summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c61
1 files changed, 25 insertions, 36 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index 9cc4f5cf2e..99e6caff87 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2370,7 +2370,7 @@ PCI_CONFIG_SPACE *mConfigSpace = NULL;
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-s", TypeValue},
{L"-i", TypeFlag},
- {L"-_e", TypeValue},
+ {L"-ec", TypeValue},
{NULL, TypeMax}
};
@@ -2516,6 +2516,11 @@ ShellCommandRunPci (
ShellStatus = SHELL_INVALID_PARAMETER;
goto Done;
}
+ if (ShellCommandLineGetFlag(Package, L"-ec") && ShellCommandLineGetValue(Package, L"-ec") == NULL) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-ec");
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto Done;
+ }
if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetValue(Package, L"-s") == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"pci", L"-s");
ShellStatus = SHELL_INVALID_PARAMETER;
@@ -2878,13 +2883,11 @@ ShellCommandRunPci (
// If "-i" appears in command line, interpret data in configuration space
//
if (ExplainData) {
- EnhancedDump = 0;
- if (ShellCommandLineGetFlag(Package, L"-_e")) {
- EnhancedDump = 0xFFFF;
- Temp = ShellCommandLineGetValue(Package, L"-_e");
- if (Temp != NULL) {
- EnhancedDump = (UINT16) ShellHexStrToUintn (Temp);
- }
+ EnhancedDump = 0xFFFF;
+ if (ShellCommandLineGetFlag(Package, L"-ec")) {
+ Temp = ShellCommandLineGetValue(Package, L"-ec");
+ ASSERT (Temp != NULL);
+ EnhancedDump = (UINT16) ShellHexStrToUintn (Temp);
}
Status = PciExplainData (&ConfigSpace, Address, IoDev, EnhancedDump);
}
@@ -5829,39 +5832,25 @@ PciExplainPciExpress (
return EFI_UNSUPPORTED;
}
- if (EnhancedDump == 0) {
+ ExtHdr = (PCI_EXP_EXT_HDR*)ExRegBuffer;
+ while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
//
- // Print the PciEx extend space in raw bytes ( 0xFF-0xFFF)
+ // Process this item
//
- ShellPrintEx (-1, -1, L"\r\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\r\n\r\n");
-
- DumpHex (
- 2,
- EFI_PCIE_CAPABILITY_BASE_OFFSET,
- ExtendRegSize,
- (VOID *) (ExRegBuffer)
- );
- } else {
- ExtHdr = (PCI_EXP_EXT_HDR*)ExRegBuffer;
- while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+ if (EnhancedDump == 0xFFFF || EnhancedDump == ExtHdr->CapabilityId) {
//
- // Process this item
+ // Print this item
//
- if (EnhancedDump == 0xFFFF || EnhancedDump == ExtHdr->CapabilityId) {
- //
- // Print this item
- //
- PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExRegBuffer, ExtHdr, &PciExpressCap);
- }
+ PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExRegBuffer, ExtHdr, &PciExpressCap);
+ }
- //
- // Advance to the next item if it exists
- //
- if (ExtHdr->NextCapabilityOffset != 0) {
- ExtHdr = (PCI_EXP_EXT_HDR*)((UINT8*)ExRegBuffer + ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
- } else {
- break;
- }
+ //
+ // Advance to the next item if it exists
+ //
+ if (ExtHdr->NextCapabilityOffset != 0) {
+ ExtHdr = (PCI_EXP_EXT_HDR*)((UINT8*)ExRegBuffer + ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
+ } else {
+ break;
}
}
SHELL_FREE_NON_NULL(ExRegBuffer);