--- /dev/null
+/** @file\r
+ Legacy boot maintainence Ui definition.\r
+\r
+Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+\r
+#ifndef _EFI_LEGACY_BOOT_OPTION_H_\r
+#define _EFI_LEGACY_BOOT_OPTION_H_\r
+\r
+#include <PiDxe.h>\r
+\r
+\r
+#include <Guid/GlobalVariable.h>\r
+#include <Guid/LegacyDevOrder.h>\r
+#include <Guid/MdeModuleHii.h>\r
+\r
+#include <Protocol/HiiConfigAccess.h>\r
+#include <Protocol/HiiConfigRouting.h>\r
+\r
+#include <Protocol/HiiDatabase.h>\r
+#include <Protocol/LegacyBios.h>\r
+\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/UefiBootManagerLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+\r
+#include "LegacyBootMaintUiVfr.h"\r
+\r
+#define CONFIG_OPTION_OFFSET 0x1200\r
+\r
+//\r
+// VarOffset that will be used to create question\r
+// all these values are computed from the structure\r
+// defined below\r
+//\r
+#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((LEGACY_BOOT_NV_DATA *) 0)->Field)))\r
+\r
+//\r
+// Question Id of Zero is invalid, so add an offset to it\r
+//\r
+#define QUESTION_ID(Field) (VAR_OFFSET (Field) + CONFIG_OPTION_OFFSET)\r
+\r
+\r
+#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)\r
+#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)\r
+#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)\r
+#define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)\r
+#define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)\r
+\r
+\r
+//\r
+// String Contant\r
+//\r
+#define STR_FLOPPY L"Floppy Drive #%02x"\r
+#define STR_HARDDISK L"HardDisk Drive #%02x"\r
+#define STR_CDROM L"ATAPI CDROM Drive #%02x"\r
+#define STR_NET L"NET Drive #%02x"\r
+#define STR_BEV L"BEV Drive #%02x"\r
+\r
+#define STR_FLOPPY_HELP L"Select Floppy Drive #%02x"\r
+#define STR_HARDDISK_HELP L"Select HardDisk Drive #%02x"\r
+#define STR_CDROM_HELP L"Select ATAPI CDROM Drive #%02x"\r
+#define STR_NET_HELP L"NET Drive #%02x"\r
+#define STR_BEV_HELP L"BEV Drive #%02x"\r
+\r
+#define STR_FLOPPY_TITLE L"Set Legacy Floppy Drive Order"\r
+#define STR_HARDDISK_TITLE L"Set Legacy HardDisk Drive Order"\r
+#define STR_CDROM_TITLE L"Set Legacy CDROM Drive Order"\r
+#define STR_NET_TITLE L"Set Legacy NET Drive Order"\r
+#define STR_BEV_TITLE L"Set Legacy BEV Drive Order"\r
+\r
+//\r
+// These are the VFR compiler generated data representing our VFR data.\r
+//\r
+extern UINT8 LegacyBootMaintUiVfrBin[];\r
+\r
+#pragma pack(1)\r
+\r
+///\r
+/// HII specific Vendor Device Path definition.\r
+///\r
+typedef struct {\r
+ VENDOR_DEVICE_PATH VendorDevicePath;\r
+ EFI_DEVICE_PATH_PROTOCOL End;\r
+} HII_VENDOR_DEVICE_PATH;\r
+\r
+\r
+\r
+//\r
+// Variable created with this flag will be "Efi:...."\r
+//\r
+#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE\r
+\r
+\r
+#define LEGACY_BOOT_OPTION_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('L', 'G', 'C', 'B')\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+\r
+ //\r
+ // HII relative handles\r
+ //\r
+ EFI_HII_HANDLE HiiHandle;\r
+ EFI_HANDLE DriverHandle;\r
+\r
+ //\r
+ // Produced protocols\r
+ //\r
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
+\r
+ //\r
+ // Maintain the data.\r
+ //\r
+ LEGACY_BOOT_MAINTAIN_DATA *MaintainMapData;\r
+} LEGACY_BOOT_OPTION_CALLBACK_DATA;\r
+\r
+//\r
+// All of the signatures that will be used in list structure\r
+//\r
+#define LEGACY_MENU_OPTION_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u')\r
+#define LEGACY_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r')\r
+\r
+#define LEGACY_LEGACY_DEV_CONTEXT_SELECT 0x9\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+ LIST_ENTRY Head;\r
+ UINTN MenuNumber;\r
+} LEGACY_MENU_OPTION;\r
+\r
+typedef struct {\r
+ UINT16 BbsIndex;\r
+ CHAR16 *Description;\r
+} LEGACY_DEVICE_CONTEXT;\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+ UINTN OptionNumber;\r
+ UINT16 *DisplayString;\r
+ UINT16 *HelpString;\r
+ EFI_STRING_ID DisplayStringToken;\r
+ EFI_STRING_ID HelpStringToken;\r
+ VOID *VariableContext;\r
+} LEGACY_MENU_ENTRY;\r
+\r
+typedef struct {\r
+ UINT16 BbsIndex;\r
+} LEGACY_BOOT_OPTION_BBS_DATA;\r
+\r
+#pragma pack()\r
+\r
+/**\r
+ This call back function is registered with Boot Manager formset.\r
+ When user selects a boot option, this call back function will\r
+ be triggered. The boot option is saved for later processing.\r
+\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Action Specifies the type of action taken by the browser.\r
+ @param QuestionId A unique value which is sent to the original exporting driver\r
+ so that it can identify the type of data to expect.\r
+ @param Type The type of value for the question.\r
+ @param Value A pointer to the data being sent to the original exporting driver.\r
+ @param ActionRequest On return, points to the action requested by the callback function.\r
+\r
+ @retval EFI_SUCCESS The callback successfully handled the action.\r
+ @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LegacyBootOptionCallback (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN EFI_BROWSER_ACTION Action,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN UINT8 Type,\r
+ IN EFI_IFR_TYPE_VALUE *Value,\r
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
+ );\r
+\r
+/**\r
+ This function allows a caller to extract the current configuration for one\r
+ or more named elements from the target driver.\r
+\r
+\r
+ @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Request - A null-terminated Unicode string in <ConfigRequest> format.\r
+ @param Progress - On return, points to a character in the Request string.\r
+ Points to the string's null terminator if request was successful.\r
+ Points to the most recent '&' before the first failing name/value\r
+ pair (or the beginning of the string if the failure is in the\r
+ first name/value pair) if the request was not successful.\r
+ @param Results - A null-terminated Unicode string in <ConfigAltResp> format which\r
+ has all values filled in for the names in the Request string.\r
+ String to be allocated by the called function.\r
+\r
+ @retval EFI_SUCCESS The Results is filled with the requested values.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
+ @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LegacyBootOptionExtractConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Request,\r
+ OUT EFI_STRING *Progress,\r
+ OUT EFI_STRING *Results\r
+ );\r
+\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+\r
+ @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
+ @param Progress - A pointer to a string filled in with the offset of the most\r
+ recent '&' before the first failing name/value pair (or the\r
+ beginning of the string if the failure is in the first\r
+ name/value pair) or the terminating NULL if all was successful.\r
+\r
+ @retval EFI_SUCCESS The Results is processed successfully.\r
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LegacyBootOptionRouteConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Configuration,\r
+ OUT EFI_STRING *Progress\r
+ );\r
+\r
+#endif\r