/** @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 - 2010, 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
///\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
\r
-EFI_HANDLE mBdsImageHandle;\r
-\r
/**\r
\r
Install Boot Device Selection Protocol\r
{\r
EFI_STATUS Status;\r
\r
- mBdsImageHandle = ImageHandle;\r
-\r
//\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
//\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
// Parse the boot order to get boot option\r
//\r
BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");\r
+\r
+ //\r
+ // When we didn't have chance to build boot option variables in the first \r
+ // full configuration boot (e.g.: Reset in the first page or in Device Manager),\r
+ // we have no boot options in the following mini configuration boot.\r
+ // Give the last chance to enumerate the boot options.\r
+ //\r
+ if (IsListEmpty (&BootLists)) {\r
+ BdsLibEnumerateAllBootOption (&BootLists);\r
+ }\r
+\r
Link = BootLists.ForwardLink;\r
\r
//\r
//\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
//\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
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
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
InitializeHotkeyService ();\r
\r
//\r
- // Get the BDS private data\r
+ // Fill in FirmwareVendor and FirmwareRevision from PCDs\r
//\r
- PrivateData = EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS (This);\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
+ 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
//\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