TianoCore EDK2 master
Loading...
Searching...
No Matches
Platform.c File Reference

Go to the source code of this file.

Data Structures

struct  PKG_DEVICE_PATH
 
struct  GOP_MODE
 

Functions

STATIC EFI_STATUS EFIAPI PlatformConfigToFormState (OUT MAIN_FORM_STATE *MainFormState)
 
STATIC EFI_STATUS EFIAPI ExtractConfig (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
 
STATIC EFI_STATUS EFIAPI FormStateToPlatformConfig (IN CONST MAIN_FORM_STATE *MainFormState)
 
STATIC EFI_STATUS EFIAPI RouteConfig (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
 
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)
 
STATIC EFI_STATUS EFIAPI QueryGopModes (IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop, OUT UINTN *NumGopModes, OUT GOP_MODE **GopModes)
 
STATIC EFI_STATUS EFIAPI CreateResolutionOptions (IN EFI_HII_HANDLE PackageList, OUT VOID **OpCodeBuffer, IN UINTN NumGopModes, IN GOP_MODE *GopModes)
 
STATIC EFI_STATUS EFIAPI PopulateForm (IN EFI_HII_HANDLE PackageList, IN EFI_GUID *FormSetGuid, IN EFI_FORM_ID FormId, IN UINTN NumGopModes, IN GOP_MODE *GopModes)
 
STATIC EFI_STATUS EFIAPI ExecutePlatformConfig (VOID)
 
STATIC VOID EFIAPI GopInstalled (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI PlatformInit (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI PlatformUnload (IN EFI_HANDLE ImageHandle)
 

Variables

STATIC PKG_DEVICE_PATH mPkgDevicePath
 
STATIC EFI_HII_CONFIG_ACCESS_PROTOCOL mConfigAccess
 
STATIC EFI_HII_HANDLE mInstalledPackages
 
UINT8 PlatformDxeStrings []
 
UINT8 PlatformFormsBin []
 
STATIC EFI_EVENT mGopEvent
 
STATIC VOID * mGopTracker
 
STATIC EFI_HANDLE mImageHandle
 
STATIC UINTN mNumGopModes
 
STATIC GOP_MODEmGopModes
 

Detailed Description

This driver effectuates OVMF's platform configuration settings and exposes them via HII.

Copyright (C) 2014, Red Hat, Inc. Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Platform.c.

Function Documentation

◆ Callback()

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 
)

Definition at line 505 of file Platform.c.

◆ CreateResolutionOptions()

STATIC EFI_STATUS EFIAPI CreateResolutionOptions ( IN EFI_HII_HANDLE  PackageList,
OUT VOID **  OpCodeBuffer,
IN UINTN  NumGopModes,
IN GOP_MODE GopModes 
)

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. "drop down list") opcode.

Parameters
[in]PackageListThe package list with the formset and form for which the drop down options are produced. Option names are added as new strings to PackageList.
[out]OpCodeBufferOn output, a dynamically allocated opcode buffer with drop down list options corresponding to GOP resolutions. The caller is responsible for freeing OpCodeBuffer with HiiFreeOpCodeHandle() after use.
[in]NumGopModesNumber of entries in GopModes.
[in]GopModesArray of resolutions retrieved from the GOP.
Return values
EFI_SUCESSOpcodes have been successfully produced.
Returns
Status codes from underlying functions. PackageList may have been extended with new strings. OpCodeBuffer is unchanged.

Definition at line 632 of file Platform.c.

◆ ExecutePlatformConfig()

STATIC EFI_STATUS EFIAPI ExecutePlatformConfig ( VOID  )

Load and execute the platform configuration.

Return values
EFI_SUCCESSConfiguration loaded and executed.
Returns
Status codes from PlatformConfigLoad().

Definition at line 824 of file Platform.c.

◆ ExtractConfig()

STATIC EFI_STATUS EFIAPI ExtractConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL This,
IN CONST EFI_STRING  Request,
OUT EFI_STRING *  Progress,
OUT EFI_STRING *  Results 
)

This function is called by the HII machinery when it fetches the form state.

See the precise documentation in the UEFI spec.

Parameters
[in]ThisThe Config Access Protocol instance.
[in]RequestA <ConfigRequest> format UCS-2 string describing the query.
[out]ProgressA pointer into Request on output, identifying the query element where processing failed.
[out]ResultsA <MultiConfigAltResp> format UCS-2 string that has all values filled in for the names in the Request string.
Return values
EFI_SUCCESSExtraction of form state in <MultiConfigAltResp> encoding successful.
Returns
Status codes from underlying functions.

Definition at line 228 of file Platform.c.

◆ FormStateToPlatformConfig()

STATIC EFI_STATUS EFIAPI FormStateToPlatformConfig ( IN CONST MAIN_FORM_STATE MainFormState)

Interpret the binary form state and save it as persistent platform configuration.

Parameters
[in]MainFormStateBinary form/widget state to verify and save.
Return values
EFI_SUCCESSPlatform configuration saved.
Returns
Error codes from underlying functions.

Definition at line 374 of file Platform.c.

◆ GopInstalled()

STATIC VOID EFIAPI GopInstalled ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Notification callback for GOP interface installation.

Parameters
[in]EventEvent whose notification function is being invoked.
[in]ContextThe pointer to the notification function's context, which is implementation-dependent.

Definition at line 878 of file Platform.c.

◆ PlatformConfigToFormState()

STATIC EFI_STATUS EFIAPI PlatformConfigToFormState ( OUT MAIN_FORM_STATE MainFormState)

Load the persistent platform configuration and translate it to binary form state.

If the platform configuration is missing, then the function fills in a default state.

Parameters
[out]MainFormStateBinary form/widget state after translation.
Return values
EFI_SUCCESSForm/widget state ready.
Returns
Error codes from underlying functions.

Definition at line 142 of file Platform.c.

◆ PlatformInit()

EFI_STATUS EFIAPI PlatformInit ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Entry point for this driver.

Parameters
[in]ImageHandleImage handle of this driver.
[in]SystemTablePointer to SystemTable.
Return values
EFI_SUCESSDriver has loaded successfully.
EFI_OUT_OF_RESOURCESFailed to install HII packages.
Returns
Error codes from lower level functions.

Definition at line 947 of file Platform.c.

◆ PlatformUnload()

EFI_STATUS EFIAPI PlatformUnload ( IN EFI_HANDLE  ImageHandle)

Unload the driver.

Parameters
[in]ImageHandleHandle that identifies the image to evict.
Return values
EFI_SUCCESSThe image has been unloaded.

Definition at line 1050 of file Platform.c.

◆ PopulateForm()

STATIC EFI_STATUS EFIAPI PopulateForm ( IN EFI_HII_HANDLE  PackageList,
IN EFI_GUID FormSetGuid,
IN EFI_FORM_ID  FormId,
IN UINTN  NumGopModes,
IN GOP_MODE GopModes 
)

Populate the form identified by the (PackageList, FormSetGuid, FormId) triplet.

The drop down list of video resolutions is generated from (NumGopModes, GopModes).

Return values
EFI_SUCESSForm successfully updated.
Returns
Status codes from underlying functions.

Definition at line 707 of file Platform.c.

◆ QueryGopModes()

STATIC EFI_STATUS EFIAPI QueryGopModes ( IN EFI_GRAPHICS_OUTPUT_PROTOCOL Gop,
OUT UINTN NumGopModes,
OUT GOP_MODE **  GopModes 
)

Query and save all resolutions supported by the GOP.

Parameters
[in]GopThe Graphics Output Protocol instance to query.
[out]NumGopModesThe number of modes supported by the GOP. On output, this parameter will be positive.
[out]GopModesOn output, a dynamically allocated array containing the resolutions returned by the GOP. The caller is responsible for freeing the array after use.
Return values
EFI_UNSUPPORTEDNo modes found.
EFI_OUT_OF_RESOURCESFailed to allocate GopModes.
Returns
Error codes from Gop->QueryMode().

Definition at line 563 of file Platform.c.

◆ RouteConfig()

STATIC EFI_STATUS EFIAPI RouteConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL This,
IN CONST EFI_STRING  Configuration,
OUT EFI_STRING *  Progress 
)

This function is called by the HII machinery when it wants the driver to interpret and persist the form state.

See the precise documentation in the UEFI spec.

Parameters
[in]ThisThe Config Access Protocol instance.
[in]ConfigurationA <ConfigResp> format UCS-2 string describing the form state.
[out]ProgressA pointer into Configuration on output, identifying the element where processing failed.
Return values
EFI_SUCCESSConfiguration verified, state permanent.
Returns
Status codes from underlying functions.

Definition at line 421 of file Platform.c.

Variable Documentation

◆ mConfigAccess

Definition at line 78 of file Platform.c.

◆ mGopEvent

STATIC EFI_EVENT mGopEvent

Definition at line 103 of file Platform.c.

◆ mGopModes

STATIC GOP_MODE* mGopModes

Definition at line 125 of file Platform.c.

◆ mGopTracker

STATIC VOID* mGopTracker

Definition at line 109 of file Platform.c.

◆ mImageHandle

STATIC EFI_HANDLE mImageHandle

Definition at line 114 of file Platform.c.

◆ mInstalledPackages

STATIC EFI_HII_HANDLE mInstalledPackages

Definition at line 83 of file Platform.c.

◆ mNumGopModes

STATIC UINTN mNumGopModes

Definition at line 124 of file Platform.c.

◆ mPkgDevicePath

STATIC PKG_DEVICE_PATH mPkgDevicePath
Initial value:
= {
{
{
{
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
(UINT8)(sizeof (VENDOR_DEVICE_PATH) >> 8)
}
},
EFI_CALLER_ID_GUID
},
{
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
(UINT8)(END_DEVICE_PATH_LENGTH),
(UINT8)(END_DEVICE_PATH_LENGTH >> 8)
}
}
}
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133

Definition at line 52 of file Platform.c.