From patchwork Wed Feb 13 10:05:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: lib: fwts_ioport: add dummy stubs for non-x86 arch Date: Wed, 13 Feb 2013 00:05:42 -0000 From: Colin King X-Patchwork-Id: 220106 Message-Id: <1360749942-18767-1-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com From: Colin Ian King 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 Acked-by: Alex Hung Acked-by: Keng-Yu Lin --- 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 #include +#include "fwts.h" + +#ifdef FWTS_ARCH_INTEL + +#include #include #include -#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