summaryrefslogtreecommitdiff
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorjaben carsey <jaben.carsey@intel.com>2014-11-24 14:50:14 +0000
committerjcarsey <jcarsey@Edk2>2014-11-24 14:50:14 +0000
commitcc4c331207b6556e1aaae2b603e7024d775da812 (patch)
tree40fa1514a859dd5599b828393e1583f72ecf506e /ShellPkg/Library
parent7475d13829e8f2d063553987c0f9d822cc7a1e36 (diff)
downloadedk2-platforms-cc4c331207b6556e1aaae2b603e7024d775da812.tar.xz
ShellPkg: Add optional extended decode for Vendor Device Nodes for consistent map names
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: jaben carsey <jaben.carsey@intel.com> Reviewed-by: Joe Peterson <joe.peterson@intel.com> Reviewed-by: Tapan Shah <tapandshah@hp.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16420 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c30
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf1
2 files changed, 31 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
index 4e03666a46..a42a045d52 100644
--- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
+++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
@@ -14,6 +14,7 @@
#include "UefiShellCommandLib.h"
#include <Library/DevicePathLib.h>
#include <Library/SortLib.h>
+#include <Library/UefiLib.h>
typedef enum {
MTDTypeUnknown,
@@ -575,6 +576,9 @@ DevPathSerialVendor (
{
VENDOR_DEVICE_PATH *Vendor;
SAS_DEVICE_PATH *Sas;
+ UINTN TargetNameLength;
+ UINTN Index;
+ CHAR16 *Buffer;
if (DevicePathNode == NULL || MappingItem == NULL) {
return;
@@ -589,6 +593,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);
+ }
}
}
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
index 5ef82c64d7..6550690713 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
@@ -61,6 +61,7 @@
gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## ALWAYS_CONSUMED
gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength ## ALWAYS_CONSUMED
gEfiShellPkgTokenSpaceGuid.PcdShellDecodeIScsiMapNames ## SOMETIMES_CONSUMED
+ gEfiShellPkgTokenSpaceGuid.PcdShellVendorExtendedDecode ## SOMETIMES_CONSUMED
[Depex]
gEfiUnicodeCollation2ProtocolGuid