1 | Index: OvmfPkg/PlatformPei/Platform.c
|
---|
2 | ===================================================================
|
---|
3 | --- OvmfPkg/PlatformPei/Platform.c (revision 9332)
|
---|
4 | +++ OvmfPkg/PlatformPei/Platform.c (working copy)
|
---|
5 | @@ -67,6 +67,34 @@
|
---|
6 |
|
---|
7 |
|
---|
8 | VOID
|
---|
9 | +AddRomMemoryBaseSizeHob (
|
---|
10 | + EFI_PHYSICAL_ADDRESS MemoryBase,
|
---|
11 | + UINT64 MemorySize
|
---|
12 | + )
|
---|
13 | +{
|
---|
14 | + STATIC EFI_RESOURCE_ATTRIBUTE_TYPE Attributes =
|
---|
15 | + (
|
---|
16 | + EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
---|
17 | + EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED |
|
---|
18 | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
|
---|
19 | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
|
---|
20 | + );
|
---|
21 | +
|
---|
22 | + BuildResourceDescriptorHob (
|
---|
23 | + EFI_RESOURCE_FIRMWARE_DEVICE,
|
---|
24 | + Attributes,
|
---|
25 | + MemoryBase,
|
---|
26 | + MemorySize
|
---|
27 | + );
|
---|
28 | +
|
---|
29 | + DEBUG (
|
---|
30 | + (EFI_D_ERROR, "ROM HOB: at 0x%llx size 0x%llx\n", MemoryBase, MemorySize)
|
---|
31 | + );
|
---|
32 | +
|
---|
33 | +}
|
---|
34 | +
|
---|
35 | +
|
---|
36 | +VOID
|
---|
37 | AddIoMemoryRangeHob (
|
---|
38 | EFI_PHYSICAL_ADDRESS MemoryBase,
|
---|
39 | EFI_PHYSICAL_ADDRESS MemoryLimit
|
---|
40 | @@ -111,11 +139,33 @@
|
---|
41 | AddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
|
---|
42 | }
|
---|
43 |
|
---|
44 | +#define ACPI_RSD_PTR SIGNATURE_64('R', 'S', 'D', ' ', 'P', 'T', 'R', ' ')
|
---|
45 | +VOID *
|
---|
46 | +FindAcpiRsdPtr (
|
---|
47 | + VOID
|
---|
48 | + )
|
---|
49 | +{
|
---|
50 | + UINTN Address;
|
---|
51 |
|
---|
52 | + //
|
---|
53 | + // First Search 0x0e0000 - 0x0fffff for RSD Ptr
|
---|
54 | + //
|
---|
55 | + for (Address = 0xe0000; Address < 0xfffff; Address += 0x10) {
|
---|
56 | + if (*(UINT64 *)(Address) == ACPI_RSD_PTR) {
|
---|
57 | + return (VOID *)Address;
|
---|
58 | + }
|
---|
59 | + }
|
---|
60 | + return NULL;
|
---|
61 | +}
|
---|
62 | +
|
---|
63 | +
|
---|
64 | VOID
|
---|
65 | MemMapInitialization (
|
---|
66 | )
|
---|
67 | {
|
---|
68 | + EFI_PHYSICAL_ADDRESS RsdPtr;
|
---|
69 | + EFI_PHYSICAL_ADDRESS AcpiTables;
|
---|
70 | +
|
---|
71 | //
|
---|
72 | // Create Memory Type Information HOB
|
---|
73 | //
|
---|
74 | @@ -139,6 +189,20 @@
|
---|
75 | // Video memory + Legacy BIOS region
|
---|
76 | //
|
---|
77 | AddIoMemoryRangeHob (0x0A0000, 0x100000);
|
---|
78 | +
|
---|
79 | +
|
---|
80 | + //
|
---|
81 | + // Add ACPI memory, provided by VBox
|
---|
82 | + //
|
---|
83 | + RsdPtr = (EFI_PHYSICAL_ADDRESS)(UINTN)FindAcpiRsdPtr();
|
---|
84 | + ASSERT(RsdPtr != 0);
|
---|
85 | + AcpiTables = (EFI_PHYSICAL_ADDRESS)*(UINT32*)((UINTN)RsdPtr + 16) & ~0xfff;
|
---|
86 | + ASSERT(AcpiTables != 0);
|
---|
87 | +
|
---|
88 | + // Floating pointer page
|
---|
89 | + AddRomMemoryBaseSizeHob(RsdPtr, 0x1000);
|
---|
90 | + // ACPI tables 64 K
|
---|
91 | + AddRomMemoryBaseSizeHob(AcpiTables, 0x10000);
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | @@ -214,4 +278,3 @@
|
---|
96 |
|
---|
97 | return EFI_SUCCESS;
|
---|
98 | }
|
---|
99 | -
|
---|