2 The boot manager reference implementation
4 Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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 _EFI_BOOT_MANAGER_H_
16 #define _EFI_BOOT_MANAGER_H_
18 #include <Guid/MdeModuleHii.h>
19 #include <Guid/GlobalVariable.h>
21 #include <Protocol/HiiConfigAccess.h>
22 #include <Protocol/DevicePathToText.h>
23 #include <Protocol/FormBrowserEx2.h>
25 #include <Library/PrintLib.h>
26 #include <Library/DebugLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/UefiLib.h>
30 #include <Library/MemoryAllocationLib.h>
31 #include <Library/UefiRuntimeServicesTableLib.h>
32 #include <Library/HiiLib.h>
33 #include <Library/DevicePathLib.h>
34 #include <Library/UefiBootManagerLib.h>
39 /// HII specific Vendor Device Path definition.
42 VENDOR_DEVICE_PATH VendorDevicePath
;
43 EFI_DEVICE_PATH_PROTOCOL End
;
44 } HII_VENDOR_DEVICE_PATH
;
48 // These are defined as the same with vfr file
50 #define BOOT_MANAGER_FORMSET_GUID \
52 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
55 #define BOOT_MANAGER_FORM_ID 0x1000
57 #define LABEL_BOOT_OPTION 0x00
58 #define LABEL_BOOT_OPTION_END 0x01
59 #define MAX_STRING_LEN 200
62 // Variable created with this flag will be "Efi:...."
64 #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
67 // These are the VFR compiler generated data representing our VFR data.
69 extern UINT8 BootManagerVfrBin
[];
71 #define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'M', 'C', 'B')
77 // HII relative handles
79 EFI_HII_HANDLE HiiHandle
;
80 EFI_HANDLE DriverHandle
;
85 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
86 } BOOT_MANAGER_CALLBACK_DATA
;
89 This call back function is registered with Boot Manager formset.
90 When user selects a boot option, this call back function will
91 be triggered. The boot option is saved for later processing.
94 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
95 @param Action Specifies the type of action taken by the browser.
96 @param QuestionId A unique value which is sent to the original exporting driver
97 so that it can identify the type of data to expect.
98 @param Type The type of value for the question.
99 @param Value A pointer to the data being sent to the original exporting driver.
100 @param ActionRequest On return, points to the action requested by the callback function.
102 @retval EFI_SUCCESS The callback successfully handled the action.
103 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
108 BootManagerCallback (
109 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
110 IN EFI_BROWSER_ACTION Action
,
111 IN EFI_QUESTION_ID QuestionId
,
113 IN EFI_IFR_TYPE_VALUE
*Value
,
114 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
118 This function allows a caller to extract the current configuration for one
119 or more named elements from the target driver.
122 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
123 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
124 @param Progress - On return, points to a character in the Request string.
125 Points to the string's null terminator if request was successful.
126 Points to the most recent '&' before the first failing name/value
127 pair (or the beginning of the string if the failure is in the
128 first name/value pair) if the request was not successful.
129 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
130 has all values filled in for the names in the Request string.
131 String to be allocated by the called function.
133 @retval EFI_SUCCESS The Results is filled with the requested values.
134 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
135 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
136 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
141 BootManagerExtractConfig (
142 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
143 IN CONST EFI_STRING Request
,
144 OUT EFI_STRING
*Progress
,
145 OUT EFI_STRING
*Results
149 This function processes the results of changes in configuration.
152 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
153 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
154 @param Progress - A pointer to a string filled in with the offset of the most
155 recent '&' before the first failing name/value pair (or the
156 beginning of the string if the failure is in the first
157 name/value pair) or the terminating NULL if all was successful.
159 @retval EFI_SUCCESS The Results is processed successfully.
160 @retval EFI_INVALID_PARAMETER Configuration is NULL.
161 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
166 BootManagerRouteConfig (
167 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
168 IN CONST EFI_STRING Configuration
,
169 OUT EFI_STRING
*Progress