]>
Commit | Line | Data |
---|---|---|
5d73d92f | 1 | /** @file\r |
2 | Main file for Pci shell Debug1 function.\r | |
3 | \r | |
0c84a69f | 4 | Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r |
231ad7d8 QS |
5 | (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r |
6 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> \r | |
5d73d92f | 7 | This program and the accompanying materials\r |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include "UefiShellDebug1CommandsLib.h"\r | |
18 | #include <Protocol/PciRootBridgeIo.h>\r | |
19 | #include <Library/ShellLib.h>\r | |
20 | #include <IndustryStandard/Pci.h>\r | |
21 | #include <IndustryStandard/Acpi.h>\r | |
22 | #include "Pci.h"\r | |
23 | \r | |
5d73d92f | 24 | //\r |
25 | // Printable strings for Pci class code\r | |
26 | //\r | |
27 | typedef struct {\r | |
28 | CHAR16 *BaseClass; // Pointer to the PCI base class string\r | |
29 | CHAR16 *SubClass; // Pointer to the PCI sub class string\r | |
30 | CHAR16 *PIFClass; // Pointer to the PCI programming interface string\r | |
31 | } PCI_CLASS_STRINGS;\r | |
32 | \r | |
33 | //\r | |
34 | // a structure holding a single entry, which also points to its lower level\r | |
35 | // class\r | |
36 | //\r | |
37 | typedef struct PCI_CLASS_ENTRY_TAG {\r | |
38 | UINT8 Code; // Class, subclass or I/F code\r | |
39 | CHAR16 *DescText; // Description string\r | |
40 | struct PCI_CLASS_ENTRY_TAG *LowerLevelClass; // Subclass or I/F if any\r | |
41 | } PCI_CLASS_ENTRY;\r | |
42 | \r | |
43 | //\r | |
44 | // Declarations of entries which contain printable strings for class codes\r | |
45 | // in PCI configuration space\r | |
46 | //\r | |
47 | PCI_CLASS_ENTRY PCIBlankEntry[];\r | |
48 | PCI_CLASS_ENTRY PCISubClass_00[];\r | |
49 | PCI_CLASS_ENTRY PCISubClass_01[];\r | |
50 | PCI_CLASS_ENTRY PCISubClass_02[];\r | |
51 | PCI_CLASS_ENTRY PCISubClass_03[];\r | |
52 | PCI_CLASS_ENTRY PCISubClass_04[];\r | |
53 | PCI_CLASS_ENTRY PCISubClass_05[];\r | |
54 | PCI_CLASS_ENTRY PCISubClass_06[];\r | |
55 | PCI_CLASS_ENTRY PCISubClass_07[];\r | |
56 | PCI_CLASS_ENTRY PCISubClass_08[];\r | |
57 | PCI_CLASS_ENTRY PCISubClass_09[];\r | |
58 | PCI_CLASS_ENTRY PCISubClass_0a[];\r | |
59 | PCI_CLASS_ENTRY PCISubClass_0b[];\r | |
60 | PCI_CLASS_ENTRY PCISubClass_0c[];\r | |
61 | PCI_CLASS_ENTRY PCISubClass_0d[];\r | |
62 | PCI_CLASS_ENTRY PCISubClass_0e[];\r | |
63 | PCI_CLASS_ENTRY PCISubClass_0f[];\r | |
64 | PCI_CLASS_ENTRY PCISubClass_10[];\r | |
65 | PCI_CLASS_ENTRY PCISubClass_11[];\r | |
f056e4c1 JC |
66 | PCI_CLASS_ENTRY PCISubClass_12[];\r |
67 | PCI_CLASS_ENTRY PCISubClass_13[];\r | |
68 | PCI_CLASS_ENTRY PCIPIFClass_0100[];\r | |
5d73d92f | 69 | PCI_CLASS_ENTRY PCIPIFClass_0101[];\r |
f056e4c1 JC |
70 | PCI_CLASS_ENTRY PCIPIFClass_0105[];\r |
71 | PCI_CLASS_ENTRY PCIPIFClass_0106[];\r | |
72 | PCI_CLASS_ENTRY PCIPIFClass_0107[];\r | |
73 | PCI_CLASS_ENTRY PCIPIFClass_0108[];\r | |
74 | PCI_CLASS_ENTRY PCIPIFClass_0109[];\r | |
5d73d92f | 75 | PCI_CLASS_ENTRY PCIPIFClass_0300[];\r |
76 | PCI_CLASS_ENTRY PCIPIFClass_0604[];\r | |
f056e4c1 JC |
77 | PCI_CLASS_ENTRY PCIPIFClass_0609[];\r |
78 | PCI_CLASS_ENTRY PCIPIFClass_060b[];\r | |
5d73d92f | 79 | PCI_CLASS_ENTRY PCIPIFClass_0700[];\r |
80 | PCI_CLASS_ENTRY PCIPIFClass_0701[];\r | |
81 | PCI_CLASS_ENTRY PCIPIFClass_0703[];\r | |
82 | PCI_CLASS_ENTRY PCIPIFClass_0800[];\r | |
83 | PCI_CLASS_ENTRY PCIPIFClass_0801[];\r | |
84 | PCI_CLASS_ENTRY PCIPIFClass_0802[];\r | |
85 | PCI_CLASS_ENTRY PCIPIFClass_0803[];\r | |
86 | PCI_CLASS_ENTRY PCIPIFClass_0904[];\r | |
87 | PCI_CLASS_ENTRY PCIPIFClass_0c00[];\r | |
88 | PCI_CLASS_ENTRY PCIPIFClass_0c03[];\r | |
f056e4c1 JC |
89 | PCI_CLASS_ENTRY PCIPIFClass_0c07[];\r |
90 | PCI_CLASS_ENTRY PCIPIFClass_0d01[];\r | |
5d73d92f | 91 | PCI_CLASS_ENTRY PCIPIFClass_0e00[];\r |
92 | \r | |
93 | //\r | |
94 | // Base class strings entries\r | |
95 | //\r | |
96 | PCI_CLASS_ENTRY gClassStringList[] = {\r | |
97 | {\r | |
98 | 0x00,\r | |
99 | L"Pre 2.0 device",\r | |
100 | PCISubClass_00\r | |
101 | },\r | |
102 | {\r | |
103 | 0x01,\r | |
104 | L"Mass Storage Controller",\r | |
105 | PCISubClass_01\r | |
106 | },\r | |
107 | {\r | |
108 | 0x02,\r | |
109 | L"Network Controller",\r | |
110 | PCISubClass_02\r | |
111 | },\r | |
112 | {\r | |
113 | 0x03,\r | |
114 | L"Display Controller",\r | |
115 | PCISubClass_03\r | |
116 | },\r | |
117 | {\r | |
118 | 0x04,\r | |
119 | L"Multimedia Device",\r | |
120 | PCISubClass_04\r | |
121 | },\r | |
122 | {\r | |
123 | 0x05,\r | |
124 | L"Memory Controller",\r | |
125 | PCISubClass_05\r | |
126 | },\r | |
127 | {\r | |
128 | 0x06,\r | |
129 | L"Bridge Device",\r | |
130 | PCISubClass_06\r | |
131 | },\r | |
132 | {\r | |
133 | 0x07,\r | |
134 | L"Simple Communications Controllers",\r | |
135 | PCISubClass_07\r | |
136 | },\r | |
137 | {\r | |
138 | 0x08,\r | |
139 | L"Base System Peripherals",\r | |
140 | PCISubClass_08\r | |
141 | },\r | |
142 | {\r | |
143 | 0x09,\r | |
144 | L"Input Devices",\r | |
145 | PCISubClass_09\r | |
146 | },\r | |
147 | {\r | |
148 | 0x0a,\r | |
149 | L"Docking Stations",\r | |
150 | PCISubClass_0a\r | |
151 | },\r | |
152 | {\r | |
153 | 0x0b,\r | |
154 | L"Processors",\r | |
155 | PCISubClass_0b\r | |
156 | },\r | |
157 | {\r | |
158 | 0x0c,\r | |
159 | L"Serial Bus Controllers",\r | |
160 | PCISubClass_0c\r | |
161 | },\r | |
162 | {\r | |
163 | 0x0d,\r | |
164 | L"Wireless Controllers",\r | |
165 | PCISubClass_0d\r | |
166 | },\r | |
167 | {\r | |
168 | 0x0e,\r | |
169 | L"Intelligent IO Controllers",\r | |
170 | PCISubClass_0e\r | |
171 | },\r | |
172 | {\r | |
173 | 0x0f,\r | |
174 | L"Satellite Communications Controllers",\r | |
175 | PCISubClass_0f\r | |
176 | },\r | |
177 | {\r | |
178 | 0x10,\r | |
179 | L"Encryption/Decryption Controllers",\r | |
180 | PCISubClass_10\r | |
181 | },\r | |
182 | {\r | |
183 | 0x11,\r | |
184 | L"Data Acquisition & Signal Processing Controllers",\r | |
185 | PCISubClass_11\r | |
186 | },\r | |
f056e4c1 JC |
187 | {\r |
188 | 0x12,\r | |
189 | L"Processing Accelerators",\r | |
190 | PCISubClass_12\r | |
191 | },\r | |
192 | {\r | |
193 | 0x13,\r | |
194 | L"Non-Essential Instrumentation",\r | |
195 | PCISubClass_13\r | |
196 | },\r | |
5d73d92f | 197 | {\r |
198 | 0xff,\r | |
199 | L"Device does not fit in any defined classes",\r | |
200 | PCIBlankEntry\r | |
201 | },\r | |
202 | {\r | |
203 | 0x00,\r | |
204 | NULL,\r | |
205 | /* null string ends the list */NULL\r | |
206 | }\r | |
207 | };\r | |
208 | \r | |
209 | //\r | |
210 | // Subclass strings entries\r | |
211 | //\r | |
212 | PCI_CLASS_ENTRY PCIBlankEntry[] = {\r | |
213 | {\r | |
214 | 0x00,\r | |
215 | L"",\r | |
216 | PCIBlankEntry\r | |
217 | },\r | |
218 | {\r | |
219 | 0x00,\r | |
220 | NULL,\r | |
221 | /* null string ends the list */NULL\r | |
222 | }\r | |
223 | };\r | |
224 | \r | |
225 | PCI_CLASS_ENTRY PCISubClass_00[] = {\r | |
226 | {\r | |
227 | 0x00,\r | |
228 | L"All devices other than VGA",\r | |
229 | PCIBlankEntry\r | |
230 | },\r | |
231 | {\r | |
232 | 0x01,\r | |
233 | L"VGA-compatible devices",\r | |
234 | PCIBlankEntry\r | |
235 | },\r | |
236 | {\r | |
237 | 0x00,\r | |
238 | NULL,\r | |
239 | /* null string ends the list */NULL\r | |
240 | }\r | |
241 | };\r | |
242 | \r | |
243 | PCI_CLASS_ENTRY PCISubClass_01[] = {\r | |
244 | {\r | |
245 | 0x00,\r | |
f056e4c1 JC |
246 | L"SCSI",\r |
247 | PCIPIFClass_0100\r | |
5d73d92f | 248 | },\r |
249 | {\r | |
250 | 0x01,\r | |
251 | L"IDE controller",\r | |
252 | PCIPIFClass_0101\r | |
253 | },\r | |
254 | {\r | |
255 | 0x02,\r | |
256 | L"Floppy disk controller",\r | |
257 | PCIBlankEntry\r | |
258 | },\r | |
259 | {\r | |
260 | 0x03,\r | |
261 | L"IPI controller",\r | |
262 | PCIBlankEntry\r | |
263 | },\r | |
264 | {\r | |
265 | 0x04,\r | |
266 | L"RAID controller",\r | |
267 | PCIBlankEntry\r | |
268 | },\r | |
f056e4c1 JC |
269 | {\r |
270 | 0x05,\r | |
271 | L"ATA controller with ADMA interface",\r | |
272 | PCIPIFClass_0105\r | |
273 | },\r | |
274 | {\r | |
275 | 0x06,\r | |
276 | L"Serial ATA controller",\r | |
277 | PCIPIFClass_0106\r | |
278 | },\r | |
279 | {\r | |
280 | 0x07,\r | |
281 | L"Serial Attached SCSI (SAS) controller ",\r | |
282 | PCIPIFClass_0107\r | |
283 | },\r | |
284 | {\r | |
285 | 0x08,\r | |
286 | L"Non-volatile memory subsystem",\r | |
287 | PCIPIFClass_0108\r | |
288 | },\r | |
289 | {\r | |
290 | 0x09,\r | |
291 | L"Universal Flash Storage (UFS) controller ",\r | |
292 | PCIPIFClass_0109\r | |
293 | },\r | |
5d73d92f | 294 | {\r |
295 | 0x80,\r | |
296 | L"Other mass storage controller",\r | |
297 | PCIBlankEntry\r | |
298 | },\r | |
299 | {\r | |
300 | 0x00,\r | |
301 | NULL,\r | |
302 | /* null string ends the list */NULL\r | |
303 | }\r | |
304 | };\r | |
305 | \r | |
306 | PCI_CLASS_ENTRY PCISubClass_02[] = {\r | |
307 | {\r | |
308 | 0x00,\r | |
309 | L"Ethernet controller",\r | |
310 | PCIBlankEntry\r | |
311 | },\r | |
312 | {\r | |
313 | 0x01,\r | |
314 | L"Token ring controller",\r | |
315 | PCIBlankEntry\r | |
316 | },\r | |
317 | {\r | |
318 | 0x02,\r | |
319 | L"FDDI controller",\r | |
320 | PCIBlankEntry\r | |
321 | },\r | |
322 | {\r | |
323 | 0x03,\r | |
324 | L"ATM controller",\r | |
325 | PCIBlankEntry\r | |
326 | },\r | |
327 | {\r | |
328 | 0x04,\r | |
329 | L"ISDN controller",\r | |
330 | PCIBlankEntry\r | |
331 | },\r | |
f056e4c1 JC |
332 | {\r |
333 | 0x05,\r | |
334 | L"WorldFip controller",\r | |
335 | PCIBlankEntry\r | |
336 | },\r | |
337 | {\r | |
338 | 0x06,\r | |
339 | L"PICMG 2.14 Multi Computing",\r | |
340 | PCIBlankEntry\r | |
341 | },\r | |
342 | {\r | |
343 | 0x07,\r | |
344 | L"InfiniBand controller",\r | |
345 | PCIBlankEntry\r | |
346 | },\r | |
5d73d92f | 347 | {\r |
348 | 0x80,\r | |
349 | L"Other network controller",\r | |
350 | PCIBlankEntry\r | |
351 | },\r | |
352 | {\r | |
353 | 0x00,\r | |
354 | NULL,\r | |
355 | /* null string ends the list */NULL\r | |
356 | }\r | |
357 | };\r | |
358 | \r | |
359 | PCI_CLASS_ENTRY PCISubClass_03[] = {\r | |
360 | {\r | |
361 | 0x00,\r | |
362 | L"VGA/8514 controller",\r | |
363 | PCIPIFClass_0300\r | |
364 | },\r | |
365 | {\r | |
366 | 0x01,\r | |
367 | L"XGA controller",\r | |
368 | PCIBlankEntry\r | |
369 | },\r | |
370 | {\r | |
371 | 0x02,\r | |
372 | L"3D controller",\r | |
373 | PCIBlankEntry\r | |
374 | },\r | |
375 | {\r | |
376 | 0x80,\r | |
377 | L"Other display controller",\r | |
378 | PCIBlankEntry\r | |
379 | },\r | |
380 | {\r | |
381 | 0x00,\r | |
382 | NULL,\r | |
383 | /* null string ends the list */PCIBlankEntry\r | |
384 | }\r | |
385 | };\r | |
386 | \r | |
387 | PCI_CLASS_ENTRY PCISubClass_04[] = {\r | |
388 | {\r | |
389 | 0x00,\r | |
390 | L"Video device",\r | |
391 | PCIBlankEntry\r | |
392 | },\r | |
393 | {\r | |
394 | 0x01,\r | |
395 | L"Audio device",\r | |
396 | PCIBlankEntry\r | |
397 | },\r | |
398 | {\r | |
399 | 0x02,\r | |
400 | L"Computer Telephony device",\r | |
401 | PCIBlankEntry\r | |
402 | },\r | |
f056e4c1 JC |
403 | {\r |
404 | 0x03,\r | |
405 | L"Mixed mode device",\r | |
406 | PCIBlankEntry\r | |
407 | },\r | |
5d73d92f | 408 | {\r |
409 | 0x80,\r | |
410 | L"Other multimedia device",\r | |
411 | PCIBlankEntry\r | |
412 | },\r | |
413 | {\r | |
414 | 0x00,\r | |
415 | NULL,\r | |
416 | /* null string ends the list */NULL\r | |
417 | }\r | |
418 | };\r | |
419 | \r | |
420 | PCI_CLASS_ENTRY PCISubClass_05[] = {\r | |
421 | {\r | |
422 | 0x00,\r | |
423 | L"RAM memory controller",\r | |
424 | PCIBlankEntry\r | |
425 | },\r | |
426 | {\r | |
427 | 0x01,\r | |
428 | L"Flash memory controller",\r | |
429 | PCIBlankEntry\r | |
430 | },\r | |
431 | {\r | |
432 | 0x80,\r | |
433 | L"Other memory controller",\r | |
434 | PCIBlankEntry\r | |
435 | },\r | |
436 | {\r | |
437 | 0x00,\r | |
438 | NULL,\r | |
439 | /* null string ends the list */NULL\r | |
440 | }\r | |
441 | };\r | |
442 | \r | |
443 | PCI_CLASS_ENTRY PCISubClass_06[] = {\r | |
444 | {\r | |
445 | 0x00,\r | |
446 | L"Host/PCI bridge",\r | |
447 | PCIBlankEntry\r | |
448 | },\r | |
449 | {\r | |
450 | 0x01,\r | |
451 | L"PCI/ISA bridge",\r | |
452 | PCIBlankEntry\r | |
453 | },\r | |
454 | {\r | |
455 | 0x02,\r | |
456 | L"PCI/EISA bridge",\r | |
457 | PCIBlankEntry\r | |
458 | },\r | |
459 | {\r | |
460 | 0x03,\r | |
461 | L"PCI/Micro Channel bridge",\r | |
462 | PCIBlankEntry\r | |
463 | },\r | |
464 | {\r | |
465 | 0x04,\r | |
466 | L"PCI/PCI bridge",\r | |
467 | PCIPIFClass_0604\r | |
468 | },\r | |
469 | {\r | |
470 | 0x05,\r | |
471 | L"PCI/PCMCIA bridge",\r | |
472 | PCIBlankEntry\r | |
473 | },\r | |
474 | {\r | |
475 | 0x06,\r | |
476 | L"NuBus bridge",\r | |
477 | PCIBlankEntry\r | |
478 | },\r | |
479 | {\r | |
480 | 0x07,\r | |
481 | L"CardBus bridge",\r | |
482 | PCIBlankEntry\r | |
483 | },\r | |
484 | {\r | |
485 | 0x08,\r | |
486 | L"RACEway bridge",\r | |
487 | PCIBlankEntry\r | |
488 | },\r | |
f056e4c1 JC |
489 | {\r |
490 | 0x09,\r | |
491 | L"Semi-transparent PCI-to-PCI bridge",\r | |
492 | PCIPIFClass_0609\r | |
493 | },\r | |
494 | {\r | |
495 | 0x0A,\r | |
496 | L"InfiniBand-to-PCI host bridge",\r | |
497 | PCIBlankEntry\r | |
498 | },\r | |
499 | {\r | |
500 | 0x0B,\r | |
501 | L"Advanced Switching to PCI host bridge",\r | |
502 | PCIPIFClass_060b\r | |
503 | },\r | |
5d73d92f | 504 | {\r |
505 | 0x80,\r | |
506 | L"Other bridge type",\r | |
507 | PCIBlankEntry\r | |
508 | },\r | |
509 | {\r | |
510 | 0x00,\r | |
511 | NULL,\r | |
512 | /* null string ends the list */NULL\r | |
513 | }\r | |
514 | };\r | |
515 | \r | |
516 | PCI_CLASS_ENTRY PCISubClass_07[] = {\r | |
517 | {\r | |
518 | 0x00,\r | |
519 | L"Serial controller",\r | |
520 | PCIPIFClass_0700\r | |
521 | },\r | |
522 | {\r | |
523 | 0x01,\r | |
524 | L"Parallel port",\r | |
525 | PCIPIFClass_0701\r | |
526 | },\r | |
527 | {\r | |
528 | 0x02,\r | |
529 | L"Multiport serial controller",\r | |
530 | PCIBlankEntry\r | |
531 | },\r | |
532 | {\r | |
533 | 0x03,\r | |
534 | L"Modem",\r | |
535 | PCIPIFClass_0703\r | |
536 | },\r | |
f056e4c1 JC |
537 | {\r |
538 | 0x04,\r | |
539 | L"GPIB (IEEE 488.1/2) controller",\r | |
540 | PCIBlankEntry\r | |
541 | },\r | |
542 | {\r | |
543 | 0x05,\r | |
544 | L"Smart Card",\r | |
545 | PCIBlankEntry\r | |
546 | },\r | |
5d73d92f | 547 | {\r |
548 | 0x80,\r | |
549 | L"Other communication device",\r | |
550 | PCIBlankEntry\r | |
551 | },\r | |
552 | {\r | |
553 | 0x00,\r | |
554 | NULL,\r | |
555 | /* null string ends the list */NULL\r | |
556 | }\r | |
557 | };\r | |
558 | \r | |
559 | PCI_CLASS_ENTRY PCISubClass_08[] = {\r | |
560 | {\r | |
561 | 0x00,\r | |
562 | L"PIC",\r | |
563 | PCIPIFClass_0800\r | |
564 | },\r | |
565 | {\r | |
566 | 0x01,\r | |
567 | L"DMA controller",\r | |
568 | PCIPIFClass_0801\r | |
569 | },\r | |
570 | {\r | |
571 | 0x02,\r | |
572 | L"System timer",\r | |
573 | PCIPIFClass_0802\r | |
574 | },\r | |
575 | {\r | |
576 | 0x03,\r | |
577 | L"RTC controller",\r | |
578 | PCIPIFClass_0803\r | |
579 | },\r | |
580 | {\r | |
581 | 0x04,\r | |
582 | L"Generic PCI Hot-Plug controller",\r | |
583 | PCIBlankEntry\r | |
584 | },\r | |
f056e4c1 JC |
585 | {\r |
586 | 0x05,\r | |
587 | L"SD Host controller",\r | |
588 | PCIBlankEntry\r | |
589 | },\r | |
590 | {\r | |
591 | 0x06,\r | |
592 | L"IOMMU",\r | |
593 | PCIBlankEntry\r | |
594 | },\r | |
595 | {\r | |
596 | 0x07,\r | |
597 | L"Root Complex Event Collector",\r | |
598 | PCIBlankEntry\r | |
599 | },\r | |
5d73d92f | 600 | {\r |
601 | 0x80,\r | |
602 | L"Other system peripheral",\r | |
603 | PCIBlankEntry\r | |
604 | },\r | |
605 | {\r | |
606 | 0x00,\r | |
607 | NULL,\r | |
608 | /* null string ends the list */NULL\r | |
609 | }\r | |
610 | };\r | |
611 | \r | |
612 | PCI_CLASS_ENTRY PCISubClass_09[] = {\r | |
613 | {\r | |
614 | 0x00,\r | |
615 | L"Keyboard controller",\r | |
616 | PCIBlankEntry\r | |
617 | },\r | |
618 | {\r | |
619 | 0x01,\r | |
620 | L"Digitizer (pen)",\r | |
621 | PCIBlankEntry\r | |
622 | },\r | |
623 | {\r | |
624 | 0x02,\r | |
625 | L"Mouse controller",\r | |
626 | PCIBlankEntry\r | |
627 | },\r | |
628 | {\r | |
629 | 0x03,\r | |
630 | L"Scanner controller",\r | |
631 | PCIBlankEntry\r | |
632 | },\r | |
633 | {\r | |
634 | 0x04,\r | |
635 | L"Gameport controller",\r | |
636 | PCIPIFClass_0904\r | |
637 | },\r | |
638 | {\r | |
639 | 0x80,\r | |
640 | L"Other input controller",\r | |
641 | PCIBlankEntry\r | |
642 | },\r | |
643 | {\r | |
644 | 0x00,\r | |
645 | NULL,\r | |
646 | /* null string ends the list */NULL\r | |
647 | }\r | |
648 | };\r | |
649 | \r | |
650 | PCI_CLASS_ENTRY PCISubClass_0a[] = {\r | |
651 | {\r | |
652 | 0x00,\r | |
653 | L"Generic docking station",\r | |
654 | PCIBlankEntry\r | |
655 | },\r | |
656 | {\r | |
657 | 0x80,\r | |
658 | L"Other type of docking station",\r | |
659 | PCIBlankEntry\r | |
660 | },\r | |
661 | {\r | |
662 | 0x00,\r | |
663 | NULL,\r | |
664 | /* null string ends the list */NULL\r | |
665 | }\r | |
666 | };\r | |
667 | \r | |
668 | PCI_CLASS_ENTRY PCISubClass_0b[] = {\r | |
669 | {\r | |
670 | 0x00,\r | |
671 | L"386",\r | |
672 | PCIBlankEntry\r | |
673 | },\r | |
674 | {\r | |
675 | 0x01,\r | |
676 | L"486",\r | |
677 | PCIBlankEntry\r | |
678 | },\r | |
679 | {\r | |
680 | 0x02,\r | |
681 | L"Pentium",\r | |
682 | PCIBlankEntry\r | |
683 | },\r | |
684 | {\r | |
685 | 0x10,\r | |
686 | L"Alpha",\r | |
687 | PCIBlankEntry\r | |
688 | },\r | |
689 | {\r | |
690 | 0x20,\r | |
691 | L"PowerPC",\r | |
692 | PCIBlankEntry\r | |
693 | },\r | |
694 | {\r | |
695 | 0x30,\r | |
696 | L"MIPS",\r | |
697 | PCIBlankEntry\r | |
698 | },\r | |
699 | {\r | |
700 | 0x40,\r | |
701 | L"Co-processor",\r | |
702 | PCIBlankEntry\r | |
703 | },\r | |
704 | {\r | |
705 | 0x80,\r | |
706 | L"Other processor",\r | |
707 | PCIBlankEntry\r | |
708 | },\r | |
709 | {\r | |
710 | 0x00,\r | |
711 | NULL,\r | |
712 | /* null string ends the list */NULL\r | |
713 | }\r | |
714 | };\r | |
715 | \r | |
716 | PCI_CLASS_ENTRY PCISubClass_0c[] = {\r | |
717 | {\r | |
718 | 0x00,\r | |
f056e4c1 JC |
719 | L"IEEE 1394",\r |
720 | PCIPIFClass_0c00\r | |
5d73d92f | 721 | },\r |
722 | {\r | |
723 | 0x01,\r | |
724 | L"ACCESS.bus",\r | |
725 | PCIBlankEntry\r | |
726 | },\r | |
727 | {\r | |
728 | 0x02,\r | |
729 | L"SSA",\r | |
730 | PCIBlankEntry\r | |
731 | },\r | |
732 | {\r | |
733 | 0x03,\r | |
734 | L"USB",\r | |
f056e4c1 | 735 | PCIPIFClass_0c03\r |
5d73d92f | 736 | },\r |
737 | {\r | |
738 | 0x04,\r | |
739 | L"Fibre Channel",\r | |
740 | PCIBlankEntry\r | |
741 | },\r | |
742 | {\r | |
743 | 0x05,\r | |
744 | L"System Management Bus",\r | |
745 | PCIBlankEntry\r | |
746 | },\r | |
f056e4c1 JC |
747 | {\r |
748 | 0x06,\r | |
749 | L"InfiniBand",\r | |
750 | PCIBlankEntry\r | |
751 | },\r | |
752 | {\r | |
753 | 0x07,\r | |
754 | L"IPMI",\r | |
755 | PCIPIFClass_0c07\r | |
756 | },\r | |
757 | {\r | |
758 | 0x08,\r | |
759 | L"SERCOS Interface Standard (IEC 61491)",\r | |
760 | PCIBlankEntry\r | |
761 | },\r | |
762 | {\r | |
763 | 0x09,\r | |
764 | L"CANbus",\r | |
765 | PCIBlankEntry\r | |
766 | },\r | |
5d73d92f | 767 | {\r |
768 | 0x80,\r | |
769 | L"Other bus type",\r | |
770 | PCIBlankEntry\r | |
771 | },\r | |
772 | {\r | |
773 | 0x00,\r | |
774 | NULL,\r | |
775 | /* null string ends the list */NULL\r | |
776 | }\r | |
777 | };\r | |
778 | \r | |
779 | PCI_CLASS_ENTRY PCISubClass_0d[] = {\r | |
780 | {\r | |
781 | 0x00,\r | |
782 | L"iRDA compatible controller",\r | |
783 | PCIBlankEntry\r | |
784 | },\r | |
785 | {\r | |
786 | 0x01,\r | |
f056e4c1 JC |
787 | L"",\r |
788 | PCIPIFClass_0d01\r | |
5d73d92f | 789 | },\r |
790 | {\r | |
791 | 0x10,\r | |
792 | L"RF controller",\r | |
793 | PCIBlankEntry\r | |
794 | },\r | |
f056e4c1 JC |
795 | {\r |
796 | 0x11,\r | |
797 | L"Bluetooth",\r | |
798 | PCIBlankEntry\r | |
799 | },\r | |
800 | {\r | |
801 | 0x12,\r | |
802 | L"Broadband",\r | |
803 | PCIBlankEntry\r | |
804 | },\r | |
805 | {\r | |
806 | 0x20,\r | |
59577231 | 807 | L"Ethernet (802.11a - 5 GHz)",\r |
f056e4c1 JC |
808 | PCIBlankEntry\r |
809 | },\r | |
810 | {\r | |
811 | 0x21,\r | |
59577231 | 812 | L"Ethernet (802.11b - 2.4 GHz)",\r |
f056e4c1 JC |
813 | PCIBlankEntry\r |
814 | },\r | |
5d73d92f | 815 | {\r |
816 | 0x80,\r | |
817 | L"Other type of wireless controller",\r | |
818 | PCIBlankEntry\r | |
819 | },\r | |
820 | {\r | |
821 | 0x00,\r | |
822 | NULL,\r | |
823 | /* null string ends the list */NULL\r | |
824 | }\r | |
825 | };\r | |
826 | \r | |
827 | PCI_CLASS_ENTRY PCISubClass_0e[] = {\r | |
828 | {\r | |
829 | 0x00,\r | |
830 | L"I2O Architecture",\r | |
831 | PCIPIFClass_0e00\r | |
832 | },\r | |
833 | {\r | |
834 | 0x00,\r | |
835 | NULL,\r | |
836 | /* null string ends the list */NULL\r | |
837 | }\r | |
838 | };\r | |
839 | \r | |
840 | PCI_CLASS_ENTRY PCISubClass_0f[] = {\r | |
841 | {\r | |
f056e4c1 | 842 | 0x01,\r |
5d73d92f | 843 | L"TV",\r |
844 | PCIBlankEntry\r | |
845 | },\r | |
846 | {\r | |
f056e4c1 | 847 | 0x02,\r |
5d73d92f | 848 | L"Audio",\r |
849 | PCIBlankEntry\r | |
850 | },\r | |
851 | {\r | |
f056e4c1 | 852 | 0x03,\r |
5d73d92f | 853 | L"Voice",\r |
854 | PCIBlankEntry\r | |
855 | },\r | |
856 | {\r | |
f056e4c1 | 857 | 0x04,\r |
5d73d92f | 858 | L"Data",\r |
859 | PCIBlankEntry\r | |
860 | },\r | |
f056e4c1 JC |
861 | {\r |
862 | 0x80,\r | |
863 | L"Other satellite communication controller",\r | |
864 | PCIBlankEntry\r | |
865 | },\r | |
5d73d92f | 866 | {\r |
867 | 0x00,\r | |
868 | NULL,\r | |
869 | /* null string ends the list */NULL\r | |
870 | }\r | |
871 | };\r | |
872 | \r | |
873 | PCI_CLASS_ENTRY PCISubClass_10[] = {\r | |
874 | {\r | |
875 | 0x00,\r | |
876 | L"Network & computing Encrypt/Decrypt",\r | |
877 | PCIBlankEntry\r | |
878 | },\r | |
879 | {\r | |
880 | 0x01,\r | |
881 | L"Entertainment Encrypt/Decrypt",\r | |
882 | PCIBlankEntry\r | |
883 | },\r | |
884 | {\r | |
885 | 0x80,\r | |
886 | L"Other Encrypt/Decrypt",\r | |
887 | PCIBlankEntry\r | |
888 | },\r | |
889 | {\r | |
890 | 0x00,\r | |
891 | NULL,\r | |
892 | /* null string ends the list */NULL\r | |
893 | }\r | |
894 | };\r | |
895 | \r | |
896 | PCI_CLASS_ENTRY PCISubClass_11[] = {\r | |
897 | {\r | |
898 | 0x00,\r | |
899 | L"DPIO modules",\r | |
900 | PCIBlankEntry\r | |
901 | },\r | |
f056e4c1 JC |
902 | {\r |
903 | 0x01,\r | |
904 | L"Performance Counters",\r | |
905 | PCIBlankEntry\r | |
906 | },\r | |
907 | {\r | |
908 | 0x10,\r | |
909 | L"Communications synchronization plus time and frequency test/measurement ",\r | |
910 | PCIBlankEntry\r | |
911 | },\r | |
912 | {\r | |
913 | 0x20,\r | |
914 | L"Management card",\r | |
915 | PCIBlankEntry\r | |
916 | },\r | |
5d73d92f | 917 | {\r |
918 | 0x80,\r | |
919 | L"Other DAQ & SP controllers",\r | |
920 | PCIBlankEntry\r | |
921 | },\r | |
922 | {\r | |
923 | 0x00,\r | |
924 | NULL,\r | |
925 | /* null string ends the list */NULL\r | |
926 | }\r | |
927 | };\r | |
928 | \r | |
f056e4c1 JC |
929 | PCI_CLASS_ENTRY PCISubClass_12[] = {\r |
930 | {\r | |
931 | 0x00,\r | |
932 | L"Processing Accelerator",\r | |
933 | PCIBlankEntry\r | |
934 | },\r | |
935 | {\r | |
936 | 0x00,\r | |
937 | NULL,\r | |
938 | /* null string ends the list */NULL\r | |
939 | }\r | |
940 | };\r | |
941 | \r | |
942 | PCI_CLASS_ENTRY PCISubClass_13[] = {\r | |
943 | {\r | |
944 | 0x00,\r | |
945 | L"Non-Essential Instrumentation Function",\r | |
946 | PCIBlankEntry\r | |
947 | },\r | |
948 | {\r | |
949 | 0x00,\r | |
950 | NULL,\r | |
951 | /* null string ends the list */NULL\r | |
952 | }\r | |
953 | };\r | |
954 | \r | |
5d73d92f | 955 | //\r |
956 | // Programming Interface entries\r | |
957 | //\r | |
f056e4c1 JC |
958 | PCI_CLASS_ENTRY PCIPIFClass_0100[] = {\r |
959 | {\r | |
960 | 0x00,\r | |
961 | L"SCSI controller",\r | |
962 | PCIBlankEntry\r | |
963 | },\r | |
964 | {\r | |
965 | 0x11,\r | |
966 | L"SCSI storage device SOP using PQI",\r | |
967 | PCIBlankEntry\r | |
968 | },\r | |
969 | {\r | |
970 | 0x12,\r | |
971 | L"SCSI controller SOP using PQI",\r | |
972 | PCIBlankEntry\r | |
973 | },\r | |
974 | {\r | |
975 | 0x13,\r | |
976 | L"SCSI storage device and controller SOP using PQI",\r | |
977 | PCIBlankEntry\r | |
978 | },\r | |
979 | {\r | |
980 | 0x21,\r | |
981 | L"SCSI storage device SOP using NVMe",\r | |
982 | PCIBlankEntry\r | |
983 | },\r | |
984 | {\r | |
985 | 0x00,\r | |
986 | NULL,\r | |
987 | /* null string ends the list */NULL\r | |
988 | }\r | |
989 | };\r | |
990 | \r | |
5d73d92f | 991 | PCI_CLASS_ENTRY PCIPIFClass_0101[] = {\r |
992 | {\r | |
993 | 0x00,\r | |
994 | L"",\r | |
995 | PCIBlankEntry\r | |
996 | },\r | |
997 | {\r | |
998 | 0x01,\r | |
999 | L"OM-primary",\r | |
1000 | PCIBlankEntry\r | |
1001 | },\r | |
1002 | {\r | |
1003 | 0x02,\r | |
1004 | L"PI-primary",\r | |
1005 | PCIBlankEntry\r | |
1006 | },\r | |
1007 | {\r | |
1008 | 0x03,\r | |
1009 | L"OM/PI-primary",\r | |
1010 | PCIBlankEntry\r | |
1011 | },\r | |
1012 | {\r | |
1013 | 0x04,\r | |
1014 | L"OM-secondary",\r | |
1015 | PCIBlankEntry\r | |
1016 | },\r | |
1017 | {\r | |
1018 | 0x05,\r | |
1019 | L"OM-primary, OM-secondary",\r | |
1020 | PCIBlankEntry\r | |
1021 | },\r | |
1022 | {\r | |
1023 | 0x06,\r | |
1024 | L"PI-primary, OM-secondary",\r | |
1025 | PCIBlankEntry\r | |
1026 | },\r | |
1027 | {\r | |
1028 | 0x07,\r | |
1029 | L"OM/PI-primary, OM-secondary",\r | |
1030 | PCIBlankEntry\r | |
1031 | },\r | |
1032 | {\r | |
1033 | 0x08,\r | |
1034 | L"OM-secondary",\r | |
1035 | PCIBlankEntry\r | |
1036 | },\r | |
1037 | {\r | |
1038 | 0x09,\r | |
1039 | L"OM-primary, PI-secondary",\r | |
1040 | PCIBlankEntry\r | |
1041 | },\r | |
1042 | {\r | |
1043 | 0x0a,\r | |
1044 | L"PI-primary, PI-secondary",\r | |
1045 | PCIBlankEntry\r | |
1046 | },\r | |
1047 | {\r | |
1048 | 0x0b,\r | |
1049 | L"OM/PI-primary, PI-secondary",\r | |
1050 | PCIBlankEntry\r | |
1051 | },\r | |
1052 | {\r | |
1053 | 0x0c,\r | |
1054 | L"OM-secondary",\r | |
1055 | PCIBlankEntry\r | |
1056 | },\r | |
1057 | {\r | |
1058 | 0x0d,\r | |
1059 | L"OM-primary, OM/PI-secondary",\r | |
1060 | PCIBlankEntry\r | |
1061 | },\r | |
1062 | {\r | |
1063 | 0x0e,\r | |
1064 | L"PI-primary, OM/PI-secondary",\r | |
1065 | PCIBlankEntry\r | |
1066 | },\r | |
1067 | {\r | |
1068 | 0x0f,\r | |
1069 | L"OM/PI-primary, OM/PI-secondary",\r | |
1070 | PCIBlankEntry\r | |
1071 | },\r | |
1072 | {\r | |
1073 | 0x80,\r | |
1074 | L"Master",\r | |
1075 | PCIBlankEntry\r | |
1076 | },\r | |
1077 | {\r | |
1078 | 0x81,\r | |
1079 | L"Master, OM-primary",\r | |
1080 | PCIBlankEntry\r | |
1081 | },\r | |
1082 | {\r | |
1083 | 0x82,\r | |
1084 | L"Master, PI-primary",\r | |
1085 | PCIBlankEntry\r | |
1086 | },\r | |
1087 | {\r | |
1088 | 0x83,\r | |
1089 | L"Master, OM/PI-primary",\r | |
1090 | PCIBlankEntry\r | |
1091 | },\r | |
1092 | {\r | |
1093 | 0x84,\r | |
1094 | L"Master, OM-secondary",\r | |
1095 | PCIBlankEntry\r | |
1096 | },\r | |
1097 | {\r | |
1098 | 0x85,\r | |
1099 | L"Master, OM-primary, OM-secondary",\r | |
1100 | PCIBlankEntry\r | |
1101 | },\r | |
1102 | {\r | |
1103 | 0x86,\r | |
1104 | L"Master, PI-primary, OM-secondary",\r | |
1105 | PCIBlankEntry\r | |
1106 | },\r | |
1107 | {\r | |
1108 | 0x87,\r | |
1109 | L"Master, OM/PI-primary, OM-secondary",\r | |
1110 | PCIBlankEntry\r | |
1111 | },\r | |
1112 | {\r | |
1113 | 0x88,\r | |
1114 | L"Master, OM-secondary",\r | |
1115 | PCIBlankEntry\r | |
1116 | },\r | |
1117 | {\r | |
1118 | 0x89,\r | |
1119 | L"Master, OM-primary, PI-secondary",\r | |
1120 | PCIBlankEntry\r | |
1121 | },\r | |
1122 | {\r | |
1123 | 0x8a,\r | |
1124 | L"Master, PI-primary, PI-secondary",\r | |
1125 | PCIBlankEntry\r | |
1126 | },\r | |
1127 | {\r | |
1128 | 0x8b,\r | |
1129 | L"Master, OM/PI-primary, PI-secondary",\r | |
1130 | PCIBlankEntry\r | |
1131 | },\r | |
1132 | {\r | |
1133 | 0x8c,\r | |
1134 | L"Master, OM-secondary",\r | |
1135 | PCIBlankEntry\r | |
1136 | },\r | |
1137 | {\r | |
1138 | 0x8d,\r | |
1139 | L"Master, OM-primary, OM/PI-secondary",\r | |
1140 | PCIBlankEntry\r | |
1141 | },\r | |
1142 | {\r | |
1143 | 0x8e,\r | |
1144 | L"Master, PI-primary, OM/PI-secondary",\r | |
1145 | PCIBlankEntry\r | |
1146 | },\r | |
1147 | {\r | |
1148 | 0x8f,\r | |
1149 | L"Master, OM/PI-primary, OM/PI-secondary",\r | |
1150 | PCIBlankEntry\r | |
1151 | },\r | |
1152 | {\r | |
1153 | 0x00,\r | |
1154 | NULL,\r | |
1155 | /* null string ends the list */NULL\r | |
1156 | }\r | |
1157 | };\r | |
1158 | \r | |
f056e4c1 JC |
1159 | PCI_CLASS_ENTRY PCIPIFClass_0105[] = {\r |
1160 | {\r | |
1161 | 0x20,\r | |
1162 | L"Single stepping",\r | |
1163 | PCIBlankEntry\r | |
1164 | },\r | |
1165 | {\r | |
1166 | 0x30,\r | |
1167 | L"Continuous operation",\r | |
1168 | PCIBlankEntry\r | |
1169 | },\r | |
1170 | {\r | |
1171 | 0x00,\r | |
1172 | NULL,\r | |
1173 | /* null string ends the list */NULL\r | |
1174 | }\r | |
1175 | };\r | |
1176 | \r | |
1177 | PCI_CLASS_ENTRY PCIPIFClass_0106[] = {\r | |
1178 | {\r | |
1179 | 0x00,\r | |
1180 | L"",\r | |
1181 | PCIBlankEntry\r | |
1182 | },\r | |
1183 | {\r | |
1184 | 0x01,\r | |
1185 | L"AHCI",\r | |
1186 | PCIBlankEntry\r | |
1187 | },\r | |
1188 | {\r | |
1189 | 0x02,\r | |
1190 | L"Serial Storage Bus",\r | |
1191 | PCIBlankEntry\r | |
1192 | },\r | |
1193 | {\r | |
1194 | 0x00,\r | |
1195 | NULL,\r | |
1196 | /* null string ends the list */NULL\r | |
1197 | }\r | |
1198 | };\r | |
1199 | \r | |
1200 | PCI_CLASS_ENTRY PCIPIFClass_0107[] = {\r | |
1201 | {\r | |
1202 | 0x00,\r | |
1203 | L"",\r | |
1204 | PCIBlankEntry\r | |
1205 | },\r | |
1206 | {\r | |
1207 | 0x01,\r | |
1208 | L"Obsolete",\r | |
1209 | PCIBlankEntry\r | |
1210 | },\r | |
1211 | {\r | |
1212 | 0x00,\r | |
1213 | NULL,\r | |
1214 | /* null string ends the list */NULL\r | |
1215 | }\r | |
1216 | };\r | |
1217 | \r | |
1218 | PCI_CLASS_ENTRY PCIPIFClass_0108[] = {\r | |
1219 | {\r | |
1220 | 0x00,\r | |
1221 | L"",\r | |
1222 | PCIBlankEntry\r | |
1223 | },\r | |
1224 | {\r | |
1225 | 0x01,\r | |
1226 | L"NVMHCI",\r | |
1227 | PCIBlankEntry\r | |
1228 | },\r | |
1229 | {\r | |
1230 | 0x02,\r | |
1231 | L"NVM Express",\r | |
1232 | PCIBlankEntry\r | |
1233 | },\r | |
1234 | {\r | |
1235 | 0x00,\r | |
1236 | NULL,\r | |
1237 | /* null string ends the list */NULL\r | |
1238 | }\r | |
1239 | };\r | |
1240 | \r | |
1241 | PCI_CLASS_ENTRY PCIPIFClass_0109[] = {\r | |
1242 | {\r | |
1243 | 0x00,\r | |
1244 | L"",\r | |
1245 | PCIBlankEntry\r | |
1246 | },\r | |
1247 | {\r | |
1248 | 0x01,\r | |
1249 | L"UFSHCI",\r | |
1250 | PCIBlankEntry\r | |
1251 | },\r | |
1252 | {\r | |
1253 | 0x00,\r | |
1254 | NULL,\r | |
1255 | /* null string ends the list */NULL\r | |
1256 | }\r | |
1257 | };\r | |
1258 | \r | |
5d73d92f | 1259 | PCI_CLASS_ENTRY PCIPIFClass_0300[] = {\r |
1260 | {\r | |
1261 | 0x00,\r | |
1262 | L"VGA compatible",\r | |
1263 | PCIBlankEntry\r | |
1264 | },\r | |
1265 | {\r | |
1266 | 0x01,\r | |
1267 | L"8514 compatible",\r | |
1268 | PCIBlankEntry\r | |
1269 | },\r | |
1270 | {\r | |
1271 | 0x00,\r | |
1272 | NULL,\r | |
1273 | /* null string ends the list */NULL\r | |
1274 | }\r | |
1275 | };\r | |
1276 | \r | |
1277 | PCI_CLASS_ENTRY PCIPIFClass_0604[] = {\r | |
1278 | {\r | |
1279 | 0x00,\r | |
1280 | L"",\r | |
1281 | PCIBlankEntry\r | |
1282 | },\r | |
1283 | {\r | |
1284 | 0x01,\r | |
1285 | L"Subtractive decode",\r | |
1286 | PCIBlankEntry\r | |
1287 | },\r | |
1288 | {\r | |
1289 | 0x00,\r | |
1290 | NULL,\r | |
1291 | /* null string ends the list */NULL\r | |
1292 | }\r | |
1293 | };\r | |
1294 | \r | |
f056e4c1 JC |
1295 | PCI_CLASS_ENTRY PCIPIFClass_0609[] = {\r |
1296 | {\r | |
1297 | 0x40,\r | |
1298 | L"Primary PCI bus side facing the system host processor",\r | |
1299 | PCIBlankEntry\r | |
1300 | },\r | |
1301 | {\r | |
1302 | 0x80,\r | |
1303 | L"Secondary PCI bus side facing the system host processor",\r | |
1304 | PCIBlankEntry\r | |
1305 | },\r | |
1306 | {\r | |
1307 | 0x00,\r | |
1308 | NULL,\r | |
1309 | /* null string ends the list */NULL\r | |
1310 | }\r | |
1311 | };\r | |
1312 | \r | |
1313 | PCI_CLASS_ENTRY PCIPIFClass_060b[] = {\r | |
1314 | {\r | |
1315 | 0x00,\r | |
1316 | L"Custom",\r | |
1317 | PCIBlankEntry\r | |
1318 | },\r | |
1319 | {\r | |
1320 | 0x01,\r | |
1321 | L"ASI-SIG Defined Portal",\r | |
1322 | PCIBlankEntry\r | |
1323 | },\r | |
1324 | {\r | |
1325 | 0x00,\r | |
1326 | NULL,\r | |
1327 | /* null string ends the list */NULL\r | |
1328 | }\r | |
1329 | };\r | |
1330 | \r | |
5d73d92f | 1331 | PCI_CLASS_ENTRY PCIPIFClass_0700[] = {\r |
1332 | {\r | |
1333 | 0x00,\r | |
1334 | L"Generic XT-compatible",\r | |
1335 | PCIBlankEntry\r | |
1336 | },\r | |
1337 | {\r | |
1338 | 0x01,\r | |
1339 | L"16450-compatible",\r | |
1340 | PCIBlankEntry\r | |
1341 | },\r | |
1342 | {\r | |
1343 | 0x02,\r | |
1344 | L"16550-compatible",\r | |
1345 | PCIBlankEntry\r | |
1346 | },\r | |
1347 | {\r | |
1348 | 0x03,\r | |
1349 | L"16650-compatible",\r | |
1350 | PCIBlankEntry\r | |
1351 | },\r | |
1352 | {\r | |
1353 | 0x04,\r | |
1354 | L"16750-compatible",\r | |
1355 | PCIBlankEntry\r | |
1356 | },\r | |
1357 | {\r | |
1358 | 0x05,\r | |
1359 | L"16850-compatible",\r | |
1360 | PCIBlankEntry\r | |
1361 | },\r | |
1362 | {\r | |
1363 | 0x06,\r | |
1364 | L"16950-compatible",\r | |
1365 | PCIBlankEntry\r | |
1366 | },\r | |
1367 | {\r | |
1368 | 0x00,\r | |
1369 | NULL,\r | |
1370 | /* null string ends the list */NULL\r | |
1371 | }\r | |
1372 | };\r | |
1373 | \r | |
1374 | PCI_CLASS_ENTRY PCIPIFClass_0701[] = {\r | |
1375 | {\r | |
1376 | 0x00,\r | |
1377 | L"",\r | |
1378 | PCIBlankEntry\r | |
1379 | },\r | |
1380 | {\r | |
1381 | 0x01,\r | |
1382 | L"Bi-directional",\r | |
1383 | PCIBlankEntry\r | |
1384 | },\r | |
1385 | {\r | |
1386 | 0x02,\r | |
1387 | L"ECP 1.X-compliant",\r | |
1388 | PCIBlankEntry\r | |
1389 | },\r | |
1390 | {\r | |
1391 | 0x03,\r | |
1392 | L"IEEE 1284",\r | |
1393 | PCIBlankEntry\r | |
1394 | },\r | |
1395 | {\r | |
1396 | 0xfe,\r | |
1397 | L"IEEE 1284 target (not a controller)",\r | |
1398 | PCIBlankEntry\r | |
1399 | },\r | |
1400 | {\r | |
1401 | 0x00,\r | |
1402 | NULL,\r | |
1403 | /* null string ends the list */NULL\r | |
1404 | }\r | |
1405 | };\r | |
1406 | \r | |
1407 | PCI_CLASS_ENTRY PCIPIFClass_0703[] = {\r | |
1408 | {\r | |
1409 | 0x00,\r | |
1410 | L"Generic",\r | |
1411 | PCIBlankEntry\r | |
1412 | },\r | |
1413 | {\r | |
1414 | 0x01,\r | |
1415 | L"Hayes-compatible 16450",\r | |
1416 | PCIBlankEntry\r | |
1417 | },\r | |
1418 | {\r | |
1419 | 0x02,\r | |
1420 | L"Hayes-compatible 16550",\r | |
1421 | PCIBlankEntry\r | |
1422 | },\r | |
1423 | {\r | |
1424 | 0x03,\r | |
1425 | L"Hayes-compatible 16650",\r | |
1426 | PCIBlankEntry\r | |
1427 | },\r | |
1428 | {\r | |
1429 | 0x04,\r | |
1430 | L"Hayes-compatible 16750",\r | |
1431 | PCIBlankEntry\r | |
1432 | },\r | |
1433 | {\r | |
1434 | 0x00,\r | |
1435 | NULL,\r | |
1436 | /* null string ends the list */NULL\r | |
1437 | }\r | |
1438 | };\r | |
1439 | \r | |
1440 | PCI_CLASS_ENTRY PCIPIFClass_0800[] = {\r | |
1441 | {\r | |
1442 | 0x00,\r | |
1443 | L"Generic 8259",\r | |
1444 | PCIBlankEntry\r | |
1445 | },\r | |
1446 | {\r | |
1447 | 0x01,\r | |
1448 | L"ISA",\r | |
1449 | PCIBlankEntry\r | |
1450 | },\r | |
1451 | {\r | |
1452 | 0x02,\r | |
1453 | L"EISA",\r | |
1454 | PCIBlankEntry\r | |
1455 | },\r | |
1456 | {\r | |
1457 | 0x10,\r | |
1458 | L"IO APIC",\r | |
1459 | PCIBlankEntry\r | |
1460 | },\r | |
1461 | {\r | |
1462 | 0x20,\r | |
1463 | L"IO(x) APIC interrupt controller",\r | |
1464 | PCIBlankEntry\r | |
1465 | },\r | |
1466 | {\r | |
1467 | 0x00,\r | |
1468 | NULL,\r | |
1469 | /* null string ends the list */NULL\r | |
1470 | }\r | |
1471 | };\r | |
1472 | \r | |
1473 | PCI_CLASS_ENTRY PCIPIFClass_0801[] = {\r | |
1474 | {\r | |
1475 | 0x00,\r | |
1476 | L"Generic 8237",\r | |
1477 | PCIBlankEntry\r | |
1478 | },\r | |
1479 | {\r | |
1480 | 0x01,\r | |
1481 | L"ISA",\r | |
1482 | PCIBlankEntry\r | |
1483 | },\r | |
1484 | {\r | |
1485 | 0x02,\r | |
1486 | L"EISA",\r | |
1487 | PCIBlankEntry\r | |
1488 | },\r | |
1489 | {\r | |
1490 | 0x00,\r | |
1491 | NULL,\r | |
1492 | /* null string ends the list */NULL\r | |
1493 | }\r | |
1494 | };\r | |
1495 | \r | |
1496 | PCI_CLASS_ENTRY PCIPIFClass_0802[] = {\r | |
1497 | {\r | |
1498 | 0x00,\r | |
1499 | L"Generic 8254",\r | |
1500 | PCIBlankEntry\r | |
1501 | },\r | |
1502 | {\r | |
1503 | 0x01,\r | |
1504 | L"ISA",\r | |
1505 | PCIBlankEntry\r | |
1506 | },\r | |
1507 | {\r | |
1508 | 0x02,\r | |
1509 | L"EISA",\r | |
1510 | PCIBlankEntry\r | |
1511 | },\r | |
1512 | {\r | |
1513 | 0x00,\r | |
1514 | NULL,\r | |
1515 | /* null string ends the list */NULL\r | |
1516 | }\r | |
1517 | };\r | |
1518 | \r | |
1519 | PCI_CLASS_ENTRY PCIPIFClass_0803[] = {\r | |
1520 | {\r | |
1521 | 0x00,\r | |
1522 | L"Generic",\r | |
1523 | PCIBlankEntry\r | |
1524 | },\r | |
1525 | {\r | |
1526 | 0x01,\r | |
1527 | L"ISA",\r | |
1528 | PCIBlankEntry\r | |
1529 | },\r | |
1530 | {\r | |
1531 | 0x02,\r | |
1532 | L"EISA",\r | |
1533 | PCIBlankEntry\r | |
1534 | },\r | |
1535 | {\r | |
1536 | 0x00,\r | |
1537 | NULL,\r | |
1538 | /* null string ends the list */NULL\r | |
1539 | }\r | |
1540 | };\r | |
1541 | \r | |
1542 | PCI_CLASS_ENTRY PCIPIFClass_0904[] = {\r | |
1543 | {\r | |
1544 | 0x00,\r | |
1545 | L"Generic",\r | |
1546 | PCIBlankEntry\r | |
1547 | },\r | |
1548 | {\r | |
1549 | 0x10,\r | |
1550 | L"",\r | |
1551 | PCIBlankEntry\r | |
1552 | },\r | |
1553 | {\r | |
1554 | 0x00,\r | |
1555 | NULL,\r | |
1556 | /* null string ends the list */NULL\r | |
1557 | }\r | |
1558 | };\r | |
1559 | \r | |
1560 | PCI_CLASS_ENTRY PCIPIFClass_0c00[] = {\r | |
1561 | {\r | |
1562 | 0x00,\r | |
f056e4c1 JC |
1563 | L"",\r |
1564 | PCIBlankEntry\r | |
1565 | },\r | |
1566 | {\r | |
1567 | 0x10,\r | |
1568 | L"Using 1394 OpenHCI spec",\r | |
1569 | PCIBlankEntry\r | |
1570 | },\r | |
1571 | {\r | |
1572 | 0x00,\r | |
1573 | NULL,\r | |
1574 | /* null string ends the list */NULL\r | |
1575 | }\r | |
1576 | };\r | |
1577 | \r | |
1578 | PCI_CLASS_ENTRY PCIPIFClass_0c03[] = {\r | |
1579 | {\r | |
1580 | 0x00,\r | |
1581 | L"UHCI",\r | |
5d73d92f | 1582 | PCIBlankEntry\r |
1583 | },\r | |
1584 | {\r | |
1585 | 0x10,\r | |
f056e4c1 JC |
1586 | L"OHCI",\r |
1587 | PCIBlankEntry\r | |
1588 | },\r | |
1589 | {\r | |
1590 | 0x20,\r | |
1591 | L"EHCI",\r | |
1592 | PCIBlankEntry\r | |
1593 | },\r | |
1594 | {\r | |
1595 | 0x30,\r | |
1596 | L"xHCI",\r | |
5d73d92f | 1597 | PCIBlankEntry\r |
1598 | },\r | |
1599 | {\r | |
1600 | 0x80,\r | |
1601 | L"No specific programming interface",\r | |
1602 | PCIBlankEntry\r | |
1603 | },\r | |
1604 | {\r | |
1605 | 0xfe,\r | |
1606 | L"(Not Host Controller)",\r | |
1607 | PCIBlankEntry\r | |
1608 | },\r | |
1609 | {\r | |
1610 | 0x00,\r | |
1611 | NULL,\r | |
1612 | /* null string ends the list */NULL\r | |
1613 | }\r | |
1614 | };\r | |
1615 | \r | |
f056e4c1 | 1616 | PCI_CLASS_ENTRY PCIPIFClass_0c07[] = {\r |
5d73d92f | 1617 | {\r |
1618 | 0x00,\r | |
f056e4c1 JC |
1619 | L"SMIC",\r |
1620 | PCIBlankEntry\r | |
1621 | },\r | |
1622 | {\r | |
1623 | 0x01,\r | |
1624 | L"Keyboard Controller Style",\r | |
1625 | PCIBlankEntry\r | |
1626 | },\r | |
1627 | {\r | |
1628 | 0x02,\r | |
1629 | L"Block Transfer",\r | |
1630 | PCIBlankEntry\r | |
1631 | },\r | |
1632 | {\r | |
1633 | 0x00,\r | |
1634 | NULL,\r | |
1635 | /* null string ends the list */NULL\r | |
1636 | }\r | |
1637 | };\r | |
1638 | \r | |
1639 | PCI_CLASS_ENTRY PCIPIFClass_0d01[] = {\r | |
1640 | {\r | |
1641 | 0x00,\r | |
1642 | L"Consumer IR controller",\r | |
5d73d92f | 1643 | PCIBlankEntry\r |
1644 | },\r | |
1645 | {\r | |
1646 | 0x10,\r | |
f056e4c1 | 1647 | L"UWB Radio controller",\r |
5d73d92f | 1648 | PCIBlankEntry\r |
1649 | },\r | |
1650 | {\r | |
1651 | 0x00,\r | |
1652 | NULL,\r | |
1653 | /* null string ends the list */NULL\r | |
1654 | }\r | |
1655 | };\r | |
1656 | \r | |
1657 | PCI_CLASS_ENTRY PCIPIFClass_0e00[] = {\r | |
1658 | {\r | |
1659 | 0x00,\r | |
1660 | L"Message FIFO at offset 40h",\r | |
1661 | PCIBlankEntry\r | |
1662 | },\r | |
1663 | {\r | |
1664 | 0x01,\r | |
1665 | L"",\r | |
1666 | PCIBlankEntry\r | |
1667 | },\r | |
1668 | {\r | |
1669 | 0x00,\r | |
1670 | NULL,\r | |
1671 | /* null string ends the list */NULL\r | |
1672 | }\r | |
1673 | };\r | |
1674 | \r | |
5d73d92f | 1675 | \r |
a1d4bfcc | 1676 | /**\r |
5d73d92f | 1677 | Generates printable Unicode strings that represent PCI device class,\r |
1678 | subclass and programmed I/F based on a value passed to the function.\r | |
1679 | \r | |
a1d4bfcc | 1680 | @param[in] ClassCode Value representing the PCI "Class Code" register read from a\r |
5d73d92f | 1681 | PCI device. The encodings are:\r |
1682 | bits 23:16 - Base Class Code\r | |
1683 | bits 15:8 - Sub-Class Code\r | |
1684 | bits 7:0 - Programming Interface\r | |
4ff7e37b | 1685 | @param[in, out] ClassStrings Pointer of PCI_CLASS_STRINGS structure, which contains\r |
5d73d92f | 1686 | printable class strings corresponding to ClassCode. The\r |
1687 | caller must not modify the strings that are pointed by\r | |
1688 | the fields in ClassStrings.\r | |
5d73d92f | 1689 | **/\r |
a1d4bfcc | 1690 | VOID\r |
1691 | PciGetClassStrings (\r | |
1692 | IN UINT32 ClassCode,\r | |
1693 | IN OUT PCI_CLASS_STRINGS *ClassStrings\r | |
1694 | )\r | |
5d73d92f | 1695 | {\r |
1696 | INTN Index;\r | |
1697 | UINT8 Code;\r | |
1698 | PCI_CLASS_ENTRY *CurrentClass;\r | |
1699 | \r | |
1700 | //\r | |
1701 | // Assume no strings found\r | |
1702 | //\r | |
1703 | ClassStrings->BaseClass = L"UNDEFINED";\r | |
1704 | ClassStrings->SubClass = L"UNDEFINED";\r | |
1705 | ClassStrings->PIFClass = L"UNDEFINED";\r | |
1706 | \r | |
1707 | CurrentClass = gClassStringList;\r | |
1708 | Code = (UINT8) (ClassCode >> 16);\r | |
1709 | Index = 0;\r | |
1710 | \r | |
1711 | //\r | |
1712 | // Go through all entries of the base class, until the entry with a matching\r | |
1713 | // base class code is found. If reaches an entry with a null description\r | |
1714 | // text, the last entry is met, which means no text for the base class was\r | |
1715 | // found, so no more action is needed.\r | |
1716 | //\r | |
1717 | while (Code != CurrentClass[Index].Code) {\r | |
1718 | if (NULL == CurrentClass[Index].DescText) {\r | |
1719 | return ;\r | |
1720 | }\r | |
1721 | \r | |
1722 | Index++;\r | |
1723 | }\r | |
1724 | //\r | |
1725 | // A base class was found. Assign description, and check if this class has\r | |
1726 | // sub-class defined. If sub-class defined, no more action is needed,\r | |
1727 | // otherwise, continue to find description for the sub-class code.\r | |
1728 | //\r | |
1729 | ClassStrings->BaseClass = CurrentClass[Index].DescText;\r | |
1730 | if (NULL == CurrentClass[Index].LowerLevelClass) {\r | |
1731 | return ;\r | |
1732 | }\r | |
1733 | //\r | |
1734 | // find Subclass entry\r | |
1735 | //\r | |
1736 | CurrentClass = CurrentClass[Index].LowerLevelClass;\r | |
1737 | Code = (UINT8) (ClassCode >> 8);\r | |
1738 | Index = 0;\r | |
1739 | \r | |
1740 | //\r | |
1741 | // Go through all entries of the sub-class, until the entry with a matching\r | |
1742 | // sub-class code is found. If reaches an entry with a null description\r | |
1743 | // text, the last entry is met, which means no text for the sub-class was\r | |
1744 | // found, so no more action is needed.\r | |
1745 | //\r | |
1746 | while (Code != CurrentClass[Index].Code) {\r | |
1747 | if (NULL == CurrentClass[Index].DescText) {\r | |
1748 | return ;\r | |
1749 | }\r | |
1750 | \r | |
1751 | Index++;\r | |
1752 | }\r | |
1753 | //\r | |
1754 | // A class was found for the sub-class code. Assign description, and check if\r | |
1755 | // this sub-class has programming interface defined. If no, no more action is\r | |
1756 | // needed, otherwise, continue to find description for the programming\r | |
1757 | // interface.\r | |
1758 | //\r | |
1759 | ClassStrings->SubClass = CurrentClass[Index].DescText;\r | |
1760 | if (NULL == CurrentClass[Index].LowerLevelClass) {\r | |
1761 | return ;\r | |
1762 | }\r | |
1763 | //\r | |
1764 | // Find programming interface entry\r | |
1765 | //\r | |
1766 | CurrentClass = CurrentClass[Index].LowerLevelClass;\r | |
1767 | Code = (UINT8) ClassCode;\r | |
1768 | Index = 0;\r | |
1769 | \r | |
1770 | //\r | |
1771 | // Go through all entries of the I/F entries, until the entry with a\r | |
1772 | // matching I/F code is found. If reaches an entry with a null description\r | |
1773 | // text, the last entry is met, which means no text was found, so no more\r | |
1774 | // action is needed.\r | |
1775 | //\r | |
1776 | while (Code != CurrentClass[Index].Code) {\r | |
1777 | if (NULL == CurrentClass[Index].DescText) {\r | |
1778 | return ;\r | |
1779 | }\r | |
1780 | \r | |
1781 | Index++;\r | |
1782 | }\r | |
1783 | //\r | |
1784 | // A class was found for the I/F code. Assign description, done!\r | |
1785 | //\r | |
1786 | ClassStrings->PIFClass = CurrentClass[Index].DescText;\r | |
1787 | return ;\r | |
1788 | }\r | |
1789 | \r | |
a1d4bfcc | 1790 | /**\r |
1791 | Print strings that represent PCI device class, subclass and programmed I/F.\r | |
1792 | \r | |
1793 | @param[in] ClassCodePtr Points to the memory which stores register Class Code in PCI\r | |
e8a57ade | 1794 | configuration space.\r |
a1d4bfcc | 1795 | @param[in] IncludePIF If the printed string should include the programming I/F part\r |
1796 | **/\r | |
5d73d92f | 1797 | VOID\r |
1798 | PciPrintClassCode (\r | |
1799 | IN UINT8 *ClassCodePtr,\r | |
1800 | IN BOOLEAN IncludePIF\r | |
1801 | )\r | |
5d73d92f | 1802 | {\r |
1803 | UINT32 ClassCode;\r | |
1804 | PCI_CLASS_STRINGS ClassStrings;\r | |
5d73d92f | 1805 | \r |
1806 | ClassCode = 0;\r | |
e8a57ade JC |
1807 | ClassCode |= (UINT32)ClassCodePtr[0];\r |
1808 | ClassCode |= (UINT32)(ClassCodePtr[1] << 8);\r | |
1809 | ClassCode |= (UINT32)(ClassCodePtr[2] << 16);\r | |
5d73d92f | 1810 | \r |
1811 | //\r | |
1812 | // Get name from class code\r | |
1813 | //\r | |
1814 | PciGetClassStrings (ClassCode, &ClassStrings);\r | |
1815 | \r | |
1816 | if (IncludePIF) {\r | |
1817 | //\r | |
c37e0f16 | 1818 | // Print base class, sub class, and programming inferface name\r |
5d73d92f | 1819 | //\r |
c37e0f16 | 1820 | ShellPrintEx (-1, -1, L"%s - %s - %s",\r |
5d73d92f | 1821 | ClassStrings.BaseClass,\r |
1822 | ClassStrings.SubClass,\r | |
1823 | ClassStrings.PIFClass\r | |
1824 | );\r | |
1825 | \r | |
1826 | } else {\r | |
1827 | //\r | |
c37e0f16 | 1828 | // Only print base class and sub class name\r |
5d73d92f | 1829 | //\r |
c37e0f16 | 1830 | ShellPrintEx (-1, -1, L"%s - %s",\r |
5d73d92f | 1831 | ClassStrings.BaseClass,\r |
1832 | ClassStrings.SubClass\r | |
c37e0f16 | 1833 | );\r |
5d73d92f | 1834 | }\r |
1835 | }\r | |
1836 | \r | |
a1d4bfcc | 1837 | /**\r |
1838 | This function finds out the protocol which is in charge of the given\r | |
1839 | segment, and its bus range covers the current bus number. It lookes\r | |
1840 | each instances of RootBridgeIoProtocol handle, until the one meets the\r | |
1841 | criteria is found.\r | |
1842 | \r | |
1843 | @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r | |
1844 | @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r | |
1845 | @param[in] Segment Segment number of device we are dealing with.\r | |
1846 | @param[in] Bus Bus number of device we are dealing with.\r | |
1847 | @param[out] IoDev Handle used to access configuration space of PCI device.\r | |
1848 | \r | |
1849 | @retval EFI_SUCCESS The command completed successfully.\r | |
1850 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
5d73d92f | 1851 | \r |
a1d4bfcc | 1852 | **/\r |
5d73d92f | 1853 | EFI_STATUS\r |
1854 | PciFindProtocolInterface (\r | |
1855 | IN EFI_HANDLE *HandleBuf,\r | |
1856 | IN UINTN HandleCount,\r | |
1857 | IN UINT16 Segment,\r | |
1858 | IN UINT16 Bus,\r | |
1859 | OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev\r | |
1860 | );\r | |
1861 | \r | |
a1d4bfcc | 1862 | /**\r |
1863 | This function gets the protocol interface from the given handle, and\r | |
1864 | obtains its address space descriptors.\r | |
1865 | \r | |
1866 | @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle.\r | |
1867 | @param[out] IoDev Handle used to access configuration space of PCI device.\r | |
1868 | @param[out] Descriptors Points to the address space descriptors.\r | |
1869 | \r | |
1870 | @retval EFI_SUCCESS The command completed successfully\r | |
1871 | **/\r | |
5d73d92f | 1872 | EFI_STATUS\r |
1873 | PciGetProtocolAndResource (\r | |
1874 | IN EFI_HANDLE Handle,\r | |
1875 | OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,\r | |
1876 | OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors\r | |
1877 | );\r | |
1878 | \r | |
a1d4bfcc | 1879 | /**\r |
1880 | This function get the next bus range of given address space descriptors.\r | |
1881 | It also moves the pointer backward a node, to get prepared to be called\r | |
1882 | again.\r | |
1883 | \r | |
4ff7e37b ED |
1884 | @param[in, out] Descriptors Points to current position of a serial of address space\r |
1885 | descriptors.\r | |
1886 | @param[out] MinBus The lower range of bus number.\r | |
1887 | @param[out] MaxBus The upper range of bus number.\r | |
1888 | @param[out] IsEnd Meet end of the serial of descriptors.\r | |
a1d4bfcc | 1889 | \r |
1890 | @retval EFI_SUCCESS The command completed successfully.\r | |
1891 | **/\r | |
5d73d92f | 1892 | EFI_STATUS\r |
1893 | PciGetNextBusRange (\r | |
1894 | IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r | |
1895 | OUT UINT16 *MinBus,\r | |
1896 | OUT UINT16 *MaxBus,\r | |
1897 | OUT BOOLEAN *IsEnd\r | |
1898 | );\r | |
1899 | \r | |
a1d4bfcc | 1900 | /**\r |
1901 | Explain the data in PCI configuration space. The part which is common for\r | |
1902 | PCI device and bridge is interpreted in this function. It calls other\r | |
1903 | functions to interpret data unique for device or bridge.\r | |
1904 | \r | |
1905 | @param[in] ConfigSpace Data in PCI configuration space.\r | |
1906 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
1907 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
f614ce7e | 1908 | @param[in] EnhancedDump The print format for the dump data.\r |
a1d4bfcc | 1909 | \r |
1910 | @retval EFI_SUCCESS The command completed successfully.\r | |
1911 | **/\r | |
5d73d92f | 1912 | EFI_STATUS\r |
1913 | PciExplainData (\r | |
1914 | IN PCI_CONFIG_SPACE *ConfigSpace,\r | |
1915 | IN UINT64 Address,\r | |
705bffb5 JC |
1916 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r |
1917 | IN CONST UINT16 EnhancedDump\r | |
5d73d92f | 1918 | );\r |
1919 | \r | |
a1d4bfcc | 1920 | /**\r |
1921 | Explain the device specific part of data in PCI configuration space.\r | |
1922 | \r | |
1923 | @param[in] Device Data in PCI configuration space.\r | |
1924 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
1925 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
1926 | \r | |
1927 | @retval EFI_SUCCESS The command completed successfully.\r | |
1928 | **/\r | |
5d73d92f | 1929 | EFI_STATUS\r |
1930 | PciExplainDeviceData (\r | |
0c84a69f | 1931 | IN PCI_DEVICE_HEADER_TYPE_REGION *Device,\r |
5d73d92f | 1932 | IN UINT64 Address,\r |
1933 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r | |
1934 | );\r | |
1935 | \r | |
a1d4bfcc | 1936 | /**\r |
1937 | Explain the bridge specific part of data in PCI configuration space.\r | |
1938 | \r | |
1939 | @param[in] Bridge Bridge specific data region in PCI configuration space.\r | |
1940 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
1941 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
1942 | \r | |
1943 | @retval EFI_SUCCESS The command completed successfully.\r | |
1944 | **/\r | |
5d73d92f | 1945 | EFI_STATUS\r |
1946 | PciExplainBridgeData (\r | |
0c84a69f | 1947 | IN PCI_BRIDGE_CONTROL_REGISTER *Bridge,\r |
a1d4bfcc | 1948 | IN UINT64 Address,\r |
1949 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r | |
5d73d92f | 1950 | );\r |
1951 | \r | |
a1d4bfcc | 1952 | /**\r |
1953 | Explain the Base Address Register(Bar) in PCI configuration space.\r | |
1954 | \r | |
4ff7e37b ED |
1955 | @param[in] Bar Points to the Base Address Register intended to interpret.\r |
1956 | @param[in] Command Points to the register Command.\r | |
1957 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
1958 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
1959 | @param[in, out] Index The Index.\r | |
a1d4bfcc | 1960 | \r |
1961 | @retval EFI_SUCCESS The command completed successfully.\r | |
1962 | **/\r | |
5d73d92f | 1963 | EFI_STATUS\r |
1964 | PciExplainBar (\r | |
1965 | IN UINT32 *Bar,\r | |
1966 | IN UINT16 *Command,\r | |
1967 | IN UINT64 Address,\r | |
1968 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r | |
1969 | IN OUT UINTN *Index\r | |
1970 | );\r | |
1971 | \r | |
a1d4bfcc | 1972 | /**\r |
1973 | Explain the cardbus specific part of data in PCI configuration space.\r | |
1974 | \r | |
1975 | @param[in] CardBus CardBus specific region of PCI configuration space.\r | |
1976 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
1977 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
1978 | \r | |
1979 | @retval EFI_SUCCESS The command completed successfully.\r | |
1980 | **/\r | |
5d73d92f | 1981 | EFI_STATUS\r |
1982 | PciExplainCardBusData (\r | |
0c84a69f | 1983 | IN PCI_CARDBUS_CONTROL_REGISTER *CardBus,\r |
5d73d92f | 1984 | IN UINT64 Address,\r |
1985 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r | |
1986 | );\r | |
1987 | \r | |
a1d4bfcc | 1988 | /**\r |
1989 | Explain each meaningful bit of register Status. The definition of Status is\r | |
1990 | slightly different depending on the PCI header type.\r | |
1991 | \r | |
1992 | @param[in] Status Points to the content of register Status.\r | |
1993 | @param[in] MainStatus Indicates if this register is main status(not secondary\r | |
1994 | status).\r | |
1995 | @param[in] HeaderType Header type of this PCI device.\r | |
1996 | \r | |
1997 | @retval EFI_SUCCESS The command completed successfully.\r | |
1998 | **/\r | |
5d73d92f | 1999 | EFI_STATUS\r |
2000 | PciExplainStatus (\r | |
2001 | IN UINT16 *Status,\r | |
2002 | IN BOOLEAN MainStatus,\r | |
2003 | IN PCI_HEADER_TYPE HeaderType\r | |
2004 | );\r | |
2005 | \r | |
a1d4bfcc | 2006 | /**\r |
2007 | Explain each meaningful bit of register Command.\r | |
2008 | \r | |
2009 | @param[in] Command Points to the content of register Command.\r | |
2010 | \r | |
2011 | @retval EFI_SUCCESS The command completed successfully.\r | |
2012 | **/\r | |
5d73d92f | 2013 | EFI_STATUS\r |
2014 | PciExplainCommand (\r | |
2015 | IN UINT16 *Command\r | |
2016 | );\r | |
2017 | \r | |
a1d4bfcc | 2018 | /**\r |
2019 | Explain each meaningful bit of register Bridge Control.\r | |
2020 | \r | |
2021 | @param[in] BridgeControl Points to the content of register Bridge Control.\r | |
2022 | @param[in] HeaderType The headertype.\r | |
2023 | \r | |
2024 | @retval EFI_SUCCESS The command completed successfully.\r | |
2025 | **/\r | |
5d73d92f | 2026 | EFI_STATUS\r |
2027 | PciExplainBridgeControl (\r | |
2028 | IN UINT16 *BridgeControl,\r | |
2029 | IN PCI_HEADER_TYPE HeaderType\r | |
2030 | );\r | |
2031 | \r | |
a1d4bfcc | 2032 | /**\r |
2033 | Print each capability structure.\r | |
2034 | \r | |
f614ce7e SQ |
2035 | @param[in] IoDev The pointer to the deivce.\r |
2036 | @param[in] Address The address to start at.\r | |
2037 | @param[in] CapPtr The offset from the address.\r | |
2038 | @param[in] EnhancedDump The print format for the dump data.\r | |
a1d4bfcc | 2039 | \r |
f614ce7e | 2040 | @retval EFI_SUCCESS The operation was successful.\r |
a1d4bfcc | 2041 | **/\r |
5d73d92f | 2042 | EFI_STATUS\r |
2043 | PciExplainCapabilityStruct (\r | |
2044 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r | |
2045 | IN UINT64 Address,\r | |
705bffb5 JC |
2046 | IN UINT8 CapPtr,\r |
2047 | IN CONST UINT16 EnhancedDump\r | |
5d73d92f | 2048 | );\r |
2049 | \r | |
a1d4bfcc | 2050 | /**\r |
2051 | Display Pcie device structure.\r | |
2052 | \r | |
f614ce7e SQ |
2053 | @param[in] IoDev The pointer to the root pci protocol.\r |
2054 | @param[in] Address The Address to start at.\r | |
2055 | @param[in] CapabilityPtr The offset from the address to start.\r | |
2056 | @param[in] EnhancedDump The print format for the dump data.\r | |
2057 | \r | |
2058 | @retval EFI_SUCCESS The command completed successfully.\r | |
2059 | @retval @retval EFI_SUCCESS Pci express extend space IO is not suppoted. \r | |
a1d4bfcc | 2060 | **/\r |
5d73d92f | 2061 | EFI_STATUS\r |
2062 | PciExplainPciExpress (\r | |
2063 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r | |
2064 | IN UINT64 Address,\r | |
705bffb5 JC |
2065 | IN UINT8 CapabilityPtr,\r |
2066 | IN CONST UINT16 EnhancedDump\r | |
5d73d92f | 2067 | );\r |
2068 | \r | |
a1d4bfcc | 2069 | /**\r |
2070 | Print out information of the capability information.\r | |
2071 | \r | |
2072 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
2073 | \r | |
2074 | @retval EFI_SUCCESS The operation was successful.\r | |
2075 | **/\r | |
5d73d92f | 2076 | EFI_STATUS\r |
2077 | ExplainPcieCapReg (\r | |
0c84a69f | 2078 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2079 | );\r |
2080 | \r | |
2081 | /**\r | |
2082 | Print out information of the device capability information.\r | |
2083 | \r | |
2084 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
5d73d92f | 2085 | \r |
a1d4bfcc | 2086 | @retval EFI_SUCCESS The operation was successful.\r |
2087 | **/\r | |
5d73d92f | 2088 | EFI_STATUS\r |
2089 | ExplainPcieDeviceCap (\r | |
0c84a69f | 2090 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2091 | );\r |
2092 | \r | |
2093 | /**\r | |
2094 | Print out information of the device control information.\r | |
5d73d92f | 2095 | \r |
a1d4bfcc | 2096 | @param[in] PciExpressCap The pointer to the structure about the device.\r |
2097 | \r | |
2098 | @retval EFI_SUCCESS The operation was successful.\r | |
2099 | **/\r | |
5d73d92f | 2100 | EFI_STATUS\r |
2101 | ExplainPcieDeviceControl (\r | |
0c84a69f | 2102 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2103 | );\r |
5d73d92f | 2104 | \r |
a1d4bfcc | 2105 | /**\r |
2106 | Print out information of the device status information.\r | |
2107 | \r | |
2108 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
2109 | \r | |
2110 | @retval EFI_SUCCESS The operation was successful.\r | |
2111 | **/\r | |
5d73d92f | 2112 | EFI_STATUS\r |
2113 | ExplainPcieDeviceStatus (\r | |
0c84a69f | 2114 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2115 | );\r |
2116 | \r | |
2117 | /**\r | |
2118 | Print out information of the device link information.\r | |
2119 | \r | |
2120 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
5d73d92f | 2121 | \r |
a1d4bfcc | 2122 | @retval EFI_SUCCESS The operation was successful.\r |
2123 | **/\r | |
5d73d92f | 2124 | EFI_STATUS\r |
2125 | ExplainPcieLinkCap (\r | |
0c84a69f | 2126 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2127 | );\r |
2128 | \r | |
2129 | /**\r | |
2130 | Print out information of the device link control information.\r | |
5d73d92f | 2131 | \r |
a1d4bfcc | 2132 | @param[in] PciExpressCap The pointer to the structure about the device.\r |
2133 | \r | |
2134 | @retval EFI_SUCCESS The operation was successful.\r | |
2135 | **/\r | |
5d73d92f | 2136 | EFI_STATUS\r |
2137 | ExplainPcieLinkControl (\r | |
0c84a69f | 2138 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2139 | );\r |
5d73d92f | 2140 | \r |
a1d4bfcc | 2141 | /**\r |
2142 | Print out information of the device link status information.\r | |
2143 | \r | |
2144 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
2145 | \r | |
2146 | @retval EFI_SUCCESS The operation was successful.\r | |
2147 | **/\r | |
5d73d92f | 2148 | EFI_STATUS\r |
2149 | ExplainPcieLinkStatus (\r | |
0c84a69f | 2150 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2151 | );\r |
2152 | \r | |
2153 | /**\r | |
2154 | Print out information of the device slot information.\r | |
2155 | \r | |
2156 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
5d73d92f | 2157 | \r |
a1d4bfcc | 2158 | @retval EFI_SUCCESS The operation was successful.\r |
2159 | **/\r | |
5d73d92f | 2160 | EFI_STATUS\r |
2161 | ExplainPcieSlotCap (\r | |
0c84a69f | 2162 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2163 | );\r |
2164 | \r | |
2165 | /**\r | |
2166 | Print out information of the device slot control information.\r | |
5d73d92f | 2167 | \r |
a1d4bfcc | 2168 | @param[in] PciExpressCap The pointer to the structure about the device.\r |
2169 | \r | |
2170 | @retval EFI_SUCCESS The operation was successful.\r | |
2171 | **/\r | |
5d73d92f | 2172 | EFI_STATUS\r |
2173 | ExplainPcieSlotControl (\r | |
0c84a69f | 2174 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2175 | );\r |
5d73d92f | 2176 | \r |
a1d4bfcc | 2177 | /**\r |
2178 | Print out information of the device slot status information.\r | |
2179 | \r | |
2180 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
2181 | \r | |
2182 | @retval EFI_SUCCESS The operation was successful.\r | |
2183 | **/\r | |
5d73d92f | 2184 | EFI_STATUS\r |
2185 | ExplainPcieSlotStatus (\r | |
0c84a69f | 2186 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2187 | );\r |
2188 | \r | |
2189 | /**\r | |
2190 | Print out information of the device root information.\r | |
2191 | \r | |
2192 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
5d73d92f | 2193 | \r |
a1d4bfcc | 2194 | @retval EFI_SUCCESS The operation was successful.\r |
2195 | **/\r | |
5d73d92f | 2196 | EFI_STATUS\r |
2197 | ExplainPcieRootControl (\r | |
0c84a69f | 2198 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2199 | );\r |
2200 | \r | |
2201 | /**\r | |
2202 | Print out information of the device root capability information.\r | |
5d73d92f | 2203 | \r |
a1d4bfcc | 2204 | @param[in] PciExpressCap The pointer to the structure about the device.\r |
2205 | \r | |
2206 | @retval EFI_SUCCESS The operation was successful.\r | |
2207 | **/\r | |
5d73d92f | 2208 | EFI_STATUS\r |
2209 | ExplainPcieRootCap (\r | |
0c84a69f | 2210 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2211 | );\r |
5d73d92f | 2212 | \r |
a1d4bfcc | 2213 | /**\r |
2214 | Print out information of the device root status information.\r | |
2215 | \r | |
2216 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
2217 | \r | |
2218 | @retval EFI_SUCCESS The operation was successful.\r | |
2219 | **/\r | |
5d73d92f | 2220 | EFI_STATUS\r |
2221 | ExplainPcieRootStatus (\r | |
0c84a69f | 2222 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 2223 | );\r |
5d73d92f | 2224 | \r |
0c84a69f | 2225 | typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (IN PCI_CAPABILITY_PCIEXP *PciExpressCap);\r |
5d73d92f | 2226 | \r |
2227 | typedef enum {\r | |
2228 | FieldWidthUINT8,\r | |
2229 | FieldWidthUINT16,\r | |
2230 | FieldWidthUINT32\r | |
2231 | } PCIE_CAPREG_FIELD_WIDTH;\r | |
2232 | \r | |
2233 | typedef enum {\r | |
2234 | PcieExplainTypeCommon,\r | |
2235 | PcieExplainTypeDevice,\r | |
2236 | PcieExplainTypeLink,\r | |
2237 | PcieExplainTypeSlot,\r | |
2238 | PcieExplainTypeRoot,\r | |
2239 | PcieExplainTypeMax\r | |
2240 | } PCIE_EXPLAIN_TYPE;\r | |
2241 | \r | |
2242 | typedef struct\r | |
2243 | {\r | |
2244 | UINT16 Token;\r | |
2245 | UINTN Offset;\r | |
2246 | PCIE_CAPREG_FIELD_WIDTH Width;\r | |
2247 | PCIE_EXPLAIN_FUNCTION Func;\r | |
2248 | PCIE_EXPLAIN_TYPE Type;\r | |
2249 | } PCIE_EXPLAIN_STRUCT;\r | |
2250 | \r | |
2251 | PCIE_EXPLAIN_STRUCT PcieExplainList[] = {\r | |
2252 | {\r | |
2253 | STRING_TOKEN (STR_PCIEX_CAPABILITY_CAPID),\r | |
2254 | 0x00,\r | |
2255 | FieldWidthUINT8,\r | |
2256 | NULL,\r | |
2257 | PcieExplainTypeCommon\r | |
2258 | },\r | |
2259 | {\r | |
2260 | STRING_TOKEN (STR_PCIEX_NEXTCAP_PTR),\r | |
2261 | 0x01,\r | |
2262 | FieldWidthUINT8,\r | |
2263 | NULL,\r | |
2264 | PcieExplainTypeCommon\r | |
2265 | },\r | |
2266 | {\r | |
2267 | STRING_TOKEN (STR_PCIEX_CAP_REGISTER),\r | |
2268 | 0x02,\r | |
2269 | FieldWidthUINT16,\r | |
2270 | ExplainPcieCapReg,\r | |
2271 | PcieExplainTypeCommon\r | |
2272 | },\r | |
2273 | {\r | |
2274 | STRING_TOKEN (STR_PCIEX_DEVICE_CAP),\r | |
2275 | 0x04,\r | |
2276 | FieldWidthUINT32,\r | |
2277 | ExplainPcieDeviceCap,\r | |
2278 | PcieExplainTypeDevice\r | |
2279 | },\r | |
2280 | {\r | |
2281 | STRING_TOKEN (STR_PCIEX_DEVICE_CONTROL),\r | |
2282 | 0x08,\r | |
2283 | FieldWidthUINT16,\r | |
2284 | ExplainPcieDeviceControl,\r | |
2285 | PcieExplainTypeDevice\r | |
2286 | },\r | |
2287 | {\r | |
2288 | STRING_TOKEN (STR_PCIEX_DEVICE_STATUS),\r | |
2289 | 0x0a,\r | |
2290 | FieldWidthUINT16,\r | |
2291 | ExplainPcieDeviceStatus,\r | |
2292 | PcieExplainTypeDevice\r | |
2293 | },\r | |
2294 | {\r | |
2295 | STRING_TOKEN (STR_PCIEX_LINK_CAPABILITIES),\r | |
2296 | 0x0c,\r | |
2297 | FieldWidthUINT32,\r | |
2298 | ExplainPcieLinkCap,\r | |
2299 | PcieExplainTypeLink\r | |
2300 | },\r | |
2301 | {\r | |
2302 | STRING_TOKEN (STR_PCIEX_LINK_CONTROL),\r | |
2303 | 0x10,\r | |
2304 | FieldWidthUINT16,\r | |
2305 | ExplainPcieLinkControl,\r | |
2306 | PcieExplainTypeLink\r | |
2307 | },\r | |
2308 | {\r | |
2309 | STRING_TOKEN (STR_PCIEX_LINK_STATUS),\r | |
2310 | 0x12,\r | |
2311 | FieldWidthUINT16,\r | |
2312 | ExplainPcieLinkStatus,\r | |
2313 | PcieExplainTypeLink\r | |
2314 | },\r | |
2315 | {\r | |
2316 | STRING_TOKEN (STR_PCIEX_SLOT_CAPABILITIES),\r | |
2317 | 0x14,\r | |
2318 | FieldWidthUINT32,\r | |
2319 | ExplainPcieSlotCap,\r | |
2320 | PcieExplainTypeSlot\r | |
2321 | },\r | |
2322 | {\r | |
2323 | STRING_TOKEN (STR_PCIEX_SLOT_CONTROL),\r | |
2324 | 0x18,\r | |
2325 | FieldWidthUINT16,\r | |
2326 | ExplainPcieSlotControl,\r | |
2327 | PcieExplainTypeSlot\r | |
2328 | },\r | |
2329 | {\r | |
2330 | STRING_TOKEN (STR_PCIEX_SLOT_STATUS),\r | |
2331 | 0x1a,\r | |
2332 | FieldWidthUINT16,\r | |
2333 | ExplainPcieSlotStatus,\r | |
2334 | PcieExplainTypeSlot\r | |
2335 | },\r | |
2336 | {\r | |
2337 | STRING_TOKEN (STR_PCIEX_ROOT_CONTROL),\r | |
2338 | 0x1c,\r | |
2339 | FieldWidthUINT16,\r | |
2340 | ExplainPcieRootControl,\r | |
2341 | PcieExplainTypeRoot\r | |
2342 | },\r | |
2343 | {\r | |
2344 | STRING_TOKEN (STR_PCIEX_RSVDP),\r | |
2345 | 0x1e,\r | |
2346 | FieldWidthUINT16,\r | |
2347 | ExplainPcieRootCap,\r | |
2348 | PcieExplainTypeRoot\r | |
2349 | },\r | |
2350 | {\r | |
2351 | STRING_TOKEN (STR_PCIEX_ROOT_STATUS),\r | |
2352 | 0x20,\r | |
2353 | FieldWidthUINT32,\r | |
2354 | ExplainPcieRootStatus,\r | |
2355 | PcieExplainTypeRoot\r | |
2356 | },\r | |
2357 | {\r | |
2358 | 0,\r | |
2359 | 0,\r | |
2360 | (PCIE_CAPREG_FIELD_WIDTH)0,\r | |
2361 | NULL,\r | |
2362 | PcieExplainTypeMax\r | |
2363 | }\r | |
2364 | };\r | |
2365 | \r | |
2366 | //\r | |
2367 | // Global Variables\r | |
2368 | //\r | |
2369 | PCI_CONFIG_SPACE *mConfigSpace = NULL;\r | |
2370 | STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r | |
2371 | {L"-s", TypeValue},\r | |
2372 | {L"-i", TypeFlag},\r | |
c831a2c3 | 2373 | {L"-ec", TypeValue},\r |
5d73d92f | 2374 | {NULL, TypeMax}\r |
2375 | };\r | |
2376 | \r | |
2377 | CHAR16 *DevicePortTypeTable[] = {\r | |
2378 | L"PCI Express Endpoint",\r | |
2379 | L"Legacy PCI Express Endpoint",\r | |
2380 | L"Unknown Type",\r | |
2381 | L"Unknonw Type",\r | |
2382 | L"Root Port of PCI Express Root Complex",\r | |
2383 | L"Upstream Port of PCI Express Switch",\r | |
2384 | L"Downstream Port of PCI Express Switch",\r | |
2385 | L"PCI Express to PCI/PCI-X Bridge",\r | |
2386 | L"PCI/PCI-X to PCI Express Bridge",\r | |
2387 | L"Root Complex Integrated Endpoint",\r | |
2388 | L"Root Complex Event Collector"\r | |
2389 | };\r | |
2390 | \r | |
2391 | CHAR16 *L0sLatencyStrTable[] = {\r | |
2392 | L"Less than 64ns",\r | |
2393 | L"64ns to less than 128ns",\r | |
2394 | L"128ns to less than 256ns",\r | |
2395 | L"256ns to less than 512ns",\r | |
2396 | L"512ns to less than 1us",\r | |
2397 | L"1us to less than 2us",\r | |
2398 | L"2us-4us",\r | |
2399 | L"More than 4us"\r | |
2400 | };\r | |
2401 | \r | |
2402 | CHAR16 *L1LatencyStrTable[] = {\r | |
2403 | L"Less than 1us",\r | |
2404 | L"1us to less than 2us",\r | |
2405 | L"2us to less than 4us",\r | |
2406 | L"4us to less than 8us",\r | |
2407 | L"8us to less than 16us",\r | |
2408 | L"16us to less than 32us",\r | |
2409 | L"32us-64us",\r | |
2410 | L"More than 64us"\r | |
2411 | };\r | |
2412 | \r | |
2413 | CHAR16 *ASPMCtrlStrTable[] = {\r | |
2414 | L"Disabled",\r | |
2415 | L"L0s Entry Enabled",\r | |
2416 | L"L1 Entry Enabled",\r | |
2417 | L"L0s and L1 Entry Enabled"\r | |
2418 | };\r | |
2419 | \r | |
2420 | CHAR16 *SlotPwrLmtScaleTable[] = {\r | |
2421 | L"1.0x",\r | |
2422 | L"0.1x",\r | |
2423 | L"0.01x",\r | |
2424 | L"0.001x"\r | |
2425 | };\r | |
2426 | \r | |
2427 | CHAR16 *IndicatorTable[] = {\r | |
2428 | L"Reserved",\r | |
2429 | L"On",\r | |
2430 | L"Blink",\r | |
2431 | L"Off"\r | |
2432 | };\r | |
2433 | \r | |
2434 | \r | |
a1d4bfcc | 2435 | /**\r |
2436 | Function for 'pci' command.\r | |
2437 | \r | |
2438 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
2439 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
2440 | **/\r | |
5d73d92f | 2441 | SHELL_STATUS\r |
2442 | EFIAPI\r | |
2443 | ShellCommandRunPci (\r | |
2444 | IN EFI_HANDLE ImageHandle,\r | |
2445 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
2446 | )\r | |
2447 | {\r | |
2448 | UINT16 Segment;\r | |
2449 | UINT16 Bus;\r | |
2450 | UINT16 Device;\r | |
2451 | UINT16 Func;\r | |
2452 | UINT64 Address;\r | |
2453 | EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev;\r | |
2454 | EFI_STATUS Status;\r | |
0c84a69f | 2455 | PCI_DEVICE_INDEPENDENT_REGION PciHeader;\r |
5d73d92f | 2456 | PCI_CONFIG_SPACE ConfigSpace;\r |
2457 | UINTN ScreenCount;\r | |
2458 | UINTN TempColumn;\r | |
2459 | UINTN ScreenSize;\r | |
2460 | BOOLEAN ExplainData;\r | |
2461 | UINTN Index;\r | |
2462 | UINTN SizeOfHeader;\r | |
2463 | BOOLEAN PrintTitle;\r | |
2464 | UINTN HandleBufSize;\r | |
2465 | EFI_HANDLE *HandleBuf;\r | |
2466 | UINTN HandleCount;\r | |
2467 | EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;\r | |
2468 | UINT16 MinBus;\r | |
2469 | UINT16 MaxBus;\r | |
2470 | BOOLEAN IsEnd;\r | |
2471 | LIST_ENTRY *Package;\r | |
2472 | CHAR16 *ProblemParam;\r | |
2473 | SHELL_STATUS ShellStatus;\r | |
5d73d92f | 2474 | CONST CHAR16 *Temp;\r |
6855763e | 2475 | UINT64 RetVal;\r |
705bffb5 | 2476 | UINT16 EnhancedDump;\r |
5d73d92f | 2477 | \r |
2478 | ShellStatus = SHELL_SUCCESS;\r | |
2479 | Status = EFI_SUCCESS;\r | |
2480 | Address = 0;\r | |
5d73d92f | 2481 | IoDev = NULL;\r |
2482 | HandleBuf = NULL;\r | |
2483 | Package = NULL;\r | |
2484 | \r | |
2485 | //\r | |
2486 | // initialize the shell lib (we must be in non-auto-init...)\r | |
2487 | //\r | |
2488 | Status = ShellInitialize();\r | |
2489 | ASSERT_EFI_ERROR(Status);\r | |
2490 | \r | |
2491 | Status = CommandInit();\r | |
2492 | ASSERT_EFI_ERROR(Status);\r | |
2493 | \r | |
2494 | //\r | |
2495 | // parse the command line\r | |
2496 | //\r | |
2497 | Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r | |
2498 | if (EFI_ERROR(Status)) {\r | |
2499 | if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r | |
4092a8f6 | 2500 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"pci", ProblemParam); \r |
5d73d92f | 2501 | FreePool(ProblemParam);\r |
2502 | ShellStatus = SHELL_INVALID_PARAMETER;\r | |
2503 | } else {\r | |
2504 | ASSERT(FALSE);\r | |
2505 | }\r | |
2506 | } else {\r | |
2507 | \r | |
3737ac2b | 2508 | if (ShellCommandLineGetCount(Package) == 2) {\r |
4092a8f6 | 2509 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"pci"); \r |
3737ac2b | 2510 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2511 | goto Done;\r | |
2512 | }\r | |
5d73d92f | 2513 | \r |
3737ac2b | 2514 | if (ShellCommandLineGetCount(Package) > 4) {\r |
4092a8f6 | 2515 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"pci"); \r |
3737ac2b | 2516 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2517 | goto Done;\r | |
2518 | }\r | |
c831a2c3 RN |
2519 | if (ShellCommandLineGetFlag(Package, L"-ec") && ShellCommandLineGetValue(Package, L"-ec") == NULL) {\r |
2520 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-ec"); \r | |
2521 | ShellStatus = SHELL_INVALID_PARAMETER;\r | |
2522 | goto Done;\r | |
2523 | }\r | |
3737ac2b | 2524 | if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetValue(Package, L"-s") == NULL) {\r |
4092a8f6 | 2525 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-s"); \r |
3737ac2b | 2526 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2527 | goto Done;\r | |
2528 | }\r | |
5d73d92f | 2529 | //\r |
2530 | // Get all instances of PciRootBridgeIo. Allocate space for 1 EFI_HANDLE and\r | |
2531 | // call LibLocateHandle(), if EFI_BUFFER_TOO_SMALL is returned, allocate enough\r | |
2532 | // space for handles and call it again.\r | |
2533 | //\r | |
2534 | HandleBufSize = sizeof (EFI_HANDLE);\r | |
3737ac2b | 2535 | HandleBuf = (EFI_HANDLE *) AllocateZeroPool (HandleBufSize);\r |
5d73d92f | 2536 | if (HandleBuf == NULL) {\r |
4092a8f6 | 2537 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci"); \r |
5d73d92f | 2538 | ShellStatus = SHELL_OUT_OF_RESOURCES;\r |
2539 | goto Done;\r | |
2540 | }\r | |
2541 | \r | |
2542 | Status = gBS->LocateHandle (\r | |
2543 | ByProtocol,\r | |
2544 | &gEfiPciRootBridgeIoProtocolGuid,\r | |
2545 | NULL,\r | |
2546 | &HandleBufSize,\r | |
2547 | HandleBuf\r | |
2548 | );\r | |
2549 | \r | |
2550 | if (Status == EFI_BUFFER_TOO_SMALL) {\r | |
2551 | HandleBuf = ReallocatePool (sizeof (EFI_HANDLE), HandleBufSize, HandleBuf);\r | |
2552 | if (HandleBuf == NULL) {\r | |
4092a8f6 | 2553 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"pci"); \r |
5d73d92f | 2554 | ShellStatus = SHELL_OUT_OF_RESOURCES;\r |
2555 | goto Done;\r | |
2556 | }\r | |
2557 | \r | |
2558 | Status = gBS->LocateHandle (\r | |
2559 | ByProtocol,\r | |
2560 | &gEfiPciRootBridgeIoProtocolGuid,\r | |
2561 | NULL,\r | |
2562 | &HandleBufSize,\r | |
2563 | HandleBuf\r | |
2564 | );\r | |
2565 | }\r | |
2566 | \r | |
2567 | if (EFI_ERROR (Status)) {\r | |
4092a8f6 | 2568 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"pci"); \r |
5d73d92f | 2569 | ShellStatus = SHELL_NOT_FOUND;\r |
2570 | goto Done;\r | |
2571 | }\r | |
2572 | \r | |
2573 | HandleCount = HandleBufSize / sizeof (EFI_HANDLE);\r | |
2574 | //\r | |
2575 | // Argument Count == 1(no other argument): enumerate all pci functions\r | |
2576 | //\r | |
3737ac2b | 2577 | if (ShellCommandLineGetCount(Package) == 1) {\r |
5d73d92f | 2578 | gST->ConOut->QueryMode (\r |
2579 | gST->ConOut,\r | |
2580 | gST->ConOut->Mode->Mode,\r | |
2581 | &TempColumn,\r | |
2582 | &ScreenSize\r | |
2583 | );\r | |
2584 | \r | |
2585 | ScreenCount = 0;\r | |
2586 | ScreenSize -= 4;\r | |
2587 | if ((ScreenSize & 1) == 1) {\r | |
2588 | ScreenSize -= 1;\r | |
2589 | }\r | |
2590 | \r | |
2591 | PrintTitle = TRUE;\r | |
2592 | \r | |
2593 | //\r | |
2594 | // For each handle, which decides a segment and a bus number range,\r | |
2595 | // enumerate all devices on it.\r | |
2596 | //\r | |
2597 | for (Index = 0; Index < HandleCount; Index++) {\r | |
2598 | Status = PciGetProtocolAndResource (\r | |
2599 | HandleBuf[Index],\r | |
2600 | &IoDev,\r | |
2601 | &Descriptors\r | |
2602 | );\r | |
2603 | if (EFI_ERROR (Status)) {\r | |
4092a8f6 | 2604 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_HANDLE_CFG_ERR), gShellDebug1HiiHandle, L"pci"); \r |
5d73d92f | 2605 | ShellStatus = SHELL_NOT_FOUND;\r |
2606 | goto Done;\r | |
2607 | }\r | |
2608 | //\r | |
2609 | // No document say it's impossible for a RootBridgeIo protocol handle\r | |
2610 | // to have more than one address space descriptors, so find out every\r | |
2611 | // bus range and for each of them do device enumeration.\r | |
2612 | //\r | |
2613 | while (TRUE) {\r | |
2614 | Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);\r | |
2615 | \r | |
2616 | if (EFI_ERROR (Status)) {\r | |
4092a8f6 | 2617 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_BUS_RANGE_ERR), gShellDebug1HiiHandle, L"pci"); \r |
5d73d92f | 2618 | ShellStatus = SHELL_NOT_FOUND;\r |
2619 | goto Done;\r | |
2620 | }\r | |
2621 | \r | |
2622 | if (IsEnd) {\r | |
2623 | break;\r | |
2624 | }\r | |
2625 | \r | |
2626 | for (Bus = MinBus; Bus <= MaxBus; Bus++) {\r | |
2627 | //\r | |
2628 | // For each devices, enumerate all functions it contains\r | |
2629 | //\r | |
2630 | for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {\r | |
2631 | //\r | |
2632 | // For each function, read its configuration space and print summary\r | |
2633 | //\r | |
2634 | for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {\r | |
2635 | if (ShellGetExecutionBreakFlag ()) {\r | |
2636 | ShellStatus = SHELL_ABORTED;\r | |
2637 | goto Done;\r | |
2638 | }\r | |
0c84a69f | 2639 | Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);\r |
5d73d92f | 2640 | IoDev->Pci.Read (\r |
2641 | IoDev,\r | |
2642 | EfiPciWidthUint16,\r | |
2643 | Address,\r | |
2644 | 1,\r | |
2645 | &PciHeader.VendorId\r | |
2646 | );\r | |
2647 | \r | |
2648 | //\r | |
2649 | // If VendorId = 0xffff, there does not exist a device at this\r | |
2650 | // location. For each device, if there is any function on it,\r | |
2651 | // there must be 1 function at Function 0. So if Func = 0, there\r | |
2652 | // will be no more functions in the same device, so we can break\r | |
2653 | // loop to deal with the next device.\r | |
2654 | //\r | |
2655 | if (PciHeader.VendorId == 0xffff && Func == 0) {\r | |
2656 | break;\r | |
2657 | }\r | |
2658 | \r | |
2659 | if (PciHeader.VendorId != 0xffff) {\r | |
2660 | \r | |
2661 | if (PrintTitle) {\r | |
2662 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_TITLE), gShellDebug1HiiHandle);\r | |
2663 | PrintTitle = FALSE;\r | |
2664 | }\r | |
2665 | \r | |
2666 | IoDev->Pci.Read (\r | |
2667 | IoDev,\r | |
2668 | EfiPciWidthUint32,\r | |
2669 | Address,\r | |
2670 | sizeof (PciHeader) / sizeof (UINT32),\r | |
2671 | &PciHeader\r | |
2672 | );\r | |
2673 | \r | |
2674 | ShellPrintHiiEx(\r | |
2675 | -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P1), gShellDebug1HiiHandle,\r | |
2676 | IoDev->SegmentNumber,\r | |
2677 | Bus,\r | |
2678 | Device,\r | |
2679 | Func\r | |
2680 | );\r | |
2681 | \r | |
2682 | PciPrintClassCode (PciHeader.ClassCode, FALSE);\r | |
2683 | ShellPrintHiiEx(\r | |
2684 | -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P2), gShellDebug1HiiHandle,\r | |
2685 | PciHeader.VendorId,\r | |
2686 | PciHeader.DeviceId,\r | |
2687 | PciHeader.ClassCode[0]\r | |
2688 | );\r | |
2689 | \r | |
2690 | ScreenCount += 2;\r | |
2691 | if (ScreenCount >= ScreenSize && ScreenSize != 0) {\r | |
2692 | //\r | |
2693 | // If ScreenSize == 0 we have the console redirected so don't\r | |
2694 | // block updates\r | |
2695 | //\r | |
2696 | ScreenCount = 0;\r | |
2697 | }\r | |
2698 | //\r | |
2699 | // If this is not a multi-function device, we can leave the loop\r | |
2700 | // to deal with the next device.\r | |
2701 | //\r | |
2702 | if (Func == 0 && ((PciHeader.HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00)) {\r | |
2703 | break;\r | |
2704 | }\r | |
2705 | }\r | |
2706 | }\r | |
2707 | }\r | |
2708 | }\r | |
2709 | //\r | |
2710 | // If Descriptor is NULL, Configuration() returns EFI_UNSUPPRORED,\r | |
2711 | // we assume the bus range is 0~PCI_MAX_BUS. After enumerated all\r | |
2712 | // devices on all bus, we can leave loop.\r | |
2713 | //\r | |
2714 | if (Descriptors == NULL) {\r | |
2715 | break;\r | |
2716 | }\r | |
2717 | }\r | |
2718 | }\r | |
2719 | \r | |
2720 | Status = EFI_SUCCESS;\r | |
2721 | goto Done;\r | |
2722 | }\r | |
2723 | \r | |
5d73d92f | 2724 | ExplainData = FALSE;\r |
2725 | Segment = 0;\r | |
2726 | Bus = 0;\r | |
2727 | Device = 0;\r | |
2728 | Func = 0;\r | |
2729 | if (ShellCommandLineGetFlag(Package, L"-i")) {\r | |
2730 | ExplainData = TRUE;\r | |
2731 | }\r | |
2732 | \r | |
2733 | Temp = ShellCommandLineGetValue(Package, L"-s");\r | |
2734 | if (Temp != NULL) {\r | |
6855763e CP |
2735 | //\r |
2736 | // Input converted to hexadecimal number.\r | |
2737 | //\r | |
2738 | if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r | |
2739 | Segment = (UINT16) RetVal;\r | |
2740 | } else {\r | |
4092a8f6 | 2741 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); \r |
6855763e CP |
2742 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2743 | goto Done;\r | |
2744 | }\r | |
5d73d92f | 2745 | }\r |
2746 | \r | |
2747 | //\r | |
2748 | // The first Argument(except "-i") is assumed to be Bus number, second\r | |
2749 | // to be Device number, and third to be Func number.\r | |
2750 | //\r | |
2751 | Temp = ShellCommandLineGetRawValue(Package, 1);\r | |
2752 | if (Temp != NULL) {\r | |
6855763e CP |
2753 | //\r |
2754 | // Input converted to hexadecimal number.\r | |
2755 | //\r | |
2756 | if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r | |
2757 | Bus = (UINT16) RetVal;\r | |
2758 | } else {\r | |
4092a8f6 | 2759 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); \r |
6855763e CP |
2760 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2761 | goto Done;\r | |
2762 | }\r | |
2763 | \r | |
0c84a69f | 2764 | if (Bus > PCI_MAX_BUS) {\r |
4092a8f6 | 2765 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp); \r |
5d73d92f | 2766 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2767 | goto Done;\r | |
2768 | }\r | |
2769 | }\r | |
2770 | Temp = ShellCommandLineGetRawValue(Package, 2);\r | |
2771 | if (Temp != NULL) {\r | |
6855763e CP |
2772 | //\r |
2773 | // Input converted to hexadecimal number.\r | |
2774 | //\r | |
2775 | if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r | |
2776 | Device = (UINT16) RetVal;\r | |
2777 | } else {\r | |
4092a8f6 | 2778 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); \r |
6855763e CP |
2779 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2780 | goto Done;\r | |
2781 | }\r | |
2782 | \r | |
0c84a69f | 2783 | if (Device > PCI_MAX_DEVICE){\r |
4092a8f6 | 2784 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp); \r |
5d73d92f | 2785 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2786 | goto Done;\r | |
2787 | }\r | |
2788 | }\r | |
2789 | \r | |
2790 | Temp = ShellCommandLineGetRawValue(Package, 3);\r | |
2791 | if (Temp != NULL) {\r | |
6855763e CP |
2792 | //\r |
2793 | // Input converted to hexadecimal number.\r | |
2794 | //\r | |
2795 | if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r | |
2796 | Func = (UINT16) RetVal;\r | |
2797 | } else {\r | |
4092a8f6 | 2798 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle, L"pci", Temp); \r |
6855763e CP |
2799 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2800 | goto Done;\r | |
2801 | }\r | |
2802 | \r | |
0c84a69f | 2803 | if (Func > PCI_MAX_FUNC){\r |
4092a8f6 | 2804 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"pci", Temp); \r |
5d73d92f | 2805 | ShellStatus = SHELL_INVALID_PARAMETER;\r |
2806 | goto Done;\r | |
2807 | }\r | |
2808 | }\r | |
2809 | \r | |
2810 | //\r | |
2811 | // Find the protocol interface who's in charge of current segment, and its\r | |
2812 | // bus range covers the current bus\r | |
2813 | //\r | |
2814 | Status = PciFindProtocolInterface (\r | |
2815 | HandleBuf,\r | |
2816 | HandleCount,\r | |
2817 | Segment,\r | |
2818 | Bus,\r | |
2819 | &IoDev\r | |
2820 | );\r | |
2821 | \r | |
2822 | if (EFI_ERROR (Status)) {\r | |
2823 | ShellPrintHiiEx(\r | |
4092a8f6 | 2824 | -1, -1, NULL, STRING_TOKEN (STR_PCI_NO_FIND), gShellDebug1HiiHandle, L"pci", \r |
5d73d92f | 2825 | Segment,\r |
2826 | Bus\r | |
2827 | );\r | |
2828 | ShellStatus = SHELL_NOT_FOUND;\r | |
2829 | goto Done;\r | |
2830 | }\r | |
2831 | \r | |
0c84a69f | 2832 | Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);\r |
5d73d92f | 2833 | Status = IoDev->Pci.Read (\r |
2834 | IoDev,\r | |
2835 | EfiPciWidthUint8,\r | |
2836 | Address,\r | |
2837 | sizeof (ConfigSpace),\r | |
2838 | &ConfigSpace\r | |
2839 | );\r | |
2840 | \r | |
2841 | if (EFI_ERROR (Status)) {\r | |
4092a8f6 | 2842 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_NO_CFG), gShellDebug1HiiHandle, L"pci"); \r |
5d73d92f | 2843 | ShellStatus = SHELL_ACCESS_DENIED;\r |
2844 | goto Done;\r | |
2845 | }\r | |
2846 | \r | |
2847 | mConfigSpace = &ConfigSpace;\r | |
2848 | ShellPrintHiiEx(\r | |
2849 | -1,\r | |
2850 | -1,\r | |
2851 | NULL,\r | |
2852 | STRING_TOKEN (STR_PCI_INFO),\r | |
2853 | gShellDebug1HiiHandle,\r | |
2854 | Segment,\r | |
2855 | Bus,\r | |
2856 | Device,\r | |
2857 | Func,\r | |
2858 | Segment,\r | |
2859 | Bus,\r | |
2860 | Device,\r | |
2861 | Func\r | |
2862 | );\r | |
2863 | \r | |
2864 | //\r | |
2865 | // Dump standard header of configuration space\r | |
2866 | //\r | |
2867 | SizeOfHeader = sizeof (ConfigSpace.Common) + sizeof (ConfigSpace.NonCommon);\r | |
2868 | \r | |
a1d4bfcc | 2869 | DumpHex (2, 0, SizeOfHeader, &ConfigSpace);\r |
5d73d92f | 2870 | ShellPrintEx(-1,-1, L"\r\n");\r |
2871 | \r | |
2872 | //\r | |
2873 | // Dump device dependent Part of configuration space\r | |
2874 | //\r | |
a1d4bfcc | 2875 | DumpHex (\r |
5d73d92f | 2876 | 2,\r |
2877 | SizeOfHeader,\r | |
2878 | sizeof (ConfigSpace) - SizeOfHeader,\r | |
2879 | ConfigSpace.Data\r | |
2880 | );\r | |
2881 | \r | |
2882 | //\r | |
2883 | // If "-i" appears in command line, interpret data in configuration space\r | |
2884 | //\r | |
2885 | if (ExplainData) {\r | |
c831a2c3 RN |
2886 | EnhancedDump = 0xFFFF;\r |
2887 | if (ShellCommandLineGetFlag(Package, L"-ec")) {\r | |
2888 | Temp = ShellCommandLineGetValue(Package, L"-ec");\r | |
2889 | ASSERT (Temp != NULL);\r | |
2890 | EnhancedDump = (UINT16) ShellHexStrToUintn (Temp);\r | |
705bffb5 JC |
2891 | }\r |
2892 | Status = PciExplainData (&ConfigSpace, Address, IoDev, EnhancedDump);\r | |
5d73d92f | 2893 | }\r |
2894 | }\r | |
2895 | Done:\r | |
2896 | if (HandleBuf != NULL) {\r | |
2897 | FreePool (HandleBuf);\r | |
2898 | }\r | |
2899 | if (Package != NULL) {\r | |
2900 | ShellCommandLineFreeVarList (Package);\r | |
2901 | }\r | |
2902 | mConfigSpace = NULL;\r | |
2903 | return ShellStatus;\r | |
2904 | }\r | |
2905 | \r | |
a1d4bfcc | 2906 | /**\r |
5d73d92f | 2907 | This function finds out the protocol which is in charge of the given\r |
2908 | segment, and its bus range covers the current bus number. It lookes\r | |
2909 | each instances of RootBridgeIoProtocol handle, until the one meets the\r | |
2910 | criteria is found.\r | |
2911 | \r | |
a1d4bfcc | 2912 | @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r |
2913 | @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r | |
2914 | @param[in] Segment Segment number of device we are dealing with.\r | |
2915 | @param[in] Bus Bus number of device we are dealing with.\r | |
2916 | @param[out] IoDev Handle used to access configuration space of PCI device.\r | |
5d73d92f | 2917 | \r |
a1d4bfcc | 2918 | @retval EFI_SUCCESS The command completed successfully.\r |
2919 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
5d73d92f | 2920 | \r |
2921 | **/\r | |
a1d4bfcc | 2922 | EFI_STATUS\r |
2923 | PciFindProtocolInterface (\r | |
2924 | IN EFI_HANDLE *HandleBuf,\r | |
2925 | IN UINTN HandleCount,\r | |
2926 | IN UINT16 Segment,\r | |
2927 | IN UINT16 Bus,\r | |
2928 | OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev\r | |
2929 | )\r | |
5d73d92f | 2930 | {\r |
2931 | UINTN Index;\r | |
2932 | EFI_STATUS Status;\r | |
5d73d92f | 2933 | EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;\r |
2934 | UINT16 MinBus;\r | |
2935 | UINT16 MaxBus;\r | |
2936 | BOOLEAN IsEnd;\r | |
2937 | \r | |
5d73d92f | 2938 | //\r |
2939 | // Go through all handles, until the one meets the criteria is found\r | |
2940 | //\r | |
2941 | for (Index = 0; Index < HandleCount; Index++) {\r | |
2942 | Status = PciGetProtocolAndResource (HandleBuf[Index], IoDev, &Descriptors);\r | |
2943 | if (EFI_ERROR (Status)) {\r | |
2944 | return Status;\r | |
2945 | }\r | |
2946 | //\r | |
2947 | // When Descriptors == NULL, the Configuration() is not implemented,\r | |
2948 | // so we only check the Segment number\r | |
2949 | //\r | |
2950 | if (Descriptors == NULL && Segment == (*IoDev)->SegmentNumber) {\r | |
2951 | return EFI_SUCCESS;\r | |
2952 | }\r | |
2953 | \r | |
2954 | if ((*IoDev)->SegmentNumber != Segment) {\r | |
2955 | continue;\r | |
2956 | }\r | |
2957 | \r | |
2958 | while (TRUE) {\r | |
2959 | Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);\r | |
2960 | if (EFI_ERROR (Status)) {\r | |
2961 | return Status;\r | |
2962 | }\r | |
2963 | \r | |
2964 | if (IsEnd) {\r | |
2965 | break;\r | |
2966 | }\r | |
2967 | \r | |
2968 | if (MinBus <= Bus && MaxBus >= Bus) {\r | |
2c46dd23 | 2969 | return EFI_SUCCESS;\r |
5d73d92f | 2970 | }\r |
2971 | }\r | |
2972 | }\r | |
2973 | \r | |
2c46dd23 | 2974 | return EFI_NOT_FOUND;\r |
5d73d92f | 2975 | }\r |
2976 | \r | |
a1d4bfcc | 2977 | /**\r |
2978 | This function gets the protocol interface from the given handle, and\r | |
2979 | obtains its address space descriptors.\r | |
2980 | \r | |
2981 | @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle.\r | |
2982 | @param[out] IoDev Handle used to access configuration space of PCI device.\r | |
2983 | @param[out] Descriptors Points to the address space descriptors.\r | |
2984 | \r | |
2985 | @retval EFI_SUCCESS The command completed successfully\r | |
2986 | **/\r | |
5d73d92f | 2987 | EFI_STATUS\r |
2988 | PciGetProtocolAndResource (\r | |
2989 | IN EFI_HANDLE Handle,\r | |
2990 | OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,\r | |
2991 | OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors\r | |
2992 | )\r | |
5d73d92f | 2993 | {\r |
2994 | EFI_STATUS Status;\r | |
2995 | \r | |
2996 | //\r | |
2997 | // Get inferface from protocol\r | |
2998 | //\r | |
2999 | Status = gBS->HandleProtocol (\r | |
3000 | Handle,\r | |
3001 | &gEfiPciRootBridgeIoProtocolGuid,\r | |
3002 | (VOID**)IoDev\r | |
3003 | );\r | |
3004 | \r | |
3005 | if (EFI_ERROR (Status)) {\r | |
3006 | return Status;\r | |
3007 | }\r | |
3008 | //\r | |
3009 | // Call Configuration() to get address space descriptors\r | |
3010 | //\r | |
3011 | Status = (*IoDev)->Configuration (*IoDev, (VOID**)Descriptors);\r | |
3012 | if (Status == EFI_UNSUPPORTED) {\r | |
3013 | *Descriptors = NULL;\r | |
3014 | return EFI_SUCCESS;\r | |
3015 | \r | |
3016 | } else {\r | |
3017 | return Status;\r | |
3018 | }\r | |
3019 | }\r | |
3020 | \r | |
a1d4bfcc | 3021 | /**\r |
3022 | This function get the next bus range of given address space descriptors.\r | |
3023 | It also moves the pointer backward a node, to get prepared to be called\r | |
3024 | again.\r | |
3025 | \r | |
4ff7e37b ED |
3026 | @param[in, out] Descriptors Points to current position of a serial of address space\r |
3027 | descriptors.\r | |
3028 | @param[out] MinBus The lower range of bus number.\r | |
3029 | @param[out] MaxBus The upper range of bus number.\r | |
3030 | @param[out] IsEnd Meet end of the serial of descriptors.\r | |
a1d4bfcc | 3031 | \r |
3032 | @retval EFI_SUCCESS The command completed successfully.\r | |
3033 | **/\r | |
5d73d92f | 3034 | EFI_STATUS\r |
3035 | PciGetNextBusRange (\r | |
3036 | IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r | |
3037 | OUT UINT16 *MinBus,\r | |
3038 | OUT UINT16 *MaxBus,\r | |
3039 | OUT BOOLEAN *IsEnd\r | |
3040 | )\r | |
5d73d92f | 3041 | {\r |
3042 | *IsEnd = FALSE;\r | |
3043 | \r | |
3044 | //\r | |
3045 | // When *Descriptors is NULL, Configuration() is not implemented, so assume\r | |
3046 | // range is 0~PCI_MAX_BUS\r | |
3047 | //\r | |
3048 | if ((*Descriptors) == NULL) {\r | |
3049 | *MinBus = 0;\r | |
3050 | *MaxBus = PCI_MAX_BUS;\r | |
3051 | return EFI_SUCCESS;\r | |
3052 | }\r | |
3053 | //\r | |
3054 | // *Descriptors points to one or more address space descriptors, which\r | |
3055 | // ends with a end tagged descriptor. Examine each of the descriptors,\r | |
3056 | // if a bus typed one is found and its bus range covers bus, this handle\r | |
3057 | // is the handle we are looking for.\r | |
3058 | //\r | |
5d73d92f | 3059 | \r |
3060 | while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {\r | |
3061 | if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {\r | |
3062 | *MinBus = (UINT16) (*Descriptors)->AddrRangeMin;\r | |
3063 | *MaxBus = (UINT16) (*Descriptors)->AddrRangeMax;\r | |
3064 | (*Descriptors)++;\r | |
3737ac2b | 3065 | return (EFI_SUCCESS);\r |
5d73d92f | 3066 | }\r |
3067 | \r | |
3068 | (*Descriptors)++;\r | |
3069 | }\r | |
3070 | \r | |
3737ac2b | 3071 | if ((*Descriptors)->Desc == ACPI_END_TAG_DESCRIPTOR) {\r |
3072 | *IsEnd = TRUE;\r | |
3073 | }\r | |
3074 | \r | |
5d73d92f | 3075 | return EFI_SUCCESS;\r |
3076 | }\r | |
3077 | \r | |
a1d4bfcc | 3078 | /**\r |
5d73d92f | 3079 | Explain the data in PCI configuration space. The part which is common for\r |
3080 | PCI device and bridge is interpreted in this function. It calls other\r | |
3081 | functions to interpret data unique for device or bridge.\r | |
3082 | \r | |
a1d4bfcc | 3083 | @param[in] ConfigSpace Data in PCI configuration space.\r |
3084 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
3085 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
f614ce7e | 3086 | @param[in] EnhancedDump The print format for the dump data.\r |
5d73d92f | 3087 | \r |
a1d4bfcc | 3088 | @retval EFI_SUCCESS The command completed successfully.\r |
5d73d92f | 3089 | **/\r |
a1d4bfcc | 3090 | EFI_STATUS\r |
3091 | PciExplainData (\r | |
3092 | IN PCI_CONFIG_SPACE *ConfigSpace,\r | |
3093 | IN UINT64 Address,\r | |
705bffb5 JC |
3094 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r |
3095 | IN CONST UINT16 EnhancedDump\r | |
a1d4bfcc | 3096 | )\r |
5d73d92f | 3097 | {\r |
0c84a69f RN |
3098 | PCI_DEVICE_INDEPENDENT_REGION *Common;\r |
3099 | PCI_HEADER_TYPE HeaderType;\r | |
3100 | EFI_STATUS Status;\r | |
3101 | UINT8 CapPtr;\r | |
5d73d92f | 3102 | \r |
3103 | Common = &(ConfigSpace->Common);\r | |
3104 | \r | |
c37e0f16 | 3105 | ShellPrintEx (-1, -1, L"\r\n");\r |
5d73d92f | 3106 | \r |
3107 | //\r | |
3108 | // Print Vendor Id and Device Id\r | |
3109 | //\r | |
3110 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_VID_DID), gShellDebug1HiiHandle,\r | |
3111 | INDEX_OF (&(Common->VendorId)),\r | |
3112 | Common->VendorId,\r | |
3113 | INDEX_OF (&(Common->DeviceId)),\r | |
3114 | Common->DeviceId\r | |
3115 | );\r | |
3116 | \r | |
3117 | //\r | |
3118 | // Print register Command\r | |
3119 | //\r | |
3120 | PciExplainCommand (&(Common->Command));\r | |
3121 | \r | |
3122 | //\r | |
3123 | // Print register Status\r | |
3124 | //\r | |
3125 | PciExplainStatus (&(Common->Status), TRUE, PciUndefined);\r | |
3126 | \r | |
3127 | //\r | |
3128 | // Print register Revision ID\r | |
3129 | //\r | |
14b5e3fd | 3130 | ShellPrintEx(-1, -1, L"\r\n");\r |
5d73d92f | 3131 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_RID), gShellDebug1HiiHandle,\r |
0c84a69f RN |
3132 | INDEX_OF (&(Common->RevisionID)),\r |
3133 | Common->RevisionID\r | |
5d73d92f | 3134 | );\r |
3135 | \r | |
3136 | //\r | |
3137 | // Print register BIST\r | |
3138 | //\r | |
0c84a69f RN |
3139 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_BIST), gShellDebug1HiiHandle, INDEX_OF (&(Common->BIST)));\r |
3140 | if ((Common->BIST & BIT7) != 0) {\r | |
3141 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP), gShellDebug1HiiHandle, 0x0f & Common->BIST);\r | |
5d73d92f | 3142 | } else {\r |
3143 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP_NO), gShellDebug1HiiHandle);\r | |
3144 | }\r | |
3145 | //\r | |
3146 | // Print register Cache Line Size\r | |
3147 | //\r | |
3148 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3149 | STRING_TOKEN (STR_PCI2_CACHE_LINE_SIZE),\r | |
3150 | gShellDebug1HiiHandle,\r | |
3151 | INDEX_OF (&(Common->CacheLineSize)),\r | |
3152 | Common->CacheLineSize\r | |
3153 | );\r | |
3154 | \r | |
3155 | //\r | |
3156 | // Print register Latency Timer\r | |
3157 | //\r | |
3158 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3159 | STRING_TOKEN (STR_PCI2_LATENCY_TIMER),\r | |
3160 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3161 | INDEX_OF (&(Common->LatencyTimer)),\r |
3162 | Common->LatencyTimer\r | |
5d73d92f | 3163 | );\r |
3164 | \r | |
3165 | //\r | |
3166 | // Print register Header Type\r | |
3167 | //\r | |
3168 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3169 | STRING_TOKEN (STR_PCI2_HEADER_TYPE),\r | |
3170 | gShellDebug1HiiHandle,\r | |
3171 | INDEX_OF (&(Common->HeaderType)),\r | |
3172 | Common->HeaderType\r | |
3173 | );\r | |
3174 | \r | |
0c84a69f | 3175 | if ((Common->HeaderType & BIT7) != 0) {\r |
5d73d92f | 3176 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MULTI_FUNCTION), gShellDebug1HiiHandle);\r |
3177 | \r | |
3178 | } else {\r | |
3179 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SINGLE_FUNCTION), gShellDebug1HiiHandle);\r | |
3180 | }\r | |
3181 | \r | |
3182 | HeaderType = (PCI_HEADER_TYPE)(UINT8) (Common->HeaderType & 0x7f);\r | |
3183 | switch (HeaderType) {\r | |
3184 | case PciDevice:\r | |
3185 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_PCI_DEVICE), gShellDebug1HiiHandle);\r | |
3186 | break;\r | |
3187 | \r | |
3188 | case PciP2pBridge:\r | |
3189 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_P2P_BRIDGE), gShellDebug1HiiHandle);\r | |
3190 | break;\r | |
3191 | \r | |
3192 | case PciCardBusBridge:\r | |
3193 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_BRIDGE), gShellDebug1HiiHandle);\r | |
3194 | break;\r | |
3195 | \r | |
3196 | default:\r | |
3197 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED), gShellDebug1HiiHandle);\r | |
3198 | HeaderType = PciUndefined;\r | |
3199 | }\r | |
3200 | \r | |
3201 | //\r | |
3202 | // Print register Class Code\r | |
3203 | //\r | |
3204 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CLASS), gShellDebug1HiiHandle);\r | |
3205 | PciPrintClassCode ((UINT8 *) Common->ClassCode, TRUE);\r | |
c37e0f16 | 3206 | ShellPrintEx (-1, -1, L"\r\n");\r |
5d73d92f | 3207 | \r |
3208 | if (ShellGetExecutionBreakFlag()) {\r | |
3209 | return EFI_SUCCESS;\r | |
3210 | }\r | |
3211 | \r | |
3212 | //\r | |
3213 | // Interpret remaining part of PCI configuration header depending on\r | |
3214 | // HeaderType\r | |
3215 | //\r | |
3216 | CapPtr = 0;\r | |
3217 | Status = EFI_SUCCESS;\r | |
3218 | switch (HeaderType) {\r | |
3219 | case PciDevice:\r | |
3220 | Status = PciExplainDeviceData (\r | |
3221 | &(ConfigSpace->NonCommon.Device),\r | |
3222 | Address,\r | |
3223 | IoDev\r | |
3224 | );\r | |
0c84a69f | 3225 | CapPtr = ConfigSpace->NonCommon.Device.CapabilityPtr;\r |
5d73d92f | 3226 | break;\r |
3227 | \r | |
3228 | case PciP2pBridge:\r | |
3229 | Status = PciExplainBridgeData (\r | |
3230 | &(ConfigSpace->NonCommon.Bridge),\r | |
3231 | Address,\r | |
3232 | IoDev\r | |
3233 | );\r | |
0c84a69f | 3234 | CapPtr = ConfigSpace->NonCommon.Bridge.CapabilityPtr;\r |
5d73d92f | 3235 | break;\r |
3236 | \r | |
3237 | case PciCardBusBridge:\r | |
3238 | Status = PciExplainCardBusData (\r | |
3239 | &(ConfigSpace->NonCommon.CardBus),\r | |
3240 | Address,\r | |
3241 | IoDev\r | |
3242 | );\r | |
0c84a69f | 3243 | CapPtr = ConfigSpace->NonCommon.CardBus.Cap_Ptr;\r |
5d73d92f | 3244 | break;\r |
d8f8021c | 3245 | case PciUndefined:\r |
3246 | default:\r | |
3247 | break;\r | |
5d73d92f | 3248 | }\r |
3249 | //\r | |
3250 | // If Status bit4 is 1, dump or explain capability structure\r | |
3251 | //\r | |
3252 | if ((Common->Status) & EFI_PCI_STATUS_CAPABILITY) {\r | |
705bffb5 | 3253 | PciExplainCapabilityStruct (IoDev, Address, CapPtr, EnhancedDump);\r |
5d73d92f | 3254 | }\r |
3255 | \r | |
3256 | return Status;\r | |
3257 | }\r | |
3258 | \r | |
a1d4bfcc | 3259 | /**\r |
3260 | Explain the device specific part of data in PCI configuration space.\r | |
3261 | \r | |
3262 | @param[in] Device Data in PCI configuration space.\r | |
3263 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
3264 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
3265 | \r | |
3266 | @retval EFI_SUCCESS The command completed successfully.\r | |
3267 | **/\r | |
5d73d92f | 3268 | EFI_STATUS\r |
3269 | PciExplainDeviceData (\r | |
0c84a69f | 3270 | IN PCI_DEVICE_HEADER_TYPE_REGION *Device,\r |
5d73d92f | 3271 | IN UINT64 Address,\r |
3272 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r | |
3273 | )\r | |
5d73d92f | 3274 | {\r |
3275 | UINTN Index;\r | |
3276 | BOOLEAN BarExist;\r | |
3277 | EFI_STATUS Status;\r | |
3278 | UINTN BarCount;\r | |
3279 | \r | |
3280 | //\r | |
3281 | // Print Base Address Registers(Bar). When Bar = 0, this Bar does not\r | |
3282 | // exist. If these no Bar for this function, print "none", otherwise\r | |
3283 | // list detail information about this Bar.\r | |
3284 | //\r | |
3285 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDR), gShellDebug1HiiHandle, INDEX_OF (Device->Bar));\r | |
3286 | \r | |
3287 | BarExist = FALSE;\r | |
3288 | BarCount = sizeof (Device->Bar) / sizeof (Device->Bar[0]);\r | |
3289 | for (Index = 0; Index < BarCount; Index++) {\r | |
3290 | if (Device->Bar[Index] == 0) {\r | |
3291 | continue;\r | |
3292 | }\r | |
3293 | \r | |
3294 | if (!BarExist) {\r | |
3295 | BarExist = TRUE;\r | |
3296 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE), gShellDebug1HiiHandle);\r | |
c37e0f16 | 3297 | ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------");\r |
5d73d92f | 3298 | }\r |
3299 | \r | |
3300 | Status = PciExplainBar (\r | |
3301 | &(Device->Bar[Index]),\r | |
3302 | &(mConfigSpace->Common.Command),\r | |
3303 | Address,\r | |
3304 | IoDev,\r | |
3305 | &Index\r | |
3306 | );\r | |
3307 | \r | |
3308 | if (EFI_ERROR (Status)) {\r | |
3309 | break;\r | |
3310 | }\r | |
3311 | }\r | |
3312 | \r | |
3313 | if (!BarExist) {\r | |
3314 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);\r | |
3315 | \r | |
3316 | } else {\r | |
c37e0f16 | 3317 | ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------");\r |
5d73d92f | 3318 | }\r |
3319 | \r | |
3320 | //\r | |
3321 | // Print register Expansion ROM Base Address\r | |
3322 | //\r | |
0c84a69f RN |
3323 | if ((Device->ExpansionRomBar & BIT0) == 0) {\r |
3324 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_EXPANSION_ROM_DISABLED), gShellDebug1HiiHandle, INDEX_OF (&(Device->ExpansionRomBar)));\r | |
5d73d92f | 3325 | \r |
3326 | } else {\r | |
3327 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3328 | STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE),\r | |
3329 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3330 | INDEX_OF (&(Device->ExpansionRomBar)),\r |
3331 | Device->ExpansionRomBar\r | |
5d73d92f | 3332 | );\r |
3333 | }\r | |
3334 | //\r | |
3335 | // Print register Cardbus CIS ptr\r | |
3336 | //\r | |
3337 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3338 | STRING_TOKEN (STR_PCI2_CARDBUS_CIS),\r | |
3339 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3340 | INDEX_OF (&(Device->CISPtr)),\r |
3341 | Device->CISPtr\r | |
5d73d92f | 3342 | );\r |
3343 | \r | |
3344 | //\r | |
3345 | // Print register Sub-vendor ID and subsystem ID\r | |
3346 | //\r | |
3347 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3348 | STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID),\r | |
3349 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3350 | INDEX_OF (&(Device->SubsystemVendorID)),\r |
3351 | Device->SubsystemVendorID\r | |
5d73d92f | 3352 | );\r |
3353 | \r | |
3354 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3355 | STRING_TOKEN (STR_PCI2_SUBSYSTEM_ID),\r | |
3356 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3357 | INDEX_OF (&(Device->SubsystemID)),\r |
3358 | Device->SubsystemID\r | |
5d73d92f | 3359 | );\r |
3360 | \r | |
3361 | //\r | |
3362 | // Print register Capabilities Ptr\r | |
3363 | //\r | |
3364 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3365 | STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR),\r | |
3366 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3367 | INDEX_OF (&(Device->CapabilityPtr)),\r |
3368 | Device->CapabilityPtr\r | |
5d73d92f | 3369 | );\r |
3370 | \r | |
3371 | //\r | |
3372 | // Print register Interrupt Line and interrupt pin\r | |
3373 | //\r | |
3374 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3375 | STRING_TOKEN (STR_PCI2_INTERRUPT_LINE),\r | |
3376 | gShellDebug1HiiHandle,\r | |
3377 | INDEX_OF (&(Device->InterruptLine)),\r | |
3378 | Device->InterruptLine\r | |
3379 | );\r | |
3380 | \r | |
3381 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3382 | STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),\r | |
3383 | gShellDebug1HiiHandle,\r | |
3384 | INDEX_OF (&(Device->InterruptPin)),\r | |
3385 | Device->InterruptPin\r | |
3386 | );\r | |
3387 | \r | |
3388 | //\r | |
3389 | // Print register Min_Gnt and Max_Lat\r | |
3390 | //\r | |
3391 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3392 | STRING_TOKEN (STR_PCI2_MIN_GNT),\r | |
3393 | gShellDebug1HiiHandle,\r | |
3394 | INDEX_OF (&(Device->MinGnt)),\r | |
3395 | Device->MinGnt\r | |
3396 | );\r | |
3397 | \r | |
3398 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3399 | STRING_TOKEN (STR_PCI2_MAX_LAT),\r | |
3400 | gShellDebug1HiiHandle,\r | |
3401 | INDEX_OF (&(Device->MaxLat)),\r | |
3402 | Device->MaxLat\r | |
3403 | );\r | |
3404 | \r | |
3405 | return EFI_SUCCESS;\r | |
3406 | }\r | |
3407 | \r | |
a1d4bfcc | 3408 | /**\r |
3409 | Explain the bridge specific part of data in PCI configuration space.\r | |
3410 | \r | |
3411 | @param[in] Bridge Bridge specific data region in PCI configuration space.\r | |
3412 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
3413 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
3414 | \r | |
3415 | @retval EFI_SUCCESS The command completed successfully.\r | |
3416 | **/\r | |
5d73d92f | 3417 | EFI_STATUS\r |
3418 | PciExplainBridgeData (\r | |
0c84a69f | 3419 | IN PCI_BRIDGE_CONTROL_REGISTER *Bridge,\r |
5d73d92f | 3420 | IN UINT64 Address,\r |
3421 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r | |
3422 | )\r | |
5d73d92f | 3423 | {\r |
3424 | UINTN Index;\r | |
3425 | BOOLEAN BarExist;\r | |
3426 | UINTN BarCount;\r | |
3427 | UINT32 IoAddress32;\r | |
3428 | EFI_STATUS Status;\r | |
3429 | \r | |
3430 | //\r | |
3431 | // Print Base Address Registers. When Bar = 0, this Bar does not\r | |
3432 | // exist. If these no Bar for this function, print "none", otherwise\r | |
3433 | // list detail information about this Bar.\r | |
3434 | //\r | |
3435 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDRESS), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->Bar)));\r | |
3436 | \r | |
3437 | BarExist = FALSE;\r | |
3438 | BarCount = sizeof (Bridge->Bar) / sizeof (Bridge->Bar[0]);\r | |
3439 | \r | |
3440 | for (Index = 0; Index < BarCount; Index++) {\r | |
3441 | if (Bridge->Bar[Index] == 0) {\r | |
3442 | continue;\r | |
3443 | }\r | |
3444 | \r | |
3445 | if (!BarExist) {\r | |
3446 | BarExist = TRUE;\r | |
3447 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE_2), gShellDebug1HiiHandle);\r | |
c37e0f16 | 3448 | ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------");\r |
5d73d92f | 3449 | }\r |
3450 | \r | |
3451 | Status = PciExplainBar (\r | |
3452 | &(Bridge->Bar[Index]),\r | |
3453 | &(mConfigSpace->Common.Command),\r | |
3454 | Address,\r | |
3455 | IoDev,\r | |
3456 | &Index\r | |
3457 | );\r | |
3458 | \r | |
3459 | if (EFI_ERROR (Status)) {\r | |
3460 | break;\r | |
3461 | }\r | |
3462 | }\r | |
3463 | \r | |
3464 | if (!BarExist) {\r | |
3465 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);\r | |
3466 | } else {\r | |
c37e0f16 | 3467 | ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------");\r |
5d73d92f | 3468 | }\r |
3469 | \r | |
3470 | //\r | |
3471 | // Expansion register ROM Base Address\r | |
3472 | //\r | |
0c84a69f RN |
3473 | if ((Bridge->ExpansionRomBAR & BIT0) == 0) {\r |
3474 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO_EXPANSION_ROM), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->ExpansionRomBAR)));\r | |
5d73d92f | 3475 | \r |
3476 | } else {\r | |
3477 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3478 | STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE_2),\r | |
3479 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3480 | INDEX_OF (&(Bridge->ExpansionRomBAR)),\r |
3481 | Bridge->ExpansionRomBAR\r | |
5d73d92f | 3482 | );\r |
3483 | }\r | |
3484 | //\r | |
3485 | // Print Bus Numbers(Primary, Secondary, and Subordinate\r | |
3486 | //\r | |
3487 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3488 | STRING_TOKEN (STR_PCI2_BUS_NUMBERS),\r | |
3489 | gShellDebug1HiiHandle,\r | |
3490 | INDEX_OF (&(Bridge->PrimaryBus)),\r | |
3491 | INDEX_OF (&(Bridge->SecondaryBus)),\r | |
3492 | INDEX_OF (&(Bridge->SubordinateBus))\r | |
3493 | );\r | |
3494 | \r | |
c37e0f16 | 3495 | ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n");\r |
5d73d92f | 3496 | \r |
3497 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->PrimaryBus);\r | |
3498 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SecondaryBus);\r | |
3499 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SubordinateBus);\r | |
3500 | \r | |
3501 | //\r | |
3502 | // Print register Secondary Latency Timer\r | |
3503 | //\r | |
3504 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3505 | STRING_TOKEN (STR_PCI2_SECONDARY_TIMER),\r | |
3506 | gShellDebug1HiiHandle,\r | |
3507 | INDEX_OF (&(Bridge->SecondaryLatencyTimer)),\r | |
3508 | Bridge->SecondaryLatencyTimer\r | |
3509 | );\r | |
3510 | \r | |
3511 | //\r | |
3512 | // Print register Secondary Status\r | |
3513 | //\r | |
3514 | PciExplainStatus (&(Bridge->SecondaryStatus), FALSE, PciP2pBridge);\r | |
3515 | \r | |
3516 | //\r | |
3517 | // Print I/O and memory ranges this bridge forwards. There are 3 resource\r | |
3518 | // types: I/O, memory, and pre-fetchable memory. For each resource type,\r | |
3519 | // base and limit address are listed.\r | |
3520 | //\r | |
3521 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE), gShellDebug1HiiHandle);\r | |
c37e0f16 | 3522 | ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n");\r |
5d73d92f | 3523 | \r |
3524 | //\r | |
3525 | // IO Base & Limit\r | |
3526 | //\r | |
0c84a69f | 3527 | IoAddress32 = (Bridge->IoBaseUpper16 << 16 | Bridge->IoBase << 8);\r |
5d73d92f | 3528 | IoAddress32 &= 0xfffff000;\r |
3529 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3530 | STRING_TOKEN (STR_PCI2_TWO_VARS),\r | |
3531 | gShellDebug1HiiHandle,\r | |
3532 | INDEX_OF (&(Bridge->IoBase)),\r | |
3533 | IoAddress32\r | |
3534 | );\r | |
3535 | \r | |
0c84a69f | 3536 | IoAddress32 = (Bridge->IoLimitUpper16 << 16 | Bridge->IoLimit << 8);\r |
5d73d92f | 3537 | IoAddress32 |= 0x00000fff;\r |
3538 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR), gShellDebug1HiiHandle, IoAddress32);\r | |
3539 | \r | |
3540 | //\r | |
3541 | // Memory Base & Limit\r | |
3542 | //\r | |
3543 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3544 | STRING_TOKEN (STR_PCI2_MEMORY),\r | |
3545 | gShellDebug1HiiHandle,\r | |
3546 | INDEX_OF (&(Bridge->MemoryBase)),\r | |
3547 | (Bridge->MemoryBase << 16) & 0xfff00000\r | |
3548 | );\r | |
3549 | \r | |
3550 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3551 | STRING_TOKEN (STR_PCI2_ONE_VAR),\r | |
3552 | gShellDebug1HiiHandle,\r | |
3553 | (Bridge->MemoryLimit << 16) | 0x000fffff\r | |
3554 | );\r | |
3555 | \r | |
3556 | //\r | |
3557 | // Pre-fetch-able Memory Base & Limit\r | |
3558 | //\r | |
3559 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3560 | STRING_TOKEN (STR_PCI2_PREFETCHABLE),\r | |
3561 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3562 | INDEX_OF (&(Bridge->PrefetchableMemoryBase)),\r |
3563 | Bridge->PrefetchableBaseUpper32,\r | |
3564 | (Bridge->PrefetchableMemoryBase << 16) & 0xfff00000\r | |
5d73d92f | 3565 | );\r |
3566 | \r | |
3567 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3568 | STRING_TOKEN (STR_PCI2_TWO_VARS_2),\r | |
3569 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3570 | Bridge->PrefetchableLimitUpper32,\r |
3571 | (Bridge->PrefetchableMemoryLimit << 16) | 0x000fffff\r | |
5d73d92f | 3572 | );\r |
3573 | \r | |
3574 | //\r | |
3575 | // Print register Capabilities Pointer\r | |
3576 | //\r | |
3577 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3578 | STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR_2),\r | |
3579 | gShellDebug1HiiHandle,\r | |
0c84a69f RN |
3580 | INDEX_OF (&(Bridge->CapabilityPtr)),\r |
3581 | Bridge->CapabilityPtr\r | |
5d73d92f | 3582 | );\r |
3583 | \r | |
3584 | //\r | |
3585 | // Print register Bridge Control\r | |
3586 | //\r | |
3587 | PciExplainBridgeControl (&(Bridge->BridgeControl), PciP2pBridge);\r | |
3588 | \r | |
3589 | //\r | |
3590 | // Print register Interrupt Line & PIN\r | |
3591 | //\r | |
3592 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3593 | STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_2),\r | |
3594 | gShellDebug1HiiHandle,\r | |
3595 | INDEX_OF (&(Bridge->InterruptLine)),\r | |
3596 | Bridge->InterruptLine\r | |
3597 | );\r | |
3598 | \r | |
3599 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3600 | STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),\r | |
3601 | gShellDebug1HiiHandle,\r | |
3602 | INDEX_OF (&(Bridge->InterruptPin)),\r | |
3603 | Bridge->InterruptPin\r | |
3604 | );\r | |
3605 | \r | |
3606 | return EFI_SUCCESS;\r | |
3607 | }\r | |
3608 | \r | |
a1d4bfcc | 3609 | /**\r |
3610 | Explain the Base Address Register(Bar) in PCI configuration space.\r | |
3611 | \r | |
4ff7e37b ED |
3612 | @param[in] Bar Points to the Base Address Register intended to interpret.\r |
3613 | @param[in] Command Points to the register Command.\r | |
3614 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
3615 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
3616 | @param[in, out] Index The Index.\r | |
a1d4bfcc | 3617 | \r |
3618 | @retval EFI_SUCCESS The command completed successfully.\r | |
3619 | **/\r | |
5d73d92f | 3620 | EFI_STATUS\r |
3621 | PciExplainBar (\r | |
3622 | IN UINT32 *Bar,\r | |
3623 | IN UINT16 *Command,\r | |
3624 | IN UINT64 Address,\r | |
3625 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r | |
3626 | IN OUT UINTN *Index\r | |
3627 | )\r | |
5d73d92f | 3628 | {\r |
3629 | UINT16 OldCommand;\r | |
3630 | UINT16 NewCommand;\r | |
3631 | UINT64 Bar64;\r | |
3632 | UINT32 OldBar32;\r | |
3633 | UINT32 NewBar32;\r | |
3634 | UINT64 OldBar64;\r | |
3635 | UINT64 NewBar64;\r | |
3636 | BOOLEAN IsMem;\r | |
3637 | BOOLEAN IsBar32;\r | |
3638 | UINT64 RegAddress;\r | |
3639 | \r | |
3640 | IsBar32 = TRUE;\r | |
3641 | Bar64 = 0;\r | |
3642 | NewBar32 = 0;\r | |
3643 | NewBar64 = 0;\r | |
3644 | \r | |
3645 | //\r | |
3646 | // According the bar type, list detail about this bar, for example: 32 or\r | |
3647 | // 64 bits; pre-fetchable or not.\r | |
3648 | //\r | |
0c84a69f | 3649 | if ((*Bar & BIT0) == 0) {\r |
5d73d92f | 3650 | //\r |
3651 | // This bar is of memory type\r | |
3652 | //\r | |
3653 | IsMem = TRUE;\r | |
3654 | \r | |
0c84a69f | 3655 | if ((*Bar & BIT1) == 0 && (*Bar & BIT2) == 0) {\r |
5d73d92f | 3656 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);\r |
3657 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);\r | |
3658 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_32_BITS), gShellDebug1HiiHandle);\r | |
3659 | \r | |
0c84a69f | 3660 | } else if ((*Bar & BIT1) == 0 && (*Bar & BIT2) != 0) {\r |
5d73d92f | 3661 | Bar64 = 0x0;\r |
3662 | CopyMem (&Bar64, Bar, sizeof (UINT64));\r | |
46cb4043 | 3663 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, (UINT32) RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32));\r |
2b578de0 | 3664 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32) (Bar64 & 0xfffffffffffffff0ULL));\r |
5d73d92f | 3665 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);\r |
3666 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_64_BITS), gShellDebug1HiiHandle);\r | |
3667 | IsBar32 = FALSE;\r | |
3668 | *Index += 1;\r | |
3669 | \r | |
3670 | } else {\r | |
3671 | //\r | |
3672 | // Reserved\r | |
3673 | //\r | |
3674 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);\r | |
3675 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM_2), gShellDebug1HiiHandle);\r | |
3676 | }\r | |
3677 | \r | |
0c84a69f | 3678 | if ((*Bar & BIT3) == 0) {\r |
5d73d92f | 3679 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO), gShellDebug1HiiHandle);\r |
3680 | \r | |
3681 | } else {\r | |
3682 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_YES), gShellDebug1HiiHandle);\r | |
3683 | }\r | |
3684 | \r | |
3685 | } else {\r | |
3686 | //\r | |
3687 | // This bar is of io type\r | |
3688 | //\r | |
3689 | IsMem = FALSE;\r | |
3690 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_4), gShellDebug1HiiHandle, *Bar & 0xfffffffc);\r | |
c37e0f16 | 3691 | ShellPrintEx (-1, -1, L"I/O ");\r |
5d73d92f | 3692 | }\r |
3693 | \r | |
3694 | //\r | |
3695 | // Get BAR length(or the amount of resource this bar demands for). To get\r | |
3696 | // Bar length, first we should temporarily disable I/O and memory access\r | |
3697 | // of this function(by set bits in the register Command), then write all\r | |
3698 | // "1"s to this bar. The bar value read back is the amount of resource\r | |
3699 | // this bar demands for.\r | |
3700 | //\r | |
3701 | //\r | |
3702 | // Disable io & mem access\r | |
3703 | //\r | |
3704 | OldCommand = *Command;\r | |
3705 | NewCommand = (UINT16) (OldCommand & 0xfffc);\r | |
3706 | RegAddress = Address | INDEX_OF (Command);\r | |
3707 | IoDev->Pci.Write (IoDev, EfiPciWidthUint16, RegAddress, 1, &NewCommand);\r | |
3708 | \r | |
3709 | RegAddress = Address | INDEX_OF (Bar);\r | |
3710 | \r | |
3711 | //\r | |
3712 | // Read after write the BAR to get the size\r | |
3713 | //\r | |
3714 | if (IsBar32) {\r | |
3715 | OldBar32 = *Bar;\r | |
3716 | NewBar32 = 0xffffffff;\r | |
3717 | \r | |
3718 | IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32);\r | |
3719 | IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32);\r | |
3720 | IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &OldBar32);\r | |
3721 | \r | |
3722 | if (IsMem) {\r | |
3723 | NewBar32 = NewBar32 & 0xfffffff0;\r | |
3724 | NewBar32 = (~NewBar32) + 1;\r | |
3725 | \r | |
3726 | } else {\r | |
3727 | NewBar32 = NewBar32 & 0xfffffffc;\r | |
3728 | NewBar32 = (~NewBar32) + 1;\r | |
3729 | NewBar32 = NewBar32 & 0x0000ffff;\r | |
3730 | }\r | |
3731 | } else {\r | |
3732 | \r | |
3733 | OldBar64 = 0x0;\r | |
3734 | CopyMem (&OldBar64, Bar, sizeof (UINT64));\r | |
2b578de0 | 3735 | NewBar64 = 0xffffffffffffffffULL;\r |
5d73d92f | 3736 | \r |
3737 | IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64);\r | |
3738 | IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64);\r | |
3739 | IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &OldBar64);\r | |
3740 | \r | |
3741 | if (IsMem) {\r | |
2b578de0 | 3742 | NewBar64 = NewBar64 & 0xfffffffffffffff0ULL;\r |
5d73d92f | 3743 | NewBar64 = (~NewBar64) + 1;\r |
3744 | \r | |
3745 | } else {\r | |
2b578de0 | 3746 | NewBar64 = NewBar64 & 0xfffffffffffffffcULL;\r |
5d73d92f | 3747 | NewBar64 = (~NewBar64) + 1;\r |
3748 | NewBar64 = NewBar64 & 0x000000000000ffff;\r | |
3749 | }\r | |
3750 | }\r | |
3751 | //\r | |
3752 | // Enable io & mem access\r | |
3753 | //\r | |
3754 | RegAddress = Address | INDEX_OF (Command);\r | |
3755 | IoDev->Pci.Write (IoDev, EfiPciWidthUint16, RegAddress, 1, &OldCommand);\r | |
3756 | \r | |
3757 | if (IsMem) {\r | |
3758 | if (IsBar32) {\r | |
3759 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32), gShellDebug1HiiHandle, NewBar32);\r | |
3760 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_2), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffff0) - 1);\r | |
3761 | \r | |
3762 | } else {\r | |
46cb4043 | 3763 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) RShiftU64 (NewBar64, 32));\r |
5d73d92f | 3764 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) NewBar64);\r |
c37e0f16 | 3765 | ShellPrintEx (-1, -1, L" ");\r |
5d73d92f | 3766 | ShellPrintHiiEx(-1, -1, NULL,\r |
3767 | STRING_TOKEN (STR_PCI2_RSHIFT),\r | |
3768 | gShellDebug1HiiHandle,\r | |
46cb4043 | 3769 | (UINT32) RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1), 32)\r |
5d73d92f | 3770 | );\r |
2b578de0 | 3771 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) (NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1));\r |
5d73d92f | 3772 | \r |
3773 | }\r | |
3774 | } else {\r | |
3775 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_3), gShellDebug1HiiHandle, NewBar32);\r | |
3776 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_4), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffffc) - 1);\r | |
3777 | }\r | |
3778 | \r | |
3779 | return EFI_SUCCESS;\r | |
3780 | }\r | |
3781 | \r | |
a1d4bfcc | 3782 | /**\r |
3783 | Explain the cardbus specific part of data in PCI configuration space.\r | |
3784 | \r | |
3785 | @param[in] CardBus CardBus specific region of PCI configuration space.\r | |
3786 | @param[in] Address Address used to access configuration space of this PCI device.\r | |
3787 | @param[in] IoDev Handle used to access configuration space of PCI device.\r | |
3788 | \r | |
3789 | @retval EFI_SUCCESS The command completed successfully.\r | |
3790 | **/\r | |
5d73d92f | 3791 | EFI_STATUS\r |
3792 | PciExplainCardBusData (\r | |
0c84a69f | 3793 | IN PCI_CARDBUS_CONTROL_REGISTER *CardBus,\r |
5d73d92f | 3794 | IN UINT64 Address,\r |
3795 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r | |
3796 | )\r | |
5d73d92f | 3797 | {\r |
3798 | BOOLEAN Io32Bit;\r | |
3799 | PCI_CARDBUS_DATA *CardBusData;\r | |
3800 | \r | |
3801 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3802 | STRING_TOKEN (STR_PCI2_CARDBUS_SOCKET),\r | |
3803 | gShellDebug1HiiHandle,\r | |
3804 | INDEX_OF (&(CardBus->CardBusSocketReg)),\r | |
3805 | CardBus->CardBusSocketReg\r | |
3806 | );\r | |
3807 | \r | |
3808 | //\r | |
3809 | // Print Secondary Status\r | |
3810 | //\r | |
3811 | PciExplainStatus (&(CardBus->SecondaryStatus), FALSE, PciCardBusBridge);\r | |
3812 | \r | |
3813 | //\r | |
3814 | // Print Bus Numbers(Primary bus number, CardBus bus number, and\r | |
3815 | // Subordinate bus number\r | |
3816 | //\r | |
3817 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3818 | STRING_TOKEN (STR_PCI2_BUS_NUMBERS_2),\r | |
3819 | gShellDebug1HiiHandle,\r | |
3820 | INDEX_OF (&(CardBus->PciBusNumber)),\r | |
3821 | INDEX_OF (&(CardBus->CardBusBusNumber)),\r | |
3822 | INDEX_OF (&(CardBus->SubordinateBusNumber))\r | |
3823 | );\r | |
3824 | \r | |
c37e0f16 | 3825 | ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n");\r |
5d73d92f | 3826 | \r |
3827 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS), gShellDebug1HiiHandle, CardBus->PciBusNumber);\r | |
3828 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_2), gShellDebug1HiiHandle, CardBus->CardBusBusNumber);\r | |
3829 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_3), gShellDebug1HiiHandle, CardBus->SubordinateBusNumber);\r | |
3830 | \r | |
3831 | //\r | |
3832 | // Print CardBus Latency Timer\r | |
3833 | //\r | |
3834 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3835 | STRING_TOKEN (STR_PCI2_CARDBUS_LATENCY),\r | |
3836 | gShellDebug1HiiHandle,\r | |
3837 | INDEX_OF (&(CardBus->CardBusLatencyTimer)),\r | |
3838 | CardBus->CardBusLatencyTimer\r | |
3839 | );\r | |
3840 | \r | |
3841 | //\r | |
3842 | // Print Memory/Io ranges this cardbus bridge forwards\r | |
3843 | //\r | |
3844 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE_2), gShellDebug1HiiHandle);\r | |
c37e0f16 | 3845 | ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n");\r |
5d73d92f | 3846 | \r |
3847 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3848 | STRING_TOKEN (STR_PCI2_MEM_3),\r | |
3849 | gShellDebug1HiiHandle,\r | |
3850 | INDEX_OF (&(CardBus->MemoryBase0)),\r | |
0c84a69f | 3851 | CardBus->BridgeControl & BIT8 ? L" Prefetchable" : L"Non-Prefetchable",\r |
5d73d92f | 3852 | CardBus->MemoryBase0 & 0xfffff000,\r |
3853 | CardBus->MemoryLimit0 | 0x00000fff\r | |
3854 | );\r | |
3855 | \r | |
3856 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3857 | STRING_TOKEN (STR_PCI2_MEM_3),\r | |
3858 | gShellDebug1HiiHandle,\r | |
3859 | INDEX_OF (&(CardBus->MemoryBase1)),\r | |
0c84a69f | 3860 | CardBus->BridgeControl & BIT9 ? L" Prefetchable" : L"Non-Prefetchable",\r |
5d73d92f | 3861 | CardBus->MemoryBase1 & 0xfffff000,\r |
3862 | CardBus->MemoryLimit1 | 0x00000fff\r | |
3863 | );\r | |
3864 | \r | |
0c84a69f | 3865 | Io32Bit = (BOOLEAN) (CardBus->IoBase0 & BIT0);\r |
5d73d92f | 3866 | ShellPrintHiiEx(-1, -1, NULL,\r |
3867 | STRING_TOKEN (STR_PCI2_IO_2),\r | |
3868 | gShellDebug1HiiHandle,\r | |
3869 | INDEX_OF (&(CardBus->IoBase0)),\r | |
3870 | Io32Bit ? L" 32 bit" : L" 16 bit",\r | |
3871 | CardBus->IoBase0 & (Io32Bit ? 0xfffffffc : 0x0000fffc),\r | |
d8f8021c | 3872 | (CardBus->IoLimit0 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003\r |
5d73d92f | 3873 | );\r |
3874 | \r | |
0c84a69f | 3875 | Io32Bit = (BOOLEAN) (CardBus->IoBase1 & BIT0);\r |
5d73d92f | 3876 | ShellPrintHiiEx(-1, -1, NULL,\r |
3877 | STRING_TOKEN (STR_PCI2_IO_2),\r | |
3878 | gShellDebug1HiiHandle,\r | |
3879 | INDEX_OF (&(CardBus->IoBase1)),\r | |
3880 | Io32Bit ? L" 32 bit" : L" 16 bit",\r | |
3881 | CardBus->IoBase1 & (Io32Bit ? 0xfffffffc : 0x0000fffc),\r | |
d8f8021c | 3882 | (CardBus->IoLimit1 & (Io32Bit ? 0xffffffff : 0x0000ffff)) | 0x00000003\r |
5d73d92f | 3883 | );\r |
3884 | \r | |
3885 | //\r | |
3886 | // Print register Interrupt Line & PIN\r | |
3887 | //\r | |
3888 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3889 | STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_3),\r | |
3890 | gShellDebug1HiiHandle,\r | |
3891 | INDEX_OF (&(CardBus->InterruptLine)),\r | |
3892 | CardBus->InterruptLine,\r | |
3893 | INDEX_OF (&(CardBus->InterruptPin)),\r | |
3894 | CardBus->InterruptPin\r | |
3895 | );\r | |
3896 | \r | |
3897 | //\r | |
3898 | // Print register Bridge Control\r | |
3899 | //\r | |
3900 | PciExplainBridgeControl (&(CardBus->BridgeControl), PciCardBusBridge);\r | |
3901 | \r | |
3902 | //\r | |
3903 | // Print some registers in data region of PCI configuration space for cardbus\r | |
3904 | // bridge. Fields include: Sub VendorId, Subsystem ID, and Legacy Mode Base\r | |
3905 | // Address.\r | |
3906 | //\r | |
0c84a69f | 3907 | CardBusData = (PCI_CARDBUS_DATA *) ((UINT8 *) CardBus + sizeof (PCI_CARDBUS_CONTROL_REGISTER));\r |
5d73d92f | 3908 | \r |
3909 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3910 | STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID_2),\r | |
3911 | gShellDebug1HiiHandle,\r | |
3912 | INDEX_OF (&(CardBusData->SubVendorId)),\r | |
3913 | CardBusData->SubVendorId,\r | |
3914 | INDEX_OF (&(CardBusData->SubSystemId)),\r | |
3915 | CardBusData->SubSystemId\r | |
3916 | );\r | |
3917 | \r | |
3918 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3919 | STRING_TOKEN (STR_PCI2_OPTIONAL),\r | |
3920 | gShellDebug1HiiHandle,\r | |
3921 | INDEX_OF (&(CardBusData->LegacyBase)),\r | |
3922 | CardBusData->LegacyBase\r | |
3923 | );\r | |
3924 | \r | |
3925 | return EFI_SUCCESS;\r | |
3926 | }\r | |
3927 | \r | |
a1d4bfcc | 3928 | /**\r |
3929 | Explain each meaningful bit of register Status. The definition of Status is\r | |
3930 | slightly different depending on the PCI header type.\r | |
3931 | \r | |
3932 | @param[in] Status Points to the content of register Status.\r | |
3933 | @param[in] MainStatus Indicates if this register is main status(not secondary\r | |
3934 | status).\r | |
3935 | @param[in] HeaderType Header type of this PCI device.\r | |
3936 | \r | |
3937 | @retval EFI_SUCCESS The command completed successfully.\r | |
3938 | **/\r | |
5d73d92f | 3939 | EFI_STATUS\r |
3940 | PciExplainStatus (\r | |
3941 | IN UINT16 *Status,\r | |
3942 | IN BOOLEAN MainStatus,\r | |
3943 | IN PCI_HEADER_TYPE HeaderType\r | |
3944 | )\r | |
5d73d92f | 3945 | {\r |
3946 | if (MainStatus) {\r | |
3947 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);\r | |
3948 | \r | |
3949 | } else {\r | |
3950 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SECONDARY_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);\r | |
3951 | }\r | |
3952 | \r | |
0c84a69f | 3953 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEW_CAPABILITIES), gShellDebug1HiiHandle, (*Status & BIT4) != 0);\r |
5d73d92f | 3954 | \r |
3955 | //\r | |
3956 | // Bit 5 is meaningless for CardBus Bridge\r | |
3957 | //\r | |
3958 | if (HeaderType == PciCardBusBridge) {\r | |
0c84a69f | 3959 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE), gShellDebug1HiiHandle, (*Status & BIT5) != 0);\r |
5d73d92f | 3960 | \r |
3961 | } else {\r | |
0c84a69f | 3962 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE_2), gShellDebug1HiiHandle, (*Status & BIT5) != 0);\r |
5d73d92f | 3963 | }\r |
3964 | \r | |
0c84a69f | 3965 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST_BACK), gShellDebug1HiiHandle, (*Status & BIT7) != 0);\r |
5d73d92f | 3966 | \r |
0c84a69f | 3967 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MASTER_DATA), gShellDebug1HiiHandle, (*Status & BIT8) != 0);\r |
5d73d92f | 3968 | //\r |
3969 | // Bit 9 and bit 10 together decides the DEVSEL timing\r | |
3970 | //\r | |
3971 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_DEVSEL_TIMING), gShellDebug1HiiHandle);\r | |
0c84a69f | 3972 | if ((*Status & BIT9) == 0 && (*Status & BIT10) == 0) {\r |
5d73d92f | 3973 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST), gShellDebug1HiiHandle);\r |
3974 | \r | |
0c84a69f | 3975 | } else if ((*Status & BIT9) != 0 && (*Status & BIT10) == 0) {\r |
5d73d92f | 3976 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEDIUM), gShellDebug1HiiHandle);\r |
3977 | \r | |
0c84a69f | 3978 | } else if ((*Status & BIT9) == 0 && (*Status & BIT10) != 0) {\r |
5d73d92f | 3979 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SLOW), gShellDebug1HiiHandle);\r |
3980 | \r | |
3981 | } else {\r | |
3982 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED_2), gShellDebug1HiiHandle);\r | |
3983 | }\r | |
3984 | \r | |
3985 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3986 | STRING_TOKEN (STR_PCI2_SIGNALED_TARGET),\r | |
3987 | gShellDebug1HiiHandle,\r | |
0c84a69f | 3988 | (*Status & BIT11) != 0\r |
5d73d92f | 3989 | );\r |
3990 | \r | |
3991 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3992 | STRING_TOKEN (STR_PCI2_RECEIVED_TARGET),\r | |
3993 | gShellDebug1HiiHandle,\r | |
0c84a69f | 3994 | (*Status & BIT12) != 0\r |
5d73d92f | 3995 | );\r |
3996 | \r | |
3997 | ShellPrintHiiEx(-1, -1, NULL,\r | |
3998 | STRING_TOKEN (STR_PCI2_RECEIVED_MASTER),\r | |
3999 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4000 | (*Status & BIT13) != 0\r |
5d73d92f | 4001 | );\r |
4002 | \r | |
4003 | if (MainStatus) {\r | |
4004 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4005 | STRING_TOKEN (STR_PCI2_SIGNALED_ERROR),\r | |
4006 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4007 | (*Status & BIT14) != 0\r |
5d73d92f | 4008 | );\r |
4009 | \r | |
4010 | } else {\r | |
4011 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4012 | STRING_TOKEN (STR_PCI2_RECEIVED_ERROR),\r | |
4013 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4014 | (*Status & BIT14) != 0\r |
5d73d92f | 4015 | );\r |
4016 | }\r | |
4017 | \r | |
4018 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4019 | STRING_TOKEN (STR_PCI2_DETECTED_ERROR),\r | |
4020 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4021 | (*Status & BIT15) != 0\r |
5d73d92f | 4022 | );\r |
4023 | \r | |
4024 | return EFI_SUCCESS;\r | |
4025 | }\r | |
4026 | \r | |
a1d4bfcc | 4027 | /**\r |
5d73d92f | 4028 | Explain each meaningful bit of register Command.\r |
4029 | \r | |
a1d4bfcc | 4030 | @param[in] Command Points to the content of register Command.\r |
5d73d92f | 4031 | \r |
a1d4bfcc | 4032 | @retval EFI_SUCCESS The command completed successfully.\r |
5d73d92f | 4033 | **/\r |
a1d4bfcc | 4034 | EFI_STATUS\r |
4035 | PciExplainCommand (\r | |
4036 | IN UINT16 *Command\r | |
4037 | )\r | |
5d73d92f | 4038 | {\r |
4039 | //\r | |
4040 | // Print the binary value of register Command\r | |
4041 | //\r | |
4042 | ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_COMMAND), gShellDebug1HiiHandle, INDEX_OF (Command), *Command);\r | |
4043 | \r | |
4044 | //\r | |
4045 | // Explain register Command bit by bit\r | |
4046 | //\r | |
4047 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4048 | STRING_TOKEN (STR_PCI2_SPACE_ACCESS_DENIED),\r | |
4049 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4050 | (*Command & BIT0) != 0\r |
5d73d92f | 4051 | );\r |
4052 | \r | |
4053 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4054 | STRING_TOKEN (STR_PCI2_MEMORY_SPACE),\r | |
4055 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4056 | (*Command & BIT1) != 0\r |
5d73d92f | 4057 | );\r |
4058 | \r | |
4059 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4060 | STRING_TOKEN (STR_PCI2_BEHAVE_BUS_MASTER),\r | |
4061 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4062 | (*Command & BIT2) != 0\r |
5d73d92f | 4063 | );\r |
4064 | \r | |
4065 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4066 | STRING_TOKEN (STR_PCI2_MONITOR_SPECIAL_CYCLE),\r | |
4067 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4068 | (*Command & BIT3) != 0\r |
5d73d92f | 4069 | );\r |
4070 | \r | |
4071 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4072 | STRING_TOKEN (STR_PCI2_MEM_WRITE_INVALIDATE),\r | |
4073 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4074 | (*Command & BIT4) != 0\r |
5d73d92f | 4075 | );\r |
4076 | \r | |
4077 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4078 | STRING_TOKEN (STR_PCI2_PALETTE_SNOOPING),\r | |
4079 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4080 | (*Command & BIT5) != 0\r |
5d73d92f | 4081 | );\r |
4082 | \r | |
4083 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4084 | STRING_TOKEN (STR_PCI2_ASSERT_PERR),\r | |
4085 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4086 | (*Command & BIT6) != 0\r |
5d73d92f | 4087 | );\r |
4088 | \r | |
4089 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4090 | STRING_TOKEN (STR_PCI2_DO_ADDR_STEPPING),\r | |
4091 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4092 | (*Command & BIT7) != 0\r |
5d73d92f | 4093 | );\r |
4094 | \r | |
4095 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4096 | STRING_TOKEN (STR_PCI2_SERR_DRIVER),\r | |
4097 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4098 | (*Command & BIT8) != 0\r |
5d73d92f | 4099 | );\r |
4100 | \r | |
4101 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4102 | STRING_TOKEN (STR_PCI2_FAST_BACK_2),\r | |
4103 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4104 | (*Command & BIT9) != 0\r |
5d73d92f | 4105 | );\r |
4106 | \r | |
4107 | return EFI_SUCCESS;\r | |
4108 | }\r | |
4109 | \r | |
a1d4bfcc | 4110 | /**\r |
4111 | Explain each meaningful bit of register Bridge Control.\r | |
4112 | \r | |
4113 | @param[in] BridgeControl Points to the content of register Bridge Control.\r | |
4114 | @param[in] HeaderType The headertype.\r | |
4115 | \r | |
4116 | @retval EFI_SUCCESS The command completed successfully.\r | |
4117 | **/\r | |
5d73d92f | 4118 | EFI_STATUS\r |
4119 | PciExplainBridgeControl (\r | |
4120 | IN UINT16 *BridgeControl,\r | |
4121 | IN PCI_HEADER_TYPE HeaderType\r | |
4122 | )\r | |
5d73d92f | 4123 | {\r |
4124 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4125 | STRING_TOKEN (STR_PCI2_BRIDGE_CONTROL),\r | |
4126 | gShellDebug1HiiHandle,\r | |
4127 | INDEX_OF (BridgeControl),\r | |
4128 | *BridgeControl\r | |
4129 | );\r | |
4130 | \r | |
4131 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4132 | STRING_TOKEN (STR_PCI2_PARITY_ERROR),\r | |
4133 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4134 | (*BridgeControl & BIT0) != 0\r |
5d73d92f | 4135 | );\r |
4136 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4137 | STRING_TOKEN (STR_PCI2_SERR_ENABLE),\r | |
4138 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4139 | (*BridgeControl & BIT1) != 0\r |
5d73d92f | 4140 | );\r |
4141 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4142 | STRING_TOKEN (STR_PCI2_ISA_ENABLE),\r | |
4143 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4144 | (*BridgeControl & BIT2) != 0\r |
5d73d92f | 4145 | );\r |
4146 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4147 | STRING_TOKEN (STR_PCI2_VGA_ENABLE),\r | |
4148 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4149 | (*BridgeControl & BIT3) != 0\r |
5d73d92f | 4150 | );\r |
4151 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4152 | STRING_TOKEN (STR_PCI2_MASTER_ABORT),\r | |
4153 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4154 | (*BridgeControl & BIT5) != 0\r |
5d73d92f | 4155 | );\r |
4156 | \r | |
4157 | //\r | |
4158 | // Register Bridge Control has some slight differences between P2P bridge\r | |
4159 | // and Cardbus bridge from bit 6 to bit 11.\r | |
4160 | //\r | |
4161 | if (HeaderType == PciP2pBridge) {\r | |
4162 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4163 | STRING_TOKEN (STR_PCI2_SECONDARY_BUS_RESET),\r | |
4164 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4165 | (*BridgeControl & BIT6) != 0\r |
5d73d92f | 4166 | );\r |
4167 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4168 | STRING_TOKEN (STR_PCI2_FAST_ENABLE),\r | |
4169 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4170 | (*BridgeControl & BIT7) != 0\r |
5d73d92f | 4171 | );\r |
4172 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4173 | STRING_TOKEN (STR_PCI2_PRIMARY_DISCARD_TIMER),\r | |
4174 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4175 | (*BridgeControl & BIT8)!=0 ? L"2^10" : L"2^15"\r |
5d73d92f | 4176 | );\r |
4177 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4178 | STRING_TOKEN (STR_PCI2_SECONDARY_DISCARD_TIMER),\r | |
4179 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4180 | (*BridgeControl & BIT9)!=0 ? L"2^10" : L"2^15"\r |
5d73d92f | 4181 | );\r |
4182 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4183 | STRING_TOKEN (STR_PCI2_DISCARD_TIMER_STATUS),\r | |
4184 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4185 | (*BridgeControl & BIT10) != 0\r |
5d73d92f | 4186 | );\r |
4187 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4188 | STRING_TOKEN (STR_PCI2_DISCARD_TIMER_SERR),\r | |
4189 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4190 | (*BridgeControl & BIT11) != 0\r |
5d73d92f | 4191 | );\r |
4192 | \r | |
4193 | } else {\r | |
4194 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4195 | STRING_TOKEN (STR_PCI2_CARDBUS_RESET),\r | |
4196 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4197 | (*BridgeControl & BIT6) != 0\r |
5d73d92f | 4198 | );\r |
4199 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4200 | STRING_TOKEN (STR_PCI2_IREQ_ENABLE),\r | |
4201 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4202 | (*BridgeControl & BIT7) != 0\r |
5d73d92f | 4203 | );\r |
4204 | ShellPrintHiiEx(-1, -1, NULL,\r | |
4205 | STRING_TOKEN (STR_PCI2_WRITE_POSTING_ENABLE),\r | |
4206 | gShellDebug1HiiHandle,\r | |
0c84a69f | 4207 | (*BridgeControl & BIT10) != 0\r |
5d73d92f | 4208 | );\r |
4209 | }\r | |
4210 | \r | |
4211 | return EFI_SUCCESS;\r | |
4212 | }\r | |
4213 | \r | |
a1d4bfcc | 4214 | /**\r |
4215 | Print each capability structure.\r | |
4216 | \r | |
f614ce7e SQ |
4217 | @param[in] IoDev The pointer to the deivce.\r |
4218 | @param[in] Address The address to start at.\r | |
4219 | @param[in] CapPtr The offset from the address.\r | |
4220 | @param[in] EnhancedDump The print format for the dump data.\r | |
a1d4bfcc | 4221 | \r |
4222 | @retval EFI_SUCCESS The operation was successful.\r | |
4223 | **/\r | |
5d73d92f | 4224 | EFI_STATUS\r |
4225 | PciExplainCapabilityStruct (\r | |
4226 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r | |
4227 | IN UINT64 Address,\r | |
705bffb5 JC |
4228 | IN UINT8 CapPtr,\r |
4229 | IN CONST UINT16 EnhancedDump\r | |
5d73d92f | 4230 | )\r |
4231 | {\r | |
4232 | UINT8 CapabilityPtr;\r | |
4233 | UINT16 CapabilityEntry;\r | |
4234 | UINT8 CapabilityID;\r | |
4235 | UINT64 RegAddress;\r | |
4236 | \r | |
4237 | CapabilityPtr = CapPtr;\r | |
4238 | \r | |
4239 | //\r | |
4240 | // Go through the Capability list\r | |
4241 | //\r | |
4242 | while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {\r | |
4243 | RegAddress = Address + CapabilityPtr;\r | |
4244 | IoDev->Pci.Read (IoDev, EfiPciWidthUint16, RegAddress, 1, &CapabilityEntry);\r | |
4245 | \r | |
4246 | CapabilityID = (UINT8) CapabilityEntry;\r | |
4247 | \r | |
4248 | //\r | |
4249 | // Explain PciExpress data\r | |
4250 | //\r | |
4251 | if (EFI_PCI_CAPABILITY_ID_PCIEXP == CapabilityID) {\r | |
705bffb5 | 4252 | PciExplainPciExpress (IoDev, Address, CapabilityPtr, EnhancedDump);\r |
5d73d92f | 4253 | return EFI_SUCCESS;\r |
4254 | }\r | |
4255 | //\r | |
4256 | // Explain other capabilities here\r | |
4257 | //\r | |
4258 | CapabilityPtr = (UINT8) (CapabilityEntry >> 8);\r | |
4259 | }\r | |
4260 | \r | |
4261 | return EFI_SUCCESS;\r | |
4262 | }\r | |
4263 | \r | |
a1d4bfcc | 4264 | /**\r |
4265 | Print out information of the capability information.\r | |
4266 | \r | |
4267 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4268 | \r | |
4269 | @retval EFI_SUCCESS The operation was successful.\r | |
4270 | **/\r | |
5d73d92f | 4271 | EFI_STATUS\r |
4272 | ExplainPcieCapReg (\r | |
0c84a69f | 4273 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4274 | )\r |
5d73d92f | 4275 | {\r |
5d73d92f | 4276 | CHAR16 *DevicePortType;\r |
4277 | \r | |
c37e0f16 CP |
4278 | ShellPrintEx (-1, -1,\r |
4279 | L" Capability Version(3:0): %E0x%04x%N\r\n",\r | |
0c84a69f | 4280 | PciExpressCap->Capability.Bits.Version\r |
5d73d92f | 4281 | );\r |
0c84a69f RN |
4282 | if (PciExpressCap->Capability.Bits.DevicePortType < ARRAY_SIZE (DevicePortTypeTable)) {\r |
4283 | DevicePortType = DevicePortTypeTable[PciExpressCap->Capability.Bits.DevicePortType];\r | |
5d73d92f | 4284 | } else {\r |
4285 | DevicePortType = L"Unknown Type";\r | |
4286 | }\r | |
c37e0f16 CP |
4287 | ShellPrintEx (-1, -1,\r |
4288 | L" Device/PortType(7:4): %E%s%N\r\n",\r | |
5d73d92f | 4289 | DevicePortType\r |
4290 | );\r | |
4291 | //\r | |
4292 | // 'Slot Implemented' is only valid for:\r | |
4293 | // a) Root Port of PCI Express Root Complex, or\r | |
4294 | // b) Downstream Port of PCI Express Switch\r | |
4295 | //\r | |
0c84a69f RN |
4296 | if (PciExpressCap->Capability.Bits.DevicePortType== PCIE_DEVICE_PORT_TYPE_ROOT_PORT ||\r |
4297 | PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT) {\r | |
c37e0f16 CP |
4298 | ShellPrintEx (-1, -1,\r |
4299 | L" Slot Implemented(8): %E%d%N\r\n",\r | |
0c84a69f | 4300 | PciExpressCap->Capability.Bits.SlotImplemented\r |
5d73d92f | 4301 | );\r |
4302 | }\r | |
c37e0f16 CP |
4303 | ShellPrintEx (-1, -1,\r |
4304 | L" Interrupt Message Number(13:9): %E0x%05x%N\r\n",\r | |
0c84a69f | 4305 | PciExpressCap->Capability.Bits.InterruptMessageNumber\r |
5d73d92f | 4306 | );\r |
4307 | return EFI_SUCCESS;\r | |
4308 | }\r | |
4309 | \r | |
a1d4bfcc | 4310 | /**\r |
4311 | Print out information of the device capability information.\r | |
4312 | \r | |
4313 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4314 | \r | |
4315 | @retval EFI_SUCCESS The operation was successful.\r | |
4316 | **/\r | |
5d73d92f | 4317 | EFI_STATUS\r |
4318 | ExplainPcieDeviceCap (\r | |
0c84a69f | 4319 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4320 | )\r |
5d73d92f | 4321 | {\r |
5d73d92f | 4322 | UINT8 DevicePortType;\r |
4323 | UINT8 L0sLatency;\r | |
4324 | UINT8 L1Latency;\r | |
4325 | \r | |
0c84a69f | 4326 | DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType;\r |
c37e0f16 | 4327 | ShellPrintEx (-1, -1, L" Max_Payload_Size Supported(2:0): ");\r |
0c84a69f RN |
4328 | if (PciExpressCap->DeviceCapability.Bits.MaxPayloadSize < 6) {\r |
4329 | ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceCapability.Bits.MaxPayloadSize + 7));\r | |
5d73d92f | 4330 | } else {\r |
c37e0f16 | 4331 | ShellPrintEx (-1, -1, L"%EUnknown%N\r\n");\r |
5d73d92f | 4332 | }\r |
c37e0f16 CP |
4333 | ShellPrintEx (-1, -1,\r |
4334 | L" Phantom Functions Supported(4:3): %E%d%N\r\n",\r | |
0c84a69f | 4335 | PciExpressCap->DeviceCapability.Bits.PhantomFunctions\r |
5d73d92f | 4336 | );\r |
c37e0f16 CP |
4337 | ShellPrintEx (-1, -1,\r |
4338 | L" Extended Tag Field Supported(5): %E%d-bit Tag field supported%N\r\n",\r | |
0c84a69f | 4339 | PciExpressCap->DeviceCapability.Bits.ExtendedTagField ? 8 : 5\r |
5d73d92f | 4340 | );\r |
4341 | //\r | |
4342 | // Endpoint L0s and L1 Acceptable Latency is only valid for Endpoint\r | |
4343 | //\r | |
4344 | if (IS_PCIE_ENDPOINT (DevicePortType)) {\r | |
0c84a69f RN |
4345 | L0sLatency = (UINT8)PciExpressCap->DeviceCapability.Bits.EndpointL0sAcceptableLatency;\r |
4346 | L1Latency = (UINT8)PciExpressCap->DeviceCapability.Bits.EndpointL1AcceptableLatency;\r | |
c37e0f16 | 4347 | ShellPrintEx (-1, -1, L" Endpoint L0s Acceptable Latency(8:6): ");\r |
5d73d92f | 4348 | if (L0sLatency < 4) {\r |
c37e0f16 | 4349 | ShellPrintEx (-1, -1, L"%EMaximum of %d ns%N\r\n", 1 << (L0sLatency + 6));\r |
5d73d92f | 4350 | } else {\r |
4351 | if (L0sLatency < 7) {\r | |
c37e0f16 | 4352 | ShellPrintEx (-1, -1, L"%EMaximum of %d us%N\r\n", 1 << (L0sLatency - 3));\r |
5d73d92f | 4353 | } else {\r |
c37e0f16 | 4354 | ShellPrintEx (-1, -1, L"%ENo limit%N\r\n");\r |
5d73d92f | 4355 | }\r |
4356 | }\r | |
c37e0f16 | 4357 | ShellPrintEx (-1, -1, L" Endpoint L1 Acceptable Latency(11:9): ");\r |
5d73d92f | 4358 | if (L1Latency < 7) {\r |
c37e0f16 | 4359 | ShellPrintEx (-1, -1, L"%EMaximum of %d us%N\r\n", 1 << (L1Latency + 1));\r |
5d73d92f | 4360 | } else {\r |
c37e0f16 | 4361 | ShellPrintEx (-1, -1, L"%ENo limit%N\r\n");\r |
5d73d92f | 4362 | }\r |
4363 | }\r | |
c37e0f16 CP |
4364 | ShellPrintEx (-1, -1,\r |
4365 | L" Role-based Error Reporting(15): %E%d%N\r\n",\r | |
0c84a69f | 4366 | PciExpressCap->DeviceCapability.Bits.RoleBasedErrorReporting\r |
5d73d92f | 4367 | );\r |
4368 | //\r | |
4369 | // Only valid for Upstream Port:\r | |
4370 | // a) Captured Slot Power Limit Value\r | |
4371 | // b) Captured Slot Power Scale\r | |
4372 | //\r | |
0c84a69f | 4373 | if (DevicePortType == PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT) {\r |
c37e0f16 CP |
4374 | ShellPrintEx (-1, -1,\r |
4375 | L" Captured Slot Power Limit Value(25:18): %E0x%02x%N\r\n",\r | |
0c84a69f | 4376 | PciExpressCap->DeviceCapability.Bits.CapturedSlotPowerLimitValue\r |
5d73d92f | 4377 | );\r |
c37e0f16 CP |
4378 | ShellPrintEx (-1, -1,\r |
4379 | L" Captured Slot Power Limit Scale(27:26): %E%s%N\r\n",\r | |
0c84a69f | 4380 | SlotPwrLmtScaleTable[PciExpressCap->DeviceCapability.Bits.CapturedSlotPowerLimitScale]\r |
5d73d92f | 4381 | );\r |
4382 | }\r | |
4383 | //\r | |
4384 | // Function Level Reset Capability is only valid for Endpoint\r | |
4385 | //\r | |
4386 | if (IS_PCIE_ENDPOINT (DevicePortType)) {\r | |
c37e0f16 CP |
4387 | ShellPrintEx (-1, -1,\r |
4388 | L" Function Level Reset Capability(28): %E%d%N\r\n",\r | |
0c84a69f | 4389 | PciExpressCap->DeviceCapability.Bits.FunctionLevelReset\r |
5d73d92f | 4390 | );\r |
4391 | }\r | |
4392 | return EFI_SUCCESS;\r | |
4393 | }\r | |
4394 | \r | |
a1d4bfcc | 4395 | /**\r |
4396 | Print out information of the device control information.\r | |
4397 | \r | |
4398 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4399 | \r | |
4400 | @retval EFI_SUCCESS The operation was successful.\r | |
4401 | **/\r | |
5d73d92f | 4402 | EFI_STATUS\r |
4403 | ExplainPcieDeviceControl (\r | |
0c84a69f | 4404 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4405 | )\r |
5d73d92f | 4406 | {\r |
c37e0f16 CP |
4407 | ShellPrintEx (-1, -1,\r |
4408 | L" Correctable Error Reporting Enable(0): %E%d%N\r\n",\r | |
0c84a69f RN |
4409 | PciExpressCap->DeviceControl.Bits.CorrectableError\r |
4410 | );\r | |
c37e0f16 CP |
4411 | ShellPrintEx (-1, -1,\r |
4412 | L" Non-Fatal Error Reporting Enable(1): %E%d%N\r\n",\r | |
0c84a69f | 4413 | PciExpressCap->DeviceControl.Bits.NonFatalError\r |
5d73d92f | 4414 | );\r |
c37e0f16 CP |
4415 | ShellPrintEx (-1, -1,\r |
4416 | L" Fatal Error Reporting Enable(2): %E%d%N\r\n",\r | |
0c84a69f | 4417 | PciExpressCap->DeviceControl.Bits.FatalError\r |
5d73d92f | 4418 | );\r |
c37e0f16 CP |
4419 | ShellPrintEx (-1, -1,\r |
4420 | L" Unsupported Request Reporting Enable(3): %E%d%N\r\n",\r | |
0c84a69f | 4421 | PciExpressCap->DeviceControl.Bits.UnsupportedRequest\r |
5d73d92f | 4422 | );\r |
c37e0f16 CP |
4423 | ShellPrintEx (-1, -1,\r |
4424 | L" Enable Relaxed Ordering(4): %E%d%N\r\n",\r | |
0c84a69f | 4425 | PciExpressCap->DeviceControl.Bits.RelaxedOrdering\r |
5d73d92f | 4426 | );\r |
c37e0f16 | 4427 | ShellPrintEx (-1, -1, L" Max_Payload_Size(7:5): ");\r |
0c84a69f RN |
4428 | if (PciExpressCap->DeviceControl.Bits.MaxPayloadSize < 6) {\r |
4429 | ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceControl.Bits.MaxPayloadSize + 7));\r | |
5d73d92f | 4430 | } else {\r |
c37e0f16 | 4431 | ShellPrintEx (-1, -1, L"%EUnknown%N\r\n");\r |
5d73d92f | 4432 | }\r |
c37e0f16 CP |
4433 | ShellPrintEx (-1, -1,\r |
4434 | L" Extended Tag Field Enable(8): %E%d%N\r\n",\r | |
0c84a69f | 4435 | PciExpressCap->DeviceControl.Bits.ExtendedTagField\r |
5d73d92f | 4436 | );\r |
c37e0f16 CP |
4437 | ShellPrintEx (-1, -1,\r |
4438 | L" Phantom Functions Enable(9): %E%d%N\r\n",\r | |
0c84a69f | 4439 | PciExpressCap->DeviceControl.Bits.PhantomFunctions\r |
5d73d92f | 4440 | );\r |
c37e0f16 CP |
4441 | ShellPrintEx (-1, -1,\r |
4442 | L" Auxiliary (AUX) Power PM Enable(10): %E%d%N\r\n",\r | |
0c84a69f | 4443 | PciExpressCap->DeviceControl.Bits.AuxPower\r |
5d73d92f | 4444 | );\r |
c37e0f16 CP |
4445 | ShellPrintEx (-1, -1,\r |
4446 | L" Enable No Snoop(11): %E%d%N\r\n",\r | |
0c84a69f | 4447 | PciExpressCap->DeviceControl.Bits.NoSnoop\r |
5d73d92f | 4448 | );\r |
c37e0f16 | 4449 | ShellPrintEx (-1, -1, L" Max_Read_Request_Size(14:12): ");\r |
0c84a69f RN |
4450 | if (PciExpressCap->DeviceControl.Bits.MaxReadRequestSize < 6) {\r |
4451 | ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PciExpressCap->DeviceControl.Bits.MaxReadRequestSize + 7));\r | |
5d73d92f | 4452 | } else {\r |
c37e0f16 | 4453 | ShellPrintEx (-1, -1, L"%EUnknown%N\r\n");\r |
5d73d92f | 4454 | }\r |
4455 | //\r | |
4456 | // Read operation is only valid for PCI Express to PCI/PCI-X Bridges\r | |
4457 | //\r | |
0c84a69f | 4458 | if (PciExpressCap->Capability.Bits.DevicePortType == PCIE_DEVICE_PORT_TYPE_PCIE_TO_PCI_BRIDGE) {\r |
c37e0f16 CP |
4459 | ShellPrintEx (-1, -1,\r |
4460 | L" Bridge Configuration Retry Enable(15): %E%d%N\r\n",\r | |
0c84a69f | 4461 | PciExpressCap->DeviceControl.Bits.BridgeConfigurationRetryOrFunctionLevelReset\r |
5d73d92f | 4462 | );\r |
4463 | }\r | |
4464 | return EFI_SUCCESS;\r | |
4465 | }\r | |
4466 | \r | |
a1d4bfcc | 4467 | /**\r |
4468 | Print out information of the device status information.\r | |
4469 | \r | |
4470 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4471 | \r | |
4472 | @retval EFI_SUCCESS The operation was successful.\r | |
4473 | **/\r | |
5d73d92f | 4474 | EFI_STATUS\r |
4475 | ExplainPcieDeviceStatus (\r | |
0c84a69f | 4476 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4477 | )\r |
5d73d92f | 4478 | {\r |
c37e0f16 CP |
4479 | ShellPrintEx (-1, -1,\r |
4480 | L" Correctable Error Detected(0): %E%d%N\r\n",\r | |
0c84a69f | 4481 | PciExpressCap->DeviceStatus.Bits.CorrectableError\r |
5d73d92f | 4482 | );\r |
c37e0f16 CP |
4483 | ShellPrintEx (-1, -1,\r |
4484 | L" Non-Fatal Error Detected(1): %E%d%N\r\n",\r | |
0c84a69f | 4485 | PciExpressCap->DeviceStatus.Bits.NonFatalError\r |
5d73d92f | 4486 | );\r |
c37e0f16 CP |
4487 | ShellPrintEx (-1, -1,\r |
4488 | L" Fatal Error Detected(2): %E%d%N\r\n",\r | |
0c84a69f | 4489 | PciExpressCap->DeviceStatus.Bits.FatalError\r |
5d73d92f | 4490 | );\r |
c37e0f16 CP |
4491 | ShellPrintEx (-1, -1,\r |
4492 | L" Unsupported Request Detected(3): %E%d%N\r\n",\r | |
0c84a69f | 4493 | PciExpressCap->DeviceStatus.Bits.UnsupportedRequest\r |
5d73d92f | 4494 | );\r |
c37e0f16 CP |
4495 | ShellPrintEx (-1, -1,\r |
4496 | L" AUX Power Detected(4): %E%d%N\r\n",\r | |
0c84a69f | 4497 | PciExpressCap->DeviceStatus.Bits.AuxPower\r |
5d73d92f | 4498 | );\r |
c37e0f16 CP |
4499 | ShellPrintEx (-1, -1,\r |
4500 | L" Transactions Pending(5): %E%d%N\r\n",\r | |
0c84a69f | 4501 | PciExpressCap->DeviceStatus.Bits.TransactionsPending\r |
5d73d92f | 4502 | );\r |
4503 | return EFI_SUCCESS;\r | |
4504 | }\r | |
4505 | \r | |
a1d4bfcc | 4506 | /**\r |
4507 | Print out information of the device link information.\r | |
4508 | \r | |
4509 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4510 | \r | |
4511 | @retval EFI_SUCCESS The operation was successful.\r | |
4512 | **/\r | |
5d73d92f | 4513 | EFI_STATUS\r |
4514 | ExplainPcieLinkCap (\r | |
0c84a69f | 4515 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4516 | )\r |
5d73d92f | 4517 | {\r |
541ddf44 | 4518 | CHAR16 *MaxLinkSpeed;\r |
a1d4bfcc | 4519 | CHAR16 *AspmValue;\r |
5d73d92f | 4520 | \r |
0c84a69f | 4521 | switch (PciExpressCap->LinkCapability.Bits.MaxLinkSpeed) {\r |
5d73d92f | 4522 | case 1:\r |
541ddf44 | 4523 | MaxLinkSpeed = L"2.5 GT/s";\r |
5d73d92f | 4524 | break;\r |
4525 | case 2:\r | |
541ddf44 CP |
4526 | MaxLinkSpeed = L"5.0 GT/s";\r |
4527 | break;\r | |
4528 | case 3:\r | |
4529 | MaxLinkSpeed = L"8.0 GT/s";\r | |
5d73d92f | 4530 | break;\r |
4531 | default:\r | |
541ddf44 | 4532 | MaxLinkSpeed = L"Unknown";\r |
5d73d92f | 4533 | break;\r |
4534 | }\r | |
c37e0f16 | 4535 | ShellPrintEx (-1, -1,\r |
541ddf44 CP |
4536 | L" Maximum Link Speed(3:0): %E%s%N\r\n",\r |
4537 | MaxLinkSpeed\r | |
5d73d92f | 4538 | );\r |
c37e0f16 CP |
4539 | ShellPrintEx (-1, -1,\r |
4540 | L" Maximum Link Width(9:4): %Ex%d%N\r\n",\r | |
0c84a69f | 4541 | PciExpressCap->LinkCapability.Bits.MaxLinkWidth\r |
5d73d92f | 4542 | );\r |
0c84a69f | 4543 | switch (PciExpressCap->LinkCapability.Bits.Aspm) {\r |
541ddf44 CP |
4544 | case 0:\r |
4545 | AspmValue = L"Not";\r | |
4546 | break;\r | |
5d73d92f | 4547 | case 1:\r |
541ddf44 CP |
4548 | AspmValue = L"L0s";\r |
4549 | break;\r | |
4550 | case 2:\r | |
4551 | AspmValue = L"L1";\r | |
5d73d92f | 4552 | break;\r |
4553 | case 3:\r | |
a1d4bfcc | 4554 | AspmValue = L"L0s and L1";\r |
5d73d92f | 4555 | break;\r |
4556 | default:\r | |
a1d4bfcc | 4557 | AspmValue = L"Reserved";\r |
5d73d92f | 4558 | break;\r |
4559 | }\r | |
c37e0f16 CP |
4560 | ShellPrintEx (-1, -1,\r |
4561 | L" Active State Power Management Support(11:10): %E%s Supported%N\r\n",\r | |
a1d4bfcc | 4562 | AspmValue\r |
5d73d92f | 4563 | );\r |
c37e0f16 CP |
4564 | ShellPrintEx (-1, -1,\r |
4565 | L" L0s Exit Latency(14:12): %E%s%N\r\n",\r | |
0c84a69f | 4566 | L0sLatencyStrTable[PciExpressCap->LinkCapability.Bits.L0sExitLatency]\r |
5d73d92f | 4567 | );\r |
c37e0f16 CP |
4568 | ShellPrintEx (-1, -1,\r |
4569 | L" L1 Exit Latency(17:15): %E%s%N\r\n",\r | |
0c84a69f | 4570 | L1LatencyStrTable[PciExpressCap->LinkCapability.Bits.L1ExitLatency]\r |
5d73d92f | 4571 | );\r |
c37e0f16 CP |
4572 | ShellPrintEx (-1, -1,\r |
4573 | L" Clock Power Management(18): %E%d%N\r\n",\r | |
0c84a69f | 4574 | PciExpressCap->LinkCapability.Bits.ClockPowerManagement\r |
5d73d92f | 4575 | );\r |
c37e0f16 CP |
4576 | ShellPrintEx (-1, -1,\r |
4577 | L" Surprise Down Error Reporting Capable(19): %E%d%N\r\n",\r | |
0c84a69f | 4578 | PciExpressCap->LinkCapability.Bits.SurpriseDownError\r |
5d73d92f | 4579 | );\r |
c37e0f16 CP |
4580 | ShellPrintEx (-1, -1,\r |
4581 | L" Data Link Layer Link Active Reporting Capable(20): %E%d%N\r\n",\r | |
0c84a69f | 4582 | PciExpressCap->LinkCapability.Bits.DataLinkLayerLinkActive\r |
5d73d92f | 4583 | );\r |
c37e0f16 CP |
4584 | ShellPrintEx (-1, -1,\r |
4585 | L" Link Bandwidth Notification Capability(21): %E%d%N\r\n",\r | |
0c84a69f | 4586 | PciExpressCap->LinkCapability.Bits.LinkBandwidthNotification\r |
5d73d92f | 4587 | );\r |
c37e0f16 CP |
4588 | ShellPrintEx (-1, -1,\r |
4589 | L" Port Number(31:24): %E0x%02x%N\r\n",\r | |
0c84a69f | 4590 | PciExpressCap->LinkCapability.Bits.PortNumber\r |
5d73d92f | 4591 | );\r |
4592 | return EFI_SUCCESS;\r | |
4593 | }\r | |
4594 | \r | |
a1d4bfcc | 4595 | /**\r |
4596 | Print out information of the device link control information.\r | |
4597 | \r | |
4598 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4599 | \r | |
4600 | @retval EFI_SUCCESS The operation was successful.\r | |
4601 | **/\r | |
5d73d92f | 4602 | EFI_STATUS\r |
4603 | ExplainPcieLinkControl (\r | |
0c84a69f | 4604 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4605 | )\r |
5d73d92f | 4606 | {\r |
5d73d92f | 4607 | UINT8 DevicePortType;\r |
4608 | \r | |
0c84a69f | 4609 | DevicePortType = (UINT8)PciExpressCap->Capability.Bits.DevicePortType;\r |
c37e0f16 CP |
4610 | ShellPrintEx (-1, -1,\r |
4611 | L" Active State Power Management Control(1:0): %E%s%N\r\n",\r | |
0c84a69f | 4612 | ASPMCtrlStrTable[PciExpressCap->LinkControl.Bits.AspmControl]\r |
5d73d92f | 4613 | );\r |
4614 | //\r | |
4615 | // RCB is not applicable to switches\r | |
4616 | //\r | |
4617 | if (!IS_PCIE_SWITCH(DevicePortType)) {\r | |
c37e0f16 CP |
4618 | ShellPrintEx (-1, -1,\r |
4619 | L" Read Completion Boundary (RCB)(3): %E%d byte%N\r\n",\r | |
0c84a69f | 4620 | 1 << (PciExpressCap->LinkControl.Bits.ReadCompletionBoundary + 6)\r |
5d73d92f | 4621 | );\r |
4622 | }\r | |
4623 | //\r | |
4624 | // Link Disable is reserved on\r | |
4625 | // a) Endpoints\r | |
4626 | // b) PCI Express to PCI/PCI-X bridges\r | |
4627 | // c) Upstream Ports of Switches\r | |
4628 | //\r | |
4629 | if (!IS_PCIE_ENDPOINT (DevicePortType) &&\r | |
0c84a69f RN |
4630 | DevicePortType != PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT &&\r |
4631 | DevicePortType != PCIE_DEVICE_PORT_TYPE_PCIE_TO_PCI_BRIDGE) {\r | |
c37e0f16 CP |
4632 | ShellPrintEx (-1, -1,\r |
4633 | L" Link Disable(4): %E%d%N\r\n",\r | |
0c84a69f | 4634 | PciExpressCap->LinkControl.Bits.LinkDisable\r |
5d73d92f | 4635 | );\r |
4636 | }\r | |
c37e0f16 CP |
4637 | ShellPrintEx (-1, -1,\r |
4638 | L" Common Clock Configuration(6): %E%d%N\r\n",\r | |
0c84a69f | 4639 | PciExpressCap->LinkControl.Bits.CommonClockConfiguration\r |
5d73d92f | 4640 | );\r |
c37e0f16 CP |
4641 | ShellPrintEx (-1, -1,\r |
4642 | L" Extended Synch(7): %E%d%N\r\n",\r | |
0c84a69f | 4643 | PciExpressCap->LinkControl.Bits.ExtendedSynch\r |
5d73d92f | 4644 | );\r |
c37e0f16 CP |
4645 | ShellPrintEx (-1, -1,\r |
4646 | L" Enable Clock Power Management(8): %E%d%N\r\n",\r | |
0c84a69f | 4647 | PciExpressCap->LinkControl.Bits.ClockPowerManagement\r |
5d73d92f | 4648 | );\r |
c37e0f16 CP |
4649 | ShellPrintEx (-1, -1,\r |
4650 | L" Hardware Autonomous Width Disable(9): %E%d%N\r\n",\r | |
0c84a69f | 4651 | PciExpressCap->LinkControl.Bits.HardwareAutonomousWidthDisable\r |
5d73d92f | 4652 | );\r |
c37e0f16 CP |
4653 | ShellPrintEx (-1, -1,\r |
4654 | L" Link Bandwidth Management Interrupt Enable(10): %E%d%N\r\n",\r | |
0c84a69f | 4655 | PciExpressCap->LinkControl.Bits.LinkBandwidthManagementInterrupt\r |
5d73d92f | 4656 | );\r |
c37e0f16 CP |
4657 | ShellPrintEx (-1, -1,\r |
4658 | L" Link Autonomous Bandwidth Interrupt Enable(11): %E%d%N\r\n",\r | |
0c84a69f | 4659 | PciExpressCap->LinkControl.Bits.LinkAutonomousBandwidthInterrupt\r |
5d73d92f | 4660 | );\r |
4661 | return EFI_SUCCESS;\r | |
4662 | }\r | |
4663 | \r | |
a1d4bfcc | 4664 | /**\r |
4665 | Print out information of the device link status information.\r | |
4666 | \r | |
4667 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4668 | \r | |
4669 | @retval EFI_SUCCESS The operation was successful.\r | |
4670 | **/\r | |
5d73d92f | 4671 | EFI_STATUS\r |
4672 | ExplainPcieLinkStatus (\r | |
0c84a69f | 4673 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4674 | )\r |
5d73d92f | 4675 | {\r |
541ddf44 | 4676 | CHAR16 *CurLinkSpeed;\r |
5d73d92f | 4677 | \r |
0c84a69f | 4678 | switch (PciExpressCap->LinkStatus.Bits.CurrentLinkSpeed) {\r |
5d73d92f | 4679 | case 1:\r |
541ddf44 | 4680 | CurLinkSpeed = L"2.5 GT/s";\r |
5d73d92f | 4681 | break;\r |
4682 | case 2:\r | |
541ddf44 CP |
4683 | CurLinkSpeed = L"5.0 GT/s";\r |
4684 | break;\r | |
4685 | case 3:\r | |
4686 | CurLinkSpeed = L"8.0 GT/s";\r | |
5d73d92f | 4687 | break;\r |
4688 | default:\r | |
541ddf44 | 4689 | CurLinkSpeed = L"Reserved";\r |
5d73d92f | 4690 | break;\r |
4691 | }\r | |
c37e0f16 CP |
4692 | ShellPrintEx (-1, -1,\r |
4693 | L" Current Link Speed(3:0): %E%s%N\r\n",\r | |
541ddf44 | 4694 | CurLinkSpeed\r |
5d73d92f | 4695 | );\r |
c37e0f16 CP |
4696 | ShellPrintEx (-1, -1,\r |
4697 | L" Negotiated Link Width(9:4): %Ex%d%N\r\n",\r | |
0c84a69f | 4698 | PciExpressCap->LinkStatus.Bits.NegotiatedLinkWidth\r |
5d73d92f | 4699 | );\r |
c37e0f16 CP |
4700 | ShellPrintEx (-1, -1,\r |
4701 | L" Link Training(11): %E%d%N\r\n",\r | |
0c84a69f | 4702 | PciExpressCap->LinkStatus.Bits.LinkTraining\r |
5d73d92f | 4703 | );\r |
c37e0f16 CP |
4704 | ShellPrintEx (-1, -1,\r |
4705 | L" Slot Clock Configuration(12): %E%d%N\r\n",\r | |
0c84a69f | 4706 | PciExpressCap->LinkStatus.Bits.SlotClockConfiguration\r |
5d73d92f | 4707 | );\r |
c37e0f16 CP |
4708 | ShellPrintEx (-1, -1,\r |
4709 | L" Data Link Layer Link Active(13): %E%d%N\r\n",\r | |
0c84a69f | 4710 | PciExpressCap->LinkStatus.Bits.DataLinkLayerLinkActive\r |
5d73d92f | 4711 | );\r |
c37e0f16 CP |
4712 | ShellPrintEx (-1, -1,\r |
4713 | L" Link Bandwidth Management Status(14): %E%d%N\r\n",\r | |
0c84a69f | 4714 | PciExpressCap->LinkStatus.Bits.LinkBandwidthManagement\r |
5d73d92f | 4715 | );\r |
c37e0f16 CP |
4716 | ShellPrintEx (-1, -1,\r |
4717 | L" Link Autonomous Bandwidth Status(15): %E%d%N\r\n",\r | |
0c84a69f | 4718 | PciExpressCap->LinkStatus.Bits.LinkAutonomousBandwidth\r |
5d73d92f | 4719 | );\r |
4720 | return EFI_SUCCESS;\r | |
4721 | }\r | |
4722 | \r | |
a1d4bfcc | 4723 | /**\r |
4724 | Print out information of the device slot information.\r | |
4725 | \r | |
4726 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4727 | \r | |
4728 | @retval EFI_SUCCESS The operation was successful.\r | |
4729 | **/\r | |
5d73d92f | 4730 | EFI_STATUS\r |
4731 | ExplainPcieSlotCap (\r | |
0c84a69f | 4732 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4733 | )\r |
5d73d92f | 4734 | {\r |
c37e0f16 CP |
4735 | ShellPrintEx (-1, -1,\r |
4736 | L" Attention Button Present(0): %E%d%N\r\n",\r | |
0c84a69f | 4737 | PciExpressCap->SlotCapability.Bits.AttentionButton\r |
5d73d92f | 4738 | );\r |
c37e0f16 CP |
4739 | ShellPrintEx (-1, -1,\r |
4740 | L" Power Controller Present(1): %E%d%N\r\n",\r | |
0c84a69f | 4741 | PciExpressCap->SlotCapability.Bits.PowerController\r |
5d73d92f | 4742 | );\r |
c37e0f16 CP |
4743 | ShellPrintEx (-1, -1,\r |
4744 | L" MRL Sensor Present(2): %E%d%N\r\n",\r | |
0c84a69f | 4745 | PciExpressCap->SlotCapability.Bits.MrlSensor\r |
5d73d92f | 4746 | );\r |
c37e0f16 CP |
4747 | ShellPrintEx (-1, -1,\r |
4748 | L" Attention Indicator Present(3): %E%d%N\r\n",\r | |
0c84a69f | 4749 | PciExpressCap->SlotCapability.Bits.AttentionIndicator\r |
5d73d92f | 4750 | );\r |
c37e0f16 CP |
4751 | ShellPrintEx (-1, -1,\r |
4752 | L" Power Indicator Present(4): %E%d%N\r\n",\r | |
0c84a69f | 4753 | PciExpressCap->SlotCapability.Bits.PowerIndicator\r |
5d73d92f | 4754 | );\r |
c37e0f16 CP |
4755 | ShellPrintEx (-1, -1,\r |
4756 | L" Hot-Plug Surprise(5): %E%d%N\r\n",\r | |
0c84a69f | 4757 | PciExpressCap->SlotCapability.Bits.HotPlugSurprise\r |
5d73d92f | 4758 | );\r |
c37e0f16 CP |
4759 | ShellPrintEx (-1, -1,\r |
4760 | L" Hot-Plug Capable(6): %E%d%N\r\n",\r | |
0c84a69f | 4761 | PciExpressCap->SlotCapability.Bits.HotPlugCapable\r |
5d73d92f | 4762 | );\r |
c37e0f16 CP |
4763 | ShellPrintEx (-1, -1,\r |
4764 | L" Slot Power Limit Value(14:7): %E0x%02x%N\r\n",\r | |
0c84a69f | 4765 | PciExpressCap->SlotCapability.Bits.SlotPowerLimitValue\r |
5d73d92f | 4766 | );\r |
c37e0f16 CP |
4767 | ShellPrintEx (-1, -1,\r |
4768 | L" Slot Power Limit Scale(16:15): %E%s%N\r\n",\r | |
0c84a69f | 4769 | SlotPwrLmtScaleTable[PciExpressCap->SlotCapability.Bits.SlotPowerLimitScale]\r |
5d73d92f | 4770 | );\r |
c37e0f16 CP |
4771 | ShellPrintEx (-1, -1,\r |
4772 | L" Electromechanical Interlock Present(17): %E%d%N\r\n",\r | |
0c84a69f | 4773 | PciExpressCap->SlotCapability.Bits.ElectromechanicalInterlock\r |
5d73d92f | 4774 | );\r |
c37e0f16 CP |
4775 | ShellPrintEx (-1, -1,\r |
4776 | L" No Command Completed Support(18): %E%d%N\r\n",\r | |
0c84a69f | 4777 | PciExpressCap->SlotCapability.Bits.NoCommandCompleted\r |
5d73d92f | 4778 | );\r |
c37e0f16 CP |
4779 | ShellPrintEx (-1, -1,\r |
4780 | L" Physical Slot Number(31:19): %E%d%N\r\n",\r | |
0c84a69f | 4781 | PciExpressCap->SlotCapability.Bits.PhysicalSlotNumber\r |
5d73d92f | 4782 | );\r |
4783 | \r | |
4784 | return EFI_SUCCESS;\r | |
4785 | }\r | |
4786 | \r | |
a1d4bfcc | 4787 | /**\r |
4788 | Print out information of the device slot control information.\r | |
4789 | \r | |
4790 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4791 | \r | |
4792 | @retval EFI_SUCCESS The operation was successful.\r | |
4793 | **/\r | |
5d73d92f | 4794 | EFI_STATUS\r |
4795 | ExplainPcieSlotControl (\r | |
0c84a69f | 4796 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4797 | )\r |
5d73d92f | 4798 | {\r |
c37e0f16 CP |
4799 | ShellPrintEx (-1, -1,\r |
4800 | L" Attention Button Pressed Enable(0): %E%d%N\r\n",\r | |
0c84a69f | 4801 | PciExpressCap->SlotControl.Bits.AttentionButtonPressed\r |
5d73d92f | 4802 | );\r |
c37e0f16 CP |
4803 | ShellPrintEx (-1, -1,\r |
4804 | L" Power Fault Detected Enable(1): %E%d%N\r\n",\r | |
0c84a69f | 4805 | PciExpressCap->SlotControl.Bits.PowerFaultDetected\r |
5d73d92f | 4806 | );\r |
c37e0f16 CP |
4807 | ShellPrintEx (-1, -1,\r |
4808 | L" MRL Sensor Changed Enable(2): %E%d%N\r\n",\r | |
0c84a69f | 4809 | PciExpressCap->SlotControl.Bits.MrlSensorChanged\r |
5d73d92f | 4810 | );\r |
c37e0f16 CP |
4811 | ShellPrintEx (-1, -1,\r |
4812 | L" Presence Detect Changed Enable(3): %E%d%N\r\n",\r | |
0c84a69f | 4813 | PciExpressCap->SlotControl.Bits.PresenceDetectChanged\r |
5d73d92f | 4814 | );\r |
c37e0f16 CP |
4815 | ShellPrintEx (-1, -1,\r |
4816 | L" Command Completed Interrupt Enable(4): %E%d%N\r\n",\r | |
0c84a69f | 4817 | PciExpressCap->SlotControl.Bits.CommandCompletedInterrupt\r |
5d73d92f | 4818 | );\r |
c37e0f16 CP |
4819 | ShellPrintEx (-1, -1,\r |
4820 | L" Hot-Plug Interrupt Enable(5): %E%d%N\r\n",\r | |
0c84a69f | 4821 | PciExpressCap->SlotControl.Bits.HotPlugInterrupt\r |
5d73d92f | 4822 | );\r |
c37e0f16 CP |
4823 | ShellPrintEx (-1, -1,\r |
4824 | L" Attention Indicator Control(7:6): %E%s%N\r\n",\r | |
0c84a69f RN |
4825 | IndicatorTable[\r |
4826 | PciExpressCap->SlotControl.Bits.AttentionIndicator]\r | |
5d73d92f | 4827 | );\r |
c37e0f16 CP |
4828 | ShellPrintEx (-1, -1,\r |
4829 | L" Power Indicator Control(9:8): %E%s%N\r\n",\r | |
0c84a69f | 4830 | IndicatorTable[PciExpressCap->SlotControl.Bits.PowerIndicator]\r |
5d73d92f | 4831 | );\r |
c37e0f16 | 4832 | ShellPrintEx (-1, -1, L" Power Controller Control(10): %EPower ");\r |
0c84a69f RN |
4833 | if (\r |
4834 | PciExpressCap->SlotControl.Bits.PowerController) {\r | |
c37e0f16 | 4835 | ShellPrintEx (-1, -1, L"Off%N\r\n");\r |
5d73d92f | 4836 | } else {\r |
c37e0f16 | 4837 | ShellPrintEx (-1, -1, L"On%N\r\n");\r |
5d73d92f | 4838 | }\r |
c37e0f16 CP |
4839 | ShellPrintEx (-1, -1,\r |
4840 | L" Electromechanical Interlock Control(11): %E%d%N\r\n",\r | |
0c84a69f | 4841 | PciExpressCap->SlotControl.Bits.ElectromechanicalInterlock\r |
5d73d92f | 4842 | );\r |
c37e0f16 CP |
4843 | ShellPrintEx (-1, -1,\r |
4844 | L" Data Link Layer State Changed Enable(12): %E%d%N\r\n",\r | |
0c84a69f | 4845 | PciExpressCap->SlotControl.Bits.DataLinkLayerStateChanged\r |
5d73d92f | 4846 | );\r |
4847 | return EFI_SUCCESS;\r | |
4848 | }\r | |
4849 | \r | |
a1d4bfcc | 4850 | /**\r |
4851 | Print out information of the device slot status information.\r | |
4852 | \r | |
4853 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4854 | \r | |
4855 | @retval EFI_SUCCESS The operation was successful.\r | |
4856 | **/\r | |
5d73d92f | 4857 | EFI_STATUS\r |
4858 | ExplainPcieSlotStatus (\r | |
0c84a69f | 4859 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4860 | )\r |
5d73d92f | 4861 | {\r |
c37e0f16 CP |
4862 | ShellPrintEx (-1, -1,\r |
4863 | L" Attention Button Pressed(0): %E%d%N\r\n",\r | |
0c84a69f | 4864 | PciExpressCap->SlotStatus.Bits.AttentionButtonPressed\r |
5d73d92f | 4865 | );\r |
c37e0f16 CP |
4866 | ShellPrintEx (-1, -1,\r |
4867 | L" Power Fault Detected(1): %E%d%N\r\n",\r | |
0c84a69f | 4868 | PciExpressCap->SlotStatus.Bits.PowerFaultDetected\r |
5d73d92f | 4869 | );\r |
c37e0f16 CP |
4870 | ShellPrintEx (-1, -1,\r |
4871 | L" MRL Sensor Changed(2): %E%d%N\r\n",\r | |
0c84a69f | 4872 | PciExpressCap->SlotStatus.Bits.MrlSensorChanged\r |
5d73d92f | 4873 | );\r |
c37e0f16 CP |
4874 | ShellPrintEx (-1, -1,\r |
4875 | L" Presence Detect Changed(3): %E%d%N\r\n",\r | |
0c84a69f | 4876 | PciExpressCap->SlotStatus.Bits.PresenceDetectChanged\r |
5d73d92f | 4877 | );\r |
c37e0f16 CP |
4878 | ShellPrintEx (-1, -1,\r |
4879 | L" Command Completed(4): %E%d%N\r\n",\r | |
0c84a69f | 4880 | PciExpressCap->SlotStatus.Bits.CommandCompleted\r |
5d73d92f | 4881 | );\r |
c37e0f16 | 4882 | ShellPrintEx (-1, -1, L" MRL Sensor State(5): %EMRL ");\r |
0c84a69f RN |
4883 | if (\r |
4884 | PciExpressCap->SlotStatus.Bits.MrlSensor) {\r | |
c37e0f16 | 4885 | ShellPrintEx (-1, -1, L" Opened%N\r\n");\r |
5d73d92f | 4886 | } else {\r |
c37e0f16 | 4887 | ShellPrintEx (-1, -1, L" Closed%N\r\n");\r |
5d73d92f | 4888 | }\r |
c37e0f16 | 4889 | ShellPrintEx (-1, -1, L" Presence Detect State(6): ");\r |
0c84a69f RN |
4890 | if (\r |
4891 | PciExpressCap->SlotStatus.Bits.PresenceDetect) {\r | |
c37e0f16 | 4892 | ShellPrintEx (-1, -1, L"%ECard Present in slot%N\r\n");\r |
5d73d92f | 4893 | } else {\r |
c37e0f16 | 4894 | ShellPrintEx (-1, -1, L"%ESlot Empty%N\r\n");\r |
5d73d92f | 4895 | }\r |
c37e0f16 | 4896 | ShellPrintEx (-1, -1, L" Electromechanical Interlock Status(7): %EElectromechanical Interlock ");\r |
0c84a69f RN |
4897 | if (\r |
4898 | PciExpressCap->SlotStatus.Bits.ElectromechanicalInterlock) {\r | |
c37e0f16 | 4899 | ShellPrintEx (-1, -1, L"Engaged%N\r\n");\r |
5d73d92f | 4900 | } else {\r |
c37e0f16 | 4901 | ShellPrintEx (-1, -1, L"Disengaged%N\r\n");\r |
5d73d92f | 4902 | }\r |
c37e0f16 CP |
4903 | ShellPrintEx (-1, -1,\r |
4904 | L" Data Link Layer State Changed(8): %E%d%N\r\n",\r | |
0c84a69f | 4905 | PciExpressCap->SlotStatus.Bits.DataLinkLayerStateChanged\r |
5d73d92f | 4906 | );\r |
4907 | return EFI_SUCCESS;\r | |
4908 | }\r | |
4909 | \r | |
a1d4bfcc | 4910 | /**\r |
4911 | Print out information of the device root information.\r | |
4912 | \r | |
4913 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4914 | \r | |
4915 | @retval EFI_SUCCESS The operation was successful.\r | |
4916 | **/\r | |
5d73d92f | 4917 | EFI_STATUS\r |
4918 | ExplainPcieRootControl (\r | |
0c84a69f | 4919 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4920 | )\r |
5d73d92f | 4921 | {\r |
c37e0f16 CP |
4922 | ShellPrintEx (-1, -1,\r |
4923 | L" System Error on Correctable Error Enable(0): %E%d%N\r\n",\r | |
0c84a69f | 4924 | PciExpressCap->RootControl.Bits.SystemErrorOnCorrectableError\r |
5d73d92f | 4925 | );\r |
c37e0f16 CP |
4926 | ShellPrintEx (-1, -1,\r |
4927 | L" System Error on Non-Fatal Error Enable(1): %E%d%N\r\n",\r | |
0c84a69f | 4928 | PciExpressCap->RootControl.Bits.SystemErrorOnNonFatalError\r |
5d73d92f | 4929 | );\r |
c37e0f16 CP |
4930 | ShellPrintEx (-1, -1,\r |
4931 | L" System Error on Fatal Error Enable(2): %E%d%N\r\n",\r | |
0c84a69f | 4932 | PciExpressCap->RootControl.Bits.SystemErrorOnFatalError\r |
5d73d92f | 4933 | );\r |
c37e0f16 CP |
4934 | ShellPrintEx (-1, -1,\r |
4935 | L" PME Interrupt Enable(3): %E%d%N\r\n",\r | |
0c84a69f | 4936 | PciExpressCap->RootControl.Bits.PmeInterrupt\r |
5d73d92f | 4937 | );\r |
c37e0f16 CP |
4938 | ShellPrintEx (-1, -1,\r |
4939 | L" CRS Software Visibility Enable(4): %E%d%N\r\n",\r | |
0c84a69f | 4940 | PciExpressCap->RootControl.Bits.CrsSoftwareVisibility\r |
5d73d92f | 4941 | );\r |
4942 | \r | |
4943 | return EFI_SUCCESS;\r | |
4944 | }\r | |
4945 | \r | |
a1d4bfcc | 4946 | /**\r |
4947 | Print out information of the device root capability information.\r | |
4948 | \r | |
4949 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4950 | \r | |
4951 | @retval EFI_SUCCESS The operation was successful.\r | |
4952 | **/\r | |
5d73d92f | 4953 | EFI_STATUS\r |
4954 | ExplainPcieRootCap (\r | |
0c84a69f | 4955 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4956 | )\r |
5d73d92f | 4957 | {\r |
c37e0f16 CP |
4958 | ShellPrintEx (-1, -1,\r |
4959 | L" CRS Software Visibility(0): %E%d%N\r\n",\r | |
0c84a69f | 4960 | PciExpressCap->RootCapability.Bits.CrsSoftwareVisibility\r |
5d73d92f | 4961 | );\r |
4962 | \r | |
4963 | return EFI_SUCCESS;\r | |
4964 | }\r | |
4965 | \r | |
a1d4bfcc | 4966 | /**\r |
4967 | Print out information of the device root status information.\r | |
4968 | \r | |
4969 | @param[in] PciExpressCap The pointer to the structure about the device.\r | |
4970 | \r | |
4971 | @retval EFI_SUCCESS The operation was successful.\r | |
4972 | **/\r | |
5d73d92f | 4973 | EFI_STATUS\r |
4974 | ExplainPcieRootStatus (\r | |
0c84a69f | 4975 | IN PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
a1d4bfcc | 4976 | )\r |
5d73d92f | 4977 | {\r |
c37e0f16 CP |
4978 | ShellPrintEx (-1, -1,\r |
4979 | L" PME Requester ID(15:0): %E0x%04x%N\r\n",\r | |
0c84a69f | 4980 | PciExpressCap->RootStatus.Bits.PmeRequesterId\r |
5d73d92f | 4981 | );\r |
c37e0f16 CP |
4982 | ShellPrintEx (-1, -1,\r |
4983 | L" PME Status(16): %E%d%N\r\n",\r | |
0c84a69f | 4984 | PciExpressCap->RootStatus.Bits.PmeStatus\r |
5d73d92f | 4985 | );\r |
c37e0f16 CP |
4986 | ShellPrintEx (-1, -1,\r |
4987 | L" PME Pending(17): %E%d%N\r\n",\r | |
0c84a69f | 4988 | PciExpressCap->RootStatus.Bits.PmePending\r |
5d73d92f | 4989 | );\r |
4990 | return EFI_SUCCESS;\r | |
4991 | }\r | |
4992 | \r | |
705bffb5 JC |
4993 | /**\r |
4994 | Function to interpret and print out the link control structure\r | |
4995 | \r | |
4996 | @param[in] HeaderAddress The Address of this capability header.\r | |
4997 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
4998 | **/\r | |
4999 | EFI_STATUS\r | |
705bffb5 JC |
5000 | PrintInterpretedExtendedCompatibilityLinkControl (\r |
5001 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5002 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5003 | )\r | |
5004 | {\r | |
5005 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL *Header;\r | |
5006 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL*)HeaderAddress;\r | |
5007 | \r | |
5008 | ShellPrintHiiEx(\r | |
5009 | -1, -1, NULL, \r | |
5010 | STRING_TOKEN (STR_PCI_EXT_CAP_LINK_CONTROL), \r | |
5011 | gShellDebug1HiiHandle, \r | |
5012 | Header->RootComplexLinkCapabilities,\r | |
5013 | Header->RootComplexLinkControl,\r | |
5014 | Header->RootComplexLinkStatus\r | |
5015 | ); \r | |
5016 | DumpHex (\r | |
5017 | 4,\r | |
5018 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5019 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL),\r | |
5020 | (VOID *) (HeaderAddress)\r | |
5021 | );\r | |
5022 | return (EFI_SUCCESS);\r | |
5023 | }\r | |
5024 | \r | |
5025 | /**\r | |
5026 | Function to interpret and print out the power budgeting structure\r | |
5027 | \r | |
5028 | @param[in] HeaderAddress The Address of this capability header.\r | |
5029 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5030 | **/\r | |
5031 | EFI_STATUS\r | |
705bffb5 JC |
5032 | PrintInterpretedExtendedCompatibilityPowerBudgeting (\r |
5033 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5034 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5035 | )\r | |
5036 | {\r | |
5037 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING *Header;\r | |
5038 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING*)HeaderAddress;\r | |
5039 | \r | |
5040 | ShellPrintHiiEx(\r | |
5041 | -1, -1, NULL, \r | |
5042 | STRING_TOKEN (STR_PCI_EXT_CAP_POWER), \r | |
5043 | gShellDebug1HiiHandle, \r | |
5044 | Header->DataSelect,\r | |
5045 | Header->Data,\r | |
5046 | Header->PowerBudgetCapability\r | |
5047 | ); \r | |
5048 | DumpHex (\r | |
5049 | 4,\r | |
5050 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5051 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING),\r | |
5052 | (VOID *) (HeaderAddress)\r | |
5053 | );\r | |
5054 | return (EFI_SUCCESS);\r | |
5055 | }\r | |
5056 | \r | |
5057 | /**\r | |
5058 | Function to interpret and print out the ACS structure\r | |
5059 | \r | |
5060 | @param[in] HeaderAddress The Address of this capability header.\r | |
5061 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5062 | **/\r | |
5063 | EFI_STATUS\r | |
705bffb5 JC |
5064 | PrintInterpretedExtendedCompatibilityAcs (\r |
5065 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5066 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5067 | )\r | |
5068 | {\r | |
5069 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED *Header;\r | |
5070 | UINT16 VectorSize;\r | |
5071 | UINT16 LoopCounter;\r | |
5072 | \r | |
5073 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED*)HeaderAddress;\r | |
5074 | VectorSize = 0;\r | |
5075 | \r | |
5076 | ShellPrintHiiEx(\r | |
5077 | -1, -1, NULL, \r | |
5078 | STRING_TOKEN (STR_PCI_EXT_CAP_ACS), \r | |
5079 | gShellDebug1HiiHandle, \r | |
5080 | Header->AcsCapability,\r | |
5081 | Header->AcsControl\r | |
5082 | ); \r | |
5083 | if (PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_CONTROL(Header)) {\r | |
5084 | VectorSize = PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_VECTOR_SIZE(Header);\r | |
5085 | if (VectorSize == 0) {\r | |
5086 | VectorSize = 256;\r | |
5087 | }\r | |
5088 | for (LoopCounter = 0 ; LoopCounter * 8 < VectorSize ; LoopCounter++) {\r | |
5089 | ShellPrintHiiEx(\r | |
5090 | -1, -1, NULL, \r | |
5091 | STRING_TOKEN (STR_PCI_EXT_CAP_ACS2), \r | |
5092 | gShellDebug1HiiHandle, \r | |
5093 | LoopCounter + 1,\r | |
5094 | Header->EgressControlVectorArray[LoopCounter]\r | |
5095 | ); \r | |
5096 | }\r | |
5097 | }\r | |
5098 | DumpHex (\r | |
5099 | 4,\r | |
5100 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5101 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED) + (VectorSize / 8) - 1,\r | |
5102 | (VOID *) (HeaderAddress)\r | |
5103 | );\r | |
5104 | return (EFI_SUCCESS);\r | |
5105 | }\r | |
5106 | \r | |
5107 | /**\r | |
5108 | Function to interpret and print out the latency tolerance reporting structure\r | |
5109 | \r | |
5110 | @param[in] HeaderAddress The Address of this capability header.\r | |
5111 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5112 | **/\r | |
5113 | EFI_STATUS\r | |
705bffb5 JC |
5114 | PrintInterpretedExtendedCompatibilityLatencyToleranceReporting (\r |
5115 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5116 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5117 | )\r | |
5118 | {\r | |
5119 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING *Header;\r | |
5120 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING*)HeaderAddress;\r | |
5121 | \r | |
5122 | ShellPrintHiiEx(\r | |
5123 | -1, -1, NULL, \r | |
5124 | STRING_TOKEN (STR_PCI_EXT_CAP_LAT), \r | |
5125 | gShellDebug1HiiHandle, \r | |
5126 | Header->MaxSnoopLatency,\r | |
5127 | Header->MaxNoSnoopLatency\r | |
5128 | ); \r | |
5129 | DumpHex (\r | |
5130 | 4,\r | |
5131 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5132 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING),\r | |
5133 | (VOID *) (HeaderAddress)\r | |
5134 | );\r | |
5135 | return (EFI_SUCCESS);\r | |
5136 | }\r | |
5137 | \r | |
5138 | /**\r | |
5139 | Function to interpret and print out the serial number structure\r | |
5140 | \r | |
5141 | @param[in] HeaderAddress The Address of this capability header.\r | |
5142 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5143 | **/\r | |
5144 | EFI_STATUS\r | |
705bffb5 JC |
5145 | PrintInterpretedExtendedCompatibilitySerialNumber (\r |
5146 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5147 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5148 | )\r | |
5149 | {\r | |
5150 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER *Header;\r | |
5151 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER*)HeaderAddress;\r | |
5152 | \r | |
5153 | ShellPrintHiiEx(\r | |
5154 | -1, -1, NULL, \r | |
5155 | STRING_TOKEN (STR_PCI_EXT_CAP_SN), \r | |
5156 | gShellDebug1HiiHandle, \r | |
5157 | Header->SerialNumber\r | |
5158 | ); \r | |
5159 | DumpHex (\r | |
5160 | 4,\r | |
5161 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5162 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER),\r | |
5163 | (VOID *) (HeaderAddress)\r | |
5164 | );\r | |
5165 | return (EFI_SUCCESS);\r | |
5166 | }\r | |
5167 | \r | |
5168 | /**\r | |
5169 | Function to interpret and print out the RCRB structure\r | |
5170 | \r | |
5171 | @param[in] HeaderAddress The Address of this capability header.\r | |
5172 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5173 | **/\r | |
5174 | EFI_STATUS\r | |
705bffb5 JC |
5175 | PrintInterpretedExtendedCompatibilityRcrb (\r |
5176 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5177 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5178 | )\r | |
5179 | {\r | |
5180 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER *Header;\r | |
5181 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER*)HeaderAddress;\r | |
5182 | \r | |
5183 | ShellPrintHiiEx(\r | |
5184 | -1, -1, NULL, \r | |
5185 | STRING_TOKEN (STR_PCI_EXT_CAP_RCRB), \r | |
5186 | gShellDebug1HiiHandle, \r | |
5187 | Header->VendorId,\r | |
5188 | Header->DeviceId,\r | |
5189 | Header->RcrbCapabilities,\r | |
5190 | Header->RcrbControl\r | |
5191 | ); \r | |
5192 | DumpHex (\r | |
5193 | 4,\r | |
5194 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5195 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER),\r | |
5196 | (VOID *) (HeaderAddress)\r | |
5197 | );\r | |
5198 | return (EFI_SUCCESS);\r | |
5199 | }\r | |
5200 | \r | |
5201 | /**\r | |
5202 | Function to interpret and print out the vendor specific structure\r | |
5203 | \r | |
5204 | @param[in] HeaderAddress The Address of this capability header.\r | |
5205 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5206 | **/\r | |
5207 | EFI_STATUS\r | |
705bffb5 JC |
5208 | PrintInterpretedExtendedCompatibilityVendorSpecific (\r |
5209 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5210 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5211 | )\r | |
5212 | {\r | |
5213 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC *Header;\r | |
5214 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC*)HeaderAddress;\r | |
5215 | \r | |
5216 | ShellPrintHiiEx(\r | |
5217 | -1, -1, NULL, \r | |
5218 | STRING_TOKEN (STR_PCI_EXT_CAP_VEN), \r | |
5219 | gShellDebug1HiiHandle, \r | |
5220 | Header->VendorSpecificHeader\r | |
5221 | ); \r | |
5222 | DumpHex (\r | |
5223 | 4,\r | |
5224 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5225 | PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_GET_SIZE(Header),\r | |
5226 | (VOID *) (HeaderAddress)\r | |
5227 | );\r | |
5228 | return (EFI_SUCCESS);\r | |
5229 | }\r | |
5230 | \r | |
5231 | /**\r | |
5232 | Function to interpret and print out the Event Collector Endpoint Association structure\r | |
5233 | \r | |
5234 | @param[in] HeaderAddress The Address of this capability header.\r | |
5235 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5236 | **/\r | |
5237 | EFI_STATUS\r | |
705bffb5 JC |
5238 | PrintInterpretedExtendedCompatibilityECEA (\r |
5239 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5240 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5241 | )\r | |
5242 | {\r | |
5243 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION *Header;\r | |
5244 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION*)HeaderAddress;\r | |
5245 | \r | |
5246 | ShellPrintHiiEx(\r | |
5247 | -1, -1, NULL, \r | |
5248 | STRING_TOKEN (STR_PCI_EXT_CAP_ECEA), \r | |
5249 | gShellDebug1HiiHandle, \r | |
5250 | Header->AssociationBitmap\r | |
5251 | ); \r | |
5252 | DumpHex (\r | |
5253 | 4,\r | |
5254 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5255 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION),\r | |
5256 | (VOID *) (HeaderAddress)\r | |
5257 | );\r | |
5258 | return (EFI_SUCCESS);\r | |
5259 | }\r | |
5260 | \r | |
5261 | /**\r | |
5262 | Function to interpret and print out the ARI structure\r | |
5263 | \r | |
5264 | @param[in] HeaderAddress The Address of this capability header.\r | |
5265 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5266 | **/\r | |
5267 | EFI_STATUS\r | |
705bffb5 JC |
5268 | PrintInterpretedExtendedCompatibilityAri (\r |
5269 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5270 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5271 | )\r | |
5272 | {\r | |
5273 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY *Header;\r | |
5274 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY*)HeaderAddress;\r | |
5275 | \r | |
5276 | ShellPrintHiiEx(\r | |
5277 | -1, -1, NULL, \r | |
5278 | STRING_TOKEN (STR_PCI_EXT_CAP_ARI), \r | |
5279 | gShellDebug1HiiHandle, \r | |
5280 | Header->AriCapability,\r | |
5281 | Header->AriControl\r | |
5282 | ); \r | |
5283 | DumpHex (\r | |
5284 | 4,\r | |
5285 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5286 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY),\r | |
5287 | (VOID *) (HeaderAddress)\r | |
5288 | );\r | |
5289 | return (EFI_SUCCESS);\r | |
5290 | }\r | |
5291 | \r | |
5292 | /**\r | |
5293 | Function to interpret and print out the DPA structure\r | |
5294 | \r | |
5295 | @param[in] HeaderAddress The Address of this capability header.\r | |
5296 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5297 | **/\r | |
5298 | EFI_STATUS\r | |
705bffb5 JC |
5299 | PrintInterpretedExtendedCompatibilityDynamicPowerAllocation (\r |
5300 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5301 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5302 | )\r | |
5303 | {\r | |
5304 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION *Header;\r | |
5305 | UINT8 LinkCount;\r | |
5306 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION*)HeaderAddress;\r | |
5307 | \r | |
5308 | ShellPrintHiiEx(\r | |
5309 | -1, -1, NULL, \r | |
5310 | STRING_TOKEN (STR_PCI_EXT_CAP_DPA), \r | |
5311 | gShellDebug1HiiHandle, \r | |
5312 | Header->DpaCapability,\r | |
5313 | Header->DpaLatencyIndicator,\r | |
5314 | Header->DpaStatus,\r | |
5315 | Header->DpaControl\r | |
5316 | ); \r | |
5317 | for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header) + 1 ; LinkCount++) {\r | |
5318 | ShellPrintHiiEx(\r | |
5319 | -1, -1, NULL, \r | |
5320 | STRING_TOKEN (STR_PCI_EXT_CAP_DPA2), \r | |
5321 | gShellDebug1HiiHandle, \r | |
5322 | LinkCount+1,\r | |
5323 | Header->DpaPowerAllocationArray[LinkCount]\r | |
5324 | );\r | |
5325 | }\r | |
5326 | DumpHex (\r | |
5327 | 4,\r | |
5328 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5329 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION) - 1 + PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header),\r | |
5330 | (VOID *) (HeaderAddress)\r | |
5331 | );\r | |
5332 | return (EFI_SUCCESS);\r | |
5333 | }\r | |
5334 | \r | |
5335 | /**\r | |
5336 | Function to interpret and print out the link declaration structure\r | |
5337 | \r | |
5338 | @param[in] HeaderAddress The Address of this capability header.\r | |
5339 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5340 | **/\r | |
5341 | EFI_STATUS\r | |
705bffb5 JC |
5342 | PrintInterpretedExtendedCompatibilityLinkDeclaration (\r |
5343 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5344 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5345 | )\r | |
5346 | {\r | |
5347 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION *Header;\r | |
5348 | UINT8 LinkCount;\r | |
5349 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION*)HeaderAddress;\r | |
5350 | \r | |
5351 | ShellPrintHiiEx(\r | |
5352 | -1, -1, NULL, \r | |
5353 | STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR), \r | |
5354 | gShellDebug1HiiHandle, \r | |
5355 | Header->ElementSelfDescription\r | |
5356 | );\r | |
5357 | \r | |
5358 | for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header) ; LinkCount++) {\r | |
5359 | ShellPrintHiiEx(\r | |
5360 | -1, -1, NULL, \r | |
5361 | STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR2), \r | |
5362 | gShellDebug1HiiHandle, \r | |
5363 | LinkCount+1,\r | |
5364 | Header->LinkEntry[LinkCount]\r | |
5365 | );\r | |
5366 | }\r | |
5367 | DumpHex (\r | |
5368 | 4,\r | |
5369 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5370 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION) + (PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header)-1)*sizeof(UINT32),\r | |
5371 | (VOID *) (HeaderAddress)\r | |
5372 | );\r | |
5373 | return (EFI_SUCCESS);\r | |
5374 | }\r | |
5375 | \r | |
5376 | /**\r | |
5377 | Function to interpret and print out the Advanced Error Reporting structure\r | |
5378 | \r | |
5379 | @param[in] HeaderAddress The Address of this capability header.\r | |
5380 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5381 | **/\r | |
5382 | EFI_STATUS\r | |
705bffb5 JC |
5383 | PrintInterpretedExtendedCompatibilityAer (\r |
5384 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5385 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5386 | )\r | |
5387 | {\r | |
5388 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING *Header;\r | |
5389 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING*)HeaderAddress;\r | |
5390 | \r | |
5391 | ShellPrintHiiEx(\r | |
5392 | -1, -1, NULL, \r | |
5393 | STRING_TOKEN (STR_PCI_EXT_CAP_AER), \r | |
5394 | gShellDebug1HiiHandle, \r | |
5395 | Header->UncorrectableErrorStatus,\r | |
5396 | Header->UncorrectableErrorMask,\r | |
5397 | Header->UncorrectableErrorSeverity,\r | |
5398 | Header->CorrectableErrorStatus,\r | |
5399 | Header->CorrectableErrorMask,\r | |
5400 | Header->AdvancedErrorCapabilitiesAndControl,\r | |
231ad7d8 QS |
5401 | Header->HeaderLog[0],\r |
5402 | Header->HeaderLog[1],\r | |
5403 | Header->HeaderLog[2],\r | |
5404 | Header->HeaderLog[3],\r | |
705bffb5 JC |
5405 | Header->RootErrorCommand,\r |
5406 | Header->RootErrorStatus,\r | |
5407 | Header->ErrorSourceIdentification,\r | |
5408 | Header->CorrectableErrorSourceIdentification,\r | |
5409 | Header->TlpPrefixLog[0],\r | |
5410 | Header->TlpPrefixLog[1],\r | |
5411 | Header->TlpPrefixLog[2],\r | |
5412 | Header->TlpPrefixLog[3]\r | |
5413 | );\r | |
5414 | DumpHex (\r | |
5415 | 4,\r | |
5416 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5417 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING),\r | |
5418 | (VOID *) (HeaderAddress)\r | |
5419 | );\r | |
5420 | return (EFI_SUCCESS);\r | |
5421 | }\r | |
5422 | \r | |
9f7f0697 JC |
5423 | /**\r |
5424 | Function to interpret and print out the multicast structure\r | |
5425 | \r | |
5426 | @param[in] HeaderAddress The Address of this capability header.\r | |
5427 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5428 | @param[in] PciExpressCapPtr The address of the PCIe capabilities structure.\r | |
5429 | **/\r | |
5430 | EFI_STATUS\r | |
9f7f0697 JC |
5431 | PrintInterpretedExtendedCompatibilityMulticast (\r |
5432 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5433 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,\r | |
0c84a69f | 5434 | IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr\r |
9f7f0697 JC |
5435 | )\r |
5436 | {\r | |
5437 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST *Header;\r | |
5438 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST*)HeaderAddress;\r | |
5439 | \r | |
5440 | ShellPrintHiiEx(\r | |
5441 | -1, -1, NULL, \r | |
5442 | STRING_TOKEN (STR_PCI_EXT_CAP_MULTICAST), \r | |
5443 | gShellDebug1HiiHandle, \r | |
5444 | Header->MultiCastCapability,\r | |
5445 | Header->MulticastControl,\r | |
5446 | Header->McBaseAddress,\r | |
5447 | Header->McReceiveAddress,\r | |
5448 | Header->McBlockAll,\r | |
5449 | Header->McBlockUntranslated,\r | |
5450 | Header->McOverlayBar\r | |
5451 | );\r | |
5452 | \r | |
5453 | DumpHex (\r | |
5454 | 4,\r | |
5455 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5456 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST),\r | |
5457 | (VOID *) (HeaderAddress)\r | |
5458 | );\r | |
5459 | \r | |
5460 | return (EFI_SUCCESS);\r | |
5461 | }\r | |
5462 | \r | |
5463 | /**\r | |
5464 | Function to interpret and print out the virtual channel and multi virtual channel structure\r | |
5465 | \r | |
5466 | @param[in] HeaderAddress The Address of this capability header.\r | |
5467 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5468 | **/\r | |
5469 | EFI_STATUS\r | |
9f7f0697 JC |
5470 | PrintInterpretedExtendedCompatibilityVirtualChannel (\r |
5471 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5472 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5473 | )\r | |
5474 | {\r | |
5475 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY *Header;\r | |
5476 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC *CapabilityItem;\r | |
5477 | UINT32 ItemCount;\r | |
5478 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY*)HeaderAddress;\r | |
5479 | \r | |
5480 | ShellPrintHiiEx(\r | |
5481 | -1, -1, NULL, \r | |
5482 | STRING_TOKEN (STR_PCI_EXT_CAP_VC_BASE), \r | |
5483 | gShellDebug1HiiHandle, \r | |
5484 | Header->ExtendedVcCount,\r | |
5485 | Header->PortVcCapability1,\r | |
5486 | Header->PortVcCapability2,\r | |
5487 | Header->VcArbTableOffset,\r | |
5488 | Header->PortVcControl,\r | |
5489 | Header->PortVcStatus\r | |
5490 | );\r | |
5491 | for (ItemCount = 0 ; ItemCount < Header->ExtendedVcCount ; ItemCount++) {\r | |
5492 | CapabilityItem = &Header->Capability[ItemCount];\r | |
5493 | ShellPrintHiiEx(\r | |
5494 | -1, -1, NULL, \r | |
5495 | STRING_TOKEN (STR_PCI_EXT_CAP_VC_ITEM), \r | |
5496 | gShellDebug1HiiHandle, \r | |
5497 | ItemCount+1,\r | |
5498 | CapabilityItem->VcResourceCapability,\r | |
5499 | CapabilityItem->PortArbTableOffset,\r | |
5500 | CapabilityItem->VcResourceControl,\r | |
5501 | CapabilityItem->VcResourceStatus\r | |
5502 | );\r | |
5503 | }\r | |
5504 | \r | |
5505 | DumpHex (\r | |
5506 | 4,\r | |
5507 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
26ca6f7e RN |
5508 | sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY)\r |
5509 | + Header->ExtendedVcCount * sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC),\r | |
9f7f0697 JC |
5510 | (VOID *) (HeaderAddress)\r |
5511 | );\r | |
5512 | \r | |
5513 | return (EFI_SUCCESS);\r | |
5514 | }\r | |
5515 | \r | |
5516 | /**\r | |
5517 | Function to interpret and print out the resizeable bar structure\r | |
5518 | \r | |
5519 | @param[in] HeaderAddress The Address of this capability header.\r | |
5520 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5521 | **/\r | |
5522 | EFI_STATUS\r | |
9f7f0697 JC |
5523 | PrintInterpretedExtendedCompatibilityResizeableBar (\r |
5524 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5525 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5526 | )\r | |
5527 | {\r | |
5528 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR *Header;\r | |
5529 | UINT32 ItemCount;\r | |
5530 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR*)HeaderAddress;\r | |
5531 | \r | |
5532 | for (ItemCount = 0 ; ItemCount < (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) ; ItemCount++) {\r | |
5533 | ShellPrintHiiEx(\r | |
5534 | -1, -1, NULL, \r | |
5535 | STRING_TOKEN (STR_PCI_EXT_CAP_RESIZE_BAR), \r | |
5536 | gShellDebug1HiiHandle, \r | |
5537 | ItemCount+1,\r | |
5538 | Header->Capability[ItemCount].ResizableBarCapability,\r | |
5539 | Header->Capability[ItemCount].ResizableBarControl\r | |
5540 | );\r | |
5541 | }\r | |
5542 | \r | |
5543 | DumpHex (\r | |
5544 | 4,\r | |
5545 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5546 | (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) * sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY),\r | |
5547 | (VOID *) (HeaderAddress)\r | |
5548 | );\r | |
5549 | \r | |
5550 | return (EFI_SUCCESS);\r | |
5551 | }\r | |
5552 | \r | |
5553 | /**\r | |
5554 | Function to interpret and print out the TPH structure\r | |
5555 | \r | |
5556 | @param[in] HeaderAddress The Address of this capability header.\r | |
5557 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5558 | **/\r | |
5559 | EFI_STATUS\r | |
9f7f0697 JC |
5560 | PrintInterpretedExtendedCompatibilityTph (\r |
5561 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5562 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress\r | |
5563 | )\r | |
5564 | {\r | |
5565 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH *Header;\r | |
5566 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH*)HeaderAddress;\r | |
5567 | \r | |
5568 | ShellPrintHiiEx(\r | |
5569 | -1, -1, NULL, \r | |
5570 | STRING_TOKEN (STR_PCI_EXT_CAP_TPH), \r | |
5571 | gShellDebug1HiiHandle, \r | |
5572 | Header->TphRequesterCapability,\r | |
5573 | Header->TphRequesterControl\r | |
5574 | );\r | |
5575 | DumpHex (\r | |
5576 | 8,\r | |
5577 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->TphStTable - (UINT8*)HeadersBaseAddress),\r | |
5578 | GET_TPH_TABLE_SIZE(Header),\r | |
5579 | (VOID *)Header->TphStTable\r | |
5580 | );\r | |
5581 | \r | |
5582 | DumpHex (\r | |
5583 | 4,\r | |
5584 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
5585 | sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH) + GET_TPH_TABLE_SIZE(Header) - sizeof(UINT16),\r | |
5586 | (VOID *) (HeaderAddress)\r | |
5587 | );\r | |
5588 | \r | |
5589 | return (EFI_SUCCESS);\r | |
5590 | }\r | |
5591 | \r | |
5592 | /**\r | |
5593 | Function to interpret and print out the secondary PCIe capability structure\r | |
5594 | \r | |
5595 | @param[in] HeaderAddress The Address of this capability header.\r | |
5596 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5597 | @param[in] PciExpressCapPtr The address of the PCIe capabilities structure.\r | |
5598 | **/\r | |
5599 | EFI_STATUS\r | |
9f7f0697 JC |
5600 | PrintInterpretedExtendedCompatibilitySecondary (\r |
5601 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
5602 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress,\r | |
0c84a69f | 5603 | IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCap\r |
9f7f0697 JC |
5604 | )\r |
5605 | {\r | |
5606 | CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE *Header;\r | |
5607 | Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE*)HeaderAddress;\r | |
5608 | \r | |
5609 | ShellPrintHiiEx(\r | |
5610 | -1, -1, NULL, \r | |
5611 | STRING_TOKEN (STR_PCI_EXT_CAP_SECONDARY), \r | |
5612 | gShellDebug1HiiHandle, \r | |
0c84a69f | 5613 | Header->LinkControl3.Uint32,\r |
9f7f0697 JC |
5614 | Header->LaneErrorStatus\r |
5615 | );\r | |
5616 | DumpHex (\r | |
5617 | 8,\r | |
5618 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->EqualizationControl - (UINT8*)HeadersBaseAddress),\r | |
0c84a69f | 5619 | PciExpressCap->LinkCapability.Bits.MaxLinkWidth * sizeof (PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL),\r |
9f7f0697 JC |
5620 | (VOID *)Header->EqualizationControl\r |
5621 | );\r | |
5622 | \r | |
5623 | DumpHex (\r | |
5624 | 4,\r | |
5625 | EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress),\r | |
0c84a69f RN |
5626 | sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE) - sizeof (Header->EqualizationControl)\r |
5627 | + PciExpressCap->LinkCapability.Bits.MaxLinkWidth * sizeof (PCI_EXPRESS_REG_LANE_EQUALIZATION_CONTROL),\r | |
9f7f0697 JC |
5628 | (VOID *) (HeaderAddress)\r |
5629 | );\r | |
5630 | \r | |
5631 | return (EFI_SUCCESS);\r | |
5632 | }\r | |
5633 | \r | |
705bffb5 JC |
5634 | /**\r |
5635 | Display Pcie extended capability details\r | |
5636 | \r | |
5637 | @param[in] HeadersBaseAddress The address of all the extended capability headers.\r | |
5638 | @param[in] HeaderAddress The address of this capability header.\r | |
5639 | @param[in] PciExpressCapPtr The address of the PCIe capabilities structure.\r | |
5640 | **/\r | |
5641 | EFI_STATUS\r | |
705bffb5 JC |
5642 | PrintPciExtendedCapabilityDetails(\r |
5643 | IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress, \r | |
5644 | IN CONST PCI_EXP_EXT_HDR *HeaderAddress,\r | |
0c84a69f | 5645 | IN CONST PCI_CAPABILITY_PCIEXP *PciExpressCapPtr\r |
705bffb5 JC |
5646 | )\r |
5647 | {\r | |
5648 | switch (HeaderAddress->CapabilityId){\r | |
5649 | case PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_ID:\r | |
5650 | return PrintInterpretedExtendedCompatibilityAer(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5651 | case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_CONTROL_ID:\r |
5652 | return PrintInterpretedExtendedCompatibilityLinkControl(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5653 | case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_ID:\r |
5654 | return PrintInterpretedExtendedCompatibilityLinkDeclaration(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5655 | case PCI_EXPRESS_EXTENDED_CAPABILITY_SERIAL_NUMBER_ID:\r |
5656 | return PrintInterpretedExtendedCompatibilitySerialNumber(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5657 | case PCI_EXPRESS_EXTENDED_CAPABILITY_POWER_BUDGETING_ID:\r |
5658 | return PrintInterpretedExtendedCompatibilityPowerBudgeting(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5659 | case PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_ID:\r |
5660 | return PrintInterpretedExtendedCompatibilityAcs(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5661 | case PCI_EXPRESS_EXTENDED_CAPABILITY_LATENCE_TOLERANCE_REPORTING_ID:\r |
5662 | return PrintInterpretedExtendedCompatibilityLatencyToleranceReporting(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5663 | case PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID:\r |
5664 | return PrintInterpretedExtendedCompatibilityAri(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5665 | case PCI_EXPRESS_EXTENDED_CAPABILITY_RCRB_HEADER_ID:\r |
5666 | return PrintInterpretedExtendedCompatibilityRcrb(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5667 | case PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_ID:\r |
5668 | return PrintInterpretedExtendedCompatibilityVendorSpecific(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5669 | case PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_ID:\r |
5670 | return PrintInterpretedExtendedCompatibilityDynamicPowerAllocation(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5671 | case PCI_EXPRESS_EXTENDED_CAPABILITY_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_ID:\r |
5672 | return PrintInterpretedExtendedCompatibilityECEA(HeaderAddress, HeadersBaseAddress);\r | |
705bffb5 JC |
5673 | case PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_ID:\r |
5674 | case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTI_FUNCTION_VIRTUAL_CHANNEL_ID:\r | |
9f7f0697 | 5675 | return PrintInterpretedExtendedCompatibilityVirtualChannel(HeaderAddress, HeadersBaseAddress);\r |
705bffb5 | 5676 | case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTICAST_ID: \r |
9f7f0697 JC |
5677 | //\r |
5678 | // should only be present if PCIE_CAP_DEVICEPORT_TYPE(PciExpressCapPtr->PcieCapReg) == 0100b, 0101b, or 0110b\r | |
5679 | //\r | |
5680 | return PrintInterpretedExtendedCompatibilityMulticast(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr);\r | |
705bffb5 | 5681 | case PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID:\r |
9f7f0697 | 5682 | return PrintInterpretedExtendedCompatibilityResizeableBar(HeaderAddress, HeadersBaseAddress);\r |
705bffb5 | 5683 | case PCI_EXPRESS_EXTENDED_CAPABILITY_TPH_ID:\r |
9f7f0697 | 5684 | return PrintInterpretedExtendedCompatibilityTph(HeaderAddress, HeadersBaseAddress);\r |
705bffb5 | 5685 | case PCI_EXPRESS_EXTENDED_CAPABILITY_SECONDARY_PCIE_ID:\r |
9f7f0697 | 5686 | return PrintInterpretedExtendedCompatibilitySecondary(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr);\r |
705bffb5 JC |
5687 | default:\r |
5688 | ShellPrintEx (-1, -1,\r | |
5689 | L"Unknown PCIe extended capability ID (%04xh). No interpretation available.\r\n",\r | |
5690 | HeaderAddress->CapabilityId\r | |
5691 | );\r | |
5692 | return EFI_SUCCESS;\r | |
705bffb5 JC |
5693 | };\r |
5694 | \r | |
5695 | }\r | |
5696 | \r | |
a1d4bfcc | 5697 | /**\r |
5698 | Display Pcie device structure.\r | |
5699 | \r | |
5700 | @param[in] IoDev The pointer to the root pci protocol.\r | |
5701 | @param[in] Address The Address to start at.\r | |
5702 | @param[in] CapabilityPtr The offset from the address to start.\r | |
f614ce7e SQ |
5703 | @param[in] EnhancedDump The print format for the dump data.\r |
5704 | \r | |
a1d4bfcc | 5705 | **/\r |
5d73d92f | 5706 | EFI_STATUS\r |
5707 | PciExplainPciExpress (\r | |
5708 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r | |
5709 | IN UINT64 Address,\r | |
705bffb5 JC |
5710 | IN UINT8 CapabilityPtr,\r |
5711 | IN CONST UINT16 EnhancedDump\r | |
5d73d92f | 5712 | )\r |
5713 | {\r | |
0c84a69f RN |
5714 | PCI_CAPABILITY_PCIEXP PciExpressCap;\r |
5715 | EFI_STATUS Status;\r | |
5716 | UINT64 CapRegAddress;\r | |
5717 | UINT8 Bus;\r | |
5718 | UINT8 Dev;\r | |
5719 | UINT8 Func;\r | |
5720 | UINT8 *ExRegBuffer;\r | |
5721 | UINTN ExtendRegSize;\r | |
5722 | UINT64 Pciex_Address;\r | |
5723 | UINT8 DevicePortType;\r | |
5724 | UINTN Index;\r | |
5725 | UINT8 *RegAddr;\r | |
5726 | UINTN RegValue;\r | |
5727 | PCI_EXP_EXT_HDR *ExtHdr;\r | |
5d73d92f | 5728 | \r |
5729 | CapRegAddress = Address + CapabilityPtr;\r | |
5730 | IoDev->Pci.Read (\r | |
5731 | IoDev,\r | |
5732 | EfiPciWidthUint32,\r | |
5733 | CapRegAddress,\r | |
5734 | sizeof (PciExpressCap) / sizeof (UINT32),\r | |
5735 | &PciExpressCap\r | |
5736 | );\r | |
5737 | \r | |
0c84a69f | 5738 | DevicePortType = (UINT8)PciExpressCap.Capability.Bits.DevicePortType;\r |
5d73d92f | 5739 | \r |
c37e0f16 | 5740 | ShellPrintEx (-1, -1, L"\r\nPci Express device capability structure:\r\n");\r |
5d73d92f | 5741 | \r |
5742 | for (Index = 0; PcieExplainList[Index].Type < PcieExplainTypeMax; Index++) {\r | |
5743 | if (ShellGetExecutionBreakFlag()) {\r | |
5744 | goto Done;\r | |
5745 | }\r | |
5746 | RegAddr = ((UINT8 *) &PciExpressCap) + PcieExplainList[Index].Offset;\r | |
5747 | switch (PcieExplainList[Index].Width) {\r | |
5748 | case FieldWidthUINT8:\r | |
5749 | RegValue = *(UINT8 *) RegAddr;\r | |
5750 | break;\r | |
5751 | case FieldWidthUINT16:\r | |
5752 | RegValue = *(UINT16 *) RegAddr;\r | |
5753 | break;\r | |
5754 | case FieldWidthUINT32:\r | |
5755 | RegValue = *(UINT32 *) RegAddr;\r | |
5756 | break;\r | |
5757 | default:\r | |
5758 | RegValue = 0;\r | |
5759 | break;\r | |
5760 | }\r | |
5761 | ShellPrintHiiEx(-1, -1, NULL,\r | |
5762 | PcieExplainList[Index].Token,\r | |
5763 | gShellDebug1HiiHandle,\r | |
5764 | PcieExplainList[Index].Offset,\r | |
5765 | RegValue\r | |
5766 | );\r | |
5767 | if (PcieExplainList[Index].Func == NULL) {\r | |
5768 | continue;\r | |
5769 | }\r | |
5770 | switch (PcieExplainList[Index].Type) {\r | |
5771 | case PcieExplainTypeLink:\r | |
5772 | //\r | |
5773 | // Link registers should not be used by\r | |
5774 | // a) Root Complex Integrated Endpoint\r | |
5775 | // b) Root Complex Event Collector\r | |
5776 | //\r | |
0c84a69f RN |
5777 | if (DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT ||\r |
5778 | DevicePortType == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_EVENT_COLLECTOR) {\r | |
5d73d92f | 5779 | continue;\r |
5780 | }\r | |
5781 | break;\r | |
5782 | case PcieExplainTypeSlot:\r | |
5783 | //\r | |
5784 | // Slot registers are only valid for\r | |
5785 | // a) Root Port of PCI Express Root Complex\r | |
5786 | // b) Downstream Port of PCI Express Switch\r | |
5787 | // and when SlotImplemented bit is set in PCIE cap register.\r | |
5788 | //\r | |
0c84a69f RN |
5789 | if ((DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_PORT &&\r |
5790 | DevicePortType != PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT) ||\r | |
5791 | !PciExpressCap.Capability.Bits.SlotImplemented) {\r | |
5d73d92f | 5792 | continue;\r |
5793 | }\r | |
5794 | break;\r | |
5795 | case PcieExplainTypeRoot:\r | |
5796 | //\r | |
5797 | // Root registers are only valid for\r | |
5798 | // Root Port of PCI Express Root Complex\r | |
5799 | //\r | |
0c84a69f | 5800 | if (DevicePortType != PCIE_DEVICE_PORT_TYPE_ROOT_PORT) {\r |
5d73d92f | 5801 | continue;\r |
5802 | }\r | |
5803 | break;\r | |
5804 | default:\r | |
5805 | break;\r | |
5806 | }\r | |
5807 | PcieExplainList[Index].Func (&PciExpressCap);\r | |
5808 | }\r | |
5809 | \r | |
5810 | Bus = (UINT8) (RShiftU64 (Address, 24));\r | |
5811 | Dev = (UINT8) (RShiftU64 (Address, 16));\r | |
5812 | Func = (UINT8) (RShiftU64 (Address, 8));\r | |
5813 | \r | |
0c84a69f | 5814 | Pciex_Address = EFI_PCI_ADDRESS (Bus, Dev, Func, EFI_PCIE_CAPABILITY_BASE_OFFSET);\r |
5d73d92f | 5815 | \r |
705bffb5 | 5816 | ExtendRegSize = 0x1000 - EFI_PCIE_CAPABILITY_BASE_OFFSET;\r |
5d73d92f | 5817 | \r |
3737ac2b | 5818 | ExRegBuffer = (UINT8 *) AllocateZeroPool (ExtendRegSize);\r |
5d73d92f | 5819 | \r |
5820 | //\r | |
5821 | // PciRootBridgeIo protocol should support pci express extend space IO\r | |
705bffb5 | 5822 | // (Begins at offset EFI_PCIE_CAPABILITY_BASE_OFFSET)\r |
5d73d92f | 5823 | //\r |
5824 | Status = IoDev->Pci.Read (\r | |
5825 | IoDev,\r | |
5826 | EfiPciWidthUint32,\r | |
5827 | Pciex_Address,\r | |
5828 | (ExtendRegSize) / sizeof (UINT32),\r | |
5829 | (VOID *) (ExRegBuffer)\r | |
5830 | );\r | |
705bffb5 JC |
5831 | if (EFI_ERROR (Status) || ExRegBuffer == NULL) {\r |
5832 | SHELL_FREE_NON_NULL(ExRegBuffer);\r | |
5d73d92f | 5833 | return EFI_UNSUPPORTED;\r |
5834 | }\r | |
5d73d92f | 5835 | \r |
c831a2c3 RN |
5836 | ExtHdr = (PCI_EXP_EXT_HDR*)ExRegBuffer;\r |
5837 | while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {\r | |
705bffb5 | 5838 | //\r |
c831a2c3 | 5839 | // Process this item\r |
705bffb5 | 5840 | //\r |
c831a2c3 | 5841 | if (EnhancedDump == 0xFFFF || EnhancedDump == ExtHdr->CapabilityId) {\r |
705bffb5 | 5842 | //\r |
c831a2c3 | 5843 | // Print this item\r |
705bffb5 | 5844 | //\r |
c831a2c3 RN |
5845 | PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExRegBuffer, ExtHdr, &PciExpressCap);\r |
5846 | }\r | |
5d73d92f | 5847 | \r |
c831a2c3 RN |
5848 | //\r |
5849 | // Advance to the next item if it exists\r | |
5850 | //\r | |
5851 | if (ExtHdr->NextCapabilityOffset != 0) {\r | |
5852 | ExtHdr = (PCI_EXP_EXT_HDR*)((UINT8*)ExRegBuffer + ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);\r | |
5853 | } else {\r | |
5854 | break;\r | |
705bffb5 | 5855 | }\r |
d8f8021c | 5856 | }\r |
705bffb5 | 5857 | SHELL_FREE_NON_NULL(ExRegBuffer);\r |
5d73d92f | 5858 | \r |
5859 | Done:\r | |
5860 | return EFI_SUCCESS;\r | |
5861 | }\r |