From a3c174ee4c08d1d5e7a89ce187f52e3c0807a7eb Mon Sep 17 00:00:00 2001 From: stefan Date: Sun, 23 Apr 2023 17:00:14 -0400 Subject: memory detection --- sys/include/dev.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'sys/include/dev.h') diff --git a/sys/include/dev.h b/sys/include/dev.h index b8bfef8..657c04c 100644 --- a/sys/include/dev.h +++ b/sys/include/dev.h @@ -2,7 +2,37 @@ #define _DEV_H #include +#include -void dev_init(struct fdt_header* fdt); +enum { DT_MMUTYPE_SV32, DT_MMUTYPE_SV39, DT_MMUTYPE_SV48 }; + +struct _reg { + fdt64_t address; + fdt64_t size; +}; +/* unflattend device tree */ +struct devicetree { + const char *compat; + const char *model; + int nproc; + /* main cpu, monitor/alternative cores will be ignored for now */ + struct { + short mmu_type; + const char *isa; + unsigned int freq; + } cpu; + struct { + uintptr_t origin; + uintptr_t size; + } memory; + struct { + unsigned int freq; + const char *compat; + int interrupt; + struct _reg reg; + } uart; +}; + +struct devicetree dev_init(struct fdt_header* fdt); #endif /* _DEV_H */ -- cgit v1.2.3