summaryrefslogtreecommitdiff
path: root/EmbeddedPkg
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-12 20:13:55 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-12 20:13:55 +0000
commit60428d0000da41bb55b41984f785761fcd6320be (patch)
tree1f3b9929e31aa5aa9f11516756d848f187557568 /EmbeddedPkg
parent135ec2db42941107fc2ec69107784828a1f81e91 (diff)
downloadedk2-platforms-60428d0000da41bb55b41984f785761fcd6320be.tar.xz
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
Diffstat (limited to 'EmbeddedPkg')
-rw-r--r--EmbeddedPkg/Ebl/Command.c32
-rw-r--r--EmbeddedPkg/Ebl/Dir.c16
-rw-r--r--EmbeddedPkg/Ebl/HwDebug.c2
-rw-r--r--EmbeddedPkg/Include/Library/EfiFileLib.h3
-rw-r--r--EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c10
5 files changed, 54 insertions, 9 deletions
diff --git a/EmbeddedPkg/Ebl/Command.c b/EmbeddedPkg/Ebl/Command.c
index 3efe6ee671..9527cfea81 100644
--- a/EmbeddedPkg/Ebl/Command.c
+++ b/EmbeddedPkg/Ebl/Command.c
@@ -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
}
diff --git a/EmbeddedPkg/Ebl/Dir.c b/EmbeddedPkg/Ebl/Dir.c
index 126ef5d7c7..2920d6a8e1 100644
--- a/EmbeddedPkg/Ebl/Dir.c
+++ b/EmbeddedPkg/Ebl/Dir.c
@@ -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
diff --git a/EmbeddedPkg/Ebl/HwDebug.c b/EmbeddedPkg/Ebl/HwDebug.c
index b2ea9af64b..20f0a72d95 100644
--- a/EmbeddedPkg/Ebl/HwDebug.c
+++ b/EmbeddedPkg/Ebl/HwDebug.c
@@ -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
},
diff --git a/EmbeddedPkg/Include/Library/EfiFileLib.h b/EmbeddedPkg/Include/Library/EfiFileLib.h
index 4bbb1b26f1..1ea8324b62 100644
--- a/EmbeddedPkg/Include/Library/EfiFileLib.h
+++ b/EmbeddedPkg/Include/Library/EfiFileLib.h
@@ -87,7 +87,8 @@ typedef struct {
EFI_FV_FILE_ATTRIBUTES FvAttributes;
EFI_PHYSICAL_ADDRESS FvStart;
- UINTN FvSize;
+ UINTN FvSize;
+ UINTN FvHeaderSize;
EFI_FILE *FsFileHandle; // Information valid for Fs#:
EFI_FILE_SYSTEM_INFO *FsInfo;
diff --git a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c b/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c
index d3d9596413..8d51fcf9c3 100644
--- a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c
+++ b/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c
@@ -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;