From 03784fa97a764be81ca9bcf79222e7b37e2e7692 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Mon, 9 Dec 2013 17:46:22 -0800 Subject: Add check_member macro to allow clean and easy struct offset checking This patch adds a new static assertion macro that can be used to check the offsets in structures that overlay register sets at compile time. It uses the _Static_assert() declaration from the new ISO C11 standard, which is supported (even without -std=c11) by GCC after version 4.6. (There is supposedly also support in clang, although I haven't tried it... let's deal with compiler issues when/if they turn up.) I've added it to all structures for our current ARM SoCs for now, and I think every new register overlay we add going forward should use them (at least for the last member, but feel free to add more if you think it's useful). Change-Id: If32510e7049739ad05618d363a854dc372d64386 Signed-off-by: Julius Werner Reviewed-on: https://chromium-review.googlesource.com/179412 Reviewed-by: David Hendricks Reviewed-by: Stefan Reinauer (cherry picked from commit cef5fa13c31375a316ca4556c0039b17c8ea7900) Signed-off-by: Isaac Christensen Reviewed-on: http://review.coreboot.org/6905 Tested-by: build bot (Jenkins) --- src/soc/samsung/exynos5250/clk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/soc/samsung/exynos5250/clk.h') diff --git a/src/soc/samsung/exynos5250/clk.h b/src/soc/samsung/exynos5250/clk.h index f09ac41643..9d27e679ca 100644 --- a/src/soc/samsung/exynos5250/clk.h +++ b/src/soc/samsung/exynos5250/clk.h @@ -431,7 +431,7 @@ struct exynos5_clock { unsigned int clkout_cmu_r1x_div_stat; unsigned char res98[0x3608]; - unsigned int bpll_lock; /* base + 0x2000c */ + unsigned int bpll_lock; /* base + 0x20010 */ unsigned char res99[0xfc]; unsigned int bpll_con0; unsigned int bpll_con1; @@ -461,6 +461,7 @@ struct exynos5_clock { unsigned int pll_div2_sel; unsigned char res109b[0xf5e4]; }; +check_member(exynos5_clock, pll_div2_sel, 0x20a24); static struct exynos5_clock * const exynos_clock = (void *)EXYNOS5_CLOCK_BASE; @@ -521,6 +522,7 @@ struct exynos5_mct { uint8_t reserved14[0x8]; uint32_t l1_wstat; }; +check_member(exynos5_mct, l1_wstat, 0x440); static struct exynos5_mct * const exynos_mct = (void *)EXYNOS5_MULTI_CORE_TIMER_BASE; -- cgit v1.2.3