56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <vector.h>
|
|
|
|
typedef struct {
|
|
uint32_t magic;
|
|
uint32_t totalsize;
|
|
uint32_t off_dt_struct;
|
|
uint32_t off_dt_strings;
|
|
uint32_t off_mem_rsvmap;
|
|
uint32_t version;
|
|
uint32_t last_comp_version;
|
|
uint32_t boot_cpuid_phys;
|
|
uint32_t size_dt_strings;
|
|
uint32_t size_dt_struct;
|
|
}__attribute__((packed)) fdt_header_t;
|
|
|
|
typedef struct {
|
|
uint64_t address;
|
|
uint64_t size;
|
|
}__attribute__((packed)) fdt_reserve_entry_t;
|
|
|
|
typedef struct {
|
|
uint32_t len;
|
|
uint32_t nameoff;
|
|
}__attribute__((packed)) fdt_prop_header_t;
|
|
|
|
typedef struct {
|
|
uint32_t len;
|
|
const char *name;
|
|
void *value;
|
|
} fdt_prop_t;
|
|
|
|
#define FDT_BEGIN_NODE 0x00000001
|
|
#define FDT_END_NODE 0x00000002
|
|
#define FDT_PROP 0x00000003
|
|
#define FDT_NOP 0x00000004
|
|
#define FDT_END 0x00000009
|
|
|
|
#define FDT_PATH_BUFFER_LEN 0x10
|
|
|
|
typedef void (*fdt_callback_func_t)(const vector_t *);
|
|
typedef struct {
|
|
const char *name;
|
|
const fdt_callback_func_t func;
|
|
} fdt_callback_t;
|
|
|
|
void fdt_traverse(const vector_t *struct_cbs);
|
|
|
|
extern void *dtb_start;
|
|
extern void *dtb_end;
|
|
extern void *dtb_memory_start;
|
|
extern void *dtb_memory_end;
|
|
extern vector_t *dtb_reserved_entries;
|