ShellPkg/driver: Show "-" in non-SFO mode

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>
This commit is contained in:
Huajing Li 2017-08-07 15:51:43 +08:00 committed by Ruiyu Ni
parent 416d48f755
commit d506d8db71
2 changed files with 41 additions and 20 deletions

View File

@ -269,6 +269,8 @@ ShellCommandRunDrivers (
EFI_HANDLE *HandleWalker; EFI_HANDLE *HandleWalker;
UINTN ChildCount; UINTN ChildCount;
UINTN DeviceCount; UINTN DeviceCount;
CHAR16 ChildCountStr[3];
CHAR16 DeviceCountStr[3];
CHAR16 *Temp2; CHAR16 *Temp2;
CONST CHAR16 *FullDriverName; CONST CHAR16 *FullDriverName;
CHAR16 *TruncatedDriverName; CHAR16 *TruncatedDriverName;
@ -363,26 +365,45 @@ ShellCommandRunDrivers (
FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); FullDriverName = GetStringNameFromHandle(*HandleWalker, Language);
ImageName = GetImageNameFromHandle (*HandleWalker); ImageName = GetImageNameFromHandle (*HandleWalker);
UnicodeValueToStringS (ChildCountStr, sizeof (ChildCountStr), 0, ChildCount, 0);
UnicodeValueToStringS (DeviceCountStr, sizeof (DeviceCountStr), 0, DeviceCount, 0);
TruncatedDriverName = NULL; TruncatedDriverName = NULL;
if (!SfoFlag && (FullDriverName != NULL)) { if (!SfoFlag && (FullDriverName != NULL)) {
TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16)); TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16));
StrnCpyS (TruncatedDriverName, MAX_LEN_DRIVER_NAME + 1, FullDriverName, MAX_LEN_DRIVER_NAME); StrnCpyS (TruncatedDriverName, MAX_LEN_DRIVER_NAME + 1, FullDriverName, MAX_LEN_DRIVER_NAME);
} }
ShellPrintEx( if (!SfoFlag) {
-1, ShellPrintEx (
-1, -1,
FormatString, -1,
ConvertHandleToHandleIndex(*HandleWalker), FormatString,
DriverVersion, ConvertHandleToHandleIndex (*HandleWalker),
ChildCount > 0?L'B':(DeviceCount > 0?L'D':L'?'), DriverVersion,
DriverConfig?L'Y':L'N', ChildCount > 0 ? L'B' : (DeviceCount > 0 ? L'D' : L'?'),
DriverDiag?L'Y':L'N', DriverConfig ? L'X' : L'-',
DeviceCount, DriverDiag ? L'X' : L'-',
ChildCount, DeviceCount > 0 ? DeviceCountStr : L"-",
SfoFlag?FullDriverName:TruncatedDriverName, ChildCount > 0 ? ChildCountStr : L"-",
SfoFlag ? (Temp2 == NULL ? L"" : Temp2) : (ImageName == NULL ? L"" : ImageName) 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) { if (TruncatedDriverName != NULL) {
FreePool (TruncatedDriverName); FreePool (TruncatedDriverName);
} }

View File

@ -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_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" #string STR_DRIVERS_HEADER_LINES #language en-US "%N"
" T D\r\n" "%H T D%N\r\n"
" Y C I\r\n" "%HD Y C I%N\r\n"
" P F A\r\n" "%HR P F A%N\r\n"
"DRV VERSION E G G #D #C DRIVER NAME IMAGE NAME\r\n" "%HV VERSION E G G #D #C DRIVER NAME IMAGE NAME%N\r\n"
"=== ======== = = = === === =================================== ==========\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 #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_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" #string STR_DH_OUTPUT_DECODE #language en-US "%s: %g\r\n"