3 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions
7 of the BSD License which accompanies this distribution. The
8 full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _HDD_PASSWORD_DXE_H_
17 #define _HDD_PASSWORD_DXE_H_
21 #include <IndustryStandard/Atapi.h>
22 #include <IndustryStandard/Pci.h>
23 #include <Protocol/AtaPassThru.h>
24 #include <Protocol/PciIo.h>
25 #include <Protocol/HiiConfigAccess.h>
26 #include <Protocol/VariableLock.h>
28 #include <Guid/MdeModuleHii.h>
29 #include <Guid/EventGroup.h>
30 #include <Guid/S3StorageDeviceInitList.h>
32 #include <Library/DebugLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/UefiRuntimeServicesTableLib.h>
36 #include <Library/UefiDriverEntryPoint.h>
37 #include <Library/UefiBootServicesTableLib.h>
38 #include <Library/DxeServicesTableLib.h>
39 #include <Library/MemoryAllocationLib.h>
40 #include <Library/UefiHiiServicesLib.h>
41 #include <Library/HiiLib.h>
42 #include <Library/DevicePathLib.h>
43 #include <Library/PrintLib.h>
44 #include <Library/UefiLib.h>
45 #include <Library/LockBoxLib.h>
46 #include <Library/S3BootScriptLib.h>
47 #include <Library/PciLib.h>
48 #include <Library/BaseCryptLib.h>
50 #include "HddPasswordCommon.h"
51 #include "HddPasswordHiiDataStruc.h"
54 // This is the generated IFR binary data for each formset defined in VFR.
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 HddPasswordBin
[];
61 // This is the generated String package data for all .UNI files.
62 // This data array is ready to be used as input of HiiAddPackages() to
63 // create a packagelist (which contains Form packages, String packages, etc).
65 extern UINT8 HddPasswordDxeStrings
[];
67 #define HDD_PASSWORD_DXE_PRIVATE_SIGNATURE SIGNATURE_32 ('H', 'D', 'D', 'P')
69 typedef struct _HDD_PASSWORD_CONFIG_FORM_ENTRY
{
71 EFI_HANDLE Controller
;
76 UINT16 PortMultiplierPort
;
77 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
79 CHAR8 Password
[HDD_PASSWORD_MAX_LENGTH
];
80 EFI_STRING_ID TitleToken
;
81 EFI_STRING_ID TitleHelpToken
;
83 HDD_PASSWORD_CONFIG IfrData
;
84 EFI_ATA_PASS_THRU_PROTOCOL
*AtaPassThru
;
85 } HDD_PASSWORD_CONFIG_FORM_ENTRY
;
87 typedef struct _HDD_PASSWORD_DXE_PRIVATE_DATA
{
89 EFI_HANDLE DriverHandle
;
90 EFI_HII_HANDLE HiiHandle
;
91 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
92 HDD_PASSWORD_CONFIG_FORM_ENTRY
*Current
;
93 } HDD_PASSWORD_DXE_PRIVATE_DATA
;
95 #define HDD_PASSWORD_DXE_PRIVATE_FROM_THIS(a) CR (a, HDD_PASSWORD_DXE_PRIVATE_DATA, ConfigAccess, HDD_PASSWORD_DXE_PRIVATE_SIGNATURE)
98 //Iterate through the doule linked list. NOT delete safe
100 #define EFI_LIST_FOR_EACH(Entry, ListHead) \
101 for (Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
103 #define PASSWORD_SALT_SIZE 32
105 #define HDD_PASSWORD_REQUEST_VARIABLE_NAME L"HddPasswordRequest"
108 // It needs to be locked before EndOfDxe.
110 #define HDD_PASSWORD_VARIABLE_NAME L"HddPassword"
115 HDD_PASSWORD_DEVICE Device
;
116 HDD_PASSWORD_REQUEST Request
;
117 } HDD_PASSWORD_REQUEST_VARIABLE
;
120 // It will be used to validate HDD password when the device is at frozen state.
123 HDD_PASSWORD_DEVICE Device
;
124 UINT8 PasswordHash
[SHA256_DIGEST_SIZE
];
125 UINT8 PasswordSalt
[PASSWORD_SALT_SIZE
];
126 } HDD_PASSWORD_VARIABLE
;
129 /// HII specific Vendor Device Path definition.
132 VENDOR_DEVICE_PATH VendorDevicePath
;
133 EFI_DEVICE_PATH_PROTOCOL End
;
134 } HII_VENDOR_DEVICE_PATH
;
139 // Time out value for ATA pass through protocol
141 #define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)
145 S3_BOOT_SCRIPT_LIB_WIDTH Width
;
146 } HDD_HC_PCI_REGISTER_SAVE
;