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