TianoCore EDK2 master
Loading...
Searching...
No Matches
OpalHii.c File Reference
#include "OpalHii.h"

Go to the source code of this file.

Macros

#define UPPER_LOWER_CASE_OFFSET   0x20
 

Functions

VOID GetSavedOpalRequest (IN OPAL_DISK *OpalDisk, OUT OPAL_REQUEST *OpalRequest)
 
VOID SaveOpalRequest (IN OPAL_DISK *OpalDisk, IN OPAL_REQUEST OpalRequest)
 
VOID HiiSetCurrentConfiguration (VOID)
 
EFI_STATUS HiiInstall (VOID)
 
EFI_STATUS OpalHiiAddPackages (VOID)
 
EFI_STATUS HiiUninstall (VOID)
 
EFI_STATUS HiiPopulateMainMenuForm (VOID)
 
EFI_STRING_ID GetDiskNameStringId (UINT8 DiskIndex)
 
EFI_STATUS HiiConfirmDataRemovalAction (IN OPAL_DISK *OpalDisk, IN CHAR16 *ActionString)
 
EFI_STATUS EFIAPI DriverCallback (CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, EFI_BROWSER_ACTION Action, EFI_QUESTION_ID QuestionId, UINT8 Type, EFI_IFR_TYPE_VALUE *Value, EFI_BROWSER_ACTION_REQUEST *ActionRequest)
 
EFI_STATUS HiiSelectDisk (UINT8 Index)
 
EFI_STATUS HiiPopulateDiskInfoForm (VOID)
 
EFI_STATUS HiiSetBlockSidAction (IN UINT32 PpRequest)
 
EFI_STATUS EFIAPI RouteConfig (CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, CONST EFI_STRING Configuration, EFI_STRING *Progress)
 
EFI_STATUS EFIAPI ExtractConfig (CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, CONST EFI_STRING Request, EFI_STRING *Progress, EFI_STRING *Results)
 
VOID OpalHiiSetBrowserData (VOID)
 
VOID OpalHiiGetBrowserData (VOID)
 
EFI_STATUS HiiSetFormString (EFI_STRING_ID DestStringId, CHAR8 *SrcAsciiStr)
 
EFI_STATUS OpalDiskInitialize (IN OPAL_DRIVER_DEVICE *Dev)
 
EFI_STATUS OpalDiskUpdateOwnerShip (OPAL_DISK *OpalDisk)
 
EFI_STATUS OpalDiskUpdateStatus (OPAL_DISK *OpalDisk)
 

Variables

UINT8 OpalPasswordFormBin []
 
UINT8 OpalPasswordDxeStrings []
 
CHAR16 OpalPasswordStorageName [] = L"OpalHiiConfig"
 
EFI_HII_CONFIG_ACCESS_PROTOCOL gHiiConfigAccessProtocol
 
EFI_HII_HANDLE gHiiPackageListHandle = NULL
 
const EFI_GUID gHiiPackageListGuid = PACKAGE_LIST_GUID
 
const EFI_GUID gHiiSetupVariableGuid = SETUP_VARIABLE_GUID
 
const EFI_GUID gOpalSetupFormSetGuid = SETUP_FORMSET_GUID
 
OPAL_HII_CONFIGURATION gHiiConfiguration
 
HII_VENDOR_DEVICE_PATH gHiiVendorDevicePath
 

Detailed Description

Implementation of the HII for the Opal UEFI Driver.

Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file OpalHii.c.

Macro Definition Documentation

◆ UPPER_LOWER_CASE_OFFSET

#define UPPER_LOWER_CASE_OFFSET   0x20

Definition at line 13 of file OpalHii.c.

Function Documentation

◆ DriverCallback()

EFI_STATUS EFIAPI DriverCallback ( CONST EFI_HII_CONFIG_ACCESS_PROTOCOL This,
EFI_BROWSER_ACTION  Action,
EFI_QUESTION_ID  QuestionId,
UINT8  Type,
EFI_IFR_TYPE_VALUE Value,
EFI_BROWSER_ACTION_REQUEST *  ActionRequest 
)

This function processes the results of changes in configuration.

Parameters
ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
ActionSpecifies the type of action taken by the browser.
QuestionIdA unique value which is sent to the original exporting driver so that it can identify the type of data to expect.
TypeThe type of value for the question.
ValueA pointer to the data being sent to the original exporting driver.
ActionRequestOn return, points to the action requested by the callback function.
Return values
EFI_SUCCESSThe callback successfully handled the action.
EFI_OUT_OF_RESOURCESNot enough storage is available to hold the variable and its data.
EFI_DEVICE_ERRORThe variable could not be saved.
EFI_UNSUPPORTEDThe specified Action is not supported by the callback.

Definition at line 606 of file OpalHii.c.

◆ ExtractConfig()

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

This function allows a caller to extract the current configuration for one or more named elements from the target driver.

Parameters
ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
RequestA null-terminated Unicode string in <ConfigRequest> format.
ProgressOn return, points to a character in the Request string. Points to the string's null terminator if request was successful. Points to the most recent '&' before the first failing name/value pair (or the beginning of the string if the failure is in the first name/value pair) if the request was not successful.
ResultsA null-terminated Unicode string in <ConfigAltResp> format which has all values filled in for the names in the Request string. String to be allocated by the called function.
Return values
EFI_SUCCESSThe Results is filled with the requested values.
EFI_OUT_OF_RESOURCESNot enough memory to store the results.
EFI_INVALID_PARAMETERRequest is illegal syntax, or unknown name.
EFI_NOT_FOUNDRouting data doesn't match any storage in this driver.

Definition at line 1073 of file OpalHii.c.

◆ GetDiskNameStringId()

EFI_STRING_ID GetDiskNameStringId ( UINT8  DiskIndex)

Get disk name string id.

Parameters
DiskIndexThe input disk index info.
Return values
Thedisk name string id.

Definition at line 511 of file OpalHii.c.

◆ GetSavedOpalRequest()

VOID GetSavedOpalRequest ( IN OPAL_DISK OpalDisk,
OUT OPAL_REQUEST OpalRequest 
)

Get saved OPAL request.

Parameters
[in]OpalDiskThe disk needs to get the saved OPAL request.
[out]OpalRequestOPAL request got.

Definition at line 85 of file OpalHii.c.

◆ HiiConfirmDataRemovalAction()

EFI_STATUS HiiConfirmDataRemovalAction ( IN OPAL_DISK OpalDisk,
IN CHAR16 *  ActionString 
)

Confirm whether user truly want to do the revert action.

Parameters
OpalDiskThe device which need to perform data removal action.
ActionStringSpecifies the action name shown on pop up menu.
Return values
EFI_SUCCESSConfirmed user want to do the revert action.

Definition at line 536 of file OpalHii.c.

◆ HiiInstall()

EFI_STATUS HiiInstall ( VOID  )

Install the HII related resources.

Return values
EFI_SUCCESSInstall all the resources success.
otherError occur when install the resources.

Definition at line 349 of file OpalHii.c.

◆ HiiPopulateDiskInfoForm()

EFI_STATUS HiiPopulateDiskInfoForm ( VOID  )

Draws the disk info form.

Return values
EFI_SUCCESSDraw the disk info success.

Definition at line 894 of file OpalHii.c.

◆ HiiPopulateMainMenuForm()

EFI_STATUS HiiPopulateMainMenuForm ( VOID  )

Updates the main menu form.

Return values
EFI_SUCCESSupdate the main form success.

Definition at line 471 of file OpalHii.c.

◆ HiiSelectDisk()

EFI_STATUS HiiSelectDisk ( UINT8  Index)

Update the global Disk index info.

Parameters
IndexThe input disk index info.
Return values
EFI_SUCCESSUpdate the disk index info success.

Definition at line 876 of file OpalHii.c.

◆ HiiSetBlockSidAction()

EFI_STATUS HiiSetBlockSidAction ( IN UINT32  PpRequest)

Send BlockSid request through TPM physical presence module.

Parameters
PpRequestTPM physical presence operation request.
Return values
EFI_SUCCESSDo the required action success.
OthersOther error occur.

Definition at line 984 of file OpalHii.c.

◆ HiiSetCurrentConfiguration()

VOID HiiSetCurrentConfiguration ( VOID  )

Sets the current system state of global config variables.

Definition at line 276 of file OpalHii.c.

◆ HiiSetFormString()

EFI_STATUS HiiSetFormString ( EFI_STRING_ID  DestStringId,
CHAR8 *  SrcAsciiStr 
)

Set a string Value in a form.

Parameters
DestStringIdThe stringid which need to update.
SrcAsciiStrThe string need to update.
Return values
EFI_SUCCESSDo the required action success.
OthersOther error occur.

Definition at line 1204 of file OpalHii.c.

◆ HiiUninstall()

EFI_STATUS HiiUninstall ( VOID  )

Uninstall the HII capability.

Return values
EFI_SUCCESSUninstall all the resources success.
othersOther errors occur when unistall the hii resource.

Definition at line 436 of file OpalHii.c.

◆ OpalDiskInitialize()

EFI_STATUS OpalDiskInitialize ( IN OPAL_DRIVER_DEVICE Dev)

Initialize the Opal disk base on the hardware info get from device.

Parameters
DevThe Opal device.
Return values
EFI_SUCCESSInitialize the device success.
EFI_DEVICE_ERRORGet info from device failed.

Definition at line 1256 of file OpalHii.c.

◆ OpalDiskUpdateOwnerShip()

EFI_STATUS OpalDiskUpdateOwnerShip ( OPAL_DISK OpalDisk)

Update the device ownship

Parameters
OpalDiskThe Opal device.
Return values
EFI_SUCCESSGet ownership success.
EFI_ACCESS_DENIEDHas send BlockSID command, can't change ownership.
EFI_INVALID_PARAMETERNot get Msid info before get ownership info.

Definition at line 1314 of file OpalHii.c.

◆ OpalDiskUpdateStatus()

EFI_STATUS OpalDiskUpdateStatus ( OPAL_DISK OpalDisk)

Update the device info.

Parameters
OpalDiskThe Opal device.
Return values
EFI_SUCCESSInitialize the device success.
EFI_DEVICE_ERRORGet info from device failed.
EFI_INVALID_PARAMETERNot get Msid info before get ownership info.
EFI_ACCESS_DENIEDHas send BlockSID command, can't change ownership.

Definition at line 1349 of file OpalHii.c.

◆ OpalHiiAddPackages()

EFI_STATUS OpalHiiAddPackages ( VOID  )

Install the HII form and string packages.

Return values
EFI_SUCCESSInstall all the resources success.
EFI_OUT_OF_RESOURCESOut of resource error.

Definition at line 399 of file OpalHii.c.

◆ OpalHiiGetBrowserData()

VOID OpalHiiGetBrowserData ( VOID  )

Populate the hii_g_Configuration with the browser Data.

Definition at line 1181 of file OpalHii.c.

◆ OpalHiiSetBrowserData()

VOID OpalHiiSetBrowserData ( VOID  )

Pass the current system state to the bios via the hii_G_Configuration.

Definition at line 1162 of file OpalHii.c.

◆ RouteConfig()

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

This function processes the results of changes in configuration.

Parameters
ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
ConfigurationA null-terminated Unicode string in <ConfigResp> format.
ProgressA pointer to a string filled in with the offset of the most recent '&' before the first failing name/value pair (or the beginning of the string if the failure is in the first name/value pair) or the terminating NULL if all was successful.
Return values
EFI_SUCCESSThe Results is processed successfully.
EFI_INVALID_PARAMETERConfiguration is NULL.
EFI_NOT_FOUNDRouting data doesn't match any storage in this driver.

Definition at line 1025 of file OpalHii.c.

◆ SaveOpalRequest()

VOID SaveOpalRequest ( IN OPAL_DISK OpalDisk,
IN OPAL_REQUEST  OpalRequest 
)

Save OPAL request.

Parameters
[in]OpalDiskThe disk has OPAL request to save.
[in]OpalRequestOPAL request to save.

Definition at line 156 of file OpalHii.c.

Variable Documentation

◆ gHiiConfigAccessProtocol

EFI_HII_CONFIG_ACCESS_PROTOCOL gHiiConfigAccessProtocol

Definition at line 31 of file OpalHii.c.

◆ gHiiConfiguration

OPAL_HII_CONFIGURATION gHiiConfiguration

Definition at line 50 of file OpalHii.c.

◆ gHiiPackageListGuid

const EFI_GUID gHiiPackageListGuid = PACKAGE_LIST_GUID

Definition at line 41 of file OpalHii.c.

◆ gHiiPackageListHandle

EFI_HII_HANDLE gHiiPackageListHandle = NULL

Definition at line 36 of file OpalHii.c.

◆ gHiiSetupVariableGuid

const EFI_GUID gHiiSetupVariableGuid = SETUP_VARIABLE_GUID

Definition at line 42 of file OpalHii.c.

◆ gHiiVendorDevicePath

HII_VENDOR_DEVICE_PATH gHiiVendorDevicePath
Initial value:
= {
{
{
{
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
OPAL_PASSWORD_CONFIG_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 55 of file OpalHii.c.

◆ gOpalSetupFormSetGuid

const EFI_GUID gOpalSetupFormSetGuid = SETUP_FORMSET_GUID

Definition at line 43 of file OpalHii.c.

◆ OpalPasswordStorageName

CHAR16 OpalPasswordStorageName[] = L"OpalHiiConfig"

Definition at line 29 of file OpalHii.c.