1 /** @file 2 This file contains functions related to Config Access Protocols installed by 3 by HII Thunk Modules which is used to thunk UEFI Config Access Callback to 4 Framework HII Callback. 5 6 Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 http://opensource.org/licenses/bsd-license.php 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 15 **/ 16 17 #ifndef _HII_THUNK_CONFIG_ACCESS_H_ 18 #define _HII_THUNK_CONFIG_ACCESS_H_ 19 20 /** 21 This function installs a EFI_CONFIG_ACCESS_PROTOCOL instance for a form package registered 22 by a module using Framework HII Protocol Interfaces. 23 24 UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so 25 that Setup Utility can load the Buffer Storage using this protocol. 26 27 @param Packages The Package List. 28 @param ThunkContext The Thunk Context. 29 30 @retval EFI_SUCCESS The Config Access Protocol is installed successfully. 31 @retval EFI_OUT_RESOURCE There is not enough memory. 32 33 **/ 34 EFI_STATUS 35 InstallDefaultConfigAccessProtocol ( 36 IN CONST EFI_HII_PACKAGES *Packages, 37 IN OUT HII_THUNK_CONTEXT *ThunkContext 38 ); 39 40 /** 41 This function un-installs the EFI_CONFIG_ACCESS_PROTOCOL instance for a form package registered 42 by a module using Framework HII Protocol Interfaces. 43 44 ASSERT if no Config Access is found for such pakcage list or failed to uninstall the protocol. 45 46 @param ThunkContext The Thunk Context. 47 48 **/ 49 VOID 50 UninstallDefaultConfigAccessProtocol ( 51 IN HII_THUNK_CONTEXT *ThunkContext 52 ); 53 54 /** 55 56 This function implement the EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig 57 so that data can be read from the data storage such as UEFI Variable or module's 58 customized storage exposed by EFI_FRAMEWORK_CALLBACK. 59 60 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL 61 @param Request A null-terminated Unicode string in <ConfigRequest> format. Note that this 62 includes the routing information as well as the configurable name / value pairs. It is 63 invalid for this string to be in <MultiConfigRequest> format. 64 65 @param Progress On return, points to a character in the Request string. Points to the string's null 66 terminator if request was successful. Points to the most recent '&' before the first 67 failing name / value pair (or the beginning of the string if the failure is in the first 68 name / value pair) if the request was not successful 69 @param Results A null-terminated Unicode string in <ConfigAltResp> format which has all 70 values filled in for the names in the Request string. String to be allocated by the called 71 function. 72 73 @retval EFI_INVALID_PARAMETER If there is no Buffer Storage for this Config Access instance. 74 @retval EFI_SUCCESS The setting is retrived successfully. 75 @retval !EFI_SUCCESS The error returned by UEFI Get Variable or Framework Form Callback Nvread. 76 **/ 77 EFI_STATUS 78 EFIAPI 79 ThunkExtractConfig ( 80 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 81 IN CONST EFI_STRING Request, 82 OUT EFI_STRING *Progress, 83 OUT EFI_STRING *Results 84 ); 85 86 87 /** 88 This function implement the EFI_HII_CONFIG_ACCESS_PROTOCOL.RouteConfig 89 so that data can be written to the data storage such as UEFI Variable or module's 90 customized storage exposed by EFI_FRAMEWORK_CALLBACK. 91 92 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL 93 @param Configuration A null-terminated Unicode string in <ConfigResp> format. 94 @param Progress A pointer to a string filled in with the offset of the most recent '&' before the first 95 failing name / value pair (or the beginning of the string if the failure is in the first 96 name / value pair) or the terminating NULL if all was successful. 97 98 @retval EFI_INVALID_PARAMETER If there is no Buffer Storage for this Config Access instance. 99 @retval EFI_SUCCESS The setting is saved successfully. 100 @retval !EFI_SUCCESS The error returned by UEFI Set Variable or Framework Form Callback Nvwrite. 101 **/ 102 EFI_STATUS 103 EFIAPI 104 ThunkRouteConfig ( 105 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 106 IN CONST EFI_STRING Configuration, 107 OUT EFI_STRING *Progress 108 ); 109 110 /** 111 Wrap the EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack to EFI_FORM_CALLBACK_PROTOCOL.Callback. Therefor, 112 the framework HII module willl do no porting and work with a UEFI HII SetupBrowser. 113 114 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. 115 @param Action Specifies the type of action taken by the browser. See EFI_BROWSER_ACTION_x. 116 @param QuestionId A unique value which is sent to the original exporting driver so that it can identify the 117 type of data to expect. The format of the data tends to vary based on the opcode that 118 generated the callback. 119 @param Type The type of value for the question. See EFI_IFR_TYPE_x in 120 EFI_IFR_ONE_OF_OPTION. 121 @param Value A pointer to the data being sent to the original exporting driver. The type is specified 122 by Type. Type EFI_IFR_TYPE_VALUE is defined in 123 EFI_IFR_ONE_OF_OPTION. 124 @param ActionRequest On return, points to the action requested by the callback function. Type 125 EFI_BROWSER_ACTION_REQUEST is specified in SendForm() in the Form 126 Browser Protocol. 127 128 @retval EFI_UNSUPPORTED If the Framework HII module does not register Callback although it specify the opcode under 129 focuse to be INTERRACTIVE. 130 @retval EFI_SUCCESS The callback complete successfully. 131 @retval !EFI_SUCCESS The error code returned by EFI_FORM_CALLBACK_PROTOCOL.Callback. 132 133 **/ 134 EFI_STATUS 135 EFIAPI 136 ThunkCallback ( 137 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 138 IN EFI_BROWSER_ACTION Action, 139 IN EFI_QUESTION_ID QuestionId, 140 IN UINT8 Type, 141 IN EFI_IFR_TYPE_VALUE *Value, 142 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest 143 ); 144 145 #endif 146 147