diff options
author | stefan <stefan@s00.xyz> | 2023-04-21 21:56:45 -0400 |
---|---|---|
committer | stefan <stefan@s00.xyz> | 2023-04-21 21:56:45 -0400 |
commit | 386ad4f82955d389ae347bc50f7efca5edb9d9a8 (patch) | |
tree | c18143b0a593e80145f003707a4eb29fa25d0f33 /sys/dev/dev_init.c | |
parent | eff82c45c589b42061344039d5f2efc8ad7c52df (diff) | |
download | sv-386ad4f82955d389ae347bc50f7efca5edb9d9a8.tar.gz |
actually got libfdt working
Diffstat (limited to 'sys/dev/dev_init.c')
-rw-r--r-- | sys/dev/dev_init.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/dev_init.c b/sys/dev/dev_init.c new file mode 100644 index 0000000..fc70853 --- /dev/null +++ b/sys/dev/dev_init.c @@ -0,0 +1,22 @@ +#include <dev.h> +#include <libfdt.h> +#include <sbi.h> +#include <stdio.h> +#include <string.h> +#include <stdint.h> + +void +dev_init(struct fdt_header *fdt) +{ + if (fdt_check_header(fdt) == 0) + printf("[dev_init] valid fdt at %p\n", fdt); + else + printf("[dev_init] error: fdt_check_header()\n"); + + int offset = fdt_next_node(fdt, offset, 0); + do { + printf("[dev_init] found %s\n", fdt_get_name(fdt, offset, NULL)); + offset = fdt_next_node(fdt, offset, 0); + } while (offset != -FDT_ERR_NOTFOUND); +} + |