aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2015-11-12 09:18:22 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2015-11-12 09:18:22 +0000
commit86845417d18994d0c0d14781a4a0d4bdfffc14ae (patch)
treeb5bd2a611800630099124deb9a91c94895880019
parent7b77d3ea7f000baa71ec84f141d2a95d1e162c7b (diff)
downloadsrc-86845417d18994d0c0d14781a4a0d4bdfffc14ae.tar.gz
src-86845417d18994d0c0d14781a4a0d4bdfffc14ae.zip
Build fixes:
- Add some missing I/O functions for non-i386 and amd64 platforms. - Stub ioremap() to NULL using a macro to ensure non-existing memory attributes are not referred when they do not exist. - Add more header files to linux/list.h to resolve driver compilation issues on Sparc64 and PowerPC platforms. Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/head/; revision=290706
-rw-r--r--sys/compat/linuxkpi/common/include/linux/io.h31
-rw-r--r--sys/compat/linuxkpi/common/include/linux/list.h2
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c8
3 files changed, 34 insertions, 7 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index f3a1e686963a..b6247f0cd707 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -106,12 +106,39 @@ iowrite32be(uint32_t v, volatile void *addr)
*(volatile uint32_t *)addr = htobe32(v);
}
+#undef readb
+static inline uint8_t
+readb(const volatile void *addr)
+{
+ return *(const volatile uint8_t *)addr;
+}
+
+#undef readw
+static inline uint16_t
+readw(const volatile void *addr)
+{
+ return *(const volatile uint16_t *)addr;
+}
+
+#undef readl
+static inline uint32_t
+readl(const volatile void *addr)
+{
+ return *(const volatile uint32_t *)addr;
+}
+
+#if defined(__i386__) || defined(__amd64__)
void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
+#else
+#define _ioremap_attr(...) NULL
+#endif
+
#define ioremap_nocache(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
#define ioremap_wc(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
-#define ioremap ioremap_nocache
+#define ioremap(addr, size) \
+ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
void iounmap(void *addr);
#define memset_io(a, b, c) memset((a), (b), (c))
diff --git a/sys/compat/linuxkpi/common/include/linux/list.h b/sys/compat/linuxkpi/common/include/linux/list.h
index bfa7d975a2ff..6aad25ea7b7a 100644
--- a/sys/compat/linuxkpi/common/include/linux/list.h
+++ b/sys/compat/linuxkpi/common/include/linux/list.h
@@ -67,6 +67,8 @@
#include <vm/vm.h>
#include <vm/vm_object.h>
+#include <vm/pmap.h>
+#include <machine/pmap.h>
#define prefetch(x)
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 26df7db6ce93..f51329cd4b71 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -658,22 +658,20 @@ vmmap_remove(void *addr)
return (vmmap);
}
+#if defined(__i386__) || defined(__amd64__)
void *
_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr)
{
void *addr;
-#if defined(__i386__) || defined(__amd64__)
addr = pmap_mapdev_attr(phys_addr, size, attr);
-#else
- addr = NULL;
-#endif
if (addr == NULL)
return (NULL);
vmmap_add(addr, size);
return (addr);
}
+#endif
void
iounmap(void *addr)