aarch64: Change memory layout for UEFI & ACPI

Before this change, the FDT was loaded at the end of RAM. The address of
FDT was not fixed.
While UEFI (edk2 now) requires fixed address to find FDT and RSDP.
Now the FDT is moved to the beginning of RAM, which is a fixed address.
RSDP is wrote to 2 MiB after FDT, also a fixed address.
Kernel comes 2 MiB after RSDP.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao
2021-02-02 20:27:14 +08:00
committed by Sebastien Boeuf
parent b282ff44d4
commit e4bb6409ae
5 changed files with 51 additions and 74 deletions

View File

@@ -112,16 +112,7 @@ pub fn create_acpi_tables(
memory_manager: &Arc<Mutex<MemoryManager>>,
numa_nodes: &NumaNodes,
) -> GuestAddress {
#[cfg(target_arch = "x86_64")]
// RSDP is at the EBDA
let rsdp_offset = arch::layout::RSDP_POINTER;
#[cfg(target_arch = "aarch64")]
// TODO: For aarch64 place the ACPI tables in the last MiB of guest RAM
let rsdp_offset = {
use vm_memory::GuestMemory;
guest_mem.last_addr().checked_sub(1 << 20).unwrap()
};
let mut tables: Vec<u64> = Vec::new();
// DSDT