diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-07-06 05:08:51 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-07-06 05:08:51 +0000 |
commit | 7d234422c9c97bd73d581a8badf326e45ba9a2a4 (patch) | |
tree | 84b124860b2a78952958f53f959d9916dade8214 /sys/arch | |
parent | f037e2790547fdf3132f07078735b28e19da4ff8 (diff) |
Move pci_msi_enable() out of the vpci(4) driver into the MD pci(4) code.
Soon to be used by pyro(4) as well.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/dev/pci_machdep.c | 22 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/vpci.c | 23 | ||||
-rw-r--r-- | sys/arch/sparc64/include/pci_machdep.h | 4 |
3 files changed, 25 insertions, 24 deletions
diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c index 04aae58666f..8ef8af1d4b3 100644 --- a/sys/arch/sparc64/dev/pci_machdep.c +++ b/sys/arch/sparc64/dev/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.41 2011/06/26 18:20:36 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.42 2011/07/06 05:08:50 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */ /* @@ -470,3 +470,23 @@ pci_intr_disestablish(pc, cookie) /* XXX */ printf("can't disestablish PCI interrupts yet\n"); } + +void +pci_msi_enable(pci_chipset_tag_t pc, pcitag_t tag, bus_addr_t addr, int vec) +{ + pcireg_t reg; + int off; + + if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, ®) == 0) + panic("%s: no msi capability", __func__); + + if (reg & PCI_MSI_MC_C64) { + pci_conf_write(pc, tag, off + PCI_MSI_MA, addr); + pci_conf_write(pc, tag, off + PCI_MSI_MAU32, 0); + pci_conf_write(pc, tag, off + PCI_MSI_MD64, vec); + } else { + pci_conf_write(pc, tag, off + PCI_MSI_MA, addr); + pci_conf_write(pc, tag, off + PCI_MSI_MD32, vec); + } + pci_conf_write(pc, tag, off, reg | PCI_MSI_MC_MSIE); +} diff --git a/sys/arch/sparc64/dev/vpci.c b/sys/arch/sparc64/dev/vpci.c index 427760d19c8..ec671732671 100644 --- a/sys/arch/sparc64/dev/vpci.c +++ b/sys/arch/sparc64/dev/vpci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vpci.c,v 1.8 2011/06/26 21:46:23 kettenis Exp $ */ +/* $OpenBSD: vpci.c,v 1.9 2011/07/06 05:08:50 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org> * @@ -126,7 +126,6 @@ void vpci_msi_ack(struct intrhand *); int vpci_msi_eq_intr(void *); struct msi_eq *msi_eq_alloc(bus_dma_tag_t, int); -void pci_msi_enable(pci_chipset_tag_t, pcitag_t, bus_addr_t, int); void msi_eq_free(bus_dma_tag_t t, struct msi_eq *); int vpci_dmamap_create(bus_dma_tag_t, bus_dma_tag_t, bus_size_t, int, @@ -624,26 +623,6 @@ vpci_msi_eq_intr(void *arg) return (1); } -void -pci_msi_enable(pci_chipset_tag_t pc, pcitag_t tag, bus_addr_t addr, int vec) -{ - pcireg_t reg; - int off; - - if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, ®) == 0) - panic("%s: no msi capability", __func__); - - if (reg & PCI_MSI_MC_C64) { - pci_conf_write(pc, tag, off + PCI_MSI_MA, addr); - pci_conf_write(pc, tag, off + PCI_MSI_MAU32, 0); - pci_conf_write(pc, tag, off + PCI_MSI_MD64, vec); - } else { - pci_conf_write(pc, tag, off + PCI_MSI_MA, addr); - pci_conf_write(pc, tag, off + PCI_MSI_MD32, vec); - } - pci_conf_write(pc, tag, off, reg | PCI_MSI_MC_MSIE); -} - struct msi_eq * msi_eq_alloc(bus_dma_tag_t t, int msi_eq_size) { diff --git a/sys/arch/sparc64/include/pci_machdep.h b/sys/arch/sparc64/include/pci_machdep.h index a2b82f3e3e3..20deee3a3b8 100644 --- a/sys/arch/sparc64/include/pci_machdep.h +++ b/sys/arch/sparc64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.28 2011/06/26 18:20:36 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.29 2011/07/06 05:08:50 kettenis Exp $ */ /* $NetBSD: pci_machdep.h,v 1.7 2001/07/20 00:07:14 eeh Exp $ */ /* @@ -94,6 +94,8 @@ void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int, int (*)(void *), void *, const char *); void pci_intr_disestablish(pci_chipset_tag_t, void *); +void pci_msi_enable(pci_chipset_tag_t, pcitag_t, bus_addr_t, int); + int sparc64_pci_enumerate_bus(struct pci_softc *, int (*match)(struct pci_attach_args *), struct pci_attach_args *); |