diff --git a/src/add-ons/kernel/bus_managers/pci/pci_info.cpp b/src/add-ons/kernel/bus_managers/pci/pci_info.cpp index 29bd88194e..b7d8b3e9f5 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci_info.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci_info.cpp @@ -21,7 +21,8 @@ void get_vendor_info(uint16 vendorID, const char **venShort, const char **venFull); -void get_device_info(uint16 vendorID, uint16 deviceID, const char **devShort, const char **devFull); +void get_device_info(uint16 vendorID, uint16 deviceID, uint16 subvendorID, + uint16 subsystemID, const char **devShort, const char **devFull); const char *get_class_info(uint8 class_base, uint8 class_sub, uint8 class_api); const char *get_capability_name(uint8 cap_id); @@ -172,7 +173,8 @@ print_info_basic(const pci_info *info, bool verbose) } const char *devShort; const char *devFull; - get_device_info(info->vendor_id, info->device_id, &devShort, &devFull); + get_device_info(info->vendor_id, info->device_id, info->u.h0.subsystem_vendor_id, info->u.h0.subsystem_id, + &devShort, &devFull); if (!devShort && !devFull) { TRACE(("PCI: device %04x: Unknown\n", info->device_id)); } else if (devShort && devFull) { @@ -679,16 +681,30 @@ get_vendor_info(uint16 vendorID, const char **venShort, const char **venFull) void -get_device_info(uint16 vendorID, uint16 deviceID, const char **devShort, const char **devFull) +get_device_info(uint16 vendorID, uint16 deviceID, + uint16 subvendorID, uint16 subsystemID, const char **devShort, const char **devFull) { - for (int i = 0; i < (int)PCI_DEVTABLE_LEN; i++) { + int i; + *devShort = NULL; + *devFull = NULL; + + // search for the device + for (i = 0; i < (int)PCI_DEVTABLE_LEN; i++) { if (PciDevTable[i].VenId == vendorID && PciDevTable[i].DevId == deviceID ) { *devShort = PciDevTable[i].Chip && PciDevTable[i].Chip[0] ? PciDevTable[i].Chip : NULL; *devFull = PciDevTable[i].ChipDesc && PciDevTable[i].ChipDesc[0] ? PciDevTable[i].ChipDesc : NULL; - return; } } - *devShort = NULL; - *devFull = NULL; + + // search for the subsystem eventually + for (; i < (int)PCI_DEVTABLE_LEN; i++) { + if (PciDevTable[i].VenId != vendorID || PciDevTable[i].DevId != deviceID) + break; + if (PciDevTable[i].SubVenId == subvendorID && PciDevTable[i].SubDevId == subsystemID ) { + *devShort = PciDevTable[i].Chip && PciDevTable[i].Chip[0] ? PciDevTable[i].Chip : NULL; + *devFull = PciDevTable[i].ChipDesc && PciDevTable[i].ChipDesc[0] ? PciDevTable[i].ChipDesc : NULL; + break; + } + } } #endif /* USE_PCI_HEADER */ diff --git a/src/preferences/devices/pci-header.awk b/src/preferences/devices/pci-header.awk index 61db7a7ae4..1e9667943c 100644 --- a/src/preferences/devices/pci-header.awk +++ b/src/preferences/devices/pci-header.awk @@ -58,10 +58,14 @@ BEGIN { device = substr($0, 8) gsub( /\"/, "\\\"", device ) + # store device ID for possible devices afterwards + deviceid = $1 devicecount++ devices[devicecount, 1] = vendorid devices[devicecount, 2] = $1 - devices[devicecount, 3] = device + devices[devicecount, 3] = 0 + devices[devicecount, 4] = 0 + devices[devicecount, 5] = device } # matches subvendor device @@ -71,9 +75,11 @@ BEGIN { gsub( /\"/, "\\\"", device ) devicecount++ - devices[devicecount, 1] = $1 - devices[devicecount, 2] = $2 - devices[devicecount, 3] = device + devices[devicecount, 1] = vendorid + devices[devicecount, 2] = deviceid + devices[devicecount, 3] = $1 + devices[devicecount, 4] = $2 + devices[devicecount, 5] = device } # match device class - store data for later @@ -123,7 +129,7 @@ END { if ( devicecount > 0 ) { - print "typedef struct _PCI_DEVTABLE\n{\n\tunsigned short VenId ;\n\tunsigned short DevId ;\n\tchar *\tChipDesc ;\n\tchar *\tChip;\n} PCI_DEVTABLE, *PPCI_DEVTABLE ;\n" > ofile + print "typedef struct _PCI_DEVTABLE\n{\n\tunsigned short VenId ;\n\tunsigned short DevId ;\n\tunsigned short\tSubVenId ;\n\tunsigned short\tSubDevId ;\n\tchar *\tChipDesc ;\n\tchar *\tChip;\n} PCI_DEVTABLE, *PPCI_DEVTABLE ;\n" > ofile print "PCI_DEVTABLE\tPciDevTable [] =\n{" > ofile for (i = 1; i <= devicecount; i++) { @@ -132,7 +138,7 @@ END { } else { formatting = "" } - printf formatting "\t{ 0x" devices[i, 1] ", 0x" devices[i, 2] ", \"" devices[i, 3] "\" }" > ofile + printf formatting "\t{ 0x" devices[i, 1] ", 0x" devices[i, 2] ", 0x" devices[i, 3] ", 0x" devices[i, 4] ", \"" devices[i, 5] "\" }" > ofile } print "\n} ;\n\n// Use this value for loop control during searching:\n#define PCI_DEVTABLE_LEN (sizeof(PciDevTable)/sizeof(PCI_DEVTABLE))\n" > ofile