]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/BootManagerUiLib/BootManager.h
3adddf637f048921c7a9b0d932c5f3c1bed661b3
[mirror_edk2.git] / MdeModulePkg / Library / BootManagerUiLib / BootManager.h
1 /** @file
2 The boot manager reference implementation
3
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.
9
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.
12
13 **/
14
15 #ifndef _EFI_BOOT_MANAGER_H_
16 #define _EFI_BOOT_MANAGER_H_
17
18 #include <Guid/MdeModuleHii.h>
19 #include <Guid/GlobalVariable.h>
20
21 #include <Protocol/HiiConfigAccess.h>
22 #include <Protocol/DevicePathToText.h>
23 #include <Protocol/FormBrowserEx2.h>
24
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>
35
36 #pragma pack(1)
37
38 ///
39 /// HII specific Vendor Device Path definition.
40 ///
41 typedef struct {
42 VENDOR_DEVICE_PATH VendorDevicePath;
43 EFI_DEVICE_PATH_PROTOCOL End;
44 } HII_VENDOR_DEVICE_PATH;
45 #pragma pack()
46
47 //
48 // These are defined as the same with vfr file
49 //
50 #define BOOT_MANAGER_FORMSET_GUID \
51 { \
52 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
53 }
54
55 #define BOOT_MANAGER_FORM_ID 0x1000
56
57 #define LABEL_BOOT_OPTION 0x00
58 #define LABEL_BOOT_OPTION_END 0x01
59 #define MAX_STRING_LEN 200
60
61 //
62 // Variable created with this flag will be "Efi:...."
63 //
64 #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
65
66 //
67 // These are the VFR compiler generated data representing our VFR data.
68 //
69 extern UINT8 BootManagerVfrBin[];
70
71 #define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'M', 'C', 'B')
72
73 typedef struct {
74 UINTN Signature;
75
76 //
77 // HII relative handles
78 //
79 EFI_HII_HANDLE HiiHandle;
80 EFI_HANDLE DriverHandle;
81
82 //
83 // Produced protocols
84 //
85 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
86 } BOOT_MANAGER_CALLBACK_DATA;
87
88 /**
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.
92
93
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.
101
102 @retval EFI_SUCCESS The callback successfully handled the action.
103 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
104
105 **/
106 EFI_STATUS
107 EFIAPI
108 BootManagerCallback (
109 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
110 IN EFI_BROWSER_ACTION Action,
111 IN EFI_QUESTION_ID QuestionId,
112 IN UINT8 Type,
113 IN EFI_IFR_TYPE_VALUE *Value,
114 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
115 );
116
117 /**
118 This function allows a caller to extract the current configuration for one
119 or more named elements from the target driver.
120
121
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.
132
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.
137
138 **/
139 EFI_STATUS
140 EFIAPI
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
146 );
147
148 /**
149 This function processes the results of changes in configuration.
150
151
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.
158
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.
162
163 **/
164 EFI_STATUS
165 EFIAPI
166 BootManagerRouteConfig (
167 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
168 IN CONST EFI_STRING Configuration,
169 OUT EFI_STRING *Progress
170 );
171
172 #endif