]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Bds/BdsInternal.h
ArmPlatformPkg: Print arguments for EFI Application
[mirror_edk2.git] / ArmPlatformPkg / Bds / BdsInternal.h
index e7a83e6926f7fff60e35f39f096296493c1d56b2..447b8c9cd1901a57081fe759ac667ab1464e1349 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
@@ -18,7 +18,6 @@
 #include <PiDxe.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/BdsLib.h>\r
-#include <Library/BdsUnixLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/UefiLib.h>\r
 #define BOOT_DEVICE_DESCRIPTION_MAX   100\r
 #define BOOT_DEVICE_FILEPATH_MAX      100\r
 #define BOOT_DEVICE_OPTION_MAX        300\r
-#define BOOT_DEVICE_ADDRESS_MAX       20\r
+#define BOOT_DEVICE_ADDRESS_MAX       (sizeof(L"0x0000000000000000"))\r
 \r
 #define ARM_BDS_OPTIONAL_DATA_SIGNATURE   SIGNATURE_32('a', 'b', 'o', 'd')\r
 \r
-#define IS_ARM_BDS_BOOTENTRY(ptr)  (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) == ARM_BDS_OPTIONAL_DATA_SIGNATURE)\r
+#define IS_ARM_BDS_BOOTENTRY(ptr)  \\r
+  (((ptr)->OptionalData != NULL) && \\r
+   (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) \\r
+      == ARM_BDS_OPTIONAL_DATA_SIGNATURE))\r
 \r
 #define UPDATE_BOOT_ENTRY L"Update entry: "\r
 #define DELETE_BOOT_ENTRY L"Delete entry: "\r
@@ -54,7 +56,7 @@ typedef enum {
 typedef struct {\r
   UINT16                     CmdLineSize;\r
   UINT16                     InitrdSize;\r
-  \r
+\r
   // These following fields have variable length and are packed:\r
   //CHAR8                      *CmdLine;\r
   //EFI_DEVICE_PATH_PROTOCOL   *InitrdPathList;\r
@@ -99,22 +101,14 @@ typedef struct {
 typedef struct _BDS_LOAD_OPTION_SUPPORT {\r
   BDS_SUPPORTED_DEVICE_TYPE   Type;\r
   EFI_STATUS    (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);\r
-  BOOLEAN       (*IsSupported)(IN BDS_LOAD_OPTION* BdsLoadOption);\r
-  EFI_STATUS    (*CreateDevicePathNode)(IN BDS_SUPPORTED_DEVICE* BdsLoadOption, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\r
-  EFI_STATUS    (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\r
+  BOOLEAN       (*IsSupported)(IN  EFI_DEVICE_PATH *DevicePath);\r
+  EFI_STATUS    (*CreateDevicePathNode)(IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes, OUT BOOLEAN *RequestBootType);\r
+  EFI_STATUS    (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT BOOLEAN *RequestBootType);\r
 } BDS_LOAD_OPTION_SUPPORT;\r
 \r
 #define LOAD_OPTION_ENTRY_FROM_LINK(a)  BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)\r
 #define LOAD_OPTION_FROM_LINK(a)        ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption\r
 \r
-EFI_STATUS\r
-GetEnvironmentVariable (\r
-  IN     CONST CHAR16*   VariableName,\r
-  IN     VOID*           DefaultValue,\r
-  IN OUT UINTN*          Size,\r
-  OUT    VOID**          Value\r
-  );\r
-\r
 EFI_STATUS\r
 BootDeviceListSupportedInit (\r
   IN OUT LIST_ENTRY *SupportedDeviceList\r
@@ -128,8 +122,8 @@ BootDeviceListSupportedFree (
 \r
 EFI_STATUS\r
 BootDeviceGetDeviceSupport (\r
-  IN  BDS_LOAD_OPTION *BootOption,\r
-  OUT BDS_LOAD_OPTION_SUPPORT**  DeviceSupport\r
+  IN  EFI_DEVICE_PATH           *DevicePath,\r
+  OUT BDS_LOAD_OPTION_SUPPORT   **DeviceSupport\r
   );\r
 \r
 EFI_STATUS\r
@@ -225,7 +219,8 @@ BootOptionCreate (
   IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
   IN  ARM_BDS_LOADER_TYPE       BootType,\r
-  IN  ARM_BDS_LOADER_ARGUMENTS* BootArguments,\r
+  IN  UINT8*                    OptionalData,\r
+  IN  UINTN                     OptionalDataSize,\r
   OUT BDS_LOAD_OPTION**         BdsLoadOption\r
   );\r
 \r
@@ -236,7 +231,8 @@ BootOptionUpdate (
   IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
   IN  ARM_BDS_LOADER_TYPE       BootType,\r
-  IN  ARM_BDS_LOADER_ARGUMENTS* BootArguments\r
+  IN UINT8*                     OptionalData,\r
+  IN UINTN                      OptionalDataSize\r
   );\r
 \r
 EFI_STATUS\r
@@ -244,9 +240,42 @@ BootOptionDelete (
   IN  BDS_LOAD_OPTION *BootOption\r
   );\r
 \r
+EFI_STATUS\r
+BootDeviceGetType (\r
+  IN  EFI_DEVICE_PATH* DevicePath,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
+  OUT UINT32 *Attributes\r
+  );\r
+\r
 EFI_STATUS\r
 BootMenuMain (\r
   VOID\r
   );\r
 \r
+BOOLEAN\r
+IsUnicodeString (\r
+  IN VOID* String\r
+  );\r
+\r
+/*\r
+ * Try to detect if the given string is an ASCII or Unicode string\r
+ *\r
+ * There are actually few limitation to this function but it is mainly to give\r
+ * a user friendly output.\r
+ *\r
+ * Some limitations:\r
+ *   - it only supports unicode string that use ASCII character (< 0x100)\r
+ *   - single character ASCII strings are interpreted as Unicode string\r
+ *   - string cannot be longer than 2 x BOOT_DEVICE_OPTION_MAX (600 bytes)\r
+ *\r
+ * @param String    Buffer that might contain a Unicode or Ascii string\r
+ * @param IsUnicode If not NULL this boolean value returns if the string is an\r
+ *                  ASCII or Unicode string.\r
+ */\r
+BOOLEAN\r
+IsPrintableString (\r
+  IN  VOID*    String,\r
+  OUT BOOLEAN *IsUnicode\r
+  );\r
+\r
 #endif /* _BDSINTERNAL_H_ */\r