]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.h
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Universal / PlatformDriverOverride / PlatOverMngr / PlatOverMngr.h
CommitLineData
a6f164a7 1/** @file\r
2\r
3Copyright (c) 2007 - 2008, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 PlatOverMngr.h\r
15\r
16Abstract:\r
17\r
18 Function prototype for platform driver override manager driver\r
19\r
20**/\r
21\r
22#ifndef _PLAT_OVER_MNGR_H_\r
23#define _PLAT_OVER_MNGR_H_\r
24\r
a6f164a7 25#include <PiDxe.h>\r
26\r
27#include <Protocol/HiiConfigAccess.h>\r
28#include <Protocol/HiiConfigRouting.h>\r
29#include <Protocol/HiiDatabase.h>\r
30#include <Protocol/LoadedImage.h>\r
31#include <Protocol/FirmwareVolumeBlock.h>\r
32#include <Protocol/FirmwareVolume2.h>\r
33#include <Protocol/PciIo.h>\r
34#include <Protocol/BusSpecificDriverOverride.h>\r
35#include <Protocol/ComponentName2.h>\r
36#include <Protocol/ComponentName.h>\r
37#include <Protocol/DevicePathToText.h>\r
38\r
39#include <Library/BaseLib.h>\r
40#include <Library/DebugLib.h>\r
41#include <Library/UefiLib.h>\r
42#include <Library/UefiApplicationEntryPoint.h>\r
43#include <Library/UefiBootServicesTableLib.h>\r
44#include <Library/PlatDriOverLib.h>\r
45#include <Library/IfrSupportLib.h>\r
46#include <Library/ExtendedIfrSupportLib.h>\r
47#include <Library/BaseMemoryLib.h>\r
48#include <Library/MemoryAllocationLib.h>\r
49#include <Library/HiiLib.h>\r
50#include <Library/ExtendedHiiLib.h>\r
51#include <Library/UefiRuntimeServicesTableLib.h>\r
1232b214 52#include <Library/DevicePathLib.h>\r
a6f164a7 53\r
54#define MIN_ALIGNMENT_SIZE 4\r
55#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r
56\r
57\r
f3f2e05d 58#define EFI_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('C', 'l', 'b', 'k')\r
a6f164a7 59#define EFI_CALLBACK_INFO_FROM_THIS(a) CR (a, EFI_CALLBACK_INFO, ConfigAccess, EFI_CALLBACK_INFO_SIGNATURE)\r
60#define MAX_CHOICE_NUM 0x100\r
61#define UPDATE_DATA_SIZE 0x1000\r
62\r
63\r
64extern UINT8 VfrBin[];\r
65\r
66extern UINT8 PlatOverMngrStrings[];\r
67\r
68//\r
69// Following definition is the same as in vfr file\r
70//\r
71#define PLAT_OVER_MNGR_GUID \\r
72 { \\r
555e76f8 73 0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \\r
a6f164a7 74 }\r
75\r
76typedef struct {\r
77 UINT8 DriSelection[100];\r
78 UINT8 DriOrder[100];\r
79 UINT8 PciDeviceFilter;\r
80} PLAT_OVER_MNGR_DATA;\r
81\r
82#define FORM_ID_DEVICE 0x1234\r
83#define FORM_ID_DRIVER 0x1200\r
84#define FORM_ID_ORDER 0x1500\r
85\r
86#define KEY_VALUE_DEVICE_OFFSET 0x0100\r
87#define KEY_VALUE_DEVICE_MAX 0x04ff\r
88\r
89#define QUESTION_ID_OFFSET 0x0500\r
90\r
91#define KEY_VALUE_DEVICE_REFRESH 0x1234\r
92#define KEY_VALUE_DEVICE_FILTER 0x1235\r
93#define KEY_VALUE_DEVICE_CLEAR 0x1236\r
94\r
95#define KEY_VALUE_DRIVER_GOTO_PREVIOUS 0x1300\r
96#define KEY_VALUE_DRIVER_GOTO_ORDER 0x1301\r
97\r
98#define KEY_VALUE_ORDER_GOTO_PREVIOUS 0x2000\r
99#define KEY_VALUE_ORDER_SAVE_AND_EXIT 0x1800\r
100\r
101#define VARSTORE_ID_PLAT_OVER_MNGR 0x1000\r
102\r
103//\r
104// Question Id start from 1, so define an offset for it\r
105//\r
106#define VAR_OFFSET(Field) ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))\r
107\r
108#define DRIVER_SELECTION_VAR_OFFSET (VAR_OFFSET (DriSelection))\r
109#define DRIVER_ORDER_VAR_OFFSET (VAR_OFFSET (DriOrder))\r
110\r
111#define DRIVER_SELECTION_QUESTION_ID (VAR_OFFSET (DriSelection) + QUESTION_ID_OFFSET)\r
112#define DRIVER_ORDER_QUESTION_ID (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)\r
113\r
114typedef struct {\r
115 UINTN Signature;\r
116\r
117 EFI_HANDLE DriverHandle;\r
118 EFI_HII_HANDLE RegisteredHandle;\r
119 PLAT_OVER_MNGR_DATA FakeNvData;\r
120\r
121 EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
122\r
123 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
124} EFI_CALLBACK_INFO;\r
125\r
126typedef struct {\r
127 EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration;\r
128 EFI_HANDLE DriverImageHandle;\r
129 EFI_HANDLE ControllerHandle;\r
130 EFI_HANDLE ChildControllerHandle;\r
131 //\r
132 // To avoid created string leak in Hii database, use this token to reuse every token created by the driver\r
133 //\r
134 EFI_STRING_ID DescriptionToken;\r
135} CFG_PROTOCOL_INVOKER_CHOICE;\r
136\r
cebc8d48
LG
137/**\r
138 This function allows a caller to extract the current configuration for one\r
139 or more named elements from the target driver.\r
140\r
141 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
142 @param Request A null-terminated Unicode string in <ConfigRequest> format.\r
143 @param Progress On return, points to a character in the Request string.\r
144 Points to the string's null terminator if request was successful.\r
145 Points to the most recent '&' before the first failing name/value\r
146 pair (or the beginning of the string if the failure is in the\r
147 first name/value pair) if the request was not successful.\r
148 @param Results A null-terminated Unicode string in <ConfigAltResp> format which\r
149 has all values filled in for the names in the Request string.\r
150 String to be allocated by the called function.\r
151\r
152 @retval EFI_SUCCESS The Results is filled with the requested values.\r
153 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
154 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
155 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
156\r
157**/\r
a6f164a7 158EFI_STATUS\r
159EFIAPI\r
160PlatOverMngrExtractConfig (\r
cebc8d48 161 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
a6f164a7 162 IN CONST EFI_STRING Request,\r
163 OUT EFI_STRING *Progress,\r
164 OUT EFI_STRING *Results\r
165 );\r
166\r
cebc8d48
LG
167/**\r
168 This function processes the results of changes in configuration.\r
169\r
170 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
171 @param Configuration A null-terminated Unicode string in <ConfigRequest> format.\r
172 @param Progress A pointer to a string filled in with the offset of the most\r
173 recent '&' before the first failing name/value pair (or the\r
174 beginning of the string if the failure is in the first\r
175 name/value pair) or the terminating NULL if all was successful.\r
176\r
177 @retval EFI_SUCCESS The Results is processed successfully.\r
178 @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
179 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
180\r
181**/\r
a6f164a7 182EFI_STATUS\r
183EFIAPI\r
184PlatOverMngrRouteConfig (\r
185 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
186 IN CONST EFI_STRING Configuration,\r
187 OUT EFI_STRING *Progress\r
188 );\r
189\r
cebc8d48
LG
190/**\r
191 This is the function that is called to provide results data to the driver. This data\r
192 consists of a unique key which is used to identify what data is either being passed back\r
193 or being asked for.\r
194\r
195 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
196 @param Action A null-terminated Unicode string in <ConfigRequest> format.\r
197 @param KeyValue A unique Goto OpCode callback value which record user's selection.\r
198 0x100 <= KeyValue <0x500 : user select a controller item in the first page;\r
199 KeyValue == 0x1234 : user select 'Refresh' in first page, or user select 'Go to Previous Menu' in second page\r
200 KeyValue == 0x1235 : user select 'Pci device filter' in first page\r
201 KeyValue == 0x1500 : user select 'order ... priority' item in second page\r
202 KeyValue == 0x1800 : user select 'commint changes' in third page\r
203 KeyValue == 0x2000 : user select 'Go to Previous Menu' in third page\r
204 @param Type The type of value for the question.\r
205 @param Value A pointer to the data being sent to the original exporting driver.\r
206 @param ActionRequest On return, points to the action requested by the callback function.\r
207\r
208 @retval EFI_SUCCESS Always returned.\r
209\r
210**/\r
a6f164a7 211EFI_STATUS\r
212EFIAPI\r
213PlatOverMngrCallback (\r
214 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
215 IN EFI_BROWSER_ACTION Action,\r
216 IN EFI_QUESTION_ID KeyValue,\r
217 IN UINT8 Type,\r
218 IN EFI_IFR_TYPE_VALUE *Value,\r
219 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
220 );\r
221\r
cebc8d48
LG
222/**\r
223 Get the image name\r
224\r
225 @param Image Image to search.\r
226\r
227 @retval !NULL Pointer into the image name if the image name is found,\r
228 @retval NULL Pointer to NULL if the image name is not found.\r
229\r
230**/\r
a6f164a7 231CHAR16 *\r
232GetImageName (\r
cebc8d48 233 IN EFI_LOADED_IMAGE_PROTOCOL *Image\r
a6f164a7 234 );\r
235\r
cebc8d48
LG
236/**\r
237 Get the description string by device path.\r
238\r
239 @param DevPath The input device path.\r
240\r
241 @retval !NULL The description string retured.\r
242 @retval NULL The description string cannot be found.\r
243\r
244**/\r
245CHAR16 *\r
a6f164a7 246DevicePathToStr (\r
cebc8d48 247 IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
a6f164a7 248 );\r
249\r
a6f164a7 250#endif\r