]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/BootManagerUiLib/BootManager.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[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 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _EFI_BOOT_MANAGER_H_
10 #define _EFI_BOOT_MANAGER_H_
11
12 #include <Guid/MdeModuleHii.h>
13 #include <Guid/GlobalVariable.h>
14
15 #include <Protocol/HiiConfigAccess.h>
16 #include <Protocol/DevicePathToText.h>
17 #include <Protocol/FormBrowserEx2.h>
18
19 #include <Library/PrintLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Library/UefiLib.h>
24 #include <Library/MemoryAllocationLib.h>
25 #include <Library/UefiRuntimeServicesTableLib.h>
26 #include <Library/HiiLib.h>
27 #include <Library/DevicePathLib.h>
28 #include <Library/UefiBootManagerLib.h>
29
30 #pragma pack(1)
31
32 ///
33 /// HII specific Vendor Device Path definition.
34 ///
35 typedef struct {
36 VENDOR_DEVICE_PATH VendorDevicePath;
37 EFI_DEVICE_PATH_PROTOCOL End;
38 } HII_VENDOR_DEVICE_PATH;
39 #pragma pack()
40
41 //
42 // These are defined as the same with vfr file
43 //
44 #define BOOT_MANAGER_FORMSET_GUID \
45 { \
46 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
47 }
48
49 #define BOOT_MANAGER_FORM_ID 0x1000
50
51 #define LABEL_BOOT_OPTION 0x00
52 #define LABEL_BOOT_OPTION_END 0x01
53 #define MAX_STRING_LEN 200
54
55 //
56 // Variable created with this flag will be "Efi:...."
57 //
58 #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
59
60 //
61 // These are the VFR compiler generated data representing our VFR data.
62 //
63 extern UINT8 BootManagerVfrBin[];
64
65 #define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'M', 'C', 'B')
66
67 typedef struct {
68 UINTN Signature;
69
70 //
71 // HII relative handles
72 //
73 EFI_HII_HANDLE HiiHandle;
74 EFI_HANDLE DriverHandle;
75
76 //
77 // Produced protocols
78 //
79 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
80 } BOOT_MANAGER_CALLBACK_DATA;
81
82 /**
83 This call back function is registered with Boot Manager formset.
84 When user selects a boot option, this call back function will
85 be triggered. The boot option is saved for later processing.
86
87
88 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
89 @param Action Specifies the type of action taken by the browser.
90 @param QuestionId A unique value which is sent to the original exporting driver
91 so that it can identify the type of data to expect.
92 @param Type The type of value for the question.
93 @param Value A pointer to the data being sent to the original exporting driver.
94 @param ActionRequest On return, points to the action requested by the callback function.
95
96 @retval EFI_SUCCESS The callback successfully handled the action.
97 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
98
99 **/
100 EFI_STATUS
101 EFIAPI
102 BootManagerCallback (
103 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
104 IN EFI_BROWSER_ACTION Action,
105 IN EFI_QUESTION_ID QuestionId,
106 IN UINT8 Type,
107 IN EFI_IFR_TYPE_VALUE *Value,
108 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
109 );
110
111 /**
112 This function allows a caller to extract the current configuration for one
113 or more named elements from the target driver.
114
115
116 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
117 @param Request - A null-terminated Unicode string in <ConfigRequest> format.
118 @param Progress - On return, points to a character in the Request string.
119 Points to the string's null terminator if request was successful.
120 Points to the most recent '&' before the first failing name/value
121 pair (or the beginning of the string if the failure is in the
122 first name/value pair) if the request was not successful.
123 @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
124 has all values filled in for the names in the Request string.
125 String to be allocated by the called function.
126
127 @retval EFI_SUCCESS The Results is filled with the requested values.
128 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
129 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
130 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
131
132 **/
133 EFI_STATUS
134 EFIAPI
135 BootManagerExtractConfig (
136 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
137 IN CONST EFI_STRING Request,
138 OUT EFI_STRING *Progress,
139 OUT EFI_STRING *Results
140 );
141
142 /**
143 This function processes the results of changes in configuration.
144
145
146 @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
147 @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
148 @param Progress - A pointer to a string filled in with the offset of the most
149 recent '&' before the first failing name/value pair (or the
150 beginning of the string if the failure is in the first
151 name/value pair) or the terminating NULL if all was successful.
152
153 @retval EFI_SUCCESS The Results is processed successfully.
154 @retval EFI_INVALID_PARAMETER Configuration is NULL.
155 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
156
157 **/
158 EFI_STATUS
159 EFIAPI
160 BootManagerRouteConfig (
161 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
162 IN CONST EFI_STRING Configuration,
163 OUT EFI_STRING *Progress
164 );
165
166 #endif