- 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
This commit is contained in:
Mike Smith 2000-12-09 09:15:38 +00:00
parent 418754d037
commit 2961fc5ac4
3 changed files with 31 additions and 13 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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;
};