1 /** @file 2 The file provides the mechanism to set and get the values 3 associated with a keyword exposed through a x-UEFI- prefixed 4 configuration language namespace. 5 6 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials are licensed and made available under 8 the terms and conditions of the BSD License that accompanies this distribution. 9 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 __EFI_CONFIG_KEYWORD_HANDLER_H__ 18 #define __EFI_CONFIG_KEYWORD_HANDLER_H__ 19 20 #define EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL_GUID \ 21 { \ 22 0x0a8badd5, 0x03b8, 0x4d19, {0xb1, 0x28, 0x7b, 0x8f, 0x0e, 0xda, 0xa5, 0x96 } \ 23 } 24 25 //*********************************************************** 26 // Progress Errors 27 //*********************************************************** 28 #define KEYWORD_HANDLER_NO_ERROR 0x00000000 29 #define KEYWORD_HANDLER_NAMESPACE_ID_NOT_FOUND 0x00000001 30 #define KEYWORD_HANDLER_MALFORMED_STRING 0x00000002 31 #define KEYWORD_HANDLER_KEYWORD_NOT_FOUND 0x00000004 32 #define KEYWORD_HANDLER_INCOMPATIBLE_VALUE_DETECTED 0x00000008 33 #define KEYWORD_HANDLER_ACCESS_NOT_PERMITTED 0x00000010 34 #define KEYWORD_HANDLER_UNDEFINED_PROCESSING_ERROR 0x80000000 35 36 typedef struct _EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL; 37 38 /** 39 40 This function accepts a <MultiKeywordResp> formatted string, finds the associated 41 keyword owners, creates a <MultiConfigResp> string from it and forwards it to the 42 EFI_HII_ROUTING_PROTOCOL.RouteConfig function. 43 44 If there is an issue in resolving the contents of the KeywordString, then the 45 function returns an error and also sets the Progress and ProgressErr with the 46 appropriate information about where the issue occurred and additional data about 47 the nature of the issue. 48 49 In the case when KeywordString containing multiple keywords, when an EFI_NOT_FOUND 50 error is generated during processing the second or later keyword element, the system 51 storage associated with earlier keywords is not modified. All elements of the 52 KeywordString must successfully pass all tests for format and access prior to making 53 any modifications to storage. 54 55 In the case when EFI_DEVICE_ERROR is returned from the processing of a KeywordString 56 containing multiple keywords, the state of storage associated with earlier keywords 57 is undefined. 58 59 60 @param This Pointer to the EFI_KEYWORD_HANDLER _PROTOCOL instance. 61 62 @param KeywordString A null-terminated string in <MultiKeywordResp> format. 63 64 @param Progress On return, points to a character in the KeywordString. 65 Points to the string's NULL terminator if the request 66 was successful. Points to the most recent '&' before 67 the first failing string element if the request was 68 not successful. 69 70 @param ProgressErr If during the processing of the KeywordString there was 71 a failure, this parameter gives additional information 72 about the possible source of the problem. The various 73 errors are defined in "Related Definitions" below. 74 75 76 @retval EFI_SUCCESS The specified action was completed successfully. 77 78 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: 79 1. KeywordString is NULL. 80 2. Parsing of the KeywordString resulted in an 81 error. See Progress and ProgressErr for more data. 82 83 @retval EFI_NOT_FOUND An element of the KeywordString was not found. 84 See ProgressErr for more data. 85 86 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. 87 See ProgressErr for more data. 88 89 @retval EFI_ACCESS_DENIED The action violated system policy. See ProgressErr 90 for more data. 91 92 @retval EFI_DEVICE_ERROR An unexpected system error occurred. See ProgressErr 93 for more data. 94 95 **/ 96 typedef 97 EFI_STATUS 98 (EFIAPI *EFI_CONFIG_KEYWORD_HANDLER_SET_DATA) ( 99 IN EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *This, 100 IN CONST EFI_STRING KeywordString, 101 OUT EFI_STRING *Progress, 102 OUT UINT32 *ProgressErr 103 ); 104 105 106 /** 107 108 This function accepts a <MultiKeywordRequest> formatted string, finds the underlying 109 keyword owners, creates a <MultiConfigRequest> string from it and forwards it to the 110 EFI_HII_ROUTING_PROTOCOL.ExtractConfig function. 111 112 If there is an issue in resolving the contents of the KeywordString, then the function 113 returns an EFI_INVALID_PARAMETER and also set the Progress and ProgressErr with the 114 appropriate information about where the issue occurred and additional data about the 115 nature of the issue. 116 117 In the case when KeywordString is NULL, or contains multiple keywords, or when 118 EFI_NOT_FOUND is generated while processing the keyword elements, the Results string 119 contains values returned for all keywords processed prior to the keyword generating the 120 error but no values for the keyword with error or any following keywords. 121 122 123 @param This Pointer to the EFI_KEYWORD_HANDLER _PROTOCOL instance. 124 125 @param NameSpaceId A null-terminated string containing the platform configuration 126 language to search through in the system. If a NULL is passed 127 in, then it is assumed that any platform configuration language 128 with the prefix of "x-UEFI-" are searched. 129 130 @param KeywordString A null-terminated string in <MultiKeywordRequest> format. If a 131 NULL is passed in the KeywordString field, all of the known 132 keywords in the system for the NameSpaceId specified are 133 returned in the Results field. 134 135 @param Progress On return, points to a character in the KeywordString. Points 136 to the string's NULL terminator if the request was successful. 137 Points to the most recent '&' before the first failing string 138 element if the request was not successful. 139 140 @param ProgressErr If during the processing of the KeywordString there was a 141 failure, this parameter gives additional information about the 142 possible source of the problem. See the definitions in SetData() 143 for valid value definitions. 144 145 @param Results A null-terminated string in <MultiKeywordResp> format is returned 146 which has all the values filled in for the keywords in the 147 KeywordString. This is a callee-allocated field, and must be freed 148 by the caller after being used. 149 150 @retval EFI_SUCCESS The specified action was completed successfully. 151 152 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: 153 1.Progress, ProgressErr, or Resuts is NULL. 154 2.Parsing of the KeywordString resulted in an error. See 155 Progress and ProgressErr for more data. 156 157 158 @retval EFI_NOT_FOUND An element of the KeywordString was not found. See 159 ProgressErr for more data. 160 161 @retval EFI_NOT_FOUND The NamespaceId specified was not found. See ProgressErr 162 for more data. 163 164 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. See 165 ProgressErr for more data. 166 167 @retval EFI_ACCESS_DENIED The action violated system policy. See ProgressErr for 168 more data. 169 170 @retval EFI_DEVICE_ERROR An unexpected system error occurred. See ProgressErr 171 for more data. 172 173 **/ 174 typedef 175 EFI_STATUS 176 (EFIAPI *EFI_CONFIG_KEYWORD_HANDLER_GET_DATA) ( 177 IN EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *This, 178 IN CONST EFI_STRING NameSpaceId, OPTIONAL 179 IN CONST EFI_STRING KeywordString, OPTIONAL 180 OUT EFI_STRING *Progress, 181 OUT UINT32 *ProgressErr, 182 OUT EFI_STRING *Results 183 ); 184 185 /// 186 /// The EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL provides the mechanism 187 /// to set and get the values associated with a keyword exposed 188 /// through a x-UEFI- prefixed configuration language namespace 189 /// 190 191 struct _EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL { 192 EFI_CONFIG_KEYWORD_HANDLER_SET_DATA SetData; 193 EFI_CONFIG_KEYWORD_HANDLER_GET_DATA GetData; 194 }; 195 196 extern EFI_GUID gEfiConfigKeywordHandlerProtocolGuid; 197 198 #endif 199 200