From 2961fc5ac412eec93a03d4badbbf4e01918d864a Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sat, 9 Dec 2000 09:15:38 +0000 Subject: [PATCH] - Fix the device database parsing code so that it actually works. - Improve the formatting for devices identified by the database. - Fix the pcib_route_interrupt method definition, as an old version snuck in here somehow 8( - Remove a couple of the vendor/device IDs for PCI:ISA bridges which correctly identify themselves. Submitted by: peter --- sys/dev/pci/isa_pci.c | 2 -- sys/dev/pci/pci.c | 40 ++++++++++++++++++++++++++++++---------- sys/dev/pci/pcib_if.m | 2 +- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/sys/dev/pci/isa_pci.c b/sys/dev/pci/isa_pci.c index b7e5f7c58081..1c7ec28486af 100644 --- a/sys/dev/pci/isa_pci.c +++ b/sys/dev/pci/isa_pci.c @@ -99,7 +99,6 @@ isab_probe(device_t dev) case 0x04848086: /* Intel 82378ZB/82378IB */ case 0x122e8086: /* Intel 82371FB */ case 0x70008086: /* Intel 82371SB */ - case 0x71108086: /* Intel 82371AB */ case 0x71988086: /* Intel 82443MX */ case 0x24108086: /* Intel 82801AA (ICH) */ case 0x24208086: /* Intel 82801AB (ICH0) */ @@ -107,7 +106,6 @@ isab_probe(device_t dev) case 0x00061004: /* VLSI 82C593 */ case 0x05861106: /* VIA 82C586 */ case 0x05961106: /* VIA 82C596 PCI-ISA */ - case 0x06861106: /* VIA 82C686 PCI-ISA */ /* AcerLabs -- vendor 0x10b9 */ /* Funny : The datasheet told me vendor id is "10b8",sub-vendor */ /* id is '10b9" but the register always shows "10b9". -Foxfair */ diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 46990693278e..4395646bcb8c 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1149,7 +1149,7 @@ pci_probe_nomatch(device_t dev, device_t child) * Look for a listing for this device in a loaded device database. */ if ((device = pci_describe_device(child)) != NULL) { - printf("<%s>", device); + device_printf(dev, "<%s>", device); free(device, M_DEVBUF); } else { /* @@ -1209,26 +1209,42 @@ static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc) { char *cp = *ptr; + int left; *device = -1; *vendor = -1; - *desc = NULL; + **desc = '\0'; for (;;) { - if ((cp - pci_vendordata) >= pci_vendordata_size) + left = pci_vendordata_size - (cp - pci_vendordata); + if (left <= 0) { + *ptr = cp; return(1); + } /* vendor entry? */ - if (sscanf(cp, "%x\t%80[^\n]", vendor, *desc) == 2) + if (*cp != '\t' && sscanf(cp, "%x\t%80[^\n]", vendor, *desc) == 2) break; /* device entry? */ - if (sscanf(cp, "\t%x\t%80[^\n]", device, *desc) == 2) + if (*cp == '\t' && sscanf(cp, "%x\t%80[^\n]", device, *desc) == 2) break; /* skip to next line */ - while (*cp != '\n') + while (*cp != '\n' && left > 0) { cp++; - cp++; + left--; + } + if (*cp == '\n') { + cp++; + left--; + } } + /* skip to next line */ + while (*cp != '\n' && left > 0) { + cp++; + left--; + } + if (*cp == '\n' && left > 0) + cp++; *ptr = cp; return(0); } @@ -1262,8 +1278,10 @@ pci_describe_device(device_t dev) if ((dp = malloc(80, M_DEVBUF, M_NOWAIT)) == NULL) goto out; for (;;) { - if (pci_describe_parse_line(&line, &vendor, &device, &dp)) - goto out; + if (pci_describe_parse_line(&line, &vendor, &device, &dp)) { + *dp = 0; + break; + } if (vendor != -1) { *dp = 0; break; @@ -1271,8 +1289,10 @@ pci_describe_device(device_t dev) if (device == pci_get_device(dev)) break; } + if (dp[0] == '\0') + snprintf(dp, 80, "0x%x", pci_get_device(dev)); if ((desc = malloc(strlen(vp) + strlen(dp) + 3, M_DEVBUF, M_NOWAIT)) != NULL) - sprintf(desc, "%s%s%s", vp, (dp[0] != 0) ? ", " : "", dp); + sprintf(desc, "%s, %s", vp, dp); out: if (vp != NULL) free(vp, M_DEVBUF); diff --git a/sys/dev/pci/pcib_if.m b/sys/dev/pci/pcib_if.m index 5224778caab6..1ea253800563 100644 --- a/sys/dev/pci/pcib_if.m +++ b/sys/dev/pci/pcib_if.m @@ -75,7 +75,7 @@ METHOD void write_config { # a device's interrupt register. # METHOD int route_interrupt { + device_t pcib; device_t dev; - int device; int pin; };