[PATCH 1/2] kexec tools: device tree blob reserve memory map entry cleanup
Michael Neuling
mikey at neuling.org
Wed Oct 26 12:51:12 EST 2005
Patch cleans up how the reserve memory maps entry for the device tree
are modified. Shouldn't change any functionality.
Signed-off-by: Michael Neuling <mikey at neuling.org>
---
kexec-elf-ppc64.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
Index: kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-ppc64.c
===================================================================
--- kexec-tools-1.101.orig/kexec/arch/ppc64/kexec-elf-ppc64.c 2005-10-24 14:18:38.000000000 +1000
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-ppc64.c 2005-10-26 11:18:14.000000000 +1000
@@ -171,10 +171,7 @@
/* Add v2wrap to the current image */
unsigned char *v2wrap_buf = NULL;
off_t v2wrap_size = 0;
- unsigned int off_len;
- unsigned char *seg_buf;
- unsigned int rsvmap_len;
- unsigned long long *ptr;
+ unsigned long long *rsvmap_ptr;
struct bootblock *bb_ptr;
unsigned int devtree_size;
@@ -189,23 +186,20 @@
add_buffer(info, v2wrap_buf, v2wrap_size, v2wrap_size, 0, 0,
0xFFFFFFFFFFFFFFFFUL, -1);
- /* patch reserve map address for flattened device-tree */
- base_addr = info->segment[(info->nr_segments)-1].mem;
- seg_buf = (unsigned char *)info->segment[(info->nr_segments)-1].buf;
- seg_buf = seg_buf + 0x100; /* offset to end of v2wrap */
- bb_ptr = (struct bootblock *)seg_buf;
- rsvmap_len = bb_ptr->off_dt_struct - bb_ptr->off_mem_rsvmap;
- devtree_size = bb_ptr->totalsize;
- off_len = sizeof(struct bootblock);
- off_len += 7; off_len &= ~7;
- seg_buf = seg_buf + off_len;
- off_len = rsvmap_len / (2 * sizeof(unsigned long long));
-
- ptr = (unsigned long long *)seg_buf;
- ptr = ptr + 2*(off_len-2);
- *ptr = base_addr + 0x100;
- ptr++;
- *ptr = (unsigned long long)devtree_size;
+ /* patch reserve map address for flattened device-tree
+ find last entry (both 0) in the reserve mem list. Assume DT
+ entry is before this one */
+ bb_ptr = (struct bootblock *)(unsigned char *)info->segment[(info->nr_segments)-1].buf + 0x100;
+
+ rsvmap_ptr = info->segment[(info->nr_segments)-1].buf + 0x100 +
+ bb_ptr->off_mem_rsvmap;
+ while (*rsvmap_ptr || *(rsvmap_ptr+1)){
+ rsvmap_ptr += 2;
+ }
+ rsvmap_ptr -= 2;
+ *rsvmap_ptr = info->segment[(info->nr_segments)-1].mem + 0x100;
+ rsvmap_ptr++;
+ *rsvmap_ptr = (unsigned long long)bb_ptr->totalsize;
unsigned int nr_segments;
nr_segments = info->nr_segments;
More information about the Linuxppc64-dev
mailing list