TianoCore EDK2 master
Loading...
Searching...
No Matches
BlSupportDxe.c
Go to the documentation of this file.
1
9#include "BlSupportDxe.h"
10
25 IN BOOLEAN IsMMIO,
26 IN UINTN GcdType,
27 IN EFI_PHYSICAL_ADDRESS BaseAddress,
28 IN UINT64 Length,
29 IN UINTN Alignment,
30 IN EFI_HANDLE ImageHandle
31 )
32{
33 EFI_STATUS Status;
34
35 if (IsMMIO) {
36 Status = gDS->AddMemorySpace (
37 GcdType,
38 BaseAddress,
39 Length,
40 EFI_MEMORY_UC
41 );
42 if (EFI_ERROR (Status)) {
43 DEBUG ((
44 DEBUG_WARN,
45 "Failed to add memory space :0x%lx 0x%lx\n",
46 BaseAddress,
47 Length
48 ));
49 }
50
51 Status = gDS->AllocateMemorySpace (
53 GcdType,
54 Alignment,
55 Length,
56 &BaseAddress,
57 ImageHandle,
58 NULL
59 );
60 } else {
61 Status = gDS->AddIoSpace (
62 GcdType,
63 BaseAddress,
64 Length
65 );
66 if (EFI_ERROR (Status)) {
67 DEBUG ((
68 DEBUG_WARN,
69 "Failed to add IO space :0x%lx 0x%lx\n",
70 BaseAddress,
71 Length
72 ));
73 }
74
75 Status = gDS->AllocateIoSpace (
77 GcdType,
78 Alignment,
79 Length,
80 &BaseAddress,
81 ImageHandle,
82 NULL
83 );
84 }
85
86 return Status;
87}
88
100EFIAPI
102 IN EFI_HANDLE ImageHandle,
103 IN EFI_SYSTEM_TABLE *SystemTable
104 )
105{
106 EFI_STATUS Status;
107 EFI_HOB_GUID_TYPE *GuidHob;
109 ACPI_BOARD_INFO *AcpiBoardInfo;
110
111 Status = EFI_SUCCESS;
112 //
113 // Report MMIO/IO Resources
114 //
115 ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC
116
117 ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, ImageHandle); // HPET
118
119 //
120 // Find the frame buffer information and update PCDs
121 //
122 GuidHob = GetFirstGuidHob (&gEfiGraphicsInfoHobGuid);
123 if (GuidHob != NULL) {
124 GfxInfo = (EFI_PEI_GRAPHICS_INFO_HOB *)GET_GUID_HOB_DATA (GuidHob);
125 Status = PcdSet32S (PcdVideoHorizontalResolution, GfxInfo->GraphicsMode.HorizontalResolution);
126 ASSERT_EFI_ERROR (Status);
127 Status = PcdSet32S (PcdVideoVerticalResolution, GfxInfo->GraphicsMode.VerticalResolution);
128 ASSERT_EFI_ERROR (Status);
129 Status = PcdSet32S (PcdSetupVideoHorizontalResolution, GfxInfo->GraphicsMode.HorizontalResolution);
130 ASSERT_EFI_ERROR (Status);
131 Status = PcdSet32S (PcdSetupVideoVerticalResolution, GfxInfo->GraphicsMode.VerticalResolution);
132 ASSERT_EFI_ERROR (Status);
133 }
134
135 //
136 // Set PcdPciExpressBaseAddress and PcdPciExpressBaseSize by HOB info
137 //
139 if (GuidHob != NULL) {
140 AcpiBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob);
141 Status = PcdSet64S (PcdPciExpressBaseAddress, AcpiBoardInfo->PcieBaseAddress);
142 ASSERT_EFI_ERROR (Status);
143 Status = PcdSet64S (PcdPciExpressBaseSize, AcpiBoardInfo->PcieBaseSize);
144 ASSERT_EFI_ERROR (Status);
145 }
146
147 return EFI_SUCCESS;
148}
UINT64 UINTN
EFI_GUID gUefiAcpiBoardInfoGuid
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
Definition: HobLib.c:215
EFI_STATUS EFIAPI BlDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: BlSupportDxe.c:101
EFI_STATUS ReserveResourceInGcd(IN BOOLEAN IsMMIO, IN UINTN GcdType, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINTN Alignment, IN EFI_HANDLE ImageHandle)
Definition: BlSupportDxe.c:24
EFI_DXE_SERVICES * gDS
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
STATIC UINTN PcdPciExpressBaseSize(VOID)
Definition: PciExpressLib.c:92
#define PcdSet64S(TokenName, Value)
Definition: PcdLib.h:511
#define PcdSet32S(TokenName, Value)
Definition: PcdLib.h:497
@ EfiGcdMemoryTypeMemoryMappedIo
Definition: PiDxeCis.h:44
@ EfiGcdAllocateAddress
Definition: PiDxeCis.h:107
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112