2 This driver will report some MMIO/IO resources to dxe core, extract smbios and acpi
3 tables from bootloader.
5 Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "BlSupportDxe.h"
12 Reserve MMIO/IO resource in GCD
14 @param IsMMIO Flag of whether it is mmio resource or io resource.
15 @param GcdType Type of the space.
16 @param BaseAddress Base address of the space.
17 @param Length Length of the space.
18 @param Alignment Align with 2^Alignment
19 @param ImageHandle Handle for the image of this driver.
21 @retval EFI_SUCCESS Reserve successful
24 ReserveResourceInGcd (
27 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
30 IN EFI_HANDLE ImageHandle
36 Status
= gDS
->AddMemorySpace (
42 if (EFI_ERROR (Status
)) {
45 "Failed to add memory space :0x%lx 0x%lx\n",
50 ASSERT_EFI_ERROR (Status
);
51 Status
= gDS
->AllocateMemorySpace (
52 EfiGcdAllocateAddress
,
60 ASSERT_EFI_ERROR (Status
);
62 Status
= gDS
->AddIoSpace (
67 ASSERT_EFI_ERROR (Status
);
68 Status
= gDS
->AllocateIoSpace (
69 EfiGcdAllocateAddress
,
77 ASSERT_EFI_ERROR (Status
);
84 Main entry for the bootloader support DXE module.
86 @param[in] ImageHandle The firmware allocated handle for the EFI image.
87 @param[in] SystemTable A pointer to the EFI System Table.
89 @retval EFI_SUCCESS The entry point is executed successfully.
90 @retval other Some error occurs when executing this entry point.
96 IN EFI_HANDLE ImageHandle
,
97 IN EFI_SYSTEM_TABLE
*SystemTable
101 EFI_HOB_GUID_TYPE
*GuidHob
;
102 EFI_PEI_GRAPHICS_INFO_HOB
*GfxInfo
;
103 ACPI_BOARD_INFO
*AcpiBoardInfo
;
105 Status
= EFI_SUCCESS
;
107 // Report MMIO/IO Resources
109 Status
= ReserveResourceInGcd (TRUE
, EfiGcdMemoryTypeMemoryMappedIo
, 0xFEC00000, SIZE_4KB
, 0, ImageHandle
); // IOAPIC
110 ASSERT_EFI_ERROR (Status
);
112 Status
= ReserveResourceInGcd (TRUE
, EfiGcdMemoryTypeMemoryMappedIo
, 0xFED00000, SIZE_1KB
, 0, ImageHandle
); // HPET
113 ASSERT_EFI_ERROR (Status
);
116 // Find the frame buffer information and update PCDs
118 GuidHob
= GetFirstGuidHob (&gEfiGraphicsInfoHobGuid
);
119 if (GuidHob
!= NULL
) {
120 GfxInfo
= (EFI_PEI_GRAPHICS_INFO_HOB
*)GET_GUID_HOB_DATA (GuidHob
);
121 Status
= PcdSet32S (PcdVideoHorizontalResolution
, GfxInfo
->GraphicsMode
.HorizontalResolution
);
122 ASSERT_EFI_ERROR (Status
);
123 Status
= PcdSet32S (PcdVideoVerticalResolution
, GfxInfo
->GraphicsMode
.VerticalResolution
);
124 ASSERT_EFI_ERROR (Status
);
125 Status
= PcdSet32S (PcdSetupVideoHorizontalResolution
, GfxInfo
->GraphicsMode
.HorizontalResolution
);
126 ASSERT_EFI_ERROR (Status
);
127 Status
= PcdSet32S (PcdSetupVideoVerticalResolution
, GfxInfo
->GraphicsMode
.VerticalResolution
);
128 ASSERT_EFI_ERROR (Status
);
132 // Set PcdPciExpressBaseAddress and PcdPciExpressBaseSize by HOB info
134 GuidHob
= GetFirstGuidHob (&gUefiAcpiBoardInfoGuid
);
135 if (GuidHob
!= NULL
) {
136 AcpiBoardInfo
= (ACPI_BOARD_INFO
*)GET_GUID_HOB_DATA (GuidHob
);
137 Status
= PcdSet64S (PcdPciExpressBaseAddress
, AcpiBoardInfo
->PcieBaseAddress
);
138 ASSERT_EFI_ERROR (Status
);
139 Status
= PcdSet64S (PcdPciExpressBaseSize
, AcpiBoardInfo
->PcieBaseSize
);
140 ASSERT_EFI_ERROR (Status
);