1 /** @file 2 The Oem config reference implement 3 4 Copyright (c) 2018, Hisilicon Limited. All rights reserved. 5 Copyright (c) 2018, Linaro Limited. All rights reserved. 6 SPDX-License-Identifier: BSD-2-Clause-Patent 7 8 **/ 9 10 #ifndef _OEM_CONFIG_H_ 11 #define _OEM_CONFIG_H_ 12 13 #include <Guid/HiiPlatformSetupFormset.h> 14 #include <Guid/MdeModuleHii.h> 15 #include <Guid/VersionInfoHobGuid.h> 16 #include <Library/BaseMemoryLib.h> 17 #include <Library/BaseLib.h> 18 #include <Library/DebugLib.h> 19 #include <Library/DevicePathLib.h> 20 #include <Library/HiiLib.h> 21 #include <Library/HobLib.h> 22 #include <Library/MemoryAllocationLib.h> 23 #include "Library/OemConfigData.h" 24 #include <Library/PcdLib.h> 25 #include <Library/PrintLib.h> 26 #include <Library/UefiBootServicesTableLib.h> 27 #include <Library/UefiHiiServicesLib.h> 28 #include <Library/UefiRuntimeServicesTableLib.h> 29 #include <Pi/PiFirmwareVolume.h> 30 #include <Protocol/HiiConfigAccess.h> 31 32 // 33 // These are the VFR compiler generated data representing our VFR data. 34 // 35 extern UINT8 OemConfigVfrBin[]; 36 37 // 38 // HII specific Vendor Device Path definition. 39 // 40 typedef struct { 41 VENDOR_DEVICE_PATH VendorDevicePath; 42 EFI_DEVICE_PATH_PROTOCOL End; 43 } HII_VENDOR_DEVICE_PATH; 44 45 #define OEM_CONFIG_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('O', 'E', 'M', 'C') 46 typedef struct { 47 UINTN Signature; 48 EFI_HII_HANDLE HiiHandle; 49 EFI_HANDLE DriverHandle; 50 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; 51 } OEM_CONFIG_CALLBACK_DATA; 52 53 /** 54 This function allows a caller to extract the current configuration for one 55 or more named elements from the target driver. 56 57 58 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 59 @param Request A null-terminated Unicode string in <ConfigRequest> format. 60 @param Progress On return, points to a character in the Request string. 61 Points to the string's null terminator if request was successful. 62 Points to the most recent '&' before the first failing name/value 63 pair (or the beginning of the string if the failure is in the 64 first name/value pair) if the request was not successful. 65 @param Results A null-terminated Unicode string in <ConfigAltResp> format which 66 has all values filled in for the names in the Request string. 67 String to be allocated by the called function. 68 69 @retval EFI_SUCCESS The Results is filled with the requested values. 70 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. 71 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name. 72 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver. 73 74 **/ 75 EFI_STATUS 76 EFIAPI 77 OemExtractConfig ( 78 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 79 IN CONST EFI_STRING Request, 80 OUT EFI_STRING *Progress, 81 OUT EFI_STRING *Results 82 ); 83 84 /** 85 This function processes the results of changes in configuration. 86 87 88 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 89 @param Configuration A null-terminated Unicode string in <ConfigResp> format. 90 @param Progress A pointer to a string filled in with the offset of the most 91 recent '&' before the first failing name/value pair (or the 92 beginning of the string if the failure is in the first 93 name/value pair) or the terminating NULL if all was successful. 94 95 @retval EFI_SUCCESS The Results is processed successfully. 96 @retval EFI_INVALID_PARAMETER Configuration is NULL. 97 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver. 98 99 **/ 100 EFI_STATUS 101 EFIAPI 102 OemRouteConfig ( 103 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 104 IN CONST EFI_STRING Configuration, 105 OUT EFI_STRING *Progress 106 ); 107 108 /** 109 This function is invoked if user selected a interactive opcode from Device Manager's 110 Formset. If user set VBIOS, the new value is saved to EFI variable. 111 112 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 113 @param Action Specifies the type of action taken by the browser. 114 @param QuestionId A unique value which is sent to the original exporting driver 115 so that it can identify the type of data to expect. 116 @param Type The type of value for the question. 117 @param Value A pointer to the data being sent to the original exporting driver. 118 @param ActionRequest On return, points to the action requested by the callback function. 119 120 @retval EFI_SUCCESS The callback successfully handled the action. 121 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters. 122 123 **/ 124 EFI_STATUS 125 EFIAPI 126 OemCallback ( 127 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 128 IN EFI_BROWSER_ACTION Action, 129 IN EFI_QUESTION_ID QuestionId, 130 IN UINT8 Type, 131 IN EFI_IFR_TYPE_VALUE *Value, 132 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest 133 ); 134 135 VOID GetReleaseTime (EFI_TIME *Time); 136 #endif 137