2 The device manager reference implement
4 Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _DEVICE_MANAGER_H_
16 #define _DEVICE_MANAGER_H_
18 #include <Guid/MdeModuleHii.h>
19 #include <Guid/HiiPlatformSetupFormset.h>
21 #include <Protocol/HiiConfigAccess.h>
22 #include <Protocol/PciIo.h>
24 #include <Library/PrintLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/BaseMemoryLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/MemoryAllocationLib.h>
29 #include <Library/BaseLib.h>
30 #include <Library/HiiLib.h>
31 #include <Library/DevicePathLib.h>
32 #include <Library/UefiHiiServicesLib.h>
35 // These are defined as the same with vfr file
37 #define DEVICE_MANAGER_FORMSET_GUID \
39 0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \
42 #define LABEL_END 0xffff
43 #define LABEL_FORM_ID_OFFSET 0x0100
45 #define DEVICE_MANAGER_FORM_ID 0x1000
46 #define NETWORK_DEVICE_LIST_FORM_ID 0x1001
47 #define NETWORK_DEVICE_FORM_ID 0x1002
48 #define DEVICE_KEY_OFFSET 0x4000
49 #define NETWORK_DEVICE_LIST_KEY_OFFSET 0x2000
51 #define MAX_KEY_SECTION_LEN 0x1000
53 #define QUESTION_NETWORK_DEVICE_ID 0x3FFF
55 // These are the VFR compiler generated data representing our VFR data.
57 extern UINT8 DeviceManagerVfrBin
[];
59 #define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')
62 /// HII specific Vendor Device Path definition.
65 VENDOR_DEVICE_PATH VendorDevicePath
;
66 EFI_DEVICE_PATH_PROTOCOL End
;
67 } HII_VENDOR_DEVICE_PATH
;
73 /// Device Manager HII relative handles
75 EFI_HII_HANDLE HiiHandle
;
77 EFI_HANDLE DriverHandle
;
80 /// Device Manager Produced protocols
82 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
85 /// Configuration data
88 } DEVICE_MANAGER_CALLBACK_DATA
;
91 EFI_STRING_ID PromptId
;
92 EFI_QUESTION_ID QuestionId
;
98 MENU_INFO_ITEM
*NodeList
;
99 } MAC_ADDRESS_NODE_LIST
;
101 #define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \
103 DEVICE_MANAGER_CALLBACK_DATA, \
105 DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \
108 EFI_STRING_ID StringId
;
110 } DEVICE_MANAGER_MENU_ITEM
;
113 This function allows a caller to extract the current configuration for one
114 or more named elements from the target driver.
117 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
118 @param Request A null-terminated Unicode string in <ConfigRequest> format.
119 @param Progress On return, points to a character in the Request string.
120 Points to the string's null terminator if request was successful.
121 Points to the most recent '&' before the first failing name/value
122 pair (or the beginning of the string if the failure is in the
123 first name/value pair) if the request was not successful.
124 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
125 has all values filled in for the names in the Request string.
126 String to be allocated by the called function.
128 @retval EFI_SUCCESS The Results is filled with the requested values.
129 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
130 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
131 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
136 DeviceManagerExtractConfig (
137 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
138 IN CONST EFI_STRING Request
,
139 OUT EFI_STRING
*Progress
,
140 OUT EFI_STRING
*Results
144 This function processes the results of changes in configuration.
147 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
148 @param Configuration A null-terminated Unicode string in <ConfigResp> format.
149 @param Progress A pointer to a string filled in with the offset of the most
150 recent '&' before the first failing name/value pair (or the
151 beginning of the string if the failure is in the first
152 name/value pair) or the terminating NULL if all was successful.
154 @retval EFI_SUCCESS The Results is processed successfully.
155 @retval EFI_INVALID_PARAMETER Configuration is NULL.
156 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
161 DeviceManagerRouteConfig (
162 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
163 IN CONST EFI_STRING Configuration
,
164 OUT EFI_STRING
*Progress
168 This function is invoked if user selected a interactive opcode from Device Manager's
169 Formset. If user set VBIOS, the new value is saved to EFI variable.
171 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
172 @param Action Specifies the type of action taken by the browser.
173 @param QuestionId A unique value which is sent to the original exporting driver
174 so that it can identify the type of data to expect.
175 @param Type The type of value for the question.
176 @param Value A pointer to the data being sent to the original exporting driver.
177 @param ActionRequest On return, points to the action requested by the callback function.
179 @retval EFI_SUCCESS The callback successfully handled the action.
180 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
185 DeviceManagerCallback (
186 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
187 IN EFI_BROWSER_ACTION Action
,
188 IN EFI_QUESTION_ID QuestionId
,
190 IN EFI_IFR_TYPE_VALUE
*Value
,
191 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest