OvmfPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the OvmfPkg 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: Andrew Fish <afish@apple.com>
This commit is contained in:
committed by
mergify[bot]
parent
d1050b9dff
commit
ac0a286f4d
@@ -44,19 +44,19 @@
|
||||
//
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} PKG_DEVICE_PATH;
|
||||
#pragma pack()
|
||||
|
||||
STATIC PKG_DEVICE_PATH mPkgDevicePath = {
|
||||
STATIC PKG_DEVICE_PATH mPkgDevicePath = {
|
||||
{
|
||||
{
|
||||
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)
|
||||
}
|
||||
},
|
||||
EFI_CALLER_ID_GUID
|
||||
@@ -65,8 +65,8 @@ STATIC PKG_DEVICE_PATH mPkgDevicePath = {
|
||||
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)
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -75,12 +75,12 @@ STATIC PKG_DEVICE_PATH mPkgDevicePath = {
|
||||
// The configuration interface between the HII engine (form display etc) and
|
||||
// this driver.
|
||||
//
|
||||
STATIC EFI_HII_CONFIG_ACCESS_PROTOCOL mConfigAccess;
|
||||
STATIC EFI_HII_CONFIG_ACCESS_PROTOCOL mConfigAccess;
|
||||
|
||||
//
|
||||
// The handle representing our list of packages after installation.
|
||||
//
|
||||
STATIC EFI_HII_HANDLE mInstalledPackages;
|
||||
STATIC EFI_HII_HANDLE mInstalledPackages;
|
||||
|
||||
//
|
||||
// The arrays below constitute our HII package list. They are auto-generated by
|
||||
@@ -93,32 +93,31 @@ STATIC EFI_HII_HANDLE mInstalledPackages;
|
||||
// plus "Bin".
|
||||
//
|
||||
//
|
||||
extern UINT8 PlatformDxeStrings[];
|
||||
extern UINT8 PlatformFormsBin[];
|
||||
extern UINT8 PlatformDxeStrings[];
|
||||
extern UINT8 PlatformFormsBin[];
|
||||
|
||||
//
|
||||
// We want to be notified about GOP installations until we find one GOP
|
||||
// interface that lets us populate the form.
|
||||
//
|
||||
STATIC EFI_EVENT mGopEvent;
|
||||
STATIC EFI_EVENT mGopEvent;
|
||||
|
||||
//
|
||||
// The registration record underneath this pointer allows us to iterate through
|
||||
// the GOP instances one by one.
|
||||
//
|
||||
STATIC VOID *mGopTracker;
|
||||
STATIC VOID *mGopTracker;
|
||||
|
||||
//
|
||||
// Cache the resolutions we get from the GOP.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 X;
|
||||
UINT32 Y;
|
||||
UINT32 X;
|
||||
UINT32 Y;
|
||||
} GOP_MODE;
|
||||
|
||||
STATIC UINTN mNumGopModes;
|
||||
STATIC GOP_MODE *mGopModes;
|
||||
|
||||
STATIC UINTN mNumGopModes;
|
||||
STATIC GOP_MODE *mGopModes;
|
||||
|
||||
/**
|
||||
Load the persistent platform configuration and translate it to binary form
|
||||
@@ -136,63 +135,66 @@ STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatformConfigToFormState (
|
||||
OUT MAIN_FORM_STATE *MainFormState
|
||||
OUT MAIN_FORM_STATE *MainFormState
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PLATFORM_CONFIG PlatformConfig;
|
||||
UINT64 OptionalElements;
|
||||
UINTN ModeNumber;
|
||||
EFI_STATUS Status;
|
||||
PLATFORM_CONFIG PlatformConfig;
|
||||
UINT64 OptionalElements;
|
||||
UINTN ModeNumber;
|
||||
|
||||
ZeroMem (MainFormState, sizeof *MainFormState);
|
||||
|
||||
Status = PlatformConfigLoad (&PlatformConfig, &OptionalElements);
|
||||
switch (Status) {
|
||||
case EFI_SUCCESS:
|
||||
if (OptionalElements & PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION) {
|
||||
//
|
||||
// Format the preferred resolution as text.
|
||||
//
|
||||
UnicodeSPrintAsciiFormat (
|
||||
(CHAR16 *) MainFormState->CurrentPreferredResolution,
|
||||
sizeof MainFormState->CurrentPreferredResolution,
|
||||
"%Ldx%Ld",
|
||||
(INT64) PlatformConfig.HorizontalResolution,
|
||||
(INT64) PlatformConfig.VerticalResolution);
|
||||
case EFI_SUCCESS:
|
||||
if (OptionalElements & PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION) {
|
||||
//
|
||||
// Format the preferred resolution as text.
|
||||
//
|
||||
UnicodeSPrintAsciiFormat (
|
||||
(CHAR16 *)MainFormState->CurrentPreferredResolution,
|
||||
sizeof MainFormState->CurrentPreferredResolution,
|
||||
"%Ldx%Ld",
|
||||
(INT64)PlatformConfig.HorizontalResolution,
|
||||
(INT64)PlatformConfig.VerticalResolution
|
||||
);
|
||||
|
||||
//
|
||||
// Try to locate it in the drop-down list too. This may not succeed, but
|
||||
// that's fine.
|
||||
//
|
||||
for (ModeNumber = 0; ModeNumber < mNumGopModes; ++ModeNumber) {
|
||||
if (mGopModes[ModeNumber].X == PlatformConfig.HorizontalResolution &&
|
||||
mGopModes[ModeNumber].Y == PlatformConfig.VerticalResolution) {
|
||||
MainFormState->NextPreferredResolution = (UINT32) ModeNumber;
|
||||
break;
|
||||
//
|
||||
// Try to locate it in the drop-down list too. This may not succeed, but
|
||||
// that's fine.
|
||||
//
|
||||
for (ModeNumber = 0; ModeNumber < mNumGopModes; ++ModeNumber) {
|
||||
if ((mGopModes[ModeNumber].X == PlatformConfig.HorizontalResolution) &&
|
||||
(mGopModes[ModeNumber].Y == PlatformConfig.VerticalResolution))
|
||||
{
|
||||
MainFormState->NextPreferredResolution = (UINT32)ModeNumber;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
//
|
||||
// fall through otherwise
|
||||
//
|
||||
|
||||
case EFI_NOT_FOUND:
|
||||
UnicodeSPrintAsciiFormat (
|
||||
(CHAR16 *) MainFormState->CurrentPreferredResolution,
|
||||
sizeof MainFormState->CurrentPreferredResolution,
|
||||
"Unset");
|
||||
break;
|
||||
case EFI_NOT_FOUND:
|
||||
UnicodeSPrintAsciiFormat (
|
||||
(CHAR16 *)MainFormState->CurrentPreferredResolution,
|
||||
sizeof MainFormState->CurrentPreferredResolution,
|
||||
"Unset"
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
return Status;
|
||||
default:
|
||||
return Status;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is called by the HII machinery when it fetches the form state.
|
||||
|
||||
@@ -223,10 +225,10 @@ ExtractConfig (
|
||||
IN CONST EFI_STRING Request,
|
||||
OUT EFI_STRING *Progress,
|
||||
OUT EFI_STRING *Results
|
||||
)
|
||||
)
|
||||
{
|
||||
MAIN_FORM_STATE MainFormState;
|
||||
EFI_STATUS Status;
|
||||
MAIN_FORM_STATE MainFormState;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: Request=\"%s\"\n", __FUNCTION__, Request));
|
||||
|
||||
@@ -239,19 +241,29 @@ ExtractConfig (
|
||||
//
|
||||
// Answer the textual request keying off the binary form state.
|
||||
//
|
||||
Status = gHiiConfigRouting->BlockToConfig (gHiiConfigRouting, Request,
|
||||
(VOID *) &MainFormState, sizeof MainFormState,
|
||||
Results, Progress);
|
||||
Status = gHiiConfigRouting->BlockToConfig (
|
||||
gHiiConfigRouting,
|
||||
Request,
|
||||
(VOID *)&MainFormState,
|
||||
sizeof MainFormState,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: BlockToConfig(): %r, Progress=\"%s\"\n",
|
||||
__FUNCTION__, Status, (Status == EFI_DEVICE_ERROR) ? NULL : *Progress));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: BlockToConfig(): %r, Progress=\"%s\"\n",
|
||||
__FUNCTION__,
|
||||
Status,
|
||||
(Status == EFI_DEVICE_ERROR) ? NULL : *Progress
|
||||
));
|
||||
} else {
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: Results=\"%s\"\n", __FUNCTION__, *Results));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Interpret the binary form state and save it as persistent platform
|
||||
configuration.
|
||||
@@ -265,12 +277,12 @@ STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FormStateToPlatformConfig (
|
||||
IN CONST MAIN_FORM_STATE *MainFormState
|
||||
IN CONST MAIN_FORM_STATE *MainFormState
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PLATFORM_CONFIG PlatformConfig;
|
||||
CONST GOP_MODE *GopMode;
|
||||
EFI_STATUS Status;
|
||||
PLATFORM_CONFIG PlatformConfig;
|
||||
CONST GOP_MODE *GopMode;
|
||||
|
||||
//
|
||||
// There's nothing to do with the textual CurrentPreferredResolution field.
|
||||
@@ -279,6 +291,7 @@ FormStateToPlatformConfig (
|
||||
if (MainFormState->NextPreferredResolution >= mNumGopModes) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
GopMode = mGopModes + MainFormState->NextPreferredResolution;
|
||||
|
||||
ZeroMem (&PlatformConfig, sizeof PlatformConfig);
|
||||
@@ -289,7 +302,6 @@ FormStateToPlatformConfig (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function is called by the HII machinery when it wants the driver to
|
||||
interpret and persist the form state.
|
||||
@@ -315,14 +327,18 @@ RouteConfig (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN CONST EFI_STRING Configuration,
|
||||
OUT EFI_STRING *Progress
|
||||
)
|
||||
)
|
||||
{
|
||||
MAIN_FORM_STATE MainFormState;
|
||||
UINTN BlockSize;
|
||||
EFI_STATUS Status;
|
||||
MAIN_FORM_STATE MainFormState;
|
||||
UINTN BlockSize;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: Configuration=\"%s\"\n", __FUNCTION__,
|
||||
Configuration));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: Configuration=\"%s\"\n",
|
||||
__FUNCTION__,
|
||||
Configuration
|
||||
));
|
||||
|
||||
//
|
||||
// the "read" step in RMW
|
||||
@@ -340,12 +356,21 @@ RouteConfig (
|
||||
// general we must pre-load the form state from the platform config.)
|
||||
//
|
||||
BlockSize = sizeof MainFormState;
|
||||
Status = gHiiConfigRouting->ConfigToBlock (gHiiConfigRouting, Configuration,
|
||||
(VOID *) &MainFormState, &BlockSize, Progress);
|
||||
Status = gHiiConfigRouting->ConfigToBlock (
|
||||
gHiiConfigRouting,
|
||||
Configuration,
|
||||
(VOID *)&MainFormState,
|
||||
&BlockSize,
|
||||
Progress
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: ConfigToBlock(): %r, Progress=\"%s\"\n",
|
||||
__FUNCTION__, Status,
|
||||
(Status == EFI_BUFFER_TOO_SMALL) ? NULL : *Progress));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a: ConfigToBlock(): %r, Progress=\"%s\"\n",
|
||||
__FUNCTION__,
|
||||
Status,
|
||||
(Status == EFI_BUFFER_TOO_SMALL) ? NULL : *Progress
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -356,46 +381,51 @@ RouteConfig (
|
||||
if (EFI_ERROR (Status)) {
|
||||
*Progress = Configuration;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Callback (
|
||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||
IN EFI_BROWSER_ACTION Action,
|
||||
IN EFI_QUESTION_ID QuestionId,
|
||||
IN UINT8 Type,
|
||||
IN OUT 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 OUT EFI_IFR_TYPE_VALUE *Value,
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: Action=0x%Lx QuestionId=%d Type=%d\n",
|
||||
__FUNCTION__, (UINT64) Action, QuestionId, Type));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: Action=0x%Lx QuestionId=%d Type=%d\n",
|
||||
__FUNCTION__,
|
||||
(UINT64)Action,
|
||||
QuestionId,
|
||||
Type
|
||||
));
|
||||
|
||||
if (Action != EFI_BROWSER_ACTION_CHANGED) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
switch (QuestionId) {
|
||||
case QUESTION_SAVE_EXIT:
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
|
||||
break;
|
||||
case QUESTION_SAVE_EXIT:
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
|
||||
break;
|
||||
|
||||
case QUESTION_DISCARD_EXIT:
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
|
||||
break;
|
||||
case QUESTION_DISCARD_EXIT:
|
||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Query and save all resolutions supported by the GOP.
|
||||
|
||||
@@ -417,17 +447,18 @@ STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
QueryGopModes (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop,
|
||||
OUT UINTN *NumGopModes,
|
||||
OUT GOP_MODE **GopModes
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop,
|
||||
OUT UINTN *NumGopModes,
|
||||
OUT GOP_MODE **GopModes
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 ModeNumber;
|
||||
EFI_STATUS Status;
|
||||
UINT32 ModeNumber;
|
||||
|
||||
if (Gop->Mode->MaxMode == 0) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
*NumGopModes = Gop->Mode->MaxMode;
|
||||
|
||||
*GopModes = AllocatePool (Gop->Mode->MaxMode * sizeof **GopModes);
|
||||
@@ -436,8 +467,8 @@ QueryGopModes (
|
||||
}
|
||||
|
||||
for (ModeNumber = 0; ModeNumber < Gop->Mode->MaxMode; ++ModeNumber) {
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
UINTN SizeOfInfo;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
UINTN SizeOfInfo;
|
||||
|
||||
Status = Gop->QueryMode (Gop, ModeNumber, &SizeOfInfo, &Info);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -457,7 +488,6 @@ FreeGopModes:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a set of "one-of-many" (ie. "drop down list") option IFR opcodes,
|
||||
based on available GOP resolutions, to be placed under a "one-of-many" (ie.
|
||||
@@ -492,9 +522,9 @@ CreateResolutionOptions (
|
||||
IN GOP_MODE *GopModes
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *OutputBuffer;
|
||||
UINTN ModeNumber;
|
||||
EFI_STATUS Status;
|
||||
VOID *OutputBuffer;
|
||||
UINTN ModeNumber;
|
||||
|
||||
OutputBuffer = HiiAllocateOpCodeHandle ();
|
||||
if (OutputBuffer == NULL) {
|
||||
@@ -502,20 +532,35 @@ CreateResolutionOptions (
|
||||
}
|
||||
|
||||
for (ModeNumber = 0; ModeNumber < NumGopModes; ++ModeNumber) {
|
||||
CHAR16 Desc[MAXSIZE_RES_CUR];
|
||||
EFI_STRING_ID NewString;
|
||||
VOID *OpCode;
|
||||
CHAR16 Desc[MAXSIZE_RES_CUR];
|
||||
EFI_STRING_ID NewString;
|
||||
VOID *OpCode;
|
||||
|
||||
UnicodeSPrintAsciiFormat (Desc, sizeof Desc, "%Ldx%Ld",
|
||||
(INT64) GopModes[ModeNumber].X, (INT64) GopModes[ModeNumber].Y);
|
||||
NewString = HiiSetString (PackageList, 0 /* new string */, Desc,
|
||||
NULL /* for all languages */);
|
||||
UnicodeSPrintAsciiFormat (
|
||||
Desc,
|
||||
sizeof Desc,
|
||||
"%Ldx%Ld",
|
||||
(INT64)GopModes[ModeNumber].X,
|
||||
(INT64)GopModes[ModeNumber].Y
|
||||
);
|
||||
NewString = HiiSetString (
|
||||
PackageList,
|
||||
0 /* new string */,
|
||||
Desc,
|
||||
NULL /* for all languages */
|
||||
);
|
||||
if (NewString == 0) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto FreeOutputBuffer;
|
||||
}
|
||||
OpCode = HiiCreateOneOfOptionOpCode (OutputBuffer, NewString,
|
||||
0 /* Flags */, EFI_IFR_NUMERIC_SIZE_4, ModeNumber);
|
||||
|
||||
OpCode = HiiCreateOneOfOptionOpCode (
|
||||
OutputBuffer,
|
||||
NewString,
|
||||
0 /* Flags */,
|
||||
EFI_IFR_NUMERIC_SIZE_4,
|
||||
ModeNumber
|
||||
);
|
||||
if (OpCode == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto FreeOutputBuffer;
|
||||
@@ -531,7 +576,6 @@ FreeOutputBuffer:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Populate the form identified by the (PackageList, FormSetGuid, FormId)
|
||||
triplet.
|
||||
@@ -554,11 +598,11 @@ PopulateForm (
|
||||
IN GOP_MODE *GopModes
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *OpCodeBuffer;
|
||||
VOID *OpCode;
|
||||
EFI_IFR_GUID_LABEL *Anchor;
|
||||
VOID *OpCodeBuffer2;
|
||||
EFI_STATUS Status;
|
||||
VOID *OpCodeBuffer;
|
||||
VOID *OpCode;
|
||||
EFI_IFR_GUID_LABEL *Anchor;
|
||||
VOID *OpCodeBuffer2;
|
||||
|
||||
OpCodeBuffer2 = NULL;
|
||||
|
||||
@@ -574,12 +618,17 @@ PopulateForm (
|
||||
// 2. Create a label opcode (which is a Tiano extension) inside the buffer.
|
||||
// The label's number must match the "anchor" label in the form.
|
||||
//
|
||||
OpCode = HiiCreateGuidOpCode (OpCodeBuffer, &gEfiIfrTianoGuid,
|
||||
NULL /* optional copy origin */, sizeof *Anchor);
|
||||
OpCode = HiiCreateGuidOpCode (
|
||||
OpCodeBuffer,
|
||||
&gEfiIfrTianoGuid,
|
||||
NULL /* optional copy origin */,
|
||||
sizeof *Anchor
|
||||
);
|
||||
if (OpCode == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto FreeOpCodeBuffer;
|
||||
}
|
||||
|
||||
Anchor = OpCode;
|
||||
Anchor->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
|
||||
Anchor->Number = LABEL_RES_NEXT;
|
||||
@@ -590,8 +639,12 @@ PopulateForm (
|
||||
//
|
||||
// 3.1. Get a list of resolutions.
|
||||
//
|
||||
Status = CreateResolutionOptions (PackageList, &OpCodeBuffer2,
|
||||
NumGopModes, GopModes);
|
||||
Status = CreateResolutionOptions (
|
||||
PackageList,
|
||||
&OpCodeBuffer2,
|
||||
NumGopModes,
|
||||
GopModes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreeOpCodeBuffer;
|
||||
}
|
||||
@@ -605,8 +658,10 @@ PopulateForm (
|
||||
QUESTION_RES_NEXT, // ID of question,
|
||||
FORMSTATEID_MAIN_FORM, // identifies form state
|
||||
// storage,
|
||||
(UINT16) OFFSET_OF (MAIN_FORM_STATE, // value of question stored
|
||||
NextPreferredResolution), // at this offset,
|
||||
(UINT16)OFFSET_OF (
|
||||
MAIN_FORM_STATE, // value of question stored
|
||||
NextPreferredResolution
|
||||
), // at this offset,
|
||||
STRING_TOKEN (STR_RES_NEXT), // Prompt,
|
||||
STRING_TOKEN (STR_RES_NEXT_HELP), // Help,
|
||||
0, // QuestionFlags,
|
||||
@@ -624,7 +679,10 @@ PopulateForm (
|
||||
//
|
||||
// 4. Update the form with the opcode buffer.
|
||||
//
|
||||
Status = HiiUpdateForm (PackageList, FormSetGuid, FormId,
|
||||
Status = HiiUpdateForm (
|
||||
PackageList,
|
||||
FormSetGuid,
|
||||
FormId,
|
||||
OpCodeBuffer, // buffer with head anchor, and new contents to be
|
||||
// inserted at it
|
||||
NULL // buffer with tail anchor, for deleting old
|
||||
@@ -640,7 +698,6 @@ FreeOpCodeBuffer:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Load and execute the platform configuration.
|
||||
|
||||
@@ -654,15 +711,19 @@ ExecutePlatformConfig (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PLATFORM_CONFIG PlatformConfig;
|
||||
UINT64 OptionalElements;
|
||||
RETURN_STATUS PcdStatus;
|
||||
EFI_STATUS Status;
|
||||
PLATFORM_CONFIG PlatformConfig;
|
||||
UINT64 OptionalElements;
|
||||
RETURN_STATUS PcdStatus;
|
||||
|
||||
Status = PlatformConfigLoad (&PlatformConfig, &OptionalElements);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (((Status == EFI_NOT_FOUND) ? DEBUG_VERBOSE : DEBUG_ERROR,
|
||||
"%a: failed to load platform config: %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
(Status == EFI_NOT_FOUND) ? DEBUG_VERBOSE : DEBUG_ERROR,
|
||||
"%a: failed to load platform config: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -670,19 +731,22 @@ ExecutePlatformConfig (
|
||||
//
|
||||
// Pass the preferred resolution to GraphicsConsoleDxe via dynamic PCDs.
|
||||
//
|
||||
PcdStatus = PcdSet32S (PcdVideoHorizontalResolution,
|
||||
PlatformConfig.HorizontalResolution);
|
||||
PcdStatus = PcdSet32S (
|
||||
PcdVideoHorizontalResolution,
|
||||
PlatformConfig.HorizontalResolution
|
||||
);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
PcdStatus = PcdSet32S (PcdVideoVerticalResolution,
|
||||
PlatformConfig.VerticalResolution);
|
||||
PcdStatus = PcdSet32S (
|
||||
PcdVideoVerticalResolution,
|
||||
PlatformConfig.VerticalResolution
|
||||
);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Notification callback for GOP interface installation.
|
||||
|
||||
@@ -695,24 +759,27 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
GopInstalled (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
|
||||
EFI_STATUS Status;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
|
||||
|
||||
ASSERT (Event == mGopEvent);
|
||||
|
||||
//
|
||||
// Check further GOPs.
|
||||
//
|
||||
for (;;) {
|
||||
for ( ; ;) {
|
||||
mNumGopModes = 0;
|
||||
mGopModes = NULL;
|
||||
mGopModes = NULL;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, mGopTracker,
|
||||
(VOID **) &Gop);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
mGopTracker,
|
||||
(VOID **)&Gop
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
@@ -722,8 +789,13 @@ GopInstalled (
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = PopulateForm (mInstalledPackages, &gOvmfPlatformConfigGuid,
|
||||
FORMID_MAIN_FORM, mNumGopModes, mGopModes);
|
||||
Status = PopulateForm (
|
||||
mInstalledPackages,
|
||||
&gOvmfPlatformConfigGuid,
|
||||
FORMID_MAIN_FORM,
|
||||
mNumGopModes,
|
||||
mGopModes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (mGopModes);
|
||||
continue;
|
||||
@@ -738,11 +810,10 @@ GopInstalled (
|
||||
//
|
||||
Status = gBS->CloseEvent (mGopEvent);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
mGopEvent = NULL;
|
||||
mGopEvent = NULL;
|
||||
mGopTracker = NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Entry point for this driver.
|
||||
|
||||
@@ -761,7 +832,7 @@ PlatformInit (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ExecutePlatformConfig ();
|
||||
|
||||
@@ -772,10 +843,14 @@ PlatformInit (
|
||||
//
|
||||
// Declare ourselves suitable for HII communication.
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,
|
||||
&gEfiDevicePathProtocolGuid, &mPkgDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid, &mConfigAccess,
|
||||
NULL);
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ImageHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&mPkgDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&mConfigAccess,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -795,14 +870,22 @@ PlatformInit (
|
||||
goto UninstallProtocols;
|
||||
}
|
||||
|
||||
Status = gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, &GopInstalled,
|
||||
NULL /* Context */, &mGopEvent);
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
&GopInstalled,
|
||||
NULL /* Context */,
|
||||
&mGopEvent
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto RemovePackages;
|
||||
}
|
||||
|
||||
Status = gBS->RegisterProtocolNotify (&gEfiGraphicsOutputProtocolGuid,
|
||||
mGopEvent, &mGopTracker);
|
||||
Status = gBS->RegisterProtocolNotify (
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
mGopEvent,
|
||||
&mGopTracker
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto CloseGopEvent;
|
||||
}
|
||||
@@ -822,10 +905,14 @@ RemovePackages:
|
||||
HiiRemovePackages (mInstalledPackages);
|
||||
|
||||
UninstallProtocols:
|
||||
gBS->UninstallMultipleProtocolInterfaces (ImageHandle,
|
||||
&gEfiDevicePathProtocolGuid, &mPkgDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid, &mConfigAccess,
|
||||
NULL);
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
ImageHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&mPkgDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&mConfigAccess,
|
||||
NULL
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -861,9 +948,13 @@ PlatformUnload (
|
||||
// Release resources allocated by the entry point.
|
||||
//
|
||||
HiiRemovePackages (mInstalledPackages);
|
||||
gBS->UninstallMultipleProtocolInterfaces (ImageHandle,
|
||||
&gEfiDevicePathProtocolGuid, &mPkgDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid, &mConfigAccess,
|
||||
NULL);
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
ImageHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&mPkgDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&mConfigAccess,
|
||||
NULL
|
||||
);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user