Message ID | 1360749942-18767-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 02/13/2013 06:05 PM, Colin King wrote: > From: Colin Ian King <colin.king@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@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 > Acked-by: Alex Hung <alex.hung@canonical.com>
On Mon, Feb 18, 2013 at 10:30 AM, Alex Hung <alex.hung@canonical.com> wrote: > On 02/13/2013 06:05 PM, Colin King wrote: >> >> From: Colin Ian King <colin.king@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@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 >> > > Acked-by: Alex Hung <alex.hung@canonical.com> > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
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