TianoCore EDK2 master
Loading...
Searching...
No Matches
HddPasswordDxe.c File Reference
#include "HddPasswordDxe.h"
#include <Library/VariablePolicyHelperLib.h>

Go to the source code of this file.

Functions

BOOLEAN PasswordIsFullZero (IN CHAR8 *Password)
 
VOID SaveDeviceInfo (IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry, IN OUT HDD_PASSWORD_DEVICE_INFO *TempDevInfo)
 
VOID BuildHddPasswordDeviceInfo (VOID)
 
EFI_STATUS FreezeLockDevice (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort)
 
EFI_STATUS GetHddDeviceIdentifyData (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN ATA_IDENTIFY_DATA *IdentifyData)
 
VOID GetHddPasswordSecurityStatus (IN ATA_IDENTIFY_DATA *IdentifyData, IN OUT HDD_PASSWORD_CONFIG *IfrData)
 
VOID EFIAPI HddPasswordEndOfDxeEventNotify (EFI_EVENT Event, VOID *Context)
 
VOID GenSalt (IN OUT UINT8 *SaltValue)
 
BOOLEAN GenerateCredential (IN UINT8 *Buffer, IN UINTN BufferSize, IN UINT8 *SaltValue, OUT UINT8 *Credential)
 
VOID SaveHddPasswordVariable (IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry, IN CHAR8 *Password)
 
BOOLEAN GetSavedHddPasswordVariable (IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry, OUT HDD_PASSWORD_VARIABLE *HddPasswordVariable)
 
EFI_STATUS ValidateHddPassword (IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry, IN CHAR8 *Password)
 
EFI_STATUS UnlockHddPassword (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN CHAR8 Identifier, IN CHAR8 *Password)
 
EFI_STATUS DisableHddPassword (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN CHAR8 Identifier, IN CHAR8 *Password)
 
EFI_STATUS SetHddPassword (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN CHAR8 Identifier, IN CHAR8 SecurityLevel, IN CHAR16 MasterPasswordIdentifier, IN CHAR8 *Password)
 
VOID GetHddDeviceModelNumber (IN ATA_IDENTIFY_DATA *IdentifyData, IN OUT CHAR16 *String)
 
EFI_STATUS PopupHddPasswordInputWindows (IN CHAR16 *PopUpString1, IN CHAR16 *PopUpString2, IN OUT CHAR8 *Password)
 
VOID HddPasswordRequestPassword (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry)
 
VOID ProcessHddPasswordRequestSetUserPwd (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry)
 
VOID ProcessHddPasswordRequestSetMasterPwd (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry)
 
VOID ProcessHddPasswordRequest (IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN UINT16 Port, IN UINT16 PortMultiplierPort, IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry)
 
VOID GetSavedHddPasswordRequest (IN OUT HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry)
 
VOID SaveHddPasswordRequest (IN HDD_PASSWORD_CONFIG_FORM_ENTRY *ConfigFormEntry)
 
HDD_PASSWORD_CONFIG_FORM_ENTRYHddPasswordGetConfigFormEntryByIndex (IN UINT32 Index)
 
EFI_STATUS EFIAPI HddPasswordFormExtractConfig (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
 
EFI_STATUS EFIAPI HddPasswordFormRouteConfig (IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
 
EFI_STATUS EFIAPI HddPasswordFormCallback (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)
 
EFI_STATUS HddPasswordConfigUpdateForm (IN EFI_HII_HANDLE HiiHandle, IN EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru, IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_HANDLE Controller, IN UINTN Bus, IN UINTN Device, IN UINTN Function, IN UINT16 Port, IN UINT16 PortMultiplierPort)
 
VOID EFIAPI HddPasswordNotificationEvent (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS HddPasswordConfigFormInit (OUT HDD_PASSWORD_DXE_PRIVATE_DATA **Instance)
 
EFI_STATUS EFIAPI HddPasswordDxeInit (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_GUID mHddPasswordVendorGuid = HDD_PASSWORD_CONFIG_GUID
 
CHAR16 mHddPasswordVendorStorageName [] = L"HDD_PASSWORD_CONFIG"
 
LIST_ENTRY mHddPasswordConfigFormList
 
UINT32 mNumberOfHddDevices = 0
 
EFI_GUID mHddPasswordDeviceInfoGuid = HDD_PASSWORD_DEVICE_INFO_GUID
 
BOOLEAN mHddPasswordEndOfDxe = FALSE
 
HDD_PASSWORD_REQUEST_VARIABLEmHddPasswordRequestVariable = NULL
 
UINTN mHddPasswordRequestVariableSize = 0
 
HII_VENDOR_DEVICE_PATH mHddPasswordHiiVendorDevicePath
 

Detailed Description

HDD password driver which is used to support HDD security feature.

Copyright (c) 2019, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation.

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

Definition in file HddPasswordDxe.c.

Function Documentation

◆ BuildHddPasswordDeviceInfo()

VOID BuildHddPasswordDeviceInfo ( VOID  )

Build HDD password device info and save them to LockBox.

Definition at line 99 of file HddPasswordDxe.c.

◆ DisableHddPassword()

EFI_STATUS DisableHddPassword ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN CHAR8  Identifier,
IN CHAR8 *  Password 
)

Send disable hdd password cmd through Ata Pass Thru Protocol.

Parameters
[in]AtaPassThruThe pointer to the ATA_PASS_THRU protocol.
[in]PortThe port number of the ATA device to send the command.
[in]PortMultiplierPortThe port multiplier port number of the ATA device to send the command. If there is no port multiplier, then specify 0xFFFF.
[in]IdentifierThe identifier to set user or master password.
[in]PasswordThe hdd password of attached ATA device.
Return values
EFI_SUCCESSSuccessful to disable hdd password cmd.
EFI_INVALID_PARAMETERThe parameter passed-in is invalid.
EFI_OUT_OF_RESOURCESNot enough memory to disable hdd password cmd.
EFI_DEVICE_ERRORCan not disable hdd password cmd.

Definition at line 1007 of file HddPasswordDxe.c.

◆ FreezeLockDevice()

EFI_STATUS FreezeLockDevice ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort 
)

Send freeze lock cmd through Ata Pass Thru Protocol.

Parameters
[in]AtaPassThruThe pointer to the ATA_PASS_THRU protocol.
[in]PortThe port number of the ATA device to send the command.
[in]PortMultiplierPortThe port multiplier port number of the ATA device to send the command. If there is no port multiplier, then specify 0xFFFF.
Return values
EFI_SUCCESSSuccessful to send freeze lock cmd.
EFI_INVALID_PARAMETERThe parameter passed-in is invalid.
EFI_OUT_OF_RESOURCESNot enough memory to send freeze lock cmd.
EFI_DEVICE_ERRORCan not send freeze lock cmd.

Definition at line 252 of file HddPasswordDxe.c.

◆ GenerateCredential()

BOOLEAN GenerateCredential ( IN UINT8 *  Buffer,
IN UINTN  BufferSize,
IN UINT8 *  SaltValue,
OUT UINT8 *  Credential 
)

Hash the data to get credential.

Parameters
[in]BufferPoints to the data buffer
[in]BufferSizeBuffer size
[in]SaltValuePoints to the salt buffer, 32 bytes
[out]CredentialPoints to the hashed result
Return values
TRUEHash the data successfully.
FALSEFailed to hash the data.

Definition at line 540 of file HddPasswordDxe.c.

◆ GenSalt()

VOID GenSalt ( IN OUT UINT8 *  SaltValue)

Generate Salt value.

Parameters
[in,out]SaltValuePoints to the salt buffer, 32 bytes

Definition at line 519 of file HddPasswordDxe.c.

◆ GetHddDeviceIdentifyData()

EFI_STATUS GetHddDeviceIdentifyData ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN ATA_IDENTIFY_DATA IdentifyData 
)

Get attached harddisk identify data through Ata Pass Thru Protocol.

Parameters
[in]AtaPassThruThe pointer to the ATA_PASS_THRU protocol.
[in]PortThe port number of the ATA device to send the command.
[in]PortMultiplierPortThe port multiplier port number of the ATA device to send the command. If there is no port multiplier, then specify 0xFFFF.
[in]IdentifyDataThe buffer to store identify data.
Return values
EFI_SUCCESSSuccessful to get identify data.
EFI_INVALID_PARAMETERThe parameter passed-in is invalid.
EFI_OUT_OF_RESOURCESNot enough memory to get identify data.
EFI_DEVICE_ERRORCan not get identify data.

Definition at line 338 of file HddPasswordDxe.c.

◆ GetHddDeviceModelNumber()

VOID GetHddDeviceModelNumber ( IN ATA_IDENTIFY_DATA IdentifyData,
IN OUT CHAR16 *  String 
)

Get attached harddisk model number from identify data buffer.

Parameters
[in]IdentifyDataPointer to identify data buffer.
[in,out]StringThe buffer to store harddisk model number.

Definition at line 1201 of file HddPasswordDxe.c.

◆ GetHddPasswordSecurityStatus()

VOID GetHddPasswordSecurityStatus ( IN ATA_IDENTIFY_DATA IdentifyData,
IN OUT HDD_PASSWORD_CONFIG IfrData 
)

Parse security status according to identify data.

Parameters
[in]IdentifyDataThe buffer to store identify data.
[in,out]IfrDataIFR data to hold security status.

Definition at line 412 of file HddPasswordDxe.c.

◆ GetSavedHddPasswordRequest()

VOID GetSavedHddPasswordRequest ( IN OUT HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry)

Get saved HDD password request.

Parameters
[in,out]ConfigFormEntryThe HDD Password configuration form entry.

Definition at line 1887 of file HddPasswordDxe.c.

◆ GetSavedHddPasswordVariable()

BOOLEAN GetSavedHddPasswordVariable ( IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry,
OUT HDD_PASSWORD_VARIABLE HddPasswordVariable 
)

Get saved HDD password variable that will be used to validate HDD password when the device is at frozen state.

Parameters
[in]ConfigFormEntryThe HDD Password configuration form entry.
[out]HddPasswordVariableThe variable node for the HDD password device.
Return values
TRUEThe variable node for the HDD password device is found and returned.
FALSEThe variable node for the HDD password device is not found.

Definition at line 784 of file HddPasswordDxe.c.

◆ HddPasswordConfigFormInit()

EFI_STATUS HddPasswordConfigFormInit ( OUT HDD_PASSWORD_DXE_PRIVATE_DATA **  Instance)

Initialize the HDD Password configuration form.

Parameters
[out]InstancePointer to private instance.
Return values
EFI_SUCCESSThe HDD Password configuration form is initialized.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
OthersOther errors as indicated.

Definition at line 2750 of file HddPasswordDxe.c.

◆ HddPasswordConfigUpdateForm()

EFI_STATUS HddPasswordConfigUpdateForm ( IN EFI_HII_HANDLE  HiiHandle,
IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_HANDLE  Controller,
IN UINTN  Bus,
IN UINTN  Device,
IN UINTN  Function,
IN UINT16  Port,
IN UINT16  PortMultiplierPort 
)

Updates the HDD Password configuration form to add an entry for the attached ata harddisk device specified by the Controller.

Parameters
[in]HiiHandleThe HII Handle associated with the registered package list.
[in]AtaPassThruPointer to ATA_PASSTHRU instance.
[in]PciIoPointer to PCI_IO instance.
[in]ControllerThe controller handle of the attached ata controller.
[in]BusThe bus number of ATA controller.
[in]DeviceThe device number of ATA controller.
[in]FunctionThe function number of ATA controller.
[in]PortThe port number of attached ATA device.
[in]PortMultiplierPortThe port number of port multiplier of attached ATA device.
Return values
EFI_SUCCESSThe Hdd Password configuration form is updated.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
OthersOther errors as indicated.

Definition at line 2431 of file HddPasswordDxe.c.

◆ HddPasswordDxeInit()

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

Main entry for this driver.

Parameters
ImageHandleImage handle this driver.
SystemTablePointer to SystemTable.
Return values
EFI_SUCCESSThis function always complete successfully.

Definition at line 2817 of file HddPasswordDxe.c.

◆ HddPasswordEndOfDxeEventNotify()

VOID EFIAPI HddPasswordEndOfDxeEventNotify ( EFI_EVENT  Event,
VOID *  Context 
)

Notification function of EFI_END_OF_DXE_EVENT_GROUP_GUID event group.

This is a notification function registered on EFI_END_OF_DXE_EVENT_GROUP_GUID event group.

Parameters
EventEvent whose notification function is being invoked.
ContextPointer to the notification function's context.

Definition at line 443 of file HddPasswordDxe.c.

◆ HddPasswordFormCallback()

EFI_STATUS EFIAPI HddPasswordFormCallback ( 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 
)

This function is called to provide results data to the driver. This data consists of a unique key that is used to identify which data is either being passed back or being asked for.

Parameters
[in]ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
[in]ActionSpecifies the type of action taken by the browser.
[in]QuestionIdA unique value which is sent to the original exporting driver so that it can identify the type of data to expect. The format of the data tends to vary based on the opcode that enerated the callback.
[in]TypeThe type of value for the question.
[in]ValueA pointer to the data being sent to the original exporting driver.
[out]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.Currently not implemented.
EFI_INVALID_PARAMETERSPassing in wrong parameter.
OthersOther errors as indicated.

Definition at line 2321 of file HddPasswordDxe.c.

◆ HddPasswordFormExtractConfig()

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

This function allows the caller to request the current configuration for one or more named elements. The resulting string is in <ConfigAltResp> format. Any and all alternative configuration strings shall also be appended to the end of the current configuration string. If they are, they must appear after the current configuration. They must contain the same routing (GUID, NAME, PATH) as the current configuration string. They must have an additional description indicating the type of alternative configuration the string represents, "ALTCFG=<StringToken>". That <StringToken> (when converted from Hex UNICODE to binary) is a reference to a string in the associated string pack.

Parameters
[in]ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
[in]RequestA null-terminated Unicode string in <ConfigRequest> format. Note that this includes the routing information as well as the configurable name / value pairs. It is invalid for this string to be in <MultiConfigRequest> format.
[out]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.
[out]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 string is filled with the values corresponding to all requested names.
EFI_OUT_OF_RESOURCESNot enough memory to store the parts of the results that must be stored awaiting possible future protocols.
EFI_INVALID_PARAMETERFor example, passing in a NULL for the Request parameter would result in this type of error. In this case, the Progress parameter would be set to NULL.
EFI_NOT_FOUNDRouting data doesn't match any known driver. Progress set to the first character in the routing header. Note: There is no requirement that the driver validate the routing data. It must skip the <ConfigHdr> in order to process the names.
EFI_INVALID_PARAMETERIllegal syntax. Progress set to most recent & before the error or the beginning of the string.
EFI_INVALID_PARAMETERUnknown name. Progress points to the & before the name in question.Currently not implemented.

Definition at line 2149 of file HddPasswordDxe.c.

◆ HddPasswordFormRouteConfig()

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

This function applies changes in a driver's configuration. Input is a Configuration, which has the routing data for this driver followed by name / value configuration pairs. The driver must apply those pairs to its configurable storage. If the driver's configuration is stored in a linear block of data and the driver's name / value pairs are in <BlockConfig> format, it may use the ConfigToBlock helper function (above) to simplify the job. Currently not implemented.

Parameters
[in]ThisPoints to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
[in]ConfigurationA null-terminated Unicode string in <ConfigString> format.
[out]ProgressA pointer to a string filled in with the offset of the most recent '&' before the first failing name / value pair (or the beginn ing 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 have been distributed or are awaiting distribution.
EFI_OUT_OF_RESOURCESNot enough memory to store the parts of the results that must be stored awaiting possible future protocols.
EFI_INVALID_PARAMETERSPassing in a NULL for the Results parameter would result in this type of error.
EFI_NOT_FOUNDTarget for the specified routing data was not found.

Definition at line 2270 of file HddPasswordDxe.c.

◆ HddPasswordGetConfigFormEntryByIndex()

HDD_PASSWORD_CONFIG_FORM_ENTRY * HddPasswordGetConfigFormEntryByIndex ( IN UINT32  Index)

Get the HDD Password configuration form entry by the index of the goto opcode activated.

Parameters
[in]IndexThe 0-based index of the goto opcode activated.
Returns
The HDD Password configuration form entry found.

Definition at line 2062 of file HddPasswordDxe.c.

◆ HddPasswordNotificationEvent()

VOID EFIAPI HddPasswordNotificationEvent ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Ata Pass Thru Protocol notification event handler.

Check attached harddisk status to see if it's locked. If yes, then pop up a password windows to require user input. It also registers a form for user configuration on Hdd password configuration.

Parameters
[in]EventEvent whose notification function is being invoked.
[in]ContextPointer to the notification function's context.

Definition at line 2608 of file HddPasswordDxe.c.

◆ HddPasswordRequestPassword()

VOID HddPasswordRequestPassword ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry 
)

Check if disk is locked, show popup window and ask for password if it is.

Parameters
[in]AtaPassThruPointer to ATA_PASSTHRU instance.
[in]PortThe port number of attached ATA device.
[in]PortMultiplierPortThe port number of port multiplier of attached ATA device.
[in]ConfigFormEntryThe HDD Password configuration form entry.

Definition at line 1345 of file HddPasswordDxe.c.

◆ PasswordIsFullZero()

BOOLEAN PasswordIsFullZero ( IN CHAR8 *  Password)

Check if the password is full zero.

Parameters
[in]PasswordPoints to the data buffer
Return values
TRUEThis password string is full zero.
FALSEThis password string is not full zero.

Definition at line 56 of file HddPasswordDxe.c.

◆ PopupHddPasswordInputWindows()

EFI_STATUS PopupHddPasswordInputWindows ( IN CHAR16 *  PopUpString1,
IN CHAR16 *  PopUpString2,
IN OUT CHAR8 *  Password 
)

Get password input from the popup windows.

Parameters
[in]PopUpString1Pop up string 1.
[in]PopUpString2Pop up string 2.
[in,out]PasswordThe buffer to hold the input password.
Return values
EFI_ABORTEDIt is given up by pressing 'ESC' key.
EFI_SUCCESSGet password input successfully.

Definition at line 1237 of file HddPasswordDxe.c.

◆ ProcessHddPasswordRequest()

VOID ProcessHddPasswordRequest ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry 
)

Process HDD password request.

Parameters
[in]AtaPassThruPointer to ATA_PASSTHRU instance.
[in]PortThe port number of attached ATA device.
[in]PortMultiplierPortThe port number of port multiplier of attached ATA device.
[in]ConfigFormEntryThe HDD Password configuration form entry.

Definition at line 1804 of file HddPasswordDxe.c.

◆ ProcessHddPasswordRequestSetMasterPwd()

VOID ProcessHddPasswordRequestSetMasterPwd ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry 
)

Process Set Master Pwd HDD password request.

Parameters
[in]AtaPassThruPointer to ATA_PASSTHRU instance.
[in]PortThe port number of attached ATA device.
[in]PortMultiplierPortThe port number of port multiplier of attached ATA device.
[in]ConfigFormEntryThe HDD Password configuration form entry.

Definition at line 1673 of file HddPasswordDxe.c.

◆ ProcessHddPasswordRequestSetUserPwd()

VOID ProcessHddPasswordRequestSetUserPwd ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry 
)

Process Set User Pwd HDD password request.

Parameters
[in]AtaPassThruPointer to ATA_PASSTHRU instance.
[in]PortThe port number of attached ATA device.
[in]PortMultiplierPortThe port number of port multiplier of attached ATA device.
[in]ConfigFormEntryThe HDD Password configuration form entry.

Definition at line 1528 of file HddPasswordDxe.c.

◆ SaveDeviceInfo()

VOID SaveDeviceInfo ( IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry,
IN OUT HDD_PASSWORD_DEVICE_INFO TempDevInfo 
)

Save device info.

Parameters
[in]ConfigFormEntryPoints to HDD_PASSWORD_CONFIG_FORM_ENTRY buffer
[in,out]TempDevInfoPoints to HDD_PASSWORD_DEVICE_INFO buffer

Definition at line 79 of file HddPasswordDxe.c.

◆ SaveHddPasswordRequest()

VOID SaveHddPasswordRequest ( IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry)

Save HDD password request.

Parameters
[in]ConfigFormEntryThe HDD Password configuration form entry.

Definition at line 1948 of file HddPasswordDxe.c.

◆ SaveHddPasswordVariable()

VOID SaveHddPasswordVariable ( IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry,
IN CHAR8 *  Password 
)

Save HDD password variable that will be used to validate HDD password when the device is at frozen state.

Parameters
[in]ConfigFormEntryThe HDD Password configuration form entry.
[in]PasswordThe hdd password of attached ATA device.

Definition at line 606 of file HddPasswordDxe.c.

◆ SetHddPassword()

EFI_STATUS SetHddPassword ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN CHAR8  Identifier,
IN CHAR8  SecurityLevel,
IN CHAR16  MasterPasswordIdentifier,
IN CHAR8 *  Password 
)

Send set hdd password cmd through Ata Pass Thru Protocol.

Parameters
[in]AtaPassThruThe pointer to the ATA_PASS_THRU protocol.
[in]PortThe port number of the ATA device to send the command.
[in]PortMultiplierPortThe port multiplier port number of the ATA device to send the command. If there is no port multiplier, then specify 0xFFFF.
[in]IdentifierThe identifier to set user or master password.
[in]SecurityLevelThe security level to be set to device.
[in]MasterPasswordIdentifierThe master password identifier to be set to device.
[in]PasswordThe hdd password of attached ATA device.
Return values
EFI_SUCCESSSuccessful to set hdd password cmd.
EFI_INVALID_PARAMETERThe parameter passed-in is invalid.
EFI_OUT_OF_RESOURCESNot enough memory to set hdd password cmd.
EFI_DEVICE_ERRORCan not set hdd password cmd.

Definition at line 1107 of file HddPasswordDxe.c.

◆ UnlockHddPassword()

EFI_STATUS UnlockHddPassword ( IN EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru,
IN UINT16  Port,
IN UINT16  PortMultiplierPort,
IN CHAR8  Identifier,
IN CHAR8 *  Password 
)

Send unlock hdd password cmd through Ata Pass Thru Protocol.

Parameters
[in]AtaPassThruThe pointer to the ATA_PASS_THRU protocol.
[in]PortThe port number of the ATA device to send the command.
[in]PortMultiplierPortThe port multiplier port number of the ATA device to send the command. If there is no port multiplier, then specify 0xFFFF.
[in]IdentifierThe identifier to set user or master password.
[in]PasswordThe hdd password of attached ATA device.
Return values
EFI_SUCCESSSuccessful to send unlock hdd password cmd.
EFI_INVALID_PARAMETERThe parameter passed-in is invalid.
EFI_OUT_OF_RESOURCESNot enough memory to send unlock hdd password cmd.
EFI_DEVICE_ERRORCan not send unlock hdd password cmd.

Definition at line 909 of file HddPasswordDxe.c.

◆ ValidateHddPassword()

EFI_STATUS ValidateHddPassword ( IN HDD_PASSWORD_CONFIG_FORM_ENTRY ConfigFormEntry,
IN CHAR8 *  Password 
)

Use saved HDD password variable to validate HDD password when the device is at frozen state.

Parameters
[in]ConfigFormEntryThe HDD Password configuration form entry.
[in]PasswordThe hdd password of attached ATA device.
Return values
EFI_SUCCESSPass to validate the HDD password.
EFI_NOT_FOUNDThe variable node for the HDD password device is not found.
EFI_DEVICE_ERRORFailed to generate credential for the HDD password.
EFI_INVALID_PARAMETERFailed to validate the HDD password.

Definition at line 858 of file HddPasswordDxe.c.

Variable Documentation

◆ mHddPasswordConfigFormList

LIST_ENTRY mHddPasswordConfigFormList

Definition at line 16 of file HddPasswordDxe.c.

◆ mHddPasswordDeviceInfoGuid

EFI_GUID mHddPasswordDeviceInfoGuid = HDD_PASSWORD_DEVICE_INFO_GUID

Definition at line 19 of file HddPasswordDxe.c.

◆ mHddPasswordEndOfDxe

BOOLEAN mHddPasswordEndOfDxe = FALSE

Definition at line 20 of file HddPasswordDxe.c.

◆ mHddPasswordHiiVendorDevicePath

HII_VENDOR_DEVICE_PATH mHddPasswordHiiVendorDevicePath
Initial value:
= {
{
{
{
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
HDD_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 24 of file HddPasswordDxe.c.

◆ mHddPasswordRequestVariable

HDD_PASSWORD_REQUEST_VARIABLE* mHddPasswordRequestVariable = NULL

Definition at line 21 of file HddPasswordDxe.c.

◆ mHddPasswordRequestVariableSize

UINTN mHddPasswordRequestVariableSize = 0

Definition at line 22 of file HddPasswordDxe.c.

◆ mHddPasswordVendorGuid

EFI_GUID mHddPasswordVendorGuid = HDD_PASSWORD_CONFIG_GUID

Definition at line 14 of file HddPasswordDxe.c.

◆ mHddPasswordVendorStorageName

CHAR16 mHddPasswordVendorStorageName[] = L"HDD_PASSWORD_CONFIG"

Definition at line 15 of file HddPasswordDxe.c.

◆ mNumberOfHddDevices

UINT32 mNumberOfHddDevices = 0

Definition at line 17 of file HddPasswordDxe.c.