]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Add a signature in front of the Boot Argument propoer to this Bds
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 9 Sep 2011 10:51:13 +0000 (10:51 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 9 Sep 2011 10:51:13 +0000 (10:51 +0000)
Each application loader has its own OptionalData format. To avoid to start a Boot Entry
that has not been created by ArmPlatform/Bds a signature has been added to the
OptionalData.

ArmPlatformPkg/Bds: Rename some internal structure from BDS_* to ARM_BDS_*

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12311 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Bds/Bds.c
ArmPlatformPkg/Bds/BdsHelper.c
ArmPlatformPkg/Bds/BdsInternal.h
ArmPlatformPkg/Bds/BootMenu.c
ArmPlatformPkg/Bds/BootOption.c
ArmPlatformPkg/Bds/BootOptionSupport.c

index a1fa21a0f98d465b99860f1007afb0338433503f..cdfea032285af7c035b6eb07b3d3e015d6e7f9e2 100644 (file)
@@ -203,8 +203,11 @@ DefineDefaultBootEntries (
   EFI_STATUS                          Status;
   EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
   EFI_DEVICE_PATH*                    BootDevicePath;
-  BDS_LOADER_ARGUMENTS                BootArguments;
-  BDS_LOADER_TYPE                     BootType;
+  ARM_BDS_LOADER_ARGUMENTS*           BootArguments;
+  ARM_BDS_LOADER_TYPE                 BootType;
+  EFI_DEVICE_PATH*                    InitrdPath;
+  UINTN                               CmdLineSize;
+  UINTN                               InitrdSize;
 
   //
   // If Boot Order does not exist then create a default entry
@@ -240,19 +243,28 @@ DefineDefaultBootEntries (
 
     // Create the entry is the Default values are correct
     if (BootDevicePath != NULL) {
-      BootType = (BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
+      BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
 
-      if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) {
-        BootArguments.LinuxAtagArguments.CmdLine[0] = '\0';
-        AsciiStrnCpy (BootArguments.LinuxAtagArguments.CmdLine,(CHAR8*)PcdGetPtr(PcdDefaultBootArgument),BOOT_DEVICE_OPTION_MAX);
-        BootArguments.LinuxAtagArguments.InitrdPathList = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));
+      if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
+        CmdLineSize = AsciiStrSize ((CHAR8*)PcdGetPtr(PcdDefaultBootArgument));
+        InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));
+        InitrdSize = GetDevicePathSize (InitrdPath);
+
+        BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);
+        BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
+        BootArguments->LinuxArguments.InitrdSize = InitrdSize;
+
+        CopyMem ((VOID*)(BootArguments + 1), (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), CmdLineSize);
+        CopyMem ((VOID*)(BootArguments + 1) + CmdLineSize, (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), InitrdSize);
+      } else {
+        BootArguments = NULL;
       }
 
       BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,
         (CHAR16*)PcdGetPtr(PcdDefaultBootDescription),
         BootDevicePath,
         BootType,
-        &BootArguments,
+        BootArguments,
         &BdsLoadOption
         );
       FreePool (BdsLoadOption);
index 0a6961183aff1e17ec4494117ef51dad9215a5f4..91b42341e60f258da2ac56cab6b20f6b20cdb736 100644 (file)
@@ -343,3 +343,34 @@ BdsStartBootOption (
   }
   return Status;
 }
+
+UINTN
+GetUnalignedDevicePathSize (
+  IN EFI_DEVICE_PATH* DevicePath
+  )
+{
+  UINTN Size;
+  EFI_DEVICE_PATH* AlignedDevicePath;
+
+  if ((UINTN)DevicePath & 0x1) {
+    AlignedDevicePath = DuplicateDevicePath (DevicePath);
+    Size = GetDevicePathSize (AlignedDevicePath);
+    FreePool (AlignedDevicePath);
+  } else {
+    Size = GetDevicePathSize (DevicePath);
+  }
+  return Size;
+}
+
+EFI_DEVICE_PATH*
+GetAlignedDevicePath (
+  IN EFI_DEVICE_PATH* DevicePath
+  )
+{
+  if ((UINTN)DevicePath & 0x1) {
+    return DuplicateDevicePath (DevicePath);
+  } else {
+    return DevicePath;
+  }
+}
+
index a788ef7be1355f9306b3c5ffe8bb770f5caeeed1..d4c438b01067a9ccbf6fe63ed21e014615d98434 100644 (file)
 #define BOOT_DEVICE_OPTION_MAX        300\r
 #define BOOT_DEVICE_ADDRESS_MAX       20\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
+\r
 typedef enum {\r
     BDS_LOADER_EFI_APPLICATION = 0,\r
     BDS_LOADER_KERNEL_LINUX_ATAG,\r
     BDS_LOADER_KERNEL_LINUX_FDT,\r
-} BDS_LOADER_TYPE;\r
+} ARM_BDS_LOADER_TYPE;\r
 \r
-typedef struct{\r
-  UINT16                     InitrdPathListLength;\r
-  EFI_DEVICE_PATH_PROTOCOL   *InitrdPathList;\r
-  CHAR8                      CmdLine[BOOT_DEVICE_OPTION_MAX + 1];\r
-} BDS_LINUX_ATAG_ARGUMENTS;\r
+typedef struct {\r
+  UINT16                     CmdLineSize;\r
+  UINT16                     InitrdSize;\r
+  \r
+  // These following fields have variable length and are packed:\r
+  //CHAR8                      *CmdLine;\r
+  //EFI_DEVICE_PATH_PROTOCOL   *InitrdPathList;\r
+} ARM_BDS_LINUX_ARGUMENTS;\r
 \r
 typedef union {\r
-  BDS_LINUX_ATAG_ARGUMENTS     LinuxAtagArguments;\r
-} BDS_LOADER_ARGUMENTS;\r
+  ARM_BDS_LINUX_ARGUMENTS    LinuxArguments;\r
+} ARM_BDS_LOADER_ARGUMENTS;\r
 \r
 typedef struct {\r
-  BDS_LOADER_TYPE            LoaderType;\r
-  BDS_LOADER_ARGUMENTS       Arguments;\r
-} BDS_LOADER_OPTIONAL_DATA;\r
+  UINT32                     Signature;\r
+  ARM_BDS_LOADER_TYPE        LoaderType;\r
+} ARM_BDS_LOADER_OPTIONAL_DATA_HEADER;\r
+\r
+typedef struct {\r
+  ARM_BDS_LOADER_OPTIONAL_DATA_HEADER Header;\r
+  ARM_BDS_LOADER_ARGUMENTS            Arguments;\r
+} ARM_BDS_LOADER_OPTIONAL_DATA;\r
 \r
 typedef enum {\r
   BDS_DEVICE_FILESYSTEM = 0,\r
@@ -97,8 +109,8 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT {
   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 BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\r
-  EFI_STATUS    (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\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
 } BDS_LOAD_OPTION_SUPPORT;\r
 \r
 #define LOAD_OPTION_FROM_LINK(a)   BASE_CR(a, BDS_LOAD_OPTION, Link)\r
@@ -182,6 +194,16 @@ BdsStartBootOption (
   IN CHAR16* BootOption\r
   );\r
 \r
+UINTN\r
+GetUnalignedDevicePathSize (\r
+  IN EFI_DEVICE_PATH* DevicePath\r
+  );\r
+\r
+EFI_DEVICE_PATH*\r
+GetAlignedDevicePath (\r
+  IN EFI_DEVICE_PATH* DevicePath\r
+  );\r
+\r
 EFI_STATUS\r
 GenerateDeviceDescriptionName (\r
   IN  EFI_HANDLE  Handle,\r
@@ -207,22 +229,22 @@ BootOptionStart (
 \r
 EFI_STATUS\r
 BootOptionCreate (\r
-  IN  UINT32 Attributes,\r
-  IN  CHAR16* BootDescription,\r
+  IN  UINT32                    Attributes,\r
+  IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  BDS_LOADER_TYPE   BootType,\r
-  IN  BDS_LOADER_ARGUMENTS *BootArguments,\r
-  OUT BDS_LOAD_OPTION **BdsLoadOption\r
+  IN  ARM_BDS_LOADER_TYPE       BootType,\r
+  IN  ARM_BDS_LOADER_ARGUMENTS* BootArguments,\r
+  OUT BDS_LOAD_OPTION**         BdsLoadOption\r
   );\r
 \r
 EFI_STATUS\r
 BootOptionUpdate (\r
-  IN  BDS_LOAD_OPTION *BdsLoadOption,\r
-  IN  UINT32 Attributes,\r
-  IN  CHAR16* BootDescription,\r
+  IN  BDS_LOAD_OPTION*          BdsLoadOption,\r
+  IN  UINT32                    Attributes,\r
+  IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  BDS_LOADER_TYPE   BootType,\r
-  IN  BDS_LOADER_ARGUMENTS *BootArguments\r
+  IN  ARM_BDS_LOADER_TYPE       BootType,\r
+  IN  ARM_BDS_LOADER_ARGUMENTS* BootArguments\r
   );\r
 \r
 EFI_STATUS\r
index 591e7e683b8382759be6b92c3cda25686857d060..8aa09596fdcbaed2637d3044e876ea6660eb60a2 100644 (file)
@@ -113,22 +113,26 @@ BootMenuAddBootOption (
   IN LIST_ENTRY *BootOptionsList\r
   )\r
 {\r
-  EFI_STATUS               Status;\r
-  BDS_SUPPORTED_DEVICE*    SupportedBootDevice;\r
-  BDS_LOADER_ARGUMENTS     BootArguments;\r
+  EFI_STATUS                Status;\r
+  BDS_SUPPORTED_DEVICE*     SupportedBootDevice;\r
+  ARM_BDS_LOADER_ARGUMENTS* BootArguments;\r
   CHAR16                    BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];\r
-  UINT32                   Attributes;\r
-  BDS_LOADER_TYPE          BootType;\r
+  CHAR8                     CmdLine[BOOT_DEVICE_OPTION_MAX];\r
+  UINT32                    Attributes;\r
+  ARM_BDS_LOADER_TYPE       BootType;\r
   BDS_LOAD_OPTION          *BdsLoadOption;\r
-  EFI_DEVICE_PATH          *DevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;\r
-  EFI_DEVICE_PATH_PROTOCOL *InitrdPathNode;\r
+  EFI_DEVICE_PATH           *DevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePathNode;\r
+  EFI_DEVICE_PATH_PROTOCOL  *InitrdPathNode;\r
+  EFI_DEVICE_PATH_PROTOCOL  *InitrdPath;\r
+  UINTN                     CmdLineSize;\r
+  UINTN                     InitrdSize;\r
 \r
   Attributes                = 0;\r
   SupportedBootDevice = NULL;\r
 \r
   // List the Boot Devices supported\r
-  Status = SelectBootDevice(&SupportedBootDevice);\r
+  Status = SelectBootDevice (&SupportedBootDevice);\r
   if (EFI_ERROR(Status)) {\r
     Status = EFI_ABORTED;\r
     goto EXIT;\r
@@ -144,7 +148,7 @@ BootMenuAddBootOption (
   // Append the Device Path node to the select device path\r
   DevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)DevicePathNode);\r
 \r
-  if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
+  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
     // Create the specific device path node\r
     Print(L"File path of the initrd: ");\r
     Status = SupportedBootDevice->Support->CreateDevicePathNode (SupportedBootDevice, &InitrdPathNode, NULL, NULL);\r
@@ -155,18 +159,29 @@ BootMenuAddBootOption (
 \r
     if (InitrdPathNode != NULL) {\r
       // Append the Device Path node to the select device path\r
-      BootArguments.LinuxAtagArguments.InitrdPathList = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);\r
+      InitrdPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);\r
     } else {\r
-      BootArguments.LinuxAtagArguments.InitrdPathList = NULL;\r
+      InitrdPath = NULL;\r
     }\r
 \r
     Print(L"Arguments to pass to the binary: ");\r
-    Status = GetHIInputAscii (BootArguments.LinuxAtagArguments.CmdLine,BOOT_DEVICE_OPTION_MAX);\r
+    Status = GetHIInputAscii (CmdLine,BOOT_DEVICE_OPTION_MAX);\r
     if (EFI_ERROR(Status)) {\r
       Status = EFI_ABORTED;\r
       goto FREE_DEVICE_PATH;\r
     }\r
-    BootArguments.LinuxAtagArguments.CmdLine[BOOT_DEVICE_OPTION_MAX]= '\0';\r
+\r
+    CmdLineSize = AsciiStrSize (CmdLine);\r
+    InitrdSize = GetDevicePathSize (InitrdPath);\r
+\r
+    BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);\r
+    \r
+    BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
+    BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
+    CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize);\r
+    CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);\r
+  } else {\r
+    BootArguments = NULL;\r
   }\r
 \r
   Print(L"Description for this new Entry: ");\r
@@ -222,14 +237,17 @@ BootMenuSelectBootOption (
     DEBUG_CODE_BEGIN();\r
       CHAR16*                           DevicePathTxt;\r
       EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;\r
+      ARM_BDS_LOADER_TYPE               LoaderType;\r
 \r
       Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);\r
       ASSERT_EFI_ERROR(Status);\r
       DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText(BootOption->FilePathList,TRUE,TRUE);\r
 \r
       Print(L"\t- %s\n",DevicePathTxt);\r
-      if ((BDS_LOADER_TYPE)ReadUnaligned32(&BootOption->OptionalData->LoaderType) == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
-        Print(L"\t- Arguments: %a\n",BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine);\r
+      OptionalData = BdsLoadOption->OptionalData;\r
+      LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);\r
+      if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
+        Print (L"\t- Arguments: %a\n",&OptionalData->Arguments.LinuxArguments + 1);\r
       }\r
 \r
       FreePool(DevicePathTxt);\r
@@ -292,13 +310,19 @@ BootMenuUpdateBootOption (
   IN LIST_ENTRY *BootOptionsList\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  BDS_LOAD_OPTION           *BootOption;\r
-  BDS_LOAD_OPTION_SUPPORT   *DeviceSupport;\r
-  BDS_LOADER_ARGUMENTS      BootArguments;\r
+  EFI_STATUS                    Status;\r
+  BDS_LOAD_OPTION               *BootOption;\r
+  BDS_LOAD_OPTION_SUPPORT*      DeviceSupport;\r
+  ARM_BDS_LOADER_ARGUMENTS*     BootArguments;\r
   CHAR16                        BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];\r
-  EFI_DEVICE_PATH*          DevicePath;\r
-  BDS_LOADER_TYPE           BootType;\r
+  CHAR8                         CmdLine[BOOT_DEVICE_OPTION_MAX];\r
+  EFI_DEVICE_PATH*              DevicePath;\r
+  ARM_BDS_LOADER_TYPE           BootType;\r
+  ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;\r
+  ARM_BDS_LINUX_ARGUMENTS*      LinuxArguments;\r
+  EFI_DEVICE_PATH*              InitrdPathList;\r
+  UINTN                         InitrdSize;\r
+  UINTN                         CmdLineSize;\r
 \r
   Status = BootMenuSelectBootOption (BootOptionsList,L"Update entry: ",&BootOption);\r
   if (EFI_ERROR(Status)) {\r
@@ -319,41 +343,46 @@ BootMenuUpdateBootOption (
     goto EXIT;\r
   }\r
 \r
-  BootType = (BDS_LOADER_TYPE)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->LoaderType));\r
+  OptionalData = BootOption->OptionalData;\r
+  BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&OptionalData->Header.LoaderType));\r
 \r
   // TODO: Allow adding an initrd to a boot entry without one\r
-  if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
-    if (ReadUnaligned16(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathListLength) > 0\r
-        && (EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)) != NULL) {\r
-\r
-      Print(L"File path of the initrd: ");\r
-      Status = DeviceSupport->UpdateDevicePathNode (\r
-                (EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)),\r
-                &BootArguments.LinuxAtagArguments.InitrdPathList,\r
-                NULL,\r
-                NULL);\r
-      if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
-        Status = EFI_ABORTED;\r
-        goto EXIT;\r
-      }\r
-    } else {\r
-      BootArguments.LinuxAtagArguments.InitrdPathList = NULL;\r
-      BootArguments.LinuxAtagArguments.InitrdPathListLength = 0;\r
+  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
+    LinuxArguments = &OptionalData->Arguments.LinuxArguments;\r
+\r
+    CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);\r
+    InitrdSize = GetUnalignedDevicePathSize ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize));\r
+\r
+    Print(L"File path of the initrd: ");\r
+    Status = DeviceSupport->UpdateDevicePathNode (\r
+      (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)(LinuxArguments + 1) + CmdLineSize), &InitrdPathList, NULL, NULL);\r
+    if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
+      Status = EFI_ABORTED;\r
+      goto EXIT;\r
     }\r
 \r
-    Print(L"Arguments to pass to the binary: ");\r
-    if (ReadUnaligned32((CONST UINT32*)&BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine)) {\r
-      AsciiStrnCpy(BootArguments.LinuxAtagArguments.CmdLine,\r
-                   BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine,\r
-                   BOOT_DEVICE_OPTION_MAX+1);\r
+    Print(L"Arguments to pass to the binary: "); \r
+    if (CmdLineSize > 0) {\r
+      AsciiStrnCpy(CmdLine, (CONST CHAR8*)(LinuxArguments + 1), CmdLineSize);\r
     } else {\r
-      BootArguments.LinuxAtagArguments.CmdLine[0] = '\0';\r
+      CmdLine[0] = '\0';\r
     }\r
-    Status = EditHIInputAscii (BootArguments.LinuxAtagArguments.CmdLine, BOOT_DEVICE_OPTION_MAX);\r
+    Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);\r
     if (EFI_ERROR(Status)) {\r
       Status = EFI_ABORTED;\r
       goto FREE_DEVICE_PATH;\r
     }\r
+\r
+    CmdLineSize = AsciiStrSize (CmdLine);\r
+    InitrdSize = GetDevicePathSize (InitrdPathList);\r
+\r
+    BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);\r
+    BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
+    BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
+    CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);\r
+    CopyMem ((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLine, InitrdPathList, InitrdSize);\r
+  } else {\r
+    BootArguments = NULL;\r
   }\r
 \r
   Print(L"Description for this new Entry: ");\r
@@ -364,7 +393,7 @@ BootMenuUpdateBootOption (
   }\r
 \r
   // Update the entry\r
-  Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, &BootArguments);\r
+  Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, BootArguments);\r
 \r
 FREE_DEVICE_PATH:\r
   FreePool (DevicePath);\r
@@ -452,15 +481,15 @@ BootMenuMain (
   VOID\r
   )\r
 {\r
-  LIST_ENTRY BootOptionsList;\r
-  UINTN       OptionCount;\r
-  UINTN       BootOptionCount;\r
-  EFI_STATUS  Status;\r
-  LIST_ENTRY  *Entry;\r
-  BDS_LOAD_OPTION *BootOption;\r
-  UINTN   BootOptionSelected;\r
-  UINTN   Index;\r
-  UINTN   BootMainEntryCount;\r
+  LIST_ENTRY                    BootOptionsList;\r
+  UINTN                         OptionCount;\r
+  UINTN                         BootOptionCount;\r
+  EFI_STATUS                    Status;\r
+  LIST_ENTRY*                   Entry;\r
+  BDS_LOAD_OPTION*              BootOption;\r
+  UINTN                         BootOptionSelected;\r
+  UINTN                         Index;\r
+  UINTN                         BootMainEntryCount;\r
 \r
   BootOption              = NULL;\r
   BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);\r
@@ -484,6 +513,9 @@ BootMenuMain (
       DEBUG_CODE_BEGIN();\r
         CHAR16*                           DevicePathTxt;\r
         EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;\r
+        ARM_BDS_LOADER_OPTIONAL_DATA*     OptionalData;\r
+        UINTN                             CmdLineSize;\r
+        ARM_BDS_LOADER_TYPE           LoaderType;\r
 \r
         Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);\r
         if (EFI_ERROR(Status)) {\r
@@ -494,18 +526,22 @@ BootMenuMain (
         DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText(BootOption->FilePathList,TRUE,TRUE);\r
 \r
         Print(L"\t- %s\n",DevicePathTxt);\r
-        if (ReadUnaligned32(&BootOption->OptionalData->LoaderType) == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
-          if (ReadUnaligned16(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathListLength) > 0\r
-              && (EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)) != NULL) {\r
-            DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)ReadUnaligned32((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)),TRUE,TRUE);\r
-            Print(L"\t- Initrd: %s\n", DevicePathTxt);\r
+\r
+        // If it is a supported BootEntry then print its details\r
+        if (IS_ARM_BDS_BOOTENTRY (BootOption)) {\r
+          OptionalData = BootOption->OptionalData;\r
+          LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);\r
+          if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
+            if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {\r
+              CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);\r
+              DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (\r
+                  GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize)), TRUE, TRUE);\r
+              Print(L"\t- Initrd: %s\n", DevicePathTxt);\r
+            }\r
+            Print(L"\t- Arguments: %a\n", (&OptionalData->Arguments.LinuxArguments + 1));\r
           }\r
-        \r
-          Print(L"\t- Arguments: %a\n", BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine);\r
+          Print(L"\t- LoaderType: %d\n", LoaderType);\r
         }\r
-\r
-        Print(L"\t- LoaderType: %d\n", ReadUnaligned32 (&BootOption->OptionalData->LoaderType));\r
-\r
         FreePool(DevicePathTxt);\r
       DEBUG_CODE_END();\r
 \r
index f4ff182ef219437b6a7631ade94dc39e0e5b0e29..f6090d266dcf97e5fc2acee748c153ec8738324f 100644 (file)
@@ -25,33 +25,64 @@ BootOptionStart (
   EFI_DEVICE_PATH*                      FdtDevicePath;\r
   EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL*   EfiDevicePathFromTextProtocol;\r
   UINT32                                LoaderType;\r
+  ARM_BDS_LOADER_OPTIONAL_DATA*         OptionalData;\r
+  ARM_BDS_LINUX_ARGUMENTS*              LinuxArguments;\r
+  EFI_DEVICE_PATH_PROTOCOL*             FdtDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL*             DefaultFdtDevicePath;\r
+  UINTN                                 FdtDevicePathSize;\r
+  UINTN                                 CmdLineSize;\r
+  UINTN                                 InitrdSize;\r
+  EFI_DEVICE_PATH*                      Initrd;\r
+\r
+    Status = EFI_UNSUPPORTED;\r
+    OptionalData = BootOption->OptionalData;\r
+    LoaderType = ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);\r
+\r
+    if (LoaderType == BDS_LOADER_EFI_APPLICATION) {\r
+      // Need to connect every drivers to ensure no dependencies are missing for the application\r
+      BdsConnectAllDrivers();\r
+\r
+      Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, 0, NULL);\r
+    } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
+      LinuxArguments = &(OptionalData->Arguments.LinuxArguments);\r
+      CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);\r
+      InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);\r
+\r
+      if (InitrdSize > 0) {\r
+        Initrd = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize));\r
+      } else {\r
+        Initrd = NULL;\r
+      }\r
 \r
-  Status = EFI_UNSUPPORTED;\r
-  LoaderType = ReadUnaligned32 (&BootOption->OptionalData->LoaderType);\r
-\r
-  if (LoaderType == BDS_LOADER_EFI_APPLICATION) {\r
-    // Need to connect every drivers to ensure no dependencies are missing for the application\r
-    BdsConnectAllDrivers();\r
-\r
-    Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList);\r
-  } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
-    Status = BdsBootLinux (BootOption->FilePathList, \r
-                               (EFI_DEVICE_PATH_PROTOCOL*)ReadUnaligned32((UINT32*)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList)),\r
-                               BootOption->OptionalData->Arguments.LinuxAtagArguments.CmdLine,\r
-                               NULL);\r
-  } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {\r
-    // Convert the FDT path into a Device Path\r
-    Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);\r
-    ASSERT_EFI_ERROR(Status);\r
-    FdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));\r
-\r
-    Status = BdsBootLinux (BootOption->FilePathList,\r
-                              NULL,\r
-                              NULL,\r
-                              FdtDevicePath);\r
-\r
-    FreePool(FdtDevicePath);\r
-  }\r
+      Status = BdsBootLinux (BootOption->FilePathList,\r
+                                 Initrd, // Initrd\r
+                                 (CHAR8*)(LinuxArguments + 1), // CmdLine\r
+                                 NULL);\r
+    } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {\r
+      LinuxArguments = &(OptionalData->Arguments.LinuxArguments);\r
+      CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);\r
+      InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);\r
+\r
+      if (InitrdSize > 0) {\r
+        Initrd = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize));\r
+      } else {\r
+        Initrd = NULL;\r
+      }\r
+\r
+      // Get the default FDT device path\r
+      Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);\r
+      ASSERT_EFI_ERROR(Status);\r
+      DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));\r
+\r
+      // Get the FDT device path\r
+      FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);\r
+      Status = GetEnvironmentVariable ((CHAR16 *)L"FDT", DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);\r
+      ASSERT_EFI_ERROR(Status);\r
+\r
+      Status = BdsBootLinux (BootOption->FilePathList,\r
+                                Initrd, // Initrd\r
+                                (CHAR8*)(LinuxArguments + 1),\r
+                                FdtDevicePath);\r
 \r
   return Status;\r
 }\r
@@ -191,53 +222,34 @@ BootOptionSetFields (
   IN UINT32                     Attributes,\r
   IN CHAR16*                    BootDescription,\r
   IN EFI_DEVICE_PATH_PROTOCOL*  DevicePath,\r
-  IN BDS_LOADER_TYPE            BootType,\r
-  IN BDS_LOADER_ARGUMENTS*      BootArguments\r
+  IN ARM_BDS_LOADER_TYPE        BootType,\r
+  IN ARM_BDS_LOADER_ARGUMENTS*  BootArguments\r
   )\r
 {\r
-  EFI_LOAD_OPTION EfiLoadOption;\r
-  UINTN           EfiLoadOptionSize;\r
-  UINTN           BootDescriptionSize;\r
-  UINTN           BootOptionalDataSize;\r
-  UINT16          FilePathListLength;\r
-  UINT16          InitrdPathListLength;\r
-  EFI_DEVICE_PATH_PROTOCOL* DevicePathNode;\r
-  EFI_DEVICE_PATH_PROTOCOL* InitrdPathNode;\r
-  UINTN           NodeLength;\r
-  UINT8*          EfiLoadOptionPtr;\r
-  UINT8           *InitrdPathListPtr;\r
+  EFI_LOAD_OPTION               EfiLoadOption;\r
+  UINTN                         EfiLoadOptionSize;\r
+  UINTN                         BootDescriptionSize;\r
+  UINTN                         BootOptionalDataSize;\r
+  UINT16                        FilePathListLength;\r
+  UINT8*                        EfiLoadOptionPtr;\r
+  UINT8*                        InitrdPathListPtr;\r
+  UINTN                         OptionalDataSize;\r
+  ARM_BDS_LINUX_ARGUMENTS*      DestLinuxArguments;\r
+  ARM_BDS_LINUX_ARGUMENTS*      SrcLinuxArguments;\r
 \r
   // If we are overwriting an existent Boot Option then we have to free previously allocated memory\r
   if (BootOption->LoadOption) {\r
     FreePool(BootOption->LoadOption);\r
   }\r
 \r
-  BootDescriptionSize = StrSize(BootDescription);\r
-  BootOptionalDataSize = sizeof(BDS_LOADER_TYPE) + (BootType == BDS_LOADER_KERNEL_LINUX_ATAG ? \r
-                         (sizeof(UINT16) + sizeof(EFI_DEVICE_PATH_PROTOCOL*) + BOOT_DEVICE_OPTION_MAX + 1)\r
-                         : 0);\r
+  BootDescriptionSize = StrSize (BootDescription);\r
+  BootOptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);\r
+  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
+    BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize;\r
+  }\r
 \r
   // Compute the size of the FilePath list\r
-  FilePathListLength = 0;\r
-  DevicePathNode = DevicePath;\r
-  while (!IsDevicePathEndType (DevicePathNode)) {\r
-    FilePathListLength += DevicePathNodeLength (DevicePathNode);\r
-    DevicePathNode = NextDevicePathNode (DevicePathNode);\r
-  }\r
-  // Add the length of the DevicePath EndType\r
-  FilePathListLength += DevicePathNodeLength (DevicePathNode);\r
-\r
-  InitrdPathListLength = 0;\r
-  if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG && BootArguments->LinuxAtagArguments.InitrdPathList != NULL) {\r
-    // Compute the size of the InitrdPath list    \r
-    InitrdPathNode = BootArguments->LinuxAtagArguments.InitrdPathList;\r
-    while (!IsDevicePathEndType (InitrdPathNode)) {\r
-      InitrdPathListLength += DevicePathNodeLength (InitrdPathNode);\r
-      InitrdPathNode = NextDevicePathNode (InitrdPathNode);\r
-    }\r
-    // Add the length of the DevicePath EndType\r
-    InitrdPathListLength += DevicePathNodeLength (InitrdPathNode);\r
-  }\r
+  FilePathListLength = GetUnalignedDevicePathSize (DevicePath);\r
 \r
   // Allocate the memory for the EFI Load Option\r
   EfiLoadOptionSize = sizeof(UINT32) + sizeof(UINT16) + BootDescriptionSize + FilePathListLength + BootOptionalDataSize;\r
@@ -265,53 +277,40 @@ BootOptionSetFields (
 \r
   // File path fields\r
   BootOption->FilePathList = (EFI_DEVICE_PATH_PROTOCOL*)EfiLoadOptionPtr;\r
-  DevicePathNode = DevicePath;\r
-  while (!IsDevicePathEndType (DevicePathNode)) {\r
-    NodeLength = DevicePathNodeLength(DevicePathNode);\r
-    CopyMem (EfiLoadOptionPtr, DevicePathNode, NodeLength);\r
-    EfiLoadOptionPtr += NodeLength;\r
-    DevicePathNode = NextDevicePathNode (DevicePathNode);\r
-  }\r
-\r
-  // Set the End Device Path Type\r
-  SetDevicePathEndNode (EfiLoadOptionPtr);\r
-  EfiLoadOptionPtr = (UINT8 *)EfiLoadOptionPtr + sizeof(EFI_DEVICE_PATH);\r
+  CopyMem (EfiLoadOptionPtr, DevicePath, FilePathListLength);\r
+  EfiLoadOptionPtr += FilePathListLength;\r
 \r
   // Optional Data fields, Do unaligned writes\r
-  WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, BootType);\r
+  BootOption->OptionalData = EfiLoadOptionPtr;\r
+  WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, ARM_BDS_OPTIONAL_DATA_SIGNATURE);\r
+  WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);\r
 \r
-  BootOption->OptionalData = (BDS_LOADER_OPTIONAL_DATA *)EfiLoadOptionPtr;\r
+  OptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);\r
 \r
-  if (BootType == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
-    CopyMem (&((BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxAtagArguments.CmdLine,\r
-             BootArguments->LinuxAtagArguments.CmdLine,\r
-             AsciiStrSize(BootArguments->LinuxAtagArguments.CmdLine));\r
+  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
+    SrcLinuxArguments = &(BootArguments->LinuxArguments);\r
+    DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;\r
 \r
-    WriteUnaligned32 ((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathListLength), InitrdPathListLength);\r
+    WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize);\r
+    WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize);\r
+    OptionalDataSize += sizeof (ARM_BDS_LINUX_ARGUMENTS);\r
 \r
-    if ((EFI_DEVICE_PATH_PROTOCOL*)ReadUnaligned32((UINT32 *)&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList) != NULL\r
-        && BootArguments->LinuxAtagArguments.InitrdPathList != NULL) {\r
-      InitrdPathListPtr = AllocatePool(InitrdPathListLength);\r
-      WriteUnaligned32 ((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList), (UINT32)InitrdPathListPtr);\r
-      InitrdPathNode = BootArguments->LinuxAtagArguments.InitrdPathList;\r
-\r
-      while (!IsDevicePathEndType (InitrdPathNode)) {\r
-        NodeLength = DevicePathNodeLength(InitrdPathNode);\r
-        CopyMem (InitrdPathListPtr, InitrdPathNode, NodeLength);\r
-        InitrdPathListPtr += NodeLength;\r
-        InitrdPathNode = NextDevicePathNode (InitrdPathNode);\r
-      }\r
+    if (SrcLinuxArguments->CmdLineSize > 0) {\r
+      CopyMem ((VOID*)(DestLinuxArguments + 1), (VOID*)(SrcLinuxArguments + 1), SrcLinuxArguments->CmdLineSize);\r
+      OptionalDataSize += SrcLinuxArguments->CmdLineSize;\r
+    }\r
 \r
-      // Set the End Device Path Type\r
-      SetDevicePathEndNode (InitrdPathListPtr);\r
-    } else {\r
-      WriteUnaligned32 ((UINT32 *)(&BootOption->OptionalData->Arguments.LinuxAtagArguments.InitrdPathList), (UINT32)NULL);\r
+    if (SrcLinuxArguments->InitrdSize > 0) {\r
+      InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize);\r
+      CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);\r
     }\r
   }\r
+  BootOption->OptionalDataSize = OptionalDataSize;\r
+\r
   // If this function is called at the creation of the Boot Device entry (not at the update) the\r
   // BootOption->LoadOptionSize must be zero then we get a new BootIndex for this entry\r
   if (BootOption->LoadOptionSize == 0) {\r
-    BootOption->LoadOptionIndex = BootOptionAllocateBootIndex();\r
+    BootOption->LoadOptionIndex = BootOptionAllocateBootIndex ();\r
   }\r
 \r
   // Fill the EFI Load option fields\r
@@ -326,8 +325,8 @@ BootOptionCreate (
   IN  UINT32                    Attributes,\r
   IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  BDS_LOADER_TYPE           BootType,\r
-  IN  BDS_LOADER_ARGUMENTS*     BootArguments,\r
+  IN  ARM_BDS_LOADER_TYPE       BootType,\r
+  IN  ARM_BDS_LOADER_ARGUMENTS* BootArguments,\r
   OUT BDS_LOAD_OPTION           **BdsLoadOption\r
   )\r
 {\r
@@ -387,12 +386,12 @@ BootOptionCreate (
 \r
 EFI_STATUS\r
 BootOptionUpdate (\r
-  IN  BDS_LOAD_OPTION *BdsLoadOption,\r
-  IN  UINT32 Attributes,\r
-  IN  CHAR16* BootDescription,\r
+  IN  BDS_LOAD_OPTION*          BdsLoadOption,\r
+  IN  UINT32                    Attributes,\r
+  IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  BDS_LOADER_TYPE   BootType,\r
-  IN  BDS_LOADER_ARGUMENTS* BootArguments\r
+  IN  ARM_BDS_LOADER_TYPE       BootType,\r
+  IN  ARM_BDS_LOADER_ARGUMENTS* BootArguments\r
   )\r
 {\r
   EFI_STATUS      Status;\r
index a7e83b828b99ffeea510ba3570bfe458bc28148f..4c37c9de8831e00d8c96ecff2a02828aa79c1b47 100644 (file)
@@ -35,7 +35,7 @@ EFI_STATUS
 BdsLoadOptionFileSystemCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   );\r
 \r
@@ -43,7 +43,7 @@ EFI_STATUS
 BdsLoadOptionFileSystemUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   );\r
 \r
@@ -61,7 +61,7 @@ EFI_STATUS
 BdsLoadOptionMemMapCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   );\r
 \r
@@ -69,7 +69,7 @@ EFI_STATUS
 BdsLoadOptionMemMapUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   );\r
 \r
@@ -87,7 +87,7 @@ EFI_STATUS
 BdsLoadOptionPxeCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   );\r
 \r
@@ -95,7 +95,7 @@ EFI_STATUS
 BdsLoadOptionPxeUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   );\r
 \r
@@ -113,7 +113,7 @@ EFI_STATUS
 BdsLoadOptionTftpCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   );\r
 \r
@@ -121,7 +121,7 @@ EFI_STATUS
 BdsLoadOptionTftpUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   );\r
 \r
@@ -131,34 +131,34 @@ BdsLoadOptionTftpIsSupported (
   );\r
 \r
 BDS_LOAD_OPTION_SUPPORT BdsLoadOptionSupportList[] = {\r
-    {\r
-        BDS_DEVICE_FILESYSTEM,\r
-        BdsLoadOptionFileSystemList,\r
-        BdsLoadOptionFileSystemIsSupported,\r
-        BdsLoadOptionFileSystemCreateDevicePath,\r
-        BdsLoadOptionFileSystemUpdateDevicePath\r
-    },\r
-    {\r
-        BDS_DEVICE_MEMMAP,\r
-        BdsLoadOptionMemMapList,\r
-        BdsLoadOptionMemMapIsSupported,\r
-        BdsLoadOptionMemMapCreateDevicePath,\r
-        BdsLoadOptionMemMapUpdateDevicePath\r
-    },\r
-    {\r
-        BDS_DEVICE_PXE,\r
-        BdsLoadOptionPxeList,\r
-        BdsLoadOptionPxeIsSupported,\r
-        BdsLoadOptionPxeCreateDevicePath,\r
-        BdsLoadOptionPxeUpdateDevicePath\r
-    },\r
-    {\r
-        BDS_DEVICE_TFTP,\r
-        BdsLoadOptionTftpList,\r
-        BdsLoadOptionTftpIsSupported,\r
-        BdsLoadOptionTftpCreateDevicePath,\r
-        BdsLoadOptionTftpUpdateDevicePath\r
-    }\r
+  {\r
+    BDS_DEVICE_FILESYSTEM,\r
+    BdsLoadOptionFileSystemList,\r
+    BdsLoadOptionFileSystemIsSupported,\r
+    BdsLoadOptionFileSystemCreateDevicePath,\r
+    BdsLoadOptionFileSystemUpdateDevicePath\r
+  },\r
+  {\r
+    BDS_DEVICE_MEMMAP,\r
+    BdsLoadOptionMemMapList,\r
+    BdsLoadOptionMemMapIsSupported,\r
+    BdsLoadOptionMemMapCreateDevicePath,\r
+    BdsLoadOptionMemMapUpdateDevicePath\r
+  },\r
+  {\r
+    BDS_DEVICE_PXE,\r
+    BdsLoadOptionPxeList,\r
+    BdsLoadOptionPxeIsSupported,\r
+    BdsLoadOptionPxeCreateDevicePath,\r
+    BdsLoadOptionPxeUpdateDevicePath\r
+  },\r
+  {\r
+    BDS_DEVICE_TFTP,\r
+    BdsLoadOptionTftpList,\r
+    BdsLoadOptionTftpIsSupported,\r
+    BdsLoadOptionTftpCreateDevicePath,\r
+    BdsLoadOptionTftpUpdateDevicePath\r
+  }\r
 };\r
 \r
 EFI_STATUS\r
@@ -172,7 +172,7 @@ BootDeviceListSupportedInit (
   InitializeListHead (SupportedDeviceList);\r
 \r
   for (Index = 0; Index < BDS_DEVICE_MAX; Index++) {\r
-    BdsLoadOptionSupportList[Index].ListDevices(SupportedDeviceList);\r
+    BdsLoadOptionSupportList[Index].ListDevices (SupportedDeviceList);\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -192,7 +192,7 @@ BootDeviceListSupportedFree (
     SupportedDevice = SUPPORTED_BOOT_DEVICE_FROM_LINK(Entry);\r
     Entry = RemoveEntryList (Entry);\r
     if (SupportedDevice != Except) {\r
-      FreePool(SupportedDevice);\r
+      FreePool (SupportedDevice);\r
     }\r
   }\r
 \r
@@ -222,7 +222,7 @@ STATIC
 EFI_STATUS\r
 BootDeviceGetType (\r
   IN  CHAR16* FileName,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   )\r
 {\r
@@ -295,7 +295,7 @@ BdsLoadOptionFileSystemList (
     Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);\r
     if (!EFI_ERROR(Status)) {\r
       // Allocate BDS Supported Device structure\r
-      SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool(sizeof(BDS_SUPPORTED_DEVICE));\r
+      SupportedDevice = (BDS_SUPPORTED_DEVICE*)AllocatePool (sizeof(BDS_SUPPORTED_DEVICE));\r
 \r
       FileProtocol = NULL;\r
       Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiSimpleFileSystemProtocolGuid, (VOID **)&FileProtocol);\r
@@ -329,7 +329,7 @@ EFI_STATUS
 BdsLoadOptionFileSystemCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   )\r
 {\r
@@ -373,7 +373,7 @@ EFI_STATUS
 BdsLoadOptionFileSystemUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   )\r
 {\r
@@ -527,7 +527,7 @@ EFI_STATUS
 BdsLoadOptionMemMapCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   )\r
 {\r
@@ -549,7 +549,7 @@ BdsLoadOptionMemMapCreateDevicePath (
   }\r
 \r
   // Create the MemMap Device Path Node\r
-  MemMapDevicePath = (MEMMAP_DEVICE_PATH*)AllocatePool(sizeof(MEMMAP_DEVICE_PATH));\r
+  MemMapDevicePath = (MEMMAP_DEVICE_PATH*)AllocatePool (sizeof(MEMMAP_DEVICE_PATH));\r
   MemMapDevicePath->Header.Type = HARDWARE_DEVICE_PATH;\r
   MemMapDevicePath->Header.SubType = HW_MEMMAP_DP;\r
   MemMapDevicePath->MemoryType = EfiBootServicesData;\r
@@ -570,7 +570,7 @@ EFI_STATUS
 BdsLoadOptionMemMapUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   )\r
 {\r
@@ -674,7 +674,7 @@ EFI_STATUS
 BdsLoadOptionPxeCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   )\r
 {\r
@@ -688,7 +688,7 @@ EFI_STATUS
 BdsLoadOptionPxeUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   )\r
 {\r
@@ -775,7 +775,7 @@ EFI_STATUS
 BdsLoadOptionTftpCreateDevicePath (\r
   IN  BDS_SUPPORTED_DEVICE* BdsLoadOption,\r
   OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,\r
-  OUT BDS_LOADER_TYPE   *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE   *BootType,\r
   OUT UINT32      *Attributes\r
   )\r
 {\r
@@ -854,7 +854,7 @@ EFI_STATUS
 BdsLoadOptionTftpUpdateDevicePath (\r
   IN EFI_DEVICE_PATH *OldDevicePath,\r
   OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath,\r
-  OUT BDS_LOADER_TYPE *BootType,\r
+  OUT ARM_BDS_LOADER_TYPE *BootType,\r
   OUT UINT32 *Attributes\r
   )\r
 {\r