[coreboot-gerrit] New patch to review for coreboot: rockchip: rk3399: use static pointers to regs as they compile to faster code

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Sat May 7 08:30:03 CEST 2016


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14705

-gerrit

commit d1d3287675b3a49df82bf33824f94d8026cfb704
Author: Vadim Bendebury <vbendeb at chromium.org>
Date:   Wed Apr 20 15:17:24 2016 -0700

    rockchip: rk3399: use static pointers to regs as they compile to faster code
    
    Quoting an earlier review comment, using static structures pointers in
    the include file "should allow the compiler to optimize accesses
    better than defining it in a separate compilation unit (by being able
    to constant fold stuff like &rk3399_pmusgrf->field into a single
    address, rather than loading the symbol, loading an offset constant
    and adding)".
    
    Any decent compiler linker system nowadays would consolidate this
    definition in any case.
    
    BRANCH=none
    BUG=chrome-os-partner:51537
    TEST=with the rest of the patches applied Kevin successfully boots
         Linux kernel.
    
    Change-Id: Ibb576c7691a30f2f429651fcca133bd72710c13b
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: 89b6f22e37f733667156f15afb8c27d8a9f07512
    Original-Change-Id: Ice8d6d766a91e7f4fce553378a23b9ca593d12dd
    Original-Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/339869
    Original-Reviewed-by: Julius Werner <jwerner at chromium.org>
---
 src/soc/rockchip/rk3399/clock.c           | 4 ----
 src/soc/rockchip/rk3399/include/soc/grf.h | 6 +++---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/soc/rockchip/rk3399/clock.c b/src/soc/rockchip/rk3399/clock.c
index db4ec3d..7bf5df8 100644
--- a/src/soc/rockchip/rk3399/clock.c
+++ b/src/soc/rockchip/rk3399/clock.c
@@ -17,10 +17,6 @@
 #include <soc/clock.h>
 #include <soc/grf.h>
 
-struct rk3399_grf_regs * const rk3399_grf = (void *)GRF_BASE;
-struct rk3399_pmugrf_regs * const rk3399_pmugrf = (void *)PMUGRF_BASE;
-struct rk3399_pmusgrf_regs * const rk3399_pmusgrf = (void *)PMUSGRF_BASE;
-
 void rkclk_configure_spi(unsigned int bus, unsigned int hz)
 {
 }
diff --git a/src/soc/rockchip/rk3399/include/soc/grf.h b/src/soc/rockchip/rk3399/include/soc/grf.h
index 9d1821c..389454f 100644
--- a/src/soc/rockchip/rk3399/include/soc/grf.h
+++ b/src/soc/rockchip/rk3399/include/soc/grf.h
@@ -315,9 +315,9 @@ struct rk3399_pmusgrf_regs {
 };
 check_member(rk3399_pmusgrf_regs, slv_secure_con4, 0xe3d4);
 
-extern struct rk3399_grf_regs * const rk3399_grf;
-extern struct rk3399_pmugrf_regs * const rk3399_pmugrf;
-extern struct rk3399_pmusgrf_regs * const rk3399_pmusgrf;
+static struct rk3399_grf_regs * const rk3399_grf = (void *)GRF_BASE;
+static struct rk3399_pmugrf_regs * const rk3399_pmugrf = (void *)PMUGRF_BASE;
+static struct rk3399_pmusgrf_regs * const rk3399_pmusgrf = (void *)PMUSGRF_BASE;
 
 #define UART2A_SEL	RK_CLRSETBITS(3 << 10, 0 << 10)
 #define UART2B_SEL	RK_CLRSETBITS(3 << 10, 1 << 10)



More information about the coreboot-gerrit mailing list