MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@@ -8,24 +8,24 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include "BootManagerMenu.h"
|
||||
|
||||
EFI_HII_HANDLE gStringPackHandle;
|
||||
EFI_HII_HANDLE gStringPackHandle;
|
||||
|
||||
BOOLEAN mModeInitialized = FALSE;
|
||||
BOOLEAN mModeInitialized = FALSE;
|
||||
|
||||
//
|
||||
// Boot video resolution and text mode.
|
||||
//
|
||||
UINT32 mBootHorizontalResolution = 0;
|
||||
UINT32 mBootVerticalResolution = 0;
|
||||
UINT32 mBootTextModeColumn = 0;
|
||||
UINT32 mBootTextModeRow = 0;
|
||||
UINT32 mBootHorizontalResolution = 0;
|
||||
UINT32 mBootVerticalResolution = 0;
|
||||
UINT32 mBootTextModeColumn = 0;
|
||||
UINT32 mBootTextModeRow = 0;
|
||||
//
|
||||
// BIOS setup video resolution and text mode.
|
||||
//
|
||||
UINT32 mSetupTextModeColumn = 0;
|
||||
UINT32 mSetupTextModeRow = 0;
|
||||
UINT32 mSetupHorizontalResolution = 0;
|
||||
UINT32 mSetupVerticalResolution = 0;
|
||||
UINT32 mSetupTextModeColumn = 0;
|
||||
UINT32 mSetupTextModeRow = 0;
|
||||
UINT32 mSetupHorizontalResolution = 0;
|
||||
UINT32 mSetupVerticalResolution = 0;
|
||||
|
||||
/**
|
||||
Prints a unicode string to the default console, at
|
||||
@@ -40,16 +40,16 @@ UINT32 mSetupVerticalResolution = 0;
|
||||
**/
|
||||
UINTN
|
||||
PrintStringAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *String
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *String
|
||||
)
|
||||
{
|
||||
UINTN ScreenWidth;
|
||||
UINTN ScreenRows;
|
||||
CHAR16 *TurncateString;
|
||||
EFI_STATUS Status;
|
||||
UINTN ShowingLength;
|
||||
UINTN ScreenWidth;
|
||||
UINTN ScreenRows;
|
||||
CHAR16 *TurncateString;
|
||||
EFI_STATUS Status;
|
||||
UINTN ShowingLength;
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row);
|
||||
|
||||
@@ -60,7 +60,7 @@ PrintStringAt (
|
||||
&ScreenRows
|
||||
);
|
||||
|
||||
if (Column > (ScreenWidth - 1) || Row > (ScreenRows - 1)) {
|
||||
if ((Column > (ScreenWidth - 1)) || (Row > (ScreenRows - 1))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ PrintStringAt (
|
||||
// TurncateString length should leave one character for draw box and
|
||||
// require one character for string end.
|
||||
//
|
||||
ShowingLength = ScreenWidth - Column - 1;
|
||||
ShowingLength = ScreenWidth - Column - 1;
|
||||
TurncateString = AllocatePool ((ShowingLength + 1) * sizeof (CHAR16));
|
||||
|
||||
if (TurncateString == NULL) {
|
||||
@@ -89,7 +89,7 @@ PrintStringAt (
|
||||
*(TurncateString + ShowingLength - 2) = L'.';
|
||||
*(TurncateString + ShowingLength - 1) = L'.';
|
||||
*(TurncateString + ShowingLength) = L'\0';
|
||||
ShowingLength = Print (L"%s", TurncateString);
|
||||
ShowingLength = Print (L"%s", TurncateString);
|
||||
FreePool (TurncateString);
|
||||
return ShowingLength;
|
||||
} else {
|
||||
@@ -110,13 +110,13 @@ PrintStringAt (
|
||||
**/
|
||||
UINTN
|
||||
PrintCharAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 Character
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 Character
|
||||
)
|
||||
{
|
||||
UINTN ScreenWidth;
|
||||
UINTN ScreenRows;
|
||||
UINTN ScreenWidth;
|
||||
UINTN ScreenRows;
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row);
|
||||
|
||||
@@ -127,7 +127,7 @@ PrintCharAt (
|
||||
&ScreenRows
|
||||
);
|
||||
|
||||
if (Column > (ScreenWidth - 1) || Row > (ScreenRows - 1)) {
|
||||
if ((Column > (ScreenWidth - 1)) || (Row > (ScreenRows - 1))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -145,30 +145,31 @@ PrintCharAt (
|
||||
**/
|
||||
UINTN
|
||||
GetLineWidth (
|
||||
IN EFI_STRING_ID StringId
|
||||
IN EFI_STRING_ID StringId
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN IncrementValue;
|
||||
EFI_STRING String;
|
||||
UINTN LineWidth;
|
||||
UINTN Index;
|
||||
UINTN IncrementValue;
|
||||
EFI_STRING String;
|
||||
UINTN LineWidth;
|
||||
|
||||
LineWidth = 0;
|
||||
String = HiiGetString (gStringPackHandle, StringId, NULL);
|
||||
String = HiiGetString (gStringPackHandle, StringId, NULL);
|
||||
|
||||
if (String != NULL) {
|
||||
Index = 0;
|
||||
IncrementValue = 1;
|
||||
Index = 0;
|
||||
IncrementValue = 1;
|
||||
|
||||
do {
|
||||
//
|
||||
// Advance to the null-terminator or to the first width directive
|
||||
//
|
||||
for (;
|
||||
(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0);
|
||||
Index++, LineWidth = LineWidth + IncrementValue
|
||||
)
|
||||
;
|
||||
for ( ;
|
||||
(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0);
|
||||
Index++, LineWidth = LineWidth + IncrementValue
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// We hit the null-terminator, we now have a count
|
||||
@@ -176,6 +177,7 @@ GetLineWidth (
|
||||
if (String[Index] == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
|
||||
// and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
|
||||
@@ -194,6 +196,7 @@ GetLineWidth (
|
||||
IncrementValue = 2;
|
||||
}
|
||||
} while (String[Index] != 0);
|
||||
|
||||
FreePool (String);
|
||||
}
|
||||
|
||||
@@ -214,35 +217,37 @@ InitializeBootMenuScreen (
|
||||
IN OUT BOOT_MENU_POPUP_DATA *BootMenuData
|
||||
)
|
||||
{
|
||||
UINTN MaxStrWidth;
|
||||
UINTN StrWidth;
|
||||
UINTN Index;
|
||||
UINTN Column;
|
||||
UINTN Row;
|
||||
UINTN MaxPrintRows;
|
||||
UINTN UnSelectableItmes;
|
||||
UINTN MaxStrWidth;
|
||||
UINTN StrWidth;
|
||||
UINTN Index;
|
||||
UINTN Column;
|
||||
UINTN Row;
|
||||
UINTN MaxPrintRows;
|
||||
UINTN UnSelectableItmes;
|
||||
|
||||
if (BootMenuData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Get maximum string width
|
||||
//
|
||||
MaxStrWidth = 0;
|
||||
for (Index = 0; Index < TITLE_TOKEN_COUNT; Index++) {
|
||||
StrWidth = GetLineWidth (BootMenuData->TitleToken[Index]);
|
||||
StrWidth = GetLineWidth (BootMenuData->TitleToken[Index]);
|
||||
MaxStrWidth = MaxStrWidth > StrWidth ? MaxStrWidth : StrWidth;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < BootMenuData->ItemCount; Index++) {
|
||||
StrWidth = GetLineWidth (BootMenuData->PtrTokens[Index]);
|
||||
StrWidth = GetLineWidth (BootMenuData->PtrTokens[Index]);
|
||||
MaxStrWidth = MaxStrWidth > StrWidth ? MaxStrWidth : StrWidth;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < HELP_TOKEN_COUNT; Index++) {
|
||||
StrWidth = GetLineWidth (BootMenuData->HelpToken[Index]);
|
||||
StrWidth = GetLineWidth (BootMenuData->HelpToken[Index]);
|
||||
MaxStrWidth = MaxStrWidth > StrWidth ? MaxStrWidth : StrWidth;
|
||||
}
|
||||
|
||||
//
|
||||
// query current row and column to calculate boot menu location
|
||||
//
|
||||
@@ -253,31 +258,34 @@ InitializeBootMenuScreen (
|
||||
&Row
|
||||
);
|
||||
|
||||
MaxPrintRows = Row - 6;
|
||||
MaxPrintRows = Row - 6;
|
||||
UnSelectableItmes = TITLE_TOKEN_COUNT + 2 + HELP_TOKEN_COUNT + 2;
|
||||
if (MaxStrWidth + 8 > Column) {
|
||||
BootMenuData->MenuScreen.Width = Column;
|
||||
} else {
|
||||
BootMenuData->MenuScreen.Width = MaxStrWidth + 8;
|
||||
}
|
||||
|
||||
if (BootMenuData->ItemCount + UnSelectableItmes > MaxPrintRows) {
|
||||
BootMenuData->MenuScreen.Height = MaxPrintRows;
|
||||
BootMenuData->ScrollBarControl.HasScrollBar = TRUE;
|
||||
BootMenuData->MenuScreen.Height = MaxPrintRows;
|
||||
BootMenuData->ScrollBarControl.HasScrollBar = TRUE;
|
||||
BootMenuData->ScrollBarControl.ItemCountPerScreen = MaxPrintRows - UnSelectableItmes;
|
||||
BootMenuData->ScrollBarControl.FirstItem = 0;
|
||||
BootMenuData->ScrollBarControl.LastItem = MaxPrintRows - UnSelectableItmes - 1;
|
||||
BootMenuData->ScrollBarControl.FirstItem = 0;
|
||||
BootMenuData->ScrollBarControl.LastItem = MaxPrintRows - UnSelectableItmes - 1;
|
||||
} else {
|
||||
BootMenuData->MenuScreen.Height = BootMenuData->ItemCount + UnSelectableItmes;
|
||||
BootMenuData->ScrollBarControl.HasScrollBar = FALSE;
|
||||
BootMenuData->MenuScreen.Height = BootMenuData->ItemCount + UnSelectableItmes;
|
||||
BootMenuData->ScrollBarControl.HasScrollBar = FALSE;
|
||||
BootMenuData->ScrollBarControl.ItemCountPerScreen = BootMenuData->ItemCount;
|
||||
BootMenuData->ScrollBarControl.FirstItem = 0;
|
||||
BootMenuData->ScrollBarControl.LastItem = BootMenuData->ItemCount - 1;
|
||||
BootMenuData->ScrollBarControl.FirstItem = 0;
|
||||
BootMenuData->ScrollBarControl.LastItem = BootMenuData->ItemCount - 1;
|
||||
}
|
||||
|
||||
BootMenuData->MenuScreen.StartCol = (Column - BootMenuData->MenuScreen.Width) / 2;
|
||||
BootMenuData->MenuScreen.StartRow = (Row - BootMenuData->MenuScreen.Height) / 2;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
This function uses check boot option is wheher setup application or no
|
||||
|
||||
@@ -289,18 +297,18 @@ InitializeBootMenuScreen (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsBootManagerMenu (
|
||||
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
|
||||
|
||||
Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
EfiBootManagerFreeLoadOption (&BootManagerMenu);
|
||||
}
|
||||
|
||||
return (BOOLEAN) (!EFI_ERROR (Status) && (BootOption->OptionNumber == BootManagerMenu.OptionNumber));
|
||||
return (BOOLEAN)(!EFI_ERROR (Status) && (BootOption->OptionNumber == BootManagerMenu.OptionNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,13 +324,13 @@ IgnoreBootOption (
|
||||
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
|
||||
|
||||
//
|
||||
// Ignore myself.
|
||||
//
|
||||
Status = gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageDevicePathProtocolGuid, (VOID **) &ImageDevicePath);
|
||||
Status = gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageDevicePathProtocolGuid, (VOID **)&ImageDevicePath);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (CompareMem (BootOption->FilePath, ImageDevicePath, GetDevicePathSize (ImageDevicePath)) == 0) {
|
||||
return TRUE;
|
||||
@@ -363,10 +371,10 @@ InitializeBootMenuData (
|
||||
OUT BOOT_MENU_POPUP_DATA *BootMenuData
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN StrIndex;
|
||||
UINTN Index;
|
||||
UINTN StrIndex;
|
||||
|
||||
if (BootOption == NULL || BootMenuData == NULL) {
|
||||
if ((BootOption == NULL) || (BootMenuData == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -391,7 +399,7 @@ InitializeBootMenuData (
|
||||
);
|
||||
}
|
||||
|
||||
BootMenuData->ItemCount = StrIndex;
|
||||
BootMenuData->ItemCount = StrIndex;
|
||||
BootMenuData->HelpToken[0] = STRING_TOKEN (STR_BOOT_POPUP_MENU_HELP1_STRING);
|
||||
BootMenuData->HelpToken[1] = STRING_TOKEN (STR_BOOT_POPUP_MENU_HELP2_STRING);
|
||||
BootMenuData->HelpToken[2] = STRING_TOKEN (STR_BOOT_POPUP_MENU_HELP3_STRING);
|
||||
@@ -417,93 +425,101 @@ BootMenuSelectItem (
|
||||
IN OUT BOOT_MENU_POPUP_DATA *BootMenuData
|
||||
)
|
||||
{
|
||||
INT32 SavedAttribute;
|
||||
EFI_STRING String;
|
||||
UINTN StartCol;
|
||||
UINTN StartRow;
|
||||
UINTN PrintCol;
|
||||
UINTN PrintRow;
|
||||
UINTN TopShadeNum;
|
||||
UINTN LowShadeNum;
|
||||
UINTN FirstItem;
|
||||
UINTN LastItem;
|
||||
UINTN ItemCountPerScreen;
|
||||
UINTN Index;
|
||||
BOOLEAN RePaintItems;
|
||||
INT32 SavedAttribute;
|
||||
EFI_STRING String;
|
||||
UINTN StartCol;
|
||||
UINTN StartRow;
|
||||
UINTN PrintCol;
|
||||
UINTN PrintRow;
|
||||
UINTN TopShadeNum;
|
||||
UINTN LowShadeNum;
|
||||
UINTN FirstItem;
|
||||
UINTN LastItem;
|
||||
UINTN ItemCountPerScreen;
|
||||
UINTN Index;
|
||||
BOOLEAN RePaintItems;
|
||||
|
||||
if (BootMenuData == NULL || WantSelectItem >= BootMenuData->ItemCount) {
|
||||
if ((BootMenuData == NULL) || (WantSelectItem >= BootMenuData->ItemCount)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ASSERT (BootMenuData->ItemCount != 0);
|
||||
SavedAttribute = gST->ConOut->Mode->Attribute;
|
||||
RePaintItems = FALSE;
|
||||
StartCol = BootMenuData->MenuScreen.StartCol;
|
||||
StartRow = BootMenuData->MenuScreen.StartRow;
|
||||
RePaintItems = FALSE;
|
||||
StartCol = BootMenuData->MenuScreen.StartCol;
|
||||
StartRow = BootMenuData->MenuScreen.StartRow;
|
||||
//
|
||||
// print selectable items again and adjust scroll bar if need
|
||||
//
|
||||
if (BootMenuData->ScrollBarControl.HasScrollBar &&
|
||||
(WantSelectItem < BootMenuData->ScrollBarControl.FirstItem ||
|
||||
WantSelectItem > BootMenuData->ScrollBarControl.LastItem ||
|
||||
WantSelectItem == BootMenuData->SelectItem)) {
|
||||
ItemCountPerScreen = BootMenuData->ScrollBarControl.ItemCountPerScreen;
|
||||
((WantSelectItem < BootMenuData->ScrollBarControl.FirstItem) ||
|
||||
(WantSelectItem > BootMenuData->ScrollBarControl.LastItem) ||
|
||||
(WantSelectItem == BootMenuData->SelectItem)))
|
||||
{
|
||||
ItemCountPerScreen = BootMenuData->ScrollBarControl.ItemCountPerScreen;
|
||||
//
|
||||
// Set first item and last item
|
||||
//
|
||||
if (WantSelectItem < BootMenuData->ScrollBarControl.FirstItem) {
|
||||
BootMenuData->ScrollBarControl.FirstItem = WantSelectItem;
|
||||
BootMenuData->ScrollBarControl.LastItem = WantSelectItem + ItemCountPerScreen - 1;
|
||||
BootMenuData->ScrollBarControl.LastItem = WantSelectItem + ItemCountPerScreen - 1;
|
||||
} else if (WantSelectItem > BootMenuData->ScrollBarControl.LastItem) {
|
||||
BootMenuData->ScrollBarControl.FirstItem = WantSelectItem - ItemCountPerScreen + 1;
|
||||
BootMenuData->ScrollBarControl.LastItem = WantSelectItem;
|
||||
BootMenuData->ScrollBarControl.LastItem = WantSelectItem;
|
||||
}
|
||||
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLUE);
|
||||
FirstItem = BootMenuData->ScrollBarControl.FirstItem;
|
||||
LastItem = BootMenuData->ScrollBarControl.LastItem;
|
||||
FirstItem = BootMenuData->ScrollBarControl.FirstItem;
|
||||
LastItem = BootMenuData->ScrollBarControl.LastItem;
|
||||
TopShadeNum = 0;
|
||||
if (FirstItem != 0) {
|
||||
TopShadeNum = (FirstItem * ItemCountPerScreen) / BootMenuData->ItemCount;
|
||||
if ((FirstItem * ItemCountPerScreen) % BootMenuData->ItemCount != 0) {
|
||||
TopShadeNum++;
|
||||
}
|
||||
|
||||
PrintCol = StartCol + BootMenuData->MenuScreen.Width - 2;
|
||||
PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;
|
||||
for (Index = 0; Index < TopShadeNum; Index++, PrintRow++) {
|
||||
PrintCharAt (PrintCol, PrintRow, BLOCKELEMENT_LIGHT_SHADE);
|
||||
}
|
||||
}
|
||||
|
||||
LowShadeNum = 0;
|
||||
if (LastItem != BootMenuData->ItemCount - 1) {
|
||||
LowShadeNum = ((BootMenuData->ItemCount - 1 - LastItem) * ItemCountPerScreen) / BootMenuData->ItemCount;
|
||||
if (((BootMenuData->ItemCount - 1 - LastItem) * ItemCountPerScreen) % BootMenuData->ItemCount != 0) {
|
||||
LowShadeNum++;
|
||||
}
|
||||
|
||||
PrintCol = StartCol + BootMenuData->MenuScreen.Width - 2;
|
||||
PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + ItemCountPerScreen - LowShadeNum;
|
||||
for (Index = 0; Index < LowShadeNum; Index++, PrintRow++) {
|
||||
PrintCharAt (PrintCol, PrintRow, BLOCKELEMENT_LIGHT_SHADE);
|
||||
}
|
||||
}
|
||||
|
||||
PrintCol = StartCol + BootMenuData->MenuScreen.Width - 2;
|
||||
PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + TopShadeNum;
|
||||
for (Index = TopShadeNum; Index < ItemCountPerScreen - LowShadeNum; Index++, PrintRow++) {
|
||||
PrintCharAt (PrintCol, PrintRow, BLOCKELEMENT_FULL_BLOCK);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Clear selectable items first
|
||||
//
|
||||
PrintCol = StartCol + 1;
|
||||
PrintRow = StartRow + TITLE_TOKEN_COUNT + 2;
|
||||
String = AllocateZeroPool ((BootMenuData->MenuScreen.Width - 2) * sizeof (CHAR16));
|
||||
String = AllocateZeroPool ((BootMenuData->MenuScreen.Width - 2) * sizeof (CHAR16));
|
||||
ASSERT (String != NULL);
|
||||
for (Index = 0; Index < BootMenuData->MenuScreen.Width - 3; Index++) {
|
||||
String[Index] = 0x20;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < ItemCountPerScreen; Index++) {
|
||||
PrintStringAt (PrintCol, PrintRow + Index, String);
|
||||
}
|
||||
|
||||
FreePool (String);
|
||||
//
|
||||
// print selectable items
|
||||
@@ -513,6 +529,7 @@ BootMenuSelectItem (
|
||||
PrintStringAt (PrintCol, PrintRow, String);
|
||||
FreePool (String);
|
||||
}
|
||||
|
||||
RePaintItems = TRUE;
|
||||
}
|
||||
|
||||
@@ -521,9 +538,9 @@ BootMenuSelectItem (
|
||||
// items, clear select item
|
||||
//
|
||||
FirstItem = BootMenuData->ScrollBarControl.FirstItem;
|
||||
if (WantSelectItem != BootMenuData->SelectItem && !RePaintItems) {
|
||||
if ((WantSelectItem != BootMenuData->SelectItem) && !RePaintItems) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLUE);
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[BootMenuData->SelectItem], NULL);
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[BootMenuData->SelectItem], NULL);
|
||||
PrintCol = StartCol + 1;
|
||||
PrintRow = StartRow + 3 + BootMenuData->SelectItem - FirstItem;
|
||||
PrintStringAt (PrintCol, PrintRow, String);
|
||||
@@ -534,7 +551,7 @@ BootMenuSelectItem (
|
||||
// Print want to select item
|
||||
//
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLACK);
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[WantSelectItem], NULL);
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->PtrTokens[WantSelectItem], NULL);
|
||||
PrintCol = StartCol + 1;
|
||||
PrintRow = StartRow + TITLE_TOKEN_COUNT + 2 + WantSelectItem - FirstItem;
|
||||
PrintStringAt (PrintCol, PrintRow, String);
|
||||
@@ -558,26 +575,26 @@ DrawBootPopupMenu (
|
||||
IN BOOT_MENU_POPUP_DATA *BootMenuData
|
||||
)
|
||||
{
|
||||
EFI_STRING String;
|
||||
UINTN Index;
|
||||
UINTN Width;
|
||||
UINTN StartCol;
|
||||
UINTN StartRow;
|
||||
UINTN PrintRow;
|
||||
UINTN PrintCol;
|
||||
UINTN LineWidth;
|
||||
INT32 SavedAttribute;
|
||||
UINTN ItemCountPerScreen;
|
||||
EFI_STRING String;
|
||||
UINTN Index;
|
||||
UINTN Width;
|
||||
UINTN StartCol;
|
||||
UINTN StartRow;
|
||||
UINTN PrintRow;
|
||||
UINTN PrintCol;
|
||||
UINTN LineWidth;
|
||||
INT32 SavedAttribute;
|
||||
UINTN ItemCountPerScreen;
|
||||
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
|
||||
SavedAttribute = gST->ConOut->Mode->Attribute;
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_WHITE | EFI_BACKGROUND_BLUE);
|
||||
Width = BootMenuData->MenuScreen.Width;
|
||||
StartCol = BootMenuData->MenuScreen.StartCol;
|
||||
StartRow = BootMenuData->MenuScreen.StartRow;
|
||||
Width = BootMenuData->MenuScreen.Width;
|
||||
StartCol = BootMenuData->MenuScreen.StartCol;
|
||||
StartRow = BootMenuData->MenuScreen.StartRow;
|
||||
ItemCountPerScreen = BootMenuData->ScrollBarControl.ItemCountPerScreen;
|
||||
PrintRow = StartRow;
|
||||
PrintRow = StartRow;
|
||||
|
||||
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
|
||||
//
|
||||
@@ -587,6 +604,7 @@ DrawBootPopupMenu (
|
||||
for (Index = 1; Index < Width - 1; Index++) {
|
||||
PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);
|
||||
}
|
||||
|
||||
PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_DOWN_LEFT);
|
||||
|
||||
//
|
||||
@@ -610,6 +628,7 @@ DrawBootPopupMenu (
|
||||
for (Index = 1; Index < Width - 1; Index++) {
|
||||
PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);
|
||||
}
|
||||
|
||||
PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL_LEFT);
|
||||
|
||||
//
|
||||
@@ -627,6 +646,7 @@ DrawBootPopupMenu (
|
||||
for (Index = 1; Index < Width - 1; Index++) {
|
||||
PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);
|
||||
}
|
||||
|
||||
PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL_LEFT);
|
||||
|
||||
//
|
||||
@@ -638,6 +658,7 @@ DrawBootPopupMenu (
|
||||
PrintStringAt (StartCol + 1, PrintRow, String);
|
||||
PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_VERTICAL);
|
||||
}
|
||||
|
||||
FreePool (String);
|
||||
|
||||
PrintRow++;
|
||||
@@ -645,17 +666,17 @@ DrawBootPopupMenu (
|
||||
for (Index = 1; Index < Width - 1; Index++) {
|
||||
PrintCharAt (StartCol + Index, PrintRow, BOXDRAW_HORIZONTAL);
|
||||
}
|
||||
PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_UP_LEFT);
|
||||
|
||||
PrintCharAt (StartCol + Width - 1, PrintRow, BOXDRAW_UP_LEFT);
|
||||
|
||||
//
|
||||
// print title strings
|
||||
//
|
||||
PrintRow = StartRow + 1;
|
||||
for (Index = 0; Index < TITLE_TOKEN_COUNT; Index++, PrintRow++) {
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->TitleToken[Index], NULL);
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->TitleToken[Index], NULL);
|
||||
LineWidth = GetLineWidth (BootMenuData->TitleToken[Index]);
|
||||
PrintCol = StartCol + (Width - LineWidth) / 2;
|
||||
PrintCol = StartCol + (Width - LineWidth) / 2;
|
||||
PrintStringAt (PrintCol, PrintRow, String);
|
||||
FreePool (String);
|
||||
}
|
||||
@@ -676,9 +697,9 @@ DrawBootPopupMenu (
|
||||
//
|
||||
PrintRow++;
|
||||
for (Index = 0; Index < HELP_TOKEN_COUNT; Index++, PrintRow++) {
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->HelpToken[Index], NULL);
|
||||
String = HiiGetString (gStringPackHandle, BootMenuData->HelpToken[Index], NULL);
|
||||
LineWidth = GetLineWidth (BootMenuData->HelpToken[Index]);
|
||||
PrintCol = StartCol + (Width - LineWidth) / 2;
|
||||
PrintCol = StartCol + (Width - LineWidth) / 2;
|
||||
PrintStringAt (PrintCol, PrintRow, String);
|
||||
FreePool (String);
|
||||
}
|
||||
@@ -718,8 +739,8 @@ BootFromSelectOption (
|
||||
IN UINTN SelectItem
|
||||
)
|
||||
{
|
||||
UINTN ItemNum;
|
||||
UINTN Index;
|
||||
UINTN ItemNum;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (BootOptions != NULL);
|
||||
|
||||
@@ -778,7 +799,7 @@ BdsSetConsoleMode (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
(VOID**)&GraphicsOutput
|
||||
(VOID **)&GraphicsOutput
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
GraphicsOutput = NULL;
|
||||
@@ -787,7 +808,7 @@ BdsSetConsoleMode (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID**)&SimpleTextOut
|
||||
(VOID **)&SimpleTextOut
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SimpleTextOut = NULL;
|
||||
@@ -816,7 +837,7 @@ BdsSetConsoleMode (
|
||||
}
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
MaxGopMode = GraphicsOutput->Mode->MaxMode;
|
||||
MaxGopMode = GraphicsOutput->Mode->MaxMode;
|
||||
}
|
||||
|
||||
if (SimpleTextOut != NULL) {
|
||||
@@ -832,22 +853,24 @@ BdsSetConsoleMode (
|
||||
//
|
||||
for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
|
||||
Status = GraphicsOutput->QueryMode (
|
||||
GraphicsOutput,
|
||||
ModeNumber,
|
||||
&SizeOfInfo,
|
||||
&Info
|
||||
);
|
||||
GraphicsOutput,
|
||||
ModeNumber,
|
||||
&SizeOfInfo,
|
||||
&Info
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if ((Info->HorizontalResolution == NewHorizontalResolution) &&
|
||||
(Info->VerticalResolution == NewVerticalResolution)) {
|
||||
(Info->VerticalResolution == NewVerticalResolution))
|
||||
{
|
||||
if ((GraphicsOutput->Mode->Info->HorizontalResolution == NewHorizontalResolution) &&
|
||||
(GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution)) {
|
||||
(GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution))
|
||||
{
|
||||
//
|
||||
// Current resolution is same with required resolution, check if text mode need be set
|
||||
//
|
||||
Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (CurrentColumn == NewColumns && CurrentRow == NewRows) {
|
||||
if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
|
||||
//
|
||||
// If current text mode is same with required text mode. Do nothing
|
||||
//
|
||||
@@ -859,7 +882,7 @@ BdsSetConsoleMode (
|
||||
//
|
||||
for (Index = 0; Index < MaxTextMode; Index++) {
|
||||
Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
|
||||
//
|
||||
// Required text mode is supported, set it.
|
||||
@@ -878,6 +901,7 @@ BdsSetConsoleMode (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Index == MaxTextMode) {
|
||||
//
|
||||
// If required text mode is not supported, return error.
|
||||
@@ -898,6 +922,7 @@ BdsSetConsoleMode (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (Info);
|
||||
}
|
||||
}
|
||||
@@ -928,19 +953,21 @@ BdsSetConsoleMode (
|
||||
// Locate all the handles with GOP protocol and reconnect it.
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
ByProtocol,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
|
||||
}
|
||||
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
@@ -962,29 +989,29 @@ BdsSetConsoleMode (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BootManagerMenuEntry (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;
|
||||
UINTN BootOptionCount;
|
||||
EFI_STATUS Status;
|
||||
BOOT_MENU_POPUP_DATA BootMenuData;
|
||||
UINTN Index;
|
||||
EFI_INPUT_KEY Key;
|
||||
BOOLEAN ExitApplication;
|
||||
UINTN SelectItem;
|
||||
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
|
||||
UINTN BootTextColumn;
|
||||
UINTN BootTextRow;
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;
|
||||
UINTN BootOptionCount;
|
||||
EFI_STATUS Status;
|
||||
BOOT_MENU_POPUP_DATA BootMenuData;
|
||||
UINTN Index;
|
||||
EFI_INPUT_KEY Key;
|
||||
BOOLEAN ExitApplication;
|
||||
UINTN SelectItem;
|
||||
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
|
||||
UINTN BootTextColumn;
|
||||
UINTN BootTextRow;
|
||||
|
||||
//
|
||||
// Set Logo status invalid when boot manager menu is launched
|
||||
//
|
||||
BootLogo = NULL;
|
||||
Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);
|
||||
Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **)&BootLogo);
|
||||
if (!EFI_ERROR (Status) && (BootLogo != NULL)) {
|
||||
Status = BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -993,11 +1020,11 @@ BootManagerMenuEntry (
|
||||
gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
|
||||
|
||||
gStringPackHandle = HiiAddPackages (
|
||||
&gEfiCallerIdGuid,
|
||||
gImageHandle,
|
||||
BootManagerMenuAppStrings,
|
||||
NULL
|
||||
);
|
||||
&gEfiCallerIdGuid,
|
||||
gImageHandle,
|
||||
BootManagerMenuAppStrings,
|
||||
NULL
|
||||
);
|
||||
ASSERT (gStringPackHandle != NULL);
|
||||
|
||||
//
|
||||
@@ -1016,7 +1043,7 @@ BootManagerMenuEntry (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
(VOID**)&GraphicsOutput
|
||||
(VOID **)&GraphicsOutput
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
GraphicsOutput = NULL;
|
||||
@@ -1025,7 +1052,7 @@ BootManagerMenuEntry (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID**)&SimpleTextOut
|
||||
(VOID **)&SimpleTextOut
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SimpleTextOut = NULL;
|
||||
@@ -1083,58 +1110,57 @@ BootManagerMenuEntry (
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
switch (Key.UnicodeChar) {
|
||||
case CHAR_NULL:
|
||||
switch (Key.ScanCode) {
|
||||
case SCAN_UP:
|
||||
SelectItem = BootMenuData.SelectItem == 0 ? BootMenuData.ItemCount - 1 : BootMenuData.SelectItem - 1;
|
||||
BootMenuSelectItem (SelectItem, &BootMenuData);
|
||||
break;
|
||||
|
||||
case CHAR_NULL:
|
||||
switch (Key.ScanCode) {
|
||||
case SCAN_DOWN:
|
||||
SelectItem = BootMenuData.SelectItem == BootMenuData.ItemCount - 1 ? 0 : BootMenuData.SelectItem + 1;
|
||||
BootMenuSelectItem (SelectItem, &BootMenuData);
|
||||
break;
|
||||
|
||||
case SCAN_ESC:
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
ExitApplication = TRUE;
|
||||
//
|
||||
// Set boot resolution for normal boot
|
||||
//
|
||||
BdsSetConsoleMode (FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
case SCAN_UP:
|
||||
SelectItem = BootMenuData.SelectItem == 0 ? BootMenuData.ItemCount - 1 : BootMenuData.SelectItem - 1;
|
||||
BootMenuSelectItem (SelectItem, &BootMenuData);
|
||||
break;
|
||||
|
||||
case SCAN_DOWN:
|
||||
SelectItem = BootMenuData.SelectItem == BootMenuData.ItemCount - 1 ? 0 : BootMenuData.SelectItem + 1;
|
||||
BootMenuSelectItem (SelectItem, &BootMenuData);
|
||||
break;
|
||||
|
||||
case SCAN_ESC:
|
||||
case CHAR_CARRIAGE_RETURN:
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
ExitApplication = TRUE;
|
||||
//
|
||||
// Set boot resolution for normal boot
|
||||
//
|
||||
BdsSetConsoleMode (FALSE);
|
||||
BootFromSelectOption (BootOption, BootOptionCount, BootMenuData.SelectItem);
|
||||
//
|
||||
// Back to boot manager menu again, set back to setup resolution
|
||||
//
|
||||
BdsSetConsoleMode (TRUE);
|
||||
DrawBootPopupMenu (&BootMenuData);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case CHAR_CARRIAGE_RETURN:
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
//
|
||||
// Set boot resolution for normal boot
|
||||
//
|
||||
BdsSetConsoleMode (FALSE);
|
||||
BootFromSelectOption (BootOption, BootOptionCount, BootMenuData.SelectItem);
|
||||
//
|
||||
// Back to boot manager menu again, set back to setup resolution
|
||||
//
|
||||
BdsSetConsoleMode (TRUE);
|
||||
DrawBootPopupMenu (&BootMenuData);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
|
||||
FreePool (BootMenuData.PtrTokens);
|
||||
|
||||
HiiRemovePackages (gStringPackHandle);
|
||||
|
||||
return Status;
|
||||
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _BOOT_MANAGER_MENU_H_
|
||||
#define _BOOT_MANAGER_MENU_H_
|
||||
|
||||
@@ -23,21 +22,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/BootLogo.h>
|
||||
|
||||
#define TITLE_TOKEN_COUNT 1
|
||||
#define HELP_TOKEN_COUNT 3
|
||||
#define TITLE_TOKEN_COUNT 1
|
||||
#define HELP_TOKEN_COUNT 3
|
||||
|
||||
typedef struct _BOOT_MENU_SCREEN {
|
||||
UINTN StartCol;
|
||||
UINTN StartRow;
|
||||
UINTN Width;
|
||||
UINTN Height;
|
||||
UINTN StartCol;
|
||||
UINTN StartRow;
|
||||
UINTN Width;
|
||||
UINTN Height;
|
||||
} BOOT_MENU_SCREEN;
|
||||
|
||||
typedef struct _BOOT_MENU_SCROLL_BAR_CONTROL {
|
||||
BOOLEAN HasScrollBar;
|
||||
UINTN ItemCountPerScreen;
|
||||
UINTN FirstItem;
|
||||
UINTN LastItem;
|
||||
BOOLEAN HasScrollBar;
|
||||
UINTN ItemCountPerScreen;
|
||||
UINTN FirstItem;
|
||||
UINTN LastItem;
|
||||
} BOOT_MENU_SCROLL_BAR_CONTROL;
|
||||
|
||||
typedef struct _BOOT_MENU_POPUP_DATA {
|
||||
@@ -51,4 +50,3 @@ typedef struct _BOOT_MENU_POPUP_DATA {
|
||||
} BOOT_MENU_POPUP_DATA;
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -8,9 +8,9 @@
|
||||
|
||||
#include "CapsuleApp.h"
|
||||
|
||||
UINTN Argc;
|
||||
CHAR16 **Argv;
|
||||
EFI_SHELL_PROTOCOL *mShellProtocol = NULL;
|
||||
UINTN Argc;
|
||||
CHAR16 **Argv;
|
||||
EFI_SHELL_PROTOCOL *mShellProtocol = NULL;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,15 +23,15 @@ GetArg (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiShellParametersProtocolGuid,
|
||||
(VOID**)&ShellParameters
|
||||
(VOID **)&ShellParameters
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ GetShellProtocol (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (mShellProtocol == NULL) {
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiShellProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &mShellProtocol
|
||||
(VOID **)&mShellProtocol
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
mShellProtocol = NULL;
|
||||
@@ -79,19 +79,19 @@ GetShellProtocol (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ReadFileToBuffer (
|
||||
IN CHAR16 *FileName,
|
||||
OUT UINTN *BufferSize,
|
||||
OUT VOID **Buffer
|
||||
IN CHAR16 *FileName,
|
||||
OUT UINTN *BufferSize,
|
||||
OUT VOID **Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
SHELL_FILE_HANDLE Handle;
|
||||
UINT64 FileSize;
|
||||
UINTN TempBufferSize;
|
||||
VOID *TempBuffer;
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
SHELL_FILE_HANDLE Handle;
|
||||
UINT64 FileSize;
|
||||
UINTN TempBufferSize;
|
||||
VOID *TempBuffer;
|
||||
|
||||
ShellProtocol = GetShellProtocol();
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
if (ShellProtocol == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
@@ -117,8 +117,8 @@ ReadFileToBuffer (
|
||||
return Status;
|
||||
}
|
||||
|
||||
TempBufferSize = (UINTN) FileSize;
|
||||
TempBuffer = AllocateZeroPool (TempBufferSize);
|
||||
TempBufferSize = (UINTN)FileSize;
|
||||
TempBuffer = AllocateZeroPool (TempBufferSize);
|
||||
if (TempBuffer == NULL) {
|
||||
ShellProtocol->CloseFile (Handle);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -157,18 +157,18 @@ ReadFileToBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WriteFileFromBuffer (
|
||||
IN CHAR16 *FileName,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
IN CHAR16 *FileName,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
SHELL_FILE_HANDLE Handle;
|
||||
EFI_FILE_INFO *FileInfo;
|
||||
UINTN TempBufferSize;
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
SHELL_FILE_HANDLE Handle;
|
||||
EFI_FILE_INFO *FileInfo;
|
||||
UINTN TempBufferSize;
|
||||
|
||||
ShellProtocol = GetShellProtocol();
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
if (ShellProtocol == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
@@ -202,24 +202,25 @@ WriteFileFromBuffer (
|
||||
// Set the file size to 0.
|
||||
//
|
||||
FileInfo->FileSize = 0;
|
||||
Status = ShellProtocol->SetFileInfo (Handle, FileInfo);
|
||||
Status = ShellProtocol->SetFileInfo (Handle, FileInfo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (FileInfo);
|
||||
ShellProtocol->CloseFile (Handle);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (FileInfo);
|
||||
|
||||
//
|
||||
// Write the file data from the buffer
|
||||
//
|
||||
TempBufferSize = BufferSize;
|
||||
Status = ShellProtocol->WriteFile (
|
||||
Handle,
|
||||
&TempBufferSize,
|
||||
Buffer
|
||||
);
|
||||
Status = ShellProtocol->WriteFile (
|
||||
Handle,
|
||||
&TempBufferSize,
|
||||
Buffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellProtocol->CloseFile (Handle);
|
||||
return Status;
|
||||
@@ -229,4 +230,3 @@ WriteFileFromBuffer (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -27,52 +27,54 @@ CreateBmpFmp (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
CHAR16 *OutputCapsuleName;
|
||||
VOID *BmpBuffer;
|
||||
UINTN FileSize;
|
||||
CHAR16 *BmpName;
|
||||
UINT8 *FullCapsuleBuffer;
|
||||
UINTN FullCapsuleBufferSize;
|
||||
EFI_DISPLAY_CAPSULE *DisplayCapsule;
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt;
|
||||
UINTN GopBltSize;
|
||||
UINTN Height;
|
||||
UINTN Width;
|
||||
CHAR16 *OutputCapsuleName;
|
||||
VOID *BmpBuffer;
|
||||
UINTN FileSize;
|
||||
CHAR16 *BmpName;
|
||||
UINT8 *FullCapsuleBuffer;
|
||||
UINTN FullCapsuleBufferSize;
|
||||
EFI_DISPLAY_CAPSULE *DisplayCapsule;
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt;
|
||||
UINTN GopBltSize;
|
||||
UINTN Height;
|
||||
UINTN Width;
|
||||
|
||||
Status = gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"CapsuleApp: NO GOP is found.\n");
|
||||
Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"CapsuleApp: NO GOP is found.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Info = Gop->Mode->Info;
|
||||
Print(L"Current GOP: Mode - %d, ", Gop->Mode->Mode);
|
||||
Print(L"HorizontalResolution - %d, ", Info->HorizontalResolution);
|
||||
Print(L"VerticalResolution - %d\n", Info->VerticalResolution);
|
||||
Print (L"Current GOP: Mode - %d, ", Gop->Mode->Mode);
|
||||
Print (L"HorizontalResolution - %d, ", Info->HorizontalResolution);
|
||||
Print (L"VerticalResolution - %d\n", Info->VerticalResolution);
|
||||
// HorizontalResolution >= BMP_IMAGE_HEADER.PixelWidth
|
||||
// VerticalResolution >= BMP_IMAGE_HEADER.PixelHeight
|
||||
|
||||
if (Argc != 5) {
|
||||
Print(L"CapsuleApp: Incorrect parameter count.\n");
|
||||
Print (L"CapsuleApp: Incorrect parameter count.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (StrCmp(Argv[3], L"-O") != 0) {
|
||||
Print(L"CapsuleApp: NO output capsule name.\n");
|
||||
if (StrCmp (Argv[3], L"-O") != 0) {
|
||||
Print (L"CapsuleApp: NO output capsule name.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
OutputCapsuleName = Argv[4];
|
||||
|
||||
BmpBuffer = NULL;
|
||||
FileSize = 0;
|
||||
BmpBuffer = NULL;
|
||||
FileSize = 0;
|
||||
FullCapsuleBuffer = NULL;
|
||||
|
||||
BmpName = Argv[2];
|
||||
Status = ReadFileToBuffer(BmpName, &FileSize, &BmpBuffer);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"CapsuleApp: BMP image (%s) is not found.\n", BmpName);
|
||||
Status = ReadFileToBuffer (BmpName, &FileSize, &BmpBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"CapsuleApp: BMP image (%s) is not found.\n", BmpName);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
@@ -85,45 +87,48 @@ CreateBmpFmp (
|
||||
&Height,
|
||||
&Width
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"CapsuleApp: BMP image (%s) is not valid.\n", BmpName);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"CapsuleApp: BMP image (%s) is not valid.\n", BmpName);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (GopBlt != NULL) {
|
||||
FreePool (GopBlt);
|
||||
}
|
||||
Print(L"BMP image (%s), Width - %d, Height - %d\n", BmpName, Width, Height);
|
||||
|
||||
Print (L"BMP image (%s), Width - %d, Height - %d\n", BmpName, Width, Height);
|
||||
|
||||
if (Height > Info->VerticalResolution) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
Print(L"CapsuleApp: BMP image (%s) height is larger than current resolution.\n", BmpName);
|
||||
goto Done;
|
||||
}
|
||||
if (Width > Info->HorizontalResolution) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
Print(L"CapsuleApp: BMP image (%s) width is larger than current resolution.\n", BmpName);
|
||||
Print (L"CapsuleApp: BMP image (%s) height is larger than current resolution.\n", BmpName);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
FullCapsuleBufferSize = sizeof(EFI_DISPLAY_CAPSULE) + FileSize;
|
||||
FullCapsuleBuffer = AllocatePool(FullCapsuleBufferSize);
|
||||
if (Width > Info->HorizontalResolution) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
Print (L"CapsuleApp: BMP image (%s) width is larger than current resolution.\n", BmpName);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
FullCapsuleBufferSize = sizeof (EFI_DISPLAY_CAPSULE) + FileSize;
|
||||
FullCapsuleBuffer = AllocatePool (FullCapsuleBufferSize);
|
||||
if (FullCapsuleBuffer == NULL) {
|
||||
Print(L"CapsuleApp: Capsule Buffer size (0x%x) too big.\n", FullCapsuleBufferSize);
|
||||
Print (L"CapsuleApp: Capsule Buffer size (0x%x) too big.\n", FullCapsuleBufferSize);
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
DisplayCapsule = (EFI_DISPLAY_CAPSULE *)FullCapsuleBuffer;
|
||||
CopyGuid(&DisplayCapsule->CapsuleHeader.CapsuleGuid, &gWindowsUxCapsuleGuid);
|
||||
DisplayCapsule->CapsuleHeader.HeaderSize = sizeof(DisplayCapsule->CapsuleHeader);
|
||||
DisplayCapsule->CapsuleHeader.Flags = CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
|
||||
CopyGuid (&DisplayCapsule->CapsuleHeader.CapsuleGuid, &gWindowsUxCapsuleGuid);
|
||||
DisplayCapsule->CapsuleHeader.HeaderSize = sizeof (DisplayCapsule->CapsuleHeader);
|
||||
DisplayCapsule->CapsuleHeader.Flags = CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
|
||||
DisplayCapsule->CapsuleHeader.CapsuleImageSize = (UINT32)FullCapsuleBufferSize;
|
||||
|
||||
DisplayCapsule->ImagePayload.Version = 1;
|
||||
DisplayCapsule->ImagePayload.Checksum = 0;
|
||||
DisplayCapsule->ImagePayload.Version = 1;
|
||||
DisplayCapsule->ImagePayload.Checksum = 0;
|
||||
DisplayCapsule->ImagePayload.ImageType = 0; // BMP
|
||||
DisplayCapsule->ImagePayload.Reserved = 0;
|
||||
DisplayCapsule->ImagePayload.Mode = Gop->Mode->Mode;
|
||||
DisplayCapsule->ImagePayload.Reserved = 0;
|
||||
DisplayCapsule->ImagePayload.Mode = Gop->Mode->Mode;
|
||||
|
||||
//
|
||||
// Center the bitmap horizontally
|
||||
@@ -140,26 +145,27 @@ CreateBmpFmp (
|
||||
(UINT32)(((3 * Info->VerticalResolution) - (2 * Height)) / 4)
|
||||
);
|
||||
|
||||
Print(L"BMP image (%s), OffsetX - %d, OffsetY - %d\n",
|
||||
Print (
|
||||
L"BMP image (%s), OffsetX - %d, OffsetY - %d\n",
|
||||
BmpName,
|
||||
DisplayCapsule->ImagePayload.OffsetX,
|
||||
DisplayCapsule->ImagePayload.OffsetY
|
||||
);
|
||||
|
||||
CopyMem((DisplayCapsule + 1), BmpBuffer, FileSize);
|
||||
CopyMem ((DisplayCapsule + 1), BmpBuffer, FileSize);
|
||||
|
||||
DisplayCapsule->ImagePayload.Checksum = CalculateCheckSum8(FullCapsuleBuffer, FullCapsuleBufferSize);
|
||||
DisplayCapsule->ImagePayload.Checksum = CalculateCheckSum8 (FullCapsuleBuffer, FullCapsuleBufferSize);
|
||||
|
||||
Status = WriteFileFromBuffer(OutputCapsuleName, FullCapsuleBufferSize, FullCapsuleBuffer);
|
||||
Print(L"CapsuleApp: Write %s %r\n", OutputCapsuleName, Status);
|
||||
Status = WriteFileFromBuffer (OutputCapsuleName, FullCapsuleBufferSize, FullCapsuleBuffer);
|
||||
Print (L"CapsuleApp: Write %s %r\n", OutputCapsuleName, Status);
|
||||
|
||||
Done:
|
||||
if (BmpBuffer != NULL) {
|
||||
FreePool(BmpBuffer);
|
||||
FreePool (BmpBuffer);
|
||||
}
|
||||
|
||||
if (FullCapsuleBuffer != NULL) {
|
||||
FreePool(FullCapsuleBuffer);
|
||||
FreePool (FullCapsuleBuffer);
|
||||
}
|
||||
|
||||
return Status;
|
||||
@@ -174,18 +180,19 @@ Done:
|
||||
**/
|
||||
EFI_GUID *
|
||||
GetCapsuleImageTypeId (
|
||||
IN EFI_CAPSULE_HEADER *CapsuleHeader
|
||||
IN EFI_CAPSULE_HEADER *CapsuleHeader
|
||||
)
|
||||
{
|
||||
EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER *FmpCapsuleHeader;
|
||||
UINT64 *ItemOffsetList;
|
||||
EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader;
|
||||
EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER *FmpCapsuleHeader;
|
||||
UINT64 *ItemOffsetList;
|
||||
EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader;
|
||||
|
||||
FmpCapsuleHeader = (EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER *)((UINT8 *)CapsuleHeader + CapsuleHeader->HeaderSize);
|
||||
ItemOffsetList = (UINT64 *)(FmpCapsuleHeader + 1);
|
||||
ItemOffsetList = (UINT64 *)(FmpCapsuleHeader + 1);
|
||||
if (FmpCapsuleHeader->PayloadItemCount == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ImageHeader = (EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *)((UINT8 *)FmpCapsuleHeader + ItemOffsetList[FmpCapsuleHeader->EmbeddedDriverCount]);
|
||||
return &ImageHeader->UpdateImageTypeId;
|
||||
}
|
||||
@@ -199,7 +206,7 @@ GetCapsuleImageTypeId (
|
||||
**/
|
||||
UINT32
|
||||
GetEsrtFwType (
|
||||
IN EFI_GUID *ImageTypeId
|
||||
IN EFI_GUID *ImageTypeId
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -210,12 +217,12 @@ GetEsrtFwType (
|
||||
//
|
||||
// Check ESRT
|
||||
//
|
||||
Status = EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid, (VOID **)&Esrt);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
ASSERT(Esrt != NULL);
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiSystemResourceTableGuid, (VOID **)&Esrt);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ASSERT (Esrt != NULL);
|
||||
EsrtEntry = (VOID *)(Esrt + 1);
|
||||
for (Index = 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry++) {
|
||||
if (CompareGuid(&EsrtEntry->FwClass, ImageTypeId)) {
|
||||
if (CompareGuid (&EsrtEntry->FwClass, ImageTypeId)) {
|
||||
return EsrtEntry->FwType;
|
||||
}
|
||||
}
|
||||
@@ -238,19 +245,22 @@ GetEsrtFwType (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsValidCapsuleHeader (
|
||||
IN EFI_CAPSULE_HEADER *CapsuleHeader,
|
||||
IN UINT64 CapsuleSize
|
||||
IN EFI_CAPSULE_HEADER *CapsuleHeader,
|
||||
IN UINT64 CapsuleSize
|
||||
)
|
||||
{
|
||||
if (CapsuleSize < sizeof (EFI_CAPSULE_HEADER)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CapsuleHeader->CapsuleImageSize != CapsuleSize) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CapsuleHeader->HeaderSize < sizeof (EFI_CAPSULE_HEADER)) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -271,7 +281,7 @@ IsFmpCapsuleGuid (
|
||||
IN EFI_GUID *CapsuleGuid
|
||||
)
|
||||
{
|
||||
if (CompareGuid(&gEfiFmpCapsuleGuid, CapsuleGuid)) {
|
||||
if (CompareGuid (&gEfiFmpCapsuleGuid, CapsuleGuid)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -291,96 +301,98 @@ CreateNestedFmp (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
CHAR16 *OutputCapsuleName;
|
||||
VOID *CapsuleBuffer;
|
||||
UINTN FileSize;
|
||||
CHAR16 *CapsuleName;
|
||||
UINT8 *FullCapsuleBuffer;
|
||||
UINTN FullCapsuleBufferSize;
|
||||
EFI_CAPSULE_HEADER *NestedCapsuleHeader;
|
||||
EFI_GUID *ImageTypeId;
|
||||
UINT32 FwType;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *OutputCapsuleName;
|
||||
VOID *CapsuleBuffer;
|
||||
UINTN FileSize;
|
||||
CHAR16 *CapsuleName;
|
||||
UINT8 *FullCapsuleBuffer;
|
||||
UINTN FullCapsuleBufferSize;
|
||||
EFI_CAPSULE_HEADER *NestedCapsuleHeader;
|
||||
EFI_GUID *ImageTypeId;
|
||||
UINT32 FwType;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Argc != 5) {
|
||||
Print(L"CapsuleApp: Incorrect parameter count.\n");
|
||||
Print (L"CapsuleApp: Incorrect parameter count.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (StrCmp(Argv[3], L"-O") != 0) {
|
||||
Print(L"CapsuleApp: NO output capsule name.\n");
|
||||
if (StrCmp (Argv[3], L"-O") != 0) {
|
||||
Print (L"CapsuleApp: NO output capsule name.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
OutputCapsuleName = Argv[4];
|
||||
|
||||
CapsuleBuffer = NULL;
|
||||
FileSize = 0;
|
||||
CapsuleBuffer = NULL;
|
||||
FileSize = 0;
|
||||
FullCapsuleBuffer = NULL;
|
||||
|
||||
CapsuleName = Argv[2];
|
||||
Status = ReadFileToBuffer(CapsuleName, &FileSize, &CapsuleBuffer);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"CapsuleApp: Capsule image (%s) is not found.\n", CapsuleName);
|
||||
Status = ReadFileToBuffer (CapsuleName, &FileSize, &CapsuleBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"CapsuleApp: Capsule image (%s) is not found.\n", CapsuleName);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (!IsValidCapsuleHeader (CapsuleBuffer, FileSize)) {
|
||||
Print(L"CapsuleApp: Capsule image (%s) is not a valid capsule.\n", CapsuleName);
|
||||
Print (L"CapsuleApp: Capsule image (%s) is not a valid capsule.\n", CapsuleName);
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (!IsFmpCapsuleGuid (&((EFI_CAPSULE_HEADER *) CapsuleBuffer)->CapsuleGuid)) {
|
||||
Print(L"CapsuleApp: Capsule image (%s) is not a FMP capsule.\n", CapsuleName);
|
||||
if (!IsFmpCapsuleGuid (&((EFI_CAPSULE_HEADER *)CapsuleBuffer)->CapsuleGuid)) {
|
||||
Print (L"CapsuleApp: Capsule image (%s) is not a FMP capsule.\n", CapsuleName);
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
ImageTypeId = GetCapsuleImageTypeId(CapsuleBuffer);
|
||||
ImageTypeId = GetCapsuleImageTypeId (CapsuleBuffer);
|
||||
if (ImageTypeId == NULL) {
|
||||
Print(L"CapsuleApp: Capsule ImageTypeId is not found.\n");
|
||||
Print (L"CapsuleApp: Capsule ImageTypeId is not found.\n");
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
FwType = GetEsrtFwType(ImageTypeId);
|
||||
|
||||
FwType = GetEsrtFwType (ImageTypeId);
|
||||
if ((FwType != ESRT_FW_TYPE_SYSTEMFIRMWARE) && (FwType != ESRT_FW_TYPE_DEVICEFIRMWARE)) {
|
||||
Print(L"CapsuleApp: Capsule FwType is invalid.\n");
|
||||
Print (L"CapsuleApp: Capsule FwType is invalid.\n");
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
FullCapsuleBufferSize = NESTED_CAPSULE_HEADER_SIZE + FileSize;
|
||||
FullCapsuleBuffer = AllocatePool(FullCapsuleBufferSize);
|
||||
FullCapsuleBuffer = AllocatePool (FullCapsuleBufferSize);
|
||||
if (FullCapsuleBuffer == NULL) {
|
||||
Print(L"CapsuleApp: Capsule Buffer size (0x%x) too big.\n", FullCapsuleBufferSize);
|
||||
Print (L"CapsuleApp: Capsule Buffer size (0x%x) too big.\n", FullCapsuleBufferSize);
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
NestedCapsuleHeader = (EFI_CAPSULE_HEADER *)FullCapsuleBuffer;
|
||||
ZeroMem(NestedCapsuleHeader, NESTED_CAPSULE_HEADER_SIZE);
|
||||
CopyGuid(&NestedCapsuleHeader->CapsuleGuid, ImageTypeId);
|
||||
NestedCapsuleHeader->HeaderSize = NESTED_CAPSULE_HEADER_SIZE;
|
||||
NestedCapsuleHeader->Flags = (FwType == ESRT_FW_TYPE_SYSTEMFIRMWARE) ? SYSTEM_FIRMWARE_FLAG : DEVICE_FIRMWARE_FLAG;
|
||||
ZeroMem (NestedCapsuleHeader, NESTED_CAPSULE_HEADER_SIZE);
|
||||
CopyGuid (&NestedCapsuleHeader->CapsuleGuid, ImageTypeId);
|
||||
NestedCapsuleHeader->HeaderSize = NESTED_CAPSULE_HEADER_SIZE;
|
||||
NestedCapsuleHeader->Flags = (FwType == ESRT_FW_TYPE_SYSTEMFIRMWARE) ? SYSTEM_FIRMWARE_FLAG : DEVICE_FIRMWARE_FLAG;
|
||||
NestedCapsuleHeader->CapsuleImageSize = (UINT32)FullCapsuleBufferSize;
|
||||
|
||||
CopyMem((UINT8 *)NestedCapsuleHeader + NestedCapsuleHeader->HeaderSize, CapsuleBuffer, FileSize);
|
||||
CopyMem ((UINT8 *)NestedCapsuleHeader + NestedCapsuleHeader->HeaderSize, CapsuleBuffer, FileSize);
|
||||
|
||||
Status = WriteFileFromBuffer(OutputCapsuleName, FullCapsuleBufferSize, FullCapsuleBuffer);
|
||||
Print(L"CapsuleApp: Write %s %r\n", OutputCapsuleName, Status);
|
||||
Status = WriteFileFromBuffer (OutputCapsuleName, FullCapsuleBufferSize, FullCapsuleBuffer);
|
||||
Print (L"CapsuleApp: Write %s %r\n", OutputCapsuleName, Status);
|
||||
|
||||
Done:
|
||||
if (CapsuleBuffer != NULL) {
|
||||
FreePool(CapsuleBuffer);
|
||||
FreePool (CapsuleBuffer);
|
||||
}
|
||||
|
||||
if (FullCapsuleBuffer != NULL) {
|
||||
FreePool(FullCapsuleBuffer);
|
||||
FreePool (FullCapsuleBuffer);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear capsule status variable.
|
||||
|
||||
@@ -391,19 +403,19 @@ ClearCapsuleStatusVariable (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 Index;
|
||||
CHAR16 CapsuleVarName[20];
|
||||
CHAR16 *TempVarName;
|
||||
BOOLEAN Found;
|
||||
EFI_STATUS Status;
|
||||
UINT32 Index;
|
||||
CHAR16 CapsuleVarName[20];
|
||||
CHAR16 *TempVarName;
|
||||
BOOLEAN Found;
|
||||
|
||||
StrCpyS (CapsuleVarName, sizeof(CapsuleVarName)/sizeof(CapsuleVarName[0]), L"Capsule");
|
||||
StrCpyS (CapsuleVarName, sizeof (CapsuleVarName)/sizeof (CapsuleVarName[0]), L"Capsule");
|
||||
TempVarName = CapsuleVarName + StrLen (CapsuleVarName);
|
||||
Index = 0;
|
||||
Index = 0;
|
||||
|
||||
Found = FALSE;
|
||||
while (TRUE) {
|
||||
UnicodeSPrint (TempVarName, 5 * sizeof(CHAR16), L"%04x", Index);
|
||||
UnicodeSPrint (TempVarName, 5 * sizeof (CHAR16), L"%04x", Index);
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
CapsuleVarName,
|
||||
@@ -418,6 +430,7 @@ ClearCapsuleStatusVariable (
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
Found = TRUE;
|
||||
|
||||
Print (L"Clear %s %r\n", CapsuleVarName, Status);
|
||||
@@ -447,10 +460,10 @@ ClearCapsuleStatusVariable (
|
||||
**/
|
||||
EFI_STATUS
|
||||
BuildGatherList (
|
||||
IN VOID **CapsuleBuffer,
|
||||
IN UINTN *FileSize,
|
||||
IN UINTN CapsuleNum,
|
||||
OUT EFI_CAPSULE_BLOCK_DESCRIPTOR **BlockDescriptors
|
||||
IN VOID **CapsuleBuffer,
|
||||
IN UINTN *FileSize,
|
||||
IN UINTN CapsuleNum,
|
||||
OUT EFI_CAPSULE_BLOCK_DESCRIPTOR **BlockDescriptors
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -482,15 +495,15 @@ BuildGatherList (
|
||||
Count = (INT32)(NumberOfDescriptors + 2) / 2;
|
||||
}
|
||||
|
||||
Size = Count * sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR);
|
||||
BlockDescriptors1 = AllocateRuntimeZeroPool (Size);
|
||||
Size = Count * sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR);
|
||||
BlockDescriptors1 = AllocateRuntimeZeroPool (Size);
|
||||
if (BlockDescriptors1 == NULL) {
|
||||
Print (L"CapsuleApp: failed to allocate memory for descriptors\n");
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ERREXIT;
|
||||
} else {
|
||||
Print (L"CapsuleApp: creating capsule descriptors at 0x%X\n", (UINTN) BlockDescriptors1);
|
||||
Print (L"CapsuleApp: capsule data starts at 0x%X with size 0x%X\n", (UINTN) CapsuleBuffer[Index], FileSize[Index]);
|
||||
Print (L"CapsuleApp: creating capsule descriptors at 0x%X\n", (UINTN)BlockDescriptors1);
|
||||
Print (L"CapsuleApp: capsule data starts at 0x%X with size 0x%X\n", (UINTN)CapsuleBuffer[Index], FileSize[Index]);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -501,16 +514,16 @@ BuildGatherList (
|
||||
}
|
||||
|
||||
if (BlockDescriptorPre != NULL) {
|
||||
BlockDescriptorPre->Union.ContinuationPointer = (UINTN) BlockDescriptors1;
|
||||
BlockDescriptorPre->Length = 0;
|
||||
BlockDescriptorPre->Union.ContinuationPointer = (UINTN)BlockDescriptors1;
|
||||
BlockDescriptorPre->Length = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Fill them in
|
||||
//
|
||||
TempBlockPtr = BlockDescriptors1;
|
||||
TempDataPtr = CapsuleBuffer[Index];
|
||||
SizeLeft = FileSize[Index];
|
||||
TempBlockPtr = BlockDescriptors1;
|
||||
TempDataPtr = CapsuleBuffer[Index];
|
||||
SizeLeft = FileSize[Index];
|
||||
for (Number = 0; (Number < Count - 1) && (SizeLeft != 0); Number++) {
|
||||
//
|
||||
// Divide remaining data in half
|
||||
@@ -524,10 +537,11 @@ BuildGatherList (
|
||||
} else {
|
||||
Size = SizeLeft;
|
||||
}
|
||||
TempBlockPtr->Union.DataBlock = (UINTN)TempDataPtr;
|
||||
TempBlockPtr->Length = Size;
|
||||
Print (L"CapsuleApp: capsule block/size 0x%X/0x%X\n", (UINTN) TempDataPtr, Size);
|
||||
SizeLeft -= Size;
|
||||
|
||||
TempBlockPtr->Union.DataBlock = (UINTN)TempDataPtr;
|
||||
TempBlockPtr->Length = Size;
|
||||
Print (L"CapsuleApp: capsule block/size 0x%X/0x%X\n", (UINTN)TempDataPtr, Size);
|
||||
SizeLeft -= Size;
|
||||
TempDataPtr += Size;
|
||||
TempBlockPtr++;
|
||||
}
|
||||
@@ -555,10 +569,10 @@ BuildGatherList (
|
||||
//
|
||||
// Point the first list's last element to point to this second list.
|
||||
//
|
||||
TempBlockPtr->Union.ContinuationPointer = (UINTN) BlockDescriptors2;
|
||||
TempBlockPtr->Union.ContinuationPointer = (UINTN)BlockDescriptors2;
|
||||
|
||||
TempBlockPtr->Length = 0;
|
||||
TempBlockPtr = BlockDescriptors2;
|
||||
TempBlockPtr->Length = 0;
|
||||
TempBlockPtr = BlockDescriptors2;
|
||||
for (Number = 0; Number < Count - 1; Number++) {
|
||||
//
|
||||
// If second-to-last one, then dump rest to this element
|
||||
@@ -576,10 +590,10 @@ BuildGatherList (
|
||||
}
|
||||
}
|
||||
|
||||
TempBlockPtr->Union.DataBlock = (UINTN)TempDataPtr;
|
||||
TempBlockPtr->Length = Size;
|
||||
Print (L"CapsuleApp: capsule block/size 0x%X/0x%X\n", (UINTN) TempDataPtr, Size);
|
||||
SizeLeft -= Size;
|
||||
TempBlockPtr->Union.DataBlock = (UINTN)TempDataPtr;
|
||||
TempBlockPtr->Length = Size;
|
||||
Print (L"CapsuleApp: capsule block/size 0x%X/0x%X\n", (UINTN)TempDataPtr, Size);
|
||||
SizeLeft -= Size;
|
||||
TempDataPtr += Size;
|
||||
TempBlockPtr++;
|
||||
if (SizeLeft == 0) {
|
||||
@@ -596,20 +610,20 @@ BuildGatherList (
|
||||
// Null-terminate.
|
||||
//
|
||||
if (TempBlockPtr != NULL) {
|
||||
TempBlockPtr->Union.ContinuationPointer = (UINTN)NULL;
|
||||
TempBlockPtr->Length = 0;
|
||||
*BlockDescriptors = BlockDescriptorsHeader;
|
||||
TempBlockPtr->Union.ContinuationPointer = (UINTN)NULL;
|
||||
TempBlockPtr->Length = 0;
|
||||
*BlockDescriptors = BlockDescriptorsHeader;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ERREXIT:
|
||||
if (BlockDescriptors1 != NULL) {
|
||||
FreePool(BlockDescriptors1);
|
||||
FreePool (BlockDescriptors1);
|
||||
}
|
||||
|
||||
if (BlockDescriptors2 != NULL) {
|
||||
FreePool(BlockDescriptors2);
|
||||
FreePool (BlockDescriptors2);
|
||||
}
|
||||
|
||||
return Status;
|
||||
@@ -623,18 +637,18 @@ ERREXIT:
|
||||
**/
|
||||
VOID
|
||||
CleanGatherList (
|
||||
IN EFI_CAPSULE_BLOCK_DESCRIPTOR *BlockDescriptors,
|
||||
IN UINTN CapsuleNum
|
||||
IN EFI_CAPSULE_BLOCK_DESCRIPTOR *BlockDescriptors,
|
||||
IN UINTN CapsuleNum
|
||||
)
|
||||
{
|
||||
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr;
|
||||
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr1;
|
||||
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr2;
|
||||
UINTN Index;
|
||||
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr;
|
||||
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr1;
|
||||
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr2;
|
||||
UINTN Index;
|
||||
|
||||
if (BlockDescriptors != NULL) {
|
||||
TempBlockPtr1 = BlockDescriptors;
|
||||
while (1){
|
||||
while (1) {
|
||||
TempBlockPtr = TempBlockPtr1;
|
||||
for (Index = 0; Index < CapsuleNum; Index++) {
|
||||
if (TempBlockPtr[Index].Length == 0) {
|
||||
@@ -646,8 +660,8 @@ CleanGatherList (
|
||||
break;
|
||||
}
|
||||
|
||||
TempBlockPtr2 = (VOID *) ((UINTN) TempBlockPtr[Index].Union.ContinuationPointer);
|
||||
FreePool(TempBlockPtr1);
|
||||
TempBlockPtr2 = (VOID *)((UINTN)TempBlockPtr[Index].Union.ContinuationPointer);
|
||||
FreePool (TempBlockPtr1);
|
||||
TempBlockPtr1 = TempBlockPtr2;
|
||||
}
|
||||
}
|
||||
@@ -661,42 +675,42 @@ PrintUsage (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
Print(L"CapsuleApp: usage\n");
|
||||
Print(L" CapsuleApp <Capsule...> [-NR] [-OD [FSx]]\n");
|
||||
Print(L" CapsuleApp -S\n");
|
||||
Print(L" CapsuleApp -C\n");
|
||||
Print(L" CapsuleApp -P\n");
|
||||
Print(L" CapsuleApp -E\n");
|
||||
Print(L" CapsuleApp -L\n");
|
||||
Print(L" CapsuleApp -L INFO\n");
|
||||
Print(L" CapsuleApp -F\n");
|
||||
Print(L" CapsuleApp -G <BMP> -O <Capsule>\n");
|
||||
Print(L" CapsuleApp -N <Capsule> -O <NestedCapsule>\n");
|
||||
Print(L" CapsuleApp -D <Capsule>\n");
|
||||
Print(L" CapsuleApp -P GET <ImageTypeId> <Index> -O <FileName>\n");
|
||||
Print(L"Parameter:\n");
|
||||
Print(L" -NR: No reset will be triggered for the capsule\n");
|
||||
Print(L" with CAPSULE_FLAGS_PERSIST_ACROSS_RESET and without CAPSULE_FLAGS_INITIATE_RESET.\n");
|
||||
Print(L" -OD: Delivery of Capsules via file on Mass Storage device.\n");
|
||||
Print(L" -S: Dump capsule report variable (EFI_CAPSULE_REPORT_GUID),\n");
|
||||
Print(L" which is defined in UEFI specification.\n");
|
||||
Print(L" -C: Clear capsule report variable (EFI_CAPSULE_REPORT_GUID),\n");
|
||||
Print(L" which is defined in UEFI specification.\n");
|
||||
Print(L" -P: Dump UEFI FMP protocol info, or get image with specified\n");
|
||||
Print(L" ImageTypeId and Index (decimal format) to a file if 'GET'\n");
|
||||
Print(L" option is used.\n");
|
||||
Print(L" -E: Dump UEFI ESRT table info.\n");
|
||||
Print(L" -L: Dump provisioned capsule image information.\n");
|
||||
Print(L" -F: Dump all EFI System Partition.\n");
|
||||
Print(L" -G: Convert a BMP file to be an UX capsule,\n");
|
||||
Print(L" according to Windows Firmware Update document\n");
|
||||
Print(L" -N: Append a Capsule Header to an existing FMP capsule image\n");
|
||||
Print(L" with its ImageTypeId supported by the system,\n");
|
||||
Print(L" according to Windows Firmware Update document\n");
|
||||
Print(L" -O: Output new Capsule file name\n");
|
||||
Print(L" -D: Dump Capsule image header information, image payload\n");
|
||||
Print(L" information if it is an UX capsule and FMP header\n");
|
||||
Print(L" information if it is a FMP capsule.\n");
|
||||
Print (L"CapsuleApp: usage\n");
|
||||
Print (L" CapsuleApp <Capsule...> [-NR] [-OD [FSx]]\n");
|
||||
Print (L" CapsuleApp -S\n");
|
||||
Print (L" CapsuleApp -C\n");
|
||||
Print (L" CapsuleApp -P\n");
|
||||
Print (L" CapsuleApp -E\n");
|
||||
Print (L" CapsuleApp -L\n");
|
||||
Print (L" CapsuleApp -L INFO\n");
|
||||
Print (L" CapsuleApp -F\n");
|
||||
Print (L" CapsuleApp -G <BMP> -O <Capsule>\n");
|
||||
Print (L" CapsuleApp -N <Capsule> -O <NestedCapsule>\n");
|
||||
Print (L" CapsuleApp -D <Capsule>\n");
|
||||
Print (L" CapsuleApp -P GET <ImageTypeId> <Index> -O <FileName>\n");
|
||||
Print (L"Parameter:\n");
|
||||
Print (L" -NR: No reset will be triggered for the capsule\n");
|
||||
Print (L" with CAPSULE_FLAGS_PERSIST_ACROSS_RESET and without CAPSULE_FLAGS_INITIATE_RESET.\n");
|
||||
Print (L" -OD: Delivery of Capsules via file on Mass Storage device.\n");
|
||||
Print (L" -S: Dump capsule report variable (EFI_CAPSULE_REPORT_GUID),\n");
|
||||
Print (L" which is defined in UEFI specification.\n");
|
||||
Print (L" -C: Clear capsule report variable (EFI_CAPSULE_REPORT_GUID),\n");
|
||||
Print (L" which is defined in UEFI specification.\n");
|
||||
Print (L" -P: Dump UEFI FMP protocol info, or get image with specified\n");
|
||||
Print (L" ImageTypeId and Index (decimal format) to a file if 'GET'\n");
|
||||
Print (L" option is used.\n");
|
||||
Print (L" -E: Dump UEFI ESRT table info.\n");
|
||||
Print (L" -L: Dump provisioned capsule image information.\n");
|
||||
Print (L" -F: Dump all EFI System Partition.\n");
|
||||
Print (L" -G: Convert a BMP file to be an UX capsule,\n");
|
||||
Print (L" according to Windows Firmware Update document\n");
|
||||
Print (L" -N: Append a Capsule Header to an existing FMP capsule image\n");
|
||||
Print (L" with its ImageTypeId supported by the system,\n");
|
||||
Print (L" according to Windows Firmware Update document\n");
|
||||
Print (L" -O: Output new Capsule file name\n");
|
||||
Print (L" -D: Dump Capsule image header information, image payload\n");
|
||||
Print (L" information if it is an UX capsule and FMP header\n");
|
||||
Print (L" information if it is a FMP capsule.\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -738,54 +752,63 @@ UefiMain (
|
||||
EFI_GUID ImageTypeId;
|
||||
UINTN ImageIndex;
|
||||
|
||||
BlockDescriptors = NULL;
|
||||
MapFsStr = NULL;
|
||||
CapsuleNum = 0;
|
||||
BlockDescriptors = NULL;
|
||||
MapFsStr = NULL;
|
||||
CapsuleNum = 0;
|
||||
|
||||
Status = GetArg();
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"Please use UEFI SHELL to run this application!\n", Status);
|
||||
Status = GetArg ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"Please use UEFI SHELL to run this application!\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Argc < 2) {
|
||||
PrintUsage();
|
||||
PrintUsage ();
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
if (StrCmp(Argv[1], L"-D") == 0) {
|
||||
|
||||
if (StrCmp (Argv[1], L"-D") == 0) {
|
||||
if (Argc != 3) {
|
||||
Print(L"CapsuleApp: Incorrect parameter count.\n");
|
||||
Print (L"CapsuleApp: Incorrect parameter count.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
Status = DumpCapsule(Argv[2]);
|
||||
|
||||
Status = DumpCapsule (Argv[2]);
|
||||
return Status;
|
||||
}
|
||||
if (StrCmp(Argv[1], L"-G") == 0) {
|
||||
Status = CreateBmpFmp();
|
||||
|
||||
if (StrCmp (Argv[1], L"-G") == 0) {
|
||||
Status = CreateBmpFmp ();
|
||||
return Status;
|
||||
}
|
||||
if (StrCmp(Argv[1], L"-N") == 0) {
|
||||
Status = CreateNestedFmp();
|
||||
|
||||
if (StrCmp (Argv[1], L"-N") == 0) {
|
||||
Status = CreateNestedFmp ();
|
||||
return Status;
|
||||
}
|
||||
if (StrCmp(Argv[1], L"-S") == 0) {
|
||||
Status = DumpCapsuleStatusVariable();
|
||||
|
||||
if (StrCmp (Argv[1], L"-S") == 0) {
|
||||
Status = DumpCapsuleStatusVariable ();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
if (StrCmp(Argv[1], L"-C") == 0) {
|
||||
Status = ClearCapsuleStatusVariable();
|
||||
|
||||
if (StrCmp (Argv[1], L"-C") == 0) {
|
||||
Status = ClearCapsuleStatusVariable ();
|
||||
return Status;
|
||||
}
|
||||
if (StrCmp(Argv[1], L"-P") == 0) {
|
||||
|
||||
if (StrCmp (Argv[1], L"-P") == 0) {
|
||||
if (Argc == 2) {
|
||||
DumpFmpData();
|
||||
DumpFmpData ();
|
||||
}
|
||||
|
||||
if (Argc >= 3) {
|
||||
if (StrCmp(Argv[2], L"GET") != 0) {
|
||||
Print(L"CapsuleApp: Unrecognized option(%s).\n", Argv[2]);
|
||||
if (StrCmp (Argv[2], L"GET") != 0) {
|
||||
Print (L"CapsuleApp: Unrecognized option(%s).\n", Argv[2]);
|
||||
return EFI_UNSUPPORTED;
|
||||
} else {
|
||||
if (Argc != 7) {
|
||||
Print(L"CapsuleApp: Incorrect parameter count.\n");
|
||||
Print (L"CapsuleApp: Incorrect parameter count.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -797,54 +820,58 @@ UefiMain (
|
||||
Print (L"Invalid ImageTypeId - %s\n", Argv[3]);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
ImageIndex = StrDecimalToUintn(Argv[4]);
|
||||
if (StrCmp(Argv[5], L"-O") != 0) {
|
||||
Print(L"CapsuleApp: NO output file name.\n");
|
||||
|
||||
ImageIndex = StrDecimalToUintn (Argv[4]);
|
||||
if (StrCmp (Argv[5], L"-O") != 0) {
|
||||
Print (L"CapsuleApp: NO output file name.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
DumpFmpImage(&ImageTypeId, ImageIndex, Argv[6]);
|
||||
|
||||
DumpFmpImage (&ImageTypeId, ImageIndex, Argv[6]);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (StrCmp(Argv[1], L"-E") == 0) {
|
||||
DumpEsrtData();
|
||||
if (StrCmp (Argv[1], L"-E") == 0) {
|
||||
DumpEsrtData ();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (StrCmp(Argv[1], L"-L") == 0) {
|
||||
if (Argc >= 3 && StrCmp(Argv[2], L"INFO") == 0) {
|
||||
DumpProvisionedCapsule(TRUE);
|
||||
if (StrCmp (Argv[1], L"-L") == 0) {
|
||||
if ((Argc >= 3) && (StrCmp (Argv[2], L"INFO") == 0)) {
|
||||
DumpProvisionedCapsule (TRUE);
|
||||
} else {
|
||||
DumpProvisionedCapsule(FALSE);
|
||||
DumpProvisionedCapsule (FALSE);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (StrCmp(Argv[1], L"-F") == 0) {
|
||||
DumpAllEfiSysPartition();
|
||||
if (StrCmp (Argv[1], L"-F") == 0) {
|
||||
DumpAllEfiSysPartition ();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (Argv[1][0] == L'-') {
|
||||
Print(L"CapsuleApp: Unrecognized option(%s).\n", Argv[1]);
|
||||
Print (L"CapsuleApp: Unrecognized option(%s).\n", Argv[1]);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
CapsuleFirstIndex = 1;
|
||||
NoReset = FALSE;
|
||||
CapsuleOnDisk = FALSE;
|
||||
ParaOdIndex = 0;
|
||||
ParaNrIndex = 0;
|
||||
NoReset = FALSE;
|
||||
CapsuleOnDisk = FALSE;
|
||||
ParaOdIndex = 0;
|
||||
ParaNrIndex = 0;
|
||||
|
||||
for (Index = 1; Index < Argc; Index++) {
|
||||
if (StrCmp(Argv[Index], L"-OD") == 0) {
|
||||
ParaOdIndex = Index;
|
||||
if (StrCmp (Argv[Index], L"-OD") == 0) {
|
||||
ParaOdIndex = Index;
|
||||
CapsuleOnDisk = TRUE;
|
||||
} else if (StrCmp(Argv[Index], L"-NR") == 0) {
|
||||
} else if (StrCmp (Argv[Index], L"-NR") == 0) {
|
||||
ParaNrIndex = Index;
|
||||
NoReset = TRUE;
|
||||
NoReset = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -886,37 +913,40 @@ UefiMain (
|
||||
CapsuleNum = CapsuleLastIndex - CapsuleFirstIndex + 1;
|
||||
|
||||
if (CapsuleFirstIndex > CapsuleLastIndex) {
|
||||
Print(L"CapsuleApp: NO capsule image.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
if (CapsuleNum > MAX_CAPSULE_NUM) {
|
||||
Print(L"CapsuleApp: Too many capsule images.\n");
|
||||
Print (L"CapsuleApp: NO capsule image.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
ZeroMem(&CapsuleBuffer, sizeof(CapsuleBuffer));
|
||||
ZeroMem(&CapsuleBufferSize, sizeof(CapsuleBufferSize));
|
||||
if (CapsuleNum > MAX_CAPSULE_NUM) {
|
||||
Print (L"CapsuleApp: Too many capsule images.\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
ZeroMem (&CapsuleBuffer, sizeof (CapsuleBuffer));
|
||||
ZeroMem (&CapsuleBufferSize, sizeof (CapsuleBufferSize));
|
||||
BlockDescriptors = NULL;
|
||||
|
||||
for (Index = 0; Index < CapsuleNum; Index++) {
|
||||
CapsuleName = Argv[CapsuleFirstIndex + Index];
|
||||
Status = ReadFileToBuffer(CapsuleName, &CapsuleBufferSize[Index], &CapsuleBuffer[Index]);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"CapsuleApp: capsule image (%s) is not found.\n", CapsuleName);
|
||||
Status = ReadFileToBuffer (CapsuleName, &CapsuleBufferSize[Index], &CapsuleBuffer[Index]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"CapsuleApp: capsule image (%s) is not found.\n", CapsuleName);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (!IsValidCapsuleHeader (CapsuleBuffer[Index], CapsuleBufferSize[Index])) {
|
||||
Print(L"CapsuleApp: Capsule image (%s) is not a valid capsule.\n", CapsuleName);
|
||||
Print (L"CapsuleApp: Capsule image (%s) is not a valid capsule.\n", CapsuleName);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
CapsuleNames[Index] = CapsuleName;
|
||||
}
|
||||
|
||||
//
|
||||
// Every capsule use 2 descriptor 1 for data 1 for end
|
||||
//
|
||||
Status = BuildGatherList(CapsuleBuffer, CapsuleBufferSize, CapsuleNum, &BlockDescriptors);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = BuildGatherList (CapsuleBuffer, CapsuleBufferSize, CapsuleNum, &BlockDescriptors);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
@@ -925,18 +955,19 @@ UefiMain (
|
||||
//
|
||||
NeedReset = FALSE;
|
||||
for (Index = 0; Index < CapsuleNum; Index++) {
|
||||
CapsuleHeaderArray[Index] = (EFI_CAPSULE_HEADER *) CapsuleBuffer[Index];
|
||||
CapsuleHeaderArray[Index] = (EFI_CAPSULE_HEADER *)CapsuleBuffer[Index];
|
||||
if ((CapsuleHeaderArray[Index]->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
|
||||
NeedReset = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
CapsuleHeaderArray[CapsuleNum] = NULL;
|
||||
|
||||
//
|
||||
// Inquire platform capability of UpdateCapsule.
|
||||
//
|
||||
Status = gRT->QueryCapsuleCapabilities (CapsuleHeaderArray, CapsuleNum, &MaxCapsuleSize, &ResetType);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"CapsuleApp: failed to query capsule capability - %r\n", Status);
|
||||
goto Done;
|
||||
}
|
||||
@@ -970,11 +1001,12 @@ UefiMain (
|
||||
// Check whether the input capsule image has the flag of persist across system reset.
|
||||
//
|
||||
if (NeedReset) {
|
||||
Status = gRT->UpdateCapsule(CapsuleHeaderArray,CapsuleNum,(UINTN) BlockDescriptors);
|
||||
Status = gRT->UpdateCapsule (CapsuleHeaderArray, CapsuleNum, (UINTN)BlockDescriptors);
|
||||
if (Status != EFI_SUCCESS) {
|
||||
Print (L"CapsuleApp: failed to update capsule - %r\n", Status);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// For capsule with CAPSULE_FLAGS_PERSIST_ACROSS_RESET + CAPSULE_FLAGS_INITIATE_RESET,
|
||||
// a system reset should have been triggered by gRT->UpdateCapsule() calling above.
|
||||
@@ -994,7 +1026,7 @@ UefiMain (
|
||||
// For capsule who has no reset flag, only call UpdateCapsule Service without a
|
||||
// system reset. The service will process the capsule immediately.
|
||||
//
|
||||
Status = gRT->UpdateCapsule (CapsuleHeaderArray,CapsuleNum,(UINTN) BlockDescriptors);
|
||||
Status = gRT->UpdateCapsule (CapsuleHeaderArray, CapsuleNum, (UINTN)BlockDescriptors);
|
||||
if (Status != EFI_SUCCESS) {
|
||||
Print (L"CapsuleApp: failed to update capsule - %r\n", Status);
|
||||
}
|
||||
@@ -1009,7 +1041,7 @@ Done:
|
||||
}
|
||||
}
|
||||
|
||||
CleanGatherList(BlockDescriptors, CapsuleNum);
|
||||
CleanGatherList (BlockDescriptors, CapsuleNum);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _CAPSULE_APP_H_
|
||||
#define _CAPSULE_APP_H_
|
||||
|
||||
@@ -42,22 +41,22 @@
|
||||
#define CAPSULE_HEADER_SIZE 0x20
|
||||
|
||||
#define NESTED_CAPSULE_HEADER_SIZE SIZE_4KB
|
||||
#define SYSTEM_FIRMWARE_FLAG 0x50000
|
||||
#define DEVICE_FIRMWARE_FLAG 0x78010
|
||||
#define SYSTEM_FIRMWARE_FLAG 0x50000
|
||||
#define DEVICE_FIRMWARE_FLAG 0x78010
|
||||
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 0
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 0
|
||||
|
||||
#define MAX_CAPSULE_NUM 10
|
||||
#define MAX_CAPSULE_NUM 10
|
||||
|
||||
//
|
||||
// (20 * (6+5+2))+1) unicode characters from EFI FAT spec (doubled for bytes)
|
||||
//
|
||||
#define MAX_FILE_NAME_SIZE 522
|
||||
#define MAX_FILE_NAME_LEN (MAX_FILE_NAME_SIZE / sizeof(CHAR16))
|
||||
#define MAX_FILE_NAME_SIZE 522
|
||||
#define MAX_FILE_NAME_LEN (MAX_FILE_NAME_SIZE / sizeof(CHAR16))
|
||||
|
||||
extern UINTN Argc;
|
||||
extern CHAR16 **Argv;
|
||||
extern UINTN Argc;
|
||||
extern CHAR16 **Argv;
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,7 +80,6 @@ GetShellProtocol (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Read a file.
|
||||
|
||||
@@ -95,9 +93,9 @@ GetShellProtocol (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ReadFileToBuffer (
|
||||
IN CHAR16 *FileName,
|
||||
OUT UINTN *BufferSize,
|
||||
OUT VOID **Buffer
|
||||
IN CHAR16 *FileName,
|
||||
OUT UINTN *BufferSize,
|
||||
OUT VOID **Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -113,12 +111,11 @@ ReadFileToBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WriteFileFromBuffer (
|
||||
IN CHAR16 *FileName,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
IN CHAR16 *FileName,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Dump capsule information
|
||||
|
||||
@@ -129,7 +126,7 @@ WriteFileFromBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
DumpCapsule (
|
||||
IN CHAR16 *CapsuleName
|
||||
IN CHAR16 *CapsuleName
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -182,7 +179,7 @@ DumpEsrtData (
|
||||
**/
|
||||
VOID
|
||||
DumpProvisionedCapsule (
|
||||
IN BOOLEAN DumpCapsuleInfo
|
||||
IN BOOLEAN DumpCapsuleInfo
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -193,7 +190,6 @@ DumpAllEfiSysPartition (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Get SimpleFileSystem from boot option file path.
|
||||
|
||||
@@ -213,7 +209,6 @@ GetEfiSysPartitionFromBootOptionFilePath (
|
||||
OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **Fs
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Process Capsule On Disk.
|
||||
|
||||
@@ -229,12 +224,11 @@ GetEfiSysPartitionFromBootOptionFilePath (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessCapsuleOnDisk (
|
||||
IN VOID **CapsuleBuffer,
|
||||
IN UINTN *CapsuleBufferSize,
|
||||
IN CHAR16 **FilePath,
|
||||
IN CHAR16 *Map,
|
||||
IN UINTN CapsuleNum
|
||||
IN VOID **CapsuleBuffer,
|
||||
IN UINTN *CapsuleBufferSize,
|
||||
IN CHAR16 **FilePath,
|
||||
IN CHAR16 *Map,
|
||||
IN UINTN CapsuleNum
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,9 @@
|
||||
|
||||
#include "CapsuleApp.h"
|
||||
|
||||
EFI_GUID mCapsuleOnDiskBootOptionGuid = { 0x4CC29BB7, 0x2413, 0x40A2, { 0xB0, 0x6D, 0x25, 0x3E, 0x37, 0x10, 0xF5, 0x32 } };
|
||||
EFI_GUID mCapsuleOnDiskBootOptionGuid = {
|
||||
0x4CC29BB7, 0x2413, 0x40A2, { 0xB0, 0x6D, 0x25, 0x3E, 0x37, 0x10, 0xF5, 0x32 }
|
||||
};
|
||||
|
||||
/**
|
||||
Get file name from file path.
|
||||
@@ -20,13 +22,13 @@ EFI_GUID mCapsuleOnDiskBootOptionGuid = { 0x4CC29BB7, 0x2413, 0x40A2, { 0xB0, 0x
|
||||
**/
|
||||
CHAR16 *
|
||||
GetFileNameFromPath (
|
||||
CHAR16 *FilePath
|
||||
CHAR16 *FilePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
SHELL_FILE_HANDLE Handle;
|
||||
EFI_FILE_INFO *FileInfo;
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
SHELL_FILE_HANDLE Handle;
|
||||
EFI_FILE_INFO *FileInfo;
|
||||
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
if (ShellProtocol == NULL) {
|
||||
@@ -68,13 +70,13 @@ GetFileNameFromPath (
|
||||
**/
|
||||
BOOLEAN
|
||||
IsEfiSysPartitionDevicePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||
HARDDRIVE_DEVICE_PATH *Hd;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||
HARDDRIVE_DEVICE_PATH *Hd;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Check if the device path contains GPT node
|
||||
@@ -83,12 +85,14 @@ IsEfiSysPartitionDevicePath (
|
||||
|
||||
while (!IsDevicePathEnd (TempDevicePath)) {
|
||||
if ((DevicePathType (TempDevicePath) == MEDIA_DEVICE_PATH) &&
|
||||
(DevicePathSubType (TempDevicePath) == MEDIA_HARDDRIVE_DP)) {
|
||||
(DevicePathSubType (TempDevicePath) == MEDIA_HARDDRIVE_DP))
|
||||
{
|
||||
Hd = (HARDDRIVE_DEVICE_PATH *)TempDevicePath;
|
||||
if (Hd->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||
}
|
||||
|
||||
@@ -112,19 +116,19 @@ DumpAllEfiSysPartition (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_HANDLE *SimpleFileSystemHandles;
|
||||
UINTN NumberSimpleFileSystemHandles;
|
||||
UINTN Index;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN NumberEfiSystemPartitions;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
EFI_HANDLE *SimpleFileSystemHandles;
|
||||
UINTN NumberSimpleFileSystemHandles;
|
||||
UINTN Index;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN NumberEfiSystemPartitions;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
|
||||
NumberEfiSystemPartitions = 0;
|
||||
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
if (ShellProtocol == NULL) {
|
||||
Print (L"Get Shell Protocol Fail\n");;
|
||||
return ;
|
||||
Print (L"Get Shell Protocol Fail\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Print (L"EFI System Partition list:\n");
|
||||
@@ -141,12 +145,12 @@ DumpAllEfiSysPartition (
|
||||
DevicePath = DevicePathFromHandle (SimpleFileSystemHandles[Index]);
|
||||
if (IsEfiSysPartitionDevicePath (DevicePath)) {
|
||||
NumberEfiSystemPartitions++;
|
||||
Print(L" %s\n %s\n", ShellProtocol->GetMapFromDevicePath (&DevicePath), ConvertDevicePathToText (DevicePath, TRUE, TRUE));
|
||||
Print (L" %s\n %s\n", ShellProtocol->GetMapFromDevicePath (&DevicePath), ConvertDevicePathToText (DevicePath, TRUE, TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
if (NumberEfiSystemPartitions == 0) {
|
||||
Print(L" No ESP found.\n");
|
||||
Print (L" No ESP found.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,21 +166,22 @@ IsCapsuleProvisioned (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 OsIndication;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
UINT64 OsIndication;
|
||||
UINTN DataSize;
|
||||
|
||||
OsIndication = 0;
|
||||
DataSize = sizeof(UINT64);
|
||||
Status = gRT->GetVariable (
|
||||
L"OsIndications",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&OsIndication
|
||||
);
|
||||
DataSize = sizeof (UINT64);
|
||||
Status = gRT->GetVariable (
|
||||
L"OsIndications",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&OsIndication
|
||||
);
|
||||
if (!EFI_ERROR (Status) &&
|
||||
(OsIndication & EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) != 0) {
|
||||
((OsIndication & EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) != 0))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -199,11 +204,11 @@ GetEfiSysPartition (
|
||||
OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **Fs
|
||||
)
|
||||
{
|
||||
EFI_HANDLE *SimpleFileSystemHandles;
|
||||
UINTN NumberSimpleFileSystemHandles;
|
||||
UINTN Index;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE *SimpleFileSystemHandles;
|
||||
UINTN NumberSimpleFileSystemHandles;
|
||||
UINTN Index;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
@@ -245,15 +250,15 @@ GetEfiSysPartition (
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetEfiSysPartitionFromDevPath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **FsDevicePath,
|
||||
OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **Fs
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **FsDevicePath,
|
||||
OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **Fs
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||
HARDDRIVE_DEVICE_PATH *Hd;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||
HARDDRIVE_DEVICE_PATH *Hd;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Check if the device path contains GPT node
|
||||
@@ -261,12 +266,14 @@ GetEfiSysPartitionFromDevPath (
|
||||
TempDevicePath = DevicePath;
|
||||
while (!IsDevicePathEnd (TempDevicePath)) {
|
||||
if ((DevicePathType (TempDevicePath) == MEDIA_DEVICE_PATH) &&
|
||||
(DevicePathSubType (TempDevicePath) == MEDIA_HARDDRIVE_DP)) {
|
||||
(DevicePathSubType (TempDevicePath) == MEDIA_HARDDRIVE_DP))
|
||||
{
|
||||
Hd = (HARDDRIVE_DEVICE_PATH *)TempDevicePath;
|
||||
if (Hd->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||
}
|
||||
|
||||
@@ -310,13 +317,13 @@ GetEfiSysPartitionFromBootOptionFilePath (
|
||||
OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **Fs
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *CurFullPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *PreFullPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *FsFullPath;
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *CurFullPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *PreFullPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *FsFullPath;
|
||||
|
||||
CurFullPath = NULL;
|
||||
FsFullPath = NULL;
|
||||
FsFullPath = NULL;
|
||||
//
|
||||
// Try every full device Path generated from bootoption
|
||||
//
|
||||
@@ -337,13 +344,14 @@ GetEfiSysPartitionFromBootOptionFilePath (
|
||||
}
|
||||
|
||||
DEBUG_CODE_BEGIN ();
|
||||
CHAR16 *DevicePathStr;
|
||||
CHAR16 *DevicePathStr;
|
||||
|
||||
DevicePathStr = ConvertDevicePathToText (CurFullPath, TRUE, TRUE);
|
||||
if (DevicePathStr != NULL) {
|
||||
DEBUG ((DEBUG_INFO, "Full device path %s\n", DevicePathStr));
|
||||
FreePool (DevicePathStr);
|
||||
}
|
||||
|
||||
DevicePathStr = ConvertDevicePathToText (CurFullPath, TRUE, TRUE);
|
||||
if (DevicePathStr != NULL){
|
||||
DEBUG ((DEBUG_INFO, "Full device path %s\n", DevicePathStr));
|
||||
FreePool (DevicePathStr);
|
||||
}
|
||||
DEBUG_CODE_END ();
|
||||
|
||||
Status = GetEfiSysPartitionFromDevPath (CurFullPath, &FsFullPath, Fs);
|
||||
@@ -376,7 +384,7 @@ GetUpdateFileSystem (
|
||||
OUT UINT16 *BootNext,
|
||||
OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **Fs,
|
||||
OUT BOOLEAN *UpdateBootNext
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 BootOptionName[20];
|
||||
@@ -396,7 +404,7 @@ GetUpdateFileSystem (
|
||||
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
if (ShellProtocol == NULL) {
|
||||
Print (L"Get Shell Protocol Fail\n");;
|
||||
Print (L"Get Shell Protocol Fail\n");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -404,14 +412,14 @@ GetUpdateFileSystem (
|
||||
// 1. If Fs is not assigned and there are capsule provisioned before,
|
||||
// Get EFI system partition from BootNext.
|
||||
//
|
||||
if (IsCapsuleProvisioned () && Map == NULL) {
|
||||
if (IsCapsuleProvisioned () && (Map == NULL)) {
|
||||
Status = GetVariable2 (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
(VOID **)&BootNextData,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status) || BootNextData == NULL) {
|
||||
if (EFI_ERROR (Status) || (BootNextData == NULL)) {
|
||||
Print (L"Get Boot Next Data Fail. Status = %r\n", Status);
|
||||
return EFI_NOT_FOUND;
|
||||
} else {
|
||||
@@ -419,11 +427,11 @@ GetUpdateFileSystem (
|
||||
Status = EfiBootManagerVariableToLoadOption (BootOptionName, &BootNextOption);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DevicePath = BootNextOption.FilePath;
|
||||
Status = GetEfiSysPartitionFromBootOptionFilePath (DevicePath, &FullPath, Fs);
|
||||
Status = GetEfiSysPartitionFromBootOptionFilePath (DevicePath, &FullPath, Fs);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*UpdateBootNext = FALSE;
|
||||
Print(L"Get EFI system partition from BootNext : %s\n", BootNextOption.Description);
|
||||
Print(L"%s %s\n", ShellProtocol->GetMapFromDevicePath (&FullPath), ConvertDevicePathToText (FullPath, TRUE, TRUE));
|
||||
Print (L"Get EFI system partition from BootNext : %s\n", BootNextOption.Description);
|
||||
Print (L"%s %s\n", ShellProtocol->GetMapFromDevicePath (&FullPath), ConvertDevicePathToText (FullPath, TRUE, TRUE));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -436,10 +444,10 @@ GetUpdateFileSystem (
|
||||
if (Map != NULL) {
|
||||
MappedDevicePath = ShellProtocol->GetDevicePathFromMap (Map);
|
||||
if (MappedDevicePath == NULL) {
|
||||
Print(L"'%s' is not a valid mapping.\n", Map);
|
||||
Print (L"'%s' is not a valid mapping.\n", Map);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
} else if (!IsEfiSysPartitionDevicePath (DuplicateDevicePath (MappedDevicePath))) {
|
||||
Print(L"'%s' is not a EFI System Partition.\n", Map);
|
||||
Print (L"'%s' is not a EFI System Partition.\n", Map);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
@@ -448,9 +456,10 @@ GetUpdateFileSystem (
|
||||
// 2. Get EFI system partition form boot options.
|
||||
//
|
||||
BootOptionBuffer = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
|
||||
if ( (BootOptionBuffer == NULL) ||
|
||||
(BootOptionCount == 0 && Map == NULL)
|
||||
) {
|
||||
if ((BootOptionBuffer == NULL) ||
|
||||
((BootOptionCount == 0) && (Map == NULL))
|
||||
)
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -458,32 +467,34 @@ GetUpdateFileSystem (
|
||||
//
|
||||
// Get the boot option from the link list
|
||||
//
|
||||
DevicePath = BootOptionBuffer[Index].FilePath;
|
||||
DevicePath = BootOptionBuffer[Index].FilePath;
|
||||
|
||||
//
|
||||
// Skip inactive or legacy boot options
|
||||
//
|
||||
if ((BootOptionBuffer[Index].Attributes & LOAD_OPTION_ACTIVE) == 0 ||
|
||||
DevicePathType (DevicePath) == BBS_DEVICE_PATH) {
|
||||
if (((BootOptionBuffer[Index].Attributes & LOAD_OPTION_ACTIVE) == 0) ||
|
||||
(DevicePathType (DevicePath) == BBS_DEVICE_PATH))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG_CODE_BEGIN ();
|
||||
CHAR16 *DevicePathStr;
|
||||
CHAR16 *DevicePathStr;
|
||||
|
||||
DevicePathStr = ConvertDevicePathToText (DevicePath, TRUE, TRUE);
|
||||
if (DevicePathStr != NULL) {
|
||||
DEBUG ((DEBUG_INFO, "Try BootOption %s\n", DevicePathStr));
|
||||
FreePool (DevicePathStr);
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "DevicePathToStr failed\n"));
|
||||
}
|
||||
|
||||
DevicePathStr = ConvertDevicePathToText (DevicePath, TRUE, TRUE);
|
||||
if (DevicePathStr != NULL){
|
||||
DEBUG ((DEBUG_INFO, "Try BootOption %s\n", DevicePathStr));
|
||||
FreePool (DevicePathStr);
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "DevicePathToStr failed\n"));
|
||||
}
|
||||
DEBUG_CODE_END ();
|
||||
|
||||
Status = GetEfiSysPartitionFromBootOptionFilePath (DevicePath, &FullPath, Fs);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (Map == NULL) {
|
||||
*BootNext = (UINT16) BootOptionBuffer[Index].OptionNumber;
|
||||
*BootNext = (UINT16)BootOptionBuffer[Index].OptionNumber;
|
||||
*UpdateBootNext = TRUE;
|
||||
Print (L"Found EFI system partition on Boot%04x: %s\n", *BootNext, BootOptionBuffer[Index].Description);
|
||||
Print (L"%s %s\n", ShellProtocol->GetMapFromDevicePath (&FullPath), ConvertDevicePathToText (FullPath, TRUE, TRUE));
|
||||
@@ -491,7 +502,7 @@ GetUpdateFileSystem (
|
||||
}
|
||||
|
||||
if (StrnCmp (Map, ShellProtocol->GetMapFromDevicePath (&FullPath), StrLen (Map)) == 0) {
|
||||
*BootNext = (UINT16) BootOptionBuffer[Index].OptionNumber;
|
||||
*BootNext = (UINT16)BootOptionBuffer[Index].OptionNumber;
|
||||
*UpdateBootNext = TRUE;
|
||||
Print (L"Found Boot Option on %s : %s\n", Map, BootOptionBuffer[Index].Description);
|
||||
return EFI_SUCCESS;
|
||||
@@ -507,11 +518,12 @@ GetUpdateFileSystem (
|
||||
// If map is assigned, try to get ESP from mapped Fs.
|
||||
//
|
||||
DevicePath = DuplicateDevicePath (MappedDevicePath);
|
||||
Status = GetEfiSysPartitionFromDevPath (DevicePath, &FullPath, Fs);
|
||||
Status = GetEfiSysPartitionFromDevPath (DevicePath, &FullPath, Fs);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"Error: Cannot get EFI system partition from '%s' - %r\n", Map, Status);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Print (L"Warning: Cannot find Boot Option on '%s'!\n", Map);
|
||||
} else {
|
||||
Status = GetEfiSysPartition (&DevicePath, Fs);
|
||||
@@ -529,15 +541,16 @@ GetUpdateFileSystem (
|
||||
LOAD_OPTION_ACTIVE,
|
||||
L"UEFI Capsule On Disk",
|
||||
DevicePath,
|
||||
(UINT8 *) &mCapsuleOnDiskBootOptionGuid,
|
||||
sizeof(EFI_GUID)
|
||||
(UINT8 *)&mCapsuleOnDiskBootOptionGuid,
|
||||
sizeof (EFI_GUID)
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, (UINTN) -1); {
|
||||
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, (UINTN)-1);
|
||||
{
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*UpdateBootNext = TRUE;
|
||||
*BootNext = (UINT16) NewOption.OptionNumber;
|
||||
Print (L" Boot%04x: %s\n", *BootNext, ConvertDevicePathToText(DevicePath, TRUE, TRUE));
|
||||
*BootNext = (UINT16)NewOption.OptionNumber;
|
||||
Print (L" Boot%04x: %s\n", *BootNext, ConvertDevicePathToText (DevicePath, TRUE, TRUE));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -564,25 +577,25 @@ GetUpdateFileSystem (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WriteUpdateFile (
|
||||
IN VOID **Buffer,
|
||||
IN UINTN *BufferSize,
|
||||
IN CHAR16 **FileName,
|
||||
IN UINTN BufferNum,
|
||||
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Fs
|
||||
)
|
||||
IN VOID **Buffer,
|
||||
IN UINTN *BufferSize,
|
||||
IN CHAR16 **FileName,
|
||||
IN UINTN BufferNum,
|
||||
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Fs
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE *Root;
|
||||
EFI_FILE *FileHandle;
|
||||
EFI_FILE_PROTOCOL *DirHandle;
|
||||
UINT64 FileInfo;
|
||||
VOID *Filebuffer;
|
||||
UINTN FileSize;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE *Root;
|
||||
EFI_FILE *FileHandle;
|
||||
EFI_FILE_PROTOCOL *DirHandle;
|
||||
UINT64 FileInfo;
|
||||
VOID *Filebuffer;
|
||||
UINTN FileSize;
|
||||
UINTN Index;
|
||||
|
||||
DirHandle = NULL;
|
||||
FileHandle = NULL;
|
||||
Index = 0;
|
||||
DirHandle = NULL;
|
||||
FileHandle = NULL;
|
||||
Index = 0;
|
||||
|
||||
//
|
||||
// Open Root from SFS
|
||||
@@ -600,15 +613,16 @@ WriteUpdateFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = Root->Open (Root, &DirHandle, L"\\EFI", EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, EFI_FILE_DIRECTORY);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print(L"Unable to create %s directory\n", L"\\EFI");
|
||||
Print (L"Unable to create %s directory\n", L"\\EFI");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
Status = Root->Open (Root, &DirHandle, EFI_CAPSULE_FILE_DIRECTORY, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE , 0);
|
||||
|
||||
Status = Root->Open (Root, &DirHandle, EFI_CAPSULE_FILE_DIRECTORY, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = Root->Open (Root, &DirHandle, EFI_CAPSULE_FILE_DIRECTORY, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, EFI_FILE_DIRECTORY);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print(L"Unable to create %s directory\n", EFI_CAPSULE_FILE_DIRECTORY);
|
||||
Print (L"Unable to create %s directory\n", EFI_CAPSULE_FILE_DIRECTORY);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
@@ -643,7 +657,7 @@ WriteUpdateFile (
|
||||
// Set the file size to 0.
|
||||
//
|
||||
FileInfo = 0;
|
||||
Status = FileHandleSetSize (FileHandle, FileInfo);
|
||||
Status = FileHandleSetSize (FileHandle, FileInfo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"Error Deleting %s\n", FileName[Index]);
|
||||
FileHandleClose (FileHandle);
|
||||
@@ -655,8 +669,8 @@ WriteUpdateFile (
|
||||
// Write Filebuffer to file
|
||||
//
|
||||
Filebuffer = Buffer[Index];
|
||||
FileSize = BufferSize[Index];
|
||||
Status = FileHandleWrite (FileHandle, &FileSize, Filebuffer);
|
||||
FileSize = BufferSize[Index];
|
||||
Status = FileHandleWrite (FileHandle, &FileSize, Filebuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"Unable to write Capsule Update to %s, Status = %r\n", FileName[Index], Status);
|
||||
return EFI_NOT_FOUND;
|
||||
@@ -680,36 +694,37 @@ WriteUpdateFile (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetCapsuleStatusVariable (
|
||||
BOOLEAN SetCap
|
||||
BOOLEAN SetCap
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 OsIndication;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
UINT64 OsIndication;
|
||||
UINTN DataSize;
|
||||
|
||||
OsIndication = 0;
|
||||
DataSize = sizeof(UINT64);
|
||||
Status = gRT->GetVariable (
|
||||
L"OsIndications",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&OsIndication
|
||||
);
|
||||
DataSize = sizeof (UINT64);
|
||||
Status = gRT->GetVariable (
|
||||
L"OsIndications",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&OsIndication
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
OsIndication = 0;
|
||||
}
|
||||
|
||||
if (SetCap) {
|
||||
OsIndication |= ((UINT64)EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
OsIndication &= ~((UINT64)EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED);
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"OsIndications",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof(UINT64),
|
||||
sizeof (UINT64),
|
||||
&OsIndication
|
||||
);
|
||||
|
||||
@@ -728,18 +743,18 @@ IsCapsuleOnDiskSupported (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 OsIndicationsSupported;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
UINT64 OsIndicationsSupported;
|
||||
UINTN DataSize;
|
||||
|
||||
DataSize = sizeof(UINT64);
|
||||
Status = gRT->GetVariable (
|
||||
L"OsIndicationsSupported",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&OsIndicationsSupported
|
||||
);
|
||||
DataSize = sizeof (UINT64);
|
||||
Status = gRT->GetVariable (
|
||||
L"OsIndicationsSupported",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&OsIndicationsSupported
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -766,19 +781,19 @@ IsCapsuleOnDiskSupported (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessCapsuleOnDisk (
|
||||
IN VOID **CapsuleBuffer,
|
||||
IN UINTN *CapsuleBufferSize,
|
||||
IN CHAR16 **FilePath,
|
||||
IN CHAR16 *Map,
|
||||
IN UINTN CapsuleNum
|
||||
IN VOID **CapsuleBuffer,
|
||||
IN UINTN *CapsuleBufferSize,
|
||||
IN CHAR16 **FilePath,
|
||||
IN CHAR16 *Map,
|
||||
IN UINTN CapsuleNum
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 BootNext;
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Fs;
|
||||
BOOLEAN UpdateBootNext;
|
||||
CHAR16 *FileName[MAX_CAPSULE_NUM];
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
UINT16 BootNext;
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Fs;
|
||||
BOOLEAN UpdateBootNext;
|
||||
CHAR16 *FileName[MAX_CAPSULE_NUM];
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// Check if Capsule On Disk is supported
|
||||
@@ -802,7 +817,7 @@ ProcessCapsuleOnDisk (
|
||||
//
|
||||
// Get file name from file path
|
||||
//
|
||||
for (Index = 0; Index < CapsuleNum; Index ++) {
|
||||
for (Index = 0; Index < CapsuleNum; Index++) {
|
||||
FileName[Index] = GetFileNameFromPath (FilePath[Index]);
|
||||
}
|
||||
|
||||
@@ -826,13 +841,13 @@ ProcessCapsuleOnDisk (
|
||||
|
||||
if (UpdateBootNext) {
|
||||
Status = gRT->SetVariable (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof(UINT16),
|
||||
&BootNext
|
||||
);
|
||||
if (EFI_ERROR (Status)){
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof (UINT16),
|
||||
&BootNext
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"CapsuleApp: unable to set BootNext variable.\n");
|
||||
return Status;
|
||||
}
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
|
||||
|
||||
#include <Protocol/UnicodeCollation.h>
|
||||
#include <Protocol/PiPcd.h>
|
||||
#include <Protocol/Pcd.h>
|
||||
@@ -23,7 +22,6 @@
|
||||
#include <Protocol/ShellParameters.h>
|
||||
#include <Protocol/Shell.h>
|
||||
|
||||
|
||||
//
|
||||
// String token ID of help message text.
|
||||
// Shell supports to find help message in the resource section of an application image if
|
||||
@@ -32,24 +30,23 @@
|
||||
// the resource section. Thus the application can use '-?' option to show help message in
|
||||
// Shell.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStrDumpDynPcdHelpTokenId = STRING_TOKEN (STR_DUMP_DYN_PCD_HELP_INFORMATION);
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStrDumpDynPcdHelpTokenId = STRING_TOKEN (STR_DUMP_DYN_PCD_HELP_INFORMATION);
|
||||
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 0
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 0
|
||||
|
||||
static EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
|
||||
static EFI_PCD_PROTOCOL *mPiPcd = NULL;
|
||||
static PCD_PROTOCOL *mPcd = NULL;
|
||||
static EFI_GET_PCD_INFO_PROTOCOL *mPiPcdInfo = NULL;
|
||||
static GET_PCD_INFO_PROTOCOL *mPcdInfo = NULL;
|
||||
static CHAR16 *mTempPcdNameBuffer = NULL;
|
||||
static UINTN mTempPcdNameBufferSize = 0;
|
||||
static EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
|
||||
static EFI_PCD_PROTOCOL *mPiPcd = NULL;
|
||||
static PCD_PROTOCOL *mPcd = NULL;
|
||||
static EFI_GET_PCD_INFO_PROTOCOL *mPiPcdInfo = NULL;
|
||||
static GET_PCD_INFO_PROTOCOL *mPcdInfo = NULL;
|
||||
static CHAR16 *mTempPcdNameBuffer = NULL;
|
||||
static UINTN mTempPcdNameBufferSize = 0;
|
||||
|
||||
static CONST CHAR8 mHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
|
||||
static UINTN Argc;
|
||||
static CHAR16 **Argv;
|
||||
static CONST CHAR8 mHex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
|
||||
static UINTN Argc;
|
||||
static CHAR16 **Argv;
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,15 +60,15 @@ GetArg (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
|
||||
EFI_STATUS Status;
|
||||
EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiShellParametersProtocolGuid,
|
||||
(VOID**)&ShellParameters
|
||||
(VOID **)&ShellParameters
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -121,21 +118,21 @@ ShowHelp (
|
||||
static
|
||||
VOID
|
||||
DumpHex (
|
||||
IN UINTN Indent,
|
||||
IN UINTN Offset,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *UserData
|
||||
IN UINTN Indent,
|
||||
IN UINTN Offset,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *UserData
|
||||
)
|
||||
{
|
||||
UINT8 *Data;
|
||||
UINT8 *Data;
|
||||
|
||||
CHAR8 Val[50];
|
||||
CHAR8 Val[50];
|
||||
|
||||
CHAR8 Str[20];
|
||||
CHAR8 Str[20];
|
||||
|
||||
UINT8 TempByte;
|
||||
UINTN Size;
|
||||
UINTN Index;
|
||||
UINT8 TempByte;
|
||||
UINTN Size;
|
||||
UINTN Index;
|
||||
|
||||
Data = UserData;
|
||||
while (DataSize != 0) {
|
||||
@@ -145,24 +142,23 @@ DumpHex (
|
||||
}
|
||||
|
||||
for (Index = 0; Index < Size; Index += 1) {
|
||||
TempByte = Data[Index];
|
||||
Val[Index * 3 + 0] = mHex[TempByte >> 4];
|
||||
Val[Index * 3 + 1] = mHex[TempByte & 0xF];
|
||||
Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' ');
|
||||
Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);
|
||||
TempByte = Data[Index];
|
||||
Val[Index * 3 + 0] = mHex[TempByte >> 4];
|
||||
Val[Index * 3 + 1] = mHex[TempByte & 0xF];
|
||||
Val[Index * 3 + 2] = (CHAR8)((Index == 7) ? '-' : ' ');
|
||||
Str[Index] = (CHAR8)((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);
|
||||
}
|
||||
|
||||
Val[Index * 3] = 0;
|
||||
Str[Index] = 0;
|
||||
Val[Index * 3] = 0;
|
||||
Str[Index] = 0;
|
||||
Print (L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str);
|
||||
|
||||
Data += Size;
|
||||
Offset += Size;
|
||||
Data += Size;
|
||||
Offset += Size;
|
||||
DataSize -= Size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Safely append with automatic string resizing given length of Destination and
|
||||
desired length of copy from Source.
|
||||
@@ -194,23 +190,23 @@ DumpHex (
|
||||
@return Destination return the resultant string.
|
||||
**/
|
||||
static
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
InternalStrnCatGrow (
|
||||
IN OUT CHAR16 **Destination,
|
||||
IN OUT UINTN *CurrentSize,
|
||||
IN CONST CHAR16 *Source
|
||||
IN OUT CHAR16 **Destination,
|
||||
IN OUT UINTN *CurrentSize,
|
||||
IN CONST CHAR16 *Source
|
||||
)
|
||||
{
|
||||
UINTN DestinationStartSize;
|
||||
UINTN NewSize;
|
||||
UINTN SourceLen;
|
||||
UINTN DestinationStartSize;
|
||||
UINTN NewSize;
|
||||
UINTN SourceLen;
|
||||
|
||||
SourceLen = StrLen(Source);
|
||||
SourceLen = StrLen (Source);
|
||||
|
||||
//
|
||||
// ASSERTs
|
||||
//
|
||||
ASSERT(Destination != NULL);
|
||||
ASSERT (Destination != NULL);
|
||||
|
||||
//
|
||||
// If there's nothing to do then just return Destination
|
||||
@@ -222,7 +218,7 @@ InternalStrnCatGrow (
|
||||
//
|
||||
// allow for un-initialized pointers, based on size being 0
|
||||
//
|
||||
if (CurrentSize != NULL && *CurrentSize == 0) {
|
||||
if ((CurrentSize != NULL) && (*CurrentSize == 0)) {
|
||||
*Destination = NULL;
|
||||
}
|
||||
|
||||
@@ -230,9 +226,9 @@ InternalStrnCatGrow (
|
||||
// allow for NULL pointers address as Destination
|
||||
//
|
||||
if (*Destination != NULL) {
|
||||
ASSERT(CurrentSize != 0);
|
||||
DestinationStartSize = StrSize(*Destination);
|
||||
ASSERT(DestinationStartSize <= *CurrentSize);
|
||||
ASSERT (CurrentSize != 0);
|
||||
DestinationStartSize = StrSize (*Destination);
|
||||
ASSERT (DestinationStartSize <= *CurrentSize);
|
||||
} else {
|
||||
DestinationStartSize = 0;
|
||||
}
|
||||
@@ -242,16 +238,17 @@ InternalStrnCatGrow (
|
||||
//
|
||||
if (CurrentSize != NULL) {
|
||||
NewSize = *CurrentSize;
|
||||
if (NewSize < DestinationStartSize + (SourceLen * sizeof(CHAR16))) {
|
||||
while (NewSize < (DestinationStartSize + (SourceLen*sizeof(CHAR16)))) {
|
||||
NewSize += 2 * SourceLen * sizeof(CHAR16);
|
||||
if (NewSize < DestinationStartSize + (SourceLen * sizeof (CHAR16))) {
|
||||
while (NewSize < (DestinationStartSize + (SourceLen*sizeof (CHAR16)))) {
|
||||
NewSize += 2 * SourceLen * sizeof (CHAR16);
|
||||
}
|
||||
*Destination = ReallocatePool(*CurrentSize, NewSize, *Destination);
|
||||
|
||||
*Destination = ReallocatePool (*CurrentSize, NewSize, *Destination);
|
||||
*CurrentSize = NewSize;
|
||||
}
|
||||
} else {
|
||||
NewSize = (SourceLen + 1)*sizeof(CHAR16);
|
||||
*Destination = AllocateZeroPool(NewSize);
|
||||
NewSize = (SourceLen + 1)*sizeof (CHAR16);
|
||||
*Destination = AllocateZeroPool (NewSize);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -261,7 +258,7 @@ InternalStrnCatGrow (
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
StrnCatS(*Destination, NewSize/sizeof(CHAR16), Source, SourceLen);
|
||||
StrnCatS (*Destination, NewSize/sizeof (CHAR16), Source, SourceLen);
|
||||
return *Destination;
|
||||
}
|
||||
|
||||
@@ -276,15 +273,15 @@ InternalStrnCatGrow (
|
||||
static
|
||||
CHAR16 *
|
||||
GetPcdTypeString (
|
||||
IN CONST EFI_GUID *TokenSpace,
|
||||
IN EFI_PCD_TYPE PcdType
|
||||
IN CONST EFI_GUID *TokenSpace,
|
||||
IN EFI_PCD_TYPE PcdType
|
||||
)
|
||||
{
|
||||
UINTN BufLen;
|
||||
CHAR16 *RetString;
|
||||
UINTN BufLen;
|
||||
CHAR16 *RetString;
|
||||
|
||||
BufLen = 0;
|
||||
RetString = NULL;
|
||||
BufLen = 0;
|
||||
RetString = NULL;
|
||||
|
||||
switch (PcdType) {
|
||||
case EFI_PCD_TYPE_8:
|
||||
@@ -329,18 +326,18 @@ GetPcdTypeString (
|
||||
static
|
||||
VOID
|
||||
DumpPcdInfo (
|
||||
IN CONST EFI_GUID *TokenSpace,
|
||||
IN UINTN TokenNumber,
|
||||
IN EFI_PCD_INFO *PcdInfo
|
||||
IN CONST EFI_GUID *TokenSpace,
|
||||
IN UINTN TokenNumber,
|
||||
IN EFI_PCD_INFO *PcdInfo
|
||||
)
|
||||
{
|
||||
CHAR16 *RetString;
|
||||
UINT8 Uint8;
|
||||
UINT16 Uint16;
|
||||
UINT32 Uint32;
|
||||
UINT64 Uint64;
|
||||
BOOLEAN Boolean;
|
||||
VOID *PcdData;
|
||||
CHAR16 *RetString;
|
||||
UINT8 Uint8;
|
||||
UINT16 Uint16;
|
||||
UINT32 Uint32;
|
||||
UINT64 Uint64;
|
||||
BOOLEAN Boolean;
|
||||
VOID *PcdData;
|
||||
|
||||
RetString = NULL;
|
||||
|
||||
@@ -363,6 +360,7 @@ DumpPcdInfo (
|
||||
} else {
|
||||
Uint8 = mPiPcd->Get8 (TokenSpace, TokenNumber);
|
||||
}
|
||||
|
||||
Print (L" Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint8);
|
||||
break;
|
||||
case EFI_PCD_TYPE_16:
|
||||
@@ -371,6 +369,7 @@ DumpPcdInfo (
|
||||
} else {
|
||||
Uint16 = mPiPcd->Get16 (TokenSpace, TokenNumber);
|
||||
}
|
||||
|
||||
Print (L" Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint16);
|
||||
break;
|
||||
case EFI_PCD_TYPE_32:
|
||||
@@ -379,6 +378,7 @@ DumpPcdInfo (
|
||||
} else {
|
||||
Uint32 = mPiPcd->Get32 (TokenSpace, TokenNumber);
|
||||
}
|
||||
|
||||
Print (L" Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint32);
|
||||
break;
|
||||
case EFI_PCD_TYPE_64:
|
||||
@@ -387,6 +387,7 @@ DumpPcdInfo (
|
||||
} else {
|
||||
Uint64 = mPiPcd->Get64 (TokenSpace, TokenNumber);
|
||||
}
|
||||
|
||||
Print (L" Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = 0x%lx\n", TokenNumber, RetString, PcdInfo->PcdSize, Uint64);
|
||||
break;
|
||||
case EFI_PCD_TYPE_BOOL:
|
||||
@@ -395,6 +396,7 @@ DumpPcdInfo (
|
||||
} else {
|
||||
Boolean = mPiPcd->GetBool (TokenSpace, TokenNumber);
|
||||
}
|
||||
|
||||
Print (L" Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x - Value = %a\n", TokenNumber, RetString, PcdInfo->PcdSize, Boolean ? "TRUE" : "FALSE");
|
||||
break;
|
||||
case EFI_PCD_TYPE_PTR:
|
||||
@@ -403,6 +405,7 @@ DumpPcdInfo (
|
||||
} else {
|
||||
PcdData = mPiPcd->GetPtr (TokenSpace, TokenNumber);
|
||||
}
|
||||
|
||||
Print (L" Token = 0x%08x - Type = %H%-17s%N - Size = 0x%x\n", TokenNumber, RetString, PcdInfo->PcdSize);
|
||||
DumpHex (2, 0, PcdInfo->PcdSize, PcdData);
|
||||
break;
|
||||
@@ -413,6 +416,7 @@ DumpPcdInfo (
|
||||
if (RetString != NULL) {
|
||||
FreePool (RetString);
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
}
|
||||
|
||||
@@ -429,20 +433,20 @@ DumpPcdInfo (
|
||||
static
|
||||
EFI_STATUS
|
||||
ProcessPcd (
|
||||
IN CHAR16 *InputPcdName
|
||||
IN CHAR16 *InputPcdName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID *TokenSpace;
|
||||
UINTN TokenNumber;
|
||||
EFI_PCD_INFO PcdInfo;
|
||||
BOOLEAN Found;
|
||||
UINTN PcdNameSize;
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID *TokenSpace;
|
||||
UINTN TokenNumber;
|
||||
EFI_PCD_INFO PcdInfo;
|
||||
BOOLEAN Found;
|
||||
UINTN PcdNameSize;
|
||||
|
||||
PcdInfo.PcdName = NULL;
|
||||
PcdInfo.PcdSize = 0;
|
||||
PcdInfo.PcdType = 0xFF;
|
||||
Found = FALSE;
|
||||
Found = FALSE;
|
||||
|
||||
Print (L"Current system SKU ID: 0x%x\n\n", mPiPcdInfo->GetSku ());
|
||||
|
||||
@@ -451,7 +455,7 @@ ProcessPcd (
|
||||
TokenNumber = 0;
|
||||
do {
|
||||
Status = mPiPcd->GetNextToken (TokenSpace, &TokenNumber);
|
||||
if (!EFI_ERROR (Status) && TokenNumber != 0) {
|
||||
if (!EFI_ERROR (Status) && (TokenNumber != 0)) {
|
||||
if (TokenSpace == NULL) {
|
||||
//
|
||||
// PCD in default Token Space.
|
||||
@@ -460,27 +464,32 @@ ProcessPcd (
|
||||
} else {
|
||||
mPiPcdInfo->GetInfo (TokenSpace, TokenNumber, &PcdInfo);
|
||||
}
|
||||
|
||||
if (InputPcdName != NULL) {
|
||||
if (PcdInfo.PcdName == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PcdNameSize = AsciiStrSize (PcdInfo.PcdName) * sizeof (CHAR16);
|
||||
if (mTempPcdNameBuffer == NULL) {
|
||||
mTempPcdNameBufferSize = PcdNameSize;
|
||||
mTempPcdNameBuffer = AllocatePool (mTempPcdNameBufferSize);
|
||||
mTempPcdNameBuffer = AllocatePool (mTempPcdNameBufferSize);
|
||||
} else if (mTempPcdNameBufferSize < PcdNameSize) {
|
||||
mTempPcdNameBuffer = ReallocatePool (mTempPcdNameBufferSize, PcdNameSize, mTempPcdNameBuffer);
|
||||
mTempPcdNameBuffer = ReallocatePool (mTempPcdNameBufferSize, PcdNameSize, mTempPcdNameBuffer);
|
||||
mTempPcdNameBufferSize = PcdNameSize;
|
||||
}
|
||||
|
||||
if (mTempPcdNameBuffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
AsciiStrToUnicodeStrS (PcdInfo.PcdName, mTempPcdNameBuffer, mTempPcdNameBufferSize / sizeof (CHAR16));
|
||||
//
|
||||
// Compare the input PCD name with the PCD name in PCD database.
|
||||
//
|
||||
if ((StrStr (mTempPcdNameBuffer, InputPcdName) != NULL) ||
|
||||
(mUnicodeCollation != NULL && mUnicodeCollation->MetaiMatch (mUnicodeCollation, mTempPcdNameBuffer, InputPcdName))) {
|
||||
((mUnicodeCollation != NULL) && mUnicodeCollation->MetaiMatch (mUnicodeCollation, mTempPcdNameBuffer, InputPcdName)))
|
||||
{
|
||||
//
|
||||
// Found matched PCD.
|
||||
//
|
||||
@@ -493,7 +502,7 @@ ProcessPcd (
|
||||
}
|
||||
} while (!EFI_ERROR (Status) && TokenNumber != 0);
|
||||
|
||||
Status = mPiPcd->GetNextTokenSpace ((CONST EFI_GUID **) &TokenSpace);
|
||||
Status = mPiPcd->GetNextTokenSpace ((CONST EFI_GUID **)&TokenSpace);
|
||||
} while (!EFI_ERROR (Status) && TokenSpace != NULL);
|
||||
|
||||
if ((InputPcdName != NULL) && !Found) {
|
||||
@@ -503,6 +512,7 @@ ProcessPcd (
|
||||
Print (L"%EError. %NNo matching PCD found: %s.\n", InputPcdName);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -526,35 +536,35 @@ DumpDynPcdMain (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *InputPcdName;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *InputPcdName;
|
||||
|
||||
InputPcdName = NULL;
|
||||
InputPcdName = NULL;
|
||||
|
||||
Status = gBS->LocateProtocol(&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID **) &mUnicodeCollation);
|
||||
Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID **)&mUnicodeCollation);
|
||||
if (EFI_ERROR (Status)) {
|
||||
mUnicodeCollation = NULL;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID **) &mPiPcd);
|
||||
Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID **)&mPiPcd);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"DumpDynPcd: %EError. %NPI PCD protocol is not present.\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL, (VOID **) &mPiPcdInfo);
|
||||
Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL, (VOID **)&mPiPcdInfo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"DumpDynPcd: %EError. %NPI PCD info protocol is not present.\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID **) &mPcd);
|
||||
Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID **)&mPcd);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"DumpDynPcd: %EError. %NPCD protocol is not present.\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **) &mPcdInfo);
|
||||
Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **)&mPcdInfo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"DumpDynPcd: %EError. %NPCD info protocol is not present.\n");
|
||||
return Status;
|
||||
@@ -563,33 +573,33 @@ DumpDynPcdMain (
|
||||
//
|
||||
// get the command line arguments
|
||||
//
|
||||
Status = GetArg();
|
||||
if (EFI_ERROR(Status)){
|
||||
Status = GetArg ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"DumpDynPcd: %EError. %NThe input parameters are not recognized.\n");
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Argc > 2){
|
||||
if (Argc > 2) {
|
||||
Print (L"DumpDynPcd: %EError. %NToo many arguments specified.\n");
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Argc == 1){
|
||||
if (Argc == 1) {
|
||||
Status = ProcessPcd (InputPcdName);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if ((StrCmp(Argv[1], L"-?") == 0)||(StrCmp(Argv[1], L"-h") == 0)||(StrCmp(Argv[1], L"-H") == 0)){
|
||||
if ((StrCmp (Argv[1], L"-?") == 0) || (StrCmp (Argv[1], L"-h") == 0) || (StrCmp (Argv[1], L"-H") == 0)) {
|
||||
ShowHelp ();
|
||||
goto Done;
|
||||
} else {
|
||||
if ((StrCmp(Argv[1], L"-v") == 0)||(StrCmp(Argv[1], L"-V") == 0)){
|
||||
if ((StrCmp (Argv[1], L"-v") == 0) || (StrCmp (Argv[1], L"-V") == 0)) {
|
||||
ShowVersion ();
|
||||
goto Done;
|
||||
} else {
|
||||
if (StrStr(Argv[1], L"-") != NULL){
|
||||
if (StrStr (Argv[1], L"-") != NULL) {
|
||||
Print (L"DumpDynPcd: %EError. %NThe argument '%B%s%N' is invalid.\n", Argv[1]);
|
||||
goto Done;
|
||||
}
|
||||
@@ -597,9 +607,9 @@ DumpDynPcdMain (
|
||||
}
|
||||
|
||||
InputPcdName = Argv[1];
|
||||
Status = ProcessPcd (InputPcdName);
|
||||
Status = ProcessPcd (InputPcdName);
|
||||
|
||||
Done:
|
||||
Done:
|
||||
|
||||
if (mTempPcdNameBuffer != NULL) {
|
||||
FreePool (mTempPcdNameBuffer);
|
||||
@@ -607,4 +617,3 @@ DumpDynPcdMain (
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
// the resource section. Thus the application can use '-?' option to show help message in
|
||||
// Shell.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);
|
||||
|
||||
/**
|
||||
The user Entry Point for Application. The user code starts with this function
|
||||
@@ -40,7 +40,7 @@ UefiMain (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 Index;
|
||||
|
||||
Index = 0;
|
||||
|
||||
@@ -48,11 +48,11 @@ UefiMain (
|
||||
// Three PCD type (FeatureFlag, UINT32 and String) are used as the sample.
|
||||
//
|
||||
if (FeaturePcdGet (PcdHelloWorldPrintEnable)) {
|
||||
for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index ++) {
|
||||
for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index++) {
|
||||
//
|
||||
// Use UefiLib Print API to print string to UEFI console
|
||||
//
|
||||
Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString));
|
||||
Print ((CHAR16 *)PcdGetPtr (PcdHelloWorldPrintString));
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Guid/SmiHandlerProfile.h>
|
||||
|
||||
#define PROFILE_NAME_STRING_LENGTH 64
|
||||
CHAR8 mNameString[PROFILE_NAME_STRING_LENGTH + 1];
|
||||
CHAR8 mNameString[PROFILE_NAME_STRING_LENGTH + 1];
|
||||
|
||||
VOID *mSmiHandlerProfileDatabase;
|
||||
UINTN mSmiHandlerProfileDatabaseSize;
|
||||
@@ -41,6 +41,7 @@ InternalDumpData (
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < Size; Index++) {
|
||||
Print (L"%02x", (UINTN)Data[Index]);
|
||||
if ((Index + 1) != Size) {
|
||||
@@ -53,79 +54,82 @@ InternalDumpData (
|
||||
Get SMI handler profile database.
|
||||
**/
|
||||
VOID
|
||||
GetSmiHandlerProfileDatabase(
|
||||
GetSmiHandlerProfileDatabase (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN CommSize;
|
||||
UINT8 *CommBuffer;
|
||||
EFI_SMM_COMMUNICATE_HEADER *CommHeader;
|
||||
SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *CommGetInfo;
|
||||
SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *CommGetData;
|
||||
EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
|
||||
UINTN MinimalSizeNeeded;
|
||||
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
|
||||
UINT32 Index;
|
||||
EFI_MEMORY_DESCRIPTOR *Entry;
|
||||
VOID *Buffer;
|
||||
UINTN Size;
|
||||
UINTN Offset;
|
||||
EFI_STATUS Status;
|
||||
UINTN CommSize;
|
||||
UINT8 *CommBuffer;
|
||||
EFI_SMM_COMMUNICATE_HEADER *CommHeader;
|
||||
SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *CommGetInfo;
|
||||
SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *CommGetData;
|
||||
EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication;
|
||||
UINTN MinimalSizeNeeded;
|
||||
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
|
||||
UINT32 Index;
|
||||
EFI_MEMORY_DESCRIPTOR *Entry;
|
||||
VOID *Buffer;
|
||||
UINTN Size;
|
||||
UINTN Offset;
|
||||
|
||||
Status = gBS->LocateProtocol(&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **)&SmmCommunication);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"SmiHandlerProfile: Locate SmmCommunication protocol - %r\n", Status);
|
||||
return ;
|
||||
Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **)&SmmCommunication);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"SmiHandlerProfile: Locate SmmCommunication protocol - %r\n", Status);
|
||||
return;
|
||||
}
|
||||
|
||||
MinimalSizeNeeded = EFI_PAGE_SIZE;
|
||||
|
||||
Status = EfiGetSystemConfigurationTable(
|
||||
Status = EfiGetSystemConfigurationTable (
|
||||
&gEdkiiPiSmmCommunicationRegionTableGuid,
|
||||
(VOID **)&PiSmmCommunicationRegionTable
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"SmiHandlerProfile: Get PiSmmCommunicationRegionTable - %r\n", Status);
|
||||
return ;
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"SmiHandlerProfile: Get PiSmmCommunicationRegionTable - %r\n", Status);
|
||||
return;
|
||||
}
|
||||
ASSERT(PiSmmCommunicationRegionTable != NULL);
|
||||
|
||||
ASSERT (PiSmmCommunicationRegionTable != NULL);
|
||||
Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1);
|
||||
Size = 0;
|
||||
Size = 0;
|
||||
for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) {
|
||||
if (Entry->Type == EfiConventionalMemory) {
|
||||
Size = EFI_PAGES_TO_SIZE((UINTN)Entry->NumberOfPages);
|
||||
Size = EFI_PAGES_TO_SIZE ((UINTN)Entry->NumberOfPages);
|
||||
if (Size >= MinimalSizeNeeded) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize);
|
||||
}
|
||||
ASSERT(Index < PiSmmCommunicationRegionTable->NumberOfEntries);
|
||||
|
||||
ASSERT (Index < PiSmmCommunicationRegionTable->NumberOfEntries);
|
||||
CommBuffer = (UINT8 *)(UINTN)Entry->PhysicalStart;
|
||||
|
||||
//
|
||||
// Get Size
|
||||
//
|
||||
CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
|
||||
CopyMem(&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof(gSmiHandlerProfileGuid));
|
||||
CommHeader->MessageLength = sizeof(SMI_HANDLER_PROFILE_PARAMETER_GET_INFO);
|
||||
CopyMem (&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof (gSmiHandlerProfileGuid));
|
||||
CommHeader->MessageLength = sizeof (SMI_HANDLER_PROFILE_PARAMETER_GET_INFO);
|
||||
|
||||
CommGetInfo = (SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *)&CommBuffer[OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data)];
|
||||
CommGetInfo->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_INFO;
|
||||
CommGetInfo->Header.DataLength = sizeof(*CommGetInfo);
|
||||
CommGetInfo = (SMI_HANDLER_PROFILE_PARAMETER_GET_INFO *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
|
||||
CommGetInfo->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_INFO;
|
||||
CommGetInfo->Header.DataLength = sizeof (*CommGetInfo);
|
||||
CommGetInfo->Header.ReturnStatus = (UINT64)-1;
|
||||
CommGetInfo->DataSize = 0;
|
||||
CommGetInfo->DataSize = 0;
|
||||
|
||||
CommSize = sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader->MessageLength;
|
||||
Status = SmmCommunication->Communicate(SmmCommunication, CommBuffer, &CommSize);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"SmiHandlerProfile: SmmCommunication - %r\n", Status);
|
||||
return ;
|
||||
CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + CommHeader->MessageLength;
|
||||
Status = SmmCommunication->Communicate (SmmCommunication, CommBuffer, &CommSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Print (L"SmiHandlerProfile: SmmCommunication - %r\n", Status);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CommGetInfo->Header.ReturnStatus != 0) {
|
||||
Print(L"SmiHandlerProfile: GetInfo - 0x%0x\n", CommGetInfo->Header.ReturnStatus);
|
||||
return ;
|
||||
Print (L"SmiHandlerProfile: GetInfo - 0x%0x\n", CommGetInfo->Header.ReturnStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
mSmiHandlerProfileDatabaseSize = (UINTN)CommGetInfo->DataSize;
|
||||
@@ -133,25 +137,25 @@ GetSmiHandlerProfileDatabase(
|
||||
//
|
||||
// Get Data
|
||||
//
|
||||
mSmiHandlerProfileDatabase = AllocateZeroPool(mSmiHandlerProfileDatabaseSize);
|
||||
mSmiHandlerProfileDatabase = AllocateZeroPool (mSmiHandlerProfileDatabaseSize);
|
||||
if (mSmiHandlerProfileDatabase == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
Print(L"SmiHandlerProfile: AllocateZeroPool (0x%x) for dump buffer - %r\n", mSmiHandlerProfileDatabaseSize, Status);
|
||||
return ;
|
||||
Print (L"SmiHandlerProfile: AllocateZeroPool (0x%x) for dump buffer - %r\n", mSmiHandlerProfileDatabaseSize, Status);
|
||||
return;
|
||||
}
|
||||
|
||||
CommHeader = (EFI_SMM_COMMUNICATE_HEADER *)&CommBuffer[0];
|
||||
CopyMem(&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof(gSmiHandlerProfileGuid));
|
||||
CommHeader->MessageLength = sizeof(SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET);
|
||||
CopyMem (&CommHeader->HeaderGuid, &gSmiHandlerProfileGuid, sizeof (gSmiHandlerProfileGuid));
|
||||
CommHeader->MessageLength = sizeof (SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET);
|
||||
|
||||
CommGetData = (SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *)&CommBuffer[OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data)];
|
||||
CommGetData->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET;
|
||||
CommGetData->Header.DataLength = sizeof(*CommGetData);
|
||||
CommGetData = (SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET *)&CommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
|
||||
CommGetData->Header.Command = SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET;
|
||||
CommGetData->Header.DataLength = sizeof (*CommGetData);
|
||||
CommGetData->Header.ReturnStatus = (UINT64)-1;
|
||||
|
||||
CommSize = sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader->MessageLength;
|
||||
Buffer = (UINT8 *)CommHeader + CommSize;
|
||||
Size -= CommSize;
|
||||
CommSize = sizeof (EFI_GUID) + sizeof (UINTN) + CommHeader->MessageLength;
|
||||
Buffer = (UINT8 *)CommHeader + CommSize;
|
||||
Size -= CommSize;
|
||||
|
||||
CommGetData->DataBuffer = (PHYSICAL_ADDRESS)(UINTN)Buffer;
|
||||
CommGetData->DataOffset = 0;
|
||||
@@ -162,21 +166,23 @@ GetSmiHandlerProfileDatabase(
|
||||
} else {
|
||||
CommGetData->DataSize = (UINT64)(mSmiHandlerProfileDatabaseSize - CommGetData->DataOffset);
|
||||
}
|
||||
Status = SmmCommunication->Communicate(SmmCommunication, CommBuffer, &CommSize);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
|
||||
Status = SmmCommunication->Communicate (SmmCommunication, CommBuffer, &CommSize);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (CommGetData->Header.ReturnStatus != 0) {
|
||||
FreePool(mSmiHandlerProfileDatabase);
|
||||
FreePool (mSmiHandlerProfileDatabase);
|
||||
mSmiHandlerProfileDatabase = NULL;
|
||||
Print(L"SmiHandlerProfile: GetData - 0x%x\n", CommGetData->Header.ReturnStatus);
|
||||
return ;
|
||||
Print (L"SmiHandlerProfile: GetData - 0x%x\n", CommGetData->Header.ReturnStatus);
|
||||
return;
|
||||
}
|
||||
CopyMem((UINT8 *)mSmiHandlerProfileDatabase + Offset, (VOID *)(UINTN)CommGetData->DataBuffer, (UINTN)CommGetData->DataSize);
|
||||
|
||||
CopyMem ((UINT8 *)mSmiHandlerProfileDatabase + Offset, (VOID *)(UINTN)CommGetData->DataBuffer, (UINTN)CommGetData->DataSize);
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "SmiHandlerProfileSize - 0x%x\n", mSmiHandlerProfileDatabaseSize));
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,14 +199,14 @@ GetSmiHandlerProfileDatabase(
|
||||
**/
|
||||
VOID
|
||||
GetShortPdbFileName (
|
||||
IN CHAR8 *PdbFileName,
|
||||
OUT CHAR8 *AsciiBuffer
|
||||
IN CHAR8 *PdbFileName,
|
||||
OUT CHAR8 *AsciiBuffer
|
||||
)
|
||||
{
|
||||
UINTN IndexPdb; // Current work location within a Pdb string.
|
||||
UINTN IndexBuffer; // Current work location within a Buffer string.
|
||||
UINTN StartIndex;
|
||||
UINTN EndIndex;
|
||||
UINTN IndexPdb; // Current work location within a Pdb string.
|
||||
UINTN IndexBuffer; // Current work location within a Buffer string.
|
||||
UINTN StartIndex;
|
||||
UINTN EndIndex;
|
||||
|
||||
ZeroMem (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1);
|
||||
|
||||
@@ -208,7 +214,9 @@ GetShortPdbFileName (
|
||||
AsciiStrnCpyS (AsciiBuffer, PROFILE_NAME_STRING_LENGTH + 1, " ", 1);
|
||||
} else {
|
||||
StartIndex = 0;
|
||||
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++);
|
||||
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++) {
|
||||
}
|
||||
|
||||
for (IndexPdb = 0; PdbFileName[IndexPdb] != 0; IndexPdb++) {
|
||||
if ((PdbFileName[IndexPdb] == '\\') || (PdbFileName[IndexPdb] == '/')) {
|
||||
StartIndex = IndexPdb + 1;
|
||||
@@ -248,9 +256,9 @@ GetDriverNameString (
|
||||
IN SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *NameString;
|
||||
UINTN StringSize;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *NameString;
|
||||
UINTN StringSize;
|
||||
|
||||
if (ImageStruct == NULL) {
|
||||
return "???";
|
||||
@@ -260,7 +268,7 @@ GetDriverNameString (
|
||||
// Method 1: Get the name string from image PDB
|
||||
//
|
||||
if (ImageStruct->PdbStringOffset != 0) {
|
||||
GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + ImageStruct->PdbStringOffset), mNameString);
|
||||
GetShortPdbFileName ((CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset), mNameString);
|
||||
return mNameString;
|
||||
}
|
||||
|
||||
@@ -270,13 +278,13 @@ GetDriverNameString (
|
||||
//
|
||||
NameString = NULL;
|
||||
StringSize = 0;
|
||||
Status = GetSectionFromAnyFv (
|
||||
&ImageStruct->FileGuid,
|
||||
EFI_SECTION_USER_INTERFACE,
|
||||
0,
|
||||
(VOID **) &NameString,
|
||||
&StringSize
|
||||
);
|
||||
Status = GetSectionFromAnyFv (
|
||||
&ImageStruct->FileGuid,
|
||||
EFI_SECTION_USER_INTERFACE,
|
||||
0,
|
||||
(VOID **)&NameString,
|
||||
&StringSize
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Method 2: Get the name string from FFS UI section
|
||||
@@ -284,6 +292,7 @@ GetDriverNameString (
|
||||
if (StrLen (NameString) > PROFILE_NAME_STRING_LENGTH) {
|
||||
NameString[PROFILE_NAME_STRING_LENGTH] = 0;
|
||||
}
|
||||
|
||||
UnicodeStrToAsciiStrS (NameString, mNameString, sizeof (mNameString));
|
||||
FreePool (NameString);
|
||||
return mNameString;
|
||||
@@ -306,7 +315,7 @@ GetDriverNameString (
|
||||
**/
|
||||
SMM_CORE_IMAGE_DATABASE_STRUCTURE *
|
||||
GetImageFromRef (
|
||||
IN UINTN ImageRef
|
||||
IN UINTN ImageRef
|
||||
)
|
||||
{
|
||||
SMM_CORE_IMAGE_DATABASE_STRUCTURE *ImageStruct;
|
||||
@@ -318,6 +327,7 @@ GetImageFromRef (
|
||||
return ImageStruct;
|
||||
}
|
||||
}
|
||||
|
||||
ImageStruct = (VOID *)((UINTN)ImageStruct + ImageStruct->Header.Length);
|
||||
}
|
||||
|
||||
@@ -328,7 +338,7 @@ GetImageFromRef (
|
||||
Dump SMM loaded image information.
|
||||
**/
|
||||
VOID
|
||||
DumpSmmLoadedImage(
|
||||
DumpSmmLoadedImage (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
@@ -340,19 +350,21 @@ DumpSmmLoadedImage(
|
||||
while ((UINTN)ImageStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) {
|
||||
if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) {
|
||||
NameString = GetDriverNameString (ImageStruct);
|
||||
Print(L" <Image Name=\"%a\"", NameString);
|
||||
Print(L" Base=\"0x%lx\" Size=\"0x%lx\"", ImageStruct->ImageBase, ImageStruct->ImageSize);
|
||||
Print (L" <Image Name=\"%a\"", NameString);
|
||||
Print (L" Base=\"0x%lx\" Size=\"0x%lx\"", ImageStruct->ImageBase, ImageStruct->ImageSize);
|
||||
if (ImageStruct->EntryPoint != 0) {
|
||||
Print(L" EntryPoint=\"0x%lx\"", ImageStruct->EntryPoint);
|
||||
Print (L" EntryPoint=\"0x%lx\"", ImageStruct->EntryPoint);
|
||||
}
|
||||
Print(L" FvFile=\"%g\"", &ImageStruct->FileGuid);
|
||||
Print(L" RefId=\"0x%x\"", ImageStruct->ImageRef);
|
||||
Print(L">\n");
|
||||
|
||||
Print (L" FvFile=\"%g\"", &ImageStruct->FileGuid);
|
||||
Print (L" RefId=\"0x%x\"", ImageStruct->ImageRef);
|
||||
Print (L">\n");
|
||||
if (ImageStruct->PdbStringOffset != 0) {
|
||||
PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset);
|
||||
Print(L" <Pdb>%a</Pdb>\n", PdbString);
|
||||
Print (L" <Pdb>%a</Pdb>\n", PdbString);
|
||||
}
|
||||
Print(L" </Image>\n");
|
||||
|
||||
Print (L" </Image>\n");
|
||||
}
|
||||
|
||||
ImageStruct = (VOID *)((UINTN)ImageStruct + ImageStruct->Header.Length);
|
||||
@@ -361,7 +373,7 @@ DumpSmmLoadedImage(
|
||||
return;
|
||||
}
|
||||
|
||||
CHAR8 *mSxTypeString[] = {
|
||||
CHAR8 *mSxTypeString[] = {
|
||||
"SxS0",
|
||||
"SxS1",
|
||||
"SxS2",
|
||||
@@ -382,15 +394,15 @@ SxTypeToString (
|
||||
IN EFI_SLEEP_TYPE Type
|
||||
)
|
||||
{
|
||||
if (Type >= 0 && Type < ARRAY_SIZE(mSxTypeString)) {
|
||||
if ((Type >= 0) && (Type < ARRAY_SIZE (mSxTypeString))) {
|
||||
return mSxTypeString[Type];
|
||||
} else {
|
||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
||||
AsciiSPrint (mNameString, sizeof (mNameString), "0x%x", Type);
|
||||
return mNameString;
|
||||
}
|
||||
}
|
||||
|
||||
CHAR8 *mSxPhaseString[] = {
|
||||
CHAR8 *mSxPhaseString[] = {
|
||||
"SxEntry",
|
||||
"SxExit",
|
||||
};
|
||||
@@ -404,18 +416,18 @@ CHAR8 *mSxPhaseString[] = {
|
||||
**/
|
||||
CHAR8 *
|
||||
SxPhaseToString (
|
||||
IN EFI_SLEEP_PHASE Phase
|
||||
IN EFI_SLEEP_PHASE Phase
|
||||
)
|
||||
{
|
||||
if (Phase >= 0 && Phase < ARRAY_SIZE(mSxPhaseString)) {
|
||||
if ((Phase >= 0) && (Phase < ARRAY_SIZE (mSxPhaseString))) {
|
||||
return mSxPhaseString[Phase];
|
||||
} else {
|
||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
||||
AsciiSPrint (mNameString, sizeof (mNameString), "0x%x", Phase);
|
||||
return mNameString;
|
||||
}
|
||||
}
|
||||
|
||||
CHAR8 *mPowerButtonPhaseString[] = {
|
||||
CHAR8 *mPowerButtonPhaseString[] = {
|
||||
"PowerButtonEntry",
|
||||
"PowerButtonExit",
|
||||
};
|
||||
@@ -432,15 +444,15 @@ PowerButtonPhaseToString (
|
||||
IN EFI_POWER_BUTTON_PHASE Phase
|
||||
)
|
||||
{
|
||||
if (Phase >= 0 && Phase < ARRAY_SIZE(mPowerButtonPhaseString)) {
|
||||
if ((Phase >= 0) && (Phase < ARRAY_SIZE (mPowerButtonPhaseString))) {
|
||||
return mPowerButtonPhaseString[Phase];
|
||||
} else {
|
||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
||||
AsciiSPrint (mNameString, sizeof (mNameString), "0x%x", Phase);
|
||||
return mNameString;
|
||||
}
|
||||
}
|
||||
|
||||
CHAR8 *mStandbyButtonPhaseString[] = {
|
||||
CHAR8 *mStandbyButtonPhaseString[] = {
|
||||
"StandbyButtonEntry",
|
||||
"StandbyButtonExit",
|
||||
};
|
||||
@@ -457,15 +469,15 @@ StandbyButtonPhaseToString (
|
||||
IN EFI_STANDBY_BUTTON_PHASE Phase
|
||||
)
|
||||
{
|
||||
if (Phase >= 0 && Phase < ARRAY_SIZE(mStandbyButtonPhaseString)) {
|
||||
if ((Phase >= 0) && (Phase < ARRAY_SIZE (mStandbyButtonPhaseString))) {
|
||||
return mStandbyButtonPhaseString[Phase];
|
||||
} else {
|
||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
||||
AsciiSPrint (mNameString, sizeof (mNameString), "0x%x", Phase);
|
||||
return mNameString;
|
||||
}
|
||||
}
|
||||
|
||||
CHAR8 *mIoTrapTypeString[] = {
|
||||
CHAR8 *mIoTrapTypeString[] = {
|
||||
"WriteTrap",
|
||||
"ReadTrap",
|
||||
"ReadWriteTrap",
|
||||
@@ -483,15 +495,15 @@ IoTrapTypeToString (
|
||||
IN EFI_SMM_IO_TRAP_DISPATCH_TYPE Type
|
||||
)
|
||||
{
|
||||
if (Type >= 0 && Type < ARRAY_SIZE(mIoTrapTypeString)) {
|
||||
if ((Type >= 0) && (Type < ARRAY_SIZE (mIoTrapTypeString))) {
|
||||
return mIoTrapTypeString[Type];
|
||||
} else {
|
||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
||||
AsciiSPrint (mNameString, sizeof (mNameString), "0x%x", Type);
|
||||
return mNameString;
|
||||
}
|
||||
}
|
||||
|
||||
CHAR8 *mUsbTypeString[] = {
|
||||
CHAR8 *mUsbTypeString[] = {
|
||||
"UsbLegacy",
|
||||
"UsbWake",
|
||||
};
|
||||
@@ -505,13 +517,13 @@ CHAR8 *mUsbTypeString[] = {
|
||||
**/
|
||||
CHAR8 *
|
||||
UsbTypeToString (
|
||||
IN EFI_USB_SMI_TYPE Type
|
||||
IN EFI_USB_SMI_TYPE Type
|
||||
)
|
||||
{
|
||||
if (Type >= 0 && Type < ARRAY_SIZE(mUsbTypeString)) {
|
||||
if ((Type >= 0) && (Type < ARRAY_SIZE (mUsbTypeString))) {
|
||||
return mUsbTypeString[Type];
|
||||
} else {
|
||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
||||
AsciiSPrint (mNameString, sizeof (mNameString), "0x%x", Type);
|
||||
return mNameString;
|
||||
}
|
||||
}
|
||||
@@ -525,42 +537,42 @@ UsbTypeToString (
|
||||
**/
|
||||
VOID
|
||||
DumpSmiChildContext (
|
||||
IN EFI_GUID *HandlerType,
|
||||
IN VOID *Context,
|
||||
IN UINTN ContextSize
|
||||
IN EFI_GUID *HandlerType,
|
||||
IN VOID *Context,
|
||||
IN UINTN ContextSize
|
||||
)
|
||||
{
|
||||
CHAR16 *Str;
|
||||
CHAR16 *Str;
|
||||
|
||||
if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) {
|
||||
Print(L" SwSmi=\"0x%lx\"", ((SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue);
|
||||
Print (L" SwSmi=\"0x%lx\"", ((SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue);
|
||||
} else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) {
|
||||
Print(L" SxType=\"%a\"", SxTypeToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type));
|
||||
Print(L" SxPhase=\"%a\"", SxPhaseToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase));
|
||||
Print (L" SxType=\"%a\"", SxTypeToString (((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type));
|
||||
Print (L" SxPhase=\"%a\"", SxPhaseToString (((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase));
|
||||
} else if (CompareGuid (HandlerType, &gEfiSmmPowerButtonDispatch2ProtocolGuid)) {
|
||||
Print(L" PowerButtonPhase=\"%a\"", PowerButtonPhaseToString(((EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT *)Context)->Phase));
|
||||
Print (L" PowerButtonPhase=\"%a\"", PowerButtonPhaseToString (((EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT *)Context)->Phase));
|
||||
} else if (CompareGuid (HandlerType, &gEfiSmmStandbyButtonDispatch2ProtocolGuid)) {
|
||||
Print(L" StandbyButtonPhase=\"%a\"", StandbyButtonPhaseToString(((EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT *)Context)->Phase));
|
||||
Print (L" StandbyButtonPhase=\"%a\"", StandbyButtonPhaseToString (((EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT *)Context)->Phase));
|
||||
} else if (CompareGuid (HandlerType, &gEfiSmmPeriodicTimerDispatch2ProtocolGuid)) {
|
||||
Print(L" PeriodicTimerPeriod=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->Period);
|
||||
Print(L" PeriodicTimerSmiTickInterval=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->SmiTickInterval);
|
||||
Print (L" PeriodicTimerPeriod=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->Period);
|
||||
Print (L" PeriodicTimerSmiTickInterval=\"%ld\"", ((EFI_SMM_PERIODIC_TIMER_REGISTER_CONTEXT *)Context)->SmiTickInterval);
|
||||
} else if (CompareGuid (HandlerType, &gEfiSmmGpiDispatch2ProtocolGuid)) {
|
||||
Print(L" GpiNum=\"0x%lx\"", ((EFI_SMM_GPI_REGISTER_CONTEXT *)Context)->GpiNum);
|
||||
Print (L" GpiNum=\"0x%lx\"", ((EFI_SMM_GPI_REGISTER_CONTEXT *)Context)->GpiNum);
|
||||
} else if (CompareGuid (HandlerType, &gEfiSmmIoTrapDispatch2ProtocolGuid)) {
|
||||
Print(L" IoTrapAddress=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Address);
|
||||
Print(L" IoTrapLength=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Length);
|
||||
Print(L" IoTrapType=\"%a\"", IoTrapTypeToString(((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type));
|
||||
Print (L" IoTrapAddress=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Address);
|
||||
Print (L" IoTrapLength=\"0x%x\"", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Length);
|
||||
Print (L" IoTrapType=\"%a\"", IoTrapTypeToString (((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type));
|
||||
} else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) {
|
||||
Print(L" UsbType=\"0x%x\"", UsbTypeToString(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type));
|
||||
Str = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE);
|
||||
Print(L" UsbDevicePath=\"%s\"", Str);
|
||||
Print (L" UsbType=\"0x%x\"", UsbTypeToString (((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type));
|
||||
Str = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE);
|
||||
Print (L" UsbDevicePath=\"%s\"", Str);
|
||||
if (Str != NULL) {
|
||||
FreePool (Str);
|
||||
}
|
||||
} else {
|
||||
Print(L" Context=\"");
|
||||
Print (L" Context=\"");
|
||||
InternalDumpData (Context, ContextSize);
|
||||
Print(L"\"");
|
||||
Print (L"\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,8 +582,8 @@ DumpSmiChildContext (
|
||||
@param HandlerCategory SMI handler category
|
||||
**/
|
||||
VOID
|
||||
DumpSmiHandler(
|
||||
IN UINT32 HandlerCategory
|
||||
DumpSmiHandler (
|
||||
IN UINT32 HandlerCategory
|
||||
)
|
||||
{
|
||||
SMM_CORE_SMI_DATABASE_STRUCTURE *SmiStruct;
|
||||
@@ -584,39 +596,46 @@ DumpSmiHandler(
|
||||
while ((UINTN)SmiStruct < (UINTN)mSmiHandlerProfileDatabase + mSmiHandlerProfileDatabaseSize) {
|
||||
if ((SmiStruct->Header.Signature == SMM_CORE_SMI_DATABASE_SIGNATURE) && (SmiStruct->HandlerCategory == HandlerCategory)) {
|
||||
SmiHandlerStruct = (VOID *)(SmiStruct + 1);
|
||||
Print(L" <SmiEntry");
|
||||
Print (L" <SmiEntry");
|
||||
if (!IsZeroGuid (&SmiStruct->HandlerType)) {
|
||||
Print(L" HandlerType=\"%g\"", &SmiStruct->HandlerType);
|
||||
Print (L" HandlerType=\"%g\"", &SmiStruct->HandlerType);
|
||||
}
|
||||
Print(L">\n");
|
||||
|
||||
Print (L">\n");
|
||||
for (Index = 0; Index < SmiStruct->HandlerCount; Index++) {
|
||||
Print(L" <SmiHandler");
|
||||
Print (L" <SmiHandler");
|
||||
if (SmiHandlerStruct->ContextBufferSize != 0) {
|
||||
DumpSmiChildContext (&SmiStruct->HandlerType, (UINT8 *)SmiHandlerStruct + SmiHandlerStruct->ContextBufferOffset, SmiHandlerStruct->ContextBufferSize);
|
||||
}
|
||||
Print(L">\n");
|
||||
ImageStruct = GetImageFromRef((UINTN)SmiHandlerStruct->ImageRef);
|
||||
NameString = GetDriverNameString (ImageStruct);
|
||||
Print(L" <Module RefId=\"0x%x\" Name=\"%a\">\n", SmiHandlerStruct->ImageRef, NameString);
|
||||
|
||||
Print (L">\n");
|
||||
ImageStruct = GetImageFromRef ((UINTN)SmiHandlerStruct->ImageRef);
|
||||
NameString = GetDriverNameString (ImageStruct);
|
||||
Print (L" <Module RefId=\"0x%x\" Name=\"%a\">\n", SmiHandlerStruct->ImageRef, NameString);
|
||||
if ((ImageStruct != NULL) && (ImageStruct->PdbStringOffset != 0)) {
|
||||
Print(L" <Pdb>%a</Pdb>\n", (UINT8 *)ImageStruct + ImageStruct->PdbStringOffset);
|
||||
Print (L" <Pdb>%a</Pdb>\n", (UINT8 *)ImageStruct + ImageStruct->PdbStringOffset);
|
||||
}
|
||||
Print(L" </Module>\n");
|
||||
Print(L" <Handler Address=\"0x%lx\">\n", SmiHandlerStruct->Handler);
|
||||
|
||||
Print (L" </Module>\n");
|
||||
Print (L" <Handler Address=\"0x%lx\">\n", SmiHandlerStruct->Handler);
|
||||
if (ImageStruct != NULL) {
|
||||
Print(L" <RVA>0x%x</RVA>\n", (UINTN) (SmiHandlerStruct->Handler - ImageStruct->ImageBase));
|
||||
Print (L" <RVA>0x%x</RVA>\n", (UINTN)(SmiHandlerStruct->Handler - ImageStruct->ImageBase));
|
||||
}
|
||||
Print(L" </Handler>\n", SmiHandlerStruct->Handler);
|
||||
Print(L" <Caller Address=\"0x%lx\">\n", SmiHandlerStruct->CallerAddr);
|
||||
|
||||
Print (L" </Handler>\n", SmiHandlerStruct->Handler);
|
||||
Print (L" <Caller Address=\"0x%lx\">\n", SmiHandlerStruct->CallerAddr);
|
||||
if (ImageStruct != NULL) {
|
||||
Print(L" <RVA>0x%x</RVA>\n", (UINTN) (SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase));
|
||||
Print (L" <RVA>0x%x</RVA>\n", (UINTN)(SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase));
|
||||
}
|
||||
Print(L" </Caller>\n", SmiHandlerStruct->Handler);
|
||||
|
||||
Print (L" </Caller>\n", SmiHandlerStruct->Handler);
|
||||
SmiHandlerStruct = (VOID *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length);
|
||||
Print(L" </SmiHandler>\n");
|
||||
Print (L" </SmiHandler>\n");
|
||||
}
|
||||
Print(L" </SmiEntry>\n");
|
||||
|
||||
Print (L" </SmiEntry>\n");
|
||||
}
|
||||
|
||||
SmiStruct = (VOID *)((UINTN)SmiStruct + SmiStruct->Header.Length);
|
||||
}
|
||||
|
||||
@@ -635,11 +654,11 @@ DumpSmiHandler(
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmiHandlerProfileInfoEntrypoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
GetSmiHandlerProfileDatabase();
|
||||
GetSmiHandlerProfileDatabase ();
|
||||
|
||||
if (mSmiHandlerProfileDatabase == NULL) {
|
||||
return EFI_SUCCESS;
|
||||
@@ -648,38 +667,38 @@ SmiHandlerProfileInfoEntrypoint (
|
||||
//
|
||||
// Dump all image
|
||||
//
|
||||
Print(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
Print(L"<SmiHandlerProfile>\n");
|
||||
Print(L"<ImageDatabase>\n");
|
||||
Print(L" <!-- SMM image loaded -->\n");
|
||||
DumpSmmLoadedImage();
|
||||
Print(L"</ImageDatabase>\n\n");
|
||||
Print (L"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
Print (L"<SmiHandlerProfile>\n");
|
||||
Print (L"<ImageDatabase>\n");
|
||||
Print (L" <!-- SMM image loaded -->\n");
|
||||
DumpSmmLoadedImage ();
|
||||
Print (L"</ImageDatabase>\n\n");
|
||||
|
||||
//
|
||||
// Dump SMI Handler
|
||||
//
|
||||
Print(L"<SmiHandlerDatabase>\n");
|
||||
Print(L" <!-- SMI Handler registered -->\n\n");
|
||||
Print(L" <SmiHandlerCategory Name=\"RootSmi\">\n");
|
||||
Print(L" <!-- The root SMI Handler registered by SmmCore -->\n");
|
||||
DumpSmiHandler(SmmCoreSmiHandlerCategoryRootHandler);
|
||||
Print(L" </SmiHandlerCategory>\n\n");
|
||||
Print (L"<SmiHandlerDatabase>\n");
|
||||
Print (L" <!-- SMI Handler registered -->\n\n");
|
||||
Print (L" <SmiHandlerCategory Name=\"RootSmi\">\n");
|
||||
Print (L" <!-- The root SMI Handler registered by SmmCore -->\n");
|
||||
DumpSmiHandler (SmmCoreSmiHandlerCategoryRootHandler);
|
||||
Print (L" </SmiHandlerCategory>\n\n");
|
||||
|
||||
Print(L" <SmiHandlerCategory Name=\"GuidSmi\">\n");
|
||||
Print(L" <!-- The GUID SMI Handler registered by SmmCore -->\n");
|
||||
DumpSmiHandler(SmmCoreSmiHandlerCategoryGuidHandler);
|
||||
Print(L" </SmiHandlerCategory>\n\n");
|
||||
Print (L" <SmiHandlerCategory Name=\"GuidSmi\">\n");
|
||||
Print (L" <!-- The GUID SMI Handler registered by SmmCore -->\n");
|
||||
DumpSmiHandler (SmmCoreSmiHandlerCategoryGuidHandler);
|
||||
Print (L" </SmiHandlerCategory>\n\n");
|
||||
|
||||
Print(L" <SmiHandlerCategory Name=\"HardwareSmi\">\n");
|
||||
Print(L" <!-- The hardware SMI Handler registered by SmmChildDispatcher -->\n");
|
||||
DumpSmiHandler(SmmCoreSmiHandlerCategoryHardwareHandler);
|
||||
Print(L" </SmiHandlerCategory>\n\n");
|
||||
Print (L" <SmiHandlerCategory Name=\"HardwareSmi\">\n");
|
||||
Print (L" <!-- The hardware SMI Handler registered by SmmChildDispatcher -->\n");
|
||||
DumpSmiHandler (SmmCoreSmiHandlerCategoryHardwareHandler);
|
||||
Print (L" </SmiHandlerCategory>\n\n");
|
||||
|
||||
Print(L"</SmiHandlerDatabase>\n");
|
||||
Print(L"</SmiHandlerProfile>\n");
|
||||
Print (L"</SmiHandlerDatabase>\n");
|
||||
Print (L"</SmiHandlerProfile>\n");
|
||||
|
||||
if (mSmiHandlerProfileDatabase != NULL) {
|
||||
FreePool(mSmiHandlerProfileDatabase);
|
||||
FreePool (mSmiHandlerProfileDatabase);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -10,29 +10,29 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "FrontPage.h"
|
||||
#include "FrontPageCustomizedUi.h"
|
||||
|
||||
#define MAX_STRING_LEN 200
|
||||
#define MAX_STRING_LEN 200
|
||||
|
||||
EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
|
||||
EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
|
||||
|
||||
BOOLEAN mResetRequired = FALSE;
|
||||
BOOLEAN mResetRequired = FALSE;
|
||||
|
||||
EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
||||
CHAR8 *mLanguageString;
|
||||
BOOLEAN mModeInitialized = FALSE;
|
||||
EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
||||
CHAR8 *mLanguageString;
|
||||
BOOLEAN mModeInitialized = FALSE;
|
||||
//
|
||||
// Boot video resolution and text mode.
|
||||
//
|
||||
UINT32 mBootHorizontalResolution = 0;
|
||||
UINT32 mBootVerticalResolution = 0;
|
||||
UINT32 mBootTextModeColumn = 0;
|
||||
UINT32 mBootTextModeRow = 0;
|
||||
UINT32 mBootHorizontalResolution = 0;
|
||||
UINT32 mBootVerticalResolution = 0;
|
||||
UINT32 mBootTextModeColumn = 0;
|
||||
UINT32 mBootTextModeRow = 0;
|
||||
//
|
||||
// BIOS setup video resolution and text mode.
|
||||
//
|
||||
UINT32 mSetupTextModeColumn = 0;
|
||||
UINT32 mSetupTextModeRow = 0;
|
||||
UINT32 mSetupHorizontalResolution = 0;
|
||||
UINT32 mSetupVerticalResolution = 0;
|
||||
UINT32 mSetupTextModeColumn = 0;
|
||||
UINT32 mSetupTextModeRow = 0;
|
||||
UINT32 mSetupHorizontalResolution = 0;
|
||||
UINT32 mSetupVerticalResolution = 0;
|
||||
|
||||
FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate = {
|
||||
FRONT_PAGE_CALLBACK_DATA_SIGNATURE,
|
||||
@@ -52,21 +52,22 @@ HII_VENDOR_DEVICE_PATH mFrontPageHiiVendorDevicePath = {
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
{
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
|
||||
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
|
||||
}
|
||||
},
|
||||
//
|
||||
// {8E6D99EE-7531-48f8-8745-7F6144468FF2}
|
||||
//
|
||||
{ 0x8e6d99ee, 0x7531, 0x48f8, { 0x87, 0x45, 0x7f, 0x61, 0x44, 0x46, 0x8f, 0xf2 } }
|
||||
{ 0x8e6d99ee, 0x7531, 0x48f8, { 0x87, 0x45, 0x7f, 0x61, 0x44, 0x46, 0x8f, 0xf2 }
|
||||
}
|
||||
},
|
||||
{
|
||||
END_DEVICE_PATH_TYPE,
|
||||
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
||||
{
|
||||
(UINT8) (END_DEVICE_PATH_LENGTH),
|
||||
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
|
||||
(UINT8)(END_DEVICE_PATH_LENGTH),
|
||||
(UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -105,15 +106,16 @@ UpdateFrontPageBannerStrings (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FakeExtractConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Request,
|
||||
OUT EFI_STRING *Progress,
|
||||
OUT EFI_STRING *Results
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Request,
|
||||
OUT EFI_STRING *Progress,
|
||||
OUT EFI_STRING *Results
|
||||
)
|
||||
{
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
if ((Progress == NULL) || (Results == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*Progress = Request;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
@@ -137,12 +139,12 @@ FakeExtractConfig (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FakeRouteConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
)
|
||||
{
|
||||
if (Configuration == NULL || Progress == NULL) {
|
||||
if ((Configuration == NULL) || (Progress == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -172,12 +174,12 @@ FakeRouteConfig (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FrontPageCallback (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
)
|
||||
{
|
||||
return UiFrontPageCallbackHandler (gFrontPagePrivate.HiiHandle, Action, QuestionId, Type, Value, ActionRequest);
|
||||
@@ -193,10 +195,10 @@ UpdateFrontPageForm (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
VOID *StartOpCodeHandle;
|
||||
VOID *EndOpCodeHandle;
|
||||
EFI_IFR_GUID_LABEL *StartGuidLabel;
|
||||
EFI_IFR_GUID_LABEL *EndGuidLabel;
|
||||
VOID *StartOpCodeHandle;
|
||||
VOID *EndOpCodeHandle;
|
||||
EFI_IFR_GUID_LABEL *StartGuidLabel;
|
||||
EFI_IFR_GUID_LABEL *EndGuidLabel;
|
||||
|
||||
//
|
||||
// Allocate space for creation of UpdateData Buffer
|
||||
@@ -209,18 +211,18 @@ UpdateFrontPageForm (
|
||||
//
|
||||
// Create Hii Extend Label OpCode as the start opcode
|
||||
//
|
||||
StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
||||
StartGuidLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
||||
StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||
StartGuidLabel->Number = LABEL_FRANTPAGE_INFORMATION;
|
||||
//
|
||||
// Create Hii Extend Label OpCode as the end opcode
|
||||
//
|
||||
EndGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
||||
EndGuidLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
|
||||
EndGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||
EndGuidLabel->Number = LABEL_END;
|
||||
|
||||
//
|
||||
//Updata Front Page form
|
||||
// Updata Front Page form
|
||||
//
|
||||
UiCustomizeFrontPage (
|
||||
gFrontPagePrivate.HiiHandle,
|
||||
@@ -252,11 +254,12 @@ InitializeFrontPage (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Locate Hii relative protocols
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &gFormBrowser2);
|
||||
Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **)&gFormBrowser2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -265,14 +268,14 @@ InitializeFrontPage (
|
||||
// Install Device Path Protocol and Config Access protocol to driver handle
|
||||
//
|
||||
gFrontPagePrivate.DriverHandle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&gFrontPagePrivate.DriverHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&mFrontPageHiiVendorDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&gFrontPagePrivate.ConfigAccess,
|
||||
NULL
|
||||
);
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&gFrontPagePrivate.DriverHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&mFrontPageHiiVendorDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&gFrontPagePrivate.ConfigAccess,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
@@ -288,14 +291,14 @@ InitializeFrontPage (
|
||||
ASSERT (gFrontPagePrivate.HiiHandle != NULL);
|
||||
|
||||
//
|
||||
//Updata Front Page banner strings
|
||||
// Updata Front Page banner strings
|
||||
//
|
||||
UpdateFrontPageBannerStrings ();
|
||||
|
||||
//
|
||||
// Update front page menus.
|
||||
//
|
||||
UpdateFrontPageForm();
|
||||
UpdateFrontPageForm ();
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -324,15 +327,15 @@ CallFrontPage (
|
||||
);
|
||||
|
||||
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
|
||||
Status = gFormBrowser2->SendForm (
|
||||
gFormBrowser2,
|
||||
&gFrontPagePrivate.HiiHandle,
|
||||
1,
|
||||
&mFrontPageGuid,
|
||||
0,
|
||||
NULL,
|
||||
&ActionRequest
|
||||
);
|
||||
Status = gFormBrowser2->SendForm (
|
||||
gFormBrowser2,
|
||||
&gFrontPagePrivate.HiiHandle,
|
||||
1,
|
||||
&mFrontPageGuid,
|
||||
0,
|
||||
NULL,
|
||||
&ActionRequest
|
||||
);
|
||||
//
|
||||
// Check whether user change any option setting which needs a reset to be effective
|
||||
//
|
||||
@@ -348,11 +351,12 @@ CallFrontPage (
|
||||
|
||||
**/
|
||||
VOID
|
||||
FreeFrontPage(
|
||||
FreeFrontPage (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
gFrontPagePrivate.DriverHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
@@ -383,9 +387,9 @@ FreeFrontPage(
|
||||
**/
|
||||
VOID
|
||||
ConvertProcessorToString (
|
||||
IN UINT16 ProcessorFrequency,
|
||||
IN UINT16 Base10Exponent,
|
||||
OUT CHAR16 **String
|
||||
IN UINT16 ProcessorFrequency,
|
||||
IN UINT16 Base10Exponent,
|
||||
OUT CHAR16 **String
|
||||
)
|
||||
{
|
||||
CHAR16 *StringBuffer;
|
||||
@@ -395,13 +399,14 @@ ConvertProcessorToString (
|
||||
|
||||
if (Base10Exponent >= 6) {
|
||||
FreqMhz = ProcessorFrequency;
|
||||
for (Index = 0; Index < (UINT32) Base10Exponent - 6; Index++) {
|
||||
for (Index = 0; Index < (UINT32)Base10Exponent - 6; Index++) {
|
||||
FreqMhz *= 10;
|
||||
}
|
||||
} else {
|
||||
FreqMhz = 0;
|
||||
}
|
||||
DestMax = 0x20 / sizeof (CHAR16);
|
||||
|
||||
DestMax = 0x20 / sizeof (CHAR16);
|
||||
StringBuffer = AllocateZeroPool (0x20);
|
||||
ASSERT (StringBuffer != NULL);
|
||||
UnicodeValueToStringS (StringBuffer, sizeof (CHAR16) * DestMax, LEFT_JUSTIFY, FreqMhz / 1000, 3);
|
||||
@@ -415,11 +420,10 @@ ConvertProcessorToString (
|
||||
2
|
||||
);
|
||||
StrCatS (StringBuffer, DestMax, L" GHz");
|
||||
*String = (CHAR16 *) StringBuffer;
|
||||
return ;
|
||||
*String = (CHAR16 *)StringBuffer;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Convert Memory Size to a string.
|
||||
|
||||
@@ -429,8 +433,8 @@ ConvertProcessorToString (
|
||||
**/
|
||||
VOID
|
||||
ConvertMemorySizeToString (
|
||||
IN UINT32 MemorySize,
|
||||
OUT CHAR16 **String
|
||||
IN UINT32 MemorySize,
|
||||
OUT CHAR16 **String
|
||||
)
|
||||
{
|
||||
CHAR16 *StringBuffer;
|
||||
@@ -440,9 +444,9 @@ ConvertMemorySizeToString (
|
||||
UnicodeValueToStringS (StringBuffer, 0x24, LEFT_JUSTIFY, MemorySize, 10);
|
||||
StrCatS (StringBuffer, 0x24 / sizeof (CHAR16), L" MB RAM");
|
||||
|
||||
*String = (CHAR16 *) StringBuffer;
|
||||
*String = (CHAR16 *)StringBuffer;
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -459,12 +463,12 @@ ConvertMemorySizeToString (
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetOptionalStringByIndex (
|
||||
IN CHAR8 *OptionalStrStart,
|
||||
IN UINT8 Index,
|
||||
OUT CHAR16 **String
|
||||
IN CHAR8 *OptionalStrStart,
|
||||
IN UINT8 Index,
|
||||
OUT CHAR16 **String
|
||||
)
|
||||
{
|
||||
UINTN StrSize;
|
||||
UINTN StrSize;
|
||||
|
||||
if (Index == 0) {
|
||||
*String = AllocateZeroPool (sizeof (CHAR16));
|
||||
@@ -492,7 +496,6 @@ GetOptionalStringByIndex (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Update the banner information for the Front Page based on Smbios information.
|
||||
@@ -503,22 +506,22 @@ UpdateFrontPageBannerStrings (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT8 StrIndex;
|
||||
CHAR16 *NewString;
|
||||
CHAR16 *FirmwareVersionString;
|
||||
EFI_STATUS Status;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||
SMBIOS_TABLE_TYPE0 *Type0Record;
|
||||
SMBIOS_TABLE_TYPE1 *Type1Record;
|
||||
SMBIOS_TABLE_TYPE4 *Type4Record;
|
||||
SMBIOS_TABLE_TYPE19 *Type19Record;
|
||||
EFI_SMBIOS_TABLE_HEADER *Record;
|
||||
UINT64 InstalledMemory;
|
||||
BOOLEAN FoundCpu;
|
||||
UINT8 StrIndex;
|
||||
CHAR16 *NewString;
|
||||
CHAR16 *FirmwareVersionString;
|
||||
EFI_STATUS Status;
|
||||
EFI_SMBIOS_HANDLE SmbiosHandle;
|
||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||
SMBIOS_TABLE_TYPE0 *Type0Record;
|
||||
SMBIOS_TABLE_TYPE1 *Type1Record;
|
||||
SMBIOS_TABLE_TYPE4 *Type4Record;
|
||||
SMBIOS_TABLE_TYPE19 *Type19Record;
|
||||
EFI_SMBIOS_TABLE_HEADER *Record;
|
||||
UINT64 InstalledMemory;
|
||||
BOOLEAN FoundCpu;
|
||||
|
||||
InstalledMemory = 0;
|
||||
FoundCpu = 0;
|
||||
FoundCpu = 0;
|
||||
|
||||
//
|
||||
// Update default banner string.
|
||||
@@ -546,7 +549,7 @@ UpdateFrontPageBannerStrings (
|
||||
//
|
||||
// Update Front Page banner strings base on SmBios Table.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **) &Smbios);
|
||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Smbios protocol not found, get the default value.
|
||||
@@ -580,17 +583,17 @@ UpdateFrontPageBannerStrings (
|
||||
}
|
||||
|
||||
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
||||
Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
|
||||
while (!EFI_ERROR(Status)) {
|
||||
Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
|
||||
while (!EFI_ERROR (Status)) {
|
||||
if (Record->Type == SMBIOS_TYPE_BIOS_INFORMATION) {
|
||||
Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
|
||||
StrIndex = Type0Record->BiosVersion;
|
||||
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
|
||||
Type0Record = (SMBIOS_TABLE_TYPE0 *)Record;
|
||||
StrIndex = Type0Record->BiosVersion;
|
||||
GetOptionalStringByIndex ((CHAR8 *)((UINT8 *)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
|
||||
|
||||
FirmwareVersionString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
|
||||
FirmwareVersionString = (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString);
|
||||
if (*FirmwareVersionString != 0x0000 ) {
|
||||
FreePool (NewString);
|
||||
NewString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
|
||||
NewString = (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString);
|
||||
UiCustomizeFrontPageBanner (3, TRUE, &NewString);
|
||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
|
||||
} else {
|
||||
@@ -601,27 +604,27 @@ UpdateFrontPageBannerStrings (
|
||||
}
|
||||
|
||||
if (Record->Type == SMBIOS_TYPE_SYSTEM_INFORMATION) {
|
||||
Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;
|
||||
StrIndex = Type1Record->ProductName;
|
||||
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
|
||||
Type1Record = (SMBIOS_TABLE_TYPE1 *)Record;
|
||||
StrIndex = Type1Record->ProductName;
|
||||
GetOptionalStringByIndex ((CHAR8 *)((UINT8 *)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
|
||||
UiCustomizeFrontPageBanner (1, TRUE, &NewString);
|
||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
|
||||
FreePool (NewString);
|
||||
}
|
||||
|
||||
if ((Record->Type == SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {
|
||||
Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
|
||||
Type4Record = (SMBIOS_TABLE_TYPE4 *)Record;
|
||||
//
|
||||
// The information in the record should be only valid when the CPU Socket is populated.
|
||||
//
|
||||
if ((Type4Record->Status & SMBIOS_TYPE4_CPU_SOCKET_POPULATED) == SMBIOS_TYPE4_CPU_SOCKET_POPULATED) {
|
||||
StrIndex = Type4Record->ProcessorVersion;
|
||||
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
|
||||
GetOptionalStringByIndex ((CHAR8 *)((UINT8 *)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
|
||||
UiCustomizeFrontPageBanner (2, TRUE, &NewString);
|
||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
|
||||
FreePool (NewString);
|
||||
|
||||
ConvertProcessorToString(Type4Record->CurrentSpeed, 6, &NewString);
|
||||
ConvertProcessorToString (Type4Record->CurrentSpeed, 6, &NewString);
|
||||
UiCustomizeFrontPageBanner (2, FALSE, &NewString);
|
||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
|
||||
FreePool (NewString);
|
||||
@@ -631,13 +634,19 @@ UpdateFrontPageBannerStrings (
|
||||
}
|
||||
|
||||
if ( Record->Type == SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
|
||||
Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;
|
||||
Type19Record = (SMBIOS_TABLE_TYPE19 *)Record;
|
||||
if (Type19Record->StartingAddress != 0xFFFFFFFF ) {
|
||||
InstalledMemory += RShiftU64(Type19Record->EndingAddress -
|
||||
Type19Record->StartingAddress + 1, 10);
|
||||
InstalledMemory += RShiftU64 (
|
||||
Type19Record->EndingAddress -
|
||||
Type19Record->StartingAddress + 1,
|
||||
10
|
||||
);
|
||||
} else {
|
||||
InstalledMemory += RShiftU64(Type19Record->ExtendedEndingAddress -
|
||||
Type19Record->ExtendedStartingAddress + 1, 20);
|
||||
InstalledMemory += RShiftU64 (
|
||||
Type19Record->ExtendedEndingAddress -
|
||||
Type19Record->ExtendedStartingAddress + 1,
|
||||
20
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,7 +656,7 @@ UpdateFrontPageBannerStrings (
|
||||
//
|
||||
// Now update the total installed RAM size
|
||||
//
|
||||
ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString );
|
||||
ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString);
|
||||
UiCustomizeFrontPageBanner (3, FALSE, &NewString);
|
||||
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
|
||||
FreePool (NewString);
|
||||
@@ -695,7 +704,7 @@ UiSetConsoleMode (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
(VOID**)&GraphicsOutput
|
||||
(VOID **)&GraphicsOutput
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
GraphicsOutput = NULL;
|
||||
@@ -704,7 +713,7 @@ UiSetConsoleMode (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID**)&SimpleTextOut
|
||||
(VOID **)&SimpleTextOut
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SimpleTextOut = NULL;
|
||||
@@ -733,7 +742,7 @@ UiSetConsoleMode (
|
||||
}
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
MaxGopMode = GraphicsOutput->Mode->MaxMode;
|
||||
MaxGopMode = GraphicsOutput->Mode->MaxMode;
|
||||
}
|
||||
|
||||
if (SimpleTextOut != NULL) {
|
||||
@@ -749,22 +758,24 @@ UiSetConsoleMode (
|
||||
//
|
||||
for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {
|
||||
Status = GraphicsOutput->QueryMode (
|
||||
GraphicsOutput,
|
||||
ModeNumber,
|
||||
&SizeOfInfo,
|
||||
&Info
|
||||
);
|
||||
GraphicsOutput,
|
||||
ModeNumber,
|
||||
&SizeOfInfo,
|
||||
&Info
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if ((Info->HorizontalResolution == NewHorizontalResolution) &&
|
||||
(Info->VerticalResolution == NewVerticalResolution)) {
|
||||
(Info->VerticalResolution == NewVerticalResolution))
|
||||
{
|
||||
if ((GraphicsOutput->Mode->Info->HorizontalResolution == NewHorizontalResolution) &&
|
||||
(GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution)) {
|
||||
(GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution))
|
||||
{
|
||||
//
|
||||
// Current resolution is same with required resolution, check if text mode need be set
|
||||
//
|
||||
Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (CurrentColumn == NewColumns && CurrentRow == NewRows) {
|
||||
if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
|
||||
//
|
||||
// If current text mode is same with required text mode. Do nothing
|
||||
//
|
||||
@@ -776,7 +787,7 @@ UiSetConsoleMode (
|
||||
//
|
||||
for (Index = 0; Index < MaxTextMode; Index++) {
|
||||
Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {
|
||||
//
|
||||
// Required text mode is supported, set it.
|
||||
@@ -795,6 +806,7 @@ UiSetConsoleMode (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Index == MaxTextMode) {
|
||||
//
|
||||
// If required text mode is not supported, return error.
|
||||
@@ -815,6 +827,7 @@ UiSetConsoleMode (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (Info);
|
||||
}
|
||||
}
|
||||
@@ -845,19 +858,21 @@ UiSetConsoleMode (
|
||||
// Locate all the handles with GOP protocol and reconnect it.
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
ByProtocol,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
|
||||
}
|
||||
|
||||
for (Index = 0; Index < HandleCount; Index++) {
|
||||
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
@@ -885,12 +900,12 @@ InitializeUserInterface (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
|
||||
UINTN BootTextColumn;
|
||||
UINTN BootTextRow;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;
|
||||
UINTN BootTextColumn;
|
||||
UINTN BootTextRow;
|
||||
|
||||
if (!mModeInitialized) {
|
||||
//
|
||||
@@ -900,7 +915,7 @@ InitializeUserInterface (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
(VOID**)&GraphicsOutput
|
||||
(VOID **)&GraphicsOutput
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
GraphicsOutput = NULL;
|
||||
@@ -909,7 +924,7 @@ InitializeUserInterface (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID**)&SimpleTextOut
|
||||
(VOID **)&SimpleTextOut
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SimpleTextOut = NULL;
|
||||
@@ -942,7 +957,7 @@ InitializeUserInterface (
|
||||
mSetupTextModeColumn = PcdGet32 (PcdSetupConOutColumn);
|
||||
mSetupTextModeRow = PcdGet32 (PcdSetupConOutRow);
|
||||
|
||||
mModeInitialized = TRUE;
|
||||
mModeInitialized = TRUE;
|
||||
}
|
||||
|
||||
gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
|
||||
@@ -976,11 +991,11 @@ InitializeUserInterface (
|
||||
VOID
|
||||
EFIAPI
|
||||
UiEntry (
|
||||
IN BOOLEAN ConnectAllHappened
|
||||
IN BOOLEAN ConnectAllHappened
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
||||
EFI_STATUS Status;
|
||||
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
||||
|
||||
//
|
||||
// Enter Setup page.
|
||||
@@ -1006,7 +1021,7 @@ UiEntry (
|
||||
//
|
||||
// Boot Logo is corrupted, report it using Boot Logo protocol.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);
|
||||
Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **)&BootLogo);
|
||||
if (!EFI_ERROR (Status) && (BootLogo != NULL)) {
|
||||
BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
|
||||
}
|
||||
@@ -1023,7 +1038,7 @@ UiEntry (
|
||||
}
|
||||
|
||||
//
|
||||
//Will leave browser, check any reset required change is applied? if yes, reset system
|
||||
// Will leave browser, check any reset required change is applied? if yes, reset system
|
||||
//
|
||||
SetupResetReminder ();
|
||||
}
|
||||
@@ -1034,10 +1049,6 @@ UiEntry (
|
||||
// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Record the info that a reset is required.
|
||||
A module boolean variable is used to record whether a reset is required.
|
||||
@@ -1052,10 +1063,6 @@ EnableResetRequired (
|
||||
mResetRequired = TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Check if user changed any option setting which needs a system reset to be effective.
|
||||
|
||||
@@ -1069,7 +1076,6 @@ IsResetRequired (
|
||||
return mResetRequired;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check whether a reset is needed, and finish the reset reminder feature.
|
||||
If a reset is needed, Popup a menu to notice user, and finish the feature
|
||||
@@ -1082,15 +1088,14 @@ SetupResetReminder (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_INPUT_KEY Key;
|
||||
CHAR16 *StringBuffer1;
|
||||
CHAR16 *StringBuffer2;
|
||||
EFI_INPUT_KEY Key;
|
||||
CHAR16 *StringBuffer1;
|
||||
CHAR16 *StringBuffer2;
|
||||
|
||||
//
|
||||
//check any reset required change is applied? if yes, reset system
|
||||
// check any reset required change is applied? if yes, reset system
|
||||
//
|
||||
if (IsResetRequired ()) {
|
||||
|
||||
StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
|
||||
ASSERT (StringBuffer1 != NULL);
|
||||
StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
|
||||
@@ -1110,4 +1115,3 @@ SetupResetReminder (
|
||||
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,24 +18,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
extern UINT8 FrontPageVfrBin[];
|
||||
|
||||
extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
||||
extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
||||
|
||||
|
||||
#define SMBIOS_TYPE4_CPU_SOCKET_POPULATED BIT6
|
||||
#define SMBIOS_TYPE4_CPU_SOCKET_POPULATED BIT6
|
||||
|
||||
//
|
||||
// This is the VFR compiler generated header file which defines the
|
||||
// string identifiers.
|
||||
//
|
||||
#define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
|
||||
#define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
|
||||
|
||||
//
|
||||
// These are defined as the same with vfr file
|
||||
//
|
||||
#define FRONT_PAGE_FORM_ID 0x1000
|
||||
#define FRONT_PAGE_FORM_ID 0x1000
|
||||
|
||||
#define LABEL_FRANTPAGE_INFORMATION 0x1000
|
||||
#define LABEL_END 0xffff
|
||||
#define LABEL_FRANTPAGE_INFORMATION 0x1000
|
||||
#define LABEL_END 0xffff
|
||||
|
||||
#define FRONT_PAGE_FORMSET_GUID \
|
||||
{ \
|
||||
@@ -45,22 +44,21 @@ extern EFI_FORM_BROWSER2_PROTOCOL *gFormBrowser2;
|
||||
#define FRONT_PAGE_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('F', 'P', 'C', 'B')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
UINTN Signature;
|
||||
|
||||
//
|
||||
// HII relative handles
|
||||
//
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_STRING_ID *LanguageToken;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_STRING_ID *LanguageToken;
|
||||
|
||||
//
|
||||
// Produced protocols
|
||||
//
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
||||
} FRONT_PAGE_CALLBACK_DATA;
|
||||
|
||||
|
||||
#define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
|
||||
CR (a, \
|
||||
FRONT_PAGE_CALLBACK_DATA, \
|
||||
@@ -93,10 +91,10 @@ typedef struct {
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FakeExtractConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Request,
|
||||
OUT EFI_STRING *Progress,
|
||||
OUT EFI_STRING *Results
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Request,
|
||||
OUT EFI_STRING *Progress,
|
||||
OUT EFI_STRING *Results
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -118,9 +116,9 @@ FakeExtractConfig (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FakeRouteConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -144,12 +142,12 @@ FakeRouteConfig (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FrontPageCallback (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -177,9 +175,9 @@ InitializeFrontPage (
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetProducerString (
|
||||
IN EFI_GUID *ProducerGuid,
|
||||
IN EFI_STRING_ID Token,
|
||||
OUT CHAR16 **String
|
||||
IN EFI_GUID *ProducerGuid,
|
||||
IN EFI_STRING_ID Token,
|
||||
OUT CHAR16 **String
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -192,7 +190,7 @@ GetProducerString (
|
||||
VOID
|
||||
EFIAPI
|
||||
UiEntry (
|
||||
IN BOOLEAN ConnectAllHappened
|
||||
IN BOOLEAN ConnectAllHappened
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -206,8 +204,7 @@ UiEntry (
|
||||
**/
|
||||
CHAR16 *
|
||||
ExtractDevicePathFromHiiHandle (
|
||||
IN EFI_HII_HANDLE Handle
|
||||
IN EFI_HII_HANDLE Handle
|
||||
);
|
||||
|
||||
#endif // _FRONT_PAGE_H_
|
||||
|
||||
|
@@ -37,7 +37,7 @@ UiCustomizeFrontPage (
|
||||
//
|
||||
// Create empty line.
|
||||
//
|
||||
UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);
|
||||
UiCreateEmptyLine (HiiHandle, StartOpCodeHandle);
|
||||
|
||||
//
|
||||
// Find third party drivers which need to be shown in the front page.
|
||||
@@ -47,17 +47,17 @@ UiCustomizeFrontPage (
|
||||
//
|
||||
// Create empty line.
|
||||
//
|
||||
UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);
|
||||
UiCreateEmptyLine (HiiHandle, StartOpCodeHandle);
|
||||
|
||||
//
|
||||
// Create "Continue" menu.
|
||||
//
|
||||
UiCreateContinueMenu(HiiHandle, StartOpCodeHandle);
|
||||
UiCreateContinueMenu (HiiHandle, StartOpCodeHandle);
|
||||
|
||||
//
|
||||
// Create reset menu.
|
||||
//
|
||||
UiCreateResetMenu(HiiHandle, StartOpCodeHandle);
|
||||
UiCreateResetMenu (HiiHandle, StartOpCodeHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,15 +80,15 @@ UiCustomizeFrontPage (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UiFrontPageCallbackHandler (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (UiSupportLibCallbackHandler (HiiHandle, Action, QuestionId, Type, Value, ActionRequest, &Status)) {
|
||||
return Status;
|
||||
@@ -121,19 +121,21 @@ UiFrontPageCallbackHandler (
|
||||
**/
|
||||
VOID
|
||||
UiCustomizeFrontPageBanner (
|
||||
IN UINTN LineIndex,
|
||||
IN BOOLEAN LeftOrRight,
|
||||
IN OUT EFI_STRING *BannerStr
|
||||
IN UINTN LineIndex,
|
||||
IN BOOLEAN LeftOrRight,
|
||||
IN OUT EFI_STRING *BannerStr
|
||||
)
|
||||
{
|
||||
if ((LineIndex == 5) && LeftOrRight) {
|
||||
// Update STR_CUSTOMIZE_BANNER_LINE5_LEFT
|
||||
if (PcdGetBool(PcdTestKeyUsed)) {
|
||||
if (PcdGetBool (PcdTestKeyUsed)) {
|
||||
if (BannerStr != NULL) {
|
||||
FreePool(*BannerStr);
|
||||
FreePool (*BannerStr);
|
||||
}
|
||||
*BannerStr = HiiGetString(gFrontPagePrivate.HiiHandle, STRING_TOKEN(STR_TEST_KEY_USED), NULL);
|
||||
|
||||
*BannerStr = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_TEST_KEY_USED), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -33,9 +33,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
VOID
|
||||
UiCustomizeFrontPageBanner (
|
||||
IN UINTN LineIndex,
|
||||
IN BOOLEAN LeftOrRight,
|
||||
IN OUT EFI_STRING *BannerStr
|
||||
IN UINTN LineIndex,
|
||||
IN BOOLEAN LeftOrRight,
|
||||
IN OUT EFI_STRING *BannerStr
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -71,12 +71,12 @@ UiCustomizeFrontPage (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UiFrontPageCallbackHandler (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -30,29 +30,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
// This is the VFR compiler generated header file which defines the
|
||||
// string identifiers.
|
||||
//
|
||||
#define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
|
||||
#define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
|
||||
|
||||
#define UI_HII_DRIVER_LIST_SIZE 0x8
|
||||
#define UI_HII_DRIVER_LIST_SIZE 0x8
|
||||
|
||||
#define FRONT_PAGE_KEY_CONTINUE 0x1000
|
||||
#define FRONT_PAGE_KEY_RESET 0x1001
|
||||
#define FRONT_PAGE_KEY_LANGUAGE 0x1002
|
||||
#define FRONT_PAGE_KEY_DRIVER 0x2000
|
||||
#define FRONT_PAGE_KEY_CONTINUE 0x1000
|
||||
#define FRONT_PAGE_KEY_RESET 0x1001
|
||||
#define FRONT_PAGE_KEY_LANGUAGE 0x1002
|
||||
#define FRONT_PAGE_KEY_DRIVER 0x2000
|
||||
|
||||
typedef struct {
|
||||
EFI_STRING_ID PromptId;
|
||||
EFI_STRING_ID HelpId;
|
||||
EFI_STRING_ID DevicePathId;
|
||||
EFI_GUID FormSetGuid;
|
||||
BOOLEAN EmptyLineAfter;
|
||||
EFI_STRING_ID PromptId;
|
||||
EFI_STRING_ID HelpId;
|
||||
EFI_STRING_ID DevicePathId;
|
||||
EFI_GUID FormSetGuid;
|
||||
BOOLEAN EmptyLineAfter;
|
||||
} UI_HII_DRIVER_INSTANCE;
|
||||
|
||||
CHAR8 *gLanguageString;
|
||||
EFI_STRING_ID *gLanguageToken;
|
||||
UI_HII_DRIVER_INSTANCE *gHiiDriverList;
|
||||
extern EFI_HII_HANDLE gStringPackHandle;
|
||||
UINT8 gCurrentLanguageIndex;
|
||||
|
||||
CHAR8 *gLanguageString;
|
||||
EFI_STRING_ID *gLanguageToken;
|
||||
UI_HII_DRIVER_INSTANCE *gHiiDriverList;
|
||||
extern EFI_HII_HANDLE gStringPackHandle;
|
||||
UINT8 gCurrentLanguageIndex;
|
||||
|
||||
/**
|
||||
Get next language from language code list (with separator ';').
|
||||
@@ -68,8 +67,8 @@ UINT8 gCurrentLanguageIndex;
|
||||
**/
|
||||
VOID
|
||||
GetNextLanguage (
|
||||
IN OUT CHAR8 **LangCode,
|
||||
OUT CHAR8 *Lang
|
||||
IN OUT CHAR8 **LangCode,
|
||||
OUT CHAR8 *Lang
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
@@ -79,7 +78,7 @@ GetNextLanguage (
|
||||
ASSERT (*LangCode != NULL);
|
||||
ASSERT (Lang != NULL);
|
||||
|
||||
Index = 0;
|
||||
Index = 0;
|
||||
StringPtr = *LangCode;
|
||||
while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
|
||||
Index++;
|
||||
@@ -91,6 +90,7 @@ GetNextLanguage (
|
||||
if (StringPtr[Index] == ';') {
|
||||
Index++;
|
||||
}
|
||||
|
||||
*LangCode = StringPtr + Index;
|
||||
}
|
||||
|
||||
@@ -106,13 +106,13 @@ GetNextLanguage (
|
||||
**/
|
||||
EFI_STATUS
|
||||
LanguageChangeHandler (
|
||||
IN EFI_IFR_TYPE_VALUE *Value
|
||||
IN EFI_IFR_TYPE_VALUE *Value
|
||||
)
|
||||
{
|
||||
CHAR8 *LangCode;
|
||||
CHAR8 *Lang;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
CHAR8 *LangCode;
|
||||
CHAR8 *Lang;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Allocate working buffer for RFC 4646 language in supported LanguageString.
|
||||
@@ -120,7 +120,7 @@ LanguageChangeHandler (
|
||||
Lang = AllocatePool (AsciiStrSize (gLanguageString));
|
||||
ASSERT (Lang != NULL);
|
||||
|
||||
Index = 0;
|
||||
Index = 0;
|
||||
LangCode = gLanguageString;
|
||||
while (*LangCode != 0) {
|
||||
GetNextLanguage (&LangCode, Lang);
|
||||
@@ -148,6 +148,7 @@ LanguageChangeHandler (
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
FreePool (Lang);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -172,28 +173,30 @@ LanguageChangeHandler (
|
||||
**/
|
||||
BOOLEAN
|
||||
UiSupportLibCallbackHandler (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest,
|
||||
OUT EFI_STATUS *Status
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest,
|
||||
OUT EFI_STATUS *Status
|
||||
)
|
||||
{
|
||||
if (QuestionId != FRONT_PAGE_KEY_CONTINUE &&
|
||||
QuestionId != FRONT_PAGE_KEY_RESET &&
|
||||
QuestionId != FRONT_PAGE_KEY_LANGUAGE) {
|
||||
if ((QuestionId != FRONT_PAGE_KEY_CONTINUE) &&
|
||||
(QuestionId != FRONT_PAGE_KEY_RESET) &&
|
||||
(QuestionId != FRONT_PAGE_KEY_LANGUAGE))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
|
||||
if (QuestionId == FRONT_PAGE_KEY_LANGUAGE) {
|
||||
Value->u8 = gCurrentLanguageIndex;
|
||||
*Status = EFI_SUCCESS;
|
||||
*Status = EFI_SUCCESS;
|
||||
} else {
|
||||
*Status = EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -213,26 +216,26 @@ UiSupportLibCallbackHandler (
|
||||
|
||||
*Status = EFI_SUCCESS;
|
||||
switch (QuestionId) {
|
||||
case FRONT_PAGE_KEY_CONTINUE:
|
||||
//
|
||||
// This is the continue - clear the screen and return an error to get out of FrontPage loop
|
||||
//
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
break;
|
||||
case FRONT_PAGE_KEY_CONTINUE:
|
||||
//
|
||||
// This is the continue - clear the screen and return an error to get out of FrontPage loop
|
||||
//
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||
break;
|
||||
|
||||
case FRONT_PAGE_KEY_LANGUAGE:
|
||||
*Status = LanguageChangeHandler(Value);
|
||||
break;
|
||||
case FRONT_PAGE_KEY_LANGUAGE:
|
||||
*Status = LanguageChangeHandler (Value);
|
||||
break;
|
||||
|
||||
case FRONT_PAGE_KEY_RESET:
|
||||
//
|
||||
// Reset
|
||||
//
|
||||
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
||||
*Status = EFI_UNSUPPORTED;
|
||||
case FRONT_PAGE_KEY_RESET:
|
||||
//
|
||||
// Reset
|
||||
//
|
||||
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
||||
*Status = EFI_UNSUPPORTED;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,20 +251,20 @@ UiSupportLibCallbackHandler (
|
||||
**/
|
||||
VOID
|
||||
UiCreateLanguageMenu (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
)
|
||||
{
|
||||
CHAR8 *LangCode;
|
||||
CHAR8 *Lang;
|
||||
UINTN LangSize;
|
||||
CHAR8 *CurrentLang;
|
||||
UINTN OptionCount;
|
||||
CHAR16 *StringBuffer;
|
||||
VOID *OptionsOpCodeHandle;
|
||||
UINTN StringSize;
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_STRING_PROTOCOL *HiiString;
|
||||
CHAR8 *LangCode;
|
||||
CHAR8 *Lang;
|
||||
UINTN LangSize;
|
||||
CHAR8 *CurrentLang;
|
||||
UINTN OptionCount;
|
||||
CHAR16 *StringBuffer;
|
||||
VOID *OptionsOpCodeHandle;
|
||||
UINTN StringSize;
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_STRING_PROTOCOL *HiiString;
|
||||
|
||||
Lang = NULL;
|
||||
StringBuffer = NULL;
|
||||
@@ -272,17 +275,17 @@ UiCreateLanguageMenu (
|
||||
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
||||
ASSERT (OptionsOpCodeHandle != NULL);
|
||||
|
||||
GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
|
||||
GetEfiGlobalVariable2 (L"PlatformLang", (VOID **)&CurrentLang, NULL);
|
||||
|
||||
//
|
||||
// Get Support language list from variable.
|
||||
//
|
||||
GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&gLanguageString, NULL);
|
||||
GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID **)&gLanguageString, NULL);
|
||||
if (gLanguageString == NULL) {
|
||||
gLanguageString = AllocateCopyPool (
|
||||
AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
|
||||
(CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
|
||||
);
|
||||
AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
|
||||
(CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
|
||||
);
|
||||
ASSERT (gLanguageString != NULL);
|
||||
}
|
||||
|
||||
@@ -291,13 +294,13 @@ UiCreateLanguageMenu (
|
||||
// Count the language list number.
|
||||
//
|
||||
LangCode = gLanguageString;
|
||||
Lang = AllocatePool (AsciiStrSize (gLanguageString));
|
||||
Lang = AllocatePool (AsciiStrSize (gLanguageString));
|
||||
ASSERT (Lang != NULL);
|
||||
|
||||
OptionCount = 0;
|
||||
while (*LangCode != 0) {
|
||||
GetNextLanguage (&LangCode, Lang);
|
||||
OptionCount ++;
|
||||
OptionCount++;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -306,16 +309,16 @@ UiCreateLanguageMenu (
|
||||
gLanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
|
||||
ASSERT (gLanguageToken != NULL);
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
|
||||
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **)&HiiString);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
LangCode = gLanguageString;
|
||||
OptionCount = 0;
|
||||
LangCode = gLanguageString;
|
||||
OptionCount = 0;
|
||||
while (*LangCode != 0) {
|
||||
GetNextLanguage (&LangCode, Lang);
|
||||
|
||||
StringSize = 0;
|
||||
Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
|
||||
Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
StringBuffer = AllocateZeroPool (StringSize);
|
||||
ASSERT (StringBuffer != NULL);
|
||||
@@ -324,7 +327,7 @@ UiCreateLanguageMenu (
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
LangSize = AsciiStrSize (Lang);
|
||||
LangSize = AsciiStrSize (Lang);
|
||||
StringBuffer = AllocatePool (LangSize * sizeof (CHAR16));
|
||||
ASSERT (StringBuffer != NULL);
|
||||
AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize);
|
||||
@@ -339,31 +342,32 @@ UiCreateLanguageMenu (
|
||||
}
|
||||
|
||||
ASSERT (gLanguageToken != NULL);
|
||||
LangCode = gLanguageString;
|
||||
LangCode = gLanguageString;
|
||||
OptionCount = 0;
|
||||
if (Lang == NULL) {
|
||||
Lang = AllocatePool (AsciiStrSize (gLanguageString));
|
||||
ASSERT (Lang != NULL);
|
||||
}
|
||||
|
||||
while (*LangCode != 0) {
|
||||
GetNextLanguage (&LangCode, Lang);
|
||||
|
||||
if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
|
||||
if ((CurrentLang != NULL) && (AsciiStrCmp (Lang, CurrentLang) == 0)) {
|
||||
HiiCreateOneOfOptionOpCode (
|
||||
OptionsOpCodeHandle,
|
||||
gLanguageToken[OptionCount],
|
||||
EFI_IFR_OPTION_DEFAULT,
|
||||
EFI_IFR_NUMERIC_SIZE_1,
|
||||
(UINT8) OptionCount
|
||||
(UINT8)OptionCount
|
||||
);
|
||||
gCurrentLanguageIndex = (UINT8) OptionCount;
|
||||
gCurrentLanguageIndex = (UINT8)OptionCount;
|
||||
} else {
|
||||
HiiCreateOneOfOptionOpCode (
|
||||
OptionsOpCodeHandle,
|
||||
gLanguageToken[OptionCount],
|
||||
0,
|
||||
EFI_IFR_NUMERIC_SIZE_1,
|
||||
(UINT8) OptionCount
|
||||
(UINT8)OptionCount
|
||||
);
|
||||
}
|
||||
|
||||
@@ -373,6 +377,7 @@ UiCreateLanguageMenu (
|
||||
if (CurrentLang != NULL) {
|
||||
FreePool (CurrentLang);
|
||||
}
|
||||
|
||||
FreePool (Lang);
|
||||
|
||||
HiiCreateOneOfOpCode (
|
||||
@@ -398,8 +403,8 @@ UiCreateLanguageMenu (
|
||||
**/
|
||||
VOID
|
||||
UiCreateContinueMenu (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
)
|
||||
{
|
||||
HiiCreateActionOpCode (
|
||||
@@ -421,8 +426,8 @@ UiCreateContinueMenu (
|
||||
**/
|
||||
VOID
|
||||
UiCreateEmptyLine (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
)
|
||||
{
|
||||
HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_NULL_STRING), 0, 0, 0);
|
||||
@@ -437,8 +442,8 @@ UiCreateEmptyLine (
|
||||
**/
|
||||
VOID
|
||||
UiCreateResetMenu (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
)
|
||||
{
|
||||
HiiCreateActionOpCode (
|
||||
@@ -462,11 +467,11 @@ UiCreateResetMenu (
|
||||
**/
|
||||
CHAR16 *
|
||||
ExtractDevicePathFromHiiHandle (
|
||||
IN EFI_HII_HANDLE Handle
|
||||
IN EFI_HII_HANDLE Handle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE DriverHandle;
|
||||
|
||||
ASSERT (Handle != NULL);
|
||||
|
||||
@@ -479,7 +484,7 @@ ExtractDevicePathFromHiiHandle (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ConvertDevicePathToText(DevicePathFromHandle (DriverHandle), FALSE, FALSE);
|
||||
return ConvertDevicePathToText (DevicePathFromHandle (DriverHandle), FALSE, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -496,49 +501,49 @@ ExtractDevicePathFromHiiHandle (
|
||||
**/
|
||||
BOOLEAN
|
||||
RequiredDriver (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_GUID *Guid,
|
||||
OUT EFI_STRING_ID *PromptId,
|
||||
OUT EFI_STRING_ID *HelpId,
|
||||
OUT VOID *FormsetGuid
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_GUID *Guid,
|
||||
OUT EFI_STRING_ID *PromptId,
|
||||
OUT EFI_STRING_ID *HelpId,
|
||||
OUT VOID *FormsetGuid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 ClassGuidNum;
|
||||
EFI_GUID *ClassGuid;
|
||||
EFI_IFR_FORM_SET *Buffer;
|
||||
UINTN BufferSize;
|
||||
UINT8 *Ptr;
|
||||
UINTN TempSize;
|
||||
BOOLEAN RetVal;
|
||||
EFI_STATUS Status;
|
||||
UINT8 ClassGuidNum;
|
||||
EFI_GUID *ClassGuid;
|
||||
EFI_IFR_FORM_SET *Buffer;
|
||||
UINTN BufferSize;
|
||||
UINT8 *Ptr;
|
||||
UINTN TempSize;
|
||||
BOOLEAN RetVal;
|
||||
|
||||
Status = HiiGetFormSetFromHiiHandle(HiiHandle, &Buffer,&BufferSize);
|
||||
Status = HiiGetFormSetFromHiiHandle (HiiHandle, &Buffer, &BufferSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RetVal = FALSE;
|
||||
RetVal = FALSE;
|
||||
TempSize = 0;
|
||||
Ptr = (UINT8 *) Buffer;
|
||||
while(TempSize < BufferSize) {
|
||||
TempSize += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
|
||||
Ptr = (UINT8 *)Buffer;
|
||||
while (TempSize < BufferSize) {
|
||||
TempSize += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
|
||||
|
||||
if (((EFI_IFR_OP_HEADER *) Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)){
|
||||
Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
|
||||
if (((EFI_IFR_OP_HEADER *)Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {
|
||||
Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
|
||||
continue;
|
||||
}
|
||||
|
||||
ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
|
||||
ClassGuid = (EFI_GUID *) (VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));
|
||||
ClassGuidNum = (UINT8)(((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
|
||||
ClassGuid = (EFI_GUID *)(VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));
|
||||
while (ClassGuidNum-- > 0) {
|
||||
if (!CompareGuid (Guid, ClassGuid)){
|
||||
ClassGuid ++;
|
||||
if (!CompareGuid (Guid, ClassGuid)) {
|
||||
ClassGuid++;
|
||||
continue;
|
||||
}
|
||||
|
||||
*PromptId = ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle;
|
||||
*HelpId = ((EFI_IFR_FORM_SET *)Ptr)->Help;
|
||||
CopyMem (FormsetGuid, &((EFI_IFR_FORM_SET *) Ptr)->Guid, sizeof (EFI_GUID));
|
||||
*HelpId = ((EFI_IFR_FORM_SET *)Ptr)->Help;
|
||||
CopyMem (FormsetGuid, &((EFI_IFR_FORM_SET *)Ptr)->Guid, sizeof (EFI_GUID));
|
||||
RetVal = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -562,23 +567,23 @@ RequiredDriver (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UiListThirdPartyDrivers (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_GUID *ClassGuid,
|
||||
IN DRIVER_SPECIAL_HANDLER SpecialHandlerFn,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_GUID *ClassGuid,
|
||||
IN DRIVER_SPECIAL_HANDLER SpecialHandlerFn,
|
||||
IN VOID *StartOpCodeHandle
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
EFI_STRING String;
|
||||
EFI_STRING_ID Token;
|
||||
EFI_STRING_ID TokenHelp;
|
||||
EFI_HII_HANDLE *HiiHandles;
|
||||
CHAR16 *DevicePathStr;
|
||||
UINTN Count;
|
||||
UINTN CurrentSize;
|
||||
UI_HII_DRIVER_INSTANCE *DriverListPtr;
|
||||
EFI_STRING NewName;
|
||||
BOOLEAN EmptyLineAfter;
|
||||
UINTN Index;
|
||||
EFI_STRING String;
|
||||
EFI_STRING_ID Token;
|
||||
EFI_STRING_ID TokenHelp;
|
||||
EFI_HII_HANDLE *HiiHandles;
|
||||
CHAR16 *DevicePathStr;
|
||||
UINTN Count;
|
||||
UINTN CurrentSize;
|
||||
UI_HII_DRIVER_INSTANCE *DriverListPtr;
|
||||
EFI_STRING NewName;
|
||||
BOOLEAN EmptyLineAfter;
|
||||
|
||||
if (gHiiDriverList != NULL) {
|
||||
FreePool (gHiiDriverList);
|
||||
@@ -590,7 +595,7 @@ UiListThirdPartyDrivers (
|
||||
gHiiDriverList = AllocateZeroPool (UI_HII_DRIVER_LIST_SIZE * sizeof (UI_HII_DRIVER_INSTANCE));
|
||||
ASSERT (gHiiDriverList != NULL);
|
||||
DriverListPtr = gHiiDriverList;
|
||||
CurrentSize = UI_HII_DRIVER_LIST_SIZE;
|
||||
CurrentSize = UI_HII_DRIVER_LIST_SIZE;
|
||||
|
||||
for (Index = 0, Count = 0; HiiHandles[Index] != NULL; Index++) {
|
||||
if (!RequiredDriver (HiiHandles[Index], ClassGuid, &Token, &TokenHelp, &gHiiDriverList[Count].FormSetGuid)) {
|
||||
@@ -608,10 +613,11 @@ UiListThirdPartyDrivers (
|
||||
EmptyLineAfter = FALSE;
|
||||
if (SpecialHandlerFn (String, &NewName, &EmptyLineAfter)) {
|
||||
FreePool (String);
|
||||
String = NewName;
|
||||
String = NewName;
|
||||
DriverListPtr[Count].EmptyLineAfter = EmptyLineAfter;
|
||||
}
|
||||
}
|
||||
|
||||
DriverListPtr[Count].PromptId = HiiSetString (HiiHandle, 0, String, NULL);
|
||||
FreePool (String);
|
||||
|
||||
@@ -620,11 +626,12 @@ UiListThirdPartyDrivers (
|
||||
String = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
|
||||
ASSERT (String != NULL);
|
||||
}
|
||||
|
||||
DriverListPtr[Count].HelpId = HiiSetString (HiiHandle, 0, String, NULL);
|
||||
FreePool (String);
|
||||
|
||||
DevicePathStr = ExtractDevicePathFromHiiHandle(HiiHandles[Index]);
|
||||
if (DevicePathStr != NULL){
|
||||
DevicePathStr = ExtractDevicePathFromHiiHandle (HiiHandles[Index]);
|
||||
if (DevicePathStr != NULL) {
|
||||
DriverListPtr[Count].DevicePathId = HiiSetString (HiiHandle, 0, DevicePathStr, NULL);
|
||||
FreePool (DevicePathStr);
|
||||
} else {
|
||||
@@ -636,12 +643,12 @@ UiListThirdPartyDrivers (
|
||||
DriverListPtr = ReallocatePool (
|
||||
CurrentSize * sizeof (UI_HII_DRIVER_INSTANCE),
|
||||
(Count + UI_HII_DRIVER_LIST_SIZE)
|
||||
* sizeof (UI_HII_DRIVER_INSTANCE),
|
||||
* sizeof (UI_HII_DRIVER_INSTANCE),
|
||||
gHiiDriverList
|
||||
);
|
||||
ASSERT (DriverListPtr != NULL);
|
||||
gHiiDriverList = DriverListPtr;
|
||||
CurrentSize += UI_HII_DRIVER_LIST_SIZE;
|
||||
CurrentSize += UI_HII_DRIVER_LIST_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,17 +662,17 @@ UiListThirdPartyDrivers (
|
||||
gHiiDriverList[Index].PromptId,
|
||||
gHiiDriverList[Index].HelpId,
|
||||
0,
|
||||
(EFI_QUESTION_ID) (Index + FRONT_PAGE_KEY_DRIVER),
|
||||
(EFI_QUESTION_ID)(Index + FRONT_PAGE_KEY_DRIVER),
|
||||
0,
|
||||
&gHiiDriverList[Index].FormSetGuid,
|
||||
gHiiDriverList[Index].DevicePathId
|
||||
);
|
||||
);
|
||||
|
||||
if (gHiiDriverList[Index].EmptyLineAfter) {
|
||||
UiCreateEmptyLine (HiiHandle, StartOpCodeHandle);
|
||||
}
|
||||
|
||||
Index ++;
|
||||
Index++;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -18,8 +18,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
VOID
|
||||
UiCreateContinueMenu (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -31,8 +31,8 @@ UiCreateContinueMenu (
|
||||
**/
|
||||
VOID
|
||||
UiCreateEmptyLine (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -44,8 +44,8 @@ UiCreateEmptyLine (
|
||||
**/
|
||||
VOID
|
||||
UiCreateLanguageMenu (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -57,8 +57,8 @@ UiCreateLanguageMenu (
|
||||
**/
|
||||
VOID
|
||||
UiCreateResetMenu (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN VOID *StartOpCodeHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ BOOLEAN
|
||||
IN CHAR16 *DriverName,
|
||||
OUT CHAR16 **NewName,
|
||||
OUT BOOLEAN *EmptyLineAfter
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
Search the drivers in the system which need to show in the front page
|
||||
@@ -93,10 +93,10 @@ BOOLEAN
|
||||
**/
|
||||
EFI_STATUS
|
||||
UiListThirdPartyDrivers (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_GUID *ClassGuid,
|
||||
IN DRIVER_SPECIAL_HANDLER SpecialHandlerFn,
|
||||
IN VOID *StartOpCodeHandle
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_GUID *ClassGuid,
|
||||
IN DRIVER_SPECIAL_HANDLER SpecialHandlerFn,
|
||||
IN VOID *StartOpCodeHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -118,13 +118,13 @@ UiListThirdPartyDrivers (
|
||||
**/
|
||||
BOOLEAN
|
||||
UiSupportLibCallbackHandler (
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest,
|
||||
OUT EFI_STATUS *Status
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest,
|
||||
OUT EFI_STATUS *Status
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -9,36 +9,36 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include "Ui.h"
|
||||
#include "FrontPage.h"
|
||||
|
||||
EFI_HII_HANDLE gStringPackHandle;
|
||||
EFI_HII_HANDLE gStringPackHandle;
|
||||
|
||||
EFI_GUID mUiStringPackGuid = {
|
||||
EFI_GUID mUiStringPackGuid = {
|
||||
0x136a3048, 0x752a, 0x4bf6, { 0xa7, 0x57, 0x9, 0x36, 0x11, 0x95, 0x38, 0xed }
|
||||
};
|
||||
|
||||
EFI_GUID mFontPackageGuid = {
|
||||
0x78941450, 0x90ab, 0x4fb1, {0xb7, 0x5f, 0x58, 0x92, 0x14, 0xe2, 0x4a, 0xc}
|
||||
0x78941450, 0x90ab, 0x4fb1, { 0xb7, 0x5f, 0x58, 0x92, 0x14, 0xe2, 0x4a, 0xc }
|
||||
};
|
||||
|
||||
#define NARROW_GLYPH_NUMBER 8
|
||||
#define WIDE_GLYPH_NUMBER 75
|
||||
#define NARROW_GLYPH_NUMBER 8
|
||||
#define WIDE_GLYPH_NUMBER 75
|
||||
|
||||
typedef struct {
|
||||
///
|
||||
/// This 4-bytes total array length is required by HiiAddPackages()
|
||||
///
|
||||
UINT32 Length;
|
||||
UINT32 Length;
|
||||
|
||||
//
|
||||
// This is the Font package definition
|
||||
//
|
||||
EFI_HII_PACKAGE_HEADER Header;
|
||||
UINT16 NumberOfNarrowGlyphs;
|
||||
UINT16 NumberOfWideGlyphs;
|
||||
EFI_NARROW_GLYPH NarrowArray[NARROW_GLYPH_NUMBER];
|
||||
EFI_WIDE_GLYPH WideArray[WIDE_GLYPH_NUMBER];
|
||||
EFI_HII_PACKAGE_HEADER Header;
|
||||
UINT16 NumberOfNarrowGlyphs;
|
||||
UINT16 NumberOfWideGlyphs;
|
||||
EFI_NARROW_GLYPH NarrowArray[NARROW_GLYPH_NUMBER];
|
||||
EFI_WIDE_GLYPH WideArray[WIDE_GLYPH_NUMBER];
|
||||
} FONT_PACK_BIN;
|
||||
|
||||
FONT_PACK_BIN mFontBin = {
|
||||
FONT_PACK_BIN mFontBin = {
|
||||
sizeof (FONT_PACK_BIN),
|
||||
{
|
||||
sizeof (FONT_PACK_BIN) - sizeof (UINT32),
|
||||
@@ -260,11 +260,11 @@ InitializeStringSupport (
|
||||
)
|
||||
{
|
||||
gStringPackHandle = HiiAddPackages (
|
||||
&mUiStringPackGuid,
|
||||
gImageHandle,
|
||||
UiAppStrings,
|
||||
NULL
|
||||
);
|
||||
&mUiStringPackGuid,
|
||||
gImageHandle,
|
||||
UiAppStrings,
|
||||
NULL
|
||||
);
|
||||
ASSERT (gStringPackHandle != NULL);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ UninitializeStringSupport (
|
||||
**/
|
||||
CHAR16 *
|
||||
GetStringById (
|
||||
IN EFI_STRING_ID Id
|
||||
IN EFI_STRING_ID Id
|
||||
)
|
||||
{
|
||||
return HiiGetString (gStringPackHandle, Id, NULL);
|
||||
|
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef _STRING_H_
|
||||
#define _STRING_H_
|
||||
|
||||
extern EFI_HII_HANDLE gStringPackHandle;
|
||||
extern EFI_HII_HANDLE gStringPackHandle;
|
||||
|
||||
//
|
||||
// This is the VFR compiler generated header file which defines the
|
||||
@@ -38,7 +38,7 @@ extern UINT8 BdsDxeStrings[];
|
||||
**/
|
||||
CHAR16 *
|
||||
GetStringById (
|
||||
IN EFI_STRING_ID Id
|
||||
IN EFI_STRING_ID Id
|
||||
);
|
||||
|
||||
/**
|
||||
|
@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _BDS_MODULE_H_
|
||||
#define _BDS_MODULE_H_
|
||||
|
||||
@@ -37,18 +36,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
/// HII specific Vendor Device Path definition.
|
||||
///
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} HII_VENDOR_DEVICE_PATH;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
//
|
||||
//The interface functions related to the Setup Browser Reset Reminder feature
|
||||
// The interface functions related to the Setup Browser Reset Reminder feature
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
Record the info that a reset is required.
|
||||
A module boolean variable is used to record whether a reset is required.
|
||||
@@ -60,8 +57,6 @@ EnableResetRequired (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Check whether platform policy enables the reset reminder feature. The default is enabled.
|
||||
|
||||
|
@@ -41,23 +41,25 @@ EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 = NULL;
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetVariableStatisticsData (
|
||||
IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader,
|
||||
IN OUT UINTN *SmmCommunicateSize
|
||||
IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader,
|
||||
IN OUT UINTN *SmmCommunicateSize
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader;
|
||||
EFI_STATUS Status;
|
||||
SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader;
|
||||
|
||||
CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGuid);
|
||||
SmmCommunicateHeader->MessageLength = *SmmCommunicateSize - OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);
|
||||
|
||||
SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) &SmmCommunicateHeader->Data[0];
|
||||
SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *)&SmmCommunicateHeader->Data[0];
|
||||
SmmVariableFunctionHeader->Function = SMM_VARIABLE_FUNCTION_GET_STATISTICS;
|
||||
|
||||
Status = mMmCommunication2->Communicate (mMmCommunication2,
|
||||
SmmCommunicateHeader,
|
||||
SmmCommunicateHeader,
|
||||
SmmCommunicateSize);
|
||||
Status = mMmCommunication2->Communicate (
|
||||
mMmCommunication2,
|
||||
SmmCommunicateHeader,
|
||||
SmmCommunicateHeader,
|
||||
SmmCommunicateSize
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = SmmVariableFunctionHeader->ReturnStatus;
|
||||
@@ -77,62 +79,65 @@ PrintInfoFromSmm (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
EFI_MM_COMMUNICATE_HEADER *CommBuffer;
|
||||
UINTN RealCommSize;
|
||||
UINTN CommSize;
|
||||
SMM_VARIABLE_COMMUNICATE_HEADER *FunctionHeader;
|
||||
EFI_SMM_VARIABLE_PROTOCOL *Smmvariable;
|
||||
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
|
||||
UINT32 Index;
|
||||
EFI_MEMORY_DESCRIPTOR *Entry;
|
||||
UINTN Size;
|
||||
UINTN MaxSize;
|
||||
EFI_STATUS Status;
|
||||
VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
EFI_MM_COMMUNICATE_HEADER *CommBuffer;
|
||||
UINTN RealCommSize;
|
||||
UINTN CommSize;
|
||||
SMM_VARIABLE_COMMUNICATE_HEADER *FunctionHeader;
|
||||
EFI_SMM_VARIABLE_PROTOCOL *Smmvariable;
|
||||
EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;
|
||||
UINT32 Index;
|
||||
EFI_MEMORY_DESCRIPTOR *Entry;
|
||||
UINTN Size;
|
||||
UINTN MaxSize;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **) &Smmvariable);
|
||||
Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&Smmvariable);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL, (VOID **) &mMmCommunication2);
|
||||
Status = gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL, (VOID **)&mMmCommunication2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
CommBuffer = NULL;
|
||||
CommBuffer = NULL;
|
||||
RealCommSize = 0;
|
||||
Status = EfiGetSystemConfigurationTable (
|
||||
&gEdkiiPiSmmCommunicationRegionTableGuid,
|
||||
(VOID **) &PiSmmCommunicationRegionTable
|
||||
);
|
||||
Status = EfiGetSystemConfigurationTable (
|
||||
&gEdkiiPiSmmCommunicationRegionTableGuid,
|
||||
(VOID **)&PiSmmCommunicationRegionTable
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
ASSERT (PiSmmCommunicationRegionTable != NULL);
|
||||
Entry = (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable + 1);
|
||||
Size = 0;
|
||||
Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1);
|
||||
Size = 0;
|
||||
MaxSize = 0;
|
||||
for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) {
|
||||
if (Entry->Type == EfiConventionalMemory) {
|
||||
Size = EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages);
|
||||
Size = EFI_PAGES_TO_SIZE ((UINTN)Entry->NumberOfPages);
|
||||
if (Size > (SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE + sizeof (VARIABLE_INFO_ENTRY))) {
|
||||
if (Size > MaxSize) {
|
||||
MaxSize = Size;
|
||||
MaxSize = Size;
|
||||
RealCommSize = MaxSize;
|
||||
CommBuffer = (EFI_MM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart;
|
||||
CommBuffer = (EFI_MM_COMMUNICATE_HEADER *)(UINTN)Entry->PhysicalStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
Entry = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + PiSmmCommunicationRegionTable->DescriptorSize);
|
||||
|
||||
Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize);
|
||||
}
|
||||
|
||||
ASSERT (CommBuffer != NULL);
|
||||
ZeroMem (CommBuffer, RealCommSize);
|
||||
|
||||
Print (L"SMM Driver Non-Volatile Variables:\n");
|
||||
do {
|
||||
CommSize = RealCommSize;
|
||||
Status = GetVariableStatisticsData (CommBuffer, &CommSize);
|
||||
Status = GetVariableStatisticsData (CommBuffer, &CommSize);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
Print (L"The generic SMM communication buffer provided by SmmCommunicationRegionTable is too small\n");
|
||||
return Status;
|
||||
@@ -142,19 +147,19 @@ PrintInfoFromSmm (
|
||||
break;
|
||||
}
|
||||
|
||||
FunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) CommBuffer->Data;
|
||||
VariableInfo = (VARIABLE_INFO_ENTRY *) FunctionHeader->Data;
|
||||
FunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *)CommBuffer->Data;
|
||||
VariableInfo = (VARIABLE_INFO_ENTRY *)FunctionHeader->Data;
|
||||
|
||||
if (!VariableInfo->Volatile) {
|
||||
Print (
|
||||
L"%g R%03d(%03d) W%03d D%03d:%s\n",
|
||||
&VariableInfo->VendorGuid,
|
||||
VariableInfo->ReadCount,
|
||||
VariableInfo->CacheCount,
|
||||
VariableInfo->WriteCount,
|
||||
VariableInfo->DeleteCount,
|
||||
(CHAR16 *)(VariableInfo + 1)
|
||||
);
|
||||
L"%g R%03d(%03d) W%03d D%03d:%s\n",
|
||||
&VariableInfo->VendorGuid,
|
||||
VariableInfo->ReadCount,
|
||||
VariableInfo->CacheCount,
|
||||
VariableInfo->WriteCount,
|
||||
VariableInfo->DeleteCount,
|
||||
(CHAR16 *)(VariableInfo + 1)
|
||||
);
|
||||
}
|
||||
} while (TRUE);
|
||||
|
||||
@@ -162,7 +167,7 @@ PrintInfoFromSmm (
|
||||
ZeroMem (CommBuffer, RealCommSize);
|
||||
do {
|
||||
CommSize = RealCommSize;
|
||||
Status = GetVariableStatisticsData (CommBuffer, &CommSize);
|
||||
Status = GetVariableStatisticsData (CommBuffer, &CommSize);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
Print (L"The generic SMM communication buffer provided by SmmCommunicationRegionTable is too small\n");
|
||||
return Status;
|
||||
@@ -172,19 +177,19 @@ PrintInfoFromSmm (
|
||||
break;
|
||||
}
|
||||
|
||||
FunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) CommBuffer->Data;
|
||||
VariableInfo = (VARIABLE_INFO_ENTRY *) FunctionHeader->Data;
|
||||
FunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *)CommBuffer->Data;
|
||||
VariableInfo = (VARIABLE_INFO_ENTRY *)FunctionHeader->Data;
|
||||
|
||||
if (VariableInfo->Volatile) {
|
||||
Print (
|
||||
L"%g R%03d(%03d) W%03d D%03d:%s\n",
|
||||
&VariableInfo->VendorGuid,
|
||||
VariableInfo->ReadCount,
|
||||
VariableInfo->CacheCount,
|
||||
VariableInfo->WriteCount,
|
||||
VariableInfo->DeleteCount,
|
||||
(CHAR16 *)(VariableInfo + 1)
|
||||
);
|
||||
L"%g R%03d(%03d) W%03d D%03d:%s\n",
|
||||
&VariableInfo->VendorGuid,
|
||||
VariableInfo->ReadCount,
|
||||
VariableInfo->CacheCount,
|
||||
VariableInfo->WriteCount,
|
||||
VariableInfo->DeleteCount,
|
||||
(CHAR16 *)(VariableInfo + 1)
|
||||
);
|
||||
}
|
||||
} while (TRUE);
|
||||
|
||||
@@ -210,14 +215,14 @@ UefiMain (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS RuntimeDxeStatus;
|
||||
EFI_STATUS SmmStatus;
|
||||
VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
VARIABLE_INFO_ENTRY *Entry;
|
||||
EFI_STATUS RuntimeDxeStatus;
|
||||
EFI_STATUS SmmStatus;
|
||||
VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
VARIABLE_INFO_ENTRY *Entry;
|
||||
|
||||
RuntimeDxeStatus = EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID **) &Entry);
|
||||
RuntimeDxeStatus = EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID **)&Entry);
|
||||
if (EFI_ERROR (RuntimeDxeStatus) || (Entry == NULL)) {
|
||||
RuntimeDxeStatus = EfiGetSystemConfigurationTable (&gEfiAuthenticatedVariableGuid, (VOID **) &Entry);
|
||||
RuntimeDxeStatus = EfiGetSystemConfigurationTable (&gEfiAuthenticatedVariableGuid, (VOID **)&Entry);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (RuntimeDxeStatus) && (Entry != NULL)) {
|
||||
@@ -253,6 +258,7 @@ UefiMain (
|
||||
VariableInfo->Name
|
||||
);
|
||||
}
|
||||
|
||||
VariableInfo = VariableInfo->Next;
|
||||
} while (VariableInfo != NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user