ShellPkg: add the last PCIe extended capability decodings
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / Pci.c
CommitLineData
5d73d92f 1/** @file\r
2 Main file for Pci shell Debug1 function.\r
3\r
c37e0f16 4 Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\r
705bffb5 5 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r
5d73d92f 6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "UefiShellDebug1CommandsLib.h"\r
17#include <Protocol/PciRootBridgeIo.h>\r
18#include <Library/ShellLib.h>\r
19#include <IndustryStandard/Pci.h>\r
20#include <IndustryStandard/Acpi.h>\r
21#include "Pci.h"\r
22\r
23#define PCI_CLASS_STRING_LIMIT 54\r
24//\r
25// Printable strings for Pci class code\r
26//\r
27typedef 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
37typedef 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
47PCI_CLASS_ENTRY PCIBlankEntry[];\r
48PCI_CLASS_ENTRY PCISubClass_00[];\r
49PCI_CLASS_ENTRY PCISubClass_01[];\r
50PCI_CLASS_ENTRY PCISubClass_02[];\r
51PCI_CLASS_ENTRY PCISubClass_03[];\r
52PCI_CLASS_ENTRY PCISubClass_04[];\r
53PCI_CLASS_ENTRY PCISubClass_05[];\r
54PCI_CLASS_ENTRY PCISubClass_06[];\r
55PCI_CLASS_ENTRY PCISubClass_07[];\r
56PCI_CLASS_ENTRY PCISubClass_08[];\r
57PCI_CLASS_ENTRY PCISubClass_09[];\r
58PCI_CLASS_ENTRY PCISubClass_0a[];\r
59PCI_CLASS_ENTRY PCISubClass_0b[];\r
60PCI_CLASS_ENTRY PCISubClass_0c[];\r
61PCI_CLASS_ENTRY PCISubClass_0d[];\r
62PCI_CLASS_ENTRY PCISubClass_0e[];\r
63PCI_CLASS_ENTRY PCISubClass_0f[];\r
64PCI_CLASS_ENTRY PCISubClass_10[];\r
65PCI_CLASS_ENTRY PCISubClass_11[];\r
66PCI_CLASS_ENTRY PCIPIFClass_0101[];\r
67PCI_CLASS_ENTRY PCIPIFClass_0300[];\r
68PCI_CLASS_ENTRY PCIPIFClass_0604[];\r
69PCI_CLASS_ENTRY PCIPIFClass_0700[];\r
70PCI_CLASS_ENTRY PCIPIFClass_0701[];\r
71PCI_CLASS_ENTRY PCIPIFClass_0703[];\r
72PCI_CLASS_ENTRY PCIPIFClass_0800[];\r
73PCI_CLASS_ENTRY PCIPIFClass_0801[];\r
74PCI_CLASS_ENTRY PCIPIFClass_0802[];\r
75PCI_CLASS_ENTRY PCIPIFClass_0803[];\r
76PCI_CLASS_ENTRY PCIPIFClass_0904[];\r
77PCI_CLASS_ENTRY PCIPIFClass_0c00[];\r
78PCI_CLASS_ENTRY PCIPIFClass_0c03[];\r
79PCI_CLASS_ENTRY PCIPIFClass_0e00[];\r
80\r
81//\r
82// Base class strings entries\r
83//\r
84PCI_CLASS_ENTRY gClassStringList[] = {\r
85 {\r
86 0x00,\r
87 L"Pre 2.0 device",\r
88 PCISubClass_00\r
89 },\r
90 {\r
91 0x01,\r
92 L"Mass Storage Controller",\r
93 PCISubClass_01\r
94 },\r
95 {\r
96 0x02,\r
97 L"Network Controller",\r
98 PCISubClass_02\r
99 },\r
100 {\r
101 0x03,\r
102 L"Display Controller",\r
103 PCISubClass_03\r
104 },\r
105 {\r
106 0x04,\r
107 L"Multimedia Device",\r
108 PCISubClass_04\r
109 },\r
110 {\r
111 0x05,\r
112 L"Memory Controller",\r
113 PCISubClass_05\r
114 },\r
115 {\r
116 0x06,\r
117 L"Bridge Device",\r
118 PCISubClass_06\r
119 },\r
120 {\r
121 0x07,\r
122 L"Simple Communications Controllers",\r
123 PCISubClass_07\r
124 },\r
125 {\r
126 0x08,\r
127 L"Base System Peripherals",\r
128 PCISubClass_08\r
129 },\r
130 {\r
131 0x09,\r
132 L"Input Devices",\r
133 PCISubClass_09\r
134 },\r
135 {\r
136 0x0a,\r
137 L"Docking Stations",\r
138 PCISubClass_0a\r
139 },\r
140 {\r
141 0x0b,\r
142 L"Processors",\r
143 PCISubClass_0b\r
144 },\r
145 {\r
146 0x0c,\r
147 L"Serial Bus Controllers",\r
148 PCISubClass_0c\r
149 },\r
150 {\r
151 0x0d,\r
152 L"Wireless Controllers",\r
153 PCISubClass_0d\r
154 },\r
155 {\r
156 0x0e,\r
157 L"Intelligent IO Controllers",\r
158 PCISubClass_0e\r
159 },\r
160 {\r
161 0x0f,\r
162 L"Satellite Communications Controllers",\r
163 PCISubClass_0f\r
164 },\r
165 {\r
166 0x10,\r
167 L"Encryption/Decryption Controllers",\r
168 PCISubClass_10\r
169 },\r
170 {\r
171 0x11,\r
172 L"Data Acquisition & Signal Processing Controllers",\r
173 PCISubClass_11\r
174 },\r
175 {\r
176 0xff,\r
177 L"Device does not fit in any defined classes",\r
178 PCIBlankEntry\r
179 },\r
180 {\r
181 0x00,\r
182 NULL,\r
183 /* null string ends the list */NULL\r
184 }\r
185};\r
186\r
187//\r
188// Subclass strings entries\r
189//\r
190PCI_CLASS_ENTRY PCIBlankEntry[] = {\r
191 {\r
192 0x00,\r
193 L"",\r
194 PCIBlankEntry\r
195 },\r
196 {\r
197 0x00,\r
198 NULL,\r
199 /* null string ends the list */NULL\r
200 }\r
201};\r
202\r
203PCI_CLASS_ENTRY PCISubClass_00[] = {\r
204 {\r
205 0x00,\r
206 L"All devices other than VGA",\r
207 PCIBlankEntry\r
208 },\r
209 {\r
210 0x01,\r
211 L"VGA-compatible devices",\r
212 PCIBlankEntry\r
213 },\r
214 {\r
215 0x00,\r
216 NULL,\r
217 /* null string ends the list */NULL\r
218 }\r
219};\r
220\r
221PCI_CLASS_ENTRY PCISubClass_01[] = {\r
222 {\r
223 0x00,\r
224 L"SCSI controller",\r
225 PCIBlankEntry\r
226 },\r
227 {\r
228 0x01,\r
229 L"IDE controller",\r
230 PCIPIFClass_0101\r
231 },\r
232 {\r
233 0x02,\r
234 L"Floppy disk controller",\r
235 PCIBlankEntry\r
236 },\r
237 {\r
238 0x03,\r
239 L"IPI controller",\r
240 PCIBlankEntry\r
241 },\r
242 {\r
243 0x04,\r
244 L"RAID controller",\r
245 PCIBlankEntry\r
246 },\r
247 {\r
248 0x80,\r
249 L"Other mass storage controller",\r
250 PCIBlankEntry\r
251 },\r
252 {\r
253 0x00,\r
254 NULL,\r
255 /* null string ends the list */NULL\r
256 }\r
257};\r
258\r
259PCI_CLASS_ENTRY PCISubClass_02[] = {\r
260 {\r
261 0x00,\r
262 L"Ethernet controller",\r
263 PCIBlankEntry\r
264 },\r
265 {\r
266 0x01,\r
267 L"Token ring controller",\r
268 PCIBlankEntry\r
269 },\r
270 {\r
271 0x02,\r
272 L"FDDI controller",\r
273 PCIBlankEntry\r
274 },\r
275 {\r
276 0x03,\r
277 L"ATM controller",\r
278 PCIBlankEntry\r
279 },\r
280 {\r
281 0x04,\r
282 L"ISDN controller",\r
283 PCIBlankEntry\r
284 },\r
285 {\r
286 0x80,\r
287 L"Other network controller",\r
288 PCIBlankEntry\r
289 },\r
290 {\r
291 0x00,\r
292 NULL,\r
293 /* null string ends the list */NULL\r
294 }\r
295};\r
296\r
297PCI_CLASS_ENTRY PCISubClass_03[] = {\r
298 {\r
299 0x00,\r
300 L"VGA/8514 controller",\r
301 PCIPIFClass_0300\r
302 },\r
303 {\r
304 0x01,\r
305 L"XGA controller",\r
306 PCIBlankEntry\r
307 },\r
308 {\r
309 0x02,\r
310 L"3D controller",\r
311 PCIBlankEntry\r
312 },\r
313 {\r
314 0x80,\r
315 L"Other display controller",\r
316 PCIBlankEntry\r
317 },\r
318 {\r
319 0x00,\r
320 NULL,\r
321 /* null string ends the list */PCIBlankEntry\r
322 }\r
323};\r
324\r
325PCI_CLASS_ENTRY PCISubClass_04[] = {\r
326 {\r
327 0x00,\r
328 L"Video device",\r
329 PCIBlankEntry\r
330 },\r
331 {\r
332 0x01,\r
333 L"Audio device",\r
334 PCIBlankEntry\r
335 },\r
336 {\r
337 0x02,\r
338 L"Computer Telephony device",\r
339 PCIBlankEntry\r
340 },\r
341 {\r
342 0x80,\r
343 L"Other multimedia device",\r
344 PCIBlankEntry\r
345 },\r
346 {\r
347 0x00,\r
348 NULL,\r
349 /* null string ends the list */NULL\r
350 }\r
351};\r
352\r
353PCI_CLASS_ENTRY PCISubClass_05[] = {\r
354 {\r
355 0x00,\r
356 L"RAM memory controller",\r
357 PCIBlankEntry\r
358 },\r
359 {\r
360 0x01,\r
361 L"Flash memory controller",\r
362 PCIBlankEntry\r
363 },\r
364 {\r
365 0x80,\r
366 L"Other memory controller",\r
367 PCIBlankEntry\r
368 },\r
369 {\r
370 0x00,\r
371 NULL,\r
372 /* null string ends the list */NULL\r
373 }\r
374};\r
375\r
376PCI_CLASS_ENTRY PCISubClass_06[] = {\r
377 {\r
378 0x00,\r
379 L"Host/PCI bridge",\r
380 PCIBlankEntry\r
381 },\r
382 {\r
383 0x01,\r
384 L"PCI/ISA bridge",\r
385 PCIBlankEntry\r
386 },\r
387 {\r
388 0x02,\r
389 L"PCI/EISA bridge",\r
390 PCIBlankEntry\r
391 },\r
392 {\r
393 0x03,\r
394 L"PCI/Micro Channel bridge",\r
395 PCIBlankEntry\r
396 },\r
397 {\r
398 0x04,\r
399 L"PCI/PCI bridge",\r
400 PCIPIFClass_0604\r
401 },\r
402 {\r
403 0x05,\r
404 L"PCI/PCMCIA bridge",\r
405 PCIBlankEntry\r
406 },\r
407 {\r
408 0x06,\r
409 L"NuBus bridge",\r
410 PCIBlankEntry\r
411 },\r
412 {\r
413 0x07,\r
414 L"CardBus bridge",\r
415 PCIBlankEntry\r
416 },\r
417 {\r
418 0x08,\r
419 L"RACEway bridge",\r
420 PCIBlankEntry\r
421 },\r
422 {\r
423 0x80,\r
424 L"Other bridge type",\r
425 PCIBlankEntry\r
426 },\r
427 {\r
428 0x00,\r
429 NULL,\r
430 /* null string ends the list */NULL\r
431 }\r
432};\r
433\r
434PCI_CLASS_ENTRY PCISubClass_07[] = {\r
435 {\r
436 0x00,\r
437 L"Serial controller",\r
438 PCIPIFClass_0700\r
439 },\r
440 {\r
441 0x01,\r
442 L"Parallel port",\r
443 PCIPIFClass_0701\r
444 },\r
445 {\r
446 0x02,\r
447 L"Multiport serial controller",\r
448 PCIBlankEntry\r
449 },\r
450 {\r
451 0x03,\r
452 L"Modem",\r
453 PCIPIFClass_0703\r
454 },\r
455 {\r
456 0x80,\r
457 L"Other communication device",\r
458 PCIBlankEntry\r
459 },\r
460 {\r
461 0x00,\r
462 NULL,\r
463 /* null string ends the list */NULL\r
464 }\r
465};\r
466\r
467PCI_CLASS_ENTRY PCISubClass_08[] = {\r
468 {\r
469 0x00,\r
470 L"PIC",\r
471 PCIPIFClass_0800\r
472 },\r
473 {\r
474 0x01,\r
475 L"DMA controller",\r
476 PCIPIFClass_0801\r
477 },\r
478 {\r
479 0x02,\r
480 L"System timer",\r
481 PCIPIFClass_0802\r
482 },\r
483 {\r
484 0x03,\r
485 L"RTC controller",\r
486 PCIPIFClass_0803\r
487 },\r
488 {\r
489 0x04,\r
490 L"Generic PCI Hot-Plug controller",\r
491 PCIBlankEntry\r
492 },\r
493 {\r
494 0x80,\r
495 L"Other system peripheral",\r
496 PCIBlankEntry\r
497 },\r
498 {\r
499 0x00,\r
500 NULL,\r
501 /* null string ends the list */NULL\r
502 }\r
503};\r
504\r
505PCI_CLASS_ENTRY PCISubClass_09[] = {\r
506 {\r
507 0x00,\r
508 L"Keyboard controller",\r
509 PCIBlankEntry\r
510 },\r
511 {\r
512 0x01,\r
513 L"Digitizer (pen)",\r
514 PCIBlankEntry\r
515 },\r
516 {\r
517 0x02,\r
518 L"Mouse controller",\r
519 PCIBlankEntry\r
520 },\r
521 {\r
522 0x03,\r
523 L"Scanner controller",\r
524 PCIBlankEntry\r
525 },\r
526 {\r
527 0x04,\r
528 L"Gameport controller",\r
529 PCIPIFClass_0904\r
530 },\r
531 {\r
532 0x80,\r
533 L"Other input controller",\r
534 PCIBlankEntry\r
535 },\r
536 {\r
537 0x00,\r
538 NULL,\r
539 /* null string ends the list */NULL\r
540 }\r
541};\r
542\r
543PCI_CLASS_ENTRY PCISubClass_0a[] = {\r
544 {\r
545 0x00,\r
546 L"Generic docking station",\r
547 PCIBlankEntry\r
548 },\r
549 {\r
550 0x80,\r
551 L"Other type of docking station",\r
552 PCIBlankEntry\r
553 },\r
554 {\r
555 0x00,\r
556 NULL,\r
557 /* null string ends the list */NULL\r
558 }\r
559};\r
560\r
561PCI_CLASS_ENTRY PCISubClass_0b[] = {\r
562 {\r
563 0x00,\r
564 L"386",\r
565 PCIBlankEntry\r
566 },\r
567 {\r
568 0x01,\r
569 L"486",\r
570 PCIBlankEntry\r
571 },\r
572 {\r
573 0x02,\r
574 L"Pentium",\r
575 PCIBlankEntry\r
576 },\r
577 {\r
578 0x10,\r
579 L"Alpha",\r
580 PCIBlankEntry\r
581 },\r
582 {\r
583 0x20,\r
584 L"PowerPC",\r
585 PCIBlankEntry\r
586 },\r
587 {\r
588 0x30,\r
589 L"MIPS",\r
590 PCIBlankEntry\r
591 },\r
592 {\r
593 0x40,\r
594 L"Co-processor",\r
595 PCIBlankEntry\r
596 },\r
597 {\r
598 0x80,\r
599 L"Other processor",\r
600 PCIBlankEntry\r
601 },\r
602 {\r
603 0x00,\r
604 NULL,\r
605 /* null string ends the list */NULL\r
606 }\r
607};\r
608\r
609PCI_CLASS_ENTRY PCISubClass_0c[] = {\r
610 {\r
611 0x00,\r
612 L"Firewire(IEEE 1394)",\r
613 PCIPIFClass_0c03\r
614 },\r
615 {\r
616 0x01,\r
617 L"ACCESS.bus",\r
618 PCIBlankEntry\r
619 },\r
620 {\r
621 0x02,\r
622 L"SSA",\r
623 PCIBlankEntry\r
624 },\r
625 {\r
626 0x03,\r
627 L"USB",\r
628 PCIPIFClass_0c00\r
629 },\r
630 {\r
631 0x04,\r
632 L"Fibre Channel",\r
633 PCIBlankEntry\r
634 },\r
635 {\r
636 0x05,\r
637 L"System Management Bus",\r
638 PCIBlankEntry\r
639 },\r
640 {\r
641 0x80,\r
642 L"Other bus type",\r
643 PCIBlankEntry\r
644 },\r
645 {\r
646 0x00,\r
647 NULL,\r
648 /* null string ends the list */NULL\r
649 }\r
650};\r
651\r
652PCI_CLASS_ENTRY PCISubClass_0d[] = {\r
653 {\r
654 0x00,\r
655 L"iRDA compatible controller",\r
656 PCIBlankEntry\r
657 },\r
658 {\r
659 0x01,\r
660 L"Consumer IR controller",\r
661 PCIBlankEntry\r
662 },\r
663 {\r
664 0x10,\r
665 L"RF controller",\r
666 PCIBlankEntry\r
667 },\r
668 {\r
669 0x80,\r
670 L"Other type of wireless controller",\r
671 PCIBlankEntry\r
672 },\r
673 {\r
674 0x00,\r
675 NULL,\r
676 /* null string ends the list */NULL\r
677 }\r
678};\r
679\r
680PCI_CLASS_ENTRY PCISubClass_0e[] = {\r
681 {\r
682 0x00,\r
683 L"I2O Architecture",\r
684 PCIPIFClass_0e00\r
685 },\r
686 {\r
687 0x00,\r
688 NULL,\r
689 /* null string ends the list */NULL\r
690 }\r
691};\r
692\r
693PCI_CLASS_ENTRY PCISubClass_0f[] = {\r
694 {\r
695 0x00,\r
696 L"TV",\r
697 PCIBlankEntry\r
698 },\r
699 {\r
700 0x01,\r
701 L"Audio",\r
702 PCIBlankEntry\r
703 },\r
704 {\r
705 0x02,\r
706 L"Voice",\r
707 PCIBlankEntry\r
708 },\r
709 {\r
710 0x03,\r
711 L"Data",\r
712 PCIBlankEntry\r
713 },\r
714 {\r
715 0x00,\r
716 NULL,\r
717 /* null string ends the list */NULL\r
718 }\r
719};\r
720\r
721PCI_CLASS_ENTRY PCISubClass_10[] = {\r
722 {\r
723 0x00,\r
724 L"Network & computing Encrypt/Decrypt",\r
725 PCIBlankEntry\r
726 },\r
727 {\r
728 0x01,\r
729 L"Entertainment Encrypt/Decrypt",\r
730 PCIBlankEntry\r
731 },\r
732 {\r
733 0x80,\r
734 L"Other Encrypt/Decrypt",\r
735 PCIBlankEntry\r
736 },\r
737 {\r
738 0x00,\r
739 NULL,\r
740 /* null string ends the list */NULL\r
741 }\r
742};\r
743\r
744PCI_CLASS_ENTRY PCISubClass_11[] = {\r
745 {\r
746 0x00,\r
747 L"DPIO modules",\r
748 PCIBlankEntry\r
749 },\r
750 {\r
751 0x80,\r
752 L"Other DAQ & SP controllers",\r
753 PCIBlankEntry\r
754 },\r
755 {\r
756 0x00,\r
757 NULL,\r
758 /* null string ends the list */NULL\r
759 }\r
760};\r
761\r
762//\r
763// Programming Interface entries\r
764//\r
765PCI_CLASS_ENTRY PCIPIFClass_0101[] = {\r
766 {\r
767 0x00,\r
768 L"",\r
769 PCIBlankEntry\r
770 },\r
771 {\r
772 0x01,\r
773 L"OM-primary",\r
774 PCIBlankEntry\r
775 },\r
776 {\r
777 0x02,\r
778 L"PI-primary",\r
779 PCIBlankEntry\r
780 },\r
781 {\r
782 0x03,\r
783 L"OM/PI-primary",\r
784 PCIBlankEntry\r
785 },\r
786 {\r
787 0x04,\r
788 L"OM-secondary",\r
789 PCIBlankEntry\r
790 },\r
791 {\r
792 0x05,\r
793 L"OM-primary, OM-secondary",\r
794 PCIBlankEntry\r
795 },\r
796 {\r
797 0x06,\r
798 L"PI-primary, OM-secondary",\r
799 PCIBlankEntry\r
800 },\r
801 {\r
802 0x07,\r
803 L"OM/PI-primary, OM-secondary",\r
804 PCIBlankEntry\r
805 },\r
806 {\r
807 0x08,\r
808 L"OM-secondary",\r
809 PCIBlankEntry\r
810 },\r
811 {\r
812 0x09,\r
813 L"OM-primary, PI-secondary",\r
814 PCIBlankEntry\r
815 },\r
816 {\r
817 0x0a,\r
818 L"PI-primary, PI-secondary",\r
819 PCIBlankEntry\r
820 },\r
821 {\r
822 0x0b,\r
823 L"OM/PI-primary, PI-secondary",\r
824 PCIBlankEntry\r
825 },\r
826 {\r
827 0x0c,\r
828 L"OM-secondary",\r
829 PCIBlankEntry\r
830 },\r
831 {\r
832 0x0d,\r
833 L"OM-primary, OM/PI-secondary",\r
834 PCIBlankEntry\r
835 },\r
836 {\r
837 0x0e,\r
838 L"PI-primary, OM/PI-secondary",\r
839 PCIBlankEntry\r
840 },\r
841 {\r
842 0x0f,\r
843 L"OM/PI-primary, OM/PI-secondary",\r
844 PCIBlankEntry\r
845 },\r
846 {\r
847 0x80,\r
848 L"Master",\r
849 PCIBlankEntry\r
850 },\r
851 {\r
852 0x81,\r
853 L"Master, OM-primary",\r
854 PCIBlankEntry\r
855 },\r
856 {\r
857 0x82,\r
858 L"Master, PI-primary",\r
859 PCIBlankEntry\r
860 },\r
861 {\r
862 0x83,\r
863 L"Master, OM/PI-primary",\r
864 PCIBlankEntry\r
865 },\r
866 {\r
867 0x84,\r
868 L"Master, OM-secondary",\r
869 PCIBlankEntry\r
870 },\r
871 {\r
872 0x85,\r
873 L"Master, OM-primary, OM-secondary",\r
874 PCIBlankEntry\r
875 },\r
876 {\r
877 0x86,\r
878 L"Master, PI-primary, OM-secondary",\r
879 PCIBlankEntry\r
880 },\r
881 {\r
882 0x87,\r
883 L"Master, OM/PI-primary, OM-secondary",\r
884 PCIBlankEntry\r
885 },\r
886 {\r
887 0x88,\r
888 L"Master, OM-secondary",\r
889 PCIBlankEntry\r
890 },\r
891 {\r
892 0x89,\r
893 L"Master, OM-primary, PI-secondary",\r
894 PCIBlankEntry\r
895 },\r
896 {\r
897 0x8a,\r
898 L"Master, PI-primary, PI-secondary",\r
899 PCIBlankEntry\r
900 },\r
901 {\r
902 0x8b,\r
903 L"Master, OM/PI-primary, PI-secondary",\r
904 PCIBlankEntry\r
905 },\r
906 {\r
907 0x8c,\r
908 L"Master, OM-secondary",\r
909 PCIBlankEntry\r
910 },\r
911 {\r
912 0x8d,\r
913 L"Master, OM-primary, OM/PI-secondary",\r
914 PCIBlankEntry\r
915 },\r
916 {\r
917 0x8e,\r
918 L"Master, PI-primary, OM/PI-secondary",\r
919 PCIBlankEntry\r
920 },\r
921 {\r
922 0x8f,\r
923 L"Master, OM/PI-primary, OM/PI-secondary",\r
924 PCIBlankEntry\r
925 },\r
926 {\r
927 0x00,\r
928 NULL,\r
929 /* null string ends the list */NULL\r
930 }\r
931};\r
932\r
933PCI_CLASS_ENTRY PCIPIFClass_0300[] = {\r
934 {\r
935 0x00,\r
936 L"VGA compatible",\r
937 PCIBlankEntry\r
938 },\r
939 {\r
940 0x01,\r
941 L"8514 compatible",\r
942 PCIBlankEntry\r
943 },\r
944 {\r
945 0x00,\r
946 NULL,\r
947 /* null string ends the list */NULL\r
948 }\r
949};\r
950\r
951PCI_CLASS_ENTRY PCIPIFClass_0604[] = {\r
952 {\r
953 0x00,\r
954 L"",\r
955 PCIBlankEntry\r
956 },\r
957 {\r
958 0x01,\r
959 L"Subtractive decode",\r
960 PCIBlankEntry\r
961 },\r
962 {\r
963 0x00,\r
964 NULL,\r
965 /* null string ends the list */NULL\r
966 }\r
967};\r
968\r
969PCI_CLASS_ENTRY PCIPIFClass_0700[] = {\r
970 {\r
971 0x00,\r
972 L"Generic XT-compatible",\r
973 PCIBlankEntry\r
974 },\r
975 {\r
976 0x01,\r
977 L"16450-compatible",\r
978 PCIBlankEntry\r
979 },\r
980 {\r
981 0x02,\r
982 L"16550-compatible",\r
983 PCIBlankEntry\r
984 },\r
985 {\r
986 0x03,\r
987 L"16650-compatible",\r
988 PCIBlankEntry\r
989 },\r
990 {\r
991 0x04,\r
992 L"16750-compatible",\r
993 PCIBlankEntry\r
994 },\r
995 {\r
996 0x05,\r
997 L"16850-compatible",\r
998 PCIBlankEntry\r
999 },\r
1000 {\r
1001 0x06,\r
1002 L"16950-compatible",\r
1003 PCIBlankEntry\r
1004 },\r
1005 {\r
1006 0x00,\r
1007 NULL,\r
1008 /* null string ends the list */NULL\r
1009 }\r
1010};\r
1011\r
1012PCI_CLASS_ENTRY PCIPIFClass_0701[] = {\r
1013 {\r
1014 0x00,\r
1015 L"",\r
1016 PCIBlankEntry\r
1017 },\r
1018 {\r
1019 0x01,\r
1020 L"Bi-directional",\r
1021 PCIBlankEntry\r
1022 },\r
1023 {\r
1024 0x02,\r
1025 L"ECP 1.X-compliant",\r
1026 PCIBlankEntry\r
1027 },\r
1028 {\r
1029 0x03,\r
1030 L"IEEE 1284",\r
1031 PCIBlankEntry\r
1032 },\r
1033 {\r
1034 0xfe,\r
1035 L"IEEE 1284 target (not a controller)",\r
1036 PCIBlankEntry\r
1037 },\r
1038 {\r
1039 0x00,\r
1040 NULL,\r
1041 /* null string ends the list */NULL\r
1042 }\r
1043};\r
1044\r
1045PCI_CLASS_ENTRY PCIPIFClass_0703[] = {\r
1046 {\r
1047 0x00,\r
1048 L"Generic",\r
1049 PCIBlankEntry\r
1050 },\r
1051 {\r
1052 0x01,\r
1053 L"Hayes-compatible 16450",\r
1054 PCIBlankEntry\r
1055 },\r
1056 {\r
1057 0x02,\r
1058 L"Hayes-compatible 16550",\r
1059 PCIBlankEntry\r
1060 },\r
1061 {\r
1062 0x03,\r
1063 L"Hayes-compatible 16650",\r
1064 PCIBlankEntry\r
1065 },\r
1066 {\r
1067 0x04,\r
1068 L"Hayes-compatible 16750",\r
1069 PCIBlankEntry\r
1070 },\r
1071 {\r
1072 0x00,\r
1073 NULL,\r
1074 /* null string ends the list */NULL\r
1075 }\r
1076};\r
1077\r
1078PCI_CLASS_ENTRY PCIPIFClass_0800[] = {\r
1079 {\r
1080 0x00,\r
1081 L"Generic 8259",\r
1082 PCIBlankEntry\r
1083 },\r
1084 {\r
1085 0x01,\r
1086 L"ISA",\r
1087 PCIBlankEntry\r
1088 },\r
1089 {\r
1090 0x02,\r
1091 L"EISA",\r
1092 PCIBlankEntry\r
1093 },\r
1094 {\r
1095 0x10,\r
1096 L"IO APIC",\r
1097 PCIBlankEntry\r
1098 },\r
1099 {\r
1100 0x20,\r
1101 L"IO(x) APIC interrupt controller",\r
1102 PCIBlankEntry\r
1103 },\r
1104 {\r
1105 0x00,\r
1106 NULL,\r
1107 /* null string ends the list */NULL\r
1108 }\r
1109};\r
1110\r
1111PCI_CLASS_ENTRY PCIPIFClass_0801[] = {\r
1112 {\r
1113 0x00,\r
1114 L"Generic 8237",\r
1115 PCIBlankEntry\r
1116 },\r
1117 {\r
1118 0x01,\r
1119 L"ISA",\r
1120 PCIBlankEntry\r
1121 },\r
1122 {\r
1123 0x02,\r
1124 L"EISA",\r
1125 PCIBlankEntry\r
1126 },\r
1127 {\r
1128 0x00,\r
1129 NULL,\r
1130 /* null string ends the list */NULL\r
1131 }\r
1132};\r
1133\r
1134PCI_CLASS_ENTRY PCIPIFClass_0802[] = {\r
1135 {\r
1136 0x00,\r
1137 L"Generic 8254",\r
1138 PCIBlankEntry\r
1139 },\r
1140 {\r
1141 0x01,\r
1142 L"ISA",\r
1143 PCIBlankEntry\r
1144 },\r
1145 {\r
1146 0x02,\r
1147 L"EISA",\r
1148 PCIBlankEntry\r
1149 },\r
1150 {\r
1151 0x00,\r
1152 NULL,\r
1153 /* null string ends the list */NULL\r
1154 }\r
1155};\r
1156\r
1157PCI_CLASS_ENTRY PCIPIFClass_0803[] = {\r
1158 {\r
1159 0x00,\r
1160 L"Generic",\r
1161 PCIBlankEntry\r
1162 },\r
1163 {\r
1164 0x01,\r
1165 L"ISA",\r
1166 PCIBlankEntry\r
1167 },\r
1168 {\r
1169 0x02,\r
1170 L"EISA",\r
1171 PCIBlankEntry\r
1172 },\r
1173 {\r
1174 0x00,\r
1175 NULL,\r
1176 /* null string ends the list */NULL\r
1177 }\r
1178};\r
1179\r
1180PCI_CLASS_ENTRY PCIPIFClass_0904[] = {\r
1181 {\r
1182 0x00,\r
1183 L"Generic",\r
1184 PCIBlankEntry\r
1185 },\r
1186 {\r
1187 0x10,\r
1188 L"",\r
1189 PCIBlankEntry\r
1190 },\r
1191 {\r
1192 0x00,\r
1193 NULL,\r
1194 /* null string ends the list */NULL\r
1195 }\r
1196};\r
1197\r
1198PCI_CLASS_ENTRY PCIPIFClass_0c00[] = {\r
1199 {\r
1200 0x00,\r
1201 L"Universal Host Controller spec",\r
1202 PCIBlankEntry\r
1203 },\r
1204 {\r
1205 0x10,\r
1206 L"Open Host Controller spec",\r
1207 PCIBlankEntry\r
1208 },\r
1209 {\r
1210 0x80,\r
1211 L"No specific programming interface",\r
1212 PCIBlankEntry\r
1213 },\r
1214 {\r
1215 0xfe,\r
1216 L"(Not Host Controller)",\r
1217 PCIBlankEntry\r
1218 },\r
1219 {\r
1220 0x00,\r
1221 NULL,\r
1222 /* null string ends the list */NULL\r
1223 }\r
1224};\r
1225\r
1226PCI_CLASS_ENTRY PCIPIFClass_0c03[] = {\r
1227 {\r
1228 0x00,\r
1229 L"",\r
1230 PCIBlankEntry\r
1231 },\r
1232 {\r
1233 0x10,\r
1234 L"Using 1394 OpenHCI spec",\r
1235 PCIBlankEntry\r
1236 },\r
1237 {\r
1238 0x00,\r
1239 NULL,\r
1240 /* null string ends the list */NULL\r
1241 }\r
1242};\r
1243\r
1244PCI_CLASS_ENTRY PCIPIFClass_0e00[] = {\r
1245 {\r
1246 0x00,\r
1247 L"Message FIFO at offset 40h",\r
1248 PCIBlankEntry\r
1249 },\r
1250 {\r
1251 0x01,\r
1252 L"",\r
1253 PCIBlankEntry\r
1254 },\r
1255 {\r
1256 0x00,\r
1257 NULL,\r
1258 /* null string ends the list */NULL\r
1259 }\r
1260};\r
1261\r
5d73d92f 1262\r
a1d4bfcc 1263/**\r
5d73d92f 1264 Generates printable Unicode strings that represent PCI device class,\r
1265 subclass and programmed I/F based on a value passed to the function.\r
1266\r
a1d4bfcc 1267 @param[in] ClassCode Value representing the PCI "Class Code" register read from a\r
5d73d92f 1268 PCI device. The encodings are:\r
1269 bits 23:16 - Base Class Code\r
1270 bits 15:8 - Sub-Class Code\r
1271 bits 7:0 - Programming Interface\r
4ff7e37b 1272 @param[in, out] ClassStrings Pointer of PCI_CLASS_STRINGS structure, which contains\r
5d73d92f 1273 printable class strings corresponding to ClassCode. The\r
1274 caller must not modify the strings that are pointed by\r
1275 the fields in ClassStrings.\r
5d73d92f 1276**/\r
a1d4bfcc 1277VOID\r
1278PciGetClassStrings (\r
1279 IN UINT32 ClassCode,\r
1280 IN OUT PCI_CLASS_STRINGS *ClassStrings\r
1281 )\r
5d73d92f 1282{\r
1283 INTN Index;\r
1284 UINT8 Code;\r
1285 PCI_CLASS_ENTRY *CurrentClass;\r
1286\r
1287 //\r
1288 // Assume no strings found\r
1289 //\r
1290 ClassStrings->BaseClass = L"UNDEFINED";\r
1291 ClassStrings->SubClass = L"UNDEFINED";\r
1292 ClassStrings->PIFClass = L"UNDEFINED";\r
1293\r
1294 CurrentClass = gClassStringList;\r
1295 Code = (UINT8) (ClassCode >> 16);\r
1296 Index = 0;\r
1297\r
1298 //\r
1299 // Go through all entries of the base class, until the entry with a matching\r
1300 // base class code is found. If reaches an entry with a null description\r
1301 // text, the last entry is met, which means no text for the base class was\r
1302 // found, so no more action is needed.\r
1303 //\r
1304 while (Code != CurrentClass[Index].Code) {\r
1305 if (NULL == CurrentClass[Index].DescText) {\r
1306 return ;\r
1307 }\r
1308\r
1309 Index++;\r
1310 }\r
1311 //\r
1312 // A base class was found. Assign description, and check if this class has\r
1313 // sub-class defined. If sub-class defined, no more action is needed,\r
1314 // otherwise, continue to find description for the sub-class code.\r
1315 //\r
1316 ClassStrings->BaseClass = CurrentClass[Index].DescText;\r
1317 if (NULL == CurrentClass[Index].LowerLevelClass) {\r
1318 return ;\r
1319 }\r
1320 //\r
1321 // find Subclass entry\r
1322 //\r
1323 CurrentClass = CurrentClass[Index].LowerLevelClass;\r
1324 Code = (UINT8) (ClassCode >> 8);\r
1325 Index = 0;\r
1326\r
1327 //\r
1328 // Go through all entries of the sub-class, until the entry with a matching\r
1329 // sub-class code is found. If reaches an entry with a null description\r
1330 // text, the last entry is met, which means no text for the sub-class was\r
1331 // found, so no more action is needed.\r
1332 //\r
1333 while (Code != CurrentClass[Index].Code) {\r
1334 if (NULL == CurrentClass[Index].DescText) {\r
1335 return ;\r
1336 }\r
1337\r
1338 Index++;\r
1339 }\r
1340 //\r
1341 // A class was found for the sub-class code. Assign description, and check if\r
1342 // this sub-class has programming interface defined. If no, no more action is\r
1343 // needed, otherwise, continue to find description for the programming\r
1344 // interface.\r
1345 //\r
1346 ClassStrings->SubClass = CurrentClass[Index].DescText;\r
1347 if (NULL == CurrentClass[Index].LowerLevelClass) {\r
1348 return ;\r
1349 }\r
1350 //\r
1351 // Find programming interface entry\r
1352 //\r
1353 CurrentClass = CurrentClass[Index].LowerLevelClass;\r
1354 Code = (UINT8) ClassCode;\r
1355 Index = 0;\r
1356\r
1357 //\r
1358 // Go through all entries of the I/F entries, until the entry with a\r
1359 // matching I/F code is found. If reaches an entry with a null description\r
1360 // text, the last entry is met, which means no text was found, so no more\r
1361 // action is needed.\r
1362 //\r
1363 while (Code != CurrentClass[Index].Code) {\r
1364 if (NULL == CurrentClass[Index].DescText) {\r
1365 return ;\r
1366 }\r
1367\r
1368 Index++;\r
1369 }\r
1370 //\r
1371 // A class was found for the I/F code. Assign description, done!\r
1372 //\r
1373 ClassStrings->PIFClass = CurrentClass[Index].DescText;\r
1374 return ;\r
1375}\r
1376\r
a1d4bfcc 1377/**\r
1378 Print strings that represent PCI device class, subclass and programmed I/F.\r
1379\r
1380 @param[in] ClassCodePtr Points to the memory which stores register Class Code in PCI\r
1381 configuation space.\r
1382 @param[in] IncludePIF If the printed string should include the programming I/F part\r
1383**/\r
5d73d92f 1384VOID\r
1385PciPrintClassCode (\r
1386 IN UINT8 *ClassCodePtr,\r
1387 IN BOOLEAN IncludePIF\r
1388 )\r
5d73d92f 1389{\r
1390 UINT32 ClassCode;\r
1391 PCI_CLASS_STRINGS ClassStrings;\r
5d73d92f 1392\r
1393 ClassCode = 0;\r
1394 ClassCode |= ClassCodePtr[0];\r
1395 ClassCode |= (ClassCodePtr[1] << 8);\r
1396 ClassCode |= (ClassCodePtr[2] << 16);\r
1397\r
1398 //\r
1399 // Get name from class code\r
1400 //\r
1401 PciGetClassStrings (ClassCode, &ClassStrings);\r
1402\r
1403 if (IncludePIF) {\r
1404 //\r
c37e0f16 1405 // Print base class, sub class, and programming inferface name\r
5d73d92f 1406 //\r
c37e0f16 1407 ShellPrintEx (-1, -1, L"%s - %s - %s",\r
5d73d92f 1408 ClassStrings.BaseClass,\r
1409 ClassStrings.SubClass,\r
1410 ClassStrings.PIFClass\r
1411 );\r
1412\r
1413 } else {\r
1414 //\r
c37e0f16 1415 // Only print base class and sub class name\r
5d73d92f 1416 //\r
c37e0f16 1417 ShellPrintEx (-1, -1, L"%s - %s",\r
5d73d92f 1418 ClassStrings.BaseClass,\r
1419 ClassStrings.SubClass\r
c37e0f16 1420 );\r
5d73d92f 1421 }\r
1422}\r
1423\r
a1d4bfcc 1424/**\r
1425 This function finds out the protocol which is in charge of the given\r
1426 segment, and its bus range covers the current bus number. It lookes\r
1427 each instances of RootBridgeIoProtocol handle, until the one meets the\r
1428 criteria is found.\r
1429\r
1430 @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r
1431 @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r
1432 @param[in] Segment Segment number of device we are dealing with.\r
1433 @param[in] Bus Bus number of device we are dealing with.\r
1434 @param[out] IoDev Handle used to access configuration space of PCI device.\r
1435\r
1436 @retval EFI_SUCCESS The command completed successfully.\r
1437 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
5d73d92f 1438\r
a1d4bfcc 1439**/\r
5d73d92f 1440EFI_STATUS\r
1441PciFindProtocolInterface (\r
1442 IN EFI_HANDLE *HandleBuf,\r
1443 IN UINTN HandleCount,\r
1444 IN UINT16 Segment,\r
1445 IN UINT16 Bus,\r
1446 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev\r
1447 );\r
1448\r
a1d4bfcc 1449/**\r
1450 This function gets the protocol interface from the given handle, and\r
1451 obtains its address space descriptors.\r
1452\r
1453 @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle.\r
1454 @param[out] IoDev Handle used to access configuration space of PCI device.\r
1455 @param[out] Descriptors Points to the address space descriptors.\r
1456\r
1457 @retval EFI_SUCCESS The command completed successfully\r
1458**/\r
5d73d92f 1459EFI_STATUS\r
1460PciGetProtocolAndResource (\r
1461 IN EFI_HANDLE Handle,\r
1462 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,\r
1463 OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors\r
1464 );\r
1465\r
a1d4bfcc 1466/**\r
1467 This function get the next bus range of given address space descriptors.\r
1468 It also moves the pointer backward a node, to get prepared to be called\r
1469 again.\r
1470\r
4ff7e37b
ED
1471 @param[in, out] Descriptors Points to current position of a serial of address space\r
1472 descriptors.\r
1473 @param[out] MinBus The lower range of bus number.\r
1474 @param[out] MaxBus The upper range of bus number.\r
1475 @param[out] IsEnd Meet end of the serial of descriptors.\r
a1d4bfcc 1476\r
1477 @retval EFI_SUCCESS The command completed successfully.\r
1478**/\r
5d73d92f 1479EFI_STATUS\r
1480PciGetNextBusRange (\r
1481 IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r
1482 OUT UINT16 *MinBus,\r
1483 OUT UINT16 *MaxBus,\r
1484 OUT BOOLEAN *IsEnd\r
1485 );\r
1486\r
a1d4bfcc 1487/**\r
1488 Explain the data in PCI configuration space. The part which is common for\r
1489 PCI device and bridge is interpreted in this function. It calls other\r
1490 functions to interpret data unique for device or bridge.\r
1491\r
1492 @param[in] ConfigSpace Data in PCI configuration space.\r
1493 @param[in] Address Address used to access configuration space of this PCI device.\r
1494 @param[in] IoDev Handle used to access configuration space of PCI device.\r
1495\r
1496 @retval EFI_SUCCESS The command completed successfully.\r
1497**/\r
5d73d92f 1498EFI_STATUS\r
1499PciExplainData (\r
1500 IN PCI_CONFIG_SPACE *ConfigSpace,\r
1501 IN UINT64 Address,\r
705bffb5
JC
1502 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
1503 IN CONST UINT16 EnhancedDump\r
5d73d92f 1504 );\r
1505\r
a1d4bfcc 1506/**\r
1507 Explain the device specific part of data in PCI configuration space.\r
1508\r
1509 @param[in] Device Data in PCI configuration space.\r
1510 @param[in] Address Address used to access configuration space of this PCI device.\r
1511 @param[in] IoDev Handle used to access configuration space of PCI device.\r
1512\r
1513 @retval EFI_SUCCESS The command completed successfully.\r
1514**/\r
5d73d92f 1515EFI_STATUS\r
1516PciExplainDeviceData (\r
1517 IN PCI_DEVICE_HEADER *Device,\r
1518 IN UINT64 Address,\r
1519 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
1520 );\r
1521\r
a1d4bfcc 1522/**\r
1523 Explain the bridge specific part of data in PCI configuration space.\r
1524\r
1525 @param[in] Bridge Bridge specific data region in PCI configuration space.\r
1526 @param[in] Address Address used to access configuration space of this PCI device.\r
1527 @param[in] IoDev Handle used to access configuration space of PCI device.\r
1528\r
1529 @retval EFI_SUCCESS The command completed successfully.\r
1530**/\r
5d73d92f 1531EFI_STATUS\r
1532PciExplainBridgeData (\r
a1d4bfcc 1533 IN PCI_BRIDGE_HEADER *Bridge,\r
1534 IN UINT64 Address,\r
1535 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
5d73d92f 1536 );\r
1537\r
a1d4bfcc 1538/**\r
1539 Explain the Base Address Register(Bar) in PCI configuration space.\r
1540\r
4ff7e37b
ED
1541 @param[in] Bar Points to the Base Address Register intended to interpret.\r
1542 @param[in] Command Points to the register Command.\r
1543 @param[in] Address Address used to access configuration space of this PCI device.\r
1544 @param[in] IoDev Handle used to access configuration space of PCI device.\r
1545 @param[in, out] Index The Index.\r
a1d4bfcc 1546\r
1547 @retval EFI_SUCCESS The command completed successfully.\r
1548**/\r
5d73d92f 1549EFI_STATUS\r
1550PciExplainBar (\r
1551 IN UINT32 *Bar,\r
1552 IN UINT16 *Command,\r
1553 IN UINT64 Address,\r
1554 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
1555 IN OUT UINTN *Index\r
1556 );\r
1557\r
a1d4bfcc 1558/**\r
1559 Explain the cardbus specific part of data in PCI configuration space.\r
1560\r
1561 @param[in] CardBus CardBus specific region of PCI configuration space.\r
1562 @param[in] Address Address used to access configuration space of this PCI device.\r
1563 @param[in] IoDev Handle used to access configuration space of PCI device.\r
1564\r
1565 @retval EFI_SUCCESS The command completed successfully.\r
1566**/\r
5d73d92f 1567EFI_STATUS\r
1568PciExplainCardBusData (\r
1569 IN PCI_CARDBUS_HEADER *CardBus,\r
1570 IN UINT64 Address,\r
1571 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
1572 );\r
1573\r
a1d4bfcc 1574/**\r
1575 Explain each meaningful bit of register Status. The definition of Status is\r
1576 slightly different depending on the PCI header type.\r
1577\r
1578 @param[in] Status Points to the content of register Status.\r
1579 @param[in] MainStatus Indicates if this register is main status(not secondary\r
1580 status).\r
1581 @param[in] HeaderType Header type of this PCI device.\r
1582\r
1583 @retval EFI_SUCCESS The command completed successfully.\r
1584**/\r
5d73d92f 1585EFI_STATUS\r
1586PciExplainStatus (\r
1587 IN UINT16 *Status,\r
1588 IN BOOLEAN MainStatus,\r
1589 IN PCI_HEADER_TYPE HeaderType\r
1590 );\r
1591\r
a1d4bfcc 1592/**\r
1593 Explain each meaningful bit of register Command.\r
1594\r
1595 @param[in] Command Points to the content of register Command.\r
1596\r
1597 @retval EFI_SUCCESS The command completed successfully.\r
1598**/\r
5d73d92f 1599EFI_STATUS\r
1600PciExplainCommand (\r
1601 IN UINT16 *Command\r
1602 );\r
1603\r
a1d4bfcc 1604/**\r
1605 Explain each meaningful bit of register Bridge Control.\r
1606\r
1607 @param[in] BridgeControl Points to the content of register Bridge Control.\r
1608 @param[in] HeaderType The headertype.\r
1609\r
1610 @retval EFI_SUCCESS The command completed successfully.\r
1611**/\r
5d73d92f 1612EFI_STATUS\r
1613PciExplainBridgeControl (\r
1614 IN UINT16 *BridgeControl,\r
1615 IN PCI_HEADER_TYPE HeaderType\r
1616 );\r
1617\r
a1d4bfcc 1618/**\r
1619 Print each capability structure.\r
1620\r
1621 @param[in] IoDev The pointer to the deivce.\r
1622 @param[in] Address The address to start at.\r
1623 @param[in] CapPtr The offset from the address.\r
1624\r
1625 @retval EFI_SUCCESS The operation was successful.\r
1626**/\r
5d73d92f 1627EFI_STATUS\r
1628PciExplainCapabilityStruct (\r
1629 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
1630 IN UINT64 Address,\r
705bffb5
JC
1631 IN UINT8 CapPtr,\r
1632 IN CONST UINT16 EnhancedDump\r
5d73d92f 1633 );\r
1634\r
a1d4bfcc 1635/**\r
1636 Display Pcie device structure.\r
1637\r
1638 @param[in] IoDev The pointer to the root pci protocol.\r
1639 @param[in] Address The Address to start at.\r
1640 @param[in] CapabilityPtr The offset from the address to start.\r
1641**/\r
5d73d92f 1642EFI_STATUS\r
1643PciExplainPciExpress (\r
1644 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
1645 IN UINT64 Address,\r
705bffb5
JC
1646 IN UINT8 CapabilityPtr,\r
1647 IN CONST UINT16 EnhancedDump\r
5d73d92f 1648 );\r
1649\r
a1d4bfcc 1650/**\r
1651 Print out information of the capability information.\r
1652\r
1653 @param[in] PciExpressCap The pointer to the structure about the device.\r
1654\r
1655 @retval EFI_SUCCESS The operation was successful.\r
1656**/\r
5d73d92f 1657EFI_STATUS\r
1658ExplainPcieCapReg (\r
1659 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1660 );\r
1661\r
1662/**\r
1663 Print out information of the device capability information.\r
1664\r
1665 @param[in] PciExpressCap The pointer to the structure about the device.\r
5d73d92f 1666\r
a1d4bfcc 1667 @retval EFI_SUCCESS The operation was successful.\r
1668**/\r
5d73d92f 1669EFI_STATUS\r
1670ExplainPcieDeviceCap (\r
1671 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1672 );\r
1673\r
1674/**\r
1675 Print out information of the device control information.\r
5d73d92f 1676\r
a1d4bfcc 1677 @param[in] PciExpressCap The pointer to the structure about the device.\r
1678\r
1679 @retval EFI_SUCCESS The operation was successful.\r
1680**/\r
5d73d92f 1681EFI_STATUS\r
1682ExplainPcieDeviceControl (\r
1683 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1684 );\r
5d73d92f 1685\r
a1d4bfcc 1686/**\r
1687 Print out information of the device status information.\r
1688\r
1689 @param[in] PciExpressCap The pointer to the structure about the device.\r
1690\r
1691 @retval EFI_SUCCESS The operation was successful.\r
1692**/\r
5d73d92f 1693EFI_STATUS\r
1694ExplainPcieDeviceStatus (\r
1695 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1696 );\r
1697\r
1698/**\r
1699 Print out information of the device link information.\r
1700\r
1701 @param[in] PciExpressCap The pointer to the structure about the device.\r
5d73d92f 1702\r
a1d4bfcc 1703 @retval EFI_SUCCESS The operation was successful.\r
1704**/\r
5d73d92f 1705EFI_STATUS\r
1706ExplainPcieLinkCap (\r
1707 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1708 );\r
1709\r
1710/**\r
1711 Print out information of the device link control information.\r
5d73d92f 1712\r
a1d4bfcc 1713 @param[in] PciExpressCap The pointer to the structure about the device.\r
1714\r
1715 @retval EFI_SUCCESS The operation was successful.\r
1716**/\r
5d73d92f 1717EFI_STATUS\r
1718ExplainPcieLinkControl (\r
1719 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1720 );\r
5d73d92f 1721\r
a1d4bfcc 1722/**\r
1723 Print out information of the device link status information.\r
1724\r
1725 @param[in] PciExpressCap The pointer to the structure about the device.\r
1726\r
1727 @retval EFI_SUCCESS The operation was successful.\r
1728**/\r
5d73d92f 1729EFI_STATUS\r
1730ExplainPcieLinkStatus (\r
1731 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1732 );\r
1733\r
1734/**\r
1735 Print out information of the device slot information.\r
1736\r
1737 @param[in] PciExpressCap The pointer to the structure about the device.\r
5d73d92f 1738\r
a1d4bfcc 1739 @retval EFI_SUCCESS The operation was successful.\r
1740**/\r
5d73d92f 1741EFI_STATUS\r
1742ExplainPcieSlotCap (\r
1743 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1744 );\r
1745\r
1746/**\r
1747 Print out information of the device slot control information.\r
5d73d92f 1748\r
a1d4bfcc 1749 @param[in] PciExpressCap The pointer to the structure about the device.\r
1750\r
1751 @retval EFI_SUCCESS The operation was successful.\r
1752**/\r
5d73d92f 1753EFI_STATUS\r
1754ExplainPcieSlotControl (\r
1755 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1756 );\r
5d73d92f 1757\r
a1d4bfcc 1758/**\r
1759 Print out information of the device slot status information.\r
1760\r
1761 @param[in] PciExpressCap The pointer to the structure about the device.\r
1762\r
1763 @retval EFI_SUCCESS The operation was successful.\r
1764**/\r
5d73d92f 1765EFI_STATUS\r
1766ExplainPcieSlotStatus (\r
1767 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1768 );\r
1769\r
1770/**\r
1771 Print out information of the device root information.\r
1772\r
1773 @param[in] PciExpressCap The pointer to the structure about the device.\r
5d73d92f 1774\r
a1d4bfcc 1775 @retval EFI_SUCCESS The operation was successful.\r
1776**/\r
5d73d92f 1777EFI_STATUS\r
1778ExplainPcieRootControl (\r
1779 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1780 );\r
1781\r
1782/**\r
1783 Print out information of the device root capability information.\r
5d73d92f 1784\r
a1d4bfcc 1785 @param[in] PciExpressCap The pointer to the structure about the device.\r
1786\r
1787 @retval EFI_SUCCESS The operation was successful.\r
1788**/\r
5d73d92f 1789EFI_STATUS\r
1790ExplainPcieRootCap (\r
1791 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1792 );\r
5d73d92f 1793\r
a1d4bfcc 1794/**\r
1795 Print out information of the device root status information.\r
1796\r
1797 @param[in] PciExpressCap The pointer to the structure about the device.\r
1798\r
1799 @retval EFI_SUCCESS The operation was successful.\r
1800**/\r
5d73d92f 1801EFI_STATUS\r
1802ExplainPcieRootStatus (\r
1803 IN PCIE_CAP_STURCTURE *PciExpressCap\r
a1d4bfcc 1804 );\r
5d73d92f 1805\r
1806typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (IN PCIE_CAP_STURCTURE *PciExpressCap);\r
1807\r
1808typedef enum {\r
1809 FieldWidthUINT8,\r
1810 FieldWidthUINT16,\r
1811 FieldWidthUINT32\r
1812} PCIE_CAPREG_FIELD_WIDTH;\r
1813\r
1814typedef enum {\r
1815 PcieExplainTypeCommon,\r
1816 PcieExplainTypeDevice,\r
1817 PcieExplainTypeLink,\r
1818 PcieExplainTypeSlot,\r
1819 PcieExplainTypeRoot,\r
1820 PcieExplainTypeMax\r
1821} PCIE_EXPLAIN_TYPE;\r
1822\r
1823typedef struct\r
1824{\r
1825 UINT16 Token;\r
1826 UINTN Offset;\r
1827 PCIE_CAPREG_FIELD_WIDTH Width;\r
1828 PCIE_EXPLAIN_FUNCTION Func;\r
1829 PCIE_EXPLAIN_TYPE Type;\r
1830} PCIE_EXPLAIN_STRUCT;\r
1831\r
1832PCIE_EXPLAIN_STRUCT PcieExplainList[] = {\r
1833 {\r
1834 STRING_TOKEN (STR_PCIEX_CAPABILITY_CAPID),\r
1835 0x00,\r
1836 FieldWidthUINT8,\r
1837 NULL,\r
1838 PcieExplainTypeCommon\r
1839 },\r
1840 {\r
1841 STRING_TOKEN (STR_PCIEX_NEXTCAP_PTR),\r
1842 0x01,\r
1843 FieldWidthUINT8,\r
1844 NULL,\r
1845 PcieExplainTypeCommon\r
1846 },\r
1847 {\r
1848 STRING_TOKEN (STR_PCIEX_CAP_REGISTER),\r
1849 0x02,\r
1850 FieldWidthUINT16,\r
1851 ExplainPcieCapReg,\r
1852 PcieExplainTypeCommon\r
1853 },\r
1854 {\r
1855 STRING_TOKEN (STR_PCIEX_DEVICE_CAP),\r
1856 0x04,\r
1857 FieldWidthUINT32,\r
1858 ExplainPcieDeviceCap,\r
1859 PcieExplainTypeDevice\r
1860 },\r
1861 {\r
1862 STRING_TOKEN (STR_PCIEX_DEVICE_CONTROL),\r
1863 0x08,\r
1864 FieldWidthUINT16,\r
1865 ExplainPcieDeviceControl,\r
1866 PcieExplainTypeDevice\r
1867 },\r
1868 {\r
1869 STRING_TOKEN (STR_PCIEX_DEVICE_STATUS),\r
1870 0x0a,\r
1871 FieldWidthUINT16,\r
1872 ExplainPcieDeviceStatus,\r
1873 PcieExplainTypeDevice\r
1874 },\r
1875 {\r
1876 STRING_TOKEN (STR_PCIEX_LINK_CAPABILITIES),\r
1877 0x0c,\r
1878 FieldWidthUINT32,\r
1879 ExplainPcieLinkCap,\r
1880 PcieExplainTypeLink\r
1881 },\r
1882 {\r
1883 STRING_TOKEN (STR_PCIEX_LINK_CONTROL),\r
1884 0x10,\r
1885 FieldWidthUINT16,\r
1886 ExplainPcieLinkControl,\r
1887 PcieExplainTypeLink\r
1888 },\r
1889 {\r
1890 STRING_TOKEN (STR_PCIEX_LINK_STATUS),\r
1891 0x12,\r
1892 FieldWidthUINT16,\r
1893 ExplainPcieLinkStatus,\r
1894 PcieExplainTypeLink\r
1895 },\r
1896 {\r
1897 STRING_TOKEN (STR_PCIEX_SLOT_CAPABILITIES),\r
1898 0x14,\r
1899 FieldWidthUINT32,\r
1900 ExplainPcieSlotCap,\r
1901 PcieExplainTypeSlot\r
1902 },\r
1903 {\r
1904 STRING_TOKEN (STR_PCIEX_SLOT_CONTROL),\r
1905 0x18,\r
1906 FieldWidthUINT16,\r
1907 ExplainPcieSlotControl,\r
1908 PcieExplainTypeSlot\r
1909 },\r
1910 {\r
1911 STRING_TOKEN (STR_PCIEX_SLOT_STATUS),\r
1912 0x1a,\r
1913 FieldWidthUINT16,\r
1914 ExplainPcieSlotStatus,\r
1915 PcieExplainTypeSlot\r
1916 },\r
1917 {\r
1918 STRING_TOKEN (STR_PCIEX_ROOT_CONTROL),\r
1919 0x1c,\r
1920 FieldWidthUINT16,\r
1921 ExplainPcieRootControl,\r
1922 PcieExplainTypeRoot\r
1923 },\r
1924 {\r
1925 STRING_TOKEN (STR_PCIEX_RSVDP),\r
1926 0x1e,\r
1927 FieldWidthUINT16,\r
1928 ExplainPcieRootCap,\r
1929 PcieExplainTypeRoot\r
1930 },\r
1931 {\r
1932 STRING_TOKEN (STR_PCIEX_ROOT_STATUS),\r
1933 0x20,\r
1934 FieldWidthUINT32,\r
1935 ExplainPcieRootStatus,\r
1936 PcieExplainTypeRoot\r
1937 },\r
1938 {\r
1939 0,\r
1940 0,\r
1941 (PCIE_CAPREG_FIELD_WIDTH)0,\r
1942 NULL,\r
1943 PcieExplainTypeMax\r
1944 }\r
1945};\r
1946\r
1947//\r
1948// Global Variables\r
1949//\r
1950PCI_CONFIG_SPACE *mConfigSpace = NULL;\r
1951STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
1952 {L"-s", TypeValue},\r
1953 {L"-i", TypeFlag},\r
1954 {NULL, TypeMax}\r
1955 };\r
1956\r
1957CHAR16 *DevicePortTypeTable[] = {\r
1958 L"PCI Express Endpoint",\r
1959 L"Legacy PCI Express Endpoint",\r
1960 L"Unknown Type",\r
1961 L"Unknonw Type",\r
1962 L"Root Port of PCI Express Root Complex",\r
1963 L"Upstream Port of PCI Express Switch",\r
1964 L"Downstream Port of PCI Express Switch",\r
1965 L"PCI Express to PCI/PCI-X Bridge",\r
1966 L"PCI/PCI-X to PCI Express Bridge",\r
1967 L"Root Complex Integrated Endpoint",\r
1968 L"Root Complex Event Collector"\r
1969};\r
1970\r
1971CHAR16 *L0sLatencyStrTable[] = {\r
1972 L"Less than 64ns",\r
1973 L"64ns to less than 128ns",\r
1974 L"128ns to less than 256ns",\r
1975 L"256ns to less than 512ns",\r
1976 L"512ns to less than 1us",\r
1977 L"1us to less than 2us",\r
1978 L"2us-4us",\r
1979 L"More than 4us"\r
1980};\r
1981\r
1982CHAR16 *L1LatencyStrTable[] = {\r
1983 L"Less than 1us",\r
1984 L"1us to less than 2us",\r
1985 L"2us to less than 4us",\r
1986 L"4us to less than 8us",\r
1987 L"8us to less than 16us",\r
1988 L"16us to less than 32us",\r
1989 L"32us-64us",\r
1990 L"More than 64us"\r
1991};\r
1992\r
1993CHAR16 *ASPMCtrlStrTable[] = {\r
1994 L"Disabled",\r
1995 L"L0s Entry Enabled",\r
1996 L"L1 Entry Enabled",\r
1997 L"L0s and L1 Entry Enabled"\r
1998};\r
1999\r
2000CHAR16 *SlotPwrLmtScaleTable[] = {\r
2001 L"1.0x",\r
2002 L"0.1x",\r
2003 L"0.01x",\r
2004 L"0.001x"\r
2005};\r
2006\r
2007CHAR16 *IndicatorTable[] = {\r
2008 L"Reserved",\r
2009 L"On",\r
2010 L"Blink",\r
2011 L"Off"\r
2012};\r
2013\r
2014\r
a1d4bfcc 2015/**\r
2016 Function for 'pci' command.\r
2017\r
2018 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
2019 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
2020**/\r
5d73d92f 2021SHELL_STATUS\r
2022EFIAPI\r
2023ShellCommandRunPci (\r
2024 IN EFI_HANDLE ImageHandle,\r
2025 IN EFI_SYSTEM_TABLE *SystemTable\r
2026 )\r
2027{\r
2028 UINT16 Segment;\r
2029 UINT16 Bus;\r
2030 UINT16 Device;\r
2031 UINT16 Func;\r
2032 UINT64 Address;\r
2033 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev;\r
2034 EFI_STATUS Status;\r
2035 PCI_COMMON_HEADER PciHeader;\r
2036 PCI_CONFIG_SPACE ConfigSpace;\r
2037 UINTN ScreenCount;\r
2038 UINTN TempColumn;\r
2039 UINTN ScreenSize;\r
2040 BOOLEAN ExplainData;\r
2041 UINTN Index;\r
2042 UINTN SizeOfHeader;\r
2043 BOOLEAN PrintTitle;\r
2044 UINTN HandleBufSize;\r
2045 EFI_HANDLE *HandleBuf;\r
2046 UINTN HandleCount;\r
2047 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;\r
2048 UINT16 MinBus;\r
2049 UINT16 MaxBus;\r
2050 BOOLEAN IsEnd;\r
2051 LIST_ENTRY *Package;\r
2052 CHAR16 *ProblemParam;\r
2053 SHELL_STATUS ShellStatus;\r
5d73d92f 2054 CONST CHAR16 *Temp;\r
6855763e 2055 UINT64 RetVal;\r
705bffb5 2056 UINT16 EnhancedDump;\r
5d73d92f 2057\r
2058 ShellStatus = SHELL_SUCCESS;\r
2059 Status = EFI_SUCCESS;\r
2060 Address = 0;\r
5d73d92f 2061 IoDev = NULL;\r
2062 HandleBuf = NULL;\r
2063 Package = NULL;\r
2064\r
2065 //\r
2066 // initialize the shell lib (we must be in non-auto-init...)\r
2067 //\r
2068 Status = ShellInitialize();\r
2069 ASSERT_EFI_ERROR(Status);\r
2070\r
2071 Status = CommandInit();\r
2072 ASSERT_EFI_ERROR(Status);\r
2073\r
2074 //\r
2075 // parse the command line\r
2076 //\r
2077 Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
2078 if (EFI_ERROR(Status)) {\r
2079 if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
2080 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
2081 FreePool(ProblemParam);\r
2082 ShellStatus = SHELL_INVALID_PARAMETER;\r
2083 } else {\r
2084 ASSERT(FALSE);\r
2085 }\r
2086 } else {\r
2087\r
3737ac2b 2088 if (ShellCommandLineGetCount(Package) == 2) {\r
2089 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
2090 ShellStatus = SHELL_INVALID_PARAMETER;\r
2091 goto Done;\r
2092 }\r
5d73d92f 2093\r
3737ac2b 2094 if (ShellCommandLineGetCount(Package) > 4) {\r
2095 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
2096 ShellStatus = SHELL_INVALID_PARAMETER;\r
2097 goto Done;\r
2098 }\r
2099 if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetValue(Package, L"-s") == NULL) {\r
2100 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"-s");\r
2101 ShellStatus = SHELL_INVALID_PARAMETER;\r
2102 goto Done;\r
2103 }\r
5d73d92f 2104 //\r
2105 // Get all instances of PciRootBridgeIo. Allocate space for 1 EFI_HANDLE and\r
2106 // call LibLocateHandle(), if EFI_BUFFER_TOO_SMALL is returned, allocate enough\r
2107 // space for handles and call it again.\r
2108 //\r
2109 HandleBufSize = sizeof (EFI_HANDLE);\r
3737ac2b 2110 HandleBuf = (EFI_HANDLE *) AllocateZeroPool (HandleBufSize);\r
5d73d92f 2111 if (HandleBuf == NULL) {\r
2112 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle);\r
2113 ShellStatus = SHELL_OUT_OF_RESOURCES;\r
2114 goto Done;\r
2115 }\r
2116\r
2117 Status = gBS->LocateHandle (\r
2118 ByProtocol,\r
2119 &gEfiPciRootBridgeIoProtocolGuid,\r
2120 NULL,\r
2121 &HandleBufSize,\r
2122 HandleBuf\r
2123 );\r
2124\r
2125 if (Status == EFI_BUFFER_TOO_SMALL) {\r
2126 HandleBuf = ReallocatePool (sizeof (EFI_HANDLE), HandleBufSize, HandleBuf);\r
2127 if (HandleBuf == NULL) {\r
2128 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle);\r
2129 ShellStatus = SHELL_OUT_OF_RESOURCES;\r
2130 goto Done;\r
2131 }\r
2132\r
2133 Status = gBS->LocateHandle (\r
2134 ByProtocol,\r
2135 &gEfiPciRootBridgeIoProtocolGuid,\r
2136 NULL,\r
2137 &HandleBufSize,\r
2138 HandleBuf\r
2139 );\r
2140 }\r
2141\r
2142 if (EFI_ERROR (Status)) {\r
2143 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle);\r
2144 ShellStatus = SHELL_NOT_FOUND;\r
2145 goto Done;\r
2146 }\r
2147\r
2148 HandleCount = HandleBufSize / sizeof (EFI_HANDLE);\r
2149 //\r
2150 // Argument Count == 1(no other argument): enumerate all pci functions\r
2151 //\r
3737ac2b 2152 if (ShellCommandLineGetCount(Package) == 1) {\r
5d73d92f 2153 gST->ConOut->QueryMode (\r
2154 gST->ConOut,\r
2155 gST->ConOut->Mode->Mode,\r
2156 &TempColumn,\r
2157 &ScreenSize\r
2158 );\r
2159\r
2160 ScreenCount = 0;\r
2161 ScreenSize -= 4;\r
2162 if ((ScreenSize & 1) == 1) {\r
2163 ScreenSize -= 1;\r
2164 }\r
2165\r
2166 PrintTitle = TRUE;\r
2167\r
2168 //\r
2169 // For each handle, which decides a segment and a bus number range,\r
2170 // enumerate all devices on it.\r
2171 //\r
2172 for (Index = 0; Index < HandleCount; Index++) {\r
2173 Status = PciGetProtocolAndResource (\r
2174 HandleBuf[Index],\r
2175 &IoDev,\r
2176 &Descriptors\r
2177 );\r
2178 if (EFI_ERROR (Status)) {\r
2179 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_HANDLE_CFG_ERR), gShellDebug1HiiHandle, Status);\r
2180 ShellStatus = SHELL_NOT_FOUND;\r
2181 goto Done;\r
2182 }\r
2183 //\r
2184 // No document say it's impossible for a RootBridgeIo protocol handle\r
2185 // to have more than one address space descriptors, so find out every\r
2186 // bus range and for each of them do device enumeration.\r
2187 //\r
2188 while (TRUE) {\r
2189 Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);\r
2190\r
2191 if (EFI_ERROR (Status)) {\r
2192 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_BUS_RANGE_ERR), gShellDebug1HiiHandle, Status);\r
2193 ShellStatus = SHELL_NOT_FOUND;\r
2194 goto Done;\r
2195 }\r
2196\r
2197 if (IsEnd) {\r
2198 break;\r
2199 }\r
2200\r
2201 for (Bus = MinBus; Bus <= MaxBus; Bus++) {\r
2202 //\r
2203 // For each devices, enumerate all functions it contains\r
2204 //\r
2205 for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {\r
2206 //\r
2207 // For each function, read its configuration space and print summary\r
2208 //\r
2209 for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {\r
2210 if (ShellGetExecutionBreakFlag ()) {\r
2211 ShellStatus = SHELL_ABORTED;\r
2212 goto Done;\r
2213 }\r
2214 Address = CALC_EFI_PCI_ADDRESS (Bus, Device, Func, 0);\r
2215 IoDev->Pci.Read (\r
2216 IoDev,\r
2217 EfiPciWidthUint16,\r
2218 Address,\r
2219 1,\r
2220 &PciHeader.VendorId\r
2221 );\r
2222\r
2223 //\r
2224 // If VendorId = 0xffff, there does not exist a device at this\r
2225 // location. For each device, if there is any function on it,\r
2226 // there must be 1 function at Function 0. So if Func = 0, there\r
2227 // will be no more functions in the same device, so we can break\r
2228 // loop to deal with the next device.\r
2229 //\r
2230 if (PciHeader.VendorId == 0xffff && Func == 0) {\r
2231 break;\r
2232 }\r
2233\r
2234 if (PciHeader.VendorId != 0xffff) {\r
2235\r
2236 if (PrintTitle) {\r
2237 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_TITLE), gShellDebug1HiiHandle);\r
2238 PrintTitle = FALSE;\r
2239 }\r
2240\r
2241 IoDev->Pci.Read (\r
2242 IoDev,\r
2243 EfiPciWidthUint32,\r
2244 Address,\r
2245 sizeof (PciHeader) / sizeof (UINT32),\r
2246 &PciHeader\r
2247 );\r
2248\r
2249 ShellPrintHiiEx(\r
2250 -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P1), gShellDebug1HiiHandle,\r
2251 IoDev->SegmentNumber,\r
2252 Bus,\r
2253 Device,\r
2254 Func\r
2255 );\r
2256\r
2257 PciPrintClassCode (PciHeader.ClassCode, FALSE);\r
2258 ShellPrintHiiEx(\r
2259 -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P2), gShellDebug1HiiHandle,\r
2260 PciHeader.VendorId,\r
2261 PciHeader.DeviceId,\r
2262 PciHeader.ClassCode[0]\r
2263 );\r
2264\r
2265 ScreenCount += 2;\r
2266 if (ScreenCount >= ScreenSize && ScreenSize != 0) {\r
2267 //\r
2268 // If ScreenSize == 0 we have the console redirected so don't\r
2269 // block updates\r
2270 //\r
2271 ScreenCount = 0;\r
2272 }\r
2273 //\r
2274 // If this is not a multi-function device, we can leave the loop\r
2275 // to deal with the next device.\r
2276 //\r
2277 if (Func == 0 && ((PciHeader.HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00)) {\r
2278 break;\r
2279 }\r
2280 }\r
2281 }\r
2282 }\r
2283 }\r
2284 //\r
2285 // If Descriptor is NULL, Configuration() returns EFI_UNSUPPRORED,\r
2286 // we assume the bus range is 0~PCI_MAX_BUS. After enumerated all\r
2287 // devices on all bus, we can leave loop.\r
2288 //\r
2289 if (Descriptors == NULL) {\r
2290 break;\r
2291 }\r
2292 }\r
2293 }\r
2294\r
2295 Status = EFI_SUCCESS;\r
2296 goto Done;\r
2297 }\r
2298\r
5d73d92f 2299 ExplainData = FALSE;\r
2300 Segment = 0;\r
2301 Bus = 0;\r
2302 Device = 0;\r
2303 Func = 0;\r
2304 if (ShellCommandLineGetFlag(Package, L"-i")) {\r
2305 ExplainData = TRUE;\r
2306 }\r
2307\r
2308 Temp = ShellCommandLineGetValue(Package, L"-s");\r
2309 if (Temp != NULL) {\r
6855763e
CP
2310 //\r
2311 // Input converted to hexadecimal number.\r
2312 //\r
2313 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r
2314 Segment = (UINT16) RetVal;\r
2315 } else {\r
2316 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle);\r
2317 ShellStatus = SHELL_INVALID_PARAMETER;\r
2318 goto Done;\r
2319 }\r
5d73d92f 2320 }\r
2321\r
2322 //\r
2323 // The first Argument(except "-i") is assumed to be Bus number, second\r
2324 // to be Device number, and third to be Func number.\r
2325 //\r
2326 Temp = ShellCommandLineGetRawValue(Package, 1);\r
2327 if (Temp != NULL) {\r
6855763e
CP
2328 //\r
2329 // Input converted to hexadecimal number.\r
2330 //\r
2331 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r
2332 Bus = (UINT16) RetVal;\r
2333 } else {\r
2334 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle);\r
2335 ShellStatus = SHELL_INVALID_PARAMETER;\r
2336 goto Done;\r
2337 }\r
2338\r
5d73d92f 2339 if (Bus > MAX_BUS_NUMBER) {\r
2340 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
2341 ShellStatus = SHELL_INVALID_PARAMETER;\r
2342 goto Done;\r
2343 }\r
2344 }\r
2345 Temp = ShellCommandLineGetRawValue(Package, 2);\r
2346 if (Temp != NULL) {\r
6855763e
CP
2347 //\r
2348 // Input converted to hexadecimal number.\r
2349 //\r
2350 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r
2351 Device = (UINT16) RetVal;\r
2352 } else {\r
2353 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle);\r
2354 ShellStatus = SHELL_INVALID_PARAMETER;\r
2355 goto Done;\r
2356 }\r
2357\r
5d73d92f 2358 if (Device > MAX_DEVICE_NUMBER){\r
2359 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
2360 ShellStatus = SHELL_INVALID_PARAMETER;\r
2361 goto Done;\r
2362 }\r
2363 }\r
2364\r
2365 Temp = ShellCommandLineGetRawValue(Package, 3);\r
2366 if (Temp != NULL) {\r
6855763e
CP
2367 //\r
2368 // Input converted to hexadecimal number.\r
2369 //\r
2370 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) {\r
2371 Func = (UINT16) RetVal;\r
2372 } else {\r
2373 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle);\r
2374 ShellStatus = SHELL_INVALID_PARAMETER;\r
2375 goto Done;\r
2376 }\r
2377\r
5d73d92f 2378 if (Func > MAX_FUNCTION_NUMBER){\r
2379 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
2380 ShellStatus = SHELL_INVALID_PARAMETER;\r
2381 goto Done;\r
2382 }\r
2383 }\r
2384\r
2385 //\r
2386 // Find the protocol interface who's in charge of current segment, and its\r
2387 // bus range covers the current bus\r
2388 //\r
2389 Status = PciFindProtocolInterface (\r
2390 HandleBuf,\r
2391 HandleCount,\r
2392 Segment,\r
2393 Bus,\r
2394 &IoDev\r
2395 );\r
2396\r
2397 if (EFI_ERROR (Status)) {\r
2398 ShellPrintHiiEx(\r
2399 -1, -1, NULL, STRING_TOKEN (STR_PCI_NO_FIND), gShellDebug1HiiHandle,\r
5d73d92f 2400 Segment,\r
2401 Bus\r
2402 );\r
2403 ShellStatus = SHELL_NOT_FOUND;\r
2404 goto Done;\r
2405 }\r
2406\r
2407 Address = CALC_EFI_PCI_ADDRESS (Bus, Device, Func, 0);\r
2408 Status = IoDev->Pci.Read (\r
2409 IoDev,\r
2410 EfiPciWidthUint8,\r
2411 Address,\r
2412 sizeof (ConfigSpace),\r
2413 &ConfigSpace\r
2414 );\r
2415\r
2416 if (EFI_ERROR (Status)) {\r
2417 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_NO_CFG), gShellDebug1HiiHandle, Status);\r
2418 ShellStatus = SHELL_ACCESS_DENIED;\r
2419 goto Done;\r
2420 }\r
2421\r
2422 mConfigSpace = &ConfigSpace;\r
2423 ShellPrintHiiEx(\r
2424 -1,\r
2425 -1,\r
2426 NULL,\r
2427 STRING_TOKEN (STR_PCI_INFO),\r
2428 gShellDebug1HiiHandle,\r
2429 Segment,\r
2430 Bus,\r
2431 Device,\r
2432 Func,\r
2433 Segment,\r
2434 Bus,\r
2435 Device,\r
2436 Func\r
2437 );\r
2438\r
2439 //\r
2440 // Dump standard header of configuration space\r
2441 //\r
2442 SizeOfHeader = sizeof (ConfigSpace.Common) + sizeof (ConfigSpace.NonCommon);\r
2443\r
a1d4bfcc 2444 DumpHex (2, 0, SizeOfHeader, &ConfigSpace);\r
5d73d92f 2445 ShellPrintEx(-1,-1, L"\r\n");\r
2446\r
2447 //\r
2448 // Dump device dependent Part of configuration space\r
2449 //\r
a1d4bfcc 2450 DumpHex (\r
5d73d92f 2451 2,\r
2452 SizeOfHeader,\r
2453 sizeof (ConfigSpace) - SizeOfHeader,\r
2454 ConfigSpace.Data\r
2455 );\r
2456\r
2457 //\r
2458 // If "-i" appears in command line, interpret data in configuration space\r
2459 //\r
2460 if (ExplainData) {\r
705bffb5
JC
2461 EnhancedDump = 0;\r
2462 if (ShellCommandLineGetFlag(Package, L"-_e")) {\r
2463 EnhancedDump = 0xFFFF;\r
2464 Temp = ShellCommandLineGetValue(Package, L"-_e");\r
2465 if (Temp != NULL) {\r
2466 EnhancedDump = (UINT16) ShellHexStrToUintn (Temp);\r
2467 }\r
2468 }\r
2469 Status = PciExplainData (&ConfigSpace, Address, IoDev, EnhancedDump);\r
5d73d92f 2470 }\r
2471 }\r
2472Done:\r
2473 if (HandleBuf != NULL) {\r
2474 FreePool (HandleBuf);\r
2475 }\r
2476 if (Package != NULL) {\r
2477 ShellCommandLineFreeVarList (Package);\r
2478 }\r
2479 mConfigSpace = NULL;\r
2480 return ShellStatus;\r
2481}\r
2482\r
a1d4bfcc 2483/**\r
5d73d92f 2484 This function finds out the protocol which is in charge of the given\r
2485 segment, and its bus range covers the current bus number. It lookes\r
2486 each instances of RootBridgeIoProtocol handle, until the one meets the\r
2487 criteria is found.\r
2488\r
a1d4bfcc 2489 @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r
2490 @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.\r
2491 @param[in] Segment Segment number of device we are dealing with.\r
2492 @param[in] Bus Bus number of device we are dealing with.\r
2493 @param[out] IoDev Handle used to access configuration space of PCI device.\r
5d73d92f 2494\r
a1d4bfcc 2495 @retval EFI_SUCCESS The command completed successfully.\r
2496 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
5d73d92f 2497\r
2498**/\r
a1d4bfcc 2499EFI_STATUS\r
2500PciFindProtocolInterface (\r
2501 IN EFI_HANDLE *HandleBuf,\r
2502 IN UINTN HandleCount,\r
2503 IN UINT16 Segment,\r
2504 IN UINT16 Bus,\r
2505 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev\r
2506 )\r
5d73d92f 2507{\r
2508 UINTN Index;\r
2509 EFI_STATUS Status;\r
5d73d92f 2510 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;\r
2511 UINT16 MinBus;\r
2512 UINT16 MaxBus;\r
2513 BOOLEAN IsEnd;\r
2514\r
5d73d92f 2515 //\r
2516 // Go through all handles, until the one meets the criteria is found\r
2517 //\r
2518 for (Index = 0; Index < HandleCount; Index++) {\r
2519 Status = PciGetProtocolAndResource (HandleBuf[Index], IoDev, &Descriptors);\r
2520 if (EFI_ERROR (Status)) {\r
2521 return Status;\r
2522 }\r
2523 //\r
2524 // When Descriptors == NULL, the Configuration() is not implemented,\r
2525 // so we only check the Segment number\r
2526 //\r
2527 if (Descriptors == NULL && Segment == (*IoDev)->SegmentNumber) {\r
2528 return EFI_SUCCESS;\r
2529 }\r
2530\r
2531 if ((*IoDev)->SegmentNumber != Segment) {\r
2532 continue;\r
2533 }\r
2534\r
2535 while (TRUE) {\r
2536 Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);\r
2537 if (EFI_ERROR (Status)) {\r
2538 return Status;\r
2539 }\r
2540\r
2541 if (IsEnd) {\r
2542 break;\r
2543 }\r
2544\r
2545 if (MinBus <= Bus && MaxBus >= Bus) {\r
2c46dd23 2546 return EFI_SUCCESS;\r
5d73d92f 2547 }\r
2548 }\r
2549 }\r
2550\r
2c46dd23 2551 return EFI_NOT_FOUND;\r
5d73d92f 2552}\r
2553\r
a1d4bfcc 2554/**\r
2555 This function gets the protocol interface from the given handle, and\r
2556 obtains its address space descriptors.\r
2557\r
2558 @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle.\r
2559 @param[out] IoDev Handle used to access configuration space of PCI device.\r
2560 @param[out] Descriptors Points to the address space descriptors.\r
2561\r
2562 @retval EFI_SUCCESS The command completed successfully\r
2563**/\r
5d73d92f 2564EFI_STATUS\r
2565PciGetProtocolAndResource (\r
2566 IN EFI_HANDLE Handle,\r
2567 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,\r
2568 OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors\r
2569 )\r
5d73d92f 2570{\r
2571 EFI_STATUS Status;\r
2572\r
2573 //\r
2574 // Get inferface from protocol\r
2575 //\r
2576 Status = gBS->HandleProtocol (\r
2577 Handle,\r
2578 &gEfiPciRootBridgeIoProtocolGuid,\r
2579 (VOID**)IoDev\r
2580 );\r
2581\r
2582 if (EFI_ERROR (Status)) {\r
2583 return Status;\r
2584 }\r
2585 //\r
2586 // Call Configuration() to get address space descriptors\r
2587 //\r
2588 Status = (*IoDev)->Configuration (*IoDev, (VOID**)Descriptors);\r
2589 if (Status == EFI_UNSUPPORTED) {\r
2590 *Descriptors = NULL;\r
2591 return EFI_SUCCESS;\r
2592\r
2593 } else {\r
2594 return Status;\r
2595 }\r
2596}\r
2597\r
a1d4bfcc 2598/**\r
2599 This function get the next bus range of given address space descriptors.\r
2600 It also moves the pointer backward a node, to get prepared to be called\r
2601 again.\r
2602\r
4ff7e37b
ED
2603 @param[in, out] Descriptors Points to current position of a serial of address space\r
2604 descriptors.\r
2605 @param[out] MinBus The lower range of bus number.\r
2606 @param[out] MaxBus The upper range of bus number.\r
2607 @param[out] IsEnd Meet end of the serial of descriptors.\r
a1d4bfcc 2608\r
2609 @retval EFI_SUCCESS The command completed successfully.\r
2610**/\r
5d73d92f 2611EFI_STATUS\r
2612PciGetNextBusRange (\r
2613 IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r
2614 OUT UINT16 *MinBus,\r
2615 OUT UINT16 *MaxBus,\r
2616 OUT BOOLEAN *IsEnd\r
2617 )\r
5d73d92f 2618{\r
2619 *IsEnd = FALSE;\r
2620\r
2621 //\r
2622 // When *Descriptors is NULL, Configuration() is not implemented, so assume\r
2623 // range is 0~PCI_MAX_BUS\r
2624 //\r
2625 if ((*Descriptors) == NULL) {\r
2626 *MinBus = 0;\r
2627 *MaxBus = PCI_MAX_BUS;\r
2628 return EFI_SUCCESS;\r
2629 }\r
2630 //\r
2631 // *Descriptors points to one or more address space descriptors, which\r
2632 // ends with a end tagged descriptor. Examine each of the descriptors,\r
2633 // if a bus typed one is found and its bus range covers bus, this handle\r
2634 // is the handle we are looking for.\r
2635 //\r
5d73d92f 2636\r
2637 while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {\r
2638 if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {\r
2639 *MinBus = (UINT16) (*Descriptors)->AddrRangeMin;\r
2640 *MaxBus = (UINT16) (*Descriptors)->AddrRangeMax;\r
2641 (*Descriptors)++;\r
3737ac2b 2642 return (EFI_SUCCESS);\r
5d73d92f 2643 }\r
2644\r
2645 (*Descriptors)++;\r
2646 }\r
2647\r
3737ac2b 2648 if ((*Descriptors)->Desc == ACPI_END_TAG_DESCRIPTOR) {\r
2649 *IsEnd = TRUE;\r
2650 }\r
2651\r
5d73d92f 2652 return EFI_SUCCESS;\r
2653}\r
2654\r
a1d4bfcc 2655/**\r
5d73d92f 2656 Explain the data in PCI configuration space. The part which is common for\r
2657 PCI device and bridge is interpreted in this function. It calls other\r
2658 functions to interpret data unique for device or bridge.\r
2659\r
a1d4bfcc 2660 @param[in] ConfigSpace Data in PCI configuration space.\r
2661 @param[in] Address Address used to access configuration space of this PCI device.\r
2662 @param[in] IoDev Handle used to access configuration space of PCI device.\r
5d73d92f 2663\r
a1d4bfcc 2664 @retval EFI_SUCCESS The command completed successfully.\r
5d73d92f 2665**/\r
a1d4bfcc 2666EFI_STATUS\r
2667PciExplainData (\r
2668 IN PCI_CONFIG_SPACE *ConfigSpace,\r
2669 IN UINT64 Address,\r
705bffb5
JC
2670 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
2671 IN CONST UINT16 EnhancedDump\r
a1d4bfcc 2672 )\r
5d73d92f 2673{\r
2674 PCI_COMMON_HEADER *Common;\r
2675 PCI_HEADER_TYPE HeaderType;\r
2676 EFI_STATUS Status;\r
2677 UINT8 CapPtr;\r
2678\r
2679 Common = &(ConfigSpace->Common);\r
2680\r
c37e0f16 2681 ShellPrintEx (-1, -1, L"\r\n");\r
5d73d92f 2682\r
2683 //\r
2684 // Print Vendor Id and Device Id\r
2685 //\r
2686 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_VID_DID), gShellDebug1HiiHandle,\r
2687 INDEX_OF (&(Common->VendorId)),\r
2688 Common->VendorId,\r
2689 INDEX_OF (&(Common->DeviceId)),\r
2690 Common->DeviceId\r
2691 );\r
2692\r
2693 //\r
2694 // Print register Command\r
2695 //\r
2696 PciExplainCommand (&(Common->Command));\r
2697\r
2698 //\r
2699 // Print register Status\r
2700 //\r
2701 PciExplainStatus (&(Common->Status), TRUE, PciUndefined);\r
2702\r
2703 //\r
2704 // Print register Revision ID\r
2705 //\r
14b5e3fd 2706 ShellPrintEx(-1, -1, L"\r\n");\r
5d73d92f 2707 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_RID), gShellDebug1HiiHandle,\r
2708 INDEX_OF (&(Common->RevisionId)),\r
2709 Common->RevisionId\r
2710 );\r
2711\r
2712 //\r
2713 // Print register BIST\r
2714 //\r
a1d4bfcc 2715 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_BIST), gShellDebug1HiiHandle, INDEX_OF (&(Common->Bist)));\r
2716 if ((Common->Bist & PCI_BIT_7) != 0) {\r
2717 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP), gShellDebug1HiiHandle, 0x0f & Common->Bist);\r
5d73d92f 2718 } else {\r
2719 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP_NO), gShellDebug1HiiHandle);\r
2720 }\r
2721 //\r
2722 // Print register Cache Line Size\r
2723 //\r
2724 ShellPrintHiiEx(-1, -1, NULL,\r
2725 STRING_TOKEN (STR_PCI2_CACHE_LINE_SIZE),\r
2726 gShellDebug1HiiHandle,\r
2727 INDEX_OF (&(Common->CacheLineSize)),\r
2728 Common->CacheLineSize\r
2729 );\r
2730\r
2731 //\r
2732 // Print register Latency Timer\r
2733 //\r
2734 ShellPrintHiiEx(-1, -1, NULL,\r
2735 STRING_TOKEN (STR_PCI2_LATENCY_TIMER),\r
2736 gShellDebug1HiiHandle,\r
2737 INDEX_OF (&(Common->PrimaryLatencyTimer)),\r
2738 Common->PrimaryLatencyTimer\r
2739 );\r
2740\r
2741 //\r
2742 // Print register Header Type\r
2743 //\r
2744 ShellPrintHiiEx(-1, -1, NULL,\r
2745 STRING_TOKEN (STR_PCI2_HEADER_TYPE),\r
2746 gShellDebug1HiiHandle,\r
2747 INDEX_OF (&(Common->HeaderType)),\r
2748 Common->HeaderType\r
2749 );\r
2750\r
2751 if ((Common->HeaderType & PCI_BIT_7) != 0) {\r
2752 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MULTI_FUNCTION), gShellDebug1HiiHandle);\r
2753\r
2754 } else {\r
2755 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SINGLE_FUNCTION), gShellDebug1HiiHandle);\r
2756 }\r
2757\r
2758 HeaderType = (PCI_HEADER_TYPE)(UINT8) (Common->HeaderType & 0x7f);\r
2759 switch (HeaderType) {\r
2760 case PciDevice:\r
2761 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_PCI_DEVICE), gShellDebug1HiiHandle);\r
2762 break;\r
2763\r
2764 case PciP2pBridge:\r
2765 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_P2P_BRIDGE), gShellDebug1HiiHandle);\r
2766 break;\r
2767\r
2768 case PciCardBusBridge:\r
2769 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_BRIDGE), gShellDebug1HiiHandle);\r
2770 break;\r
2771\r
2772 default:\r
2773 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED), gShellDebug1HiiHandle);\r
2774 HeaderType = PciUndefined;\r
2775 }\r
2776\r
2777 //\r
2778 // Print register Class Code\r
2779 //\r
2780 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CLASS), gShellDebug1HiiHandle);\r
2781 PciPrintClassCode ((UINT8 *) Common->ClassCode, TRUE);\r
c37e0f16 2782 ShellPrintEx (-1, -1, L"\r\n");\r
5d73d92f 2783\r
2784 if (ShellGetExecutionBreakFlag()) {\r
2785 return EFI_SUCCESS;\r
2786 }\r
2787\r
2788 //\r
2789 // Interpret remaining part of PCI configuration header depending on\r
2790 // HeaderType\r
2791 //\r
2792 CapPtr = 0;\r
2793 Status = EFI_SUCCESS;\r
2794 switch (HeaderType) {\r
2795 case PciDevice:\r
2796 Status = PciExplainDeviceData (\r
2797 &(ConfigSpace->NonCommon.Device),\r
2798 Address,\r
2799 IoDev\r
2800 );\r
2801 CapPtr = ConfigSpace->NonCommon.Device.CapabilitiesPtr;\r
2802 break;\r
2803\r
2804 case PciP2pBridge:\r
2805 Status = PciExplainBridgeData (\r
2806 &(ConfigSpace->NonCommon.Bridge),\r
2807 Address,\r
2808 IoDev\r
2809 );\r
2810 CapPtr = ConfigSpace->NonCommon.Bridge.CapabilitiesPtr;\r
2811 break;\r
2812\r
2813 case PciCardBusBridge:\r
2814 Status = PciExplainCardBusData (\r
2815 &(ConfigSpace->NonCommon.CardBus),\r
2816 Address,\r
2817 IoDev\r
2818 );\r
2819 CapPtr = ConfigSpace->NonCommon.CardBus.CapabilitiesPtr;\r
2820 break;\r
d8f8021c 2821 case PciUndefined:\r
2822 default:\r
2823 break;\r
5d73d92f 2824 }\r
2825 //\r
2826 // If Status bit4 is 1, dump or explain capability structure\r
2827 //\r
2828 if ((Common->Status) & EFI_PCI_STATUS_CAPABILITY) {\r
705bffb5 2829 PciExplainCapabilityStruct (IoDev, Address, CapPtr, EnhancedDump);\r
5d73d92f 2830 }\r
2831\r
2832 return Status;\r
2833}\r
2834\r
a1d4bfcc 2835/**\r
2836 Explain the device specific part of data in PCI configuration space.\r
2837\r
2838 @param[in] Device Data in PCI configuration space.\r
2839 @param[in] Address Address used to access configuration space of this PCI device.\r
2840 @param[in] IoDev Handle used to access configuration space of PCI device.\r
2841\r
2842 @retval EFI_SUCCESS The command completed successfully.\r
2843**/\r
5d73d92f 2844EFI_STATUS\r
2845PciExplainDeviceData (\r
2846 IN PCI_DEVICE_HEADER *Device,\r
2847 IN UINT64 Address,\r
2848 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
2849 )\r
5d73d92f 2850{\r
2851 UINTN Index;\r
2852 BOOLEAN BarExist;\r
2853 EFI_STATUS Status;\r
2854 UINTN BarCount;\r
2855\r
2856 //\r
2857 // Print Base Address Registers(Bar). When Bar = 0, this Bar does not\r
2858 // exist. If these no Bar for this function, print "none", otherwise\r
2859 // list detail information about this Bar.\r
2860 //\r
2861 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDR), gShellDebug1HiiHandle, INDEX_OF (Device->Bar));\r
2862\r
2863 BarExist = FALSE;\r
2864 BarCount = sizeof (Device->Bar) / sizeof (Device->Bar[0]);\r
2865 for (Index = 0; Index < BarCount; Index++) {\r
2866 if (Device->Bar[Index] == 0) {\r
2867 continue;\r
2868 }\r
2869\r
2870 if (!BarExist) {\r
2871 BarExist = TRUE;\r
2872 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE), gShellDebug1HiiHandle);\r
c37e0f16 2873 ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------");\r
5d73d92f 2874 }\r
2875\r
2876 Status = PciExplainBar (\r
2877 &(Device->Bar[Index]),\r
2878 &(mConfigSpace->Common.Command),\r
2879 Address,\r
2880 IoDev,\r
2881 &Index\r
2882 );\r
2883\r
2884 if (EFI_ERROR (Status)) {\r
2885 break;\r
2886 }\r
2887 }\r
2888\r
2889 if (!BarExist) {\r
2890 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);\r
2891\r
2892 } else {\r
c37e0f16 2893 ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------");\r
5d73d92f 2894 }\r
2895\r
2896 //\r
2897 // Print register Expansion ROM Base Address\r
2898 //\r
2899 if ((Device->ROMBar & PCI_BIT_0) == 0) {\r
2900 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_EXPANSION_ROM_DISABLED), gShellDebug1HiiHandle, INDEX_OF (&(Device->ROMBar)));\r
2901\r
2902 } else {\r
2903 ShellPrintHiiEx(-1, -1, NULL,\r
2904 STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE),\r
2905 gShellDebug1HiiHandle,\r
2906 INDEX_OF (&(Device->ROMBar)),\r
2907 Device->ROMBar\r
2908 );\r
2909 }\r
2910 //\r
2911 // Print register Cardbus CIS ptr\r
2912 //\r
2913 ShellPrintHiiEx(-1, -1, NULL,\r
2914 STRING_TOKEN (STR_PCI2_CARDBUS_CIS),\r
2915 gShellDebug1HiiHandle,\r
2916 INDEX_OF (&(Device->CardBusCISPtr)),\r
2917 Device->CardBusCISPtr\r
2918 );\r
2919\r
2920 //\r
2921 // Print register Sub-vendor ID and subsystem ID\r
2922 //\r
2923 ShellPrintHiiEx(-1, -1, NULL,\r
2924 STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID),\r
2925 gShellDebug1HiiHandle,\r
2926 INDEX_OF (&(Device->SubVendorId)),\r
2927 Device->SubVendorId\r
2928 );\r
2929\r
2930 ShellPrintHiiEx(-1, -1, NULL,\r
2931 STRING_TOKEN (STR_PCI2_SUBSYSTEM_ID),\r
2932 gShellDebug1HiiHandle,\r
2933 INDEX_OF (&(Device->SubSystemId)),\r
2934 Device->SubSystemId\r
2935 );\r
2936\r
2937 //\r
2938 // Print register Capabilities Ptr\r
2939 //\r
2940 ShellPrintHiiEx(-1, -1, NULL,\r
2941 STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR),\r
2942 gShellDebug1HiiHandle,\r
2943 INDEX_OF (&(Device->CapabilitiesPtr)),\r
2944 Device->CapabilitiesPtr\r
2945 );\r
2946\r
2947 //\r
2948 // Print register Interrupt Line and interrupt pin\r
2949 //\r
2950 ShellPrintHiiEx(-1, -1, NULL,\r
2951 STRING_TOKEN (STR_PCI2_INTERRUPT_LINE),\r
2952 gShellDebug1HiiHandle,\r
2953 INDEX_OF (&(Device->InterruptLine)),\r
2954 Device->InterruptLine\r
2955 );\r
2956\r
2957 ShellPrintHiiEx(-1, -1, NULL,\r
2958 STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),\r
2959 gShellDebug1HiiHandle,\r
2960 INDEX_OF (&(Device->InterruptPin)),\r
2961 Device->InterruptPin\r
2962 );\r
2963\r
2964 //\r
2965 // Print register Min_Gnt and Max_Lat\r
2966 //\r
2967 ShellPrintHiiEx(-1, -1, NULL,\r
2968 STRING_TOKEN (STR_PCI2_MIN_GNT),\r
2969 gShellDebug1HiiHandle,\r
2970 INDEX_OF (&(Device->MinGnt)),\r
2971 Device->MinGnt\r
2972 );\r
2973\r
2974 ShellPrintHiiEx(-1, -1, NULL,\r
2975 STRING_TOKEN (STR_PCI2_MAX_LAT),\r
2976 gShellDebug1HiiHandle,\r
2977 INDEX_OF (&(Device->MaxLat)),\r
2978 Device->MaxLat\r
2979 );\r
2980\r
2981 return EFI_SUCCESS;\r
2982}\r
2983\r
a1d4bfcc 2984/**\r
2985 Explain the bridge specific part of data in PCI configuration space.\r
2986\r
2987 @param[in] Bridge Bridge specific data region in PCI configuration space.\r
2988 @param[in] Address Address used to access configuration space of this PCI device.\r
2989 @param[in] IoDev Handle used to access configuration space of PCI device.\r
2990\r
2991 @retval EFI_SUCCESS The command completed successfully.\r
2992**/\r
5d73d92f 2993EFI_STATUS\r
2994PciExplainBridgeData (\r
2995 IN PCI_BRIDGE_HEADER *Bridge,\r
2996 IN UINT64 Address,\r
2997 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
2998 )\r
5d73d92f 2999{\r
3000 UINTN Index;\r
3001 BOOLEAN BarExist;\r
3002 UINTN BarCount;\r
3003 UINT32 IoAddress32;\r
3004 EFI_STATUS Status;\r
3005\r
3006 //\r
3007 // Print Base Address Registers. When Bar = 0, this Bar does not\r
3008 // exist. If these no Bar for this function, print "none", otherwise\r
3009 // list detail information about this Bar.\r
3010 //\r
3011 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDRESS), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->Bar)));\r
3012\r
3013 BarExist = FALSE;\r
3014 BarCount = sizeof (Bridge->Bar) / sizeof (Bridge->Bar[0]);\r
3015\r
3016 for (Index = 0; Index < BarCount; Index++) {\r
3017 if (Bridge->Bar[Index] == 0) {\r
3018 continue;\r
3019 }\r
3020\r
3021 if (!BarExist) {\r
3022 BarExist = TRUE;\r
3023 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE_2), gShellDebug1HiiHandle);\r
c37e0f16 3024 ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------");\r
5d73d92f 3025 }\r
3026\r
3027 Status = PciExplainBar (\r
3028 &(Bridge->Bar[Index]),\r
3029 &(mConfigSpace->Common.Command),\r
3030 Address,\r
3031 IoDev,\r
3032 &Index\r
3033 );\r
3034\r
3035 if (EFI_ERROR (Status)) {\r
3036 break;\r
3037 }\r
3038 }\r
3039\r
3040 if (!BarExist) {\r
3041 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);\r
3042 } else {\r
c37e0f16 3043 ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------");\r
5d73d92f 3044 }\r
3045\r
3046 //\r
3047 // Expansion register ROM Base Address\r
3048 //\r
3049 if ((Bridge->ROMBar & PCI_BIT_0) == 0) {\r
3050 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO_EXPANSION_ROM), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->ROMBar)));\r
3051\r
3052 } else {\r
3053 ShellPrintHiiEx(-1, -1, NULL,\r
3054 STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE_2),\r
3055 gShellDebug1HiiHandle,\r
3056 INDEX_OF (&(Bridge->ROMBar)),\r
3057 Bridge->ROMBar\r
3058 );\r
3059 }\r
3060 //\r
3061 // Print Bus Numbers(Primary, Secondary, and Subordinate\r
3062 //\r
3063 ShellPrintHiiEx(-1, -1, NULL,\r
3064 STRING_TOKEN (STR_PCI2_BUS_NUMBERS),\r
3065 gShellDebug1HiiHandle,\r
3066 INDEX_OF (&(Bridge->PrimaryBus)),\r
3067 INDEX_OF (&(Bridge->SecondaryBus)),\r
3068 INDEX_OF (&(Bridge->SubordinateBus))\r
3069 );\r
3070\r
c37e0f16 3071 ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n");\r
5d73d92f 3072\r
3073 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->PrimaryBus);\r
3074 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SecondaryBus);\r
3075 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SubordinateBus);\r
3076\r
3077 //\r
3078 // Print register Secondary Latency Timer\r
3079 //\r
3080 ShellPrintHiiEx(-1, -1, NULL,\r
3081 STRING_TOKEN (STR_PCI2_SECONDARY_TIMER),\r
3082 gShellDebug1HiiHandle,\r
3083 INDEX_OF (&(Bridge->SecondaryLatencyTimer)),\r
3084 Bridge->SecondaryLatencyTimer\r
3085 );\r
3086\r
3087 //\r
3088 // Print register Secondary Status\r
3089 //\r
3090 PciExplainStatus (&(Bridge->SecondaryStatus), FALSE, PciP2pBridge);\r
3091\r
3092 //\r
3093 // Print I/O and memory ranges this bridge forwards. There are 3 resource\r
3094 // types: I/O, memory, and pre-fetchable memory. For each resource type,\r
3095 // base and limit address are listed.\r
3096 //\r
3097 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE), gShellDebug1HiiHandle);\r
c37e0f16 3098 ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n");\r
5d73d92f 3099\r
3100 //\r
3101 // IO Base & Limit\r
3102 //\r
3103 IoAddress32 = (Bridge->IoBaseUpper << 16 | Bridge->IoBase << 8);\r
3104 IoAddress32 &= 0xfffff000;\r
3105 ShellPrintHiiEx(-1, -1, NULL,\r
3106 STRING_TOKEN (STR_PCI2_TWO_VARS),\r
3107 gShellDebug1HiiHandle,\r
3108 INDEX_OF (&(Bridge->IoBase)),\r
3109 IoAddress32\r
3110 );\r
3111\r
3112 IoAddress32 = (Bridge->IoLimitUpper << 16 | Bridge->IoLimit << 8);\r
3113 IoAddress32 |= 0x00000fff;\r
3114 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR), gShellDebug1HiiHandle, IoAddress32);\r
3115\r
3116 //\r
3117 // Memory Base & Limit\r
3118 //\r
3119 ShellPrintHiiEx(-1, -1, NULL,\r
3120 STRING_TOKEN (STR_PCI2_MEMORY),\r
3121 gShellDebug1HiiHandle,\r
3122 INDEX_OF (&(Bridge->MemoryBase)),\r
3123 (Bridge->MemoryBase << 16) & 0xfff00000\r
3124 );\r
3125\r
3126 ShellPrintHiiEx(-1, -1, NULL,\r
3127 STRING_TOKEN (STR_PCI2_ONE_VAR),\r
3128 gShellDebug1HiiHandle,\r
3129 (Bridge->MemoryLimit << 16) | 0x000fffff\r
3130 );\r
3131\r
3132 //\r
3133 // Pre-fetch-able Memory Base & Limit\r
3134 //\r
3135 ShellPrintHiiEx(-1, -1, NULL,\r
3136 STRING_TOKEN (STR_PCI2_PREFETCHABLE),\r
3137 gShellDebug1HiiHandle,\r
3138 INDEX_OF (&(Bridge->PrefetchableMemBase)),\r
3139 Bridge->PrefetchableBaseUpper,\r
3140 (Bridge->PrefetchableMemBase << 16) & 0xfff00000\r
3141 );\r
3142\r
3143 ShellPrintHiiEx(-1, -1, NULL,\r
3144 STRING_TOKEN (STR_PCI2_TWO_VARS_2),\r
3145 gShellDebug1HiiHandle,\r
3146 Bridge->PrefetchableLimitUpper,\r
3147 (Bridge->PrefetchableMemLimit << 16) | 0x000fffff\r
3148 );\r
3149\r
3150 //\r
3151 // Print register Capabilities Pointer\r
3152 //\r
3153 ShellPrintHiiEx(-1, -1, NULL,\r
3154 STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR_2),\r
3155 gShellDebug1HiiHandle,\r
3156 INDEX_OF (&(Bridge->CapabilitiesPtr)),\r
3157 Bridge->CapabilitiesPtr\r
3158 );\r
3159\r
3160 //\r
3161 // Print register Bridge Control\r
3162 //\r
3163 PciExplainBridgeControl (&(Bridge->BridgeControl), PciP2pBridge);\r
3164\r
3165 //\r
3166 // Print register Interrupt Line & PIN\r
3167 //\r
3168 ShellPrintHiiEx(-1, -1, NULL,\r
3169 STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_2),\r
3170 gShellDebug1HiiHandle,\r
3171 INDEX_OF (&(Bridge->InterruptLine)),\r
3172 Bridge->InterruptLine\r
3173 );\r
3174\r
3175 ShellPrintHiiEx(-1, -1, NULL,\r
3176 STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),\r
3177 gShellDebug1HiiHandle,\r
3178 INDEX_OF (&(Bridge->InterruptPin)),\r
3179 Bridge->InterruptPin\r
3180 );\r
3181\r
3182 return EFI_SUCCESS;\r
3183}\r
3184\r
a1d4bfcc 3185/**\r
3186 Explain the Base Address Register(Bar) in PCI configuration space.\r
3187\r
4ff7e37b
ED
3188 @param[in] Bar Points to the Base Address Register intended to interpret.\r
3189 @param[in] Command Points to the register Command.\r
3190 @param[in] Address Address used to access configuration space of this PCI device.\r
3191 @param[in] IoDev Handle used to access configuration space of PCI device.\r
3192 @param[in, out] Index The Index.\r
a1d4bfcc 3193\r
3194 @retval EFI_SUCCESS The command completed successfully.\r
3195**/\r
5d73d92f 3196EFI_STATUS\r
3197PciExplainBar (\r
3198 IN UINT32 *Bar,\r
3199 IN UINT16 *Command,\r
3200 IN UINT64 Address,\r
3201 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
3202 IN OUT UINTN *Index\r
3203 )\r
5d73d92f 3204{\r
3205 UINT16 OldCommand;\r
3206 UINT16 NewCommand;\r
3207 UINT64 Bar64;\r
3208 UINT32 OldBar32;\r
3209 UINT32 NewBar32;\r
3210 UINT64 OldBar64;\r
3211 UINT64 NewBar64;\r
3212 BOOLEAN IsMem;\r
3213 BOOLEAN IsBar32;\r
3214 UINT64 RegAddress;\r
3215\r
3216 IsBar32 = TRUE;\r
3217 Bar64 = 0;\r
3218 NewBar32 = 0;\r
3219 NewBar64 = 0;\r
3220\r
3221 //\r
3222 // According the bar type, list detail about this bar, for example: 32 or\r
3223 // 64 bits; pre-fetchable or not.\r
3224 //\r
3225 if ((*Bar & PCI_BIT_0) == 0) {\r
3226 //\r
3227 // This bar is of memory type\r
3228 //\r
3229 IsMem = TRUE;\r
3230\r
3231 if ((*Bar & PCI_BIT_1) == 0 && (*Bar & PCI_BIT_2) == 0) {\r
3232 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);\r
3233 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);\r
3234 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_32_BITS), gShellDebug1HiiHandle);\r
3235\r
3236 } else if ((*Bar & PCI_BIT_1) == 0 && (*Bar & PCI_BIT_2) != 0) {\r
3237 Bar64 = 0x0;\r
3238 CopyMem (&Bar64, Bar, sizeof (UINT64));\r
46cb4043 3239 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, (UINT32) RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32));\r
2b578de0 3240 ShellPrintHiiEx(-1, -1, NULL,STRING