]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
1. PI SMBIOS Checkin. Major change include:
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BdsEntry.c
index 55ea3728926cd0a746e0bbcb56acbd4d371c7917..d671c1ea38184a24d9c2231ef1ce76904406ab4b 100644 (file)
@@ -1,5 +1,5 @@
 /** @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
@@ -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
@@ -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
@@ -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", NULL, 0);\r
-  PERF_START (0, "BDS", 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