Author: afaerber Date: Tue Nov 2 23:13:24 2010 New Revision: 944 URL: http://tracker.coreboot.org/trac/openbios/changeset/944
Log: ppc: Introduce LOAD_REG_IMMEDIATE() macro for ppc64
When loading the fw_cfg address with just lis, addi sequence, we get the high address bits as 0xffffffff on ppc64.
Use the full double word immediate load sequence on ppc64.
v2: * Rename from load() to LOAD_REG_IMMEDIATE() to match Linux. Suggested by Alex. * Move to ppc/asmdefs.h for future use elsewhere.
Signed-off-by: Andreas Färber andreas.faerber@web.de Acked-by: Alexander Graf agraf@suse.de
Modified: trunk/openbios-devel/arch/ppc/qemu/start.S trunk/openbios-devel/include/arch/ppc/asmdefs.h
Modified: trunk/openbios-devel/arch/ppc/qemu/start.S ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/start.S Tue Nov 2 23:09:31 2010 (r943) +++ trunk/openbios-devel/arch/ppc/qemu/start.S Tue Nov 2 23:13:24 2010 (r944) @@ -202,16 +202,14 @@
VECTOR( 0x300, "DSI" ): EXCEPTION_PREAMBLE - lis r3,HA(dsi_exception) - addi r3,r3,LO(dsi_exception) + LOAD_REG_IMMEDIATE(r3, dsi_exception) mtctr r3 bctrl b exception_return
VECTOR( 0x400, "ISI" ): EXCEPTION_PREAMBLE - lis r3,HA(isi_exception) - addi r3,r3,LO(isi_exception) + LOAD_REG_IMMEDIATE(r3, isi_exception) mtctr r3 bctrl b exception_return @@ -247,16 +245,14 @@
VECTOR( 0x2000, "DSI_64" ): EXCEPTION_PREAMBLE_64 - lis r3,HA(dsi_exception) - addi r3,r3,LO(dsi_exception) + LOAD_REG_IMMEDIATE(r3, dsi_exception) mtctr r3 bctrl EXCEPTION_EPILOGUE_64
VECTOR( 0x2200, "ISI_64" ): EXCEPTION_PREAMBLE_64 - lis r3,HA(isi_exception) - addi r3,r3,LO(isi_exception) + LOAD_REG_IMMEDIATE(r3, isi_exception) mtctr r3 bctrl EXCEPTION_EPILOGUE_64 @@ -278,8 +274,7 @@
/* copy exception vectors */
- lis r3,HA(__vectors) - addi r3,r3,LO(__vectors) + LOAD_REG_IMMEDIATE(r3, __vectors) li r4,0 li r5,__vectors_end - __vectors + 16 rlwinm r5,r5,0,0,28 @@ -378,22 +373,19 @@ stwu r1,-16(r1) stw r0,20(r1) mtlr r5 - lis r8,HA(saved_stack) - addi r8,r8,LO(saved_stack) // save our stack pointer + LOAD_REG_IMMEDIATE(r8, saved_stack) // save our stack pointer stw r1,0(r8) mfsdr1 r1 addi r1, r1, -32768 /* - 32 KiB exception stack */ addis r1, r1, -1 /* - 64 KiB stack */ - lis r5,HA(of_client_callback) - addi r5,r5,LO(of_client_callback) // r5 = callback + LOAD_REG_IMMEDIATE(r5, of_client_callback) // r5 = callback li r6,0 // r6 = address of client program arguments (unused) li r7,0 // r7 = length of client program arguments (unused) li r0,MSR_FP | MSR_ME | MSR_DR | MSR_IR mtmsr r0 blrl
- lis r8,HA(saved_stack) - addi r8,r8,LO(saved_stack) // restore stack pointer + LOAD_REG_IMMEDIATE(r8, saved_stack) // restore stack pointer mr r1,r8 lwz r0,20(r1) mtlr r0 @@ -418,8 +410,7 @@
/* restore OF stack */
- lis r4,HA(saved_stack) - addi r4,r4,LO(saved_stack) + LOAD_REG_IMMEDIATE(r4, saved_stack) lwz r4,0(r4)
stwu r4,-SAVE_SPACE(r4) @@ -564,12 +555,10 @@ #define FW_CFG_RAM_SIZE 0x03
compute_ramsize: - lis r9,HA(CFG_ADDR) - ori r9,r9,LO(CFG_ADDR) + LOAD_REG_IMMEDIATE(r9, CFG_ADDR) li r0,FW_CFG_RAM_SIZE sth r0,0(r9) - lis r9,HA(CFG_ADDR + 2) - ori r9,r9,LO(CFG_ADDR + 2) + LOAD_REG_IMMEDIATE(r9, CFG_ADDR + 2) lbz r1,0(r9) lbz r0,0(r9) slwi r0,r0,8
Modified: trunk/openbios-devel/include/arch/ppc/asmdefs.h ============================================================================== --- trunk/openbios-devel/include/arch/ppc/asmdefs.h Tue Nov 2 23:09:31 2010 (r943) +++ trunk/openbios-devel/include/arch/ppc/asmdefs.h Tue Nov 2 23:13:24 2010 (r944) @@ -75,6 +75,19 @@ /* MISC */ /************************************************************************/
+#ifdef __powerpc64__ +#define LOAD_REG_IMMEDIATE(D, x) \ + lis (D), (x)@highest ; \ + ori (D), (D), (x)@higher ; \ + sldi (D), (D), 32 ; \ + oris (D), (D), (x)@h ; \ + ori (D), (D), (x)@l +#else +#define LOAD_REG_IMMEDIATE(D, x) \ + lis (D), HA(x) ; \ + addi (D), (D), LO(x) +#endif + #ifndef __darwin__ #define GLOBL( name ) .globl name ; name #define EXTERN( name ) name