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/UefiHiiServicesLib.h>
29 // These are defined as the same with vfr file
31 #define DEVICE_MANAGER_FORMSET_GUID \
33 0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \
36 #define LABEL_END 0xffff
37 #define LABEL_FORM_ID_OFFSET 0x0100
39 #define DEVICE_MANAGER_FORM_ID 0x1000
40 #define NETWORK_DEVICE_LIST_FORM_ID 0x1001
41 #define NETWORK_DEVICE_FORM_ID 0x1002
42 #define DEVICE_KEY_OFFSET 0x4000
43 #define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000
45 #define MAX_KEY_SECTION_LEN 0x1000
47 #define QUESTION_NETWORK_DEVICE_ID 0x3FFF
49 // These are the VFR compiler generated data representing our VFR data.
51 extern UINT8 DeviceManagerVfrBin
[];
53 #define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')
56 /// HII specific Vendor Device Path definition.
59 VENDOR_DEVICE_PATH VendorDevicePath
;
60 EFI_DEVICE_PATH_PROTOCOL End
;
61 } HII_VENDOR_DEVICE_PATH
;
67 /// Device Manager HII relative handles
69 EFI_HII_HANDLE HiiHandle
;
71 EFI_HANDLE DriverHandle
;
74 /// Device Manager Produced protocols
76 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
79 /// Configuration data
82 } DEVICE_MANAGER_CALLBACK_DATA
;
85 EFI_STRING_ID PromptId
;
86 EFI_QUESTION_ID QuestionId
;
92 MENU_INFO_ITEM
*NodeList
;
93 } MAC_ADDRESS_NODE_LIST
;
95 #define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \
97 DEVICE_MANAGER_CALLBACK_DATA, \
99 DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \
102 EFI_STRING_ID StringId
;
104 } DEVICE_MANAGER_MENU_ITEM
;
107 This function allows a caller to extract the current configuration for one
108 or more named elements from the target driver.
111 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
112 @param Request A null-terminated Unicode string in <ConfigRequest> format.
113 @param Progress On return, points to a character in the Request string.
114 Points to the string's null terminator if request was successful.
115 Points to the most recent '&' before the first failing name/value
116 pair (or the beginning of the string if the failure is in the
117 first name/value pair) if the request was not successful.
118 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
119 has all values filled in for the names in the Request string.
120 String to be allocated by the called function.
122 @retval EFI_SUCCESS The Results is filled with the requested values.
123 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
124 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
125 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
130 DeviceManagerExtractConfig (
131 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
132 IN CONST EFI_STRING Request
,
133 OUT EFI_STRING
*Progress
,
134 OUT EFI_STRING
*Results
138 This function processes the results of changes in configuration.
141 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
142 @param Configuration A null-terminated Unicode string in <ConfigResp> format.
143 @param Progress A pointer to a string filled in with the offset of the most
144 recent '&' before the first failing name/value pair (or the
145 beginning of the string if the failure is in the first
146 name/value pair) or the terminating NULL if all was successful.
148 @retval EFI_SUCCESS The Results is processed successfully.
149 @retval EFI_INVALID_PARAMETER Configuration is NULL.
150 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
155 DeviceManagerRouteConfig (
156 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
157 IN CONST EFI_STRING Configuration
,
158 OUT EFI_STRING
*Progress
162 This function is invoked if user selected a interactive opcode from Device Manager's
163 Formset. If user set VBIOS, the new value is saved to EFI variable.
165 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
166 @param Action Specifies the type of action taken by the browser.
167 @param QuestionId A unique value which is sent to the original exporting driver
168 so that it can identify the type of data to expect.
169 @param Type The type of value for the question.
170 @param Value A pointer to the data being sent to the original exporting driver.
171 @param ActionRequest On return, points to the action requested by the callback function.
173 @retval EFI_SUCCESS The callback successfully handled the action.
174 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
179 DeviceManagerCallback (
180 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
181 IN EFI_BROWSER_ACTION Action
,
182 IN EFI_QUESTION_ID QuestionId
,
184 IN EFI_IFR_TYPE_VALUE
*Value
,
185 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest