void *find_dtb(void *dtbs, const char *compat) { struct fdt_header *d = (struct fdt_header *)dtbs; while (d->magic == be_to_cpu(FDT_MAGIC)) { if (find_str((char *)d, be_to_cpu(d->totalsize), compat) == 1) return d; d = (struct fdt_header *)((char *)d + be_to_cpu(d->totalsize)); /* align to 4-bytes */ d = (struct fdt_header *)((((unsigned int)d + 0x3) & ~0x3)); } return NULL; }
static void acq_swap(void *buf, size_t size) { uint32_t *data = buf; int i; for (i = 0; i < size / sizeof(uint32_t); i++) data[i] = be_to_cpu(data[i]); }