/*++\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation \r
+Copyright (c) 2006 - 2010, Intel Corporation \r
All rights reserved. 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
#define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)\r
\r
-CHAR16 mFirmwareVendor[] = L"TianoCore.org";\r
extern BOOLEAN gConnectAllHappened;\r
extern USB_CLASS_FORMAT_DEVICE_PATH gUsbClassKeyboardDevicePath;\r
\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_PEI_HOB_POINTERS GuidHob;\r
- VOID *Table;\r
- MEMORY_DESC_HOB MemoryDescHob;\r
- UINTN Index;\r
- EFI_PHYSICAL_ADDRESS Memory;\r
-\r
- //\r
- // Get Hob List\r
- //\r
- GuidHob.Raw = GetHobList();\r
+ EFI_STATUS Status;\r
+ EFI_PEI_HOB_POINTERS GuidHob;\r
+ VOID *Table;\r
+ MEMORY_DESC_HOB MemoryDescHob;\r
+ UINTN Index;\r
+ EFI_PHYSICAL_ADDRESS Memory;\r
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;\r
\r
- GuidHob.Raw = GetNextGuidHob (&gEfiLdrMemoryDescriptorGuid, GuidHob.Raw);\r
+ GuidHob.Raw = GetFirstGuidHob (&gEfiLdrMemoryDescriptorGuid);\r
if (GuidHob.Raw == NULL) {\r
DEBUG ((EFI_D_ERROR, "Fail to get gEfiLdrMemoryDescriptorGuid from GUID HOB LIST!\n"));\r
return;\r
(MemoryDescHob.MemDesc[Index].Type == EfiRuntimeServicesCode) ||\r
(MemoryDescHob.MemDesc[Index].Type == EfiACPIReclaimMemory) ||\r
(MemoryDescHob.MemDesc[Index].Type == EfiACPIMemoryNVS)) {\r
- DEBUG ((EFI_D_ERROR, "PhysicalStart - 0x%x, ", MemoryDescHob.MemDesc[Index].PhysicalStart));\r
- DEBUG ((EFI_D_ERROR, "PageNumber - 0x%x, ", MemoryDescHob.MemDesc[Index].NumberOfPages));\r
- DEBUG ((EFI_D_ERROR, "Type - 0x%x\n", MemoryDescHob.MemDesc[Index].Type));\r
+ DEBUG ((EFI_D_ERROR, "PhysicalStart - 0x%016lx, ", MemoryDescHob.MemDesc[Index].PhysicalStart));\r
+ DEBUG ((EFI_D_ERROR, "PageNumber - 0x%016lx, ", MemoryDescHob.MemDesc[Index].NumberOfPages));\r
+ DEBUG ((EFI_D_ERROR, "Attribute - 0x%016lx, ", MemoryDescHob.MemDesc[Index].Attribute));\r
+ DEBUG ((EFI_D_ERROR, "Type - 0x%08x\n", MemoryDescHob.MemDesc[Index].Type));\r
if ((MemoryDescHob.MemDesc[Index].Type == EfiRuntimeServicesData) ||\r
(MemoryDescHob.MemDesc[Index].Type == EfiRuntimeServicesCode)) {\r
//\r
- // Skip RuntimeSevicesData and RuntimeServicesCode, they are BFV\r
+ // For RuntimeSevicesData and RuntimeServicesCode, they are BFV or DxeCore.\r
+ // The memory type is assigned in EfiLdr\r
+ //\r
+ Status = gDS->GetMemorySpaceDescriptor (MemoryDescHob.MemDesc[Index].PhysicalStart, &Descriptor);\r
+ if (EFI_ERROR (Status)) {\r
+ continue;\r
+ }\r
+ if (Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved) {\r
+ //\r
+ // BFV or tested DXE core\r
+ //\r
+ continue;\r
+ }\r
+ //\r
+ // Untested DXE Core region, free and remove\r
+ //\r
+ Status = gDS->FreeMemorySpace (\r
+ MemoryDescHob.MemDesc[Index].PhysicalStart,\r
+ LShiftU64 (MemoryDescHob.MemDesc[Index].NumberOfPages, EFI_PAGE_SHIFT)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((EFI_D_ERROR, "FreeMemorySpace fail - %r!\n", Status));\r
+ continue;\r
+ }\r
+ Status = gDS->RemoveMemorySpace (\r
+ MemoryDescHob.MemDesc[Index].PhysicalStart,\r
+ LShiftU64 (MemoryDescHob.MemDesc[Index].NumberOfPages, EFI_PAGE_SHIFT)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((EFI_D_ERROR, "RemoveMemorySpace fail - %r!\n", Status));\r
+ continue;\r
+ }\r
+\r
+ //\r
+ // Convert Runtime type to BootTime type\r
+ //\r
+ if (MemoryDescHob.MemDesc[Index].Type == EfiRuntimeServicesData) {\r
+ MemoryDescHob.MemDesc[Index].Type = EfiBootServicesData;\r
+ } else {\r
+ MemoryDescHob.MemDesc[Index].Type = EfiBootServicesCode;\r
+ }\r
+\r
+ //\r
+ // PassThrough, let below code add and alloate.\r
//\r
- continue;\r
}\r
+ //\r
+ // ACPI or reserved memory\r
+ //\r
Status = gDS->AddMemorySpace (\r
EfiGcdMemoryTypeSystemMemory,\r
MemoryDescHob.MemDesc[Index].PhysicalStart,\r
MemoryDescHob.MemDesc[Index].Attribute\r
);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((EFI_D_ERROR, "AddMemorySpace fail!\n"));\r
+ DEBUG ((EFI_D_ERROR, "AddMemorySpace fail - %r!\n", Status));\r
if ((MemoryDescHob.MemDesc[Index].Type == EfiACPIReclaimMemory) ||\r
(MemoryDescHob.MemDesc[Index].Type == EfiACPIMemoryNVS)) {\r
//\r
&Memory\r
);\r
if (EFI_ERROR (Status)) {\r
- DEBUG ((EFI_D_ERROR, "AllocatePages fail!\n"));\r
+ DEBUG ((EFI_D_ERROR, "AllocatePages fail - %r!\n", Status));\r
//\r
// For the page added, it must be allocated.\r
//\r
if (!EFI_ERROR (Status)) {\r
if ((PCI_CLASS_SERIAL == Class[2]) &&\r
(PCI_CLASS_SERIAL_USB == Class[1])) {\r
- if (PCI_CLASSC_PI_UHCI == Class[0]) {\r
+ if (PCI_IF_UHCI == Class[0]) {\r
//\r
// Found the UHCI, then disable the legacy support\r
//\r
Command = 0;\r
Status = PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, 0xC0, 1, &Command);\r
- } else if (PCI_CLASSC_PI_EHCI == Class[0]) {\r
+ } else if (PCI_IF_EHCI == Class[0]) {\r
//\r
// Found the EHCI, then disable the legacy support\r
//\r
\r
--*/\r
{\r
- //\r
- // set firmwarevendor, here can be IBV/OEM customize\r
- //\r
- gST->FirmwareVendor = AllocateRuntimeCopyPool (\r
- sizeof (mFirmwareVendor),\r
- &mFirmwareVendor\r
- );\r
- ASSERT (gST->FirmwareVendor != NULL);\r
-\r
- gST->FirmwareRevision = 0;\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
GetSystemTablesFromHob ();\r
\r
UpdateMemoryMap ();\r
VOID\r
PlatformBdsDiagnostics (\r
IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,\r
- IN BOOLEAN QuietBoot\r
+ IN BOOLEAN QuietBoot,\r
+ IN BASEM_MEMORY_TEST BaseMemoryTest\r
)\r
/*++\r
\r
MemoryTestLevel - The memory test intensive level\r
\r
QuietBoot - Indicate if need to enable the quiet boot\r
+\r
+ BaseMemoryTest - A pointer to BdsMemoryTest()\r
\r
Returns:\r
\r
// from the graphic lib\r
//\r
if (QuietBoot) {\r
- Status = EnableQuietBoot (&gEfiDefaultBmpLogoGuid);\r
+ Status = EnableQuietBoot (PcdGetPtr(PcdLogoFile));\r
if (EFI_ERROR (Status)) {\r
DisableQuietBoot ();\r
return;\r
//\r
// Perform system diagnostic\r
//\r
- Status = BdsMemoryTest (MemoryTestLevel);\r
+ Status = BaseMemoryTest (MemoryTestLevel);\r
if (EFI_ERROR (Status)) {\r
DisableQuietBoot ();\r
}\r
//\r
// Perform system diagnostic\r
//\r
- Status = BdsMemoryTest (MemoryTestLevel);\r
+ Status = BaseMemoryTest (MemoryTestLevel);\r
}\r
\r
VOID\r
EFIAPI\r
PlatformBdsPolicyBehavior (\r
IN OUT LIST_ENTRY *DriverOptionList,\r
- IN OUT LIST_ENTRY *BootOptionList\r
+ IN OUT LIST_ENTRY *BootOptionList,\r
+ IN PROCESS_CAPSULES ProcessCapsules,\r
+ IN BASEM_MEMORY_TEST BaseMemoryTest\r
)\r
/*++\r
\r
EFI_STATUS Status;\r
UINT16 Timeout;\r
EFI_EVENT UserInputDurationTime;\r
- LIST_ENTRY *Link;\r
- BDS_COMMON_OPTION *BootOption;\r
UINTN Index;\r
EFI_INPUT_KEY Key;\r
- EFI_TPL OldTpl;\r
EFI_BOOT_MODE BootMode;\r
\r
//\r
//\r
// Memory test and Logo show\r
//\r
- PlatformBdsDiagnostics (IGNORE, TRUE);\r
+ PlatformBdsDiagnostics (IGNORE, TRUE, BaseMemoryTest);\r
\r
//\r
// Perform some platform specific connect sequence\r
//\r
// To give the User a chance to enter Setup here, if user set TimeOut is 0.\r
// BDS should still give user a chance to enter Setup\r
- //\r
- // Connect first boot option, and then check user input before exit \r
- //\r
- for (Link = BootOptionList->ForwardLink; Link != BootOptionList;Link = Link->ForwardLink) {\r
- BootOption = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);\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
- //\r
- continue;\r
- } else {\r
- //\r
- // Make sure the boot option device path connected, but ignore the BBS device path\r
- //\r
- if (DevicePathType (BootOption->DevicePath) != BBS_DEVICE_PATH) {\r
- BdsLibConnectDevicePath (BootOption->DevicePath);\r
- } \r
- break; \r
- }\r
- } \r
-\r
- //\r
// Check whether the user input after the duration time has expired \r
//\r
- OldTpl = EfiGetCurrentTpl();\r
- gBS->RestoreTPL (TPL_APPLICATION); \r
gBS->WaitForEvent (1, &UserInputDurationTime, &Index);\r
gBS->CloseEvent (UserInputDurationTime);\r
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
- gBS->RaiseTPL (OldTpl); \r
\r
if (!EFI_ERROR (Status)) {\r
//\r
\r
return EFI_SUCCESS; \r
} \r
+ \r
+/**\r
+ Lock the ConsoleIn device in system table. All key\r
+ presses will be ignored until the Password is typed in. The only way to\r
+ disable the password is to type it in to a ConIn device.\r
+\r
+ @param Password Password used to lock ConIn device.\r
+\r
+ @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.\r
+ @retval EFI_UNSUPPORTED Password not found\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LockKeyboards (\r
+ IN CHAR16 *Password\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ This function locks platform flash that is not allowed to be updated during normal boot path.\r
+ The flash layout is platform specific.\r
+\r
+ **/\r
+VOID\r
+EFIAPI\r
+PlatformBdsLockNonUpdatableFlash (\r
+ VOID\r
+ )\r
+{\r
+ return;\r
+}\r