* [PATCH 1/2] ShellPkg/driver: Show Image Name in non-SFO mode [not found] <20170809074935.230172-1-ruiyu.ni@intel.com> @ 2017-08-09 7:49 ` Ruiyu Ni 2017-08-10 7:53 ` Ard Biesheuvel 2017-08-09 7:49 ` [PATCH 2/2] ShellPkg/driver: Show "-" " Ruiyu Ni 1 sibling, 1 reply; 4+ messages in thread From: Ruiyu Ni @ 2017-08-09 7:49 UTC (permalink / raw) To: edk2-devel; +Cc: Huajing Li From: Huajing Li <huajing.li@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Huajing Li <huajing.li@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> --- .../Library/UefiShellDriver1CommandsLib/Drivers.c | 99 +++++++++++++++++++++- .../UefiShellDriver1CommandsLib.h | 4 + .../UefiShellDriver1CommandsLib.uni | 2 +- 3 files changed, 100 insertions(+), 5 deletions(-) diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c index ffdef04352..f3c1476872 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c @@ -2,7 +2,7 @@ Main file for Drivers shell Driver1 function. (C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.<BR> - Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2010 - 2017, 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 which accompanies this distribution. The full text of the license may be found at @@ -161,6 +161,92 @@ ReturnDriverVersion( } /** + Get image name from Image Handle. + + @param[in] Handle Image Handle + + @return A pointer to the image name as a string. +**/ +CHAR16 * +GetImageNameFromHandle ( + IN CONST EFI_HANDLE Handle + ) +{ + EFI_STATUS Status; + EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; + EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; + EFI_DEVICE_PATH_PROTOCOL *DevPathNode; + EFI_GUID *NameGuid; + CHAR16 *ImageName; + UINTN BufferSize; + UINT32 AuthenticationStatus; + EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv2; + + LoadedImage = NULL; + DriverBinding = NULL; + ImageName = NULL; + + Status = gBS->OpenProtocol ( + Handle, + &gEfiDriverBindingProtocolGuid, + (VOID **) &DriverBinding, + NULL, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (EFI_ERROR (Status)) { + return NULL; + } + Status = gBS->OpenProtocol ( + DriverBinding->ImageHandle, + &gEfiLoadedImageProtocolGuid, + (VOID**)&LoadedImage, + gImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (!EFI_ERROR (Status)) { + DevPathNode = LoadedImage->FilePath; + if (DevPathNode == NULL) { + return NULL; + } + while (!IsDevicePathEnd (DevPathNode)) { + NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevPathNode); + if (NameGuid != NULL) { + Status = gBS->HandleProtocol ( + LoadedImage->DeviceHandle, + &gEfiFirmwareVolume2ProtocolGuid, + &Fv2 + ); + if (!EFI_ERROR (Status)) { + Status = Fv2->ReadSection ( + Fv2, + NameGuid, + EFI_SECTION_USER_INTERFACE, + 0, + (VOID **)&ImageName, + &BufferSize, + &AuthenticationStatus + ); + if (!EFI_ERROR (Status)) { + break; + } + ImageName = NULL; + } + } + // + // Next device path node + // + DevPathNode = NextDevicePathNode (DevPathNode); + } + if (ImageName == NULL) { + ImageName = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE); + } + } + return ImageName; +} + +/** Function for 'drivers' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @@ -186,6 +272,7 @@ ShellCommandRunDrivers ( CHAR16 *Temp2; CONST CHAR16 *FullDriverName; CHAR16 *TruncatedDriverName; + CHAR16 *ImageName; CHAR16 *FormatString; UINT32 DriverVersion; BOOLEAN DriverConfig; @@ -274,6 +361,7 @@ ShellCommandRunDrivers ( DriverConfig = ReturnDriverConfig(*HandleWalker); DriverDiag = ReturnDriverDiag (*HandleWalker); FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); + ImageName = GetImageNameFromHandle (*HandleWalker); TruncatedDriverName = NULL; if (!SfoFlag && (FullDriverName != NULL)) { @@ -293,15 +381,18 @@ ShellCommandRunDrivers ( DeviceCount, ChildCount, SfoFlag?FullDriverName:TruncatedDriverName, - Temp2==NULL?L"":Temp2 - ); + SfoFlag ? (Temp2 == NULL ? L"" : Temp2) : (ImageName == NULL ? L"" : ImageName) + ); if (TruncatedDriverName != NULL) { FreePool (TruncatedDriverName); } if (Temp2 != NULL) { FreePool(Temp2); } - + if (ImageName != NULL) { + FreePool (ImageName); + } + if (ShellGetExecutionBreakFlag ()) { ShellStatus = SHELL_ABORTED; break; diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h index b061243af7..fa51677aa2 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h @@ -24,6 +24,10 @@ #include <IndustryStandard/Pci.h> +#include <Pi/PiFirmwareVolume.h> +#include <Pi/PiFirmwareFile.h> +#include <Protocol/FirmwareVolume2.h> + #include <Protocol/Shell.h> #include <Protocol/ShellParameters.h> #include <Protocol/DevicePath.h> diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni index 7a3e61e5fc..5ca548d9f6 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni @@ -93,7 +93,7 @@ " T D\r\n" " Y C I\r\n" " P F A\r\n" -"DRV VERSION E G G #D #C DRIVER NAME IMAGE PATH\r\n" +"DRV VERSION E G G #D #C DRIVER NAME IMAGE NAME\r\n" "=== ======== = = = === === =================================== ==========\r\n" #string STR_DRIVERS_ITEM_LINE #language en-US "%H%3x%N %08x %1c %1c %1c %3d %3d %-35s %s\r\n" #string STR_DRIVERS_ITEM_LINE_SFO #language en-US "DriversInfo,"%x","%x","%c","%c","%c","%d","%d","%s","%s"\r\n" -- 2.12.2.windows.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ShellPkg/driver: Show Image Name in non-SFO mode 2017-08-09 7:49 ` [PATCH 1/2] ShellPkg/driver: Show Image Name in non-SFO mode Ruiyu Ni @ 2017-08-10 7:53 ` Ard Biesheuvel 2017-08-10 10:14 ` Leif Lindholm 0 siblings, 1 reply; 4+ messages in thread From: Ard Biesheuvel @ 2017-08-10 7:53 UTC (permalink / raw) To: Ruiyu Ni; +Cc: edk2-devel@lists.01.org, Huajing Li This patch is breaking the GCC build: ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c: In function 'GetImageNameFromHandle': 220:25: error: passing argument 3 of 'gBS->HandleProtocol' from incompatible pointer type [-Werror] 220:25: note: expected 'void **' but argument is of type 'struct EFI_FIRMWARE_VOLUME2_PROTOCOL **' Please fix. Regards, Ard. On 9 August 2017 at 08:49, Ruiyu Ni <ruiyu.ni@intel.com> wrote: > From: Huajing Li <huajing.li@intel.com> > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Huajing Li <huajing.li@intel.com> > Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> > --- > .../Library/UefiShellDriver1CommandsLib/Drivers.c | 99 +++++++++++++++++++++- > .../UefiShellDriver1CommandsLib.h | 4 + > .../UefiShellDriver1CommandsLib.uni | 2 +- > 3 files changed, 100 insertions(+), 5 deletions(-) > > diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c > index ffdef04352..f3c1476872 100644 > --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c > +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c > @@ -2,7 +2,7 @@ > Main file for Drivers shell Driver1 function. > > (C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.<BR> > - Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2010 - 2017, 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 > which accompanies this distribution. The full text of the license may be found at > @@ -161,6 +161,92 @@ ReturnDriverVersion( > } > > /** > + Get image name from Image Handle. > + > + @param[in] Handle Image Handle > + > + @return A pointer to the image name as a string. > +**/ > +CHAR16 * > +GetImageNameFromHandle ( > + IN CONST EFI_HANDLE Handle > + ) > +{ > + EFI_STATUS Status; > + EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; > + EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; > + EFI_DEVICE_PATH_PROTOCOL *DevPathNode; > + EFI_GUID *NameGuid; > + CHAR16 *ImageName; > + UINTN BufferSize; > + UINT32 AuthenticationStatus; > + EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv2; > + > + LoadedImage = NULL; > + DriverBinding = NULL; > + ImageName = NULL; > + > + Status = gBS->OpenProtocol ( > + Handle, > + &gEfiDriverBindingProtocolGuid, > + (VOID **) &DriverBinding, > + NULL, > + NULL, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > + ); > + if (EFI_ERROR (Status)) { > + return NULL; > + } > + Status = gBS->OpenProtocol ( > + DriverBinding->ImageHandle, > + &gEfiLoadedImageProtocolGuid, > + (VOID**)&LoadedImage, > + gImageHandle, > + NULL, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > + ); > + if (!EFI_ERROR (Status)) { > + DevPathNode = LoadedImage->FilePath; > + if (DevPathNode == NULL) { > + return NULL; > + } > + while (!IsDevicePathEnd (DevPathNode)) { > + NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevPathNode); > + if (NameGuid != NULL) { > + Status = gBS->HandleProtocol ( > + LoadedImage->DeviceHandle, > + &gEfiFirmwareVolume2ProtocolGuid, > + &Fv2 > + ); > + if (!EFI_ERROR (Status)) { > + Status = Fv2->ReadSection ( > + Fv2, > + NameGuid, > + EFI_SECTION_USER_INTERFACE, > + 0, > + (VOID **)&ImageName, > + &BufferSize, > + &AuthenticationStatus > + ); > + if (!EFI_ERROR (Status)) { > + break; > + } > + ImageName = NULL; > + } > + } > + // > + // Next device path node > + // > + DevPathNode = NextDevicePathNode (DevPathNode); > + } > + if (ImageName == NULL) { > + ImageName = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE); > + } > + } > + return ImageName; > +} > + > +/** > Function for 'drivers' command. > > @param[in] ImageHandle Handle to the Image (NULL if Internal). > @@ -186,6 +272,7 @@ ShellCommandRunDrivers ( > CHAR16 *Temp2; > CONST CHAR16 *FullDriverName; > CHAR16 *TruncatedDriverName; > + CHAR16 *ImageName; > CHAR16 *FormatString; > UINT32 DriverVersion; > BOOLEAN DriverConfig; > @@ -274,6 +361,7 @@ ShellCommandRunDrivers ( > DriverConfig = ReturnDriverConfig(*HandleWalker); > DriverDiag = ReturnDriverDiag (*HandleWalker); > FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); > + ImageName = GetImageNameFromHandle (*HandleWalker); > > TruncatedDriverName = NULL; > if (!SfoFlag && (FullDriverName != NULL)) { > @@ -293,15 +381,18 @@ ShellCommandRunDrivers ( > DeviceCount, > ChildCount, > SfoFlag?FullDriverName:TruncatedDriverName, > - Temp2==NULL?L"":Temp2 > - ); > + SfoFlag ? (Temp2 == NULL ? L"" : Temp2) : (ImageName == NULL ? L"" : ImageName) > + ); > if (TruncatedDriverName != NULL) { > FreePool (TruncatedDriverName); > } > if (Temp2 != NULL) { > FreePool(Temp2); > } > - > + if (ImageName != NULL) { > + FreePool (ImageName); > + } > + > if (ShellGetExecutionBreakFlag ()) { > ShellStatus = SHELL_ABORTED; > break; > diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h > index b061243af7..fa51677aa2 100644 > --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h > +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h > @@ -24,6 +24,10 @@ > > #include <IndustryStandard/Pci.h> > > +#include <Pi/PiFirmwareVolume.h> > +#include <Pi/PiFirmwareFile.h> > +#include <Protocol/FirmwareVolume2.h> > + > #include <Protocol/Shell.h> > #include <Protocol/ShellParameters.h> > #include <Protocol/DevicePath.h> > diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni > index 7a3e61e5fc..5ca548d9f6 100644 > --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni > +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni > @@ -93,7 +93,7 @@ > " T D\r\n" > " Y C I\r\n" > " P F A\r\n" > -"DRV VERSION E G G #D #C DRIVER NAME IMAGE PATH\r\n" > +"DRV VERSION E G G #D #C DRIVER NAME IMAGE NAME\r\n" > "=== ======== = = = === === =================================== ==========\r\n" > #string STR_DRIVERS_ITEM_LINE #language en-US "%H%3x%N %08x %1c %1c %1c %3d %3d %-35s %s\r\n" > #string STR_DRIVERS_ITEM_LINE_SFO #language en-US "DriversInfo,"%x","%x","%c","%c","%c","%d","%d","%s","%s"\r\n" > -- > 2.12.2.windows.2 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ShellPkg/driver: Show Image Name in non-SFO mode 2017-08-10 7:53 ` Ard Biesheuvel @ 2017-08-10 10:14 ` Leif Lindholm 0 siblings, 0 replies; 4+ messages in thread From: Leif Lindholm @ 2017-08-10 10:14 UTC (permalink / raw) To: Ruiyu Ni; +Cc: edk2-devel@lists.01.org, Huajing Li, Ard Biesheuvel At a quick glance, the fix should probably be diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c index 4d876bb108..26b785c563 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c @@ -216,7 +216,7 @@ GetImageNameFromHandle ( Status = gBS->HandleProtocol ( LoadedImage->DeviceHandle, &gEfiFirmwareVolume2ProtocolGuid, - &Fv2 + (VOID **)&Fv2 ); if (!EFI_ERROR (Status)) { Status = Fv2->ReadSection ( / Leif On Thu, Aug 10, 2017 at 08:53:11AM +0100, Ard Biesheuvel wrote: > This patch is breaking the GCC build: > > ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c: > In function 'GetImageNameFromHandle': > 220:25: error: passing argument 3 of 'gBS->HandleProtocol' from > incompatible pointer type [-Werror] > 220:25: note: expected 'void **' but argument is of type 'struct > EFI_FIRMWARE_VOLUME2_PROTOCOL **' > > Please fix. > > Regards, > Ard. > > > On 9 August 2017 at 08:49, Ruiyu Ni <ruiyu.ni@intel.com> wrote: > > From: Huajing Li <huajing.li@intel.com> > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Huajing Li <huajing.li@intel.com> > > Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> > > --- > > .../Library/UefiShellDriver1CommandsLib/Drivers.c | 99 +++++++++++++++++++++- > > .../UefiShellDriver1CommandsLib.h | 4 + > > .../UefiShellDriver1CommandsLib.uni | 2 +- > > 3 files changed, 100 insertions(+), 5 deletions(-) > > > > diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c > > index ffdef04352..f3c1476872 100644 > > --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c > > +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c > > @@ -2,7 +2,7 @@ > > Main file for Drivers shell Driver1 function. > > > > (C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.<BR> > > - Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR> > > + Copyright (c) 2010 - 2017, 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 > > which accompanies this distribution. The full text of the license may be found at > > @@ -161,6 +161,92 @@ ReturnDriverVersion( > > } > > > > /** > > + Get image name from Image Handle. > > + > > + @param[in] Handle Image Handle > > + > > + @return A pointer to the image name as a string. > > +**/ > > +CHAR16 * > > +GetImageNameFromHandle ( > > + IN CONST EFI_HANDLE Handle > > + ) > > +{ > > + EFI_STATUS Status; > > + EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; > > + EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; > > + EFI_DEVICE_PATH_PROTOCOL *DevPathNode; > > + EFI_GUID *NameGuid; > > + CHAR16 *ImageName; > > + UINTN BufferSize; > > + UINT32 AuthenticationStatus; > > + EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv2; > > + > > + LoadedImage = NULL; > > + DriverBinding = NULL; > > + ImageName = NULL; > > + > > + Status = gBS->OpenProtocol ( > > + Handle, > > + &gEfiDriverBindingProtocolGuid, > > + (VOID **) &DriverBinding, > > + NULL, > > + NULL, > > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > > + ); > > + if (EFI_ERROR (Status)) { > > + return NULL; > > + } > > + Status = gBS->OpenProtocol ( > > + DriverBinding->ImageHandle, > > + &gEfiLoadedImageProtocolGuid, > > + (VOID**)&LoadedImage, > > + gImageHandle, > > + NULL, > > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > > + ); > > + if (!EFI_ERROR (Status)) { > > + DevPathNode = LoadedImage->FilePath; > > + if (DevPathNode == NULL) { > > + return NULL; > > + } > > + while (!IsDevicePathEnd (DevPathNode)) { > > + NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevPathNode); > > + if (NameGuid != NULL) { > > + Status = gBS->HandleProtocol ( > > + LoadedImage->DeviceHandle, > > + &gEfiFirmwareVolume2ProtocolGuid, > > + &Fv2 > > + ); > > + if (!EFI_ERROR (Status)) { > > + Status = Fv2->ReadSection ( > > + Fv2, > > + NameGuid, > > + EFI_SECTION_USER_INTERFACE, > > + 0, > > + (VOID **)&ImageName, > > + &BufferSize, > > + &AuthenticationStatus > > + ); > > + if (!EFI_ERROR (Status)) { > > + break; > > + } > > + ImageName = NULL; > > + } > > + } > > + // > > + // Next device path node > > + // > > + DevPathNode = NextDevicePathNode (DevPathNode); > > + } > > + if (ImageName == NULL) { > > + ImageName = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE); > > + } > > + } > > + return ImageName; > > +} > > + > > +/** > > Function for 'drivers' command. > > > > @param[in] ImageHandle Handle to the Image (NULL if Internal). > > @@ -186,6 +272,7 @@ ShellCommandRunDrivers ( > > CHAR16 *Temp2; > > CONST CHAR16 *FullDriverName; > > CHAR16 *TruncatedDriverName; > > + CHAR16 *ImageName; > > CHAR16 *FormatString; > > UINT32 DriverVersion; > > BOOLEAN DriverConfig; > > @@ -274,6 +361,7 @@ ShellCommandRunDrivers ( > > DriverConfig = ReturnDriverConfig(*HandleWalker); > > DriverDiag = ReturnDriverDiag (*HandleWalker); > > FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); > > + ImageName = GetImageNameFromHandle (*HandleWalker); > > > > TruncatedDriverName = NULL; > > if (!SfoFlag && (FullDriverName != NULL)) { > > @@ -293,15 +381,18 @@ ShellCommandRunDrivers ( > > DeviceCount, > > ChildCount, > > SfoFlag?FullDriverName:TruncatedDriverName, > > - Temp2==NULL?L"":Temp2 > > - ); > > + SfoFlag ? (Temp2 == NULL ? L"" : Temp2) : (ImageName == NULL ? L"" : ImageName) > > + ); > > if (TruncatedDriverName != NULL) { > > FreePool (TruncatedDriverName); > > } > > if (Temp2 != NULL) { > > FreePool(Temp2); > > } > > - > > + if (ImageName != NULL) { > > + FreePool (ImageName); > > + } > > + > > if (ShellGetExecutionBreakFlag ()) { > > ShellStatus = SHELL_ABORTED; > > break; > > diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h > > index b061243af7..fa51677aa2 100644 > > --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h > > +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h > > @@ -24,6 +24,10 @@ > > > > #include <IndustryStandard/Pci.h> > > > > +#include <Pi/PiFirmwareVolume.h> > > +#include <Pi/PiFirmwareFile.h> > > +#include <Protocol/FirmwareVolume2.h> > > + > > #include <Protocol/Shell.h> > > #include <Protocol/ShellParameters.h> > > #include <Protocol/DevicePath.h> > > diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni > > index 7a3e61e5fc..5ca548d9f6 100644 > > --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni > > +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni > > @@ -93,7 +93,7 @@ > > " T D\r\n" > > " Y C I\r\n" > > " P F A\r\n" > > -"DRV VERSION E G G #D #C DRIVER NAME IMAGE PATH\r\n" > > +"DRV VERSION E G G #D #C DRIVER NAME IMAGE NAME\r\n" > > "=== ======== = = = === === =================================== ==========\r\n" > > #string STR_DRIVERS_ITEM_LINE #language en-US "%H%3x%N %08x %1c %1c %1c %3d %3d %-35s %s\r\n" > > #string STR_DRIVERS_ITEM_LINE_SFO #language en-US "DriversInfo,"%x","%x","%c","%c","%c","%d","%d","%s","%s"\r\n" > > -- > > 2.12.2.windows.2 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ShellPkg/driver: Show "-" in non-SFO mode [not found] <20170809074935.230172-1-ruiyu.ni@intel.com> 2017-08-09 7:49 ` [PATCH 1/2] ShellPkg/driver: Show Image Name in non-SFO mode Ruiyu Ni @ 2017-08-09 7:49 ` Ruiyu Ni 1 sibling, 0 replies; 4+ messages in thread From: Ruiyu Ni @ 2017-08-09 7:49 UTC (permalink / raw) To: edk2-devel; +Cc: Huajing Li From: Huajing Li <huajing.li@intel.com> The patch shows "X"/"-" instead of "Y"/"N" in column "CFG" and "DIAG". The patch shows "-" instead of "0" in column "#D" and "#C". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Huajing Li <huajing.li@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> --- .../Library/UefiShellDriver1CommandsLib/Drivers.c | 49 +++++++++++++++------- .../UefiShellDriver1CommandsLib.uni | 12 +++--- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c index f3c1476872..4d876bb108 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c @@ -269,6 +269,8 @@ ShellCommandRunDrivers ( EFI_HANDLE *HandleWalker; UINTN ChildCount; UINTN DeviceCount; + CHAR16 ChildCountStr[3]; + CHAR16 DeviceCountStr[3]; CHAR16 *Temp2; CONST CHAR16 *FullDriverName; CHAR16 *TruncatedDriverName; @@ -363,26 +365,45 @@ ShellCommandRunDrivers ( FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); ImageName = GetImageNameFromHandle (*HandleWalker); + UnicodeValueToStringS (ChildCountStr, sizeof (ChildCountStr), 0, ChildCount, 0); + UnicodeValueToStringS (DeviceCountStr, sizeof (DeviceCountStr), 0, DeviceCount, 0); TruncatedDriverName = NULL; if (!SfoFlag && (FullDriverName != NULL)) { TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16)); StrnCpyS (TruncatedDriverName, MAX_LEN_DRIVER_NAME + 1, FullDriverName, MAX_LEN_DRIVER_NAME); } - ShellPrintEx( - -1, - -1, - FormatString, - ConvertHandleToHandleIndex(*HandleWalker), - DriverVersion, - ChildCount > 0?L'B':(DeviceCount > 0?L'D':L'?'), - DriverConfig?L'Y':L'N', - DriverDiag?L'Y':L'N', - DeviceCount, - ChildCount, - SfoFlag?FullDriverName:TruncatedDriverName, - SfoFlag ? (Temp2 == NULL ? L"" : Temp2) : (ImageName == NULL ? L"" : ImageName) - ); + if (!SfoFlag) { + ShellPrintEx ( + -1, + -1, + FormatString, + ConvertHandleToHandleIndex (*HandleWalker), + DriverVersion, + ChildCount > 0 ? L'B' : (DeviceCount > 0 ? L'D' : L'?'), + DriverConfig ? L'X' : L'-', + DriverDiag ? L'X' : L'-', + DeviceCount > 0 ? DeviceCountStr : L"-", + ChildCount > 0 ? ChildCountStr : L"-", + TruncatedDriverName, + ImageName == NULL ? L"" : ImageName + ); + } else { + ShellPrintEx ( + -1, + -1, + FormatString, + ConvertHandleToHandleIndex (*HandleWalker), + DriverVersion, + ChildCount > 0 ? L'B' : (DeviceCount > 0 ? L'D' : L'?'), + DriverConfig ? L'Y' : L'N', + DriverDiag ? L'Y' : L'N', + DeviceCount, + ChildCount, + FullDriverName, + Temp2 == NULL ? L"" : Temp2 + ); + } if (TruncatedDriverName != NULL) { FreePool (TruncatedDriverName); } diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni index 5ca548d9f6..05101f3782 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni @@ -90,12 +90,12 @@ #string STR_DEVICES_ITEM_LINE_SFO #language en-US "DevicesInfo,"%x","%c","%c","%c","%d","%d","%d","%s"\r\n" #string STR_DRIVERS_HEADER_LINES #language en-US "%N" -" T D\r\n" -" Y C I\r\n" -" P F A\r\n" -"DRV VERSION E G G #D #C DRIVER NAME IMAGE NAME\r\n" -"=== ======== = = = === === =================================== ==========\r\n" -#string STR_DRIVERS_ITEM_LINE #language en-US "%H%3x%N %08x %1c %1c %1c %3d %3d %-35s %s\r\n" +"%H T D%N\r\n" +"%HD Y C I%N\r\n" +"%HR P F A%N\r\n" +"%HV VERSION E G G #D #C DRIVER NAME IMAGE NAME%N\r\n" +"== ======== = = = == == =================================== ==========\r\n" +#string STR_DRIVERS_ITEM_LINE #language en-US "%H%2x%N %08x %1c %1c %1c %2s %2s %-35s %s\r\n" #string STR_DRIVERS_ITEM_LINE_SFO #language en-US "DriversInfo,"%x","%x","%c","%c","%c","%d","%d","%s","%s"\r\n" #string STR_DH_OUTPUT_DECODE #language en-US "%s: %g\r\n" -- 2.12.2.windows.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-10 10:12 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20170809074935.230172-1-ruiyu.ni@intel.com> 2017-08-09 7:49 ` [PATCH 1/2] ShellPkg/driver: Show Image Name in non-SFO mode Ruiyu Ni 2017-08-10 7:53 ` Ard Biesheuvel 2017-08-10 10:14 ` Leif Lindholm 2017-08-09 7:49 ` [PATCH 2/2] ShellPkg/driver: Show "-" " Ruiyu Ni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox