]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
Program SD Cards into 4-bit mode (support for this is required in the spec). This...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BdsEntry.c
index d8bf26a7bb339f4c4b67aea794a39608b576fe9a..f89d8b8ebef1ca5951a0a27fa9cbaa6330baf950 100644 (file)
@@ -1,12 +1,12 @@
 /** @file\r
-  This module produce main entry for BDS phase - BdsEntry. \r
+  This module produce main entry for BDS phase - BdsEntry.\r
   When this module was dispatched by DxeCore, gEfiBdsArchProtocolGuid will be installed\r
   which contains interface of BdsEntry.\r
   After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked\r
   to enter BDS phase.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -27,17 +27,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 ///\r
 /// Note: Current BDS not directly get the BootMode, DefaultBoot,\r
 /// TimeoutDefault, MemoryTestLevel value from the BDS arch protocol.\r
-/// Please refer to the library useage of BdsLibGetBootMode, BdsLibGetTimeout \r
+/// Please refer to the library useage of BdsLibGetBootMode, BdsLibGetTimeout\r
 /// and PlatformBdsDiagnostics in BdsPlatform.c\r
 ///\r
-EFI_BDS_ARCH_PROTOCOL_INSTANCE  gBdsInstanceTemplate = {\r
-  EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE,\r
-  NULL,\r
-  {BdsEntry},\r
-  0xFFFF,\r
-  TRUE,\r
-  0,\r
-  EXTENSIVE\r
+EFI_HANDLE  gBdsHandle = NULL;\r
+\r
+EFI_BDS_ARCH_PROTOCOL  gBds = {\r
+  BdsEntry\r
 };\r
 \r
 UINT16                          *mBootNext = NULL;\r
@@ -70,11 +66,10 @@ BdsInitialize (
   //\r
   // Install protocol interface\r
   //\r
-  Status = gBS->InstallProtocolInterface (\r
-                  &gBdsInstanceTemplate.Handle,\r
-                  &gEfiBdsArchProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &gBdsInstanceTemplate.Bds\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &gBdsHandle,\r
+                  &gEfiBdsArchProtocolGuid, &gBds,\r
+                  NULL\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -138,14 +133,14 @@ BdsBootDeviceSelect (
     //\r
     UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);\r
     BootOption = BdsLibVariableToOption (&BootLists, Buffer);\r
-    \r
+\r
     //\r
     // If fail to get boot option from variable, just return and do nothing.\r
     //\r
     if (BootOption == NULL) {\r
       return;\r
     }\r
-    \r
+\r
     BootOption->BootCurrent = *mBootNext;\r
   }\r
   //\r
@@ -196,7 +191,7 @@ BdsBootDeviceSelect (
     //\r
     if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {\r
       //\r
-      // skip the header of the link list, becuase it has no boot option\r
+      // skip the header of the link list, because it has no boot option\r
       //\r
       Link = Link->ForwardLink;\r
       continue;\r
@@ -233,7 +228,7 @@ BdsBootDeviceSelect (
       //\r
       // Call platform action to indicate the boot success\r
       //\r
-      BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED)); \r
+      BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));\r
       PlatformBdsBootSuccess (BootOption);\r
 \r
       //\r
@@ -244,7 +239,7 @@ BdsBootDeviceSelect (
       PlatformBdsEnterFrontPage (Timeout, FALSE);\r
 \r
       //\r
-      // Rescan the boot option list, avoid pertential risk of the boot\r
+      // Rescan the boot option list, avoid potential risk of the boot\r
       // option change in front page\r
       //\r
       if (BootNextExist) {\r
@@ -280,16 +275,16 @@ BdsEntry (
   IN EFI_BDS_ARCH_PROTOCOL  *This\r
   )\r
 {\r
-  EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData;\r
   LIST_ENTRY                      DriverOptionList;\r
   LIST_ENTRY                      BootOptionList;\r
   UINTN                           BootNextSize;\r
+  CHAR16                          *FirmwareVendor;\r
 \r
   //\r
   // Insert the performance probe\r
   //\r
-  PERF_END (0, DXE_TOK, NULL, 0);\r
-  PERF_START (0, BDS_TOK, NULL, 0);\r
+  PERF_END (NULL, "DXE", NULL, 0);\r
+  PERF_START (NULL, "BDS", NULL, 0);\r
 \r
   //\r
   // Initialize the global system boot option and driver option\r
@@ -303,19 +298,26 @@ BdsEntry (
   InitializeHotkeyService ();\r
 \r
   //\r
-  // Get the BDS private data\r
+  // Fill in FirmwareVendor and FirmwareRevision from PCDs\r
+  //\r
+  FirmwareVendor = (CHAR16 *)PcdGetPtr (PcdFirmwareVendor);\r
+  gST->FirmwareVendor = AllocateRuntimeCopyPool (StrSize (FirmwareVendor), FirmwareVendor);\r
+  ASSERT (gST->FirmwareVendor != NULL);\r
+  gST->FirmwareRevision = PcdGet32 (PcdFirmwareRevision);\r
+\r
+  //\r
+  // Fixup Tasble CRC after we updated Firmware Vendor and Revision\r
   //\r
-  PrivateData = EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS (This);\r
+  gBS->CalculateCrc32 ((VOID *)gST, sizeof(EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);\r
 \r
   //\r
   // Do the platform init, can be customized by OEM/IBV\r
   //\r
-  PERF_START (0, "PlatformBds", "BDS", 0);\r
-  PlatformBdsInit (PrivateData);\r
+  PERF_START (NULL, "PlatformBds", "BDS", 0);\r
+  PlatformBdsInit ();\r
+\r
+  InitializeHwErrRecSupport();\r
 \r
-  if (FeaturePcdGet (PcdSupportHardwareErrorRecord)) {\r
-    InitializeHwErrRecSupport (PcdGet16 (PcdHardwareErrorRecordLevel));\r
-  }\r
   //\r
   // bugbug: platform specific code\r
   // Initialize the platform specific string and language\r
@@ -345,8 +347,8 @@ BdsEntry (
   //\r
   // Setup some platform policy here\r
   //\r
-  PlatformBdsPolicyBehavior (PrivateData, &DriverOptionList, &BootOptionList);\r
-  PERF_END (0, "PlatformBds", "BDS", 0);\r
+  PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, BdsProcessCapsules, BdsMemoryTest);\r
+  PERF_END (NULL, "PlatformBds", "BDS", 0);\r
 \r
   //\r
   // BDS select the boot device to load OS\r