Alexandru Gagniuc (mr.nuke.me@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4681
-gerrit
commit 537b4ca11062f4fd6c80e81c39e4c72cb334b4c1 Author: Alexandru Gagniuc mr.nuke.me@gmail.com Date: Sun Jan 12 15:42:58 2014 -0600
lib: Make log2() available in romstage on ARM, not just x86
On x86, log2() is defined as an inline functions in arch/io.h. This is a remnant of ROMCC, and forced us to not include clog2.c in romstage. As a result, romstage on ARM has no log2(). Use the inline log2 only with ROMCC, but otherwise, use the one in clog2.c.
Change-Id: Ifef2aa0a7b5a1db071a66f2eec0be421b8b2a56d Signed-off-by: Alexandru Gagniuc mr.nuke.me@gmail.com --- src/arch/x86/include/arch/io.h | 5 ++++- src/include/lib.h | 2 +- src/lib/Makefile.inc | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/arch/x86/include/arch/io.h b/src/arch/x86/include/arch/io.h index 955d8e2..8ac9c1e 100644 --- a/src/arch/x86/include/arch/io.h +++ b/src/arch/x86/include/arch/io.h @@ -167,7 +167,8 @@ static inline __attribute__((always_inline)) void write32(unsigned long addr, ui *((volatile uint32_t *)(addr)) = value; }
-#if defined(__PRE_RAM__) || defined(__SMM__) +/* Conflicts with definition in lib.h */ +#if defined(__ROMCC__) || defined(__SMM__) static inline int log2(int value) { unsigned int r = 0; @@ -180,6 +181,8 @@ static inline int log2(int value) return r;
} +#endif + static inline int log2f(int value) { unsigned int r = 0; diff --git a/src/include/lib.h b/src/include/lib.h index 5fc390a..3a51533 100644 --- a/src/include/lib.h +++ b/src/include/lib.h @@ -23,7 +23,7 @@ #define __LIB_H__ #include <stdint.h>
-#ifndef __PRE_RAM__ /* Conflicts with inline function in arch/io.h */ +#if !defined(__ROMCC__) /* Conflicts with inline function in arch/io.h */ /* Defined in src/lib/clog2.c */ unsigned long log2(unsigned long x); #endif diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index b09dace..37c7dea 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -88,6 +88,7 @@ ramstage-y += lzma.c ramstage-y += stack.c ramstage-$(CONFIG_ARCH_X86) += gcc.c ramstage-y += clog2.c +romstage-y += clog2.c ramstage-$(CONFIG_CONSOLE_SERIAL8250) += uart8250.c ramstage-$(CONFIG_CONSOLE_SERIAL8250MEM) += uart8250mem.c ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c