]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkNt32Pkg/Include/Library/EdkGenericBdsLib.h
rename library to Library
[mirror_edk2.git] / EdkNt32Pkg / Include / Library / EdkGenericBdsLib.h
diff --git a/EdkNt32Pkg/Include/Library/EdkGenericBdsLib.h b/EdkNt32Pkg/Include/Library/EdkGenericBdsLib.h
new file mode 100644 (file)
index 0000000..9abda55
--- /dev/null
@@ -0,0 +1,382 @@
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  BdsLib.h\r
+\r
+Abstract:\r
+\r
+  BDS library definition, include the file and data structure\r
+\r
+--*/\r
+\r
+#ifndef _BDS_LIB_H_\r
+#define _BDS_LIB_H_\r
+\r
+extern EFI_HANDLE mBdsImageHandle;\r
+\r
+//\r
+// Constants which are variable names used to access variables\r
+//\r
+#define VarLegacyDevOrder L"LegacyDevOrder"\r
+\r
+//\r
+// Data structures and defines\r
+//\r
+#define FRONT_PAGE_QUESTION_ID  0x0000\r
+#define FRONT_PAGE_DATA_WIDTH   0x01\r
+\r
+//\r
+// ConnectType\r
+//\r
+#define CONSOLE_OUT 0x00000001\r
+#define STD_ERROR   0x00000002\r
+#define CONSOLE_IN  0x00000004\r
+#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)\r
+\r
+//\r
+// Load Option Attributes defined in EFI Specification\r
+//\r
+#define LOAD_OPTION_ACTIVE              0x00000001\r
+#define LOAD_OPTION_FORCE_RECONNECT     0x00000002\r
+#define IS_LOAD_OPTION_TYPE(_c, _Mask)  (BOOLEAN) (((_c) & (_Mask)) != 0)\r
+\r
+//\r
+// Define Maxmim characters that will be accepted\r
+//\r
+#define MAX_CHAR            480\r
+#define MAX_CHAR_SIZE       (MAX_CHAR * 2)\r
+\r
+#define MIN_ALIGNMENT_SIZE  4\r
+#define ALIGN_SIZE(a)       ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r
+\r
+//\r
+// Define maximum characters for boot option variable "BootXXXX"\r
+//\r
+#define BOOT_OPTION_MAX_CHAR 10\r
+\r
+//\r
+// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.\r
+//\r
+#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')\r
+\r
+typedef struct {\r
+\r
+  UINTN                     Signature;\r
+  LIST_ENTRY                Link;\r
+\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+\r
+  CHAR16                    *OptionName;\r
+  UINTN                     OptionNumber;\r
+  UINT16                    BootCurrent;\r
+  UINT32                    Attribute;\r
+  CHAR16                    *Description;\r
+  VOID                      *LoadOptions;\r
+  UINT32                    LoadOptionsSize;\r
+\r
+} BDS_COMMON_OPTION;\r
+\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  UINTN                     ConnectType;\r
+} BDS_CONSOLE_CONNECT_ENTRY;\r
+\r
+//\r
+// Lib Functions\r
+//\r
+\r
+//\r
+// Bds boot relate lib functions\r
+//\r
+EFI_STATUS\r
+BdsLibUpdateBootOrderList (\r
+  IN  LIST_ENTRY                 *BdsOptionList,\r
+  IN  CHAR16                     *VariableName\r
+  );\r
+\r
+VOID\r
+BdsLibBootNext (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibBootViaBootOption (\r
+  IN  BDS_COMMON_OPTION             * Option,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL      * DevicePath,\r
+  OUT UINTN                         *ExitDataSize,\r
+  OUT CHAR16                        **ExitData OPTIONAL\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibEnumerateAllBootOption (\r
+  IN OUT LIST_ENTRY    *BdsBootOptionList\r
+  );\r
+\r
+VOID\r
+BdsLibBuildOptionFromHandle (\r
+  IN  EFI_HANDLE      Handle,\r
+  IN  LIST_ENTRY      *BdsBootOptionList\r
+  );\r
+\r
+VOID\r
+BdsLibBuildOptionFromShell (\r
+  IN  EFI_HANDLE                 Handle,\r
+  IN  LIST_ENTRY                 *BdsBootOptionList\r
+  );\r
+\r
+//\r
+// Bds misc lib functions\r
+//\r
+UINT16\r
+BdsLibGetTimeout (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibGetBootMode (\r
+  OUT EFI_BOOT_MODE       *BootMode\r
+  );\r
+\r
+VOID\r
+BdsLibLoadDrivers (\r
+  IN  LIST_ENTRY          *BdsDriverLists\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibBuildOptionFromVar (\r
+  IN  LIST_ENTRY          *BdsCommonOptionList,\r
+  IN  CHAR16              *VariableName\r
+  );\r
+\r
+VOID                      *\r
+BdsLibGetVariableAndSize (\r
+  IN  CHAR16              *Name,\r
+  IN  EFI_GUID            *VendorGuid,\r
+  OUT UINTN               *VariableSize\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibOutputStrings (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *ConOut,\r
+  ...\r
+  );\r
+\r
+BDS_COMMON_OPTION         *\r
+BdsLibVariableToOption (\r
+  IN OUT LIST_ENTRY               *BdsCommonOptionList,\r
+  IN CHAR16                       *VariableName\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibRegisterNewOption (\r
+  IN  LIST_ENTRY                     *BdsOptionList,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL       *DevicePath,\r
+  IN  CHAR16                         *String,\r
+  IN  CHAR16                         *VariableName\r
+  );\r
+\r
+//\r
+// Bds connect or disconnect driver lib funcion\r
+//\r
+VOID\r
+BdsLibConnectAllDriversToAllControllers (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+BdsLibConnectAll (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibConnectDevicePath (\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePathToConnect\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibConnectAllEfi (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibDisconnectAllEfi (\r
+  VOID\r
+  );\r
+\r
+//\r
+// Bds console relate lib functions\r
+//\r
+VOID\r
+BdsLibConnectAllConsoles (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibConnectAllDefaultConsoles (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibUpdateConsoleVariable (\r
+  IN  CHAR16                    *ConVarName,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *CustomizedConDevicePath,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *ExclusiveDevicePath\r
+  );\r
+\r
+EFI_STATUS\r
+BdsLibConnectConsoleVariable (\r
+  IN  CHAR16                 *ConVarName\r
+  );\r
+\r
+//\r
+// Bds device path relate lib functions\r
+//\r
+EFI_DEVICE_PATH_PROTOCOL  *\r
+BdsLibUnpackDevicePath (\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath\r
+  );\r
+\r
+BOOLEAN\r
+BdsLibMatchDevicePaths (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *Multi,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *Single\r
+  );\r
+\r
+CHAR16                    *\r
+DevicePathToStr (\r
+  EFI_DEVICE_PATH_PROTOCOL     *DevPath\r
+  );\r
+\r
+VOID                      *\r
+EfiLibGetVariable (\r
+  IN CHAR16               *Name,\r
+  IN EFI_GUID             *VendorGuid\r
+  );\r
+\r
+//\r
+// Internal definitions\r
+//\r
+typedef struct {\r
+  CHAR16  *str;\r
+  UINTN   len;\r
+  UINTN   maxlen;\r
+} POOL_PRINT;\r
+\r
+typedef struct {\r
+  UINT8 Type;\r
+  UINT8 SubType;\r
+  VOID (*Function) (POOL_PRINT *, VOID *);\r
+} DEVICE_PATH_STRING_TABLE;\r
+\r
+//\r
+// Internal functions\r
+//\r
+EFI_STATUS\r
+BdsBootByDiskSignatureAndPartition (\r
+  IN  BDS_COMMON_OPTION          * Option,\r
+  IN  HARDDRIVE_DEVICE_PATH      * HardDriveDevicePath,\r
+  IN  UINT32                     LoadOptionsSize,\r
+  IN  VOID                       *LoadOptions,\r
+  OUT UINTN                      *ExitDataSize,\r
+  OUT CHAR16                     **ExitData OPTIONAL\r
+  );\r
+\r
+//\r
+// Notes: EFI 64 shadow all option rom\r
+//\r
+#ifdef EFI64\r
+#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();\r
+VOID\r
+ShadowAllOptionRom();\r
+#else\r
+#define EFI64_SHADOW_ALL_LEGACY_ROM()\r
+#endif\r
+\r
+//\r
+// BBS support macros and functions\r
+//\r
+#ifdef EFI32\r
+#define REFRESH_LEGACY_BOOT_OPTIONS \\r
+        BdsDeleteAllInvalidLegacyBootOptions ();\\r
+        BdsAddNonExistingLegacyBootOptions (); \\r
+        BdsUpdateLegacyDevOrder ()\r
+#else\r
+#define REFRESH_LEGACY_BOOT_OPTIONS\r
+#endif\r
+\r
+EFI_STATUS\r
+BdsDeleteAllInvalidLegacyBootOptions (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsAddNonExistingLegacyBootOptions (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsUpdateLegacyDevOrder (\r
+  VOID\r
+  );\r
+\r
+EFI_STATUS\r
+BdsRefreshBbsTableForBoot (\r
+  IN BDS_COMMON_OPTION        *Entry\r
+  );\r
+\r
+EFI_STATUS\r
+BdsDeleteBootOption (\r
+  IN UINTN                       OptionNumber,\r
+  IN OUT UINT16                  *BootOrder,\r
+  IN OUT UINTN                   *BootOrderSize\r
+  );\r
+\r
+//\r
+//The interface functions relate with Setup Browser Reset Reminder feature\r
+//\r
+VOID\r
+EnableResetReminderFeature (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+DisableResetReminderFeature (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EnableResetRequired (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+DisableResetRequired (\r
+  VOID\r
+  );\r
+\r
+BOOLEAN\r
+IsResetReminderFeatureEnable (\r
+  VOID\r
+  );\r
+\r
+BOOLEAN\r
+IsResetRequired (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+SetupResetReminder (\r
+  VOID\r
+  );\r
+  \r
+#endif // _BDS_LIB_H_\r