Kernel/riscv64: Add QEMU virt machine memory map

We can remove this temporary memory map once we support parsing the
device tree provided to us by the firmware.
This commit is contained in:
Sönke Holz 2024-01-24 18:51:11 +01:00 committed by Andrew Kaster
parent 3e0d1becd4
commit c0d7749654

View file

@ -217,6 +217,29 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init([[maybe_unused]] BootInfo con
// FIXME: Read the /chosen/bootargs property.
kernel_cmdline = RPi::Mailbox::the().query_kernel_command_line(s_command_line_buffer);
#elif ARCH(RISCV64)
// FIXME: Get the actual memory map from the device tree.
static multiboot_memory_map_t mmap[] = {
{
// We currently can't get the actual size of firmware-reserved memory, so mark the first 0x20'0000 bytes as reserved.
// This reserved memory region should be large enough for now.
sizeof(multiboot_mmap_entry) - sizeof(u32),
0x8000'0000,
0x20'0000,
MULTIBOOT_MEMORY_RESERVED,
},
{
sizeof(multiboot_mmap_entry) - sizeof(u32),
0x8020'0000,
1 * GiB - 0x20'0000,
MULTIBOOT_MEMORY_AVAILABLE,
},
};
multiboot_memory_map = mmap;
multiboot_memory_map_count = array_size(mmap);
multiboot_modules = nullptr;
multiboot_modules_count = 0;
kernel_cmdline = "serial_debug"sv;
#endif