[coreboot] New patch to review for coreboot: f13413b Get libpayload to compile cleanly for ARMV7

Ronald G. Minnich (rminnich@gmail.com) gerrit at coreboot.org
Thu Feb 14 18:55:23 CET 2013


Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2387

-gerrit

commit f13413bc194d82f3a68e334e4445a01864b97717
Author: Ronald G. Minnich <rminnich at gmail.com>
Date:   Thu Feb 14 09:54:57 2013 -0800

    Get libpayload to compile cleanly for ARMV7
    
    There were just a few nits: on ARM, in/out and read/write are the
    same, so create synonyms. Get rid of some the nested if bits; add
    needed function prototypes (that did not used to be needed).
    
    This is prep work for getting more ARM drivers into libpayload.
    
    Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
    
    Change-Id: I1e0b2af4a3aaf314b5cdd8a46ec2cb2663ee684e
    Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
---
 payloads/libpayload/include/armv7/arch/io.h | 10 ++++++++++
 payloads/libpayload/include/libpayload.h    |  5 +++++
 payloads/libpayload/libc/time.c             | 19 +++++++++++++------
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/payloads/libpayload/include/armv7/arch/io.h b/payloads/libpayload/include/armv7/arch/io.h
index e71e1dd..6f4c621 100644
--- a/payloads/libpayload/include/armv7/arch/io.h
+++ b/payloads/libpayload/include/armv7/arch/io.h
@@ -31,12 +31,22 @@
 #ifndef _ARCH_IO_H
 #define _ARCH_IO_H
 
+/* x86 has to differentiate between inb/readb.
+ * No such issue on arm, but we still need to define both
+ * types of operations.
+ */
 #define readb(_a) (*(volatile unsigned char *) (_a))
 #define readw(_a) (*(volatile unsigned short *) (_a))
 #define readl(_a) (*(volatile unsigned long *) (_a))
+#define inb(_a) (*(volatile unsigned char *) (_a))
+#define inw(_a) (*(volatile unsigned short *) (_a))
+#define inl(_a) (*(volatile unsigned long *) (_a))
 
 #define writeb(_v, _a) (*(volatile unsigned char *) (_a) = (_v))
 #define writew(_v, _a) (*(volatile unsigned short *) (_a) = (_v))
 #define writel(_v, _a) (*(volatile unsigned long *) (_a) = (_v))
+#define outb(_v, _a) (*(volatile unsigned char *) (_a) = (_v))
+#define outw(_v, _a) (*(volatile unsigned short *) (_a) = (_v))
+#define outl(_v, _a) (*(volatile unsigned long *) (_a) = (_v))
 
 #endif
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index eaa0d0d..d1b9de8 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -294,6 +294,11 @@ long long int llabs(long long int j);
 u8 bin2hex(u8 b);
 u8 hex2bin(u8 h);
 void fatal(const char *msg) __attribute__ ((noreturn));
+
+void *default_memset(void *s, int c, size_t n);
+void *default_memcpy(void *dst, const void *src, size_t n);
+void *default_memmove(void *dst, const void *src, size_t n);
+int default_memcmp(const void *s1, const void *s2, size_t len);
 /** @} */
 
 
diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c
index 5358c02..91f6296 100644
--- a/payloads/libpayload/libc/time.c
+++ b/payloads/libpayload/libc/time.c
@@ -110,14 +110,20 @@ static void gettimeofday_init(void)
 	clock.secs = (days * 86400) + (tm.tm_hour * 3600) +
 		(tm.tm_min * 60) + tm.tm_sec;
 }
-#else
+#endif // CONFIG_NVRAM
+#endif // CONFIG_ARCH_X86
+
+#ifdef CONFIG_ARCH_ARMV7
+static void update_clock(void)
+{
+}
+
 static void gettimeofday_init(void)
 {
-	/* Record the number of ticks */
-	clock.ticks = rdtsc();
 }
-#endif
-#endif
+#endif // CONFIG_ARCH_ARMV7
+
+
 #ifdef CONFIG_ARCH_POWERPC
 static void update_clock(void)
 {
@@ -126,7 +132,8 @@ static void update_clock(void)
 static void gettimeofday_init(void)
 {
 }
-#endif
+#endif // CONFIG_ARCH_POWERPC
+
 /**
  * Return the current time broken into a timeval structure.
  *



More information about the coreboot mailing list