summaryrefslogtreecommitdiffstats
path: root/sys/amd64/pci
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-06-01 05:14:11 +0000
committerimp <imp@FreeBSD.org>2002-06-01 05:14:11 +0000
commitf4fa57817e5515c639f8ecf473b58db63208cced (patch)
treeded8cec618731f320780ee5ac0a80483a562c902 /sys/amd64/pci
parentbd53393ae59f07eecb219fce5aa3b4aca67ff8c0 (diff)
downloadFreeBSD-src-f4fa57817e5515c639f8ecf473b58db63208cced.zip
FreeBSD-src-f4fa57817e5515c639f8ecf473b58db63208cced.tar.gz
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
Diffstat (limited to 'sys/amd64/pci')
-rw-r--r--sys/amd64/pci/pci_cfgreg.c28
1 files changed, 17 insertions, 11 deletions
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,
OpenPOWER on IntegriCloud