diff options
-rw-r--r-- | data.c | 4 | ||||
-rw-r--r-- | dtc-parser.y | 4 | ||||
-rw-r--r-- | dtc.h | 14 | ||||
-rw-r--r-- | flattree.c | 32 | ||||
-rw-r--r-- | livetree.c | 5 |
5 files changed, 28 insertions, 31 deletions
@@ -262,9 +262,9 @@ struct data data_append_re(struct data d, const struct fdt_reserve_entry *re) return data_append_data(d, &bere, sizeof(bere)); } -struct data data_append_addr(struct data d, u64 addr) +struct data data_append_addr(struct data d, uint64_t addr) { - u64 beaddr = cpu_to_be64(addr); + uint64_t beaddr = cpu_to_be64(addr); return data_append_data(d, &beaddr, sizeof(beaddr)); } diff --git a/dtc-parser.y b/dtc-parser.y index 8d04e49..b2ab562 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -39,10 +39,10 @@ static unsigned long long eval_literal(const char *s, int base, int bits); char *literal; char *labelref; unsigned int cbase; - u8 byte; + uint8_t byte; struct data data; - u64 addr; + uint64_t addr; cell_t cell; struct property *prop; struct property *proplist; @@ -75,11 +75,7 @@ static inline void *xrealloc(void *p, size_t len) return new; } -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; -typedef u32 cell_t; +typedef uint32_t cell_t; #define cpu_to_be16(x) htons(x) #define be16_to_cpu(x) ntohs(x) @@ -144,7 +140,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m, struct data data_merge(struct data d1, struct data d2); struct data data_append_cell(struct data d, cell_t word); struct data data_append_re(struct data d, const struct fdt_reserve_entry *re); -struct data data_append_addr(struct data d, u64 addr); +struct data data_append_addr(struct data d, uint64_t addr); struct data data_append_byte(struct data d, uint8_t byte); struct data data_append_zeroes(struct data d, int len); struct data data_append_align(struct data d, int align); @@ -222,7 +218,7 @@ struct reserve_info { char *label; }; -struct reserve_info *build_reserve_entry(u64 start, u64 len, char *label); +struct reserve_info *build_reserve_entry(uint64_t start, uint64_t len, char *label); struct reserve_info *chain_reserve_entry(struct reserve_info *first, struct reserve_info *list); struct reserve_info *add_reserve_entry(struct reserve_info *list, @@ -232,11 +228,11 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list, struct boot_info { struct reserve_info *reservelist; struct node *dt; /* the device tree */ - u32 boot_cpuid_phys; + uint32_t boot_cpuid_phys; }; struct boot_info *build_boot_info(struct reserve_info *reservelist, - struct node *tree, u32 boot_cpuid_phys); + struct node *tree, uint32_t boot_cpuid_phys); /* Checks */ @@ -168,16 +168,16 @@ static void asm_emit_data(void *e, struct data d) for_each_marker_of_type(m, LABEL) emit_offset_label(f, m->ref, m->offset); - while ((d.len - off) >= sizeof(u32)) { + while ((d.len - off) >= sizeof(uint32_t)) { fprintf(f, "\t.long\t0x%x\n", - be32_to_cpu(*((u32 *)(d.val+off)))); - off += sizeof(u32); + be32_to_cpu(*((uint32_t *)(d.val+off)))); + off += sizeof(uint32_t); } - if ((d.len - off) >= sizeof(u16)) { + if ((d.len - off) >= sizeof(uint16_t)) { fprintf(f, "\t.short\t0x%hx\n", - be16_to_cpu(*((u16 *)(d.val+off)))); - off += sizeof(u16); + be16_to_cpu(*((uint16_t *)(d.val+off)))); + off += sizeof(uint16_t); } if ((d.len - off) >= 1) { @@ -575,9 +575,9 @@ static void flat_read_chunk(struct inbuf *inb, void *p, int len) inb->ptr += len; } -static u32 flat_read_word(struct inbuf *inb) +static uint32_t flat_read_word(struct inbuf *inb) { - u32 val; + uint32_t val; assert(((inb->ptr - inb->base) % sizeof(val)) == 0); @@ -611,7 +611,7 @@ static char *flat_read_string(struct inbuf *inb) inb->ptr += len; - flat_realign(inb, sizeof(u32)); + flat_realign(inb, sizeof(uint32_t)); return str; } @@ -628,7 +628,7 @@ static struct data flat_read_data(struct inbuf *inb, int len) flat_read_chunk(inb, d.val, len); - flat_realign(inb, sizeof(u32)); + flat_realign(inb, sizeof(uint32_t)); return d; } @@ -655,7 +655,7 @@ static char *flat_read_stringtable(struct inbuf *inb, int offset) static struct property *flat_read_property(struct inbuf *dtbuf, struct inbuf *strbuf, int flags) { - u32 proplen, stroff; + uint32_t proplen, stroff; char *name; struct data val; @@ -725,7 +725,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf, { struct node *node; char *flatname; - u32 val; + uint32_t val; node = build_node(NULL, NULL); @@ -783,8 +783,8 @@ static struct node *unflatten_tree(struct inbuf *dtbuf, struct boot_info *dt_from_blob(const char *fname) { struct dtc_file *dtcf; - u32 magic, totalsize, version, size_dt, boot_cpuid_phys; - u32 off_dt, off_str, off_mem_rsvmap; + uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys; + uint32_t off_dt, off_str, off_mem_rsvmap; int rc; char *blob; struct fdt_header *fdt; @@ -794,7 +794,7 @@ struct boot_info *dt_from_blob(const char *fname) int sizeleft; struct reserve_info *reservelist; struct node *tree; - u32 val; + uint32_t val; int flags = 0; dtcf = dtc_open_file(fname, NULL); @@ -867,7 +867,7 @@ struct boot_info *dt_from_blob(const char *fname) die("String table offset exceeds total size\n"); if (version >= 3) { - u32 size_str = be32_to_cpu(fdt->size_dt_strings); + uint32_t size_str = be32_to_cpu(fdt->size_dt_strings); if (off_str+size_str > totalsize) die("String table extends past total size\n"); inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str); @@ -123,7 +123,8 @@ void add_child(struct node *parent, struct node *child) *p = child; } -struct reserve_info *build_reserve_entry(u64 address, u64 size, char *label) +struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size, + char *label) { struct reserve_info *new = xmalloc(sizeof(*new)); @@ -165,7 +166,7 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list, } struct boot_info *build_boot_info(struct reserve_info *reservelist, - struct node *tree, u32 boot_cpuid_phys) + struct node *tree, uint32_t boot_cpuid_phys) { struct boot_info *bi; |