mirror of https://github.com/acidanthera/audk.git
Fix help command scroll issue. Also add FV space used, and free space to dir command.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9996 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
135ec2db42
commit
60428d0000
|
@ -220,6 +220,26 @@ EblGetCommand (
|
|||
}
|
||||
|
||||
|
||||
UINTN
|
||||
CountNewLines (
|
||||
IN CHAR8 *Str
|
||||
)
|
||||
{
|
||||
UINTN Count;
|
||||
|
||||
if (Str == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (Count = 0; *Str != '\0'; Str++) {
|
||||
if (Str[Count] == '\n') {
|
||||
Count++;
|
||||
}
|
||||
}
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
List out help information on all the commands or print extended information
|
||||
|
@ -243,16 +263,22 @@ EblHelpCmd (
|
|||
{
|
||||
UINTN Index;
|
||||
CHAR8 *Ptr;
|
||||
UINTN CurrentRow;
|
||||
UINTN CurrentRow = 0;
|
||||
|
||||
if (Argc == 1) {
|
||||
// Print all the commands
|
||||
AsciiPrint ("Embedded Boot Loader (EBL) commands (help command for more info):\n");
|
||||
CurrentRow++;
|
||||
for (Index = 0; Index < mCmdTableNextFreeIndex; Index++) {
|
||||
EblSetTextColor (EFI_YELLOW);
|
||||
AsciiPrint (" %a", mCmdTable[Index]->Name);
|
||||
EblSetTextColor (0);
|
||||
AsciiPrint ("%a\n", mCmdTable[Index]->HelpSummary);
|
||||
// Handle multi line help summaries
|
||||
CurrentRow += CountNewLines (mCmdTable[Index]->HelpSummary);
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (Argv[1] != NULL) {
|
||||
// Print specific help
|
||||
|
@ -260,6 +286,8 @@ EblHelpCmd (
|
|||
if (AsciiStriCmp (Argv[1], mCmdTable[Index]->Name) == 0) {
|
||||
Ptr = (mCmdTable[Index]->Help == NULL) ? mCmdTable[Index]->HelpSummary : mCmdTable[Index]->Help;
|
||||
AsciiPrint ("%a%a\n", Argv[1], Ptr);
|
||||
// Handle multi line help summaries
|
||||
CurrentRow += CountNewLines (Ptr);
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
break;
|
||||
}
|
||||
|
@ -847,7 +875,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdTemplate[] =
|
|||
},
|
||||
{
|
||||
"hexdump",
|
||||
"[.{1|2|4}] filename [Offset] [Size]; dump a file as hex bytes at a given width",
|
||||
"[.{1|2|4}] filename [Offset] [Size]; dump a file as hex .width",
|
||||
NULL,
|
||||
EblHexdumpCmd
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ EblDirCmd (
|
|||
CHAR16 UnicodeFileName[MAX_CMD_LINE];
|
||||
CHAR8 *Path;
|
||||
CHAR8 *TypeStr;
|
||||
UINTN TotalSize;
|
||||
|
||||
|
||||
if (Argc <= 1) {
|
||||
|
@ -143,6 +144,7 @@ EblDirCmd (
|
|||
}
|
||||
}
|
||||
|
||||
TotalSize = 0;
|
||||
Fv = File->Fv;
|
||||
Key = 0;
|
||||
CurrentRow = 0;
|
||||
|
@ -157,6 +159,7 @@ EblDirCmd (
|
|||
&Size
|
||||
);
|
||||
if (!EFI_ERROR (GetNextFileStatus)) {
|
||||
TotalSize += Size;
|
||||
// Calculate size of entire file
|
||||
Section = NULL;
|
||||
Size = 0;
|
||||
|
@ -170,8 +173,8 @@ EblDirCmd (
|
|||
&AuthenticationStatus
|
||||
);
|
||||
if (!((Status == EFI_BUFFER_TOO_SMALL) || !EFI_ERROR (Status))) {
|
||||
// EFI_SUCCESS or EFI_BUFFER_TOO_SMALL mean size is valid
|
||||
Size = 0;
|
||||
// EFI_SUCCESS or EFI_BUFFER_TOO_SMALL mean size is valid
|
||||
Size = 0;
|
||||
}
|
||||
|
||||
TypeStr = (Type <= EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) ? gFvFileType[Type] : "UNKNOWN";
|
||||
|
@ -189,7 +192,7 @@ EblDirCmd (
|
|||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (StrStr (Section, MatchSubString) != NULL) {
|
||||
AsciiPrint ("%,6d %7a %g %s\n", Size, TypeStr, &NameGuid, Section);
|
||||
AsciiPrint ("%,9d %7a %g %s\n", Size, TypeStr, &NameGuid, Section);
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
break;
|
||||
}
|
||||
|
@ -197,7 +200,7 @@ EblDirCmd (
|
|||
FreePool (Section);
|
||||
} else {
|
||||
if (*MatchSubString == '\0') {
|
||||
AsciiPrint ("%,6d %7a %g\n", Size, TypeStr, &NameGuid);
|
||||
AsciiPrint ("%,9d %7a %g\n", Size, TypeStr, &NameGuid);
|
||||
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
||||
break;
|
||||
}
|
||||
|
@ -206,6 +209,11 @@ EblDirCmd (
|
|||
}
|
||||
} while (!EFI_ERROR (GetNextFileStatus));
|
||||
|
||||
if (SearchType == EFI_FV_FILETYPE_ALL) {
|
||||
AsciiPrint ("%,20d bytes in files %,d bytes free\n", TotalSize, File->FvSize - File->FvHeaderSize - TotalSize);
|
||||
}
|
||||
|
||||
|
||||
} else if ((File->Type == EfiOpenFileSystem) || (File->Type == EfiOpenBlockIo)) {
|
||||
// Simple File System DIR
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdHwDebugTemplate[] =
|
|||
},
|
||||
{
|
||||
"mfill",
|
||||
"[.{1|2|4}] Addr Len [data] [1|2|4]; Memory Fill Addr Len*(1|2|4) bytes of data(0)",
|
||||
"[.{1|2|4}] Addr Len [data]; Memory Fill Addr Len*(1|2|4) bytes of data(0)",
|
||||
NULL,
|
||||
EblMfillCmd
|
||||
},
|
||||
|
|
|
@ -88,6 +88,7 @@ typedef struct {
|
|||
|
||||
EFI_PHYSICAL_ADDRESS FvStart;
|
||||
UINTN FvSize;
|
||||
UINTN FvHeaderSize;
|
||||
|
||||
EFI_FILE *FsFileHandle; // Information valid for Fs#:
|
||||
EFI_FILE_SYSTEM_INFO *FsInfo;
|
||||
|
|
|
@ -519,6 +519,8 @@ EblFvFileDevicePath (
|
|||
EFI_LBA Lba;
|
||||
UINTN BlockSize;
|
||||
UINTN NumberOfBlocks;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FvHeader = NULL;
|
||||
UINTN Index;
|
||||
|
||||
|
||||
Status = gBS->HandleProtocol (File->EfiHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&File->Fv);
|
||||
|
@ -531,7 +533,13 @@ EblFvFileDevicePath (
|
|||
if (!EFI_ERROR (Status)) {
|
||||
Status = Fvb->GetPhysicalAddress (Fvb, &File->FvStart);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
for (Lba = 0, File->FvSize = 0; ; File->FvSize += (BlockSize * NumberOfBlocks), Lba += NumberOfBlocks) {
|
||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)File->FvStart;
|
||||
File->FvHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_HEADER);
|
||||
for (Index = 0; FvHeader->BlockMap[Index].Length !=0; Index++) {
|
||||
File->FvHeaderSize += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
|
||||
}
|
||||
|
||||
for (Lba = 0, File->FvSize = 0, NumberOfBlocks = 0; ; File->FvSize += (BlockSize * NumberOfBlocks), Lba += NumberOfBlocks) {
|
||||
Status = Fvb->GetBlockSize (Fvb, Lba, &BlockSize, &NumberOfBlocks);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue