diff options
author | Huajing Li <huajing.li@intel.com> | 2017-09-21 15:44:40 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2017-09-25 08:32:18 +0800 |
commit | 24ac68ef2097a35e27bc1a69a907364fdecc31a0 (patch) | |
tree | 1aec454a0880225bbc83b9efc5ad13806281ff2b /ShellPkg/Library | |
parent | d772f5f30227c55fd7b252e3c0f1432f3ba76f48 (diff) | |
download | edk2-24ac68ef2097a35e27bc1a69a907364fdecc31a0.tar.gz |
ShellPkg/dh: Modify the dump of BlockIo protocol
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r-- | ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 80 | ||||
-rw-r--r-- | ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni | 1 |
2 files changed, 80 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index ce2b49b5a2..fb67197171 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -1017,6 +1017,84 @@ BusSpecificDriverOverrideProtocolDumpInformation ( }
/**
+ Function to dump information about BlockIo protocol.
+
+ This will allocate the return buffer from boot services pool.
+
+ @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
+BlockIoProtocolDumpInformation (
+ IN CONST EFI_HANDLE TheHandle,
+ IN CONST BOOLEAN Verbose
+ )
+{
+ EFI_STATUS Status;
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;
+ EFI_BLOCK_IO_MEDIA *BlockMedia;
+ CHAR16 *GetString;
+ CHAR16 *RetVal;
+
+ if (!Verbose) {
+ return NULL;
+ }
+ GetString = NULL;
+ RetVal = NULL;
+
+ Status = gBS->OpenProtocol (
+ TheHandle,
+ &gEfiBlockIoProtocolGuid,
+ (VOID**)&BlockIo,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ BlockMedia = BlockIo->Media;
+ //
+ // Per spec:
+ // The function (ReadBlocks) must return EFI_NO_MEDIA or
+ // EFI_MEDIA_CHANGED even if LBA, BufferSize, or Buffer are invalid so the caller can probe
+ // for changes in media state.
+ //
+ BlockIo->ReadBlocks (
+ BlockIo,
+ BlockIo->Media->MediaId,
+ 0,
+ 0,
+ NULL
+ );
+
+ HandleParsingHiiInit ();
+ GetString = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_BLOCKIO_INFO), NULL);
+ if (GetString == NULL) {
+ return NULL;
+ }
+ RetVal = CatSPrint (
+ RetVal,
+ GetString,
+ BlockMedia->RemovableMedia ? L"Removable " : L"Fixed ",
+ BlockMedia->MediaPresent ? L"" : L"not-present ",
+ BlockMedia->MediaId,
+ BlockMedia->BlockSize,
+ BlockMedia->LastBlock,
+ MultU64x32 (BlockMedia->LastBlock + 1, BlockMedia->BlockSize),
+ BlockMedia->LogicalPartition ? L"partition" : L"raw",
+ BlockMedia->ReadOnly ? L"ro" : L"rw",
+ BlockMedia->WriteCaching ? L"cached" : L"!cached"
+ );
+
+ SHELL_FREE_NON_NULL (GetString);
+ return RetVal;
+}
+
+/**
Function to dump information about EfiAdapterInformation Protocol.
@param[in] TheHandle The handle that has the protocol installed.
@@ -1727,7 +1805,7 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { {STRING_TOKEN(STR_SIMPLE_FILE_SYS), &gEfiSimpleFileSystemProtocolGuid, NULL},
{STRING_TOKEN(STR_TAPE_IO), &gEfiTapeIoProtocolGuid, NULL},
{STRING_TOKEN(STR_DISK_IO), &gEfiDiskIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_BLK_IO), &gEfiBlockIoProtocolGuid, NULL},
+ {STRING_TOKEN(STR_BLK_IO), &gEfiBlockIoProtocolGuid, BlockIoProtocolDumpInformation},
{STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL},
{STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL},
{STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation},
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index 3f9fc9cbac..eeb6aded6f 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni @@ -335,6 +335,7 @@ #string STR_IDE_CONT_INIT #language en-US "IdeControllerInit"
#string STR_DISK_INFO #language en-US "DiskInfo"
+#string STR_BLOCKIO_INFO #language en-US " %s%sMId:%%H%x%%N bsize %%H%x%%N, lblock %lx (%,ld), %s %s %s"
#string STR_PCIRB_DUMP_PH #language en-US " ParentHandle..: %H%x%N\r\n"
#string STR_PCIRB_DUMP_SEG #language en-US " Segment #.....: %H%x%N\r\n"
|