2 Main file for Pci shell Debug1 function.
4 Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
6 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "UefiShellDebug1CommandsLib.h"
18 #include <Protocol/PciRootBridgeIo.h>
19 #include <Library/ShellLib.h>
20 #include <IndustryStandard/Pci.h>
21 #include <IndustryStandard/Acpi.h>
25 // Printable strings for Pci class code
28 CHAR16
*BaseClass
; // Pointer to the PCI base class string
29 CHAR16
*SubClass
; // Pointer to the PCI sub class string
30 CHAR16
*PIFClass
; // Pointer to the PCI programming interface string
34 // a structure holding a single entry, which also points to its lower level
37 typedef struct PCI_CLASS_ENTRY_TAG
{
38 UINT8 Code
; // Class, subclass or I/F code
39 CHAR16
*DescText
; // Description string
40 struct PCI_CLASS_ENTRY_TAG
*LowerLevelClass
; // Subclass or I/F if any
44 // Declarations of entries which contain printable strings for class codes
45 // in PCI configuration space
47 PCI_CLASS_ENTRY PCIBlankEntry
[];
48 PCI_CLASS_ENTRY PCISubClass_00
[];
49 PCI_CLASS_ENTRY PCISubClass_01
[];
50 PCI_CLASS_ENTRY PCISubClass_02
[];
51 PCI_CLASS_ENTRY PCISubClass_03
[];
52 PCI_CLASS_ENTRY PCISubClass_04
[];
53 PCI_CLASS_ENTRY PCISubClass_05
[];
54 PCI_CLASS_ENTRY PCISubClass_06
[];
55 PCI_CLASS_ENTRY PCISubClass_07
[];
56 PCI_CLASS_ENTRY PCISubClass_08
[];
57 PCI_CLASS_ENTRY PCISubClass_09
[];
58 PCI_CLASS_ENTRY PCISubClass_0a
[];
59 PCI_CLASS_ENTRY PCISubClass_0b
[];
60 PCI_CLASS_ENTRY PCISubClass_0c
[];
61 PCI_CLASS_ENTRY PCISubClass_0d
[];
62 PCI_CLASS_ENTRY PCISubClass_0e
[];
63 PCI_CLASS_ENTRY PCISubClass_0f
[];
64 PCI_CLASS_ENTRY PCISubClass_10
[];
65 PCI_CLASS_ENTRY PCISubClass_11
[];
66 PCI_CLASS_ENTRY PCISubClass_12
[];
67 PCI_CLASS_ENTRY PCISubClass_13
[];
68 PCI_CLASS_ENTRY PCIPIFClass_0100
[];
69 PCI_CLASS_ENTRY PCIPIFClass_0101
[];
70 PCI_CLASS_ENTRY PCIPIFClass_0105
[];
71 PCI_CLASS_ENTRY PCIPIFClass_0106
[];
72 PCI_CLASS_ENTRY PCIPIFClass_0107
[];
73 PCI_CLASS_ENTRY PCIPIFClass_0108
[];
74 PCI_CLASS_ENTRY PCIPIFClass_0109
[];
75 PCI_CLASS_ENTRY PCIPIFClass_0300
[];
76 PCI_CLASS_ENTRY PCIPIFClass_0604
[];
77 PCI_CLASS_ENTRY PCIPIFClass_0609
[];
78 PCI_CLASS_ENTRY PCIPIFClass_060b
[];
79 PCI_CLASS_ENTRY PCIPIFClass_0700
[];
80 PCI_CLASS_ENTRY PCIPIFClass_0701
[];
81 PCI_CLASS_ENTRY PCIPIFClass_0703
[];
82 PCI_CLASS_ENTRY PCIPIFClass_0800
[];
83 PCI_CLASS_ENTRY PCIPIFClass_0801
[];
84 PCI_CLASS_ENTRY PCIPIFClass_0802
[];
85 PCI_CLASS_ENTRY PCIPIFClass_0803
[];
86 PCI_CLASS_ENTRY PCIPIFClass_0904
[];
87 PCI_CLASS_ENTRY PCIPIFClass_0c00
[];
88 PCI_CLASS_ENTRY PCIPIFClass_0c03
[];
89 PCI_CLASS_ENTRY PCIPIFClass_0c07
[];
90 PCI_CLASS_ENTRY PCIPIFClass_0d01
[];
91 PCI_CLASS_ENTRY PCIPIFClass_0e00
[];
94 // Base class strings entries
96 PCI_CLASS_ENTRY gClassStringList
[] = {
104 L
"Mass Storage Controller",
109 L
"Network Controller",
114 L
"Display Controller",
119 L
"Multimedia Device",
124 L
"Memory Controller",
134 L
"Simple Communications Controllers",
139 L
"Base System Peripherals",
159 L
"Serial Bus Controllers",
164 L
"Wireless Controllers",
169 L
"Intelligent IO Controllers",
174 L
"Satellite Communications Controllers",
179 L
"Encryption/Decryption Controllers",
184 L
"Data Acquisition & Signal Processing Controllers",
189 L
"Processing Accelerators",
194 L
"Non-Essential Instrumentation",
199 L
"Device does not fit in any defined classes",
205 /* null string ends the list */NULL
210 // Subclass strings entries
212 PCI_CLASS_ENTRY PCIBlankEntry
[] = {
221 /* null string ends the list */NULL
225 PCI_CLASS_ENTRY PCISubClass_00
[] = {
228 L
"All devices other than VGA",
233 L
"VGA-compatible devices",
239 /* null string ends the list */NULL
243 PCI_CLASS_ENTRY PCISubClass_01
[] = {
256 L
"Floppy disk controller",
271 L
"ATA controller with ADMA interface",
276 L
"Serial ATA controller",
281 L
"Serial Attached SCSI (SAS) controller ",
286 L
"Non-volatile memory subsystem",
291 L
"Universal Flash Storage (UFS) controller ",
296 L
"Other mass storage controller",
302 /* null string ends the list */NULL
306 PCI_CLASS_ENTRY PCISubClass_02
[] = {
309 L
"Ethernet controller",
314 L
"Token ring controller",
334 L
"WorldFip controller",
339 L
"PICMG 2.14 Multi Computing",
344 L
"InfiniBand controller",
349 L
"Other network controller",
355 /* null string ends the list */NULL
359 PCI_CLASS_ENTRY PCISubClass_03
[] = {
362 L
"VGA/8514 controller",
377 L
"Other display controller",
383 /* null string ends the list */PCIBlankEntry
387 PCI_CLASS_ENTRY PCISubClass_04
[] = {
400 L
"Computer Telephony device",
405 L
"Mixed mode device",
410 L
"Other multimedia device",
416 /* null string ends the list */NULL
420 PCI_CLASS_ENTRY PCISubClass_05
[] = {
423 L
"RAM memory controller",
428 L
"Flash memory controller",
433 L
"Other memory controller",
439 /* null string ends the list */NULL
443 PCI_CLASS_ENTRY PCISubClass_06
[] = {
461 L
"PCI/Micro Channel bridge",
471 L
"PCI/PCMCIA bridge",
491 L
"Semi-transparent PCI-to-PCI bridge",
496 L
"InfiniBand-to-PCI host bridge",
501 L
"Advanced Switching to PCI host bridge",
506 L
"Other bridge type",
512 /* null string ends the list */NULL
516 PCI_CLASS_ENTRY PCISubClass_07
[] = {
519 L
"Serial controller",
529 L
"Multiport serial controller",
539 L
"GPIB (IEEE 488.1/2) controller",
549 L
"Other communication device",
555 /* null string ends the list */NULL
559 PCI_CLASS_ENTRY PCISubClass_08
[] = {
582 L
"Generic PCI Hot-Plug controller",
587 L
"SD Host controller",
597 L
"Root Complex Event Collector",
602 L
"Other system peripheral",
608 /* null string ends the list */NULL
612 PCI_CLASS_ENTRY PCISubClass_09
[] = {
615 L
"Keyboard controller",
630 L
"Scanner controller",
635 L
"Gameport controller",
640 L
"Other input controller",
646 /* null string ends the list */NULL
650 PCI_CLASS_ENTRY PCISubClass_0a
[] = {
653 L
"Generic docking station",
658 L
"Other type of docking station",
664 /* null string ends the list */NULL
668 PCI_CLASS_ENTRY PCISubClass_0b
[] = {
712 /* null string ends the list */NULL
716 PCI_CLASS_ENTRY PCISubClass_0c
[] = {
744 L
"System Management Bus",
759 L
"SERCOS Interface Standard (IEC 61491)",
775 /* null string ends the list */NULL
779 PCI_CLASS_ENTRY PCISubClass_0d
[] = {
782 L
"iRDA compatible controller",
807 L
"Ethernet (802.11a - 5 GHz)",
812 L
"Ethernet (802.11b - 2.4 GHz)",
817 L
"Other type of wireless controller",
823 /* null string ends the list */NULL
827 PCI_CLASS_ENTRY PCISubClass_0e
[] = {
836 /* null string ends the list */NULL
840 PCI_CLASS_ENTRY PCISubClass_0f
[] = {
863 L
"Other satellite communication controller",
869 /* null string ends the list */NULL
873 PCI_CLASS_ENTRY PCISubClass_10
[] = {
876 L
"Network & computing Encrypt/Decrypt",
881 L
"Entertainment Encrypt/Decrypt",
886 L
"Other Encrypt/Decrypt",
892 /* null string ends the list */NULL
896 PCI_CLASS_ENTRY PCISubClass_11
[] = {
904 L
"Performance Counters",
909 L
"Communications synchronization plus time and frequency test/measurement ",
919 L
"Other DAQ & SP controllers",
925 /* null string ends the list */NULL
929 PCI_CLASS_ENTRY PCISubClass_12
[] = {
932 L
"Processing Accelerator",
938 /* null string ends the list */NULL
942 PCI_CLASS_ENTRY PCISubClass_13
[] = {
945 L
"Non-Essential Instrumentation Function",
951 /* null string ends the list */NULL
956 // Programming Interface entries
958 PCI_CLASS_ENTRY PCIPIFClass_0100
[] = {
966 L
"SCSI storage device SOP using PQI",
971 L
"SCSI controller SOP using PQI",
976 L
"SCSI storage device and controller SOP using PQI",
981 L
"SCSI storage device SOP using NVMe",
987 /* null string ends the list */NULL
991 PCI_CLASS_ENTRY PCIPIFClass_0101
[] = {
1019 L
"OM-primary, OM-secondary",
1024 L
"PI-primary, OM-secondary",
1029 L
"OM/PI-primary, OM-secondary",
1039 L
"OM-primary, PI-secondary",
1044 L
"PI-primary, PI-secondary",
1049 L
"OM/PI-primary, PI-secondary",
1059 L
"OM-primary, OM/PI-secondary",
1064 L
"PI-primary, OM/PI-secondary",
1069 L
"OM/PI-primary, OM/PI-secondary",
1079 L
"Master, OM-primary",
1084 L
"Master, PI-primary",
1089 L
"Master, OM/PI-primary",
1094 L
"Master, OM-secondary",
1099 L
"Master, OM-primary, OM-secondary",
1104 L
"Master, PI-primary, OM-secondary",
1109 L
"Master, OM/PI-primary, OM-secondary",
1114 L
"Master, OM-secondary",
1119 L
"Master, OM-primary, PI-secondary",
1124 L
"Master, PI-primary, PI-secondary",
1129 L
"Master, OM/PI-primary, PI-secondary",
1134 L
"Master, OM-secondary",
1139 L
"Master, OM-primary, OM/PI-secondary",
1144 L
"Master, PI-primary, OM/PI-secondary",
1149 L
"Master, OM/PI-primary, OM/PI-secondary",
1155 /* null string ends the list */NULL
1159 PCI_CLASS_ENTRY PCIPIFClass_0105
[] = {
1167 L
"Continuous operation",
1173 /* null string ends the list */NULL
1177 PCI_CLASS_ENTRY PCIPIFClass_0106
[] = {
1190 L
"Serial Storage Bus",
1196 /* null string ends the list */NULL
1200 PCI_CLASS_ENTRY PCIPIFClass_0107
[] = {
1214 /* null string ends the list */NULL
1218 PCI_CLASS_ENTRY PCIPIFClass_0108
[] = {
1237 /* null string ends the list */NULL
1241 PCI_CLASS_ENTRY PCIPIFClass_0109
[] = {
1255 /* null string ends the list */NULL
1259 PCI_CLASS_ENTRY PCIPIFClass_0300
[] = {
1273 /* null string ends the list */NULL
1277 PCI_CLASS_ENTRY PCIPIFClass_0604
[] = {
1285 L
"Subtractive decode",
1291 /* null string ends the list */NULL
1295 PCI_CLASS_ENTRY PCIPIFClass_0609
[] = {
1298 L
"Primary PCI bus side facing the system host processor",
1303 L
"Secondary PCI bus side facing the system host processor",
1309 /* null string ends the list */NULL
1313 PCI_CLASS_ENTRY PCIPIFClass_060b
[] = {
1321 L
"ASI-SIG Defined Portal",
1327 /* null string ends the list */NULL
1331 PCI_CLASS_ENTRY PCIPIFClass_0700
[] = {
1334 L
"Generic XT-compatible",
1339 L
"16450-compatible",
1344 L
"16550-compatible",
1349 L
"16650-compatible",
1354 L
"16750-compatible",
1359 L
"16850-compatible",
1364 L
"16950-compatible",
1370 /* null string ends the list */NULL
1374 PCI_CLASS_ENTRY PCIPIFClass_0701
[] = {
1387 L
"ECP 1.X-compliant",
1397 L
"IEEE 1284 target (not a controller)",
1403 /* null string ends the list */NULL
1407 PCI_CLASS_ENTRY PCIPIFClass_0703
[] = {
1415 L
"Hayes-compatible 16450",
1420 L
"Hayes-compatible 16550",
1425 L
"Hayes-compatible 16650",
1430 L
"Hayes-compatible 16750",
1436 /* null string ends the list */NULL
1440 PCI_CLASS_ENTRY PCIPIFClass_0800
[] = {
1463 L
"IO(x) APIC interrupt controller",
1469 /* null string ends the list */NULL
1473 PCI_CLASS_ENTRY PCIPIFClass_0801
[] = {
1492 /* null string ends the list */NULL
1496 PCI_CLASS_ENTRY PCIPIFClass_0802
[] = {
1515 /* null string ends the list */NULL
1519 PCI_CLASS_ENTRY PCIPIFClass_0803
[] = {
1538 /* null string ends the list */NULL
1542 PCI_CLASS_ENTRY PCIPIFClass_0904
[] = {
1556 /* null string ends the list */NULL
1560 PCI_CLASS_ENTRY PCIPIFClass_0c00
[] = {
1568 L
"Using 1394 OpenHCI spec",
1574 /* null string ends the list */NULL
1578 PCI_CLASS_ENTRY PCIPIFClass_0c03
[] = {
1601 L
"No specific programming interface",
1606 L
"(Not Host Controller)",
1612 /* null string ends the list */NULL
1616 PCI_CLASS_ENTRY PCIPIFClass_0c07
[] = {
1624 L
"Keyboard Controller Style",
1635 /* null string ends the list */NULL
1639 PCI_CLASS_ENTRY PCIPIFClass_0d01
[] = {
1642 L
"Consumer IR controller",
1647 L
"UWB Radio controller",
1653 /* null string ends the list */NULL
1657 PCI_CLASS_ENTRY PCIPIFClass_0e00
[] = {
1660 L
"Message FIFO at offset 40h",
1671 /* null string ends the list */NULL
1677 Generates printable Unicode strings that represent PCI device class,
1678 subclass and programmed I/F based on a value passed to the function.
1680 @param[in] ClassCode Value representing the PCI "Class Code" register read from a
1681 PCI device. The encodings are:
1682 bits 23:16 - Base Class Code
1683 bits 15:8 - Sub-Class Code
1684 bits 7:0 - Programming Interface
1685 @param[in, out] ClassStrings Pointer of PCI_CLASS_STRINGS structure, which contains
1686 printable class strings corresponding to ClassCode. The
1687 caller must not modify the strings that are pointed by
1688 the fields in ClassStrings.
1691 PciGetClassStrings (
1692 IN UINT32 ClassCode
,
1693 IN OUT PCI_CLASS_STRINGS
*ClassStrings
1698 PCI_CLASS_ENTRY
*CurrentClass
;
1701 // Assume no strings found
1703 ClassStrings
->BaseClass
= L
"UNDEFINED";
1704 ClassStrings
->SubClass
= L
"UNDEFINED";
1705 ClassStrings
->PIFClass
= L
"UNDEFINED";
1707 CurrentClass
= gClassStringList
;
1708 Code
= (UINT8
) (ClassCode
>> 16);
1712 // Go through all entries of the base class, until the entry with a matching
1713 // base class code is found. If reaches an entry with a null description
1714 // text, the last entry is met, which means no text for the base class was
1715 // found, so no more action is needed.
1717 while (Code
!= CurrentClass
[Index
].Code
) {
1718 if (NULL
== CurrentClass
[Index
].DescText
) {
1725 // A base class was found. Assign description, and check if this class has
1726 // sub-class defined. If sub-class defined, no more action is needed,
1727 // otherwise, continue to find description for the sub-class code.
1729 ClassStrings
->BaseClass
= CurrentClass
[Index
].DescText
;
1730 if (NULL
== CurrentClass
[Index
].LowerLevelClass
) {
1734 // find Subclass entry
1736 CurrentClass
= CurrentClass
[Index
].LowerLevelClass
;
1737 Code
= (UINT8
) (ClassCode
>> 8);
1741 // Go through all entries of the sub-class, until the entry with a matching
1742 // sub-class code is found. If reaches an entry with a null description
1743 // text, the last entry is met, which means no text for the sub-class was
1744 // found, so no more action is needed.
1746 while (Code
!= CurrentClass
[Index
].Code
) {
1747 if (NULL
== CurrentClass
[Index
].DescText
) {
1754 // A class was found for the sub-class code. Assign description, and check if
1755 // this sub-class has programming interface defined. If no, no more action is
1756 // needed, otherwise, continue to find description for the programming
1759 ClassStrings
->SubClass
= CurrentClass
[Index
].DescText
;
1760 if (NULL
== CurrentClass
[Index
].LowerLevelClass
) {
1764 // Find programming interface entry
1766 CurrentClass
= CurrentClass
[Index
].LowerLevelClass
;
1767 Code
= (UINT8
) ClassCode
;
1771 // Go through all entries of the I/F entries, until the entry with a
1772 // matching I/F code is found. If reaches an entry with a null description
1773 // text, the last entry is met, which means no text was found, so no more
1774 // action is needed.
1776 while (Code
!= CurrentClass
[Index
].Code
) {
1777 if (NULL
== CurrentClass
[Index
].DescText
) {
1784 // A class was found for the I/F code. Assign description, done!
1786 ClassStrings
->PIFClass
= CurrentClass
[Index
].DescText
;
1791 Print strings that represent PCI device class, subclass and programmed I/F.
1793 @param[in] ClassCodePtr Points to the memory which stores register Class Code in PCI
1794 configuration space.
1795 @param[in] IncludePIF If the printed string should include the programming I/F part
1799 IN UINT8
*ClassCodePtr
,
1800 IN BOOLEAN IncludePIF
1804 PCI_CLASS_STRINGS ClassStrings
;
1807 ClassCode
|= (UINT32
)ClassCodePtr
[0];
1808 ClassCode
|= (UINT32
)(ClassCodePtr
[1] << 8);
1809 ClassCode
|= (UINT32
)(ClassCodePtr
[2] << 16);
1812 // Get name from class code
1814 PciGetClassStrings (ClassCode
, &ClassStrings
);
1818 // Print base class, sub class, and programming inferface name
1820 ShellPrintEx (-1, -1, L
"%s - %s - %s",
1821 ClassStrings
.BaseClass
,
1822 ClassStrings
.SubClass
,
1823 ClassStrings
.PIFClass
1828 // Only print base class and sub class name
1830 ShellPrintEx (-1, -1, L
"%s - %s",
1831 ClassStrings
.BaseClass
,
1832 ClassStrings
.SubClass
1838 This function finds out the protocol which is in charge of the given
1839 segment, and its bus range covers the current bus number. It lookes
1840 each instances of RootBridgeIoProtocol handle, until the one meets the
1843 @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.
1844 @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.
1845 @param[in] Segment Segment number of device we are dealing with.
1846 @param[in] Bus Bus number of device we are dealing with.
1847 @param[out] IoDev Handle used to access configuration space of PCI device.
1849 @retval EFI_SUCCESS The command completed successfully.
1850 @retval EFI_INVALID_PARAMETER Invalid parameter.
1854 PciFindProtocolInterface (
1855 IN EFI_HANDLE
*HandleBuf
,
1856 IN UINTN HandleCount
,
1859 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
**IoDev
1863 This function gets the protocol interface from the given handle, and
1864 obtains its address space descriptors.
1866 @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle.
1867 @param[out] IoDev Handle used to access configuration space of PCI device.
1868 @param[out] Descriptors Points to the address space descriptors.
1870 @retval EFI_SUCCESS The command completed successfully
1873 PciGetProtocolAndResource (
1874 IN EFI_HANDLE Handle
,
1875 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
**IoDev
,
1876 OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
1880 This function get the next bus range of given address space descriptors.
1881 It also moves the pointer backward a node, to get prepared to be called
1884 @param[in, out] Descriptors Points to current position of a serial of address space
1886 @param[out] MinBus The lower range of bus number.
1887 @param[out] MaxBus The upper range of bus number.
1888 @param[out] IsEnd Meet end of the serial of descriptors.
1890 @retval EFI_SUCCESS The command completed successfully.
1893 PciGetNextBusRange (
1894 IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
1901 Explain the data in PCI configuration space. The part which is common for
1902 PCI device and bridge is interpreted in this function. It calls other
1903 functions to interpret data unique for device or bridge.
1905 @param[in] ConfigSpace Data in PCI configuration space.
1906 @param[in] Address Address used to access configuration space of this PCI device.
1907 @param[in] IoDev Handle used to access configuration space of PCI device.
1908 @param[in] EnhancedDump The print format for the dump data.
1910 @retval EFI_SUCCESS The command completed successfully.
1914 IN PCI_CONFIG_SPACE
*ConfigSpace
,
1916 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
1917 IN CONST UINT16 EnhancedDump
1921 Explain the device specific part of data in PCI configuration space.
1923 @param[in] Device Data in PCI configuration space.
1924 @param[in] Address Address used to access configuration space of this PCI device.
1925 @param[in] IoDev Handle used to access configuration space of PCI device.
1927 @retval EFI_SUCCESS The command completed successfully.
1930 PciExplainDeviceData (
1931 IN PCI_DEVICE_HEADER
*Device
,
1933 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
1937 Explain the bridge specific part of data in PCI configuration space.
1939 @param[in] Bridge Bridge specific data region in PCI configuration space.
1940 @param[in] Address Address used to access configuration space of this PCI device.
1941 @param[in] IoDev Handle used to access configuration space of PCI device.
1943 @retval EFI_SUCCESS The command completed successfully.
1946 PciExplainBridgeData (
1947 IN PCI_BRIDGE_HEADER
*Bridge
,
1949 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
1953 Explain the Base Address Register(Bar) in PCI configuration space.
1955 @param[in] Bar Points to the Base Address Register intended to interpret.
1956 @param[in] Command Points to the register Command.
1957 @param[in] Address Address used to access configuration space of this PCI device.
1958 @param[in] IoDev Handle used to access configuration space of PCI device.
1959 @param[in, out] Index The Index.
1961 @retval EFI_SUCCESS The command completed successfully.
1968 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
1973 Explain the cardbus specific part of data in PCI configuration space.
1975 @param[in] CardBus CardBus specific region of PCI configuration space.
1976 @param[in] Address Address used to access configuration space of this PCI device.
1977 @param[in] IoDev Handle used to access configuration space of PCI device.
1979 @retval EFI_SUCCESS The command completed successfully.
1982 PciExplainCardBusData (
1983 IN PCI_CARDBUS_HEADER
*CardBus
,
1985 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
1989 Explain each meaningful bit of register Status. The definition of Status is
1990 slightly different depending on the PCI header type.
1992 @param[in] Status Points to the content of register Status.
1993 @param[in] MainStatus Indicates if this register is main status(not secondary
1995 @param[in] HeaderType Header type of this PCI device.
1997 @retval EFI_SUCCESS The command completed successfully.
2002 IN BOOLEAN MainStatus
,
2003 IN PCI_HEADER_TYPE HeaderType
2007 Explain each meaningful bit of register Command.
2009 @param[in] Command Points to the content of register Command.
2011 @retval EFI_SUCCESS The command completed successfully.
2019 Explain each meaningful bit of register Bridge Control.
2021 @param[in] BridgeControl Points to the content of register Bridge Control.
2022 @param[in] HeaderType The headertype.
2024 @retval EFI_SUCCESS The command completed successfully.
2027 PciExplainBridgeControl (
2028 IN UINT16
*BridgeControl
,
2029 IN PCI_HEADER_TYPE HeaderType
2033 Print each capability structure.
2035 @param[in] IoDev The pointer to the deivce.
2036 @param[in] Address The address to start at.
2037 @param[in] CapPtr The offset from the address.
2038 @param[in] EnhancedDump The print format for the dump data.
2040 @retval EFI_SUCCESS The operation was successful.
2043 PciExplainCapabilityStruct (
2044 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
2047 IN CONST UINT16 EnhancedDump
2051 Display Pcie device structure.
2053 @param[in] IoDev The pointer to the root pci protocol.
2054 @param[in] Address The Address to start at.
2055 @param[in] CapabilityPtr The offset from the address to start.
2056 @param[in] EnhancedDump The print format for the dump data.
2058 @retval EFI_SUCCESS The command completed successfully.
2059 @retval @retval EFI_SUCCESS Pci express extend space IO is not suppoted.
2062 PciExplainPciExpress (
2063 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
2065 IN UINT8 CapabilityPtr
,
2066 IN CONST UINT16 EnhancedDump
2070 Print out information of the capability information.
2072 @param[in] PciExpressCap The pointer to the structure about the device.
2074 @retval EFI_SUCCESS The operation was successful.
2078 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2082 Print out information of the device capability information.
2084 @param[in] PciExpressCap The pointer to the structure about the device.
2086 @retval EFI_SUCCESS The operation was successful.
2089 ExplainPcieDeviceCap (
2090 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2094 Print out information of the device control information.
2096 @param[in] PciExpressCap The pointer to the structure about the device.
2098 @retval EFI_SUCCESS The operation was successful.
2101 ExplainPcieDeviceControl (
2102 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2106 Print out information of the device status information.
2108 @param[in] PciExpressCap The pointer to the structure about the device.
2110 @retval EFI_SUCCESS The operation was successful.
2113 ExplainPcieDeviceStatus (
2114 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2118 Print out information of the device link information.
2120 @param[in] PciExpressCap The pointer to the structure about the device.
2122 @retval EFI_SUCCESS The operation was successful.
2125 ExplainPcieLinkCap (
2126 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2130 Print out information of the device link control information.
2132 @param[in] PciExpressCap The pointer to the structure about the device.
2134 @retval EFI_SUCCESS The operation was successful.
2137 ExplainPcieLinkControl (
2138 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2142 Print out information of the device link status information.
2144 @param[in] PciExpressCap The pointer to the structure about the device.
2146 @retval EFI_SUCCESS The operation was successful.
2149 ExplainPcieLinkStatus (
2150 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2154 Print out information of the device slot information.
2156 @param[in] PciExpressCap The pointer to the structure about the device.
2158 @retval EFI_SUCCESS The operation was successful.
2161 ExplainPcieSlotCap (
2162 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2166 Print out information of the device slot control information.
2168 @param[in] PciExpressCap The pointer to the structure about the device.
2170 @retval EFI_SUCCESS The operation was successful.
2173 ExplainPcieSlotControl (
2174 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2178 Print out information of the device slot status information.
2180 @param[in] PciExpressCap The pointer to the structure about the device.
2182 @retval EFI_SUCCESS The operation was successful.
2185 ExplainPcieSlotStatus (
2186 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2190 Print out information of the device root information.
2192 @param[in] PciExpressCap The pointer to the structure about the device.
2194 @retval EFI_SUCCESS The operation was successful.
2197 ExplainPcieRootControl (
2198 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2202 Print out information of the device root capability information.
2204 @param[in] PciExpressCap The pointer to the structure about the device.
2206 @retval EFI_SUCCESS The operation was successful.
2209 ExplainPcieRootCap (
2210 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2214 Print out information of the device root status information.
2216 @param[in] PciExpressCap The pointer to the structure about the device.
2218 @retval EFI_SUCCESS The operation was successful.
2221 ExplainPcieRootStatus (
2222 IN PCIE_CAP_STRUCTURE
*PciExpressCap
2225 typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION
) (IN PCIE_CAP_STRUCTURE
*PciExpressCap
);
2231 } PCIE_CAPREG_FIELD_WIDTH
;
2234 PcieExplainTypeCommon
,
2235 PcieExplainTypeDevice
,
2236 PcieExplainTypeLink
,
2237 PcieExplainTypeSlot
,
2238 PcieExplainTypeRoot
,
2240 } PCIE_EXPLAIN_TYPE
;
2246 PCIE_CAPREG_FIELD_WIDTH Width
;
2247 PCIE_EXPLAIN_FUNCTION Func
;
2248 PCIE_EXPLAIN_TYPE Type
;
2249 } PCIE_EXPLAIN_STRUCT
;
2251 PCIE_EXPLAIN_STRUCT PcieExplainList
[] = {
2253 STRING_TOKEN (STR_PCIEX_CAPABILITY_CAPID
),
2257 PcieExplainTypeCommon
2260 STRING_TOKEN (STR_PCIEX_NEXTCAP_PTR
),
2264 PcieExplainTypeCommon
2267 STRING_TOKEN (STR_PCIEX_CAP_REGISTER
),
2271 PcieExplainTypeCommon
2274 STRING_TOKEN (STR_PCIEX_DEVICE_CAP
),
2277 ExplainPcieDeviceCap
,
2278 PcieExplainTypeDevice
2281 STRING_TOKEN (STR_PCIEX_DEVICE_CONTROL
),
2284 ExplainPcieDeviceControl
,
2285 PcieExplainTypeDevice
2288 STRING_TOKEN (STR_PCIEX_DEVICE_STATUS
),
2291 ExplainPcieDeviceStatus
,
2292 PcieExplainTypeDevice
2295 STRING_TOKEN (STR_PCIEX_LINK_CAPABILITIES
),
2302 STRING_TOKEN (STR_PCIEX_LINK_CONTROL
),
2305 ExplainPcieLinkControl
,
2309 STRING_TOKEN (STR_PCIEX_LINK_STATUS
),
2312 ExplainPcieLinkStatus
,
2316 STRING_TOKEN (STR_PCIEX_SLOT_CAPABILITIES
),
2323 STRING_TOKEN (STR_PCIEX_SLOT_CONTROL
),
2326 ExplainPcieSlotControl
,
2330 STRING_TOKEN (STR_PCIEX_SLOT_STATUS
),
2333 ExplainPcieSlotStatus
,
2337 STRING_TOKEN (STR_PCIEX_ROOT_CONTROL
),
2340 ExplainPcieRootControl
,
2344 STRING_TOKEN (STR_PCIEX_RSVDP
),
2351 STRING_TOKEN (STR_PCIEX_ROOT_STATUS
),
2354 ExplainPcieRootStatus
,
2360 (PCIE_CAPREG_FIELD_WIDTH
)0,
2369 PCI_CONFIG_SPACE
*mConfigSpace
= NULL
;
2370 STATIC CONST SHELL_PARAM_ITEM ParamList
[] = {
2376 CHAR16
*DevicePortTypeTable
[] = {
2377 L
"PCI Express Endpoint",
2378 L
"Legacy PCI Express Endpoint",
2381 L
"Root Port of PCI Express Root Complex",
2382 L
"Upstream Port of PCI Express Switch",
2383 L
"Downstream Port of PCI Express Switch",
2384 L
"PCI Express to PCI/PCI-X Bridge",
2385 L
"PCI/PCI-X to PCI Express Bridge",
2386 L
"Root Complex Integrated Endpoint",
2387 L
"Root Complex Event Collector"
2390 CHAR16
*L0sLatencyStrTable
[] = {
2392 L
"64ns to less than 128ns",
2393 L
"128ns to less than 256ns",
2394 L
"256ns to less than 512ns",
2395 L
"512ns to less than 1us",
2396 L
"1us to less than 2us",
2401 CHAR16
*L1LatencyStrTable
[] = {
2403 L
"1us to less than 2us",
2404 L
"2us to less than 4us",
2405 L
"4us to less than 8us",
2406 L
"8us to less than 16us",
2407 L
"16us to less than 32us",
2412 CHAR16
*ASPMCtrlStrTable
[] = {
2414 L
"L0s Entry Enabled",
2415 L
"L1 Entry Enabled",
2416 L
"L0s and L1 Entry Enabled"
2419 CHAR16
*SlotPwrLmtScaleTable
[] = {
2426 CHAR16
*IndicatorTable
[] = {
2435 Function for 'pci' command.
2437 @param[in] ImageHandle Handle to the Image (NULL if Internal).
2438 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
2442 ShellCommandRunPci (
2443 IN EFI_HANDLE ImageHandle
,
2444 IN EFI_SYSTEM_TABLE
*SystemTable
2452 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
;
2454 PCI_COMMON_HEADER PciHeader
;
2455 PCI_CONFIG_SPACE ConfigSpace
;
2459 BOOLEAN ExplainData
;
2463 UINTN HandleBufSize
;
2464 EFI_HANDLE
*HandleBuf
;
2466 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
*Descriptors
;
2470 LIST_ENTRY
*Package
;
2471 CHAR16
*ProblemParam
;
2472 SHELL_STATUS ShellStatus
;
2475 UINT16 EnhancedDump
;
2477 ShellStatus
= SHELL_SUCCESS
;
2478 Status
= EFI_SUCCESS
;
2485 // initialize the shell lib (we must be in non-auto-init...)
2487 Status
= ShellInitialize();
2488 ASSERT_EFI_ERROR(Status
);
2490 Status
= CommandInit();
2491 ASSERT_EFI_ERROR(Status
);
2494 // parse the command line
2496 Status
= ShellCommandLineParse (ParamList
, &Package
, &ProblemParam
, TRUE
);
2497 if (EFI_ERROR(Status
)) {
2498 if (Status
== EFI_VOLUME_CORRUPTED
&& ProblemParam
!= NULL
) {
2499 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellDebug1HiiHandle
, L
"pci", ProblemParam
);
2500 FreePool(ProblemParam
);
2501 ShellStatus
= SHELL_INVALID_PARAMETER
;
2507 if (ShellCommandLineGetCount(Package
) == 2) {
2508 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_FEW
), gShellDebug1HiiHandle
, L
"pci");
2509 ShellStatus
= SHELL_INVALID_PARAMETER
;
2513 if (ShellCommandLineGetCount(Package
) > 4) {
2514 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellDebug1HiiHandle
, L
"pci");
2515 ShellStatus
= SHELL_INVALID_PARAMETER
;
2518 if (ShellCommandLineGetFlag(Package
, L
"-s") && ShellCommandLineGetValue(Package
, L
"-s") == NULL
) {
2519 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_NO_VALUE
), gShellDebug1HiiHandle
, L
"pci", L
"-s");
2520 ShellStatus
= SHELL_INVALID_PARAMETER
;
2524 // Get all instances of PciRootBridgeIo. Allocate space for 1 EFI_HANDLE and
2525 // call LibLocateHandle(), if EFI_BUFFER_TOO_SMALL is returned, allocate enough
2526 // space for handles and call it again.
2528 HandleBufSize
= sizeof (EFI_HANDLE
);
2529 HandleBuf
= (EFI_HANDLE
*) AllocateZeroPool (HandleBufSize
);
2530 if (HandleBuf
== NULL
) {
2531 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_OUT_MEM
), gShellDebug1HiiHandle
, L
"pci");
2532 ShellStatus
= SHELL_OUT_OF_RESOURCES
;
2536 Status
= gBS
->LocateHandle (
2538 &gEfiPciRootBridgeIoProtocolGuid
,
2544 if (Status
== EFI_BUFFER_TOO_SMALL
) {
2545 HandleBuf
= ReallocatePool (sizeof (EFI_HANDLE
), HandleBufSize
, HandleBuf
);
2546 if (HandleBuf
== NULL
) {
2547 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_OUT_MEM
), gShellDebug1HiiHandle
, L
"pci");
2548 ShellStatus
= SHELL_OUT_OF_RESOURCES
;
2552 Status
= gBS
->LocateHandle (
2554 &gEfiPciRootBridgeIoProtocolGuid
,
2561 if (EFI_ERROR (Status
)) {
2562 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PCIRBIO_NF
), gShellDebug1HiiHandle
, L
"pci");
2563 ShellStatus
= SHELL_NOT_FOUND
;
2567 HandleCount
= HandleBufSize
/ sizeof (EFI_HANDLE
);
2569 // Argument Count == 1(no other argument): enumerate all pci functions
2571 if (ShellCommandLineGetCount(Package
) == 1) {
2572 gST
->ConOut
->QueryMode (
2574 gST
->ConOut
->Mode
->Mode
,
2581 if ((ScreenSize
& 1) == 1) {
2588 // For each handle, which decides a segment and a bus number range,
2589 // enumerate all devices on it.
2591 for (Index
= 0; Index
< HandleCount
; Index
++) {
2592 Status
= PciGetProtocolAndResource (
2597 if (EFI_ERROR (Status
)) {
2598 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_HANDLE_CFG_ERR
), gShellDebug1HiiHandle
, L
"pci");
2599 ShellStatus
= SHELL_NOT_FOUND
;
2603 // No document say it's impossible for a RootBridgeIo protocol handle
2604 // to have more than one address space descriptors, so find out every
2605 // bus range and for each of them do device enumeration.
2608 Status
= PciGetNextBusRange (&Descriptors
, &MinBus
, &MaxBus
, &IsEnd
);
2610 if (EFI_ERROR (Status
)) {
2611 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_BUS_RANGE_ERR
), gShellDebug1HiiHandle
, L
"pci");
2612 ShellStatus
= SHELL_NOT_FOUND
;
2620 for (Bus
= MinBus
; Bus
<= MaxBus
; Bus
++) {
2622 // For each devices, enumerate all functions it contains
2624 for (Device
= 0; Device
<= PCI_MAX_DEVICE
; Device
++) {
2626 // For each function, read its configuration space and print summary
2628 for (Func
= 0; Func
<= PCI_MAX_FUNC
; Func
++) {
2629 if (ShellGetExecutionBreakFlag ()) {
2630 ShellStatus
= SHELL_ABORTED
;
2633 Address
= CALC_EFI_PCI_ADDRESS (Bus
, Device
, Func
, 0);
2643 // If VendorId = 0xffff, there does not exist a device at this
2644 // location. For each device, if there is any function on it,
2645 // there must be 1 function at Function 0. So if Func = 0, there
2646 // will be no more functions in the same device, so we can break
2647 // loop to deal with the next device.
2649 if (PciHeader
.VendorId
== 0xffff && Func
== 0) {
2653 if (PciHeader
.VendorId
!= 0xffff) {
2656 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_TITLE
), gShellDebug1HiiHandle
);
2664 sizeof (PciHeader
) / sizeof (UINT32
),
2669 -1, -1, NULL
, STRING_TOKEN (STR_PCI_LINE_P1
), gShellDebug1HiiHandle
,
2670 IoDev
->SegmentNumber
,
2676 PciPrintClassCode (PciHeader
.ClassCode
, FALSE
);
2678 -1, -1, NULL
, STRING_TOKEN (STR_PCI_LINE_P2
), gShellDebug1HiiHandle
,
2681 PciHeader
.ClassCode
[0]
2685 if (ScreenCount
>= ScreenSize
&& ScreenSize
!= 0) {
2687 // If ScreenSize == 0 we have the console redirected so don't
2693 // If this is not a multi-function device, we can leave the loop
2694 // to deal with the next device.
2696 if (Func
== 0 && ((PciHeader
.HeaderType
& HEADER_TYPE_MULTI_FUNCTION
) == 0x00)) {
2704 // If Descriptor is NULL, Configuration() returns EFI_UNSUPPRORED,
2705 // we assume the bus range is 0~PCI_MAX_BUS. After enumerated all
2706 // devices on all bus, we can leave loop.
2708 if (Descriptors
== NULL
) {
2714 Status
= EFI_SUCCESS
;
2718 ExplainData
= FALSE
;
2723 if (ShellCommandLineGetFlag(Package
, L
"-i")) {
2727 Temp
= ShellCommandLineGetValue(Package
, L
"-s");
2730 // Input converted to hexadecimal number.
2732 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp
, &RetVal
, TRUE
, TRUE
))) {
2733 Segment
= (UINT16
) RetVal
;
2735 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV_HEX
), gShellDebug1HiiHandle
, L
"pci", Temp
);
2736 ShellStatus
= SHELL_INVALID_PARAMETER
;
2742 // The first Argument(except "-i") is assumed to be Bus number, second
2743 // to be Device number, and third to be Func number.
2745 Temp
= ShellCommandLineGetRawValue(Package
, 1);
2748 // Input converted to hexadecimal number.
2750 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp
, &RetVal
, TRUE
, TRUE
))) {
2751 Bus
= (UINT16
) RetVal
;
2753 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV_HEX
), gShellDebug1HiiHandle
, L
"pci", Temp
);
2754 ShellStatus
= SHELL_INVALID_PARAMETER
;
2758 if (Bus
> MAX_BUS_NUMBER
) {
2759 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV
), gShellDebug1HiiHandle
, L
"pci", Temp
);
2760 ShellStatus
= SHELL_INVALID_PARAMETER
;
2764 Temp
= ShellCommandLineGetRawValue(Package
, 2);
2767 // Input converted to hexadecimal number.
2769 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp
, &RetVal
, TRUE
, TRUE
))) {
2770 Device
= (UINT16
) RetVal
;
2772 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV_HEX
), gShellDebug1HiiHandle
, L
"pci", Temp
);
2773 ShellStatus
= SHELL_INVALID_PARAMETER
;
2777 if (Device
> MAX_DEVICE_NUMBER
){
2778 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV
), gShellDebug1HiiHandle
, L
"pci", Temp
);
2779 ShellStatus
= SHELL_INVALID_PARAMETER
;
2784 Temp
= ShellCommandLineGetRawValue(Package
, 3);
2787 // Input converted to hexadecimal number.
2789 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp
, &RetVal
, TRUE
, TRUE
))) {
2790 Func
= (UINT16
) RetVal
;
2792 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV_HEX
), gShellDebug1HiiHandle
, L
"pci", Temp
);
2793 ShellStatus
= SHELL_INVALID_PARAMETER
;
2797 if (Func
> MAX_FUNCTION_NUMBER
){
2798 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV
), gShellDebug1HiiHandle
, L
"pci", Temp
);
2799 ShellStatus
= SHELL_INVALID_PARAMETER
;
2805 // Find the protocol interface who's in charge of current segment, and its
2806 // bus range covers the current bus
2808 Status
= PciFindProtocolInterface (
2816 if (EFI_ERROR (Status
)) {
2818 -1, -1, NULL
, STRING_TOKEN (STR_PCI_NO_FIND
), gShellDebug1HiiHandle
, L
"pci",
2822 ShellStatus
= SHELL_NOT_FOUND
;
2826 Address
= CALC_EFI_PCI_ADDRESS (Bus
, Device
, Func
, 0);
2827 Status
= IoDev
->Pci
.Read (
2831 sizeof (ConfigSpace
),
2835 if (EFI_ERROR (Status
)) {
2836 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_NO_CFG
), gShellDebug1HiiHandle
, L
"pci");
2837 ShellStatus
= SHELL_ACCESS_DENIED
;
2841 mConfigSpace
= &ConfigSpace
;
2846 STRING_TOKEN (STR_PCI_INFO
),
2847 gShellDebug1HiiHandle
,
2859 // Dump standard header of configuration space
2861 SizeOfHeader
= sizeof (ConfigSpace
.Common
) + sizeof (ConfigSpace
.NonCommon
);
2863 DumpHex (2, 0, SizeOfHeader
, &ConfigSpace
);
2864 ShellPrintEx(-1,-1, L
"\r\n");
2867 // Dump device dependent Part of configuration space
2872 sizeof (ConfigSpace
) - SizeOfHeader
,
2877 // If "-i" appears in command line, interpret data in configuration space
2881 if (ShellCommandLineGetFlag(Package
, L
"-_e")) {
2882 EnhancedDump
= 0xFFFF;
2883 Temp
= ShellCommandLineGetValue(Package
, L
"-_e");
2885 EnhancedDump
= (UINT16
) ShellHexStrToUintn (Temp
);
2888 Status
= PciExplainData (&ConfigSpace
, Address
, IoDev
, EnhancedDump
);
2892 if (HandleBuf
!= NULL
) {
2893 FreePool (HandleBuf
);
2895 if (Package
!= NULL
) {
2896 ShellCommandLineFreeVarList (Package
);
2898 mConfigSpace
= NULL
;
2903 This function finds out the protocol which is in charge of the given
2904 segment, and its bus range covers the current bus number. It lookes
2905 each instances of RootBridgeIoProtocol handle, until the one meets the
2908 @param[in] HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.
2909 @param[in] HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles.
2910 @param[in] Segment Segment number of device we are dealing with.
2911 @param[in] Bus Bus number of device we are dealing with.
2912 @param[out] IoDev Handle used to access configuration space of PCI device.
2914 @retval EFI_SUCCESS The command completed successfully.
2915 @retval EFI_INVALID_PARAMETER Invalid parameter.
2919 PciFindProtocolInterface (
2920 IN EFI_HANDLE
*HandleBuf
,
2921 IN UINTN HandleCount
,
2924 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
**IoDev
2929 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
*Descriptors
;
2935 // Go through all handles, until the one meets the criteria is found
2937 for (Index
= 0; Index
< HandleCount
; Index
++) {
2938 Status
= PciGetProtocolAndResource (HandleBuf
[Index
], IoDev
, &Descriptors
);
2939 if (EFI_ERROR (Status
)) {
2943 // When Descriptors == NULL, the Configuration() is not implemented,
2944 // so we only check the Segment number
2946 if (Descriptors
== NULL
&& Segment
== (*IoDev
)->SegmentNumber
) {
2950 if ((*IoDev
)->SegmentNumber
!= Segment
) {
2955 Status
= PciGetNextBusRange (&Descriptors
, &MinBus
, &MaxBus
, &IsEnd
);
2956 if (EFI_ERROR (Status
)) {
2964 if (MinBus
<= Bus
&& MaxBus
>= Bus
) {
2970 return EFI_NOT_FOUND
;
2974 This function gets the protocol interface from the given handle, and
2975 obtains its address space descriptors.
2977 @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle.
2978 @param[out] IoDev Handle used to access configuration space of PCI device.
2979 @param[out] Descriptors Points to the address space descriptors.
2981 @retval EFI_SUCCESS The command completed successfully
2984 PciGetProtocolAndResource (
2985 IN EFI_HANDLE Handle
,
2986 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
**IoDev
,
2987 OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
2993 // Get inferface from protocol
2995 Status
= gBS
->HandleProtocol (
2997 &gEfiPciRootBridgeIoProtocolGuid
,
3001 if (EFI_ERROR (Status
)) {
3005 // Call Configuration() to get address space descriptors
3007 Status
= (*IoDev
)->Configuration (*IoDev
, (VOID
**)Descriptors
);
3008 if (Status
== EFI_UNSUPPORTED
) {
3009 *Descriptors
= NULL
;
3018 This function get the next bus range of given address space descriptors.
3019 It also moves the pointer backward a node, to get prepared to be called
3022 @param[in, out] Descriptors Points to current position of a serial of address space
3024 @param[out] MinBus The lower range of bus number.
3025 @param[out] MaxBus The upper range of bus number.
3026 @param[out] IsEnd Meet end of the serial of descriptors.
3028 @retval EFI_SUCCESS The command completed successfully.
3031 PciGetNextBusRange (
3032 IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
3041 // When *Descriptors is NULL, Configuration() is not implemented, so assume
3042 // range is 0~PCI_MAX_BUS
3044 if ((*Descriptors
) == NULL
) {
3046 *MaxBus
= PCI_MAX_BUS
;
3050 // *Descriptors points to one or more address space descriptors, which
3051 // ends with a end tagged descriptor. Examine each of the descriptors,
3052 // if a bus typed one is found and its bus range covers bus, this handle
3053 // is the handle we are looking for.
3056 while ((*Descriptors
)->Desc
!= ACPI_END_TAG_DESCRIPTOR
) {
3057 if ((*Descriptors
)->ResType
== ACPI_ADDRESS_SPACE_TYPE_BUS
) {
3058 *MinBus
= (UINT16
) (*Descriptors
)->AddrRangeMin
;
3059 *MaxBus
= (UINT16
) (*Descriptors
)->AddrRangeMax
;
3061 return (EFI_SUCCESS
);
3067 if ((*Descriptors
)->Desc
== ACPI_END_TAG_DESCRIPTOR
) {
3075 Explain the data in PCI configuration space. The part which is common for
3076 PCI device and bridge is interpreted in this function. It calls other
3077 functions to interpret data unique for device or bridge.
3079 @param[in] ConfigSpace Data in PCI configuration space.
3080 @param[in] Address Address used to access configuration space of this PCI device.
3081 @param[in] IoDev Handle used to access configuration space of PCI device.
3082 @param[in] EnhancedDump The print format for the dump data.
3084 @retval EFI_SUCCESS The command completed successfully.
3088 IN PCI_CONFIG_SPACE
*ConfigSpace
,
3090 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
3091 IN CONST UINT16 EnhancedDump
3094 PCI_COMMON_HEADER
*Common
;
3095 PCI_HEADER_TYPE HeaderType
;
3099 Common
= &(ConfigSpace
->Common
);
3101 ShellPrintEx (-1, -1, L
"\r\n");
3104 // Print Vendor Id and Device Id
3106 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_LINE_VID_DID
), gShellDebug1HiiHandle
,
3107 INDEX_OF (&(Common
->VendorId
)),
3109 INDEX_OF (&(Common
->DeviceId
)),
3114 // Print register Command
3116 PciExplainCommand (&(Common
->Command
));
3119 // Print register Status
3121 PciExplainStatus (&(Common
->Status
), TRUE
, PciUndefined
);
3124 // Print register Revision ID
3126 ShellPrintEx(-1, -1, L
"\r\n");
3127 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_LINE_RID
), gShellDebug1HiiHandle
,
3128 INDEX_OF (&(Common
->RevisionId
)),
3133 // Print register BIST
3135 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_LINE_BIST
), gShellDebug1HiiHandle
, INDEX_OF (&(Common
->Bist
)));
3136 if ((Common
->Bist
& PCI_BIT_7
) != 0) {
3137 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_LINE_CAP
), gShellDebug1HiiHandle
, 0x0f & Common
->Bist
);
3139 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_PCI_LINE_CAP_NO
), gShellDebug1HiiHandle
);
3142 // Print register Cache Line Size
3144 ShellPrintHiiEx(-1, -1, NULL
,
3145 STRING_TOKEN (STR_PCI2_CACHE_LINE_SIZE
),
3146 gShellDebug1HiiHandle
,
3147 INDEX_OF (&(Common
->CacheLineSize
)),
3148 Common
->CacheLineSize
3152 // Print register Latency Timer
3154 ShellPrintHiiEx(-1, -1, NULL
,
3155 STRING_TOKEN (STR_PCI2_LATENCY_TIMER
),
3156 gShellDebug1HiiHandle
,
3157 INDEX_OF (&(Common
->PrimaryLatencyTimer
)),
3158 Common
->PrimaryLatencyTimer
3162 // Print register Header Type
3164 ShellPrintHiiEx(-1, -1, NULL
,
3165 STRING_TOKEN (STR_PCI2_HEADER_TYPE
),
3166 gShellDebug1HiiHandle
,
3167 INDEX_OF (&(Common
->HeaderType
)),
3171 if ((Common
->HeaderType
& PCI_BIT_7
) != 0) {
3172 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_MULTI_FUNCTION
), gShellDebug1HiiHandle
);
3175 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_SINGLE_FUNCTION
), gShellDebug1HiiHandle
);
3178 HeaderType
= (PCI_HEADER_TYPE
)(UINT8
) (Common
->HeaderType
& 0x7f);
3179 switch (HeaderType
) {
3181 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_PCI_DEVICE
), gShellDebug1HiiHandle
);
3185 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_P2P_BRIDGE
), gShellDebug1HiiHandle
);
3188 case PciCardBusBridge
:
3189 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_CARDBUS_BRIDGE
), gShellDebug1HiiHandle
);
3193 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_RESERVED
), gShellDebug1HiiHandle
);
3194 HeaderType
= PciUndefined
;
3198 // Print register Class Code
3200 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_CLASS
), gShellDebug1HiiHandle
);
3201 PciPrintClassCode ((UINT8
*) Common
->ClassCode
, TRUE
);
3202 ShellPrintEx (-1, -1, L
"\r\n");
3204 if (ShellGetExecutionBreakFlag()) {
3209 // Interpret remaining part of PCI configuration header depending on
3213 Status
= EFI_SUCCESS
;
3214 switch (HeaderType
) {
3216 Status
= PciExplainDeviceData (
3217 &(ConfigSpace
->NonCommon
.Device
),
3221 CapPtr
= ConfigSpace
->NonCommon
.Device
.CapabilitiesPtr
;
3225 Status
= PciExplainBridgeData (
3226 &(ConfigSpace
->NonCommon
.Bridge
),
3230 CapPtr
= ConfigSpace
->NonCommon
.Bridge
.CapabilitiesPtr
;
3233 case PciCardBusBridge
:
3234 Status
= PciExplainCardBusData (
3235 &(ConfigSpace
->NonCommon
.CardBus
),
3239 CapPtr
= ConfigSpace
->NonCommon
.CardBus
.CapabilitiesPtr
;
3246 // If Status bit4 is 1, dump or explain capability structure
3248 if ((Common
->Status
) & EFI_PCI_STATUS_CAPABILITY
) {
3249 PciExplainCapabilityStruct (IoDev
, Address
, CapPtr
, EnhancedDump
);
3256 Explain the device specific part of data in PCI configuration space.
3258 @param[in] Device Data in PCI configuration space.
3259 @param[in] Address Address used to access configuration space of this PCI device.
3260 @param[in] IoDev Handle used to access configuration space of PCI device.
3262 @retval EFI_SUCCESS The command completed successfully.
3265 PciExplainDeviceData (
3266 IN PCI_DEVICE_HEADER
*Device
,
3268 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
3277 // Print Base Address Registers(Bar). When Bar = 0, this Bar does not
3278 // exist. If these no Bar for this function, print "none", otherwise
3279 // list detail information about this Bar.
3281 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_BASE_ADDR
), gShellDebug1HiiHandle
, INDEX_OF (Device
->Bar
));
3284 BarCount
= sizeof (Device
->Bar
) / sizeof (Device
->Bar
[0]);
3285 for (Index
= 0; Index
< BarCount
; Index
++) {
3286 if (Device
->Bar
[Index
] == 0) {
3292 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_START_TYPE
), gShellDebug1HiiHandle
);
3293 ShellPrintEx (-1, -1, L
" --------------------------------------------------------------------------");
3296 Status
= PciExplainBar (
3297 &(Device
->Bar
[Index
]),
3298 &(mConfigSpace
->Common
.Command
),
3304 if (EFI_ERROR (Status
)) {
3310 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NONE
), gShellDebug1HiiHandle
);
3313 ShellPrintEx (-1, -1, L
"\r\n --------------------------------------------------------------------------");
3317 // Print register Expansion ROM Base Address
3319 if ((Device
->ROMBar
& PCI_BIT_0
) == 0) {
3320 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_EXPANSION_ROM_DISABLED
), gShellDebug1HiiHandle
, INDEX_OF (&(Device
->ROMBar
)));
3323 ShellPrintHiiEx(-1, -1, NULL
,
3324 STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE
),
3325 gShellDebug1HiiHandle
,
3326 INDEX_OF (&(Device
->ROMBar
)),
3331 // Print register Cardbus CIS ptr
3333 ShellPrintHiiEx(-1, -1, NULL
,
3334 STRING_TOKEN (STR_PCI2_CARDBUS_CIS
),
3335 gShellDebug1HiiHandle
,
3336 INDEX_OF (&(Device
->CardBusCISPtr
)),
3337 Device
->CardBusCISPtr
3341 // Print register Sub-vendor ID and subsystem ID
3343 ShellPrintHiiEx(-1, -1, NULL
,
3344 STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID
),
3345 gShellDebug1HiiHandle
,
3346 INDEX_OF (&(Device
->SubVendorId
)),
3350 ShellPrintHiiEx(-1, -1, NULL
,
3351 STRING_TOKEN (STR_PCI2_SUBSYSTEM_ID
),
3352 gShellDebug1HiiHandle
,
3353 INDEX_OF (&(Device
->SubSystemId
)),
3358 // Print register Capabilities Ptr
3360 ShellPrintHiiEx(-1, -1, NULL
,
3361 STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR
),
3362 gShellDebug1HiiHandle
,
3363 INDEX_OF (&(Device
->CapabilitiesPtr
)),
3364 Device
->CapabilitiesPtr
3368 // Print register Interrupt Line and interrupt pin
3370 ShellPrintHiiEx(-1, -1, NULL
,
3371 STRING_TOKEN (STR_PCI2_INTERRUPT_LINE
),
3372 gShellDebug1HiiHandle
,
3373 INDEX_OF (&(Device
->InterruptLine
)),
3374 Device
->InterruptLine
3377 ShellPrintHiiEx(-1, -1, NULL
,
3378 STRING_TOKEN (STR_PCI2_INTERRUPT_PIN
),
3379 gShellDebug1HiiHandle
,
3380 INDEX_OF (&(Device
->InterruptPin
)),
3381 Device
->InterruptPin
3385 // Print register Min_Gnt and Max_Lat
3387 ShellPrintHiiEx(-1, -1, NULL
,
3388 STRING_TOKEN (STR_PCI2_MIN_GNT
),
3389 gShellDebug1HiiHandle
,
3390 INDEX_OF (&(Device
->MinGnt
)),
3394 ShellPrintHiiEx(-1, -1, NULL
,
3395 STRING_TOKEN (STR_PCI2_MAX_LAT
),
3396 gShellDebug1HiiHandle
,
3397 INDEX_OF (&(Device
->MaxLat
)),
3405 Explain the bridge specific part of data in PCI configuration space.
3407 @param[in] Bridge Bridge specific data region in PCI configuration space.
3408 @param[in] Address Address used to access configuration space of this PCI device.
3409 @param[in] IoDev Handle used to access configuration space of PCI device.
3411 @retval EFI_SUCCESS The command completed successfully.
3414 PciExplainBridgeData (
3415 IN PCI_BRIDGE_HEADER
*Bridge
,
3417 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
3427 // Print Base Address Registers. When Bar = 0, this Bar does not
3428 // exist. If these no Bar for this function, print "none", otherwise
3429 // list detail information about this Bar.
3431 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_BASE_ADDRESS
), gShellDebug1HiiHandle
, INDEX_OF (&(Bridge
->Bar
)));
3434 BarCount
= sizeof (Bridge
->Bar
) / sizeof (Bridge
->Bar
[0]);
3436 for (Index
= 0; Index
< BarCount
; Index
++) {
3437 if (Bridge
->Bar
[Index
] == 0) {
3443 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_START_TYPE_2
), gShellDebug1HiiHandle
);
3444 ShellPrintEx (-1, -1, L
" --------------------------------------------------------------------------");
3447 Status
= PciExplainBar (
3448 &(Bridge
->Bar
[Index
]),
3449 &(mConfigSpace
->Common
.Command
),
3455 if (EFI_ERROR (Status
)) {
3461 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NONE
), gShellDebug1HiiHandle
);
3463 ShellPrintEx (-1, -1, L
"\r\n --------------------------------------------------------------------------");
3467 // Expansion register ROM Base Address
3469 if ((Bridge
->ROMBar
& PCI_BIT_0
) == 0) {
3470 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NO_EXPANSION_ROM
), gShellDebug1HiiHandle
, INDEX_OF (&(Bridge
->ROMBar
)));
3473 ShellPrintHiiEx(-1, -1, NULL
,
3474 STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE_2
),
3475 gShellDebug1HiiHandle
,
3476 INDEX_OF (&(Bridge
->ROMBar
)),
3481 // Print Bus Numbers(Primary, Secondary, and Subordinate
3483 ShellPrintHiiEx(-1, -1, NULL
,
3484 STRING_TOKEN (STR_PCI2_BUS_NUMBERS
),
3485 gShellDebug1HiiHandle
,
3486 INDEX_OF (&(Bridge
->PrimaryBus
)),
3487 INDEX_OF (&(Bridge
->SecondaryBus
)),
3488 INDEX_OF (&(Bridge
->SubordinateBus
))
3491 ShellPrintEx (-1, -1, L
" ------------------------------------------------------\r\n");
3493 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_BRIDGE
), gShellDebug1HiiHandle
, Bridge
->PrimaryBus
);
3494 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_BRIDGE
), gShellDebug1HiiHandle
, Bridge
->SecondaryBus
);
3495 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_BRIDGE
), gShellDebug1HiiHandle
, Bridge
->SubordinateBus
);
3498 // Print register Secondary Latency Timer
3500 ShellPrintHiiEx(-1, -1, NULL
,
3501 STRING_TOKEN (STR_PCI2_SECONDARY_TIMER
),
3502 gShellDebug1HiiHandle
,
3503 INDEX_OF (&(Bridge
->SecondaryLatencyTimer
)),
3504 Bridge
->SecondaryLatencyTimer
3508 // Print register Secondary Status
3510 PciExplainStatus (&(Bridge
->SecondaryStatus
), FALSE
, PciP2pBridge
);
3513 // Print I/O and memory ranges this bridge forwards. There are 3 resource
3514 // types: I/O, memory, and pre-fetchable memory. For each resource type,
3515 // base and limit address are listed.
3517 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE
), gShellDebug1HiiHandle
);
3518 ShellPrintEx (-1, -1, L
"----------------------------------------------------------------------\r\n");
3523 IoAddress32
= (Bridge
->IoBaseUpper
<< 16 | Bridge
->IoBase
<< 8);
3524 IoAddress32
&= 0xfffff000;
3525 ShellPrintHiiEx(-1, -1, NULL
,
3526 STRING_TOKEN (STR_PCI2_TWO_VARS
),
3527 gShellDebug1HiiHandle
,
3528 INDEX_OF (&(Bridge
->IoBase
)),
3532 IoAddress32
= (Bridge
->IoLimitUpper
<< 16 | Bridge
->IoLimit
<< 8);
3533 IoAddress32
|= 0x00000fff;
3534 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_ONE_VAR
), gShellDebug1HiiHandle
, IoAddress32
);
3537 // Memory Base & Limit
3539 ShellPrintHiiEx(-1, -1, NULL
,
3540 STRING_TOKEN (STR_PCI2_MEMORY
),
3541 gShellDebug1HiiHandle
,
3542 INDEX_OF (&(Bridge
->MemoryBase
)),
3543 (Bridge
->MemoryBase
<< 16) & 0xfff00000
3546 ShellPrintHiiEx(-1, -1, NULL
,
3547 STRING_TOKEN (STR_PCI2_ONE_VAR
),
3548 gShellDebug1HiiHandle
,
3549 (Bridge
->MemoryLimit
<< 16) | 0x000fffff
3553 // Pre-fetch-able Memory Base & Limit
3555 ShellPrintHiiEx(-1, -1, NULL
,
3556 STRING_TOKEN (STR_PCI2_PREFETCHABLE
),
3557 gShellDebug1HiiHandle
,
3558 INDEX_OF (&(Bridge
->PrefetchableMemBase
)),
3559 Bridge
->PrefetchableBaseUpper
,
3560 (Bridge
->PrefetchableMemBase
<< 16) & 0xfff00000
3563 ShellPrintHiiEx(-1, -1, NULL
,
3564 STRING_TOKEN (STR_PCI2_TWO_VARS_2
),
3565 gShellDebug1HiiHandle
,
3566 Bridge
->PrefetchableLimitUpper
,
3567 (Bridge
->PrefetchableMemLimit
<< 16) | 0x000fffff
3571 // Print register Capabilities Pointer
3573 ShellPrintHiiEx(-1, -1, NULL
,
3574 STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR_2
),
3575 gShellDebug1HiiHandle
,
3576 INDEX_OF (&(Bridge
->CapabilitiesPtr
)),
3577 Bridge
->CapabilitiesPtr
3581 // Print register Bridge Control
3583 PciExplainBridgeControl (&(Bridge
->BridgeControl
), PciP2pBridge
);
3586 // Print register Interrupt Line & PIN
3588 ShellPrintHiiEx(-1, -1, NULL
,
3589 STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_2
),
3590 gShellDebug1HiiHandle
,
3591 INDEX_OF (&(Bridge
->InterruptLine
)),
3592 Bridge
->InterruptLine
3595 ShellPrintHiiEx(-1, -1, NULL
,
3596 STRING_TOKEN (STR_PCI2_INTERRUPT_PIN
),
3597 gShellDebug1HiiHandle
,
3598 INDEX_OF (&(Bridge
->InterruptPin
)),
3599 Bridge
->InterruptPin
3606 Explain the Base Address Register(Bar) in PCI configuration space.
3608 @param[in] Bar Points to the Base Address Register intended to interpret.
3609 @param[in] Command Points to the register Command.
3610 @param[in] Address Address used to access configuration space of this PCI device.
3611 @param[in] IoDev Handle used to access configuration space of PCI device.
3612 @param[in, out] Index The Index.
3614 @retval EFI_SUCCESS The command completed successfully.
3621 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
3642 // According the bar type, list detail about this bar, for example: 32 or
3643 // 64 bits; pre-fetchable or not.
3645 if ((*Bar
& PCI_BIT_0
) == 0) {
3647 // This bar is of memory type
3651 if ((*Bar
& PCI_BIT_1
) == 0 && (*Bar
& PCI_BIT_2
) == 0) {
3652 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_BAR
), gShellDebug1HiiHandle
, *Bar
& 0xfffffff0);
3653 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_MEM
), gShellDebug1HiiHandle
);
3654 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_32_BITS
), gShellDebug1HiiHandle
);
3656 } else if ((*Bar
& PCI_BIT_1
) == 0 && (*Bar
& PCI_BIT_2
) != 0) {
3658 CopyMem (&Bar64
, Bar
, sizeof (UINT64
));
3659 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_ONE_VAR_2
), gShellDebug1HiiHandle
, (UINT32
) RShiftU64 ((Bar64
& 0xfffffffffffffff0ULL
), 32));
3660 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_ONE_VAR_3
), gShellDebug1HiiHandle
, (UINT32
) (Bar64
& 0xfffffffffffffff0ULL
));
3661 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_MEM
), gShellDebug1HiiHandle
);
3662 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_64_BITS
), gShellDebug1HiiHandle
);
3670 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_BAR
), gShellDebug1HiiHandle
, *Bar
& 0xfffffff0);
3671 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_MEM_2
), gShellDebug1HiiHandle
);
3674 if ((*Bar
& PCI_BIT_3
) == 0) {
3675 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NO
), gShellDebug1HiiHandle
);
3678 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_YES
), gShellDebug1HiiHandle
);
3683 // This bar is of io type
3686 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_ONE_VAR_4
), gShellDebug1HiiHandle
, *Bar
& 0xfffffffc);
3687 ShellPrintEx (-1, -1, L
"I/O ");
3691 // Get BAR length(or the amount of resource this bar demands for). To get
3692 // Bar length, first we should temporarily disable I/O and memory access
3693 // of this function(by set bits in the register Command), then write all
3694 // "1"s to this bar. The bar value read back is the amount of resource
3695 // this bar demands for.
3698 // Disable io & mem access
3700 OldCommand
= *Command
;
3701 NewCommand
= (UINT16
) (OldCommand
& 0xfffc);
3702 RegAddress
= Address
| INDEX_OF (Command
);
3703 IoDev
->Pci
.Write (IoDev
, EfiPciWidthUint16
, RegAddress
, 1, &NewCommand
);
3705 RegAddress
= Address
| INDEX_OF (Bar
);
3708 // Read after write the BAR to get the size
3712 NewBar32
= 0xffffffff;
3714 IoDev
->Pci
.Write (IoDev
, EfiPciWidthUint32
, RegAddress
, 1, &NewBar32
);
3715 IoDev
->Pci
.Read (IoDev
, EfiPciWidthUint32
, RegAddress
, 1, &NewBar32
);
3716 IoDev
->Pci
.Write (IoDev
, EfiPciWidthUint32
, RegAddress
, 1, &OldBar32
);
3719 NewBar32
= NewBar32
& 0xfffffff0;
3720 NewBar32
= (~NewBar32
) + 1;
3723 NewBar32
= NewBar32
& 0xfffffffc;
3724 NewBar32
= (~NewBar32
) + 1;
3725 NewBar32
= NewBar32
& 0x0000ffff;
3730 CopyMem (&OldBar64
, Bar
, sizeof (UINT64
));
3731 NewBar64
= 0xffffffffffffffffULL
;
3733 IoDev
->Pci
.Write (IoDev
, EfiPciWidthUint32
, RegAddress
, 2, &NewBar64
);
3734 IoDev
->Pci
.Read (IoDev
, EfiPciWidthUint32
, RegAddress
, 2, &NewBar64
);
3735 IoDev
->Pci
.Write (IoDev
, EfiPciWidthUint32
, RegAddress
, 2, &OldBar64
);
3738 NewBar64
= NewBar64
& 0xfffffffffffffff0ULL
;
3739 NewBar64
= (~NewBar64
) + 1;
3742 NewBar64
= NewBar64
& 0xfffffffffffffffcULL
;
3743 NewBar64
= (~NewBar64
) + 1;
3744 NewBar64
= NewBar64
& 0x000000000000ffff;
3748 // Enable io & mem access
3750 RegAddress
= Address
| INDEX_OF (Command
);
3751 IoDev
->Pci
.Write (IoDev
, EfiPciWidthUint16
, RegAddress
, 1, &OldCommand
);
3755 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NEWBAR_32
), gShellDebug1HiiHandle
, NewBar32
);
3756 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NEWBAR_32_2
), gShellDebug1HiiHandle
, NewBar32
+ (*Bar
& 0xfffffff0) - 1);
3759 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_RSHIFT
), gShellDebug1HiiHandle
, (UINT32
) RShiftU64 (NewBar64
, 32));
3760 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_RSHIFT
), gShellDebug1HiiHandle
, (UINT32
) NewBar64
);
3761 ShellPrintEx (-1, -1, L
" ");
3762 ShellPrintHiiEx(-1, -1, NULL
,
3763 STRING_TOKEN (STR_PCI2_RSHIFT
),
3764 gShellDebug1HiiHandle
,
3765 (UINT32
) RShiftU64 ((NewBar64
+ (Bar64
& 0xfffffffffffffff0ULL
) - 1), 32)
3767 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_RSHIFT
), gShellDebug1HiiHandle
, (UINT32
) (NewBar64
+ (Bar64
& 0xfffffffffffffff0ULL
) - 1));
3771 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NEWBAR_32_3
), gShellDebug1HiiHandle
, NewBar32
);
3772 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NEWBAR_32_4
), gShellDebug1HiiHandle
, NewBar32
+ (*Bar
& 0xfffffffc) - 1);
3779 Explain the cardbus specific part of data in PCI configuration space.
3781 @param[in] CardBus CardBus specific region of PCI configuration space.
3782 @param[in] Address Address used to access configuration space of this PCI device.
3783 @param[in] IoDev Handle used to access configuration space of PCI device.
3785 @retval EFI_SUCCESS The command completed successfully.
3788 PciExplainCardBusData (
3789 IN PCI_CARDBUS_HEADER
*CardBus
,
3791 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
3795 PCI_CARDBUS_DATA
*CardBusData
;
3797 ShellPrintHiiEx(-1, -1, NULL
,
3798 STRING_TOKEN (STR_PCI2_CARDBUS_SOCKET
),
3799 gShellDebug1HiiHandle
,
3800 INDEX_OF (&(CardBus
->CardBusSocketReg
)),
3801 CardBus
->CardBusSocketReg
3805 // Print Secondary Status
3807 PciExplainStatus (&(CardBus
->SecondaryStatus
), FALSE
, PciCardBusBridge
);
3810 // Print Bus Numbers(Primary bus number, CardBus bus number, and
3811 // Subordinate bus number
3813 ShellPrintHiiEx(-1, -1, NULL
,
3814 STRING_TOKEN (STR_PCI2_BUS_NUMBERS_2
),
3815 gShellDebug1HiiHandle
,
3816 INDEX_OF (&(CardBus
->PciBusNumber
)),
3817 INDEX_OF (&(CardBus
->CardBusBusNumber
)),
3818 INDEX_OF (&(CardBus
->SubordinateBusNumber
))
3821 ShellPrintEx (-1, -1, L
" ------------------------------------------------------\r\n");
3823 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_CARDBUS
), gShellDebug1HiiHandle
, CardBus
->PciBusNumber
);
3824 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_CARDBUS_2
), gShellDebug1HiiHandle
, CardBus
->CardBusBusNumber
);
3825 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_CARDBUS_3
), gShellDebug1HiiHandle
, CardBus
->SubordinateBusNumber
);
3828 // Print CardBus Latency Timer
3830 ShellPrintHiiEx(-1, -1, NULL
,
3831 STRING_TOKEN (STR_PCI2_CARDBUS_LATENCY
),
3832 gShellDebug1HiiHandle
,
3833 INDEX_OF (&(CardBus
->CardBusLatencyTimer
)),
3834 CardBus
->CardBusLatencyTimer
3838 // Print Memory/Io ranges this cardbus bridge forwards
3840 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE_2
), gShellDebug1HiiHandle
);
3841 ShellPrintEx (-1, -1, L
"----------------------------------------------------------------------\r\n");
3843 ShellPrintHiiEx(-1, -1, NULL
,
3844 STRING_TOKEN (STR_PCI2_MEM_3
),
3845 gShellDebug1HiiHandle
,
3846 INDEX_OF (&(CardBus
->MemoryBase0
)),
3847 CardBus
->BridgeControl
& PCI_BIT_8
? L
" Prefetchable" : L
"Non-Prefetchable",
3848 CardBus
->MemoryBase0
& 0xfffff000,
3849 CardBus
->MemoryLimit0
| 0x00000fff
3852 ShellPrintHiiEx(-1, -1, NULL
,
3853 STRING_TOKEN (STR_PCI2_MEM_3
),
3854 gShellDebug1HiiHandle
,
3855 INDEX_OF (&(CardBus
->MemoryBase1
)),
3856 CardBus
->BridgeControl
& PCI_BIT_9
? L
" Prefetchable" : L
"Non-Prefetchable",
3857 CardBus
->MemoryBase1
& 0xfffff000,
3858 CardBus
->MemoryLimit1
| 0x00000fff
3861 Io32Bit
= (BOOLEAN
) (CardBus
->IoBase0
& PCI_BIT_0
);
3862 ShellPrintHiiEx(-1, -1, NULL
,
3863 STRING_TOKEN (STR_PCI2_IO_2
),
3864 gShellDebug1HiiHandle
,
3865 INDEX_OF (&(CardBus
->IoBase0
)),
3866 Io32Bit
? L
" 32 bit" : L
" 16 bit",
3867 CardBus
->IoBase0
& (Io32Bit
? 0xfffffffc : 0x0000fffc),
3868 (CardBus
->IoLimit0
& (Io32Bit
? 0xffffffff : 0x0000ffff)) | 0x00000003
3871 Io32Bit
= (BOOLEAN
) (CardBus
->IoBase1
& PCI_BIT_0
);
3872 ShellPrintHiiEx(-1, -1, NULL
,
3873 STRING_TOKEN (STR_PCI2_IO_2
),
3874 gShellDebug1HiiHandle
,
3875 INDEX_OF (&(CardBus
->IoBase1
)),
3876 Io32Bit
? L
" 32 bit" : L
" 16 bit",
3877 CardBus
->IoBase1
& (Io32Bit
? 0xfffffffc : 0x0000fffc),
3878 (CardBus
->IoLimit1
& (Io32Bit
? 0xffffffff : 0x0000ffff)) | 0x00000003
3882 // Print register Interrupt Line & PIN
3884 ShellPrintHiiEx(-1, -1, NULL
,
3885 STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_3
),
3886 gShellDebug1HiiHandle
,
3887 INDEX_OF (&(CardBus
->InterruptLine
)),
3888 CardBus
->InterruptLine
,
3889 INDEX_OF (&(CardBus
->InterruptPin
)),
3890 CardBus
->InterruptPin
3894 // Print register Bridge Control
3896 PciExplainBridgeControl (&(CardBus
->BridgeControl
), PciCardBusBridge
);
3899 // Print some registers in data region of PCI configuration space for cardbus
3900 // bridge. Fields include: Sub VendorId, Subsystem ID, and Legacy Mode Base
3903 CardBusData
= (PCI_CARDBUS_DATA
*) ((UINT8
*) CardBus
+ sizeof (PCI_CARDBUS_HEADER
));
3905 ShellPrintHiiEx(-1, -1, NULL
,
3906 STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID_2
),
3907 gShellDebug1HiiHandle
,
3908 INDEX_OF (&(CardBusData
->SubVendorId
)),
3909 CardBusData
->SubVendorId
,
3910 INDEX_OF (&(CardBusData
->SubSystemId
)),
3911 CardBusData
->SubSystemId
3914 ShellPrintHiiEx(-1, -1, NULL
,
3915 STRING_TOKEN (STR_PCI2_OPTIONAL
),
3916 gShellDebug1HiiHandle
,
3917 INDEX_OF (&(CardBusData
->LegacyBase
)),
3918 CardBusData
->LegacyBase
3925 Explain each meaningful bit of register Status. The definition of Status is
3926 slightly different depending on the PCI header type.
3928 @param[in] Status Points to the content of register Status.
3929 @param[in] MainStatus Indicates if this register is main status(not secondary
3931 @param[in] HeaderType Header type of this PCI device.
3933 @retval EFI_SUCCESS The command completed successfully.
3938 IN BOOLEAN MainStatus
,
3939 IN PCI_HEADER_TYPE HeaderType
3943 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_STATUS
), gShellDebug1HiiHandle
, INDEX_OF (Status
), *Status
);
3946 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_SECONDARY_STATUS
), gShellDebug1HiiHandle
, INDEX_OF (Status
), *Status
);
3949 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_NEW_CAPABILITIES
), gShellDebug1HiiHandle
, (*Status
& PCI_BIT_4
) != 0);
3952 // Bit 5 is meaningless for CardBus Bridge
3954 if (HeaderType
== PciCardBusBridge
) {
3955 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_66_CAPABLE
), gShellDebug1HiiHandle
, (*Status
& PCI_BIT_5
) != 0);
3958 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_66_CAPABLE_2
), gShellDebug1HiiHandle
, (*Status
& PCI_BIT_5
) != 0);
3961 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_FAST_BACK
), gShellDebug1HiiHandle
, (*Status
& PCI_BIT_7
) != 0);
3963 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_MASTER_DATA
), gShellDebug1HiiHandle
, (*Status
& PCI_BIT_8
) != 0);
3965 // Bit 9 and bit 10 together decides the DEVSEL timing
3967 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_DEVSEL_TIMING
), gShellDebug1HiiHandle
);
3968 if ((*Status
& PCI_BIT_9
) == 0 && (*Status
& PCI_BIT_10
) == 0) {
3969 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_FAST
), gShellDebug1HiiHandle
);
3971 } else if ((*Status
& PCI_BIT_9
) != 0 && (*Status
& PCI_BIT_10
) == 0) {
3972 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_MEDIUM
), gShellDebug1HiiHandle
);
3974 } else if ((*Status
& PCI_BIT_9
) == 0 && (*Status
& PCI_BIT_10
) != 0) {
3975 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_SLOW
), gShellDebug1HiiHandle
);
3978 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_RESERVED_2
), gShellDebug1HiiHandle
);
3981 ShellPrintHiiEx(-1, -1, NULL
,
3982 STRING_TOKEN (STR_PCI2_SIGNALED_TARGET
),
3983 gShellDebug1HiiHandle
,
3984 (*Status
& PCI_BIT_11
) != 0
3987 ShellPrintHiiEx(-1, -1, NULL
,
3988 STRING_TOKEN (STR_PCI2_RECEIVED_TARGET
),
3989 gShellDebug1HiiHandle
,
3990 (*Status
& PCI_BIT_12
) != 0
3993 ShellPrintHiiEx(-1, -1, NULL
,
3994 STRING_TOKEN (STR_PCI2_RECEIVED_MASTER
),
3995 gShellDebug1HiiHandle
,
3996 (*Status
& PCI_BIT_13
) != 0
4000 ShellPrintHiiEx(-1, -1, NULL
,
4001 STRING_TOKEN (STR_PCI2_SIGNALED_ERROR
),
4002 gShellDebug1HiiHandle
,
4003 (*Status
& PCI_BIT_14
) != 0
4007 ShellPrintHiiEx(-1, -1, NULL
,
4008 STRING_TOKEN (STR_PCI2_RECEIVED_ERROR
),
4009 gShellDebug1HiiHandle
,
4010 (*Status
& PCI_BIT_14
) != 0
4014 ShellPrintHiiEx(-1, -1, NULL
,
4015 STRING_TOKEN (STR_PCI2_DETECTED_ERROR
),
4016 gShellDebug1HiiHandle
,
4017 (*Status
& PCI_BIT_15
) != 0
4024 Explain each meaningful bit of register Command.
4026 @param[in] Command Points to the content of register Command.
4028 @retval EFI_SUCCESS The command completed successfully.
4036 // Print the binary value of register Command
4038 ShellPrintHiiEx(-1, -1, NULL
,STRING_TOKEN (STR_PCI2_COMMAND
), gShellDebug1HiiHandle
, INDEX_OF (Command
), *Command
);
4041 // Explain register Command bit by bit
4043 ShellPrintHiiEx(-1, -1, NULL
,
4044 STRING_TOKEN (STR_PCI2_SPACE_ACCESS_DENIED
),
4045 gShellDebug1HiiHandle
,
4046 (*Command
& PCI_BIT_0
) != 0
4049 ShellPrintHiiEx(-1, -1, NULL
,
4050 STRING_TOKEN (STR_PCI2_MEMORY_SPACE
),
4051 gShellDebug1HiiHandle
,
4052 (*Command
& PCI_BIT_1
) != 0
4055 ShellPrintHiiEx(-1, -1, NULL
,
4056 STRING_TOKEN (STR_PCI2_BEHAVE_BUS_MASTER
),
4057 gShellDebug1HiiHandle
,
4058 (*Command
& PCI_BIT_2
) != 0
4061 ShellPrintHiiEx(-1, -1, NULL
,
4062 STRING_TOKEN (STR_PCI2_MONITOR_SPECIAL_CYCLE
),
4063 gShellDebug1HiiHandle
,
4064 (*Command
& PCI_BIT_3
) != 0
4067 ShellPrintHiiEx(-1, -1, NULL
,
4068 STRING_TOKEN (STR_PCI2_MEM_WRITE_INVALIDATE
),
4069 gShellDebug1HiiHandle
,
4070 (*Command
& PCI_BIT_4
) != 0
4073 ShellPrintHiiEx(-1, -1, NULL
,
4074 STRING_TOKEN (STR_PCI2_PALETTE_SNOOPING
),
4075 gShellDebug1HiiHandle
,
4076 (*Command
& PCI_BIT_5
) != 0
4079 ShellPrintHiiEx(-1, -1, NULL
,
4080 STRING_TOKEN (STR_PCI2_ASSERT_PERR
),
4081 gShellDebug1HiiHandle
,
4082 (*Command
& PCI_BIT_6
) != 0
4085 ShellPrintHiiEx(-1, -1, NULL
,
4086 STRING_TOKEN (STR_PCI2_DO_ADDR_STEPPING
),
4087 gShellDebug1HiiHandle
,
4088 (*Command
& PCI_BIT_7
) != 0
4091 ShellPrintHiiEx(-1, -1, NULL
,
4092 STRING_TOKEN (STR_PCI2_SERR_DRIVER
),
4093 gShellDebug1HiiHandle
,
4094 (*Command
& PCI_BIT_8
) != 0
4097 ShellPrintHiiEx(-1, -1, NULL
,
4098 STRING_TOKEN (STR_PCI2_FAST_BACK_2
),
4099 gShellDebug1HiiHandle
,
4100 (*Command
& PCI_BIT_9
) != 0
4107 Explain each meaningful bit of register Bridge Control.
4109 @param[in] BridgeControl Points to the content of register Bridge Control.
4110 @param[in] HeaderType The headertype.
4112 @retval EFI_SUCCESS The command completed successfully.
4115 PciExplainBridgeControl (
4116 IN UINT16
*BridgeControl
,
4117 IN PCI_HEADER_TYPE HeaderType
4120 ShellPrintHiiEx(-1, -1, NULL
,
4121 STRING_TOKEN (STR_PCI2_BRIDGE_CONTROL
),
4122 gShellDebug1HiiHandle
,
4123 INDEX_OF (BridgeControl
),
4127 ShellPrintHiiEx(-1, -1, NULL
,
4128 STRING_TOKEN (STR_PCI2_PARITY_ERROR
),
4129 gShellDebug1HiiHandle
,
4130 (*BridgeControl
& PCI_BIT_0
) != 0
4132 ShellPrintHiiEx(-1, -1, NULL
,
4133 STRING_TOKEN (STR_PCI2_SERR_ENABLE
),
4134 gShellDebug1HiiHandle
,
4135 (*BridgeControl
& PCI_BIT_1
) != 0
4137 ShellPrintHiiEx(-1, -1, NULL
,
4138 STRING_TOKEN (STR_PCI2_ISA_ENABLE
),
4139 gShellDebug1HiiHandle
,
4140 (*BridgeControl
& PCI_BIT_2
) != 0
4142 ShellPrintHiiEx(-1, -1, NULL
,
4143 STRING_TOKEN (STR_PCI2_VGA_ENABLE
),
4144 gShellDebug1HiiHandle
,
4145 (*BridgeControl
& PCI_BIT_3
) != 0
4147 ShellPrintHiiEx(-1, -1, NULL
,
4148 STRING_TOKEN (STR_PCI2_MASTER_ABORT
),
4149 gShellDebug1HiiHandle
,
4150 (*BridgeControl
& PCI_BIT_5
) != 0
4154 // Register Bridge Control has some slight differences between P2P bridge
4155 // and Cardbus bridge from bit 6 to bit 11.
4157 if (HeaderType
== PciP2pBridge
) {
4158 ShellPrintHiiEx(-1, -1, NULL
,
4159 STRING_TOKEN (STR_PCI2_SECONDARY_BUS_RESET
),
4160 gShellDebug1HiiHandle
,
4161 (*BridgeControl
& PCI_BIT_6
) != 0
4163 ShellPrintHiiEx(-1, -1, NULL
,
4164 STRING_TOKEN (STR_PCI2_FAST_ENABLE
),
4165 gShellDebug1HiiHandle
,
4166 (*BridgeControl
& PCI_BIT_7
) != 0
4168 ShellPrintHiiEx(-1, -1, NULL
,
4169 STRING_TOKEN (STR_PCI2_PRIMARY_DISCARD_TIMER
),
4170 gShellDebug1HiiHandle
,
4171 (*BridgeControl
& PCI_BIT_8
)!=0 ? L
"2^10" : L
"2^15"
4173 ShellPrintHiiEx(-1, -1, NULL
,
4174 STRING_TOKEN (STR_PCI2_SECONDARY_DISCARD_TIMER
),
4175 gShellDebug1HiiHandle
,
4176 (*BridgeControl
& PCI_BIT_9
)!=0 ? L
"2^10" : L
"2^15"
4178 ShellPrintHiiEx(-1, -1, NULL
,
4179 STRING_TOKEN (STR_PCI2_DISCARD_TIMER_STATUS
),
4180 gShellDebug1HiiHandle
,
4181 (*BridgeControl
& PCI_BIT_10
) != 0
4183 ShellPrintHiiEx(-1, -1, NULL
,
4184 STRING_TOKEN (STR_PCI2_DISCARD_TIMER_SERR
),
4185 gShellDebug1HiiHandle
,
4186 (*BridgeControl
& PCI_BIT_11
) != 0
4190 ShellPrintHiiEx(-1, -1, NULL
,
4191 STRING_TOKEN (STR_PCI2_CARDBUS_RESET
),
4192 gShellDebug1HiiHandle
,
4193 (*BridgeControl
& PCI_BIT_6
) != 0
4195 ShellPrintHiiEx(-1, -1, NULL
,
4196 STRING_TOKEN (STR_PCI2_IREQ_ENABLE
),
4197 gShellDebug1HiiHandle
,
4198 (*BridgeControl
& PCI_BIT_7
) != 0
4200 ShellPrintHiiEx(-1, -1, NULL
,
4201 STRING_TOKEN (STR_PCI2_WRITE_POSTING_ENABLE
),
4202 gShellDebug1HiiHandle
,
4203 (*BridgeControl
& PCI_BIT_10
) != 0
4211 Print each capability structure.
4213 @param[in] IoDev The pointer to the deivce.
4214 @param[in] Address The address to start at.
4215 @param[in] CapPtr The offset from the address.
4216 @param[in] EnhancedDump The print format for the dump data.
4218 @retval EFI_SUCCESS The operation was successful.
4221 PciExplainCapabilityStruct (
4222 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
4225 IN CONST UINT16 EnhancedDump
4228 UINT8 CapabilityPtr
;
4229 UINT16 CapabilityEntry
;
4233 CapabilityPtr
= CapPtr
;
4236 // Go through the Capability list
4238 while ((CapabilityPtr
>= 0x40) && ((CapabilityPtr
& 0x03) == 0x00)) {
4239 RegAddress
= Address
+ CapabilityPtr
;
4240 IoDev
->Pci
.Read (IoDev
, EfiPciWidthUint16
, RegAddress
, 1, &CapabilityEntry
);
4242 CapabilityID
= (UINT8
) CapabilityEntry
;
4245 // Explain PciExpress data
4247 if (EFI_PCI_CAPABILITY_ID_PCIEXP
== CapabilityID
) {
4248 PciExplainPciExpress (IoDev
, Address
, CapabilityPtr
, EnhancedDump
);
4252 // Explain other capabilities here
4254 CapabilityPtr
= (UINT8
) (CapabilityEntry
>> 8);
4261 Print out information of the capability information.
4263 @param[in] PciExpressCap The pointer to the structure about the device.
4265 @retval EFI_SUCCESS The operation was successful.
4269 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4273 CHAR16
*DevicePortType
;
4275 PcieCapReg
= PciExpressCap
->PcieCapReg
;
4276 ShellPrintEx (-1, -1,
4277 L
" Capability Version(3:0): %E0x%04x%N\r\n",
4278 PCIE_CAP_VERSION (PcieCapReg
)
4280 if ((UINT8
) PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg
) < PCIE_DEVICE_PORT_TYPE_MAX
) {
4281 DevicePortType
= DevicePortTypeTable
[PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg
)];
4283 DevicePortType
= L
"Unknown Type";
4285 ShellPrintEx (-1, -1,
4286 L
" Device/PortType(7:4): %E%s%N\r\n",
4290 // 'Slot Implemented' is only valid for:
4291 // a) Root Port of PCI Express Root Complex, or
4292 // b) Downstream Port of PCI Express Switch
4294 if (PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg
) == PCIE_ROOT_COMPLEX_ROOT_PORT
||
4295 PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg
) == PCIE_SWITCH_DOWNSTREAM_PORT
) {
4296 ShellPrintEx (-1, -1,
4297 L
" Slot Implemented(8): %E%d%N\r\n",
4298 PCIE_CAP_SLOT_IMPLEMENTED (PcieCapReg
)
4301 ShellPrintEx (-1, -1,
4302 L
" Interrupt Message Number(13:9): %E0x%05x%N\r\n",
4303 PCIE_CAP_INT_MSG_NUM (PcieCapReg
)
4309 Print out information of the device capability information.
4311 @param[in] PciExpressCap The pointer to the structure about the device.
4313 @retval EFI_SUCCESS The operation was successful.
4316 ExplainPcieDeviceCap (
4317 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4321 UINT32 PcieDeviceCap
;
4322 UINT8 DevicePortType
;
4326 PcieCapReg
= PciExpressCap
->PcieCapReg
;
4327 PcieDeviceCap
= PciExpressCap
->PcieDeviceCap
;
4328 DevicePortType
= (UINT8
) PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg
);
4329 ShellPrintEx (-1, -1, L
" Max_Payload_Size Supported(2:0): ");
4330 if (PCIE_CAP_MAX_PAYLOAD (PcieDeviceCap
) < 6) {
4331 ShellPrintEx (-1, -1, L
"%E%d bytes%N\r\n", 1 << (PCIE_CAP_MAX_PAYLOAD (PcieDeviceCap
) + 7));
4333 ShellPrintEx (-1, -1, L
"%EUnknown%N\r\n");
4335 ShellPrintEx (-1, -1,
4336 L
" Phantom Functions Supported(4:3): %E%d%N\r\n",
4337 PCIE_CAP_PHANTOM_FUNC (PcieDeviceCap
)
4339 ShellPrintEx (-1, -1,
4340 L
" Extended Tag Field Supported(5): %E%d-bit Tag field supported%N\r\n",
4341 PCIE_CAP_EXTENDED_TAG (PcieDeviceCap
) ? 8 : 5
4344 // Endpoint L0s and L1 Acceptable Latency is only valid for Endpoint
4346 if (IS_PCIE_ENDPOINT (DevicePortType
)) {
4347 L0sLatency
= (UINT8
) PCIE_CAP_L0SLATENCY (PcieDeviceCap
);
4348 L1Latency
= (UINT8
) PCIE_CAP_L1LATENCY (PcieDeviceCap
);
4349 ShellPrintEx (-1, -1, L
" Endpoint L0s Acceptable Latency(8:6): ");
4350 if (L0sLatency
< 4) {
4351 ShellPrintEx (-1, -1, L
"%EMaximum of %d ns%N\r\n", 1 << (L0sLatency
+ 6));
4353 if (L0sLatency
< 7) {
4354 ShellPrintEx (-1, -1, L
"%EMaximum of %d us%N\r\n", 1 << (L0sLatency
- 3));
4356 ShellPrintEx (-1, -1, L
"%ENo limit%N\r\n");
4359 ShellPrintEx (-1, -1, L
" Endpoint L1 Acceptable Latency(11:9): ");
4360 if (L1Latency
< 7) {
4361 ShellPrintEx (-1, -1, L
"%EMaximum of %d us%N\r\n", 1 << (L1Latency
+ 1));
4363 ShellPrintEx (-1, -1, L
"%ENo limit%N\r\n");
4366 ShellPrintEx (-1, -1,
4367 L
" Role-based Error Reporting(15): %E%d%N\r\n",
4368 PCIE_CAP_ERR_REPORTING (PcieDeviceCap
)
4371 // Only valid for Upstream Port:
4372 // a) Captured Slot Power Limit Value
4373 // b) Captured Slot Power Scale
4375 if (DevicePortType
== PCIE_SWITCH_UPSTREAM_PORT
) {
4376 ShellPrintEx (-1, -1,
4377 L
" Captured Slot Power Limit Value(25:18): %E0x%02x%N\r\n",
4378 PCIE_CAP_SLOT_POWER_VALUE (PcieDeviceCap
)
4380 ShellPrintEx (-1, -1,
4381 L
" Captured Slot Power Limit Scale(27:26): %E%s%N\r\n",
4382 SlotPwrLmtScaleTable
[PCIE_CAP_SLOT_POWER_SCALE (PcieDeviceCap
)]
4386 // Function Level Reset Capability is only valid for Endpoint
4388 if (IS_PCIE_ENDPOINT (DevicePortType
)) {
4389 ShellPrintEx (-1, -1,
4390 L
" Function Level Reset Capability(28): %E%d%N\r\n",
4391 PCIE_CAP_FUNC_LEVEL_RESET (PcieDeviceCap
)
4398 Print out information of the device control information.
4400 @param[in] PciExpressCap The pointer to the structure about the device.
4402 @retval EFI_SUCCESS The operation was successful.
4405 ExplainPcieDeviceControl (
4406 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4410 UINT16 PcieDeviceControl
;
4412 PcieCapReg
= PciExpressCap
->PcieCapReg
;
4413 PcieDeviceControl
= PciExpressCap
->DeviceControl
;
4414 ShellPrintEx (-1, -1,
4415 L
" Correctable Error Reporting Enable(0): %E%d%N\r\n",
4416 PCIE_CAP_COR_ERR_REPORTING_ENABLE (PcieDeviceControl
)
4418 ShellPrintEx (-1, -1,
4419 L
" Non-Fatal Error Reporting Enable(1): %E%d%N\r\n",
4420 PCIE_CAP_NONFAT_ERR_REPORTING_ENABLE (PcieDeviceControl
)
4422 ShellPrintEx (-1, -1,
4423 L
" Fatal Error Reporting Enable(2): %E%d%N\r\n",
4424 PCIE_CAP_FATAL_ERR_REPORTING_ENABLE (PcieDeviceControl
)
4426 ShellPrintEx (-1, -1,
4427 L
" Unsupported Request Reporting Enable(3): %E%d%N\r\n",
4428 PCIE_CAP_UNSUP_REQ_REPORTING_ENABLE (PcieDeviceControl
)
4430 ShellPrintEx (-1, -1,
4431 L
" Enable Relaxed Ordering(4): %E%d%N\r\n",
4432 PCIE_CAP_RELAXED_ORDERING_ENABLE (PcieDeviceControl
)
4434 ShellPrintEx (-1, -1, L
" Max_Payload_Size(7:5): ");
4435 if (PCIE_CAP_MAX_PAYLOAD_SIZE (PcieDeviceControl
) < 6) {
4436 ShellPrintEx (-1, -1, L
"%E%d bytes%N\r\n", 1 << (PCIE_CAP_MAX_PAYLOAD_SIZE (PcieDeviceControl
) + 7));
4438 ShellPrintEx (-1, -1, L
"%EUnknown%N\r\n");
4440 ShellPrintEx (-1, -1,
4441 L
" Extended Tag Field Enable(8): %E%d%N\r\n",
4442 PCIE_CAP_EXTENDED_TAG_ENABLE (PcieDeviceControl
)
4444 ShellPrintEx (-1, -1,
4445 L
" Phantom Functions Enable(9): %E%d%N\r\n",
4446 PCIE_CAP_PHANTOM_FUNC_ENABLE (PcieDeviceControl
)
4448 ShellPrintEx (-1, -1,
4449 L
" Auxiliary (AUX) Power PM Enable(10): %E%d%N\r\n",
4450 PCIE_CAP_AUX_PM_ENABLE (PcieDeviceControl
)
4452 ShellPrintEx (-1, -1,
4453 L
" Enable No Snoop(11): %E%d%N\r\n",
4454 PCIE_CAP_NO_SNOOP_ENABLE (PcieDeviceControl
)
4456 ShellPrintEx (-1, -1, L
" Max_Read_Request_Size(14:12): ");
4457 if (PCIE_CAP_MAX_READ_REQ_SIZE (PcieDeviceControl
) < 6) {
4458 ShellPrintEx (-1, -1, L
"%E%d bytes%N\r\n", 1 << (PCIE_CAP_MAX_READ_REQ_SIZE (PcieDeviceControl
) + 7));
4460 ShellPrintEx (-1, -1, L
"%EUnknown%N\r\n");
4463 // Read operation is only valid for PCI Express to PCI/PCI-X Bridges
4465 if (PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg
) == PCIE_PCIE_TO_PCIX_BRIDGE
) {
4466 ShellPrintEx (-1, -1,
4467 L
" Bridge Configuration Retry Enable(15): %E%d%N\r\n",
4468 PCIE_CAP_BRG_CONF_RETRY (PcieDeviceControl
)
4475 Print out information of the device status information.
4477 @param[in] PciExpressCap The pointer to the structure about the device.
4479 @retval EFI_SUCCESS The operation was successful.
4482 ExplainPcieDeviceStatus (
4483 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4486 UINT16 PcieDeviceStatus
;
4488 PcieDeviceStatus
= PciExpressCap
->DeviceStatus
;
4489 ShellPrintEx (-1, -1,
4490 L
" Correctable Error Detected(0): %E%d%N\r\n",
4491 PCIE_CAP_COR_ERR_DETECTED (PcieDeviceStatus
)
4493 ShellPrintEx (-1, -1,
4494 L
" Non-Fatal Error Detected(1): %E%d%N\r\n",
4495 PCIE_CAP_NONFAT_ERR_DETECTED (PcieDeviceStatus
)
4497 ShellPrintEx (-1, -1,
4498 L
" Fatal Error Detected(2): %E%d%N\r\n",
4499 PCIE_CAP_FATAL_ERR_DETECTED (PcieDeviceStatus
)
4501 ShellPrintEx (-1, -1,
4502 L
" Unsupported Request Detected(3): %E%d%N\r\n",
4503 PCIE_CAP_UNSUP_REQ_DETECTED (PcieDeviceStatus
)
4505 ShellPrintEx (-1, -1,
4506 L
" AUX Power Detected(4): %E%d%N\r\n",
4507 PCIE_CAP_AUX_POWER_DETECTED (PcieDeviceStatus
)
4509 ShellPrintEx (-1, -1,
4510 L
" Transactions Pending(5): %E%d%N\r\n",
4511 PCIE_CAP_TRANSACTION_PENDING (PcieDeviceStatus
)
4517 Print out information of the device link information.
4519 @param[in] PciExpressCap The pointer to the structure about the device.
4521 @retval EFI_SUCCESS The operation was successful.
4524 ExplainPcieLinkCap (
4525 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4529 CHAR16
*MaxLinkSpeed
;
4532 PcieLinkCap
= PciExpressCap
->LinkCap
;
4533 switch (PCIE_CAP_MAX_LINK_SPEED (PcieLinkCap
)) {
4535 MaxLinkSpeed
= L
"2.5 GT/s";
4538 MaxLinkSpeed
= L
"5.0 GT/s";
4541 MaxLinkSpeed
= L
"8.0 GT/s";
4544 MaxLinkSpeed
= L
"Unknown";
4547 ShellPrintEx (-1, -1,
4548 L
" Maximum Link Speed(3:0): %E%s%N\r\n",
4551 ShellPrintEx (-1, -1,
4552 L
" Maximum Link Width(9:4): %Ex%d%N\r\n",
4553 PCIE_CAP_MAX_LINK_WIDTH (PcieLinkCap
)
4555 switch (PCIE_CAP_ASPM_SUPPORT (PcieLinkCap
)) {
4566 AspmValue
= L
"L0s and L1";
4569 AspmValue
= L
"Reserved";
4572 ShellPrintEx (-1, -1,
4573 L
" Active State Power Management Support(11:10): %E%s Supported%N\r\n",
4576 ShellPrintEx (-1, -1,
4577 L
" L0s Exit Latency(14:12): %E%s%N\r\n",
4578 L0sLatencyStrTable
[PCIE_CAP_L0S_LATENCY (PcieLinkCap
)]
4580 ShellPrintEx (-1, -1,
4581 L
" L1 Exit Latency(17:15): %E%s%N\r\n",
4582 L1LatencyStrTable
[PCIE_CAP_L0S_LATENCY (PcieLinkCap
)]
4584 ShellPrintEx (-1, -1,
4585 L
" Clock Power Management(18): %E%d%N\r\n",
4586 PCIE_CAP_CLOCK_PM (PcieLinkCap
)
4588 ShellPrintEx (-1, -1,
4589 L
" Surprise Down Error Reporting Capable(19): %E%d%N\r\n",
4590 PCIE_CAP_SUP_DOWN_ERR_REPORTING (PcieLinkCap
)
4592 ShellPrintEx (-1, -1,
4593 L
" Data Link Layer Link Active Reporting Capable(20): %E%d%N\r\n",
4594 PCIE_CAP_LINK_ACTIVE_REPORTING (PcieLinkCap
)
4596 ShellPrintEx (-1, -1,
4597 L
" Link Bandwidth Notification Capability(21): %E%d%N\r\n",
4598 PCIE_CAP_LINK_BWD_NOTIF_CAP (PcieLinkCap
)
4600 ShellPrintEx (-1, -1,
4601 L
" Port Number(31:24): %E0x%02x%N\r\n",
4602 PCIE_CAP_PORT_NUMBER (PcieLinkCap
)
4608 Print out information of the device link control information.
4610 @param[in] PciExpressCap The pointer to the structure about the device.
4612 @retval EFI_SUCCESS The operation was successful.
4615 ExplainPcieLinkControl (
4616 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4619 UINT16 PcieLinkControl
;
4620 UINT8 DevicePortType
;
4622 PcieLinkControl
= PciExpressCap
->LinkControl
;
4623 DevicePortType
= (UINT8
) PCIE_CAP_DEVICEPORT_TYPE (PciExpressCap
->PcieCapReg
);
4624 ShellPrintEx (-1, -1,
4625 L
" Active State Power Management Control(1:0): %E%s%N\r\n",
4626 ASPMCtrlStrTable
[PCIE_CAP_ASPM_CONTROL (PcieLinkControl
)]
4629 // RCB is not applicable to switches
4631 if (!IS_PCIE_SWITCH(DevicePortType
)) {
4632 ShellPrintEx (-1, -1,
4633 L
" Read Completion Boundary (RCB)(3): %E%d byte%N\r\n",
4634 1 << (PCIE_CAP_RCB (PcieLinkControl
) + 6)
4638 // Link Disable is reserved on
4640 // b) PCI Express to PCI/PCI-X bridges
4641 // c) Upstream Ports of Switches
4643 if (!IS_PCIE_ENDPOINT (DevicePortType
) &&
4644 DevicePortType
!= PCIE_SWITCH_UPSTREAM_PORT
&&
4645 DevicePortType
!= PCIE_PCIE_TO_PCIX_BRIDGE
) {
4646 ShellPrintEx (-1, -1,
4647 L
" Link Disable(4): %E%d%N\r\n",
4648 PCIE_CAP_LINK_DISABLE (PcieLinkControl
)
4651 ShellPrintEx (-1, -1,
4652 L
" Common Clock Configuration(6): %E%d%N\r\n",
4653 PCIE_CAP_COMMON_CLK_CONF (PcieLinkControl
)
4655 ShellPrintEx (-1, -1,
4656 L
" Extended Synch(7): %E%d%N\r\n",
4657 PCIE_CAP_EXT_SYNC (PcieLinkControl
)
4659 ShellPrintEx (-1, -1,
4660 L
" Enable Clock Power Management(8): %E%d%N\r\n",
4661 PCIE_CAP_CLK_PWR_MNG (PcieLinkControl
)
4663 ShellPrintEx (-1, -1,
4664 L
" Hardware Autonomous Width Disable(9): %E%d%N\r\n",
4665 PCIE_CAP_HW_AUTO_WIDTH_DISABLE (PcieLinkControl
)
4667 ShellPrintEx (-1, -1,
4668 L
" Link Bandwidth Management Interrupt Enable(10): %E%d%N\r\n",
4669 PCIE_CAP_LINK_BDW_MNG_INT_EN (PcieLinkControl
)
4671 ShellPrintEx (-1, -1,
4672 L
" Link Autonomous Bandwidth Interrupt Enable(11): %E%d%N\r\n",
4673 PCIE_CAP_LINK_AUTO_BDW_INT_EN (PcieLinkControl
)
4679 Print out information of the device link status information.
4681 @param[in] PciExpressCap The pointer to the structure about the device.
4683 @retval EFI_SUCCESS The operation was successful.
4686 ExplainPcieLinkStatus (
4687 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4690 UINT16 PcieLinkStatus
;
4691 CHAR16
*CurLinkSpeed
;
4693 PcieLinkStatus
= PciExpressCap
->LinkStatus
;
4694 switch (PCIE_CAP_CUR_LINK_SPEED (PcieLinkStatus
)) {
4696 CurLinkSpeed
= L
"2.5 GT/s";
4699 CurLinkSpeed
= L
"5.0 GT/s";
4702 CurLinkSpeed
= L
"8.0 GT/s";
4705 CurLinkSpeed
= L
"Reserved";
4708 ShellPrintEx (-1, -1,
4709 L
" Current Link Speed(3:0): %E%s%N\r\n",
4712 ShellPrintEx (-1, -1,
4713 L
" Negotiated Link Width(9:4): %Ex%d%N\r\n",
4714 PCIE_CAP_NEGO_LINK_WIDTH (PcieLinkStatus
)
4716 ShellPrintEx (-1, -1,
4717 L
" Link Training(11): %E%d%N\r\n",
4718 PCIE_CAP_LINK_TRAINING (PcieLinkStatus
)
4720 ShellPrintEx (-1, -1,
4721 L
" Slot Clock Configuration(12): %E%d%N\r\n",
4722 PCIE_CAP_SLOT_CLK_CONF (PcieLinkStatus
)
4724 ShellPrintEx (-1, -1,
4725 L
" Data Link Layer Link Active(13): %E%d%N\r\n",
4726 PCIE_CAP_DATA_LINK_ACTIVE (PcieLinkStatus
)
4728 ShellPrintEx (-1, -1,
4729 L
" Link Bandwidth Management Status(14): %E%d%N\r\n",
4730 PCIE_CAP_LINK_BDW_MNG_STAT (PcieLinkStatus
)
4732 ShellPrintEx (-1, -1,
4733 L
" Link Autonomous Bandwidth Status(15): %E%d%N\r\n",
4734 PCIE_CAP_LINK_AUTO_BDW_STAT (PcieLinkStatus
)
4740 Print out information of the device slot information.
4742 @param[in] PciExpressCap The pointer to the structure about the device.
4744 @retval EFI_SUCCESS The operation was successful.
4747 ExplainPcieSlotCap (
4748 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4753 PcieSlotCap
= PciExpressCap
->SlotCap
;
4755 ShellPrintEx (-1, -1,
4756 L
" Attention Button Present(0): %E%d%N\r\n",
4757 PCIE_CAP_ATT_BUT_PRESENT (PcieSlotCap
)
4759 ShellPrintEx (-1, -1,
4760 L
" Power Controller Present(1): %E%d%N\r\n",
4761 PCIE_CAP_PWR_CTRLLER_PRESENT (PcieSlotCap
)
4763 ShellPrintEx (-1, -1,
4764 L
" MRL Sensor Present(2): %E%d%N\r\n",
4765 PCIE_CAP_MRL_SENSOR_PRESENT (PcieSlotCap
)
4767 ShellPrintEx (-1, -1,
4768 L
" Attention Indicator Present(3): %E%d%N\r\n",
4769 PCIE_CAP_ATT_IND_PRESENT (PcieSlotCap
)
4771 ShellPrintEx (-1, -1,
4772 L
" Power Indicator Present(4): %E%d%N\r\n",
4773 PCIE_CAP_PWD_IND_PRESENT (PcieSlotCap
)
4775 ShellPrintEx (-1, -1,
4776 L
" Hot-Plug Surprise(5): %E%d%N\r\n",
4777 PCIE_CAP_HOTPLUG_SUPPRISE (PcieSlotCap
)
4779 ShellPrintEx (-1, -1,
4780 L
" Hot-Plug Capable(6): %E%d%N\r\n",
4781 PCIE_CAP_HOTPLUG_CAPABLE (PcieSlotCap
)
4783 ShellPrintEx (-1, -1,
4784 L
" Slot Power Limit Value(14:7): %E0x%02x%N\r\n",
4785 PCIE_CAP_SLOT_PWR_LIMIT_VALUE (PcieSlotCap
)
4787 ShellPrintEx (-1, -1,
4788 L
" Slot Power Limit Scale(16:15): %E%s%N\r\n",
4789 SlotPwrLmtScaleTable
[PCIE_CAP_SLOT_PWR_LIMIT_SCALE (PcieSlotCap
)]
4791 ShellPrintEx (-1, -1,
4792 L
" Electromechanical Interlock Present(17): %E%d%N\r\n",
4793 PCIE_CAP_ELEC_INTERLOCK_PRESENT (PcieSlotCap
)
4795 ShellPrintEx (-1, -1,
4796 L
" No Command Completed Support(18): %E%d%N\r\n",
4797 PCIE_CAP_NO_COMM_COMPLETED_SUP (PcieSlotCap
)
4799 ShellPrintEx (-1, -1,
4800 L
" Physical Slot Number(31:19): %E%d%N\r\n",
4801 PCIE_CAP_PHY_SLOT_NUM (PcieSlotCap
)
4808 Print out information of the device slot control information.
4810 @param[in] PciExpressCap The pointer to the structure about the device.
4812 @retval EFI_SUCCESS The operation was successful.
4815 ExplainPcieSlotControl (
4816 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4819 UINT16 PcieSlotControl
;
4821 PcieSlotControl
= PciExpressCap
->SlotControl
;
4822 ShellPrintEx (-1, -1,
4823 L
" Attention Button Pressed Enable(0): %E%d%N\r\n",
4824 PCIE_CAP_ATT_BUT_ENABLE (PcieSlotControl
)
4826 ShellPrintEx (-1, -1,
4827 L
" Power Fault Detected Enable(1): %E%d%N\r\n",
4828 PCIE_CAP_PWR_FLT_DETECT_ENABLE (PcieSlotControl
)
4830 ShellPrintEx (-1, -1,
4831 L
" MRL Sensor Changed Enable(2): %E%d%N\r\n",
4832 PCIE_CAP_MRL_SENSOR_CHANGE_ENABLE (PcieSlotControl
)
4834 ShellPrintEx (-1, -1,
4835 L
" Presence Detect Changed Enable(3): %E%d%N\r\n",
4836 PCIE_CAP_PRES_DETECT_CHANGE_ENABLE (PcieSlotControl
)
4838 ShellPrintEx (-1, -1,
4839 L
" Command Completed Interrupt Enable(4): %E%d%N\r\n",
4840 PCIE_CAP_COMM_CMPL_INT_ENABLE (PcieSlotControl
)
4842 ShellPrintEx (-1, -1,
4843 L
" Hot-Plug Interrupt Enable(5): %E%d%N\r\n",
4844 PCIE_CAP_HOTPLUG_INT_ENABLE (PcieSlotControl
)
4846 ShellPrintEx (-1, -1,
4847 L
" Attention Indicator Control(7:6): %E%s%N\r\n",
4848 IndicatorTable
[PCIE_CAP_ATT_IND_CTRL (PcieSlotControl
)]
4850 ShellPrintEx (-1, -1,
4851 L
" Power Indicator Control(9:8): %E%s%N\r\n",
4852 IndicatorTable
[PCIE_CAP_PWR_IND_CTRL (PcieSlotControl
)]
4854 ShellPrintEx (-1, -1, L
" Power Controller Control(10): %EPower ");
4855 if (PCIE_CAP_PWR_CTRLLER_CTRL (PcieSlotControl
)) {
4856 ShellPrintEx (-1, -1, L
"Off%N\r\n");
4858 ShellPrintEx (-1, -1, L
"On%N\r\n");
4860 ShellPrintEx (-1, -1,
4861 L
" Electromechanical Interlock Control(11): %E%d%N\r\n",
4862 PCIE_CAP_ELEC_INTERLOCK_CTRL (PcieSlotControl
)
4864 ShellPrintEx (-1, -1,
4865 L
" Data Link Layer State Changed Enable(12): %E%d%N\r\n",
4866 PCIE_CAP_DLINK_STAT_CHANGE_ENABLE (PcieSlotControl
)
4872 Print out information of the device slot status information.
4874 @param[in] PciExpressCap The pointer to the structure about the device.
4876 @retval EFI_SUCCESS The operation was successful.
4879 ExplainPcieSlotStatus (
4880 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4883 UINT16 PcieSlotStatus
;
4885 PcieSlotStatus
= PciExpressCap
->SlotStatus
;
4887 ShellPrintEx (-1, -1,
4888 L
" Attention Button Pressed(0): %E%d%N\r\n",
4889 PCIE_CAP_ATT_BUT_PRESSED (PcieSlotStatus
)
4891 ShellPrintEx (-1, -1,
4892 L
" Power Fault Detected(1): %E%d%N\r\n",
4893 PCIE_CAP_PWR_FLT_DETECTED (PcieSlotStatus
)
4895 ShellPrintEx (-1, -1,
4896 L
" MRL Sensor Changed(2): %E%d%N\r\n",
4897 PCIE_CAP_MRL_SENSOR_CHANGED (PcieSlotStatus
)
4899 ShellPrintEx (-1, -1,
4900 L
" Presence Detect Changed(3): %E%d%N\r\n",
4901 PCIE_CAP_PRES_DETECT_CHANGED (PcieSlotStatus
)
4903 ShellPrintEx (-1, -1,
4904 L
" Command Completed(4): %E%d%N\r\n",
4905 PCIE_CAP_COMM_COMPLETED (PcieSlotStatus
)
4907 ShellPrintEx (-1, -1, L
" MRL Sensor State(5): %EMRL ");
4908 if (PCIE_CAP_MRL_SENSOR_STATE (PcieSlotStatus
)) {
4909 ShellPrintEx (-1, -1, L
" Opened%N\r\n");
4911 ShellPrintEx (-1, -1, L
" Closed%N\r\n");
4913 ShellPrintEx (-1, -1, L
" Presence Detect State(6): ");
4914 if (PCIE_CAP_PRES_DETECT_STATE (PcieSlotStatus
)) {
4915 ShellPrintEx (-1, -1, L
"%ECard Present in slot%N\r\n");
4917 ShellPrintEx (-1, -1, L
"%ESlot Empty%N\r\n");
4919 ShellPrintEx (-1, -1, L
" Electromechanical Interlock Status(7): %EElectromechanical Interlock ");
4920 if (PCIE_CAP_ELEC_INTERLOCK_STATE (PcieSlotStatus
)) {
4921 ShellPrintEx (-1, -1, L
"Engaged%N\r\n");
4923 ShellPrintEx (-1, -1, L
"Disengaged%N\r\n");
4925 ShellPrintEx (-1, -1,
4926 L
" Data Link Layer State Changed(8): %E%d%N\r\n",
4927 PCIE_CAP_DLINK_STAT_CHANGED (PcieSlotStatus
)
4933 Print out information of the device root information.
4935 @param[in] PciExpressCap The pointer to the structure about the device.
4937 @retval EFI_SUCCESS The operation was successful.
4940 ExplainPcieRootControl (
4941 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4944 UINT16 PcieRootControl
;
4946 PcieRootControl
= PciExpressCap
->RootControl
;
4948 ShellPrintEx (-1, -1,
4949 L
" System Error on Correctable Error Enable(0): %E%d%N\r\n",
4950 PCIE_CAP_SYSERR_ON_CORERR_EN (PcieRootControl
)
4952 ShellPrintEx (-1, -1,
4953 L
" System Error on Non-Fatal Error Enable(1): %E%d%N\r\n",
4954 PCIE_CAP_SYSERR_ON_NONFATERR_EN (PcieRootControl
)
4956 ShellPrintEx (-1, -1,
4957 L
" System Error on Fatal Error Enable(2): %E%d%N\r\n",
4958 PCIE_CAP_SYSERR_ON_FATERR_EN (PcieRootControl
)
4960 ShellPrintEx (-1, -1,
4961 L
" PME Interrupt Enable(3): %E%d%N\r\n",
4962 PCIE_CAP_PME_INT_ENABLE (PcieRootControl
)
4964 ShellPrintEx (-1, -1,
4965 L
" CRS Software Visibility Enable(4): %E%d%N\r\n",
4966 PCIE_CAP_CRS_SW_VIS_ENABLE (PcieRootControl
)
4973 Print out information of the device root capability information.
4975 @param[in] PciExpressCap The pointer to the structure about the device.
4977 @retval EFI_SUCCESS The operation was successful.
4980 ExplainPcieRootCap (
4981 IN PCIE_CAP_STRUCTURE
*PciExpressCap
4986 PcieRootCap
= PciExpressCap
->RsvdP
;
4988 ShellPrintEx (-1, -1,
4989 L
" CRS Software Visibility(0): %E%d%N\r\n",
4990 PCIE_CAP_CRS_SW_VIS (PcieRootCap
)
4997 Print out information of the device root status information.
4999 @param[in] PciExpressCap The pointer to the structure about the device.
5001 @retval EFI_SUCCESS The operation was successful.
5004 ExplainPcieRootStatus (
5005 IN PCIE_CAP_STRUCTURE
*PciExpressCap
5008 UINT32 PcieRootStatus
;
5010 PcieRootStatus
= PciExpressCap
->RootStatus
;
5012 ShellPrintEx (-1, -1,
5013 L
" PME Requester ID(15:0): %E0x%04x%N\r\n",
5014 PCIE_CAP_PME_REQ_ID (PcieRootStatus
)
5016 ShellPrintEx (-1, -1,
5017 L
" PME Status(16): %E%d%N\r\n",
5018 PCIE_CAP_PME_STATUS (PcieRootStatus
)
5020 ShellPrintEx (-1, -1,
5021 L
" PME Pending(17): %E%d%N\r\n",
5022 PCIE_CAP_PME_PENDING (PcieRootStatus
)
5028 Function to interpret and print out the link control structure
5030 @param[in] HeaderAddress The Address of this capability header.
5031 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5035 PrintInterpretedExtendedCompatibilityLinkControl (
5036 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5037 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5040 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL
*Header
;
5041 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL
*)HeaderAddress
;
5045 STRING_TOKEN (STR_PCI_EXT_CAP_LINK_CONTROL
),
5046 gShellDebug1HiiHandle
,
5047 Header
->RootComplexLinkCapabilities
,
5048 Header
->RootComplexLinkControl
,
5049 Header
->RootComplexLinkStatus
5053 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5054 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL
),
5055 (VOID
*) (HeaderAddress
)
5057 return (EFI_SUCCESS
);
5061 Function to interpret and print out the power budgeting structure
5063 @param[in] HeaderAddress The Address of this capability header.
5064 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5068 PrintInterpretedExtendedCompatibilityPowerBudgeting (
5069 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5070 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5073 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING
*Header
;
5074 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING
*)HeaderAddress
;
5078 STRING_TOKEN (STR_PCI_EXT_CAP_POWER
),
5079 gShellDebug1HiiHandle
,
5082 Header
->PowerBudgetCapability
5086 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5087 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING
),
5088 (VOID
*) (HeaderAddress
)
5090 return (EFI_SUCCESS
);
5094 Function to interpret and print out the ACS structure
5096 @param[in] HeaderAddress The Address of this capability header.
5097 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5101 PrintInterpretedExtendedCompatibilityAcs (
5102 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5103 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5106 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED
*Header
;
5110 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED
*)HeaderAddress
;
5115 STRING_TOKEN (STR_PCI_EXT_CAP_ACS
),
5116 gShellDebug1HiiHandle
,
5117 Header
->AcsCapability
,
5120 if (PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_CONTROL(Header
)) {
5121 VectorSize
= PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_VECTOR_SIZE(Header
);
5122 if (VectorSize
== 0) {
5125 for (LoopCounter
= 0 ; LoopCounter
* 8 < VectorSize
; LoopCounter
++) {
5128 STRING_TOKEN (STR_PCI_EXT_CAP_ACS2
),
5129 gShellDebug1HiiHandle
,
5131 Header
->EgressControlVectorArray
[LoopCounter
]
5137 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5138 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED
) + (VectorSize
/ 8) - 1,
5139 (VOID
*) (HeaderAddress
)
5141 return (EFI_SUCCESS
);
5145 Function to interpret and print out the latency tolerance reporting structure
5147 @param[in] HeaderAddress The Address of this capability header.
5148 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5152 PrintInterpretedExtendedCompatibilityLatencyToleranceReporting (
5153 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5154 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5157 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING
*Header
;
5158 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING
*)HeaderAddress
;
5162 STRING_TOKEN (STR_PCI_EXT_CAP_LAT
),
5163 gShellDebug1HiiHandle
,
5164 Header
->MaxSnoopLatency
,
5165 Header
->MaxNoSnoopLatency
5169 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5170 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING
),
5171 (VOID
*) (HeaderAddress
)
5173 return (EFI_SUCCESS
);
5177 Function to interpret and print out the serial number structure
5179 @param[in] HeaderAddress The Address of this capability header.
5180 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5184 PrintInterpretedExtendedCompatibilitySerialNumber (
5185 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5186 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5189 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER
*Header
;
5190 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER
*)HeaderAddress
;
5194 STRING_TOKEN (STR_PCI_EXT_CAP_SN
),
5195 gShellDebug1HiiHandle
,
5196 Header
->SerialNumber
5200 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5201 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER
),
5202 (VOID
*) (HeaderAddress
)
5204 return (EFI_SUCCESS
);
5208 Function to interpret and print out the RCRB structure
5210 @param[in] HeaderAddress The Address of this capability header.
5211 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5215 PrintInterpretedExtendedCompatibilityRcrb (
5216 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5217 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5220 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER
*Header
;
5221 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER
*)HeaderAddress
;
5225 STRING_TOKEN (STR_PCI_EXT_CAP_RCRB
),
5226 gShellDebug1HiiHandle
,
5229 Header
->RcrbCapabilities
,
5234 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5235 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER
),
5236 (VOID
*) (HeaderAddress
)
5238 return (EFI_SUCCESS
);
5242 Function to interpret and print out the vendor specific structure
5244 @param[in] HeaderAddress The Address of this capability header.
5245 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5249 PrintInterpretedExtendedCompatibilityVendorSpecific (
5250 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5251 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5254 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC
*Header
;
5255 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC
*)HeaderAddress
;
5259 STRING_TOKEN (STR_PCI_EXT_CAP_VEN
),
5260 gShellDebug1HiiHandle
,
5261 Header
->VendorSpecificHeader
5265 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5266 PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_GET_SIZE(Header
),
5267 (VOID
*) (HeaderAddress
)
5269 return (EFI_SUCCESS
);
5273 Function to interpret and print out the Event Collector Endpoint Association structure
5275 @param[in] HeaderAddress The Address of this capability header.
5276 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5280 PrintInterpretedExtendedCompatibilityECEA (
5281 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5282 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5285 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION
*Header
;
5286 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION
*)HeaderAddress
;
5290 STRING_TOKEN (STR_PCI_EXT_CAP_ECEA
),
5291 gShellDebug1HiiHandle
,
5292 Header
->AssociationBitmap
5296 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5297 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION
),
5298 (VOID
*) (HeaderAddress
)
5300 return (EFI_SUCCESS
);
5304 Function to interpret and print out the ARI structure
5306 @param[in] HeaderAddress The Address of this capability header.
5307 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5311 PrintInterpretedExtendedCompatibilityAri (
5312 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5313 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5316 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY
*Header
;
5317 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY
*)HeaderAddress
;
5321 STRING_TOKEN (STR_PCI_EXT_CAP_ARI
),
5322 gShellDebug1HiiHandle
,
5323 Header
->AriCapability
,
5328 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5329 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY
),
5330 (VOID
*) (HeaderAddress
)
5332 return (EFI_SUCCESS
);
5336 Function to interpret and print out the DPA structure
5338 @param[in] HeaderAddress The Address of this capability header.
5339 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5343 PrintInterpretedExtendedCompatibilityDynamicPowerAllocation (
5344 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5345 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5348 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION
*Header
;
5350 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION
*)HeaderAddress
;
5354 STRING_TOKEN (STR_PCI_EXT_CAP_DPA
),
5355 gShellDebug1HiiHandle
,
5356 Header
->DpaCapability
,
5357 Header
->DpaLatencyIndicator
,
5361 for (LinkCount
= 0 ; LinkCount
< PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header
) + 1 ; LinkCount
++) {
5364 STRING_TOKEN (STR_PCI_EXT_CAP_DPA2
),
5365 gShellDebug1HiiHandle
,
5367 Header
->DpaPowerAllocationArray
[LinkCount
]
5372 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5373 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION
) - 1 + PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header
),
5374 (VOID
*) (HeaderAddress
)
5376 return (EFI_SUCCESS
);
5380 Function to interpret and print out the link declaration structure
5382 @param[in] HeaderAddress The Address of this capability header.
5383 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5387 PrintInterpretedExtendedCompatibilityLinkDeclaration (
5388 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5389 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5392 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION
*Header
;
5394 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION
*)HeaderAddress
;
5398 STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR
),
5399 gShellDebug1HiiHandle
,
5400 Header
->ElementSelfDescription
5403 for (LinkCount
= 0 ; LinkCount
< PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header
) ; LinkCount
++) {
5406 STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR2
),
5407 gShellDebug1HiiHandle
,
5409 Header
->LinkEntry
[LinkCount
]
5414 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5415 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION
) + (PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header
)-1)*sizeof(UINT32
),
5416 (VOID
*) (HeaderAddress
)
5418 return (EFI_SUCCESS
);
5422 Function to interpret and print out the Advanced Error Reporting structure
5424 @param[in] HeaderAddress The Address of this capability header.
5425 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5429 PrintInterpretedExtendedCompatibilityAer (
5430 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5431 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5434 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING
*Header
;
5435 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING
*)HeaderAddress
;
5439 STRING_TOKEN (STR_PCI_EXT_CAP_AER
),
5440 gShellDebug1HiiHandle
,
5441 Header
->UncorrectableErrorStatus
,
5442 Header
->UncorrectableErrorMask
,
5443 Header
->UncorrectableErrorSeverity
,
5444 Header
->CorrectableErrorStatus
,
5445 Header
->CorrectableErrorMask
,
5446 Header
->AdvancedErrorCapabilitiesAndControl
,
5447 Header
->HeaderLog
[0],
5448 Header
->HeaderLog
[1],
5449 Header
->HeaderLog
[2],
5450 Header
->HeaderLog
[3],
5451 Header
->RootErrorCommand
,
5452 Header
->RootErrorStatus
,
5453 Header
->ErrorSourceIdentification
,
5454 Header
->CorrectableErrorSourceIdentification
,
5455 Header
->TlpPrefixLog
[0],
5456 Header
->TlpPrefixLog
[1],
5457 Header
->TlpPrefixLog
[2],
5458 Header
->TlpPrefixLog
[3]
5462 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5463 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING
),
5464 (VOID
*) (HeaderAddress
)
5466 return (EFI_SUCCESS
);
5470 Function to interpret and print out the multicast structure
5472 @param[in] HeaderAddress The Address of this capability header.
5473 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5474 @param[in] PciExpressCapPtr The address of the PCIe capabilities structure.
5478 PrintInterpretedExtendedCompatibilityMulticast (
5479 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5480 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
,
5481 IN CONST PCIE_CAP_STRUCTURE
*PciExpressCapPtr
5484 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST
*Header
;
5485 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST
*)HeaderAddress
;
5489 STRING_TOKEN (STR_PCI_EXT_CAP_MULTICAST
),
5490 gShellDebug1HiiHandle
,
5491 Header
->MultiCastCapability
,
5492 Header
->MulticastControl
,
5493 Header
->McBaseAddress
,
5494 Header
->McReceiveAddress
,
5496 Header
->McBlockUntranslated
,
5497 Header
->McOverlayBar
5502 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5503 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST
),
5504 (VOID
*) (HeaderAddress
)
5507 return (EFI_SUCCESS
);
5511 Function to interpret and print out the virtual channel and multi virtual channel structure
5513 @param[in] HeaderAddress The Address of this capability header.
5514 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5518 PrintInterpretedExtendedCompatibilityVirtualChannel (
5519 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5520 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5523 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY
*Header
;
5524 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC
*CapabilityItem
;
5526 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY
*)HeaderAddress
;
5530 STRING_TOKEN (STR_PCI_EXT_CAP_VC_BASE
),
5531 gShellDebug1HiiHandle
,
5532 Header
->ExtendedVcCount
,
5533 Header
->PortVcCapability1
,
5534 Header
->PortVcCapability2
,
5535 Header
->VcArbTableOffset
,
5536 Header
->PortVcControl
,
5537 Header
->PortVcStatus
5539 for (ItemCount
= 0 ; ItemCount
< Header
->ExtendedVcCount
; ItemCount
++) {
5540 CapabilityItem
= &Header
->Capability
[ItemCount
];
5543 STRING_TOKEN (STR_PCI_EXT_CAP_VC_ITEM
),
5544 gShellDebug1HiiHandle
,
5546 CapabilityItem
->VcResourceCapability
,
5547 CapabilityItem
->PortArbTableOffset
,
5548 CapabilityItem
->VcResourceControl
,
5549 CapabilityItem
->VcResourceStatus
5555 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5556 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC
) + (Header
->ExtendedVcCount
- 1) * sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY
),
5557 (VOID
*) (HeaderAddress
)
5560 return (EFI_SUCCESS
);
5564 Function to interpret and print out the resizeable bar structure
5566 @param[in] HeaderAddress The Address of this capability header.
5567 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5571 PrintInterpretedExtendedCompatibilityResizeableBar (
5572 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5573 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5576 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR
*Header
;
5578 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR
*)HeaderAddress
;
5580 for (ItemCount
= 0 ; ItemCount
< (UINT32
)GET_NUMBER_RESIZABLE_BARS(Header
) ; ItemCount
++) {
5583 STRING_TOKEN (STR_PCI_EXT_CAP_RESIZE_BAR
),
5584 gShellDebug1HiiHandle
,
5586 Header
->Capability
[ItemCount
].ResizableBarCapability
,
5587 Header
->Capability
[ItemCount
].ResizableBarControl
5593 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5594 (UINT32
)GET_NUMBER_RESIZABLE_BARS(Header
) * sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY
),
5595 (VOID
*) (HeaderAddress
)
5598 return (EFI_SUCCESS
);
5602 Function to interpret and print out the TPH structure
5604 @param[in] HeaderAddress The Address of this capability header.
5605 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5609 PrintInterpretedExtendedCompatibilityTph (
5610 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5611 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
5614 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH
*Header
;
5615 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH
*)HeaderAddress
;
5619 STRING_TOKEN (STR_PCI_EXT_CAP_TPH
),
5620 gShellDebug1HiiHandle
,
5621 Header
->TphRequesterCapability
,
5622 Header
->TphRequesterControl
5626 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)Header
->TphStTable
- (UINT8
*)HeadersBaseAddress
),
5627 GET_TPH_TABLE_SIZE(Header
),
5628 (VOID
*)Header
->TphStTable
5633 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5634 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH
) + GET_TPH_TABLE_SIZE(Header
) - sizeof(UINT16
),
5635 (VOID
*) (HeaderAddress
)
5638 return (EFI_SUCCESS
);
5642 Function to interpret and print out the secondary PCIe capability structure
5644 @param[in] HeaderAddress The Address of this capability header.
5645 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5646 @param[in] PciExpressCapPtr The address of the PCIe capabilities structure.
5650 PrintInterpretedExtendedCompatibilitySecondary (
5651 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5652 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
,
5653 IN CONST PCIE_CAP_STRUCTURE
*PciExpressCapPtr
5656 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE
*Header
;
5657 Header
= (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE
*)HeaderAddress
;
5661 STRING_TOKEN (STR_PCI_EXT_CAP_SECONDARY
),
5662 gShellDebug1HiiHandle
,
5663 Header
->LinkControl3
,
5664 Header
->LaneErrorStatus
5668 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)Header
->EqualizationControl
- (UINT8
*)HeadersBaseAddress
),
5669 PCIE_CAP_MAX_LINK_WIDTH(PciExpressCapPtr
->LinkCap
),
5670 (VOID
*)Header
->EqualizationControl
5675 EFI_PCIE_CAPABILITY_BASE_OFFSET
+ ((UINT8
*)HeaderAddress
- (UINT8
*)HeadersBaseAddress
),
5676 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH
) - sizeof(Header
->EqualizationControl
) + PCIE_CAP_MAX_LINK_WIDTH(PciExpressCapPtr
->LinkCap
),
5677 (VOID
*) (HeaderAddress
)
5680 return (EFI_SUCCESS
);
5684 Display Pcie extended capability details
5686 @param[in] HeadersBaseAddress The address of all the extended capability headers.
5687 @param[in] HeaderAddress The address of this capability header.
5688 @param[in] PciExpressCapPtr The address of the PCIe capabilities structure.
5692 PrintPciExtendedCapabilityDetails(
5693 IN CONST PCI_EXP_EXT_HDR
*HeadersBaseAddress
,
5694 IN CONST PCI_EXP_EXT_HDR
*HeaderAddress
,
5695 IN CONST PCIE_CAP_STRUCTURE
*PciExpressCapPtr
5698 switch (HeaderAddress
->CapabilityId
){
5699 case PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_ID
:
5700 return PrintInterpretedExtendedCompatibilityAer(HeaderAddress
, HeadersBaseAddress
);
5701 case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_CONTROL_ID
:
5702 return PrintInterpretedExtendedCompatibilityLinkControl(HeaderAddress
, HeadersBaseAddress
);
5703 case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_ID
:
5704 return PrintInterpretedExtendedCompatibilityLinkDeclaration(HeaderAddress
, HeadersBaseAddress
);
5705 case PCI_EXPRESS_EXTENDED_CAPABILITY_SERIAL_NUMBER_ID
:
5706 return PrintInterpretedExtendedCompatibilitySerialNumber(HeaderAddress
, HeadersBaseAddress
);
5707 case PCI_EXPRESS_EXTENDED_CAPABILITY_POWER_BUDGETING_ID
:
5708 return PrintInterpretedExtendedCompatibilityPowerBudgeting(HeaderAddress
, HeadersBaseAddress
);
5709 case PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_ID
:
5710 return PrintInterpretedExtendedCompatibilityAcs(HeaderAddress
, HeadersBaseAddress
);
5711 case PCI_EXPRESS_EXTENDED_CAPABILITY_LATENCE_TOLERANCE_REPORTING_ID
:
5712 return PrintInterpretedExtendedCompatibilityLatencyToleranceReporting(HeaderAddress
, HeadersBaseAddress
);
5713 case PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID
:
5714 return PrintInterpretedExtendedCompatibilityAri(HeaderAddress
, HeadersBaseAddress
);
5715 case PCI_EXPRESS_EXTENDED_CAPABILITY_RCRB_HEADER_ID
:
5716 return PrintInterpretedExtendedCompatibilityRcrb(HeaderAddress
, HeadersBaseAddress
);
5717 case PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_ID
:
5718 return PrintInterpretedExtendedCompatibilityVendorSpecific(HeaderAddress
, HeadersBaseAddress
);
5719 case PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_ID
:
5720 return PrintInterpretedExtendedCompatibilityDynamicPowerAllocation(HeaderAddress
, HeadersBaseAddress
);
5721 case PCI_EXPRESS_EXTENDED_CAPABILITY_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_ID
:
5722 return PrintInterpretedExtendedCompatibilityECEA(HeaderAddress
, HeadersBaseAddress
);
5723 case PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_ID
:
5724 case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTI_FUNCTION_VIRTUAL_CHANNEL_ID
:
5725 return PrintInterpretedExtendedCompatibilityVirtualChannel(HeaderAddress
, HeadersBaseAddress
);
5726 case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTICAST_ID
:
5728 // should only be present if PCIE_CAP_DEVICEPORT_TYPE(PciExpressCapPtr->PcieCapReg) == 0100b, 0101b, or 0110b
5730 return PrintInterpretedExtendedCompatibilityMulticast(HeaderAddress
, HeadersBaseAddress
, PciExpressCapPtr
);
5731 case PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID
:
5732 return PrintInterpretedExtendedCompatibilityResizeableBar(HeaderAddress
, HeadersBaseAddress
);
5733 case PCI_EXPRESS_EXTENDED_CAPABILITY_TPH_ID
:
5734 return PrintInterpretedExtendedCompatibilityTph(HeaderAddress
, HeadersBaseAddress
);
5735 case PCI_EXPRESS_EXTENDED_CAPABILITY_SECONDARY_PCIE_ID
:
5736 return PrintInterpretedExtendedCompatibilitySecondary(HeaderAddress
, HeadersBaseAddress
, PciExpressCapPtr
);
5738 ShellPrintEx (-1, -1,
5739 L
"Unknown PCIe extended capability ID (%04xh). No interpretation available.\r\n",
5740 HeaderAddress
->CapabilityId
5748 Display Pcie device structure.
5750 @param[in] IoDev The pointer to the root pci protocol.
5751 @param[in] Address The Address to start at.
5752 @param[in] CapabilityPtr The offset from the address to start.
5753 @param[in] EnhancedDump The print format for the dump data.
5757 PciExplainPciExpress (
5758 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*IoDev
,
5760 IN UINT8 CapabilityPtr
,
5761 IN CONST UINT16 EnhancedDump
5765 PCIE_CAP_STRUCTURE PciExpressCap
;
5767 UINT64 CapRegAddress
;
5772 UINTN ExtendRegSize
;
5773 UINT64 Pciex_Address
;
5774 UINT8 DevicePortType
;
5778 PCI_EXP_EXT_HDR
*ExtHdr
;
5780 CapRegAddress
= Address
+ CapabilityPtr
;
5785 sizeof (PciExpressCap
) / sizeof (UINT32
),
5789 DevicePortType
= (UINT8
) PCIE_CAP_DEVICEPORT_TYPE (PciExpressCap
.PcieCapReg
);
5791 ShellPrintEx (-1, -1, L
"\r\nPci Express device capability structure:\r\n");
5793 for (Index
= 0; PcieExplainList
[Index
].Type
< PcieExplainTypeMax
; Index
++) {
5794 if (ShellGetExecutionBreakFlag()) {
5797 RegAddr
= ((UINT8
*) &PciExpressCap
) + PcieExplainList
[Index
].Offset
;
5798 switch (PcieExplainList
[Index
].Width
) {
5799 case FieldWidthUINT8
:
5800 RegValue
= *(UINT8
*) RegAddr
;
5802 case FieldWidthUINT16
:
5803 RegValue
= *(UINT16
*) RegAddr
;
5805 case FieldWidthUINT32
:
5806 RegValue
= *(UINT32
*) RegAddr
;
5812 ShellPrintHiiEx(-1, -1, NULL
,
5813 PcieExplainList
[Index
].Token
,
5814 gShellDebug1HiiHandle
,
5815 PcieExplainList
[Index
].Offset
,
5818 if (PcieExplainList
[Index
].Func
== NULL
) {
5821 switch (PcieExplainList
[Index
].Type
) {
5822 case PcieExplainTypeLink
:
5824 // Link registers should not be used by
5825 // a) Root Complex Integrated Endpoint
5826 // b) Root Complex Event Collector
5828 if (DevicePortType
== PCIE_ROOT_COMPLEX_INTEGRATED_PORT
||
5829 DevicePortType
== PCIE_ROOT_COMPLEX_EVENT_COLLECTOR
) {
5833 case PcieExplainTypeSlot
:
5835 // Slot registers are only valid for
5836 // a) Root Port of PCI Express Root Complex
5837 // b) Downstream Port of PCI Express Switch
5838 // and when SlotImplemented bit is set in PCIE cap register.
5840 if ((DevicePortType
!= PCIE_ROOT_COMPLEX_ROOT_PORT
&&
5841 DevicePortType
!= PCIE_SWITCH_DOWNSTREAM_PORT
) ||
5842 !PCIE_CAP_SLOT_IMPLEMENTED (PciExpressCap
.PcieCapReg
)) {
5846 case PcieExplainTypeRoot
:
5848 // Root registers are only valid for
5849 // Root Port of PCI Express Root Complex
5851 if (DevicePortType
!= PCIE_ROOT_COMPLEX_ROOT_PORT
) {
5858 PcieExplainList
[Index
].Func (&PciExpressCap
);
5861 Bus
= (UINT8
) (RShiftU64 (Address
, 24));
5862 Dev
= (UINT8
) (RShiftU64 (Address
, 16));
5863 Func
= (UINT8
) (RShiftU64 (Address
, 8));
5865 Pciex_Address
= CALC_EFI_PCIEX_ADDRESS (Bus
, Dev
, Func
, EFI_PCIE_CAPABILITY_BASE_OFFSET
);
5867 ExtendRegSize
= 0x1000 - EFI_PCIE_CAPABILITY_BASE_OFFSET
;
5869 ExRegBuffer
= (UINT8
*) AllocateZeroPool (ExtendRegSize
);
5872 // PciRootBridgeIo protocol should support pci express extend space IO
5873 // (Begins at offset EFI_PCIE_CAPABILITY_BASE_OFFSET)
5875 Status
= IoDev
->Pci
.Read (
5879 (ExtendRegSize
) / sizeof (UINT32
),
5880 (VOID
*) (ExRegBuffer
)
5882 if (EFI_ERROR (Status
) || ExRegBuffer
== NULL
) {
5883 SHELL_FREE_NON_NULL(ExRegBuffer
);
5884 return EFI_UNSUPPORTED
;
5887 if (EnhancedDump
== 0) {
5889 // Print the PciEx extend space in raw bytes ( 0xFF-0xFFF)
5891 ShellPrintEx (-1, -1, L
"\r\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\r\n\r\n");
5895 EFI_PCIE_CAPABILITY_BASE_OFFSET
,
5897 (VOID
*) (ExRegBuffer
)
5900 ExtHdr
= (PCI_EXP_EXT_HDR
*)ExRegBuffer
;
5901 while (ExtHdr
->CapabilityId
!= 0 && ExtHdr
->CapabilityVersion
!= 0) {
5903 // Process this item
5905 if (EnhancedDump
== 0xFFFF || EnhancedDump
== ExtHdr
->CapabilityId
) {
5909 PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR
*)ExRegBuffer
, ExtHdr
, &PciExpressCap
);
5913 // Advance to the next item if it exists
5915 if (ExtHdr
->NextCapabilityOffset
!= 0) {
5916 ExtHdr
= (PCI_EXP_EXT_HDR
*)((UINT8
*)ExRegBuffer
+ ExtHdr
->NextCapabilityOffset
);
5922 SHELL_FREE_NON_NULL(ExRegBuffer
);