3 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
4 Copyright (c) Microsoft Corporation.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _HDD_PASSWORD_DXE_H_
11 #define _HDD_PASSWORD_DXE_H_
15 #include <IndustryStandard/Atapi.h>
16 #include <IndustryStandard/Pci.h>
17 #include <Protocol/AtaPassThru.h>
18 #include <Protocol/PciIo.h>
19 #include <Protocol/HiiConfigAccess.h>
20 #include <Protocol/VariableLock.h>
22 #include <Guid/MdeModuleHii.h>
23 #include <Guid/EventGroup.h>
24 #include <Guid/S3StorageDeviceInitList.h>
26 #include <Library/DebugLib.h>
27 #include <Library/BaseLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/UefiRuntimeServicesTableLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/DxeServicesTableLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiHiiServicesLib.h>
35 #include <Library/HiiLib.h>
36 #include <Library/DevicePathLib.h>
37 #include <Library/PrintLib.h>
38 #include <Library/UefiLib.h>
39 #include <Library/LockBoxLib.h>
40 #include <Library/S3BootScriptLib.h>
41 #include <Library/PciLib.h>
42 #include <Library/BaseCryptLib.h>
44 #include "HddPasswordCommon.h"
45 #include "HddPasswordHiiDataStruc.h"
48 // This is the generated IFR binary data for each formset defined in VFR.
49 // This data array is ready to be used as input of HiiAddPackages() to
50 // create a packagelist (which contains Form packages, String packages, etc).
52 extern UINT8 HddPasswordBin
[];
55 // This is the generated String package data for all .UNI files.
56 // This data array is ready to be used as input of HiiAddPackages() to
57 // create a packagelist (which contains Form packages, String packages, etc).
59 extern UINT8 HddPasswordDxeStrings
[];
61 #define HDD_PASSWORD_DXE_PRIVATE_SIGNATURE SIGNATURE_32 ('H', 'D', 'D', 'P')
63 typedef struct _HDD_PASSWORD_CONFIG_FORM_ENTRY
{
65 EFI_HANDLE Controller
;
70 UINT16 PortMultiplierPort
;
71 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
73 CHAR8 Password
[HDD_PASSWORD_MAX_LENGTH
];
74 EFI_STRING_ID TitleToken
;
75 EFI_STRING_ID TitleHelpToken
;
77 HDD_PASSWORD_CONFIG IfrData
;
78 EFI_ATA_PASS_THRU_PROTOCOL
*AtaPassThru
;
79 } HDD_PASSWORD_CONFIG_FORM_ENTRY
;
81 typedef struct _HDD_PASSWORD_DXE_PRIVATE_DATA
{
83 EFI_HANDLE DriverHandle
;
84 EFI_HII_HANDLE HiiHandle
;
85 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
86 HDD_PASSWORD_CONFIG_FORM_ENTRY
*Current
;
87 } HDD_PASSWORD_DXE_PRIVATE_DATA
;
89 #define HDD_PASSWORD_DXE_PRIVATE_FROM_THIS(a) CR (a, HDD_PASSWORD_DXE_PRIVATE_DATA, ConfigAccess, HDD_PASSWORD_DXE_PRIVATE_SIGNATURE)
91 #define PASSWORD_SALT_SIZE 32
93 #define HDD_PASSWORD_REQUEST_VARIABLE_NAME L"HddPasswordRequest"
96 // It needs to be locked before EndOfDxe.
98 #define HDD_PASSWORD_VARIABLE_NAME L"HddPassword"
103 HDD_PASSWORD_DEVICE Device
;
104 HDD_PASSWORD_REQUEST Request
;
105 } HDD_PASSWORD_REQUEST_VARIABLE
;
108 // It will be used to validate HDD password when the device is at frozen state.
111 HDD_PASSWORD_DEVICE Device
;
112 UINT8 PasswordHash
[SHA256_DIGEST_SIZE
];
113 UINT8 PasswordSalt
[PASSWORD_SALT_SIZE
];
114 } HDD_PASSWORD_VARIABLE
;
117 /// HII specific Vendor Device Path definition.
120 VENDOR_DEVICE_PATH VendorDevicePath
;
121 EFI_DEVICE_PATH_PROTOCOL End
;
122 } HII_VENDOR_DEVICE_PATH
;
127 // Time out value for ATA pass through protocol
129 #define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)
133 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
134 } HDD_HC_PCI_REGISTER_SAVE
;