LegacyBootMaintUi.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /** @file
  2. Legacy boot maintenance Ui definition.
  3. Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _EFI_LEGACY_BOOT_OPTION_H_
  7. #define _EFI_LEGACY_BOOT_OPTION_H_
  8. #include <PiDxe.h>
  9. #include <Guid/GlobalVariable.h>
  10. #include <Guid/LegacyDevOrder.h>
  11. #include <Guid/MdeModuleHii.h>
  12. #include <Protocol/HiiConfigAccess.h>
  13. #include <Protocol/HiiConfigRouting.h>
  14. #include <Protocol/HiiDatabase.h>
  15. #include <Protocol/LegacyBios.h>
  16. #include <Library/UefiDriverEntryPoint.h>
  17. #include <Library/UefiBootServicesTableLib.h>
  18. #include <Library/UefiRuntimeServicesTableLib.h>
  19. #include <Library/BaseLib.h>
  20. #include <Library/DevicePathLib.h>
  21. #include <Library/DebugLib.h>
  22. #include <Library/HiiLib.h>
  23. #include <Library/UefiBootManagerLib.h>
  24. #include <Library/MemoryAllocationLib.h>
  25. #include <Library/UefiLib.h>
  26. #include <Library/PrintLib.h>
  27. #include <Library/BaseMemoryLib.h>
  28. #include "LegacyBootMaintUiVfr.h"
  29. #define CONFIG_OPTION_OFFSET 0x1200
  30. //
  31. // VarOffset that will be used to create question
  32. // all these values are computed from the structure
  33. // defined below
  34. //
  35. #define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))
  36. //
  37. // Question Id of Zero is invalid, so add an offset to it
  38. //
  39. #define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)
  40. #define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
  41. #define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
  42. #define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
  43. #define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
  44. #define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
  45. //
  46. // String Constant
  47. //
  48. #define STR_FLOPPY L"Floppy Drive #%02x"
  49. #define STR_HARDDISK L"HardDisk Drive #%02x"
  50. #define STR_CDROM L"ATAPI CDROM Drive #%02x"
  51. #define STR_NET L"NET Drive #%02x"
  52. #define STR_BEV L"BEV Drive #%02x"
  53. #define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"
  54. #define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"
  55. #define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"
  56. #define STR_NET_HELP L"NET Drive #%02x"
  57. #define STR_BEV_HELP L"BEV Drive #%02x"
  58. #define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"
  59. #define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"
  60. #define STR_CDROM_TITLE L"Set Legacy CDROM Drive Order"
  61. #define STR_NET_TITLE L"Set Legacy NET Drive Order"
  62. #define STR_BEV_TITLE L"Set Legacy BEV Drive Order"
  63. //
  64. // These are the VFR compiler generated data representing our VFR data.
  65. //
  66. extern UINT8 LegacyBootMaintUiVfrBin[];
  67. #pragma pack(1)
  68. ///
  69. /// HII specific Vendor Device Path definition.
  70. ///
  71. typedef struct {
  72. VENDOR_DEVICE_PATH VendorDevicePath;
  73. EFI_DEVICE_PATH_PROTOCOL End;
  74. } HII_VENDOR_DEVICE_PATH;
  75. //
  76. // Variable created with this flag will be "Efi:...."
  77. //
  78. #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
  79. #define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')
  80. typedef struct {
  81. UINTN Signature;
  82. //
  83. // HII relative handles
  84. //
  85. EFI_HII_HANDLE HiiHandle;
  86. EFI_HANDLE DriverHandle;
  87. //
  88. // Produced protocols
  89. //
  90. EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
  91. //
  92. // Maintain the data.
  93. //
  94. LEGACY_BOOT_MAINTAIN_DATA *MaintainMapData;
  95. } LEGACY_BOOT_OPTION_CALLBACK_DATA;
  96. //
  97. // All of the signatures that will be used in list structure
  98. //
  99. #define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')
  100. #define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')
  101. #define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9
  102. typedef struct {
  103. UINTN Signature;
  104. LIST_ENTRY Head;
  105. UINTN MenuNumber;
  106. } LEGACY_MENU_OPTION;
  107. typedef struct {
  108. UINT16 BbsIndex;
  109. CHAR16 *Description;
  110. } LEGACY_DEVICE_CONTEXT;
  111. typedef struct {
  112. UINTN Signature;
  113. LIST_ENTRY Link;
  114. UINTN OptionNumber;
  115. UINT16 *DisplayString;
  116. UINT16 *HelpString;
  117. EFI_STRING_ID DisplayStringToken;
  118. EFI_STRING_ID HelpStringToken;
  119. VOID *VariableContext;
  120. } LEGACY_MENU_ENTRY;
  121. typedef struct {
  122. UINT16 BbsIndex;
  123. } LEGACY_BOOT_OPTION_BBS_DATA;
  124. #pragma pack()
  125. /**
  126. This call back function is registered with Boot Manager formset.
  127. When user selects a boot option, this call back function will
  128. be triggered. The boot option is saved for later processing.
  129. @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
  130. @param Action Specifies the type of action taken by the browser.
  131. @param QuestionId A unique value which is sent to the original exporting driver
  132. so that it can identify the type of data to expect.
  133. @param Type The type of value for the question.
  134. @param Value A pointer to the data being sent to the original exporting driver.
  135. @param ActionRequest On return, points to the action requested by the callback function.
  136. @retval EFI_SUCCESS The callback successfully handled the action.
  137. @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
  138. **/
  139. EFI_STATUS
  140. EFIAPI
  141. LegacyBootOptionCallback (
  142. IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
  143. IN EFI_BROWSER_ACTION Action,
  144. IN EFI_QUESTION_ID QuestionId,
  145. IN UINT8 Type,
  146. IN EFI_IFR_TYPE_VALUE *Value,
  147. OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
  148. );
  149. /**
  150. This function allows a caller to extract the current configuration for one
  151. or more named elements from the target driver.
  152. @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
  153. @param Request - A null-terminated Unicode string in <ConfigRequest> format.
  154. @param Progress - On return, points to a character in the Request string.
  155. Points to the string's null terminator if request was successful.
  156. Points to the most recent '&' before the first failing name/value
  157. pair (or the beginning of the string if the failure is in the
  158. first name/value pair) if the request was not successful.
  159. @param Results - A null-terminated Unicode string in <ConfigAltResp> format which
  160. has all values filled in for the names in the Request string.
  161. String to be allocated by the called function.
  162. @retval EFI_SUCCESS The Results is filled with the requested values.
  163. @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
  164. @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
  165. @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
  166. **/
  167. EFI_STATUS
  168. EFIAPI
  169. LegacyBootOptionExtractConfig (
  170. IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
  171. IN CONST EFI_STRING Request,
  172. OUT EFI_STRING *Progress,
  173. OUT EFI_STRING *Results
  174. );
  175. /**
  176. This function processes the results of changes in configuration.
  177. @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
  178. @param Configuration - A null-terminated Unicode string in <ConfigResp> format.
  179. @param Progress - A pointer to a string filled in with the offset of the most
  180. recent '&' before the first failing name/value pair (or the
  181. beginning of the string if the failure is in the first
  182. name/value pair) or the terminating NULL if all was successful.
  183. @retval EFI_SUCCESS The Results is processed successfully.
  184. @retval EFI_INVALID_PARAMETER Configuration is NULL.
  185. @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
  186. **/
  187. EFI_STATUS
  188. EFIAPI
  189. LegacyBootOptionRouteConfig (
  190. IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
  191. IN CONST EFI_STRING Configuration,
  192. OUT EFI_STRING *Progress
  193. );
  194. #endif