3 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _HDD_PASSWORD_DXE_H_
10 #define _HDD_PASSWORD_DXE_H_
14 #include <IndustryStandard/Atapi.h>
15 #include <IndustryStandard/Pci.h>
16 #include <Protocol/AtaPassThru.h>
17 #include <Protocol/PciIo.h>
18 #include <Protocol/HiiConfigAccess.h>
19 #include <Protocol/VariableLock.h>
21 #include <Guid/MdeModuleHii.h>
22 #include <Guid/EventGroup.h>
23 #include <Guid/S3StorageDeviceInitList.h>
25 #include <Library/DebugLib.h>
26 #include <Library/BaseLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/UefiRuntimeServicesTableLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/DxeServicesTableLib.h>
32 #include <Library/MemoryAllocationLib.h>
33 #include <Library/UefiHiiServicesLib.h>
34 #include <Library/HiiLib.h>
35 #include <Library/DevicePathLib.h>
36 #include <Library/PrintLib.h>
37 #include <Library/UefiLib.h>
38 #include <Library/LockBoxLib.h>
39 #include <Library/S3BootScriptLib.h>
40 #include <Library/PciLib.h>
41 #include <Library/BaseCryptLib.h>
43 #include "HddPasswordCommon.h"
44 #include "HddPasswordHiiDataStruc.h"
47 // This is the generated IFR binary data for each formset defined in VFR.
48 // This data array is ready to be used as input of HiiAddPackages() to
49 // create a packagelist (which contains Form packages, String packages, etc).
51 extern UINT8 HddPasswordBin
[];
54 // This is the generated String package data for all .UNI files.
55 // This data array is ready to be used as input of HiiAddPackages() to
56 // create a packagelist (which contains Form packages, String packages, etc).
58 extern UINT8 HddPasswordDxeStrings
[];
60 #define HDD_PASSWORD_DXE_PRIVATE_SIGNATURE SIGNATURE_32 ('H', 'D', 'D', 'P')
62 typedef struct _HDD_PASSWORD_CONFIG_FORM_ENTRY
{
64 EFI_HANDLE Controller
;
69 UINT16 PortMultiplierPort
;
70 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
72 CHAR8 Password
[HDD_PASSWORD_MAX_LENGTH
];
73 EFI_STRING_ID TitleToken
;
74 EFI_STRING_ID TitleHelpToken
;
76 HDD_PASSWORD_CONFIG IfrData
;
77 EFI_ATA_PASS_THRU_PROTOCOL
*AtaPassThru
;
78 } HDD_PASSWORD_CONFIG_FORM_ENTRY
;
80 typedef struct _HDD_PASSWORD_DXE_PRIVATE_DATA
{
82 EFI_HANDLE DriverHandle
;
83 EFI_HII_HANDLE HiiHandle
;
84 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
85 HDD_PASSWORD_CONFIG_FORM_ENTRY
*Current
;
86 } HDD_PASSWORD_DXE_PRIVATE_DATA
;
88 #define HDD_PASSWORD_DXE_PRIVATE_FROM_THIS(a) CR (a, HDD_PASSWORD_DXE_PRIVATE_DATA, ConfigAccess, HDD_PASSWORD_DXE_PRIVATE_SIGNATURE)
91 //Iterate through the doule linked list. NOT delete safe
93 #define EFI_LIST_FOR_EACH(Entry, ListHead) \
94 for (Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
96 #define PASSWORD_SALT_SIZE 32
98 #define HDD_PASSWORD_REQUEST_VARIABLE_NAME L"HddPasswordRequest"
101 // It needs to be locked before EndOfDxe.
103 #define HDD_PASSWORD_VARIABLE_NAME L"HddPassword"
108 HDD_PASSWORD_DEVICE Device
;
109 HDD_PASSWORD_REQUEST Request
;
110 } HDD_PASSWORD_REQUEST_VARIABLE
;
113 // It will be used to validate HDD password when the device is at frozen state.
116 HDD_PASSWORD_DEVICE Device
;
117 UINT8 PasswordHash
[SHA256_DIGEST_SIZE
];
118 UINT8 PasswordSalt
[PASSWORD_SALT_SIZE
];
119 } HDD_PASSWORD_VARIABLE
;
122 /// HII specific Vendor Device Path definition.
125 VENDOR_DEVICE_PATH VendorDevicePath
;
126 EFI_DEVICE_PATH_PROTOCOL End
;
127 } HII_VENDOR_DEVICE_PATH
;
132 // Time out value for ATA pass through protocol
134 #define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)
138 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
139 } HDD_HC_PCI_REGISTER_SAVE
;