]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.h
MdeModulePkg/DeviceManagerUiLib: connect all before creating menu page
[mirror_edk2.git] / MdeModulePkg / Library / DeviceManagerUiLib / DeviceManager.h
CommitLineData
32465d9a
DB
1/** @file\r
2The device manager reference implement\r
3\r
4Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
32465d9a
DB
6\r
7**/\r
8\r
9#ifndef _DEVICE_MANAGER_H_\r
10#define _DEVICE_MANAGER_H_\r
11\r
12#include <Guid/MdeModuleHii.h>\r
13#include <Guid/HiiPlatformSetupFormset.h>\r
14\r
15#include <Protocol/HiiConfigAccess.h>\r
16#include <Protocol/PciIo.h>\r
17\r
18#include <Library/PrintLib.h>\r
19#include <Library/DebugLib.h>\r
20#include <Library/BaseMemoryLib.h>\r
21#include <Library/UefiBootServicesTableLib.h>\r
22#include <Library/MemoryAllocationLib.h>\r
23#include <Library/BaseLib.h>\r
24#include <Library/HiiLib.h>\r
25#include <Library/DevicePathLib.h>\r
13406bde 26#include <Library/UefiBootManagerLib.h>\r
32465d9a
DB
27#include <Library/UefiHiiServicesLib.h>\r
28\r
29//\r
30// These are defined as the same with vfr file\r
31//\r
32#define DEVICE_MANAGER_FORMSET_GUID \\r
33 { \\r
34 0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \\r
35 }\r
36\r
37#define LABEL_END 0xffff\r
38#define LABEL_FORM_ID_OFFSET 0x0100\r
39\r
40#define DEVICE_MANAGER_FORM_ID 0x1000\r
41#define NETWORK_DEVICE_LIST_FORM_ID 0x1001\r
42#define NETWORK_DEVICE_FORM_ID 0x1002\r
43#define DEVICE_KEY_OFFSET 0x4000\r
44#define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000\r
45\r
46#define MAX_KEY_SECTION_LEN 0x1000\r
47\r
48#define QUESTION_NETWORK_DEVICE_ID 0x3FFF\r
49//\r
50// These are the VFR compiler generated data representing our VFR data.\r
51//\r
52extern UINT8 DeviceManagerVfrBin[];\r
53\r
54#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')\r
55\r
56///\r
57/// HII specific Vendor Device Path definition.\r
58///\r
59typedef struct {\r
60 VENDOR_DEVICE_PATH VendorDevicePath;\r
61 EFI_DEVICE_PATH_PROTOCOL End;\r
62} HII_VENDOR_DEVICE_PATH;\r
63\r
64typedef struct {\r
65 UINTN Signature;\r
66\r
67 ///\r
68 /// Device Manager HII relative handles\r
69 ///\r
70 EFI_HII_HANDLE HiiHandle;\r
71\r
72 EFI_HANDLE DriverHandle;\r
73\r
74 ///\r
75 /// Device Manager Produced protocols\r
76 ///\r
77 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
78\r
79 ///\r
80 /// Configuration data\r
81 ///\r
82 UINT8 VideoBios;\r
83} DEVICE_MANAGER_CALLBACK_DATA;\r
84\r
85typedef struct {\r
86 EFI_STRING_ID PromptId;\r
87 EFI_QUESTION_ID QuestionId;\r
88}MENU_INFO_ITEM;\r
89\r
90typedef struct {\r
91 UINTN CurListLen;\r
92 UINTN MaxListLen;\r
93 MENU_INFO_ITEM *NodeList;\r
94} MAC_ADDRESS_NODE_LIST;\r
95\r
96#define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \\r
97 CR (a, \\r
98 DEVICE_MANAGER_CALLBACK_DATA, \\r
99 ConfigAccess, \\r
100 DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \\r
101 )\r
102typedef struct {\r
103 EFI_STRING_ID StringId;\r
104 UINT16 Class;\r
105} DEVICE_MANAGER_MENU_ITEM;\r
106\r
107/**\r
108 This function allows a caller to extract the current configuration for one\r
109 or more named elements from the target driver.\r
110\r
111\r
112 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
113 @param Request A null-terminated Unicode string in <ConfigRequest> format.\r
114 @param Progress On return, points to a character in the Request string.\r
115 Points to the string's null terminator if request was successful.\r
116 Points to the most recent '&' before the first failing name/value\r
117 pair (or the beginning of the string if the failure is in the\r
118 first name/value pair) if the request was not successful.\r
119 @param Results A null-terminated Unicode string in <ConfigAltResp> format which\r
120 has all values filled in for the names in the Request string.\r
121 String to be allocated by the called function.\r
122\r
123 @retval EFI_SUCCESS The Results is filled with the requested values.\r
124 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
125 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
126 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
127\r
128**/\r
129EFI_STATUS\r
130EFIAPI\r
131DeviceManagerExtractConfig (\r
132 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
133 IN CONST EFI_STRING Request,\r
134 OUT EFI_STRING *Progress,\r
135 OUT EFI_STRING *Results\r
136 );\r
137\r
138/**\r
139 This function processes the results of changes in configuration.\r
140\r
141\r
142 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
143 @param Configuration A null-terminated Unicode string in <ConfigResp> format.\r
144 @param Progress A pointer to a string filled in with the offset of the most\r
145 recent '&' before the first failing name/value pair (or the\r
146 beginning of the string if the failure is in the first\r
147 name/value pair) or the terminating NULL if all was successful.\r
148\r
149 @retval EFI_SUCCESS The Results is processed successfully.\r
150 @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
151 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
152\r
153**/\r
154EFI_STATUS\r
155EFIAPI\r
156DeviceManagerRouteConfig (\r
157 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
158 IN CONST EFI_STRING Configuration,\r
159 OUT EFI_STRING *Progress\r
160 );\r
161\r
162/**\r
163 This function is invoked if user selected a interactive opcode from Device Manager's\r
164 Formset. If user set VBIOS, the new value is saved to EFI variable.\r
165\r
166 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
167 @param Action Specifies the type of action taken by the browser.\r
168 @param QuestionId A unique value which is sent to the original exporting driver\r
169 so that it can identify the type of data to expect.\r
170 @param Type The type of value for the question.\r
171 @param Value A pointer to the data being sent to the original exporting driver.\r
172 @param ActionRequest On return, points to the action requested by the callback function.\r
173\r
174 @retval EFI_SUCCESS The callback successfully handled the action.\r
175 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
176\r
177**/\r
178EFI_STATUS\r
179EFIAPI\r
180DeviceManagerCallback (\r
181 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
182 IN EFI_BROWSER_ACTION Action,\r
183 IN EFI_QUESTION_ID QuestionId,\r
184 IN UINT8 Type,\r
185 IN EFI_IFR_TYPE_VALUE *Value,\r
186 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
187 );\r
188\r
189#endif\r