diff options
-rw-r--r-- | sys/arch/i386/pci/pci_intr_fixup.c | 39 | ||||
-rw-r--r-- | sys/arch/i386/pci/pcibios.c | 14 | ||||
-rw-r--r-- | sys/arch/i386/pci/pcibiosvar.h | 5 |
3 files changed, 34 insertions, 24 deletions
diff --git a/sys/arch/i386/pci/pci_intr_fixup.c b/sys/arch/i386/pci/pci_intr_fixup.c index 180d14444bd..8dc53ad83da 100644 --- a/sys/arch/i386/pci/pci_intr_fixup.c +++ b/sys/arch/i386/pci/pci_intr_fixup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_intr_fixup.c,v 1.13 2001/01/28 19:56:10 mickey Exp $ */ +/* $OpenBSD: pci_intr_fixup.c,v 1.14 2001/05/12 19:12:44 mickey Exp $ */ /* $NetBSD: pci_intr_fixup.c,v 1.10 2000/08/10 21:18:27 soda Exp $ */ /* @@ -660,10 +660,12 @@ pci_intr_header_fixup(pc, tag, ihp) } int -pci_intr_fixup(pc, iot) +pci_intr_fixup(sc, pc, iot) + struct pcibios_softc *sc; pci_chipset_tag_t pc; bus_space_tag_t iot; { + struct pcibios_pir_header *pirh = &pcibios_pir_header; const struct pciintr_icu_table *piit = NULL; pcitag_t icutag; pcireg_t icuid; @@ -675,11 +677,11 @@ pci_intr_fixup(pc, iot) * if present. Otherwise, we have to look for the router * ourselves (the PCI-ISA bridge). */ - if (pcibios_pir_header.signature != 0) { - icutag = pci_make_tag(pc, pcibios_pir_header.router_bus, - PIR_DEVFUNC_DEVICE(pcibios_pir_header.router_devfunc), - PIR_DEVFUNC_FUNCTION(pcibios_pir_header.router_devfunc)); - icuid = pcibios_pir_header.compat_router; + if (pirh->signature != 0) { + icutag = pci_make_tag(pc, pirh->router_bus, + PIR_DEVFUNC_DEVICE(pirh->router_devfunc), + PIR_DEVFUNC_FUNCTION(pirh->router_devfunc)); + icuid = pirh->compat_router; if (icuid == 0 || (piit = pciintr_icu_lookup(icuid)) == NULL) { /* @@ -708,14 +710,19 @@ pci_intr_fixup(pc, iot) if (PCI_VENDOR(icuid) == 0) continue; - if ((piit = pciintr_icu_lookup(icuid))) + if ((piit = pciintr_icu_lookup(icuid))) { + pirh->compat_router = icuid; + pirh->router_bus = 0; + pirh->router_devfunc = + PIR_DEVFUNC_COMPOSE(device, 0); break; + } } } if (piit == NULL) { - printf("pcibios: no compatible PCI ICU found"); - if (pcibios_pir_header.signature != 0 && icuid != 0) + printf("%s: no compatible PCI ICU found", sc->sc_dev.dv_xname); + if (pirh->signature != 0 && icuid != 0) printf(": ICU vendor 0x%04x product 0x%04x", PCI_VENDOR(icuid), PCI_PRODUCT(icuid)); printf("\n"); @@ -727,6 +734,18 @@ pci_intr_fixup(pc, iot) return (0); /* success! */ } else return (-1); /* non-fatal */ + } else { + char devinfo[256]; + + printf("%s: PCI Interrupt Router at %03d:%02d:%01d", + sc->sc_dev.dv_xname, pirh->router_bus, + PIR_DEVFUNC_DEVICE(pirh->router_devfunc), + PIR_DEVFUNC_FUNCTION(pirh->router_devfunc)); + if (pirh->compat_router != 0) { + pci_devinfo(pirh->compat_router, 0, 0, devinfo); + printf(" (%s)", devinfo); + } + printf("\n"); } /* diff --git a/sys/arch/i386/pci/pcibios.c b/sys/arch/i386/pci/pcibios.c index 7bd9d299c0f..9de6e27fcab 100644 --- a/sys/arch/i386/pci/pcibios.c +++ b/sys/arch/i386/pci/pcibios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcibios.c,v 1.23 2001/02/28 20:33:30 mickey Exp $ */ +/* $OpenBSD: pcibios.c,v 1.24 2001/05/12 19:12:44 mickey Exp $ */ /* $NetBSD: pcibios.c,v 1.5 2000/08/01 05:23:59 uch Exp $ */ /* @@ -215,7 +215,7 @@ pcibiosattach(parent, self, aux) /* * Fixup interrupt routing. */ - rv = pci_intr_fixup(NULL, I386_BUS_SPACE_IO); + rv = pci_intr_fixup(sc, NULL, I386_BUS_SPACE_IO); switch (rv) { case -1: /* Non-fatal error. */ @@ -253,7 +253,6 @@ pcibios_pir_init(sc) pcibios_pir_table = NULL; for (pa = PCI_IRQ_TABLE_START; pa < PCI_IRQ_TABLE_END; pa += 16) { - char devinfo[256]; u_int8_t *p, cksum; struct pcibios_pir_header *pirh; int i; @@ -301,15 +300,6 @@ pcibios_pir_init(sc) bcopy(p + 32, pcibios_pir_table, pirh->tablesize - 32); pcibios_pir_table_nentries = (pirh->tablesize - 32) / 16; - printf("%s: PCI Interrupt Router at %03d:%02d:%01d", - sc->sc_dev.dv_xname, pirh->router_bus, - PIR_DEVFUNC_DEVICE(pirh->router_devfunc), - PIR_DEVFUNC_FUNCTION(pirh->router_devfunc)); - if (pirh->compat_router != 0) { - pci_devinfo(pirh->compat_router, 0, 0, devinfo); - printf(" (%s)", devinfo); - } - printf("\n"); } /* diff --git a/sys/arch/i386/pci/pcibiosvar.h b/sys/arch/i386/pci/pcibiosvar.h index a74bc33e6f7..4a68d638264 100644 --- a/sys/arch/i386/pci/pcibiosvar.h +++ b/sys/arch/i386/pci/pcibiosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcibiosvar.h,v 1.6 2001/01/27 04:59:40 mickey Exp $ */ +/* $OpenBSD: pcibiosvar.h,v 1.7 2001/05/12 19:12:44 mickey Exp $ */ /* $NetBSD: pcibios.h,v 1.2 2000/04/28 17:15:16 uch Exp $ */ /* @@ -102,6 +102,7 @@ struct pcibios_pir_header { #define PIR_DEVFUNC_DEVICE(devfunc) (((devfunc) >> 3) & 0x1f) #define PIR_DEVFUNC_FUNCTION(devfunc) ((devfunc) & 7) +#define PIR_DEVFUNC_COMPOSE(dev,func) ((((dev) &0x1f) << 3) | ((func) & 7)) void pcibios_init __P((void)); @@ -144,7 +145,7 @@ typedef const struct pciintr_icu *pciintr_icu_tag_t; #define PCIADDR_SEARCH_MEM 1 struct extent *pciaddr_search __P((int, bus_addr_t *, bus_size_t)); -int pci_intr_fixup __P((pci_chipset_tag_t, bus_space_tag_t)); +int pci_intr_fixup __P((struct pcibios_softc *, pci_chipset_tag_t, bus_space_tag_t)); int pci_bus_fixup __P((pci_chipset_tag_t, int)); void pci_addr_fixup __P((struct pcibios_softc *, pci_chipset_tag_t, int)); void pci_device_foreach __P((struct pcibios_softc *, pci_chipset_tag_t, int, |