Skip to contentSkip to conversation

PPC: E500: Put dtb after initrd

PATCH In review Alexander Graf 1 participant 2 messages Jan 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: E500: Put dtb after initrd

We have 3 blobs we need to load when booting the system:

- kernel
- initrd
- dtb

We place them in physical memory in that order. At least we should. This patch fixes the dtb location up to take the initrd location into account, fixing its offset.

---
 hw/ppc/e500.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
hw/ppc/e500.c +3 -2
index 3a9e1c7..516d219 100644
@@ -460,7 +460,7 @@ void ppce500_init(PPCE500Params *params)
     target_long kernel_size=0;
     target_ulong dt_base = 0;
     target_ulong initrd_base = 0;
-    target_long initrd_size=0;
+    target_long initrd_size = 0;
     int i = 0, j, k;
     unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
     qemu_irq **irqs, *mpic;
@@ -642,7 +642,8 @@ void ppce500_init(PPCE500Params *params)
         struct boot_info *boot_info;
         int dt_size;
 
-        dt_base = (loadaddr + kernel_size + DTC_LOAD_PAD) & ~DTC_PAD_MASK;
+        dt_base = (loadaddr + kernel_size + initrd_size + DTC_LOAD_PAD) &
+                  ~DTC_PAD_MASK;
         dt_size = ppce500_load_device_tree(env, params, dt_base, initrd_base,
                                            initrd_size);
         if (dt_size < 0) {
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 6 lines · Alexander Graf

We have 3 blobs we need to load when booting the system:

- kernel
- initrd
- dtb

Quoted 6 lines

We place them in physical memory in that order. At least we should. This patch fixes the dtb location up to take the initrd location into account, fixing its offset.

Ignore this one :).

Alex

Quoted 27 lines
---
  hw/ppc/e500.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
hw/ppc/e500.c +3 -2
index 3a9e1c7..516d219 100644
@@ -460,7 +460,7 @@ void ppce500_init(PPCE500Params *params)
      target_long kernel_size=0;
      target_ulong dt_base = 0;
      target_ulong initrd_base = 0;
-    target_long initrd_size=0;
+    target_long initrd_size = 0;
      int i = 0, j, k;
      unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
      qemu_irq **irqs, *mpic;
@@ -642,7 +642,8 @@ void ppce500_init(PPCE500Params *params)
          struct boot_info *boot_info;
          int dt_size;
 
-        dt_base = (loadaddr + kernel_size + DTC_LOAD_PAD)&  ~DTC_PAD_MASK;
+        dt_base = (loadaddr + kernel_size + initrd_size + DTC_LOAD_PAD)&
+                  ~DTC_PAD_MASK;
          dt_size = ppce500_load_device_tree(env, params, dt_base, initrd_base,
                                             initrd_size);
          if (dt_size<  0) {