|
|
@ -358,6 +358,7 @@ static void *__unflatten_device_tree(const void *blob, |
|
|
|
{ |
|
|
|
int size; |
|
|
|
void *mem; |
|
|
|
uint32_t *endp; |
|
|
|
|
|
|
|
printf(" -> unflatten_device_tree()\n"); |
|
|
|
|
|
|
@ -381,7 +382,7 @@ static void *__unflatten_device_tree(const void *blob, |
|
|
|
if (size < 0) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
size = ((size + 3) & (~3)); //(ALIGN(size, 4);
|
|
|
|
size = ((size + 3) & (~3)); |
|
|
|
|
|
|
|
printf(" size is %d, allocating...\n", size); |
|
|
|
|
|
|
@ -389,15 +390,16 @@ static void *__unflatten_device_tree(const void *blob, |
|
|
|
mem = dt_alloc(size + 4, __alignof__(struct device_node)); |
|
|
|
memset(mem, 0, size); |
|
|
|
|
|
|
|
*(uint32_t *)((unsigned char *)mem + size) = 0xefbeadde; |
|
|
|
endp = (uint32_t *)((char *)mem + size); |
|
|
|
*endp = 0xdeadbeef; |
|
|
|
|
|
|
|
printf(" unflattening %p...\n", mem); |
|
|
|
printf(" unflattening %p...(end %p)\n", mem, endp); |
|
|
|
|
|
|
|
/* Second pass, do actual unflattening */ |
|
|
|
unflatten_dt_nodes(blob, mem, dad, mynodes); |
|
|
|
if (*(uint32_t *)((unsigned char *)mem + size) != 0xefbeadde) |
|
|
|
printf("End of tree marker overwritten: %08x\n", |
|
|
|
*(uint32_t *)((unsigned char *)mem + size)); |
|
|
|
if (*endp != 0xdeadbeef) { |
|
|
|
printf("End of tree marker overwritten: %08x\n", *endp); |
|
|
|
} |
|
|
|
|
|
|
|
if (detached && mynodes) { |
|
|
|
of_node_set_flag(*mynodes, OF_DETACHED); |
|
|
@ -418,8 +420,7 @@ static void *__unflatten_device_tree(const void *blob, |
|
|
|
*/ |
|
|
|
int unflatten_device_tree(void *mempos) |
|
|
|
{ |
|
|
|
__unflatten_device_tree(mempos, NULL, &of_root, |
|
|
|
__alloc, 0); |
|
|
|
__unflatten_device_tree(mempos, NULL, &of_root, __alloc, 0); |
|
|
|
|
|
|
|
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ |
|
|
|
of_alias_scan(__alloc); |
|
|
|