]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Bds/Bds.c
ArmPlatformPkg/Bds: Early Console Initialization
[mirror_edk2.git] / ArmPlatformPkg / Bds / Bds.c
index 6a12717a1c12c96f4b0d9dc5b9368566564fcbf4..4cea3cd531bbdc46e95625b4abe281d3dbc6168b 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2015, 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
@@ -220,12 +220,6 @@ DefineDefaultBootEntries (
   EFI_STATUS                          Status;\r
   EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;\r
   EFI_DEVICE_PATH*                    BootDevicePath;\r
-  UINT8*                              OptionalData;\r
-  UINTN                               OptionalDataSize;\r
-  ARM_BDS_LOADER_ARGUMENTS*           BootArguments;\r
-  ARM_BDS_LOADER_TYPE                 BootType;\r
-  EFI_DEVICE_PATH*                    InitrdPath;\r
-  UINTN                               InitrdSize;\r
   UINTN                               CmdLineSize;\r
   UINTN                               CmdLineAsciiSize;\r
   CHAR16*                             DefaultBootArgument;\r
@@ -258,15 +252,17 @@ DefineDefaultBootEntries (
       ASSERT_EFI_ERROR(Status);\r
       DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (BootDevicePath, TRUE, TRUE);\r
 \r
-      ASSERT (StrCmp ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath), DevicePathTxt) == 0);\r
+      if (StrCmp ((CHAR16*)PcdGetPtr (PcdDefaultBootDevicePath), DevicePathTxt) != 0) {\r
+        DEBUG ((EFI_D_ERROR, "Device Path given: '%s' Device Path expected: '%s'\n",\r
+            (CHAR16*)PcdGetPtr (PcdDefaultBootDevicePath), DevicePathTxt));\r
+        ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);\r
+      }\r
 \r
       FreePool (DevicePathTxt);\r
     DEBUG_CODE_END();\r
 \r
     // Create the entry is the Default values are correct\r
     if (BootDevicePath != NULL) {\r
-      BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);\r
-\r
       // We do not support NULL pointer\r
       ASSERT (PcdGetPtr (PcdDefaultBootArgument) != NULL);\r
 \r
@@ -304,33 +300,11 @@ DefineDefaultBootEntries (
         AsciiStrToUnicodeStr (AsciiDefaultBootArgument, DefaultBootArgument);\r
       }\r
 \r
-      if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
-        InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));\r
-        InitrdSize = GetDevicePathSize (InitrdPath);\r
-\r
-        OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineAsciiSize + InitrdSize;\r
-        BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);\r
-        if (BootArguments == NULL) {\r
-          return EFI_OUT_OF_RESOURCES;\r
-        }\r
-        BootArguments->LinuxArguments.CmdLineSize = CmdLineAsciiSize;\r
-        BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
-\r
-        CopyMem ((VOID*)(BootArguments + 1), AsciiDefaultBootArgument, CmdLineAsciiSize);\r
-        CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineAsciiSize), InitrdPath, InitrdSize);\r
-\r
-        OptionalData = (UINT8*)BootArguments;\r
-      } else {\r
-        OptionalData = (UINT8*)DefaultBootArgument;\r
-        OptionalDataSize = CmdLineSize;\r
-      }\r
-\r
       BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,\r
-        (CHAR16*)PcdGetPtr(PcdDefaultBootDescription),\r
+        (CHAR16*)PcdGetPtr (PcdDefaultBootDescription),\r
         BootDevicePath,\r
-        BootType,\r
-        OptionalData,\r
-        OptionalDataSize,\r
+        (UINT8 *)DefaultBootArgument, // OptionalData\r
+        CmdLineSize,                  // OptionalDataSize\r
         &BdsLoadOption\r
         );\r
       FreePool (BdsLoadOption);\r
@@ -505,6 +479,9 @@ BdsEntry (
   Status = gBS->CalculateCrc32 ((VOID*)gST, gST->Hdr.HeaderSize, &gST->Hdr.CRC32);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  // Now we need to setup the EFI System Table with information about the console devices.\r
+  InitializeConsole ();\r
+\r
   // If BootNext environment variable is defined then we just load it !\r
   BootNextSize = sizeof(UINT16);\r
   Status = GetGlobalEnvironmentVariable (L"BootNext", NULL, &BootNextSize, (VOID**)&BootNext);\r
@@ -544,9 +521,6 @@ BdsEntry (
   // If Boot Order does not exist then create a default entry\r
   DefineDefaultBootEntries ();\r
 \r
-  // Now we need to setup the EFI System Table with information about the console devices.\r
-  InitializeConsole ();\r
-\r
   //\r
   // Update the CRC32 in the EFI System Table header\r
   //\r