After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked\r
to enter BDS phase.\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, 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
\r
UINT16 *mBootNext = NULL;\r
\r
+///\r
+/// The read-only variables defined in UEFI Spec.\r
+///\r
+CHAR16 *mReadOnlyVariables[] = {\r
+ L"PlatformLangCodes",\r
+ L"LangCodes",\r
+ L"BootOptionSupport",\r
+ L"HwErrRecSupport",\r
+ L"OsIndicationsSupported"\r
+ };\r
+\r
/**\r
\r
Install Boot Device Selection Protocol\r
//\r
// OS indicater support variable\r
//\r
- OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;\r
+ OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI \\r
+ | EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED;\r
+\r
Status = gRT->SetVariable (\r
L"OsIndicationsSupported",\r
&gEfiGlobalVariableGuid,\r
\r
}\r
\r
+/**\r
+\r
+ Allocate a block of memory that will contain performance data to OS.\r
+\r
+**/\r
+VOID\r
+BdsAllocateMemoryForPerformanceData (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase;\r
+ EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;\r
+\r
+ AcpiLowMemoryBase = 0x0FFFFFFFFULL;\r
+\r
+ //\r
+ // Allocate a block of memory that will contain performance data to OS.\r
+ //\r
+ Status = gBS->AllocatePages (\r
+ AllocateMaxAddress,\r
+ EfiReservedMemoryType,\r
+ EFI_SIZE_TO_PAGES (PERF_DATA_MAX_LENGTH),\r
+ &AcpiLowMemoryBase\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Save the pointer to variable for use in S3 resume.\r
+ //\r
+ Status = gRT->SetVariable (\r
+ L"PerfDataMemAddr",\r
+ &gPerformanceProtocolGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ sizeof (EFI_PHYSICAL_ADDRESS),\r
+ &AcpiLowMemoryBase\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ //\r
+ // Mark L"PerfDataMemAddr" variable to read-only if the Variable Lock protocol exists\r
+ //\r
+ Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = VariableLock->RequestToLock (VariableLock, L"PerfDataMemAddr", &gPerformanceProtocolGuid);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+ }\r
+}\r
+\r
/**\r
\r
Service routine for BdsInstance->Entry(). Devices are connected, the\r
LIST_ENTRY BootOptionList;\r
UINTN BootNextSize;\r
CHAR16 *FirmwareVendor;\r
+ EFI_STATUS Status;\r
+ UINT16 BootTimeOut;\r
+ UINTN Index;\r
+ EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;\r
\r
//\r
// Insert the performance probe\r
PERF_END (NULL, "DXE", NULL, 0);\r
PERF_START (NULL, "BDS", NULL, 0);\r
\r
+ PERF_CODE (\r
+ BdsAllocateMemoryForPerformanceData ();\r
+ );\r
+\r
//\r
// Initialize the global system boot option and driver option\r
//\r
//\r
// Fixup Tasble CRC after we updated Firmware Vendor and Revision\r
//\r
+ gST->Hdr.CRC32 = 0;\r
gBS->CalculateCrc32 ((VOID *)gST, sizeof(EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);\r
\r
//\r
BdsFormalizeEfiGlobalVariable();\r
\r
//\r
- // Do the platform init, can be customized by OEM/IBV\r
+ // Mark the read-only variables if the Variable Lock protocol exists\r
//\r
- PERF_START (NULL, "PlatformBds", "BDS", 0);\r
- PlatformBdsInit ();\r
+ Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);\r
+ DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));\r
+ if (!EFI_ERROR (Status)) {\r
+ for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof (mReadOnlyVariables[0]); Index++) {\r
+ Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+ }\r
+\r
+ //\r
+ // Report Status Code to indicate connecting drivers will happen\r
+ //\r
+ REPORT_STATUS_CODE (\r
+ EFI_PROGRESS_CODE,\r
+ (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS)\r
+ );\r
\r
InitializeHwErrRecSupport();\r
\r
+ //\r
+ // Initialize L"Timeout" EFI global variable.\r
+ //\r
+ BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);\r
+ if (BootTimeOut != 0xFFFF) {\r
+ //\r
+ // If time out value equal 0xFFFF, no need set to 0xFFFF to variable area because UEFI specification\r
+ // define same behavior between no value or 0xFFFF value for L"Timeout".\r
+ //\r
+ Status = gRT->SetVariable (\r
+ L"Timeout",\r
+ &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+ sizeof (UINT16),\r
+ &BootTimeOut\r
+ );\r
+ ASSERT_EFI_ERROR(Status);\r
+ }\r
+\r
//\r
// bugbug: platform specific code\r
// Initialize the platform specific string and language\r
InitializeLanguage (TRUE);\r
InitializeFrontPage (TRUE);\r
\r
+ //\r
+ // Do the platform init, can be customized by OEM/IBV\r
+ //\r
+ PERF_START (NULL, "PlatformBds", "BDS", 0);\r
+ PlatformBdsInit ();\r
+\r
//\r
// Set up the device list based on EFI 1.1 variables\r
// process Driver#### and Load the driver's in the\r