1 | /** @file
|
---|
2 | The device manager reference implement
|
---|
3 |
|
---|
4 | Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _DEVICE_MANAGER_H_
|
---|
10 | #define _DEVICE_MANAGER_H_
|
---|
11 |
|
---|
12 | #include <Guid/MdeModuleHii.h>
|
---|
13 | #include <Guid/HiiPlatformSetupFormset.h>
|
---|
14 |
|
---|
15 | #include <Protocol/HiiConfigAccess.h>
|
---|
16 | #include <Protocol/PciIo.h>
|
---|
17 |
|
---|
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>
|
---|
27 |
|
---|
28 | //
|
---|
29 | // These are defined as the same with vfr file
|
---|
30 | //
|
---|
31 | #define DEVICE_MANAGER_FORMSET_GUID \
|
---|
32 | { \
|
---|
33 | 0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \
|
---|
34 | }
|
---|
35 |
|
---|
36 | #define LABEL_END 0xffff
|
---|
37 | #define LABEL_FORM_ID_OFFSET 0x0100
|
---|
38 |
|
---|
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
|
---|
44 |
|
---|
45 | #define MAX_KEY_SECTION_LEN 0x1000
|
---|
46 |
|
---|
47 | #define QUESTION_NETWORK_DEVICE_ID 0x3FFF
|
---|
48 | //
|
---|
49 | // These are the VFR compiler generated data representing our VFR data.
|
---|
50 | //
|
---|
51 | extern UINT8 DeviceManagerVfrBin[];
|
---|
52 |
|
---|
53 | #define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')
|
---|
54 |
|
---|
55 | ///
|
---|
56 | /// HII specific Vendor Device Path definition.
|
---|
57 | ///
|
---|
58 | typedef struct {
|
---|
59 | VENDOR_DEVICE_PATH VendorDevicePath;
|
---|
60 | EFI_DEVICE_PATH_PROTOCOL End;
|
---|
61 | } HII_VENDOR_DEVICE_PATH;
|
---|
62 |
|
---|
63 | typedef struct {
|
---|
64 | UINTN Signature;
|
---|
65 |
|
---|
66 | ///
|
---|
67 | /// Device Manager HII relative handles
|
---|
68 | ///
|
---|
69 | EFI_HII_HANDLE HiiHandle;
|
---|
70 |
|
---|
71 | EFI_HANDLE DriverHandle;
|
---|
72 |
|
---|
73 | ///
|
---|
74 | /// Device Manager Produced protocols
|
---|
75 | ///
|
---|
76 | EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
---|
77 |
|
---|
78 | ///
|
---|
79 | /// Configuration data
|
---|
80 | ///
|
---|
81 | UINT8 VideoBios;
|
---|
82 | } DEVICE_MANAGER_CALLBACK_DATA;
|
---|
83 |
|
---|
84 | typedef struct {
|
---|
85 | EFI_STRING_ID PromptId;
|
---|
86 | EFI_QUESTION_ID QuestionId;
|
---|
87 | }MENU_INFO_ITEM;
|
---|
88 |
|
---|
89 | typedef struct {
|
---|
90 | UINTN CurListLen;
|
---|
91 | UINTN MaxListLen;
|
---|
92 | MENU_INFO_ITEM *NodeList;
|
---|
93 | } MAC_ADDRESS_NODE_LIST;
|
---|
94 |
|
---|
95 | #define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \
|
---|
96 | CR (a, \
|
---|
97 | DEVICE_MANAGER_CALLBACK_DATA, \
|
---|
98 | ConfigAccess, \
|
---|
99 | DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \
|
---|
100 | )
|
---|
101 | typedef struct {
|
---|
102 | EFI_STRING_ID StringId;
|
---|
103 | UINT16 Class;
|
---|
104 | } DEVICE_MANAGER_MENU_ITEM;
|
---|
105 |
|
---|
106 | /**
|
---|
107 | This function allows a caller to extract the current configuration for one
|
---|
108 | or more named elements from the target driver.
|
---|
109 |
|
---|
110 |
|
---|
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.
|
---|
121 |
|
---|
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.
|
---|
126 |
|
---|
127 | **/
|
---|
128 | EFI_STATUS
|
---|
129 | EFIAPI
|
---|
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
|
---|
135 | );
|
---|
136 |
|
---|
137 | /**
|
---|
138 | This function processes the results of changes in configuration.
|
---|
139 |
|
---|
140 |
|
---|
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.
|
---|
147 |
|
---|
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.
|
---|
151 |
|
---|
152 | **/
|
---|
153 | EFI_STATUS
|
---|
154 | EFIAPI
|
---|
155 | DeviceManagerRouteConfig (
|
---|
156 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
157 | IN CONST EFI_STRING Configuration,
|
---|
158 | OUT EFI_STRING *Progress
|
---|
159 | );
|
---|
160 |
|
---|
161 | /**
|
---|
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.
|
---|
164 |
|
---|
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.
|
---|
172 |
|
---|
173 | @retval EFI_SUCCESS The callback successfully handled the action.
|
---|
174 | @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
|
---|
175 |
|
---|
176 | **/
|
---|
177 | EFI_STATUS
|
---|
178 | EFIAPI
|
---|
179 | DeviceManagerCallback (
|
---|
180 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
---|
181 | IN EFI_BROWSER_ACTION Action,
|
---|
182 | IN EFI_QUESTION_ID QuestionId,
|
---|
183 | IN UINT8 Type,
|
---|
184 | IN EFI_IFR_TYPE_VALUE *Value,
|
---|
185 | OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
---|
186 | );
|
---|
187 |
|
---|
188 | #endif
|
---|