DEBUG 8xxx cpu_numcores
PATCH 1/1 DEBUG 8xxx cpu_numcores
The following debug patch shows that gd->cpu is not being relocated to ddr. Linux may not be able to boot due to "fdt board" crashing if flash has been erased or changed.
On mpc8572ds:
=> fdt board
fdt boardcpu_numcores gd=3fe6df68 cpu=effed578 n=2cpu_numcores gd=3fe6df68 cpu=effed578 n=2cpu_numcores gd=3fe6df68 cpu=effed578 n=2cpu_numcores gd=3fe6df68 cpu=effed578 n=2
--- cpu/mpc8xxx/cpu.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
cpu/mpc8xxx/cpu.c +3 -1
@@ -22,7 +22,7 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ - +#define DEBUG #include <config.h> #include <common.h> #include <command.h>
@@ -98,6 +98,8 @@ struct cpu_type *identify_cpu(u32 ver)int cpu_numcores () {struct cpu_type *cpu; cpu = gd->cpu; +debug ("cpu_numcores gd=%x cpu=%x n=%x\n" , + (int )gd, (int )cpu, cpu->num_cores);return cpu->num_cores; }
Signature · 1 line
1.5.6.5
PATCH 1/1 DEBUG 8xxx cpu_numcores
Quoted 13 lines · Ed Swarthout
The following debug patch shows that
gd->cpuis not being relocated to ddr. Linux may not be able to boot due to "fdt board" crashing if flash has been erased or changed.On mpc8572ds:
=> fdt board
fdt boardcpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2
Quoted 4 lines
Signed-off-by Ed Swarthout <[email protected]>---
cpu/mpc8xxx/cpu.c| 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)
I agree w/Ed that we broke the relocation of gd->cpu with commit:
commit a0e2066f392782730f0398095e583c87812d97f2
Author: Peter Tyser <[email protected]> Date: Mon Sep 21 11:20:27 2009 -0500
ppc: Remove board.c relocation fixups
...
-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
- gd->cpu += gd->reloc_off;
-#endif
Peter, Joakim,
any suggestions on how to properly fix this?
- k
PATCH 1/1 DEBUG 8xxx cpu_numcores
Quoted 36 lines · Kumar Gala
Quoted 13 lines · Ed Swarthout
The following debug patch shows that
gd->cpuis not being relocated to ddr. Linux may not be able to boot due to "fdt board" crashing if flash has been erased or changed.On mpc8572ds:
=> fdt board
fdt boardcpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2Quoted 4 lines
Signed-off-by Ed Swarthout <[email protected]>---
cpu/mpc8xxx/cpu.c| 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)I agree w/Ed that we broke the relocation of
gd->cpuwith commit:commit
a0e2066f392782730f0398095e583c87812d97f2Author: Peter Tyser <[email protected]> Date: Mon Sep 21 11:20:27 2009 -0500ppc: Remove
board.crelocation fixupsSigned-off-by Peter Tyser <[email protected]>...
(quoted diff) +0
-3-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) - gd->cpu += gd->reloc_off; -#endif
Quoted 3 lines
Peter, Joakim,
any suggestions on how to properly fix this?
Hmm, the cpu pointer is set with a flash address since probecpu() is called before relocation. The relocation fixups only update initialized pointers, so the cpu pointer isn't touched during relocation fixups.
Do we really need to call probecpu() so early? Calling it after relocation would resolve the problem. Calling it both before and after relocation would resolve the issue too, but seems kind of hokey.
Otherwise we could re-add a fixup to board.c, eg:
lib_ppc/board.c +8 -0
@@ -645,6 +645,14 @@ void board_init_r (gd_t *id, ulong dest_addr)/* The Malloc area is immediately below the monitor copy in DRAM */ malloc_start = dest_addr -TOTAL_MALLOC_LEN ; +#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) +/* +* The cpu pointer is set to an address in flash prior to relocation. +* We need to update it to point to the same CPU entry in RAM. +*/ + gd->cpu += dest_addr -CONFIG_SYS_MONITOR_BASE ; +#endif +#ifdef CONFIG_SERIAL_MULTI serial_initialize ();#endif
What's less dirty, adding some magical relocation fixup math, or calling a function two times to magically update a variable? Or can we just call probecpu() once after relocation?
Peter
PATCH 1/1 DEBUG 8xxx cpu_numcores
Quoted 71 lines · Peter Tyser
Quoted 36 lines · Kumar Gala
Quoted 13 lines · Ed Swarthout
The following debug patch shows that
gd->cpuis not being relocated to ddr. Linux may not be able to boot due to "fdt board" crashing if flash has been erased or changed.On mpc8572ds:
=> fdt board
fdt boardcpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2Quoted 4 lines
Signed-off-by Ed Swarthout <[email protected]>---
cpu/mpc8xxx/cpu.c| 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)I agree w/Ed that we broke the relocation of
gd->cpuwith commit:commit
a0e2066f392782730f0398095e583c87812d97f2Author: Peter Tyser <[email protected]> Date: Mon Sep 21 11:20:27 2009 -0500ppc: Remove
board.crelocation fixupsSigned-off-by Peter Tyser <[email protected]>...
(quoted diff) +0
-3-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) - gd->cpu += gd->reloc_off; -#endifQuoted 3 lines
Peter, Joakim,
any suggestions on how to properly fix this?
Hmm, the cpu pointer is set with a flash address since
probecpu()is called before relocation. The relocation fixups only update initialized pointers, so the cpu pointer isn't touched during relocation fixups.Do we really need to call
probecpu()so early? Calling it after relocation would resolve the problem. Calling it both before and after relocation would resolve the issue too, but seems kind of hokey.Otherwise we could re-add a fixup to
board.c, eg:lib_ppc/board.c +8
-0@@ -645,6 +645,14 @@ void board_init_r (gd_t *id, ulong dest_addr)/* The Malloc area is immediately below the monitor copy in DRAM */ malloc_start = dest_addr -TOTAL_MALLOC_LEN ; +#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) +/* +* The cpu pointer is set to an address in flash prior to relocation. +* We need to update it to point to the same CPU entry in RAM. +*/ + gd->cpu += dest_addr -CONFIG_SYS_MONITOR_BASE ; +#endif +#ifdef CONFIG_SERIAL_MULTI serial_initialize ();#endif
Quoted 3 lines
What's less dirty, adding some magical relocation fixup math, or calling a function two times to magically update a variable? Or can we just call
probecpu()once after relocation?
Where would we call it if it was after relocation?
- k
PATCH 1/1 DEBUG 8xxx cpu_numcores
Quoted 73 lines · Kumar Gala
Quoted 71 lines · Peter Tyser
Quoted 36 lines · Kumar Gala
Quoted 13 lines · Ed Swarthout
The following debug patch shows that
gd->cpuis not being relocated to ddr. Linux may not be able to boot due to "fdt board" crashing if flash has been erased or changed.On mpc8572ds:
=> fdt board
fdt boardcpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2Quoted 4 lines
Signed-off-by Ed Swarthout <[email protected]>---
cpu/mpc8xxx/cpu.c| 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)I agree w/Ed that we broke the relocation of
gd->cpuwith commit:commit
a0e2066f392782730f0398095e583c87812d97f2Author: Peter Tyser <[email protected]> Date: Mon Sep 21 11:20:27 2009 -0500ppc: Remove
board.crelocation fixupsSigned-off-by Peter Tyser <[email protected]>...
(quoted diff) +0
-3-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) - gd->cpu += gd->reloc_off; -#endifQuoted 3 lines
Peter, Joakim,
any suggestions on how to properly fix this?
Hmm, the cpu pointer is set with a flash address since
probecpu()is called before relocation. The relocation fixups only update initialized pointers, so the cpu pointer isn't touched during relocation fixups.Do we really need to call
probecpu()so early? Calling it after relocation would resolve the problem. Calling it both before and after relocation would resolve the issue too, but seems kind of hokey.Otherwise we could re-add a fixup to
board.c, eg:lib_ppc/board.c +8
-0@@ -645,6 +645,14 @@ void board_init_r (gd_t *id, ulong dest_addr)/* The Malloc area is immediately below the monitor copy in DRAM */ malloc_start = dest_addr -TOTAL_MALLOC_LEN ; +#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) +/* +* The cpu pointer is set to an address in flash prior to relocation. +* We need to update it to point to the same CPU entry in RAM. +*/ + gd->cpu += dest_addr -CONFIG_SYS_MONITOR_BASE ; +#endif +#ifdef CONFIG_SERIAL_MULTI serial_initialize ();#endif
Quoted 5 lines
Quoted 3 lines
What's less dirty, adding some magical relocation fixup math, or calling a function two times to magically update a variable? Or can we just call
probecpu()once after relocation?Where would we call it if it was after relocation?
Either near the top of lib_ppc/board.c:board_init_r() or possibly in cpu/mpc8[5|6]xx/cpu_init.c:cpu_init_r().
I added Ed's debug, and it looks like cpu_numcores() is called many times prior to relocation though. So I'd assume we can't just call it once after relocation.
So the options are:
1. Add "gd->cpu +=" fixup to lib_ppc/board.c where it used to be (We can't put the manual fixup in cpu/mpc8[5|6]xx/cpu_init.c since that code won't have the relocation offset needed for fixing up).
2. Re-call probecpu() in lib_ppc/board.c
3. Re-call probecpu() in cpu/mpc8[5|6]xx/cpu_init.c
I'd slightly lean towards #1, but its not particularly pretty either...
Peter
PATCH 1/1 DEBUG 8xxx cpu_numcores
Quoted 87 lines · Peter Tyser
Quoted 73 lines · Kumar Gala
Quoted 71 lines · Peter Tyser
Quoted 36 lines · Kumar Gala
Quoted 13 lines · Ed Swarthout
The following debug patch shows that
gd->cpuis not being relocated to ddr. Linux may not be able to boot due to "fdt board" crashing if flash has been erased or changed.On mpc8572ds:
=> fdt board
fdt boardcpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2cpu_numcoresgd=3fe6df68 cpu=effed578 n=2Quoted 4 lines
Signed-off-by Ed Swarthout <[email protected]>---
cpu/mpc8xxx/cpu.c| 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)I agree w/Ed that we broke the relocation of
gd->cpuwith commit:commit
a0e2066f392782730f0398095e583c87812d97f2Author: Peter Tyser <[email protected]> Date: Mon Sep 21 11:20:27 2009 -0500ppc: Remove
board.crelocation fixupsSigned-off-by Peter Tyser <[email protected]>...
(quoted diff) +0
-3-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) - gd->cpu += gd->reloc_off; -#endifQuoted 3 lines
Peter, Joakim,
any suggestions on how to properly fix this?
Hmm, the cpu pointer is set with a flash address since
probecpu()is called before relocation. The relocation fixups only update initialized pointers, so the cpu pointer isn't touched during relocation fixups.Do we really need to call
probecpu()so early? Calling it after relocation would resolve the problem. Calling it both before and after relocation would resolve the issue too, but seems kind of hokey.Otherwise we could re-add a fixup to
board.c, eg:lib_ppc/board.c +8
-0@@ -645,6 +645,14 @@ void board_init_r (gd_t *id, ulong dest_addr)/* The Malloc area is immediately below the monitor copy in DRAM */ malloc_start = dest_addr -TOTAL_MALLOC_LEN ; +#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) +/* +* The cpu pointer is set to an address in flash prior to relocation. +* We need to update it to point to the same CPU entry in RAM. +*/ + gd->cpu += dest_addr -CONFIG_SYS_MONITOR_BASE ; +#endif +#ifdef CONFIG_SERIAL_MULTI serial_initialize ();#endif Quoted 5 lines
Quoted 3 lines
What's less dirty, adding some magical relocation fixup math, or calling a function two times to magically update a variable? Or can we just call
probecpu()once after relocation?Where would we call it if it was after relocation?
Either near the top of lib_ppc/board.c:board_init_r() or possibly in cpu/mpc8[5|6]xx/cpu_init.c:cpu_init_r().
I added Ed's debug, and it looks like
cpu_numcores()is called many times prior to relocation though. So I'd assume we can't just call it once after relocation.
Quoted 8 lines
So the options are:
1. Add "gd->cpu+=" fixup tolib_ppc/board.cwhere it used to be (We can't put the manual fixup in cpu/mpc8[5|6]xx/cpu_init.c since that code won't have the relocation offset needed for fixing up).
2. Re-callprobecpu()inlib_ppc/board.c
3. Re-callprobecpu()in cpu/mpc8[5|6]xx/cpu_init.cI'd slightly lean towards #1, but its not particularly pretty either...
I'm for #1 as well. Can you send a clean patch w/signoff. I'll test it right away.
- k
PATCH 1/1 DEBUG 8xxx cpu_numcores
In reply to Kumar GalaDear Kumar Gala,
Quoted 2 lines · In message <[email protected]> you wrote:
I agree w/Ed that we broke the relocation of
gd->cpuwith commit:
I was on the verge of releasing v2009.11 - shall I wait for a fix?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Due to lack of disk space, this fortune database has been discontinued.
PATCH 1/1 DEBUG 8xxx cpu_numcores
Quoted 7 lines · Wolfgang Denk
Dear Kumar Gala,
Quoted 2 lines · In message <[email protected]> you wrote:
I agree w/Ed that we broke the relocation of
gd->cpuwith commit:I was on the verge of releasing v2009.11 - shall I wait for a fix?
Yes, please do.
- k