path: root/hwaccess.h
diff options
authorPatrick Georgi <>2010-09-30 17:03:32 +0000
committerPatrick Georgi <>2010-09-30 17:03:32 +0000
commita9095a95450860e7ea96bb6c21ca4f34e406d3d6 (patch)
treef79ff036266bb09b180f27b3552dd30116a221e4 /hwaccess.h
parent5cfc94a98be9fa2317220c76367fe1792c328461 (diff)
Add support for building flashrom against libpayload
This doesn't include changes to the frontend which must be done separately, so this won't work out of the box. This code was tested on hardware. Corresponding to flashrom svn r1184. Signed-off-by: Patrick Georgi <> Acked-by: Carl-Daniel Hailfinger <>
Diffstat (limited to 'hwaccess.h')
1 files changed, 11 insertions, 1 deletions
diff --git a/hwaccess.h b/hwaccess.h
index 2d17326..45629d2 100644
--- a/hwaccess.h
+++ b/hwaccess.h
@@ -292,7 +292,7 @@ static inline uint32_t inl(uint16_t port)
-#if !defined(__DARWIN__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
+#if !defined(__DARWIN__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__LIBPAYLOAD__)
typedef struct { uint32_t hi, lo; } msr_t;
msr_t rdmsr(int addr);
int wrmsr(int addr, msr_t msr);
@@ -307,6 +307,16 @@ typedef struct { uint32_t hi, lo; } msr_t;
msr_t freebsd_rdmsr(int addr);
int freebsd_wrmsr(int addr, msr_t msr);
+#if defined(__LIBPAYLOAD__)
+#include <arch/io.h>
+#include <arch/msr.h>
+typedef struct { uint32_t hi, lo; } msr_t;
+msr_t libpayload_rdmsr(int addr);
+int libpayload_wrmsr(int addr, msr_t msr);
+#undef rdmsr
+#define rdmsr libpayload_rdmsr
+#define wrmsr libpayload_wrmsr
#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
OpenPOWER on IntegriCloud