aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2002-06-01 05:14:11 +0000
committerWarner Losh <imp@FreeBSD.org>2002-06-01 05:14:11 +0000
commit8ce1ab3a241850d664ab7636b7f3f980db748071 (patch)
treeded8cec618731f320780ee5ac0a80483a562c902 /sys
parent181b15f9f8565e7d5ccc273daf115cdfb7761f21 (diff)
downloadsrc-8ce1ab3a241850d664ab7636b7f3f980db748071.tar.gz
src-8ce1ab3a241850d664ab7636b7f3f980db748071.zip
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
Notes
Notes: svn path=/head/; revision=97694
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/pci/pci_cfgreg.c28
-rw-r--r--sys/i386/pci/pci_cfgreg.c28
-rw-r--r--sys/i386/pci/pci_pir.c28
3 files changed, 51 insertions, 33 deletions
diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c
index 5b8bf9b64586..8cabd0b7f49e 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,
diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c
index 5b8bf9b64586..8cabd0b7f49e 100644
--- a/sys/i386/pci/pci_cfgreg.c
+++ b/sys/i386/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,
diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c
index 5b8bf9b64586..8cabd0b7f49e 100644
--- a/sys/i386/pci/pci_pir.c
+++ b/sys/i386/pci/pci_pir.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,