1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

Fix compilation for DOS and non-x86 targets

Fixup for r1638.
Thanks to Idwer Vollering for testing.

Corresponding to flashrom svn r1645.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
Carl-Daniel Hailfinger 2013-01-08 22:49:12 +00:00
parent a2faddf7d3
commit 8225868465

View File

@ -65,31 +65,25 @@ static inline void sync_primitive(void)
#endif #endif
} }
#if IS_X86 && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__))
static int release_io_perms(void *p) static int release_io_perms(void *p)
{ {
#if IS_X86 #if defined (__sun)
#if defined(__DJGPP__) || defined(__LIBPAYLOAD__)
/* Nothing to release */
#elif defined (__sun)
sysi86(SI86V86, V86SC_IOPL, 0); sysi86(SI86V86, V86SC_IOPL, 0);
#elif IS_BSD #elif IS_BSD
close(io_fd); close(io_fd);
#elif IS_LINUX #elif IS_LINUX
iopl(0); iopl(0);
#endif
#else
/* PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM. */
#endif #endif
return 0; return 0;
} }
#endif
/* Get I/O permissions with automatic permission release on shutdown. */ /* Get I/O permissions with automatic permission release on shutdown. */
int rget_io_perms(void) int rget_io_perms(void)
{ {
#if IS_X86 #if IS_X86 && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__))
#if defined(__DJGPP__) || defined(__LIBPAYLOAD__) #if defined (__sun)
/* We have full permissions by default. */
#elif defined (__sun)
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) { if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) {
#elif IS_BSD #elif IS_BSD
if ((io_fd = open("/dev/io", O_RDWR)) < 0) { if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
@ -107,7 +101,8 @@ int rget_io_perms(void)
register_shutdown(release_io_perms, NULL); register_shutdown(release_io_perms, NULL);
} }
#else #else
/* PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM. */ /* DJGPP and libpayload environments have full PCI port I/O permissions by default. */
/* PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM. */
#endif #endif
return 0; return 0;
} }