From f4fa57817e5515c639f8ecf473b58db63208cced Mon Sep 17 00:00:00 2001 From: imp Date: Sat, 1 Jun 2002 05:14:11 +0000 Subject: Use a common function to map the bogus intlines. Don't require pin be non-zero before we map bogus intlines, always do it. This fixes a number of problems on HP Omnibook computers. Tested/Reviewed by: Brooks Davis --- sys/amd64/pci/pci_cfgreg.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'sys/amd64/pci') diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index 5b8bf9b..8cabd0b 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -76,6 +76,21 @@ static int pcireg_cfgopen(void); static struct PIR_table *pci_route_table; static int pci_route_count; +/* + * Some BIOS writers seem to want to ignore the spec and put + * 0 in the intline rather than 255 to indicate none. Some use + * numbers in the range 128-254 to indicate something strange and + * apparently undocumented anywhere. Assume these are completely bogus + * and map them to 255, which means "none". + */ +static __inline__ int +pci_i386_map_intline(int line) +{ + if (line == 0 || line >= 128) + return (255); + return (line); +} + int pci_pcibios_active(void) { @@ -226,8 +241,7 @@ pci_cfgregread(int bus, int slot, int func, int reg, int bytes) if (reg == PCIR_INTLINE && bytes == 1) { line = pci_do_cfgregread(bus, slot, func, PCIR_INTLINE, 1); pin = pci_do_cfgregread(bus, slot, func, PCIR_INTPIN, 1); - if (pin != 0 && (line == 0 || line >= 128)) - return (255); + return pci_i386_map_intline(line); } #endif /* APIC_IO */ return(pci_do_cfgregread(bus, slot, func, reg, bytes)); @@ -407,15 +421,7 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int if ((pci_get_bus(*childp) == bus) && (pci_get_slot(*childp) == device) && (pci_get_intpin(*childp) == matchpin)) { - irq = pci_get_irq(*childp); - /* - * Some BIOS writers seem to want to ignore the spec and put - * 0 in the intline rather than 255 to indicate none. Once - * we've found one that matches, we break because there can - * be no others (which is why test looks a little odd). - */ - if (irq == 0) - irq = 255; + irq = pci_i386_map_intline(pci_get_irq(*childp)); if (irq != 255) PRVERB(("pci_cfgintr_search: linked (%x) to configured irq %d at %d:%d:%d\n", pe->pe_intpin[pin - 1].link, irq, -- cgit v1.1