diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c index fe314f70f8..7dff549548 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c @@ -1,6 +1,7 @@ /** @file Main file for Drivers shell Driver1 function. + (C) Copyright 2012-2014, Hewlett-Packard Development Company, L.P. Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -14,6 +15,8 @@ #include "UefiShellDriver1CommandsLib.h" +#define MAX_LEN_DRIVER_NAME 35 + STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {L"-sfo", TypeFlag}, {L"-l", TypeValue}, @@ -185,15 +188,19 @@ ShellCommandRunDrivers ( UINTN ChildCount; UINTN DeviceCount; CHAR16 *Temp2; + CONST CHAR16 *FullDriverName; + CHAR16 *TruncatedDriverName; CHAR16 *FormatString; UINT32 DriverVersion; BOOLEAN DriverConfig; BOOLEAN DriverDiag; + BOOLEAN SfoFlag; ShellStatus = SHELL_SUCCESS; Status = EFI_SUCCESS; Language = NULL; FormatString = NULL; + SfoFlag = FALSE; // // initialize the shell lib (we must be in non-auto-init...) @@ -234,10 +241,21 @@ ShellCommandRunDrivers ( } } - if (ShellCommandLineGetFlag(Package, L"-sfo")) { - FormatString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN(STR_DRIVERS_ITEM_LINE_SFO), Language); + if (ShellCommandLineGetFlag (Package, L"-sfo")) { + SfoFlag = TRUE; + FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE_SFO), Language); + // + // print the SFO header + // + ShellPrintHiiEx ( + -1, + -1, + Language, + STRING_TOKEN (STR_GEN_SFO_HEADER), + gShellDriver1HiiHandle, + L"drivers"); } else { - FormatString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN(STR_DRIVERS_ITEM_LINE), Language); + FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language); // // print the header row // @@ -245,21 +263,27 @@ ShellCommandRunDrivers ( -1, -1, Language, - STRING_TOKEN(STR_DRIVERS_HEADER_LINES), + STRING_TOKEN (STR_DRIVERS_HEADER_LINES), gShellDriver1HiiHandle); } HandleList = GetHandleListByProtocol(&gEfiDriverBindingProtocolGuid); for (HandleWalker = HandleList ; HandleWalker != NULL && *HandleWalker != NULL ; HandleWalker++){ - ChildCount = 0; - DeviceCount = 0; - Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL); - Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL); - Temp2 = GetDevicePathTextForHandle(*HandleWalker); - DriverVersion = ReturnDriverVersion(*HandleWalker); - DriverConfig = ReturnDriverConfig(*HandleWalker); - DriverDiag = ReturnDriverDiag (*HandleWalker); - Lang = GetStringNameFromHandle(*HandleWalker, Language); + ChildCount = 0; + DeviceCount = 0; + Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL); + Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL); + Temp2 = GetDevicePathTextForHandle(*HandleWalker); + DriverVersion = ReturnDriverVersion(*HandleWalker); + DriverConfig = ReturnDriverConfig(*HandleWalker); + DriverDiag = ReturnDriverDiag (*HandleWalker); + FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); + + TruncatedDriverName = NULL; + if (!SfoFlag && (FullDriverName != NULL)) { + TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16)); + StrnCpy (TruncatedDriverName, FullDriverName, MAX_LEN_DRIVER_NAME); + } ShellPrintEx( -1, @@ -272,9 +296,12 @@ ShellCommandRunDrivers ( DriverDiag?L'Y':L'N', DeviceCount, ChildCount, - Lang, + SfoFlag?FullDriverName:TruncatedDriverName, Temp2==NULL?L"":Temp2 ); + if (TruncatedDriverName != NULL) { + FreePool (TruncatedDriverName); + } if (Temp2 != NULL) { FreePool(Temp2); } diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni index a7c787e01b..5655a4bf25 100644 Binary files a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni and b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni differ