2 The device manager reference implement
4 Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _DEVICE_MANAGER_H_
10 #define _DEVICE_MANAGER_H_
12 #include <Guid/MdeModuleHii.h>
13 #include <Guid/HiiPlatformSetupFormset.h>
15 #include <Protocol/HiiConfigAccess.h>
16 #include <Protocol/PciIo.h>
18 #include <Library/PrintLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/MemoryAllocationLib.h>
23 #include <Library/BaseLib.h>
24 #include <Library/HiiLib.h>
25 #include <Library/DevicePathLib.h>
26 #include <Library/UefiBootManagerLib.h>
27 #include <Library/UefiHiiServicesLib.h>
30 // These are defined as the same with vfr file
32 #define DEVICE_MANAGER_FORMSET_GUID \
34 0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \
37 #define LABEL_END 0xffff
38 #define LABEL_FORM_ID_OFFSET 0x0100
40 #define DEVICE_MANAGER_FORM_ID 0x1000
41 #define NETWORK_DEVICE_LIST_FORM_ID 0x1001
42 #define NETWORK_DEVICE_FORM_ID 0x1002
43 #define DEVICE_KEY_OFFSET 0x4000
44 #define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000
46 #define MAX_KEY_SECTION_LEN 0x1000
48 #define QUESTION_NETWORK_DEVICE_ID 0x3FFF
50 // These are the VFR compiler generated data representing our VFR data.
52 extern UINT8 DeviceManagerVfrBin
[];
54 #define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')
57 /// HII specific Vendor Device Path definition.
60 VENDOR_DEVICE_PATH VendorDevicePath
;
61 EFI_DEVICE_PATH_PROTOCOL End
;
62 } HII_VENDOR_DEVICE_PATH
;
68 /// Device Manager HII relative handles
70 EFI_HII_HANDLE HiiHandle
;
72 EFI_HANDLE DriverHandle
;
75 /// Device Manager Produced protocols
77 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
80 /// Configuration data
83 } DEVICE_MANAGER_CALLBACK_DATA
;
86 EFI_STRING_ID PromptId
;
87 EFI_QUESTION_ID QuestionId
;
93 MENU_INFO_ITEM
*NodeList
;
94 } MAC_ADDRESS_NODE_LIST
;
96 #define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \
98 DEVICE_MANAGER_CALLBACK_DATA, \
100 DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \
103 EFI_STRING_ID StringId
;
105 } DEVICE_MANAGER_MENU_ITEM
;
108 This function allows a caller to extract the current configuration for one
109 or more named elements from the target driver.
112 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
113 @param Request A null-terminated Unicode string in <ConfigRequest> format.
114 @param Progress On return, points to a character in the Request string.
115 Points to the string's null terminator if request was successful.
116 Points to the most recent '&' before the first failing name/value
117 pair (or the beginning of the string if the failure is in the
118 first name/value pair) if the request was not successful.
119 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
120 has all values filled in for the names in the Request string.
121 String to be allocated by the called function.
123 @retval EFI_SUCCESS The Results is filled with the requested values.
124 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
125 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
126 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
131 DeviceManagerExtractConfig (
132 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
133 IN CONST EFI_STRING Request
,
134 OUT EFI_STRING
*Progress
,
135 OUT EFI_STRING
*Results
139 This function processes the results of changes in configuration.
142 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
143 @param Configuration A null-terminated Unicode string in <ConfigResp> format.
144 @param Progress A pointer to a string filled in with the offset of the most
145 recent '&' before the first failing name/value pair (or the
146 beginning of the string if the failure is in the first
147 name/value pair) or the terminating NULL if all was successful.
149 @retval EFI_SUCCESS The Results is processed successfully.
150 @retval EFI_INVALID_PARAMETER Configuration is NULL.
151 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
156 DeviceManagerRouteConfig (
157 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
158 IN CONST EFI_STRING Configuration
,
159 OUT EFI_STRING
*Progress
163 This function is invoked if user selected a interactive opcode from Device Manager's
164 Formset. If user set VBIOS, the new value is saved to EFI variable.
166 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
167 @param Action Specifies the type of action taken by the browser.
168 @param QuestionId A unique value which is sent to the original exporting driver
169 so that it can identify the type of data to expect.
170 @param Type The type of value for the question.
171 @param Value A pointer to the data being sent to the original exporting driver.
172 @param ActionRequest On return, points to the action requested by the callback function.
174 @retval EFI_SUCCESS The callback successfully handled the action.
175 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
180 DeviceManagerCallback (
181 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
182 IN EFI_BROWSER_ACTION Action
,
183 IN EFI_QUESTION_ID QuestionId
,
185 IN EFI_IFR_TYPE_VALUE
*Value
,
186 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest