summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c170
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h4
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf9
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.unibin29662 -> 33030 bytes
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c187
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf4
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c4
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c2
-rw-r--r--ShellPkg/ShellPkg.dec12
9 files changed, 327 insertions, 65 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index b4cf682ad8..9c6cf61af5 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -1,7 +1,7 @@
/** @file
Provides interface to advanced shell functionality for parsing both handle and protocol database.
- Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.
+ Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -581,6 +581,167 @@ DevicePathProtocolDumpInformation(
return (Temp);
}
+/**
+ Function to dump information about EfiAdapterInformation Protocol.
+
+ @param[in] TheHandle The handle that has the protocol installed.
+ @param[in] Verbose TRUE for additional information, FALSE otherwise.
+
+ @retval A pointer to a string containing the information.
+**/
+CHAR16*
+EFIAPI
+AdapterInformationDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
+ )
+{
+ EFI_STATUS Status;
+ EFI_ADAPTER_INFORMATION_PROTOCOL *EfiAdptrInfoProtocol;
+ UINTN InfoTypesBufferCount;
+ UINTN GuidIndex;
+ EFI_GUID *InfoTypesBuffer;
+ CHAR16 *GuidStr;
+ CHAR16 *TempStr;
+ CHAR16 *RetVal;
+ VOID *InformationBlock;
+ UINTN InformationBlockSize;
+
+ if (!Verbose) {
+ return (CatSPrint(NULL, L"AdapterInfo"));
+ }
+
+ //
+ // Allocate print buffer to store data
+ //
+ RetVal = AllocateZeroPool (PcdGet16(PcdShellPrintBufferSize));
+ if (RetVal == NULL) {
+ return NULL;
+ }
+
+ Status = gBS->OpenProtocol (
+ (EFI_HANDLE) (TheHandle),
+ &gEfiAdapterInformationProtocolGuid,
+ (VOID **) &EfiAdptrInfoProtocol,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (EFI_ERROR (Status)) {
+ SHELL_FREE_NON_NULL (RetVal);
+ return NULL;
+ }
+
+ //
+ // Get a list of supported information types for this instance of the protocol.
+ //
+ Status = EfiAdptrInfoProtocol->GetSupportedTypes (
+ EfiAdptrInfoProtocol,
+ &InfoTypesBuffer,
+ &InfoTypesBufferCount
+ );
+ if (EFI_ERROR (Status)) {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GET_SUPP_TYPES_FAILED), NULL);
+ RetVal = CatSPrint (RetVal, TempStr, Status);
+ } else {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SUPP_TYPE_HEADER), NULL);
+ RetVal = CatSPrint (RetVal, TempStr);
+ SHELL_FREE_NON_NULL (TempStr);
+
+ for (GuidIndex = 0; GuidIndex < InfoTypesBufferCount; GuidIndex++) {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_NUMBER), NULL);
+ RetVal = CatSPrint (RetVal, TempStr, (GuidIndex + 1), InfoTypesBuffer[GuidIndex]);
+ SHELL_FREE_NON_NULL (TempStr);
+
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_STRING), NULL);
+
+ if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {
+ RetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoMediaStateGuid");
+ } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {
+ RetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoNetworkBootGuid");
+ } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid)) {
+ RetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoSanMacAddressGuid");
+ } else {
+
+ GuidStr = GetStringNameFromGuid (&InfoTypesBuffer[GuidIndex], NULL);
+
+ if (GuidStr != NULL) {
+ if (StrCmp(GuidStr, L"UnknownDevice") == 0) {
+ RetVal = CatSPrint (RetVal, TempStr, L"UnknownInfoType");
+
+ SHELL_FREE_NON_NULL (TempStr);
+ SHELL_FREE_NON_NULL(GuidStr);
+ //
+ // So that we never have to pass this UnknownInfoType to the parsing function "GetInformation" service of AIP
+ //
+ continue;
+ } else {
+ RetVal = CatSPrint (RetVal, TempStr, GuidStr);
+ SHELL_FREE_NON_NULL(GuidStr);
+ }
+ }
+ }
+
+ SHELL_FREE_NON_NULL (TempStr);
+
+ Status = EfiAdptrInfoProtocol->GetInformation (
+ EfiAdptrInfoProtocol,
+ &InfoTypesBuffer[GuidIndex],
+ &InformationBlock,
+ &InformationBlockSize
+ );
+
+ if (EFI_ERROR (Status)) {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GETINFO_FAILED), NULL);
+ RetVal = CatSPrint (RetVal, TempStr, Status);
+ } else {
+ if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_MEDIA_STATE), NULL);
+ RetVal = CatSPrint (
+ RetVal,
+ TempStr,
+ ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState,
+ ((EFI_ADAPTER_INFO_MEDIA_STATE *)InformationBlock)->MediaState
+ );
+ } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_NETWORK_BOOT_INFO), NULL);
+ RetVal = CatSPrint (
+ RetVal,
+ TempStr,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4BootCapablity,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6BootCapablity,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBootCapablity,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->OffloadCapability,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiMpioCapability,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv4Boot,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->iScsiIpv6Boot,
+ ((EFI_ADAPTER_INFO_NETWORK_BOOT *)InformationBlock)->FCoeBoot
+ );
+ } else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid) == TRUE) {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SAN_MAC_ADDRESS_INFO), NULL);
+ RetVal = CatSPrint (
+ RetVal,
+ TempStr,
+ ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[0],
+ ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[1],
+ ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[2],
+ ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[3],
+ ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[4],
+ ((EFI_ADAPTER_INFO_SAN_MAC_ADDRESS *)InformationBlock)->SanMacAddress.Addr[5]
+ );
+ } else {
+ TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_UNKNOWN_INFO_TYPE), NULL);
+ RetVal = CatSPrint (RetVal, TempStr, &InfoTypesBuffer[GuidIndex]);
+ }
+ }
+ SHELL_FREE_NON_NULL (TempStr);
+ SHELL_FREE_NON_NULL (InformationBlock);
+ }
+ }
+
+ return RetVal;
+}
//
// Put the information on the NT32 protocol GUIDs here so we are not dependant on the Nt32Pkg
//
@@ -713,6 +874,8 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
{STRING_TOKEN(STR_GPT_NBR), &gEfiPartTypeLegacyMbrGuid, NULL},
{STRING_TOKEN(STR_DRIVER_CONFIG), &gEfiDriverConfigurationProtocolGuid, NULL},
{STRING_TOKEN(STR_DRIVER_CONFIG2), &gEfiDriverConfiguration2ProtocolGuid, NULL},
+ {STRING_TOKEN(STR_ISA_IO), &gEfiIsaIoProtocolGuid, NULL},
+ {STRING_TOKEN(STR_ISA_ACPI), &gEfiIsaAcpiProtocolGuid, NULL},
//
// the ones under this are GUID identified structs, not protocols
@@ -770,7 +933,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
// UEFI 2.4
//
{STRING_TOKEN(STR_DISK_IO2), &gEfiDiskIo2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_ADAPTER_INFO), &gEfiAdapterInformationProtocolGuid, NULL},
+ {STRING_TOKEN(STR_ADAPTER_INFO), &gEfiAdapterInformationProtocolGuid, AdapterInformationDumpInformation},
//
// PI Spec ones
@@ -898,7 +1061,6 @@ AddNewGuidNameMapping(
IN CONST CHAR8 *Lang OPTIONAL
)
{
- CONST GUID_INFO_BLOCK *Temp;
EFI_STRING_ID NameID;
HandleParsingHiiInit();
@@ -907,7 +1069,7 @@ AddNewGuidNameMapping(
return (EFI_INVALID_PARAMETER);
}
- if ((Temp = InternalShellGetNodeFromGuid(Guid)) != NULL) {
+ if ((InternalShellGetNodeFromGuid(Guid)) != NULL) {
return (EFI_ACCESS_DENIED);
}
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
index c1735a64ae..ba6e152d3b 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
@@ -1,7 +1,7 @@
/** @file
Provides interface to advanced shell functionality for parsing both handle and protocol database.
- Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.
+ Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -135,6 +135,8 @@
#include <Protocol/DiskIo2.h>
#include <Protocol/AdapterInformation.h>
#include <Protocol/EfiShellDynamicCommand.h>
+#include <Protocol/IsaIo.h>
+#include <Protocol/IsaAcpi.h>
#include <Library/HandleParsingLib.h>
#include <Library/UefiBootServicesTableLib.h>
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
index 6c30552503..dc97876667 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
@@ -1,6 +1,6 @@
## @file
# Provides interface to advanced shell functionality for parsing both handle and protocol database.
-# Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.
+# Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>
#
# This program and the accompanying materials
@@ -36,6 +36,7 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
ShellPkg/ShellPkg.dec
+ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
[LibraryClasses]
UefiBootServicesTableLib
@@ -172,6 +173,9 @@
gEfiIdeControllerInitProtocolGuid ##UNDEFINED
gEfiDiskIo2ProtocolGuid ##UNDEFINED
gEfiAdapterInformationProtocolGuid ##UNDEFINED
+ gEfiIsaIoProtocolGuid ##UNDEFINED
+ gEfiIsaAcpiProtocolGuid ##UNDEFINED
+ gEfiShellDynamicCommandProtocolGuid ##UNDEFINED
[Guids]
gEfiFileInfoGuid ##CONSUMES
@@ -188,6 +192,9 @@
gEfiPartTypeSystemPartGuid ##UNDEFINED
gEfiPartTypeLegacyMbrGuid ##UNDEFINED
gHandleParsingHiiGuid ##UNDEFINED
+ gEfiAdapterInfoMediaStateGuid ##SOMETIMES CONSUMES
+ gEfiAdapterInfoNetworkBootGuid ##SOMETIMES CONSUMES
+ gEfiAdapterInfoSanMacAddressGuid ##SOMETIMES CONSUMES
[Pcd.common]
gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize ##CONSUMES
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
index 36acfb10b2..364fd9c483 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
Binary files differ
diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
index a009609ffc..48739e20fd 100644
--- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
+++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
@@ -14,6 +14,8 @@
#include "UefiShellCommandLib.h"
#include <Library/DevicePathLib.h>
#include <Library/SortLib.h>
+#include <Library/UefiLib.h>
+#include <Protocol/UsbIo.h>
typedef enum {
MTDTypeUnknown,
@@ -40,10 +42,12 @@ typedef struct {
CHAR16 *Name;
} MTD_NAME;
+typedef VOID (EFIAPI *SerialDecodeFucntion) (EFI_DEVICE_PATH_PROTOCOL *DevPath, DEVICE_CONSIST_MAPPING_INFO *MapInfo,EFI_DEVICE_PATH_PROTOCOL *);
+
typedef struct {
UINT8 Type;
UINT8 SubType;
- VOID (EFIAPI *SerialFun) (EFI_DEVICE_PATH_PROTOCOL *DevPath, DEVICE_CONSIST_MAPPING_INFO *MapInfo);
+ SerialDecodeFucntion SerialFun;
INTN (EFIAPI *CompareFun) (EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2);
} DEV_PATH_CONSIST_MAPPING_TABLE;
@@ -427,7 +431,8 @@ VOID
EFIAPI
DevPathSerialHardDrive (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
HARDDRIVE_DEVICE_PATH *Hd;
@@ -453,7 +458,8 @@ VOID
EFIAPI
DevPathSerialAtapi (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
ATAPI_DEVICE_PATH *Atapi;
@@ -475,7 +481,8 @@ VOID
EFIAPI
DevPathSerialCdRom (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
CDROM_DEVICE_PATH *Cd;
@@ -498,7 +505,8 @@ VOID
EFIAPI
DevPathSerialFibre (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
FIBRECHANNEL_DEVICE_PATH *Fibre;
@@ -521,7 +529,8 @@ VOID
EFIAPI
DevPathSerialUart (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
UART_DEVICE_PATH *Uart;
@@ -546,10 +555,16 @@ VOID
EFIAPI
DevPathSerialUsb (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- USB_DEVICE_PATH *Usb;
+ USB_DEVICE_PATH *Usb;
+ EFI_USB_IO_PROTOCOL *UsbIo;
+ EFI_HANDLE TempHandle;
+ EFI_STATUS Status;
+ USB_INTERFACE_DESCRIPTOR InterfaceDesc;
+
ASSERT(DevicePathNode != NULL);
ASSERT(MappingItem != NULL);
@@ -557,6 +572,35 @@ DevPathSerialUsb (
Usb = (USB_DEVICE_PATH *) DevicePathNode;
AppendCSDNum (MappingItem, Usb->ParentPortNumber);
AppendCSDNum (MappingItem, Usb->InterfaceNumber);
+
+ if (PcdGetBool(PcdUsbExtendedDecode)) {
+ Status = gBS->LocateDevicePath( &gEfiUsbIoProtocolGuid, &DevicePath, &TempHandle );
+ UsbIo = NULL;
+ if (!EFI_ERROR(Status)) {
+ Status = gBS->OpenProtocol(TempHandle, &gEfiUsbIoProtocolGuid, (VOID**)&UsbIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ }
+
+ if (!EFI_ERROR(Status)) {
+ ASSERT(UsbIo != NULL);
+ Status = UsbIo->UsbGetInterfaceDescriptor(UsbIo, &InterfaceDesc);
+ if (!EFI_ERROR(Status)) {
+ if (InterfaceDesc.InterfaceClass == USB_MASS_STORE_CLASS && MappingItem->Mtd == MTDTypeUnknown) {
+ switch (InterfaceDesc.InterfaceSubClass){
+ case USB_MASS_STORE_SCSI:
+ MappingItem->Mtd = MTDTypeHardDisk;
+ break;
+ case USB_MASS_STORE_8070I:
+ case USB_MASS_STORE_UFI:
+ MappingItem->Mtd = MTDTypeFloppy;
+ break;
+ case USB_MASS_STORE_8020I:
+ MappingItem->Mtd = MTDTypeCDRom;
+ break;
+ }
+ }
+ }
+ }
+ }
}
/**
@@ -570,11 +614,15 @@ VOID
EFIAPI
DevPathSerialVendor (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
VENDOR_DEVICE_PATH *Vendor;
SAS_DEVICE_PATH *Sas;
+ UINTN TargetNameLength;
+ UINTN Index;
+ CHAR16 *Buffer;
if (DevicePathNode == NULL || MappingItem == NULL) {
return;
@@ -589,6 +637,32 @@ DevPathSerialVendor (
AppendCSDNum (MappingItem, Sas->Lun);
AppendCSDNum (MappingItem, Sas->DeviceTopology);
AppendCSDNum (MappingItem, Sas->RelativeTargetPort);
+ } else {
+ TargetNameLength = MIN(DevicePathNodeLength (DevicePathNode) - sizeof (VENDOR_DEVICE_PATH), PcdGet32(PcdShellVendorExtendedDecode));
+ if (TargetNameLength != 0) {
+ //
+ // String is 2 chars per data byte, plus NULL terminator
+ //
+ Buffer = AllocateZeroPool (((TargetNameLength * 2) + 1) * sizeof(CHAR16));
+ ASSERT(Buffer != NULL);
+ if (Buffer == NULL) {
+ return;
+ }
+
+ //
+ // Build the string data
+ //
+ for (Index = 0; Index < TargetNameLength; Index++) {
+ Buffer = CatSPrint (Buffer, L"%02x", *((UINT8*)Vendor + sizeof (VENDOR_DEVICE_PATH) + Index));
+}
+
+ //
+ // Append the new data block
+ //
+ AppendCSDStr (MappingItem, Buffer);
+
+ FreePool(Buffer);
+ }
}
}
@@ -602,7 +676,8 @@ VOID
EFIAPI
DevPathSerialLun (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
DEVICE_LOGICAL_UNIT_DEVICE_PATH *Lun;
@@ -624,7 +699,8 @@ VOID
EFIAPI
DevPathSerialSata (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
SATA_DEVICE_PATH *Sata;
@@ -648,16 +724,10 @@ VOID
EFIAPI
DevPathSerialIScsi (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
-///@todo make this a PCD
-//
-// As Csd of ISCSI node is quite long, we comment
-// the code below to keep the consistent mapping
-// short. Uncomment if you really need it.
-//
-/*
ISCSI_DEVICE_PATH *IScsi;
UINT8 *IScsiTargetName;
CHAR16 *TargetName;
@@ -667,24 +737,25 @@ DevPathSerialIScsi (
ASSERT(DevicePathNode != NULL);
ASSERT(MappingItem != NULL);
- IScsi = (ISCSI_DEVICE_PATH *) DevicePathNode;
- AppendCSDNum (MappingItem, IScsi->NetworkProtocol);
- AppendCSDNum (MappingItem, IScsi->LoginOption);
- AppendCSDNum (MappingItem, IScsi->Lun);
- AppendCSDNum (MappingItem, IScsi->TargetPortalGroupTag);
- TargetNameLength = DevicePathNodeLength (DevicePathNode) - sizeof (ISCSI_DEVICE_PATH);
- if (TargetNameLength > 0) {
- TargetName = AllocateZeroPool ((TargetNameLength + 1) * sizeof (CHAR16));
- if (TargetName != NULL) {
- IScsiTargetName = (UINT8 *) (IScsi + 1);
- for (Index = 0; Index < TargetNameLength; Index++) {
- TargetName[Index] = (CHAR16) IScsiTargetName[Index];
+ if (PcdGetBool(PcdShellDecodeIScsiMapNames)) {
+ IScsi = (ISCSI_DEVICE_PATH *) DevicePathNode;
+ AppendCSDNum (MappingItem, IScsi->NetworkProtocol);
+ AppendCSDNum (MappingItem, IScsi->LoginOption);
+ AppendCSDNum (MappingItem, IScsi->Lun);
+ AppendCSDNum (MappingItem, IScsi->TargetPortalGroupTag);
+ TargetNameLength = DevicePathNodeLength (DevicePathNode) - sizeof (ISCSI_DEVICE_PATH);
+ if (TargetNameLength > 0) {
+ TargetName = AllocateZeroPool ((TargetNameLength + 1) * sizeof (CHAR16));
+ if (TargetName != NULL) {
+ IScsiTargetName = (UINT8 *) (IScsi + 1);
+ for (Index = 0; Index < TargetNameLength; Index++) {
+ TargetName[Index] = (CHAR16) IScsiTargetName[Index];
+ }
+ AppendCSDStr (MappingItem, TargetName);
+ FreePool (TargetName);
}
- AppendCSDStr (MappingItem, TargetName);
- FreePool (TargetName);
}
}
- */
}
/**
@@ -697,7 +768,8 @@ VOID
EFIAPI
DevPathSerialI2O (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
I2O_DEVICE_PATH *DevicePath_I20;
@@ -719,7 +791,8 @@ VOID
EFIAPI
DevPathSerialMacAddr (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
MAC_ADDR_DEVICE_PATH *Mac;
@@ -755,7 +828,8 @@ VOID
EFIAPI
DevPathSerialInfiniBand (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
INFINIBAND_DEVICE_PATH *InfiniBand;
@@ -787,7 +861,8 @@ VOID
EFIAPI
DevPathSerialIPv4 (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
IPv4_DEVICE_PATH *Ip;
@@ -831,7 +906,8 @@ VOID
EFIAPI
DevPathSerialIPv6 (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
IPv6_DEVICE_PATH *Ip;
@@ -867,7 +943,8 @@ VOID
EFIAPI
DevPathSerialScsi (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
SCSI_DEVICE_PATH *Scsi;
@@ -890,7 +967,8 @@ VOID
EFIAPI
DevPathSerial1394 (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
F1394_DEVICE_PATH *DevicePath_F1394;
@@ -914,7 +992,8 @@ VOID
EFIAPI
DevPathSerialAcpi (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
ACPI_HID_DEVICE_PATH *Acpi;
@@ -943,7 +1022,8 @@ VOID
EFIAPI
DevPathSerialDefault (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN DEVICE_CONSIST_MAPPING_INFO *MappingItem
+ IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
return;
@@ -1185,21 +1265,22 @@ GetDeviceConsistMappingInfo (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- VOID (EFIAPI *SerialFun) (EFI_DEVICE_PATH_PROTOCOL *, DEVICE_CONSIST_MAPPING_INFO *);
-
- UINTN Index;
+ SerialDecodeFucntion SerialFun;
+ UINTN Index;
+ EFI_DEVICE_PATH_PROTOCOL *OriginalDevicePath;
ASSERT(DevicePath != NULL);
ASSERT(MappingItem != NULL);
SetMem (&MappingItem->Csd, sizeof (POOL_PRINT), 0);
+ OriginalDevicePath = DevicePath;
while (!IsDevicePathEnd (DevicePath)) {
//
- // Find the handler to dump this device path node
+ // Find the handler to dump this device path node and
+ // initialize with generic function in case nothing is found
//
- SerialFun = NULL;
- for (Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) {
+ for (SerialFun = DevPathSerialDefault, Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) {
if (DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type &&
DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType
@@ -1208,14 +1289,8 @@ GetDeviceConsistMappingInfo (
break;
}
}
- //
- // If not found, use a generic function
- //
- if (!SerialFun) {
- SerialFun = DevPathSerialDefault;
- }
- SerialFun (DevicePath, MappingItem);
+ SerialFun (DevicePath, MappingItem, OriginalDevicePath);
//
// Next device path node
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
index d3a2056405..38df3b31f7 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -53,6 +53,7 @@
gEfiShellProtocolGuid # ALWAYS_CONSUMED
gEfiShellParametersProtocolGuid # ALWAYS_CONSUMED
gEfiShellDynamicCommandProtocolGuid # SOMETIMES_CONSUMED
+ gEfiUsbIoProtocolGuid ## SOMETIMES_CONSUMED
[Guids]
gEfiSasDevicePathGuid # ALWAYS_CONSUMED
@@ -60,6 +61,9 @@
[Pcd.common]
gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## ALWAYS_CONSUMED
gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength ## ALWAYS_CONSUMED
+ gEfiShellPkgTokenSpaceGuid.PcdUsbExtendedDecode ## SOMETIMES_CONSUMED
+ gEfiShellPkgTokenSpaceGuid.PcdShellDecodeIScsiMapNames ## SOMETIMES_CONSUMED
+ gEfiShellPkgTokenSpaceGuid.PcdShellVendorExtendedDecode ## SOMETIMES_CONSUMED
[Depex]
gEfiUnicodeCollation2ProtocolGuid
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c
index 3b7a04f7a0..aae2834a5a 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c
@@ -92,7 +92,7 @@ PerformParsing(
if (LoopVariable == TableNameInstance
|| (TableNameInstance == (UINTN)-1)) {
for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer != NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) {
- ColumnPointer = StrStr (ColumnPointer, L",");
+ ColumnPointer = StrStr (ColumnPointer, L",\"");
if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL){
ColumnPointer++;
}
@@ -102,7 +102,7 @@ PerformParsing(
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"Column Index");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- TempSpot = StrStr (ColumnPointer, L",");
+ TempSpot = StrStr (ColumnPointer, L",\"");
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 4a4c40a928..6cef8b7d4c 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -2078,7 +2078,7 @@ InternalCommandLineParse (
ASSERT(GetItemValue == 0);
break;
}
- } else if (GetItemValue != 0 && !InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, CurrentItemPackage->Type == TypeTimeValue)) {
+ } else if (GetItemValue != 0 && CurrentItemPackage != NULL && !InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, (CONST BOOLEAN)(CurrentItemPackage->Type == TypeTimeValue))) {
ASSERT(CurrentItemPackage != NULL);
//
// get the item VALUE for a previous flag
diff --git a/ShellPkg/ShellPkg.dec b/ShellPkg/ShellPkg.dec
index 90eb08ab85..a99f9a688d 100644
--- a/ShellPkg/ShellPkg.dec
+++ b/ShellPkg/ShellPkg.dec
@@ -128,3 +128,15 @@
## Unicode string of the shell supplier
gEfiShellPkgTokenSpaceGuid.PcdShellSupplier|L"EDK II"|VOID*|0x00000010
+
+ ## Do extended decode of USB for determining media type
+ gEfiShellPkgTokenSpaceGuid.PcdUsbExtendedDecode|TRUE|BOOLEAN|0x00000011
+
+ ## Do iSCSI decode for map names.
+ # This is disabled by default due to the length of generated strings
+ gEfiShellPkgTokenSpaceGuid.PcdShellDecodeIScsiMapNames|FALSE|BOOLEAN|0x00000012
+
+ ## Controls Extended decode for Vendor device path nodes for map names.
+ # Up to this many bytes of vendor specific data will be used. Default is 0
+ # (disabled).
+ gEfiShellPkgTokenSpaceGuid.PcdShellVendorExtendedDecode|0|UINT32|0x00000013