[PATCH] lib: fwts_ioport: add dummy stubs for non-x86 arch

Colin King colin.king at canonical.com
Wed Feb 13 10:05:42 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Architectures like PowerPC get a failure to build because we don't
have sys/io.h.  Since the I/O access is for just for x86 fwts tests
the easiest way forward is to implement dummy I/O funcs for non-x86
systems and don't include sys/io.h for these.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_ioport.c | 65 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 62 insertions(+), 3 deletions(-)

diff --git a/src/lib/src/fwts_ioport.c b/src/lib/src/fwts_ioport.c
index 4da6a7a..ecee2c8 100644
--- a/src/lib/src/fwts_ioport.c
+++ b/src/lib/src/fwts_ioport.c
@@ -17,13 +17,15 @@
  *
  */
 
-#include <sys/io.h>
 #include <stdint.h>
+#include "fwts.h"
+
+#ifdef FWTS_ARCH_INTEL
+
+#include <sys/io.h>
 #include <signal.h>
 #include <setjmp.h>
 
-#include "fwts.h"
-
 static jmp_buf jmpbuf;
 
 /*
@@ -134,3 +136,60 @@ int fwts_outl(uint32_t port, uint32_t value)
 
 	return FWTS_OK;
 }
+
+#else
+
+/*
+ *  dummy versions of above, all return FWTS_ERROR
+ *  for non-x86 platforms and any return values are
+ *  set to ~0.
+ */
+int fwts_inb(uint32_t port, uint8_t *value)
+{	
+	FWTS_UNUSED(port);
+
+	*value = ~0;
+	return FWTS_ERROR;
+}
+
+int fwts_inw(uint32_t port, uint16_t *value)
+{
+	FWTS_UNUSED(port);
+
+	*value = ~0;
+	return FWTS_ERROR;
+}
+
+int fwts_inl(uint32_t port, uint32_t *value)
+{
+	FWTS_UNUSED(port);
+
+	*value = ~0;
+	return FWTS_ERROR;
+}
+
+int fwts_outb(uint32_t port, uint8_t value)
+{
+	FWTS_UNUSED(port);
+	FWTS_UNUSED(value);
+
+	return FWTS_ERROR;
+}
+
+int fwts_outw(uint32_t port, uint16_t value)
+{
+	FWTS_UNUSED(port);
+	FWTS_UNUSED(value);
+
+	return FWTS_ERROR;
+}
+
+int fwts_outl(uint32_t port, uint32_t value)
+{
+	FWTS_UNUSED(port);
+	FWTS_UNUSED(value);
+
+	return FWTS_ERROR;
+}
+
+#endif
-- 
1.8.1.2




More information about the fwts-devel mailing list