mpc83xx: Replace ppcDWstore with inline assembly
authorMario Six <mario.six@gdsys.cc>
Mon, 21 Jan 2019 08:18:20 +0000 (09:18 +0100)
committerMario Six <mario.six@gdsys.cc>
Tue, 21 May 2019 05:52:34 +0000 (07:52 +0200)
ppcDWstore/ppcDWload are hardly used by any board, but since they're
implemented in start.S, they're always present in every U-Boot image,
even if they're not needed.

Re-implement these fuctions in C with inline assembly, so that the
compiler can decide when to actually include them.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
arch/powerpc/cpu/mpc83xx/cpu.c
arch/powerpc/cpu/mpc83xx/start.S

index 4ea4249aff0326dacbd94ffeaa68d4482c81a80a..9c67099a17ad92447600fbf362949df1634fb6af 100644 (file)
@@ -229,3 +229,21 @@ int cpu_mmc_init(bd_t *bis)
        return 0;
 #endif
 }
+
+void ppcDWstore(unsigned int *addr, unsigned int *value)
+{
+       asm("lfd 1, 0(%1)\n\t"
+           "stfd 1, 0(%0)"
+           :
+           : "r" (addr), "r" (value)
+           : "memory");
+}
+
+void ppcDWload(unsigned int *addr, unsigned int *ret)
+{
+       asm("lfd 1, 0(%0)\n\t"
+           "stfd 1, 0(%1)"
+           :
+           : "r" (addr), "r" (ret)
+           : "memory");
+}
index 9fbbf59ce211e939d99dbfb43ee51bf17a2df205..f4a8a766c3379e4b3c669baf01f44ee0f7865121 100644 (file)
@@ -119,18 +119,6 @@ disable_addr_trans:
        mtspr   SRR1, r3
        rfi
 
-       .globl  ppcDWstore
-ppcDWstore:
-       lfd     1, 0(r4)
-       stfd    1, 0(r3)
-       blr
-
-       .globl  ppcDWload
-ppcDWload:
-       lfd     1, 0(r3)
-       stfd    1, 0(r4)
-       blr
-
 #ifndef CONFIG_DEFAULT_IMMR
 #error CONFIG_DEFAULT_IMMR must be defined
 #endif /* CONFIG_DEFAULT_IMMR */