Revision: 16420
          http://sourceforge.net/p/edk2/code/16420
Author:   jcarsey
Date:     2014-11-24 14:50:14 +0000 (Mon, 24 Nov 2014)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Joe Peterson <[email protected]>
Reviewed-by: Tapan Shah <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
    trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
    trunk/edk2/ShellPkg/ShellPkg.dec

Modified: trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c    
2014-11-24 04:57:40 UTC (rev 16419)
+++ trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c    
2014-11-24 14:50:14 UTC (rev 16420)
@@ -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 @@
 {
   VENDOR_DEVICE_PATH  *Vendor;
   SAS_DEVICE_PATH     *Sas;
+  UINTN               TargetNameLength;
+  UINTN               Index;
+  CHAR16              *Buffer;
 
   if (DevicePathNode == NULL || MappingItem == NULL) {
     return;
@@ -589,6 +593,32 @@
     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);
+    }
   }
 }
 

Modified: 
trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf     
2014-11-24 04:57:40 UTC (rev 16419)
+++ trunk/edk2/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf     
2014-11-24 14:50:14 UTC (rev 16420)
@@ -61,6 +61,7 @@
   gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel         ## ALWAYS_CONSUMED
   gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength        ## ALWAYS_CONSUMED
   gEfiShellPkgTokenSpaceGuid.PcdShellDecodeIScsiMapNames  ## SOMETIMES_CONSUMED
+  gEfiShellPkgTokenSpaceGuid.PcdShellVendorExtendedDecode ## SOMETIMES_CONSUMED
 
 [Depex]
   gEfiUnicodeCollation2ProtocolGuid

Modified: trunk/edk2/ShellPkg/ShellPkg.dec
===================================================================
--- trunk/edk2/ShellPkg/ShellPkg.dec    2014-11-24 04:57:40 UTC (rev 16419)
+++ trunk/edk2/ShellPkg/ShellPkg.dec    2014-11-24 14:50:14 UTC (rev 16420)
@@ -132,3 +132,8 @@
   ## 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


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to