11STATIC UINT32 mTopOfLowerUsableDram = 0;
19 { EfiMaxMemoryType, 0 }
48 if (AcpiBoardInfo ==
NULL) {
49 return EFI_INVALID_PARAMETER;
55 if ((MemoryMapEntry->Type == E820_RAM) || (MemoryMapEntry->Type == E820_ACPI)) {
59 if (MemoryMapEntry->Base == AcpiBoardInfo->PcieBaseAddress) {
63 Type = EFI_RESOURCE_MEMORY_MAPPED_IO;
64 }
else if (MemoryMapEntry->Base < mTopOfLowerUsableDram) {
68 Type = EFI_RESOURCE_MEMORY_RESERVED;
69 }
else if ((MemoryMapEntry->Base < 0x100000000ULL) && (MemoryMapEntry->Base >= mTopOfLowerUsableDram)) {
73 Type = EFI_RESOURCE_MEMORY_MAPPED_IO;
75 Type = EFI_RESOURCE_MEMORY_RESERVED;
78 Base = MemoryMapEntry->Base;
79 Size = MemoryMapEntry->Size;
81 Attribue = EFI_RESOURCE_ATTRIBUTE_PRESENT |
82 EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
83 EFI_RESOURCE_ATTRIBUTE_TESTED |
84 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
85 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
86 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
87 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
90 DEBUG ((DEBUG_INFO,
"buildhob: base = 0x%lx, size = 0x%lx, type = 0x%x\n", Base, Size, Type));
92 if ((MemoryMapEntry->Type == E820_UNUSABLE) ||
93 (MemoryMapEntry->Type == E820_DISABLED))
96 }
else if (MemoryMapEntry->Type == E820_PMEM) {
132 if ((MemoryMapEntry->Type == E820_UNUSABLE) || (MemoryMapEntry->Type == E820_DISABLED) ||
133 (MemoryMapEntry->Type == E820_PMEM))
141 if ((MemoryMapEntry->Base + MemoryMapEntry->Size) > 0x100000000ULL) {
145 if ((MemoryMapEntry->Type == E820_RAM) || (MemoryMapEntry->Type == E820_ACPI) ||
146 (MemoryMapEntry->Type == E820_NVS))
151 if (mTopOfLowerUsableDram < (MemoryMapEntry->Base + MemoryMapEntry->Size)) {
152 mTopOfLowerUsableDram = (UINT32)(MemoryMapEntry->Base + MemoryMapEntry->Size);
161 if (mTopOfLowerUsableDram == MemoryMapEntry->Base) {
162 mTopOfLowerUsableDram = (UINT32)(MemoryMapEntry->Base + MemoryMapEntry->Size);
195 if ((MemoryMapEntry->Type != E820_RAM) && (MemoryMapEntry->Type != E820_ACPI) &&
196 (MemoryMapEntry->Type != E820_NVS))
201 Type = EFI_RESOURCE_SYSTEM_MEMORY;
202 Base = MemoryMapEntry->Base;
203 Size = MemoryMapEntry->Size;
205 Attribue = EFI_RESOURCE_ATTRIBUTE_PRESENT |
206 EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
207 EFI_RESOURCE_ATTRIBUTE_TESTED |
208 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
209 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
210 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
211 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
214 DEBUG ((DEBUG_INFO,
"buildhob: base = 0x%lx, size = 0x%lx, type = 0x%x\n", Base, Size, Type));
216 if (MemoryMapEntry->Type == E820_ACPI) {
218 }
else if (MemoryMapEntry->Type == E820_NVS) {
248 DEBUG ((DEBUG_INFO,
"Guessing Top of Lower Usable DRAM:\n"));
250 if (EFI_ERROR (Status)) {
254 DEBUG ((DEBUG_INFO,
"Assuming TOLUD = 0x%x\n", mTopOfLowerUsableDram));
259 DEBUG ((DEBUG_INFO,
"Building ResourceDescriptorHobs for usable memory:\n"));
261 if (EFI_ERROR (Status)) {
269 if (!EFI_ERROR (Status)) {
270 NewGfxInfo =
BuildGuidHob (&gEfiGraphicsInfoHobGuid,
sizeof (GfxInfo));
271 ASSERT (NewGfxInfo !=
NULL);
272 CopyMem (NewGfxInfo, &GfxInfo,
sizeof (GfxInfo));
273 DEBUG ((DEBUG_INFO,
"Created graphics info hob\n"));
277 if (!EFI_ERROR (Status)) {
278 NewGfxDeviceInfo =
BuildGuidHob (&gEfiGraphicsDeviceInfoHobGuid,
sizeof (GfxDeviceInfo));
279 ASSERT (NewGfxDeviceInfo !=
NULL);
280 CopyMem (NewGfxDeviceInfo, &GfxDeviceInfo,
sizeof (GfxDeviceInfo));
281 DEBUG ((DEBUG_INFO,
"Created graphics device info hob\n"));
288 ASSERT (SmBiosTableHob !=
NULL);
289 SmBiosTableHob->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION;
291 DEBUG ((DEBUG_INFO,
"Create smbios table gUniversalPayloadSmbiosTableGuid guid hob\n"));
293 if (!EFI_ERROR (Status)) {
294 DEBUG ((DEBUG_INFO,
"Detected Smbios Table at 0x%lx\n", SmBiosTableHob->SmBiosEntryPoint));
301 ASSERT (AcpiTableHob !=
NULL);
302 AcpiTableHob->Header.Revision = UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION;
304 DEBUG ((DEBUG_INFO,
"Create ACPI table gUniversalPayloadAcpiTableGuid guid hob\n"));
306 if (!EFI_ERROR (Status)) {
307 DEBUG ((DEBUG_INFO,
"Detected ACPI Table at 0x%lx\n", AcpiTableHob->Rsdp));
314 ASSERT (AcpiBoardInfo !=
NULL);
319 DEBUG ((DEBUG_INFO,
"Building ResourceDescriptorHobs for reserved memory:\n"));
321 if (EFI_ERROR (Status)) {
329 if (EFI_ERROR (Status)) {
330 DEBUG ((DEBUG_WARN,
"Error when parsing misc info, Status = %r\n", Status));
337 if (EFI_ERROR (Status)) {
338 DEBUG ((DEBUG_ERROR,
"Error when parsing platform info, Status = %r\n", Status));
355 UINT8 PhysicalAddressBits;
365 if (RegEax >= 0x80000008) {
367 PhysicalAddressBits = (UINT8)RegEax;
369 PhysicalAddressBits = 36;
377 ResourceAttribute = (
378 EFI_RESOURCE_ATTRIBUTE_PRESENT |
379 EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
380 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
381 EFI_RESOURCE_ATTRIBUTE_TESTED
401 PHYSICAL_ADDRESS DxeCoreEntryPoint;
409 Status =
PcdSet64S (PcdBootloaderParameter, BootloaderParameter);
416 MemBase =
PcdGet32 (PcdPayloadFdMemBase);
418 HobMemTop = HobMemBase +
FixedPcdGet32 (PcdSystemMemoryUefiRegionSize);
420 HobConstructor ((VOID *)MemBase, (VOID *)HobMemTop, (VOID *)HobMemBase, (VOID *)HobMemTop);
426 if (!EFI_ERROR (Status)) {
428 ASSERT (UniversalSerialPort !=
NULL);
429 UniversalSerialPort->Header.Revision = UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO_REVISION;
431 UniversalSerialPort->UseMmio = (SerialPortInfo.Type == 1) ?
FALSE :
TRUE;
432 UniversalSerialPort->RegisterBase = SerialPortInfo.BaseAddr;
433 UniversalSerialPort->BaudRate = SerialPortInfo.Baud;
434 UniversalSerialPort->RegisterStride = (UINT8)SerialPortInfo.RegWidth;
436 if (SerialPortInfo.InputHertz > 0) {
437 Status =
PcdSet32S (PcdSerialClockRate, SerialPortInfo.InputHertz);
439 DEBUG ((DEBUG_ERROR,
"Failed to set PcdSerialClockRate; Status = %r\n", Status));
446 ProcessLibraryConstructorList ();
447 DEBUG ((DEBUG_INFO,
"sizeof(UINTN) = 0x%x\n",
sizeof (
UINTN)));
451 if (EFI_ERROR (Status)) {
452 DEBUG ((DEBUG_ERROR,
"BuildHobFromBl Status = %r\n", Status));
463 &gEfiMemoryTypeInformationGuid,
464 mDefaultMemoryTypeInformation,
465 sizeof (mDefaultMemoryTypeInformation)
472 DEBUG ((DEBUG_INFO,
"DxeCoreEntryPoint = 0x%lx\n", DxeCoreEntryPoint));
477 IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, 0xFF);
478 IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, 0xFF);
VOID *EFIAPI GetFirstHob(IN UINT16 Type)
VOID *EFIAPI BuildGuidDataHob(IN CONST EFI_GUID *Guid, IN VOID *Data, IN UINTN DataLength)
VOID EFIAPI BuildCpuHob(IN UINT8 SizeOfMemorySpace, IN UINT8 SizeOfIoSpace)
VOID EFIAPI BuildResourceDescriptorHob(IN EFI_RESOURCE_TYPE ResourceType, IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, IN EFI_PHYSICAL_ADDRESS PhysicalStart, IN UINT64 NumberOfBytes)
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
VOID EFIAPI BuildMemoryAllocationHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_MEMORY_TYPE MemoryType)
VOID EFIAPI CpuDeadLoop(VOID)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
RETURN_STATUS EFIAPI ParseSmbiosTable(OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmbiosTable)
RETURN_STATUS EFIAPI ParseMemoryInfo(IN BL_MEM_INFO_CALLBACK MemInfoCallback, IN VOID *Params)
RETURN_STATUS EFIAPI ParseGfxDeviceInfo(OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *GfxDeviceInfo)
RETURN_STATUS EFIAPI ParseGfxInfo(OUT EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo)
RETURN_STATUS EFIAPI ParseAcpiTableInfo(OUT UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTableHob)
RETURN_STATUS EFIAPI ParseSerialInfo(OUT SERIAL_PORT_INFO *SerialPortInfo)
RETURN_STATUS EFIAPI ParseMiscInfo(VOID)
VOID HandOffToDxeCore(IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint, IN EFI_PEI_HOB_POINTERS HobList)
ACPI_BOARD_INFO * BuildHobFromAcpi(IN UINT64 AcpiTableBase)
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
EFI_STATUS LoadDxeCore(OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint)
#define RETURN_ERROR(StatusCode)
#define ALIGN_VALUE(Value, Alignment)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
UINT32 EFIAPI AsmCpuid(IN UINT32 Index, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
#define FixedPcdGet32(TokenName)
#define PcdGet32(TokenName)
#define PcdSet64S(TokenName, Value)
#define PcdSet32S(TokenName, Value)
UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE
UINT64 EFI_PHYSICAL_ADDRESS
VOID BuildGenericHob(VOID)
EFI_STATUS FindToludCallback(IN MEMORY_MAP_ENTRY *MemoryMapEntry, IN VOID *Params)
EFI_STATUS MemInfoCallback(IN MEMORY_MAP_ENTRY *MemoryMapEntry, IN VOID *Params)
EFI_STATUS BuildHobFromBl(VOID)
EFI_STATUS EFIAPI _ModuleEntryPoint(IN UINTN BootloaderParameter)
EFI_STATUS MemInfoCallbackMmio(IN MEMORY_MAP_ENTRY *MemoryMapEntry, IN VOID *Params)
VOID EFIAPI InitializeFloatingPointUnits(VOID)