summaryrefslogtreecommitdiff
path: root/physmap.c
diff options
context:
space:
mode:
authorstuge <stuge@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-01-26 01:23:31 +0000
committerstuge <stuge@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-01-26 01:23:31 +0000
commit433354e6e54973dbc9b8f1e152a32f8d1608913d (patch)
tree8c343406448761849134777cf4a7c81b089a7d58 /physmap.c
parent8d080afdcd84222374af47df48a2545836a724be (diff)
downloadflashrom-433354e6e54973dbc9b8f1e152a32f8d1608913d.tar.gz
Original v2 revision: 3905
flashrom: Darwin / Mac OS X Through DirectIO from coresystems GmbH we now support Darwin/Mac OS X. DirectIO is available at http://www.coresystems.de/en/directio Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@399 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'physmap.c')
-rw-r--r--physmap.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/physmap.c b/physmap.c
index 65d2569..92e4dcc 100644
--- a/physmap.c
+++ b/physmap.c
@@ -1,4 +1,3 @@
-#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -6,6 +5,24 @@
#include <errno.h>
#include "flash.h"
+#ifdef __DARWIN__
+#include <DirectIO/darwinio.h>
+
+#define MEM_DEV "DirectIO"
+
+void *sys_physmap(unsigned long phys_addr, size_t len)
+{
+ return map_physical(phys_addr, len);
+}
+
+void physunmap(void *virt_addr, size_t len)
+{
+ unmap_physical(virt_addr, len);
+}
+
+#else
+#include <sys/mman.h>
+
#if defined (__sun) && (defined(__i386) || defined(__amd64))
# define MEM_DEV "/dev/xsvc"
#else
@@ -34,6 +51,7 @@ void physunmap(void *virt_addr, size_t len)
{
munmap(virt_addr, len);
}
+#endif
void *physmap(const char *descr, unsigned long phys_addr, size_t len)
{