summaryrefslogtreecommitdiff
path: root/hwaccess.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2013-01-08 22:49:12 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2013-01-08 22:49:12 +0000
commit0fd7a888281d2cb394bc08676c62df274a59ab66 (patch)
tree73eba56408b31c6431013f57c5da73cb1d805fd2 /hwaccess.c
parent1258228f6cee785ba4426d223a356b3ef7439481 (diff)
downloadflashrom-0fd7a888281d2cb394bc08676c62df274a59ab66.tar.gz
Fix compilation for DOS and non-x86 targets.
Fixup for r1638. Thanks to Idwer Vollering for testing. 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> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1645 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'hwaccess.c')
-rw-r--r--hwaccess.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/hwaccess.c b/hwaccess.c
index 93e2a9f..f0b2f63 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -65,31 +65,25 @@ static inline void sync_primitive(void)
#endif
}
+#if IS_X86 && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__))
static int release_io_perms(void *p)
{
-#if IS_X86
-#if defined(__DJGPP__) || defined(__LIBPAYLOAD__)
- /* Nothing to release */
-#elif defined (__sun)
+#if defined (__sun)
sysi86(SI86V86, V86SC_IOPL, 0);
#elif IS_BSD
close(io_fd);
#elif IS_LINUX
iopl(0);
#endif
-#else
-/* PCI port I/O support is unimplemented on PPC/MIPS and unavailable on ARM. */
-#endif
return 0;
}
+#endif
/* Get I/O permissions with automatic permission release on shutdown. */
int rget_io_perms(void)
{
-#if IS_X86
-#if defined(__DJGPP__) || defined(__LIBPAYLOAD__)
- /* We have full permissions by default. */
-#elif defined (__sun)
+#if IS_X86 && !(defined(__DJGPP__) || defined(__LIBPAYLOAD__))
+#if defined (__sun)
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) {
#elif IS_BSD
if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
@@ -107,7 +101,8 @@ int rget_io_perms(void)
register_shutdown(release_io_perms, NULL);
}
#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
return 0;
}