x86_pci_strings.c
16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
/*
* Copyright (C) 2014 René Kijewski <rene.kijewski@fu-berlin.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @ingroup x86-irq
* @{
*
* @file
* @brief String names of PCI classes, vendors, and devices.
*
* @author René Kijewski <rene.kijewski@fu-berlin.de>
*
* @}
*/
#include "x86_pci_strings.h"
#include <stdio.h>
/* TODO: don't always include all strings */
const char *x86_pci_subclass_to_string(unsigned baseclass, unsigned subclass, unsigned interface, const char **baseclass_name)
{
static char temp_baseclass_number[7], temp_subclass_number[7];
const char *baseclass_name_null;
if (!baseclass_name) {
baseclass_name = &baseclass_name_null;
}
// "PCI LOCAL BUS SPECIFICATION, REV. 3.0"; Appendix D.
switch (baseclass) {
case 0x00:
*baseclass_name = "Device was built before Class Code definitions were finalized";
switch (subclass) {
case 0x00: return "Non-VGA";
case 0x01: return "VGA";
}
break;
case 0x01:
*baseclass_name = "Mass storage controller";
switch (subclass) {
case 0x00: return "SCSI bus controller";
case 0x01: return "IDE controller";
case 0x02: return "Floppy disk controller";
case 0x03: return "IPI bus controller";
case 0x04: return "RAID controller";
case 0x05: return "ATA controller";
case 0x06: return "Serial ATA Direct Port Access";
case 0x80: return "Other mass storage controller";
}
break;
case 0x02:
*baseclass_name = "Network controller";
switch (subclass) {
case 0x00: return "Ethernet controller";
case 0x01: return "Token Ring controller";
case 0x02: return "FDDI controller";
case 0x03: return "ATM controller";
case 0x04: return "ISDN controller";
case 0x05: return "WorldFip controller";
case 0x06: return "PICMG 2.14 Multi Computing";
case 0x80: return "Other network controller";
}
break;
case 0x03:
*baseclass_name = "Display controller";
switch (subclass) {
case 0x00: switch (interface) {
case 0x00: return "VGA-compatible controller";
case 0x01: return "8514-compatible controller";
default: return "[UNDEFINED IN ACPI 3.0]";
}
case 0x01: return "XGA coltroller";
case 0x02: return "3D controller";
case 0x80: return "Other display controller";
}
break;
case 0x04:
*baseclass_name = "Multimedia device";
switch (subclass) {
case 0x00: return "Video device";
case 0x01: return "Audio device";
case 0x02: return "Computer telephony device";
case 0x80: return "Other multimedia device";
}
break;
case 0x05:
*baseclass_name = "Memory controller";
switch (subclass) {
case 0x00: return "RAM";
case 0x01: return "Flash";
case 0x80: return "Other memory controller";
}
break;
case 0x06:
*baseclass_name = "Bridge device";
switch (subclass) {
case 0x00: return "Host bridge";
case 0x01: return "ISA bridge";
case 0x02: return "EISA bridge";
case 0x03: return "MCA bridge";
case 0x04: return "PCI-to-PCI bridge";
case 0x05: return "PCMCIA bridge";
case 0x06: return "NuBus bridge";
case 0x07: return "CardBus bridge";
case 0x08: return "RACEway bridge";
case 0x09: return "Semi-transparent PCI-to-PCI bridge";
case 0x0a: return "InfiniBand-to-PCI host bridge";
case 0x80: return "Other bridge device";
}
break;
case 0x07:
*baseclass_name = "Simple communication controller";
switch (subclass) {
case 0x00:
switch (interface) {
case 0x00: return "Generic XT-compatible serial controller";
case 0x01: return "16450-compatible serial controller";
case 0x02: return "16550-compatible serial controller";
case 0x03: return "16650-compatible serial controller";
case 0x04: return "16750-compatible serial controller";
case 0x05: return "16850-compatible serial controller";
case 0x06: return "16950-compatible serial controller";
}
break;
case 0x01:
switch (interface) {
case 0x00: return "Parallel port";
case 0x01: return "Bi-directional parallel port";
case 0x02: return "ECP 1.X compliant parallel port";
case 0x03: return "IEEE1284 controller";
case 0xef: return "IEEE1284 target device";
}
break;
case 0x02: return "Multiport serial controller";
case 0x03:
switch (interface) {
case 0x00: return "Generic modem";
case 0x01: return "Hayes compatible modem, 16450-compatible interface";
case 0x02: return "Hayes compatible modem, 16550-compatible interface";
case 0x03: return "Hayes compatible modem, 16650-compatible interface";
case 0x04: return "Hayes compatible modem, 16750-compatible interface";
}
break;
case 0x04: return "GPIB (IEEE 488.1/2) controller";
case 0x05: return "Smart Card";
case 0x80: return "Other communications device";
}
break;
case 0x08:
*baseclass_name = "Base system peripheral";
switch (subclass) {
case 0x00:
switch (interface) {
case 0x00: return "Generic 8259 PIC";
case 0x01: return "ISA PIC";
case 0x02: return "EISA PIC";
case 0x10: return "I/O APIC interrupt controller (see below)";
case 0x20: return "I/O(x) APIC interrupt controller";
}
break;
case 0x01:
switch (interface) {
case 0x00: return "Generic 8237 DMA controller";
case 0x01: return "ISA DMA controller";
case 0x02: return "EISA DMA controller";
}
break;
case 0x02:
switch (interface) {
case 0x00: return "Generic 8254 system timer";
case 0x01: return "ISA system timer";
case 0x02: return "EISA system timers (two timers)";
}
break;
case 0x03:
switch (interface) {
case 0x00: return "Generic RTC controller";
case 0x01: return "ISA RTC controller";
}
break;
case 0x04: return "Generic PCI Hot-Plug controller";
case 0x80: return "Other system peripheral";
}
break;
case 0x09:
*baseclass_name = "Input device";
switch (subclass) {
case 0x00: return "Keyboard controller";
case 0x01: return "Digitizer (pen)";
case 0x02: return "Mouse controller";
case 0x03: return "Scanner controller";
case 0x04: return "Gameport controller";
case 0x80: return "Other input controller";
}
break;
case 0x0a:
*baseclass_name = "Docking station";
switch (subclass) {
case 0x00: return "Generic docking station";
case 0x80: return "Other type of docking station";
}
break;
case 0x0b:
*baseclass_name = "Processor";
switch (subclass) {
case 0x00: return "386";
case 0x01: return "486";
case 0x02: return "Pentium";
case 0x10: return "Alpha";
case 0x20: return "PowerPC";
case 0x30: return "MIPS";
case 0x40: return "Co-processor";
}
break;
case 0x0c:
*baseclass_name = "Serial bus controller";
switch (subclass) {
case 0x00:
switch (interface) {
case 0x00: return "IEEE 1394 (FireWire)";
case 0x01: return "IEEE 1394 following the 1394 OpenHCI specification";
}
break;
case 0x01: return "ACCESS.bus";
case 0x02: return "SSA";
case 0x03:
switch (interface) {
case 0x00: return "Universal Serial Bus (USB) following the Universal Host Controller Specification";
case 0x10: return "Universal Serial Bus (USB) following the Open Host Controller Specification";
case 0x20: return "USB2 host controller following the Intel Enhanced Host Controller Interface";
case 0x80: return "Universal Serial Bus with no specific programming interface";
case 0xfe: return "USB device";
}
break;
case 0x04: return "Fibre Channel";
case 0x05: return "SMBus";
case 0x06: return "InfiniBand";
case 0x07:
switch (interface) {
case 0x00: return "IPMI SMIC Interface";
case 0x01: return "IPMI Kybd Controller Style Interface";
case 0x02: return "IPMI Block Transfer Interface";
}
break;
case 0x08: return "SERCOS Interface Standard (IEC 61491)";
case 0x09: return "CANbus";
}
break;
case 0x0d:
*baseclass_name = "Wireless controller";
switch (subclass) {
case 0x00: return "iRDA compatible controller";
case 0x01: return "Consumer IR controller";
case 0x10: return "RF controller";
case 0x11: return "Bluetooth";
case 0x12: return "Broadband";
case 0x20: return "Ethernet (802.11a)";
case 0x21: return "Ethernet (802.11b)";
case 0x80: return "Other type of wireless controller";
}
break;
case 0x0e:
*baseclass_name = "Intelligent I/O controller";
switch (subclass) {
case 0x00:
switch (interface) {
case 0x00: return "Message FIFO at offset 040h";
default: return "Intelligent I/O (I2O) Architecture Specification 1.0";
}
break;
}
break;
case 0x0f:
*baseclass_name = "Satellite communication controller";
switch (subclass) {
case 0x01: return "TV";
case 0x02: return "Audio";
case 0x03: return "Voice";
case 0x04: return "Data";
}
break;
case 0x10:
*baseclass_name = "Encryption/Decryption controller";
switch (subclass) {
case 0x00: return "Network and computing en/decryption";
case 0x10: return "Entertainment en/decryption";
case 0x80: return "Other en/decryption";
}
break;
case 0x11:
*baseclass_name = "Data acquisition and signal processing controller";
switch (subclass) {
case 0x00: return "DPIO modules";
case 0x01: return "Performance counters";
case 0x10: return "Communications synchronization plus time and frequency test/measurement";
case 0x20: return "Management card";
case 0x80: return "Other data acquisition/signal processing controllers";
}
break;
case 0xff:
*baseclass_name = "Other device";
break;
default:
snprintf(temp_baseclass_number, sizeof temp_baseclass_number, "0x%04x", baseclass);
*baseclass_name = temp_baseclass_number;
}
snprintf(temp_subclass_number, sizeof temp_subclass_number, "0x%04x", subclass);
return temp_subclass_number;
}
const char *x86_pci_device_id_to_string(unsigned vendor_id, unsigned device_id, const char **vendor_name)
{
static char temp_vendor_name[7], temp_device_name[7];
const char *vendor_name_null;
if (!vendor_name) {
vendor_name = &vendor_name_null;
}
// http://pci-ids.ucw.cz/read/PC/
// http://www.pcidatabase.com/
switch (vendor_id) {
case 0x1013:
*vendor_name = "Cirrus Logic";
switch (device_id) {
case 0x00b8: return "GD 5446";
}
break;
case 0x8086:
*vendor_name = "Intel Corporation";
switch (device_id) {
case 0x100e: return "82540EM Gigabit Ethernet Controller";
case 0x1237: return "440FX - 82441FX PMC [Natoma]";
case 0x2415: return "82801AA AC'97 Audio Controller";
case 0x2668: return "82801FB/FBM/FR/FW/FRW (ICH6 Family) HDA Controller";
case 0x7000: return "82371SB PIIX3 ISA [Natoma/Triton II]";
case 0x7010: return "82371SB PIIX3 IDE [Natoma/Triton II]";
case 0x7020: return "82371SB PIIX3 USB [Natoma/Triton II]";
case 0x7113: return "82371AB/EB/MB PIIX4 ACPI";
/* intel galileo */
/* FIXME: find out the actual names ... */
case 0x0958: return "Host Bridge";
case 0x095E: return "Legacy Bridge";
case 0x11C3: return "PCIe* Root Port 0";
case 0x11C4: return "PCIe* Root Port 1";
case 0x08A7: return "SDIO / eMMC Controller";
case 0x0936: return "HS-UART";
case 0x0939: return "USB 2.0 Device";
case 0x093A: return "USB OHCI Host Controller";
case 0x0937: return "10/100 Ethernet";
case 0x0935: return "SPI Controller";
case 0x0934: return "I2C* Controller and GPIO Controller";
}
break;
default:
snprintf(temp_vendor_name, sizeof temp_vendor_name, "0x%04x", vendor_id);
*vendor_name = temp_vendor_name;
}
snprintf(temp_device_name, sizeof temp_device_name, "0x%04x", device_id);
return temp_device_name;
}