2 This driver will report some MMIO/IO resources to dxe core, extract smbios and acpi
3 tables from coreboot and install.
5 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "CbSupportDxe.h"
18 Reserve MMIO/IO resource in GCD
20 @param IsMMIO Flag of whether it is mmio resource or io resource.
21 @param GcdType Type of the space.
22 @param BaseAddress Base address of the space.
23 @param Length Length of the space.
24 @param Alignment Align with 2^Alignment
25 @param ImageHandle Handle for the image of this driver.
27 @retval EFI_SUCCESS Reserve successful
30 CbReserveResourceInGcd (
33 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
36 IN EFI_HANDLE ImageHandle
42 Status
= gDS
->AddMemorySpace (
48 if (EFI_ERROR (Status
)) {
51 "Failed to add memory space :0x%lx 0x%lx\n",
56 ASSERT_EFI_ERROR (Status
);
57 Status
= gDS
->AllocateMemorySpace (
58 EfiGcdAllocateAddress
,
66 ASSERT_EFI_ERROR (Status
);
68 Status
= gDS
->AddIoSpace (
73 ASSERT_EFI_ERROR (Status
);
74 Status
= gDS
->AllocateIoSpace (
75 EfiGcdAllocateAddress
,
83 ASSERT_EFI_ERROR (Status
);
90 Main entry for the Coreboot Support DXE module.
92 @param[in] ImageHandle The firmware allocated handle for the EFI image.
93 @param[in] SystemTable A pointer to the EFI System Table.
95 @retval EFI_SUCCESS The entry point is executed successfully.
96 @retval other Some error occurs when executing this entry point.
102 IN EFI_HANDLE ImageHandle
,
103 IN EFI_SYSTEM_TABLE
*SystemTable
107 EFI_HOB_GUID_TYPE
*GuidHob
;
108 SYSTEM_TABLE_INFO
*pSystemTableInfo
;
109 FRAME_BUFFER_INFO
*FbInfo
;
111 Status
= EFI_SUCCESS
;
113 // Report MMIO/IO Resources
115 Status
= CbReserveResourceInGcd (TRUE
, EfiGcdMemoryTypeMemoryMappedIo
, 0xFEC00000, SIZE_4KB
, 0, SystemTable
); // IOAPIC
116 ASSERT_EFI_ERROR (Status
);
118 Status
= CbReserveResourceInGcd (TRUE
, EfiGcdMemoryTypeMemoryMappedIo
, 0xFED00000, SIZE_1KB
, 0, SystemTable
); // HPET
119 ASSERT_EFI_ERROR (Status
);
122 // Find the system table information guid hob
124 GuidHob
= GetFirstGuidHob (&gUefiSystemTableInfoGuid
);
125 ASSERT (GuidHob
!= NULL
);
126 pSystemTableInfo
= (SYSTEM_TABLE_INFO
*)GET_GUID_HOB_DATA (GuidHob
);
129 // Install Acpi Table
131 if (pSystemTableInfo
->AcpiTableBase
!= 0 && pSystemTableInfo
->AcpiTableSize
!= 0) {
132 DEBUG ((EFI_D_ERROR
, "Install Acpi Table at 0x%lx, length 0x%x\n", pSystemTableInfo
->AcpiTableBase
, pSystemTableInfo
->AcpiTableSize
));
133 Status
= gBS
->InstallConfigurationTable (&gEfiAcpiTableGuid
, (VOID
*)(UINTN
)pSystemTableInfo
->AcpiTableBase
);
134 ASSERT_EFI_ERROR (Status
);
138 // Install Smbios Table
140 if (pSystemTableInfo
->SmbiosTableBase
!= 0 && pSystemTableInfo
->SmbiosTableSize
!= 0) {
141 DEBUG ((EFI_D_ERROR
, "Install Smbios Table at 0x%lx, length 0x%x\n", pSystemTableInfo
->SmbiosTableBase
, pSystemTableInfo
->SmbiosTableSize
));
142 Status
= gBS
->InstallConfigurationTable (&gEfiSmbiosTableGuid
, (VOID
*)(UINTN
)pSystemTableInfo
->SmbiosTableBase
);
143 ASSERT_EFI_ERROR (Status
);
147 // Find the frame buffer information and update PCDs
149 GuidHob
= GetFirstGuidHob (&gUefiFrameBufferInfoGuid
);
150 if (GuidHob
!= NULL
) {
151 FbInfo
= (FRAME_BUFFER_INFO
*)GET_GUID_HOB_DATA (GuidHob
);
152 Status
= PcdSet32S (PcdVideoHorizontalResolution
, FbInfo
->HorizontalResolution
);
153 ASSERT_EFI_ERROR (Status
);
154 Status
= PcdSet32S (PcdVideoVerticalResolution
, FbInfo
->VerticalResolution
);
155 ASSERT_EFI_ERROR (Status
);
156 Status
= PcdSet32S (PcdSetupVideoHorizontalResolution
, FbInfo
->HorizontalResolution
);
157 ASSERT_EFI_ERROR (Status
);
158 Status
= PcdSet32S (PcdSetupVideoVerticalResolution
, FbInfo
->VerticalResolution
);
159 ASSERT_EFI_ERROR (Status
);