00001 #ifndef PCILOOKUP_H
00002
00003 #define PCILOOKUP_H
00004
00005 #ifdef PCI_TRANSLATION_ENABLE
00006
00007 struct pci_vendor
00008 {
00009 uint16_t vendor_id;
00010 char *vendor;
00011 };
00012
00013 struct pci_vendor pci_vendor_table[] = {
00014 {0x1013, "Cirrus Logic"},
00015 {0x10de, "nVidia"},
00016 {0x10EC, "Realtek"},
00017 {0x11c1, "Agere Systems"},
00018 {0x8086, "Intel"}
00019 };
00020
00021 struct pci_device
00022 {
00023 uint16_t vendor_id;
00024 uint16_t device_id;
00025 char *device;
00026 };
00027
00028 struct pci_device pci_device_table[] = {
00029 {0x1013, 0x00b8, "CL-GD5446"},
00030 {0x10ec, 0x8029, "RTL8029 - NE2K Compatible"},
00031 {0x10ec, 0x8139, "RTL8139"},
00032 {0x8086, 0x1237, "82441FX"},
00033 {0x8086, 0x7000, "82371SB_ISA"},
00034 {0x8086, 0x7010, "82371SB_IDE"},
00035 {0x8086, 0x7020, "82371SB_USB"},
00036 {0x8086, 0x7113, "82371AB/EB/MB_ACPI"}
00037 };
00038
00039
00040 #define PCI_DEVICE_TABLE_SZ (sizeof (pci_device_table) / sizeof (struct pci_device ))
00041 #define PCI_VENDOR_TABLE_SZ (sizeof (pci_vendor_table) / sizeof (struct pci_vendor))
00042
00045 const char *pci_lookup_vendor (uint16_t vendor);
00046 const char *pci_lookup_device (uint16_t vendor, uint16_t device);
00047
00048 const char *
00049 pci_lookup_vendor (uint16_t vendor)
00050 {
00051 unsigned int i;
00052 for (i = 0; i < PCI_VENDOR_TABLE_SZ; i++)
00053 {
00054 if (pci_vendor_table[i].vendor_id > vendor)
00055 break;
00056 if (pci_vendor_table[i].vendor_id == vendor)
00057 return pci_vendor_table[i].vendor;
00058 }
00059
00060 return "Unknown Vendor";
00061 }
00062
00063 const char *
00064 pci_lookup_device (uint16_t vendor, uint16_t device)
00065 {
00066 unsigned int i;
00067 for (i = 0; i < PCI_DEVICE_TABLE_SZ; i++)
00068 {
00069 if (pci_device_table[i].vendor_id > vendor)
00070 break;
00071 if (pci_device_table[i].vendor_id == vendor &&
00072 pci_device_table[i].device_id == device)
00073 return pci_device_table[i].device;
00074 }
00075
00076 return "Unknown Device";
00077 }
00078
00079 #else
00080
00081 #define pci_lookup_vendor(x) "Unknown Vendor"
00082 #define pci_lookup_device(x,y) "Unknown Device"
00083
00084 #endif
00085
00086 struct pci_class
00087 {
00088 uint8_t major;
00089 uint8_t minor;
00090 uint8_t iface;
00091 char *name;
00092 };
00093
00094 struct pci_class pci_class_table[] = {
00095 {0, 0, 0, "Pre-PCI 2.0 Non-VGA Device"},
00096 {0, 1, 0, "Pre-PCI 2.0 VGA Device"},
00097 {1, 0, 0, "SCSI Controller"},
00098 {1, 1, 0, "IDE Controller"},
00099 {1, 2, 0, "Floppy Disk Controller"},
00100 {2, 0, 0, "Ethernet"},
00101 {3, 0, 0, "VGA Controller"},
00102 {3, 1, 0, "XGA Controller"},
00103 {5, 0, 0, "Memory Controller - RAM"},
00104 {5, 1, 0, "Memory Controller - Flash"},
00105 {6, 0, 0, "PCI Host"},
00106 {6, 1, 0, "PCI-ISA Bridge"},
00107 {6, 2, 0, "PCI-EISA Bridge"},
00108 {6, 4, 0, "PCI-PCI Bridge"},
00109 {6, 5, 0, "PCI-PCMCIA Bridge"},
00110 {12, 0, 0, "Firewire Adapter"},
00111 {12, 3, 0, "USB 1.1 Controller (UHCI)"},
00112 {12, 3, 0x10, "USB 1.1 Controller (OHCI)"},
00113 {12, 3, 0x20, "USB 2.0 Controller (EHCI)"}
00114 };
00115
00116 #define PCI_CLASS_TABLE_SZ (sizeof(pci_class_table) / sizeof(struct pci_class))
00117
00118 const char *pci_lookup_class (uint8_t major, uint8_t minor, uint8_t iface);
00119 const char *
00120 pci_lookup_class (uint8_t major, uint8_t minor, uint8_t iface)
00121 {
00122 unsigned int i;
00123 for (i = 0; i < PCI_CLASS_TABLE_SZ; i++)
00124 {
00125 if (pci_class_table[i].major > major)
00126 break;
00127 if (pci_class_table[i].major != major)
00128 continue;
00129 if (pci_class_table[i].minor != minor)
00130 continue;
00131 if (pci_class_table[i].iface != iface)
00132 continue;
00133 return pci_class_table[i].name;
00134 }
00135
00136 return "Unknown Type";
00137 }
00138
00139 #endif