mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
sparc: Update PROM initialization code for generic board
Fixed the prom_relocate() function in start.S file by reserving memory in the board_init_f sequence and saving the offset to the __prom_start_reloc variable. This value is used as the destination when relocating the PROM. Add the prom_init() function to the end of the board_init_r sequence. Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>
This commit is contained in:
parent
c97088c3cf
commit
1e85ccec53
6 changed files with 56 additions and 28 deletions
|
@ -25,6 +25,8 @@ extern struct linux_romvec *kernel_arg_promvec;
|
||||||
#define PROM_TEXT __attribute__ ((__section__ (".prom.text")))
|
#define PROM_TEXT __attribute__ ((__section__ (".prom.text")))
|
||||||
#define PROM_DATA __attribute__ ((__section__ (".prom.data")))
|
#define PROM_DATA __attribute__ ((__section__ (".prom.data")))
|
||||||
|
|
||||||
|
void *__prom_start_reloc; /* relocated prom_start address */
|
||||||
|
|
||||||
/* for __va */
|
/* for __va */
|
||||||
extern int __prom_start;
|
extern int __prom_start;
|
||||||
#define PAGE_OFFSET 0xf0000000
|
#define PAGE_OFFSET 0xf0000000
|
||||||
|
|
|
@ -414,24 +414,24 @@ fixup_got:
|
||||||
bcs 30b ! while (ptr < end)
|
bcs 30b ! while (ptr < end)
|
||||||
nop
|
nop
|
||||||
|
|
||||||
#if 0 /* FIXME: Relocated PROM address should be calculated! */
|
|
||||||
|
|
||||||
prom_relocate:
|
prom_relocate:
|
||||||
SPARC_LOAD_ADDRESS(__prom_start, l7, g2)
|
SPARC_LOAD_ADDRESS(__prom_start, l7, g2)
|
||||||
SPARC_LOAD_ADDRESS(__prom_end, l7, g3)
|
SPARC_LOAD_ADDRESS(__prom_end, l7, g3)
|
||||||
set CONFIG_SYS_PROM_OFFSET, %g4
|
/*
|
||||||
|
* Calculated addres is stored in this variable by
|
||||||
|
* reserve_prom() function in common/board_f.c
|
||||||
|
*/
|
||||||
|
SPARC_LOAD_ADDRESS(__prom_start_reloc, l7, g4)
|
||||||
|
ld [%g4], %g4
|
||||||
|
|
||||||
prom_relocate_loop:
|
40: ldd [%g2], %l0
|
||||||
ldd [%g2],%l0
|
ldd [%g2+8], %l2
|
||||||
ldd [%g2+8],%l2
|
std %l0, [%g4]
|
||||||
std %l0,[%g4]
|
std %l2, [%g4+8]
|
||||||
std %l2,[%g4+8]
|
inc 16, %g2
|
||||||
inc 16,%g2
|
cmp %g2, %g3
|
||||||
subcc %g3,%g2,%g0
|
bcs 40b
|
||||||
bne prom_relocate_loop
|
inc 16, %g4
|
||||||
inc 16,%g4
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
! %o0 = stack pointer (relocated)
|
! %o0 = stack pointer (relocated)
|
||||||
! %o1 = global data pointer (relocated)
|
! %o1 = global data pointer (relocated)
|
||||||
|
|
|
@ -33,6 +33,8 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
ambapp_dev_gptimer *gptimer;
|
ambapp_dev_gptimer *gptimer;
|
||||||
|
|
||||||
|
void *__prom_start_reloc; /* relocated prom_start address */
|
||||||
|
|
||||||
/* for __va */
|
/* for __va */
|
||||||
extern int __prom_start;
|
extern int __prom_start;
|
||||||
#define PAGE_OFFSET 0xf0000000
|
#define PAGE_OFFSET 0xf0000000
|
||||||
|
|
|
@ -397,24 +397,24 @@ fixup_got:
|
||||||
bcs 30b ! while (ptr < end)
|
bcs 30b ! while (ptr < end)
|
||||||
nop
|
nop
|
||||||
|
|
||||||
#if 0 /* FIXME: Relocated PROM address should be calculated! */
|
|
||||||
|
|
||||||
prom_relocate:
|
prom_relocate:
|
||||||
SPARC_LOAD_ADDRESS(__prom_start, l7, g2)
|
SPARC_LOAD_ADDRESS(__prom_start, l7, g2)
|
||||||
SPARC_LOAD_ADDRESS(__prom_end, l7, g3)
|
SPARC_LOAD_ADDRESS(__prom_end, l7, g3)
|
||||||
set CONFIG_SYS_PROM_OFFSET, %g4
|
/*
|
||||||
|
* Calculated addres is stored in this variable by
|
||||||
|
* reserve_prom() function in common/board_f.c
|
||||||
|
*/
|
||||||
|
SPARC_LOAD_ADDRESS(__prom_start_reloc, l7, g4)
|
||||||
|
ld [%g4], %g4
|
||||||
|
|
||||||
prom_relocate_loop:
|
40: ldd [%g2], %l0
|
||||||
ldd [%g2],%l0
|
ldd [%g2+8], %l2
|
||||||
ldd [%g2+8],%l2
|
std %l0, [%g4]
|
||||||
std %l0,[%g4]
|
std %l2, [%g4+8]
|
||||||
std %l2,[%g4+8]
|
inc 16, %g2
|
||||||
inc 16,%g2
|
cmp %g2, %g3
|
||||||
subcc %g3,%g2,%g0
|
bcs 40b
|
||||||
bne prom_relocate_loop
|
inc 16, %g4
|
||||||
inc 16,%g4
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
! %o0 = stack pointer (relocated)
|
! %o0 = stack pointer (relocated)
|
||||||
! %o1 = global data pointer (relocated)
|
! %o1 = global data pointer (relocated)
|
||||||
|
|
|
@ -357,6 +357,20 @@ static int setup_dest_addr(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_SPARC)
|
||||||
|
static int reserve_prom(void)
|
||||||
|
{
|
||||||
|
/* defined in arch/sparc/cpu/leon?/prom.c */
|
||||||
|
extern void *__prom_start_reloc;
|
||||||
|
int size = 8192; /* page table = 2k, prom = 6k */
|
||||||
|
gd->relocaddr -= size;
|
||||||
|
__prom_start_reloc = map_sysmem(gd->relocaddr + 2048, size - 2048);
|
||||||
|
debug("Reserving %dk for PROM and page table at %08lx\n", size,
|
||||||
|
gd->relocaddr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
|
#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
|
||||||
static int reserve_logbuffer(void)
|
static int reserve_logbuffer(void)
|
||||||
{
|
{
|
||||||
|
@ -909,6 +923,9 @@ static init_fnc_t init_sequence_f[] = {
|
||||||
/* Blackfin u-boot monitor should be on top of the ram */
|
/* Blackfin u-boot monitor should be on top of the ram */
|
||||||
reserve_uboot,
|
reserve_uboot,
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(CONFIG_SPARC)
|
||||||
|
reserve_prom,
|
||||||
|
#endif
|
||||||
#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
|
#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
|
||||||
reserve_logbuffer,
|
reserve_logbuffer,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,6 +66,10 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
#if defined(CONFIG_SPARC)
|
||||||
|
extern int prom_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
ulong monitor_flash_len;
|
ulong monitor_flash_len;
|
||||||
|
|
||||||
__weak int board_flash_wp_on(void)
|
__weak int board_flash_wp_on(void)
|
||||||
|
@ -933,6 +937,9 @@ init_fnc_t init_sequence_r[] = {
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PS2KBD
|
#ifdef CONFIG_PS2KBD
|
||||||
initr_kbd,
|
initr_kbd,
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_SPARC)
|
||||||
|
prom_init,
|
||||||
#endif
|
#endif
|
||||||
run_main_loop,
|
run_main_loop,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue