This diff completes the implementation of PCI "flags", making sure
they get passed down the PCI bus hierarchy. The idea here is that a
host bridge that supports MSI will set the PCI_FLAGS_MSI_OKAY flag.
Device drivers then can check this flag before they'll attempt to use
MSI. Some PCI-PCI bridges don't support MSI. For these bridges
ppb(4) will clear the PCI_FLAGS_MSI_OKAY flag such that devices behind
it will not try to use MSI.
ok?
Index: pci.c
===
RCS file: /cvs/src/sys/dev/pci/pci.c,v
retrieving revision 1.89
diff -u -p -r1.89 pci.c
--- pci.c 12 Apr 2011 20:29:35 - 1.89
+++ pci.c 13 May 2011 21:05:11 -
@@ -167,6 +167,7 @@ pciattach(struct device *parent, struct
sc->sc_memt = pba->pba_memt;
sc->sc_dmat = pba->pba_dmat;
sc->sc_pc = pba->pba_pc;
+ sc->sc_flags = sc->sc_flags;
sc->sc_ioex = pba->pba_ioex;
sc->sc_memex = pba->pba_memex;
sc->sc_pmemex = pba->pba_pmemex;
@@ -371,7 +372,8 @@ pci_probe_device(struct pci_softc *sc, p
/* This is a simplification of the NetBSD code.
We don't support turning off I/O or memory
on broken hardware. */
- pa.pa_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
+ pa.pa_flags = sc->sc_flags;
+ pa.pa_flags |= PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
if (sc->sc_bridgetag == NULL) {
pa.pa_intrswiz = 0;
Index: pcivar.h
===
RCS file: /cvs/src/sys/dev/pci/pcivar.h,v
retrieving revision 1.63
diff -u -p -r1.63 pcivar.h
--- pcivar.h7 Sep 2010 16:21:45 - 1.63
+++ pcivar.h13 May 2011 21:05:11 -
@@ -90,6 +90,7 @@ struct pcibus_attach_args {
bus_space_tag_t pba_memt; /* pci mem space tag */
bus_dma_tag_t pba_dmat; /* DMA tag */
pci_chipset_tag_t pba_pc;
+ int pba_flags; /* flags; see below */
struct extent *pba_ioex;
struct extent *pba_memex;
@@ -163,6 +164,8 @@ struct pci_attach_args {
#definePCI_FLAGS_MRM_OKAY 0x08/* Memory Read Multiple
okay */
#definePCI_FLAGS_MWI_OKAY 0x10/* Memory Write and
Invalidate
okay */
+#definePCI_FLAGS_MSI_OKAY 0x20/* Message Signaled
Interrupts
+ okay */
/*
*
@@ -180,6 +183,7 @@ struct pci_softc {
bus_space_tag_t sc_iot, sc_memt;
bus_dma_tag_t sc_dmat;
pci_chipset_tag_t sc_pc;
+ int sc_flags;
struct extent *sc_ioex;
struct extent *sc_memex;
struct extent *sc_pmemex;
Index: ppb.c
===
RCS file: /cvs/src/sys/dev/pci/ppb.c,v
retrieving revision 1.48
diff -u -p -r1.48 ppb.c
--- ppb.c 18 Apr 2011 04:18:36 - 1.48
+++ ppb.c 13 May 2011 21:05:11 -
@@ -291,12 +291,10 @@ ppbattach(struct device *parent, struct
pba.pba_memt = pa->pa_memt;
pba.pba_dmat = pa->pa_dmat;
pba.pba_pc = pc;
+ pba.pba_flags = pa->pa_flags & ~PCI_FLAGS_MRM_OKAY;
pba.pba_ioex = sc->sc_ioex;
pba.pba_memex = sc->sc_memex;
pba.pba_pmemex = sc->sc_pmemex;
-#if 0
- pba.pba_flags = pa->pa_flags & ~PCI_FLAGS_MRM_OKAY;
-#endif
pba.pba_domain = pa->pa_domain;
pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
pba.pba_bridgeih = sc->sc_ih;