summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-04-08 20:42:18 -0400
committerstefan <stefan@s00.xyz>2023-04-08 20:42:18 -0400
commit1aac36f788834699b6891aea7a83eb950bd5e8f6 (patch)
tree18e0a6c26b83e71c101193e60149f49b1641daf0 /sys/dev
parenta1a97aa7b2b0c3d1f3b6766446d605f83de1c561 (diff)
downloadsv-1aac36f788834699b6891aea7a83eb950bd5e8f6.tar.gz
no idea whot i changed lol
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cpu.c6
-rw-r--r--sys/dev/fdt/fdt.c28
2 files changed, 34 insertions, 0 deletions
diff --git a/sys/dev/cpu.c b/sys/dev/cpu.c
new file mode 100644
index 0000000..f96b807
--- /dev/null
+++ b/sys/dev/cpu.c
@@ -0,0 +1,6 @@
+#include <cpu.h>
+
+extern struct hart harts[NPROC];
+
+
+
diff --git a/sys/dev/fdt/fdt.c b/sys/dev/fdt/fdt.c
new file mode 100644
index 0000000..4b132e2
--- /dev/null
+++ b/sys/dev/fdt/fdt.c
@@ -0,0 +1,28 @@
+#include <fdt.h>
+#include <sbi.h>
+#include <printf.h>
+#include <stdint.h>
+
+void
+fdt_walk(struct fdt_header *header)
+{
+ if (fdt_uint32(header->magic) != FDT_HEADER_MAGIC) {
+ printf("corrupted or invalid fdt");
+ }
+ printf("parsing fdt @%p...\n", header);
+ printf("header->totalsize: %d\n", fdt_uint32(header->totalsize));
+ printf("header->off_dt_struct: %d\n", fdt_uint32(header->off_dt_struct));
+ printf("header->off_dt_strings: %d\n", fdt_uint32(header->off_dt_strings));
+ printf("header->off_mem_rsvmap: %d\n", fdt_uint32(header->off_mem_rsvmap));
+ printf("header->version: %d\n", fdt_uint32(header->version));
+ printf("header->last_comp_version: %d\n", fdt_uint32(header->last_comp_version));
+ printf("header->boot_cpuid_phys: %d\n", fdt_uint32(header->boot_cpuid_phys));
+ printf("header->size_dt_strings: %d\n", fdt_uint32(header->size_dt_strings));
+ printf("header->size_dt_struct: %d\n", fdt_uint32(header->size_dt_struct));
+
+ uint8_t *dts = header + fdt_uint32(header->off_dt_struct) + sizeof(uint32_t);
+ uint8_t *dtstr = header + fdt_uint32(header->off_dt_strings);
+ printf("parsing dt struct @%p...\n", dts);
+ printf(dts);
+}
+