Linux panic if the VGA region isn't reserved.
When Linux is booted on EFI system, it expects the memory at 0xa0000 to
_not_ be conventional memory. Otherwise a variable isn't initialised
properly and Linux panic when a virtual console/terminal is asked to be
created.
See for more detail:
https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg02139.html
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <
20190813113119.14804-25-anthony.perard@citrix.com>
Status = XenGetE820Map (&E820Map, &E820EntriesCount);\r
ASSERT_EFI_ERROR (Status);\r
\r
Status = XenGetE820Map (&E820Map, &E820EntriesCount);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ AddMemoryBaseSizeHob (0, 0xA0000);\r
+ //\r
+ // Video memory + Legacy BIOS region, to allow Linux to boot.\r
+ //\r
+ AddReservedMemoryBaseSizeHob (0xA0000, BASE_1MB - 0xA0000, TRUE);\r
+\r
LapicBase = PcdGet32 (PcdCpuLocalApicBaseAddress);\r
LapicEnd = LapicBase + SIZE_1MB;\r
AddIoMemoryRangeHob (LapicBase, LapicEnd);\r
LapicBase = PcdGet32 (PcdCpuLocalApicBaseAddress);\r
LapicEnd = LapicBase + SIZE_1MB;\r
AddIoMemoryRangeHob (LapicBase, LapicEnd);\r
Base = ALIGN_VALUE (Entry->BaseAddr, (UINT64)EFI_PAGE_SIZE);\r
End = (Entry->BaseAddr + Entry->Length) & ~(UINT64)EFI_PAGE_MASK;\r
\r
Base = ALIGN_VALUE (Entry->BaseAddr, (UINT64)EFI_PAGE_SIZE);\r
End = (Entry->BaseAddr + Entry->Length) & ~(UINT64)EFI_PAGE_MASK;\r
\r
+ //\r
+ // Ignore the first 1MB, this is handled before the loop.\r
+ //\r
+ if (Base < BASE_1MB) {\r
+ Base = BASE_1MB;\r
+ }\r
+ if (Base >= End) {\r
+ continue;\r
+ }\r
+\r
switch (Entry->Type) {\r
case EfiAcpiAddressRangeMemory:\r
AddMemoryRangeHob (Base, End);\r
switch (Entry->Type) {\r
case EfiAcpiAddressRangeMemory:\r
AddMemoryRangeHob (Base, End);\r