summaryrefslogtreecommitdiff
path: root/sys/include/dev.h
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-04-23 17:00:14 -0400
committerstefan <stefan@s00.xyz>2023-04-23 17:00:14 -0400
commita3c174ee4c08d1d5e7a89ce187f52e3c0807a7eb (patch)
treebad1c1d9026e7de550a1e69863acdf9a8213b2b7 /sys/include/dev.h
parent386ad4f82955d389ae347bc50f7efca5edb9d9a8 (diff)
downloadsv-a3c174ee4c08d1d5e7a89ce187f52e3c0807a7eb.tar.gz
memory detection
Diffstat (limited to 'sys/include/dev.h')
-rw-r--r--sys/include/dev.h32
1 files changed, 31 insertions, 1 deletions
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 <libfdt.h>
+#include <stdint.h>
-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 */