kernel: update arch headers for riscv64

Change-Id: Iaf1c253745412614f7e4a30019d96483cb0d3a12
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4310
Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
X512
2021-08-06 17:26:04 +00:00
committed by Alex von Gluck IV
parent ec1174b442
commit b87ec78210
2 changed files with 53 additions and 13 deletions
@@ -15,25 +15,21 @@
// memory layout
#define KERNEL_LOAD_BASE 0x80000000
#define KERNEL_LOAD_BASE_64_BIT 0xffffffff80000000ll
#define KERNEL_LOAD_BASE_64_BIT 0xffffffc000000000
#if defined(__riscv64__)
// Base of the kernel address space.
#define KERNEL_BASE (0x0000000000000000 + 0x1000)
#define KERNEL_TOP (0x0000004000000000 - 1)
#define KERNEL_SIZE ((KERNEL_TOP - KERNEL_BASE) + 1)
// Kernel physical memory map area.
#define KERNEL_PMAP_BASE 0x0000003000000000
#define KERNEL_PMAP_SIZE 0x1000000000
#define KERNEL_BASE 0xffffffc000000000
#define KERNEL_SIZE 0x0000004000000000
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
// Userspace address space layout.
#define USER_BASE 0xffffffc000000000
#define USER_BASE_ANY USER_BASE
#define USER_SIZE 0x0000004000000000
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
#define USER_BASE (0x0000000000000000 + 0x1000)
#define USER_BASE_ANY USER_BASE
#define USER_TOP (0x0000004000000000 - 1)
#define USER_SIZE (USER_TOP - USER_BASE + 1)
#define KERNEL_USER_DATA_BASE (USER_BASE + 0x3000000000)
#define USER_STACK_REGION (USER_BASE + 0x3000000000)
@@ -18,15 +18,59 @@
#define MAX_VIRTUAL_RANGES_TO_KEEP 32
enum {
kPlatform1None,
kPlatform1Riscv,
kPlatform1Sbi,
};
enum {
kPlatform2None,
kPlatform2Riscv,
kPlatform2Efi,
kPlatform2UBoot,
};
enum {
kUartKindNone,
kUartKind8250,
kUartKindSifive,
kUartKindPl011,
};
typedef struct {
uint32 kind;
addr_range regs;
uint32 irq;
int64 clock;
} _PACKED ArchUart;
// kernel args
typedef struct {
// Virtual address range of RAM physical memory mapping region
addr_range physMap;
// The virtual ranges we want to keep in the kernel.
uint32 num_virtual_ranges_to_keep;
addr_range virtual_ranges_to_keep[MAX_VIRTUAL_RANGES_TO_KEEP];
// needed for UEFI, otherwise kernel acpi support can't find ACPI root
uint32 platform1;
uint32 platform2;
uint bootHart;
uint64 timerFrequrency; // in Hz
// All following address are virtual
FixedWidthPointer<void> acpi_root;
FixedWidthPointer<void> fdt;
addr_range htif;
addr_range plic;
addr_range clint;
ArchUart uart;
} _PACKED arch_kernel_args;
#endif /* KERNEL_ARCH_RISCV64_KERNEL_ARGS_H */