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