CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:35:36 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: uaccess.h

Log Message:
Add some copy_to/from_user variants to Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/include/asm/uaccess.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/uaccess.h
diff -u src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.4 src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.4	Wed Jul 24 02:12:14 2013
+++ src/sys/external/bsd/drm2/include/asm/uaccess.h	Sun Sep  8 15:35:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaccess.h,v 1.1.2.4 2013/07/24 02:12:14 riastradh Exp $	*/
+/*	$NetBSD: uaccess.h,v 1.1.2.5 2013/09/08 15:35:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,6 +35,19 @@
 #include 
 #include 
 
+/* XXX This is a cop-out.  */
+#define	VERIFY_READ	0
+#define	VERIFY_WRITE	1
+static inline bool
+access_ok(int verify_op __unused, const void *uaddr __unused,
+size_t nbytes __unused)
+{
+	return true;
+}
+
+#define	__copy_from_user	copy_from_user
+#define	__copy_to_user		copy_to_user
+
 static inline int
 copy_from_user(void *kernel_addr, const void *user_addr, size_t len)
 {
@@ -55,4 +68,33 @@ copy_to_user(void *user_addr, const void
 #define	put_user(KERNEL_LOC, USER_ADDR)	\
 	copy_to_user((USER_ADDR), &(KERNEL_LOC), sizeof(KERNEL_LOC))
 
+#if 0
+/*
+ * XXX These `inatomic' versions are a cop out, but they should do for
+ * now -- they are used only in fast paths which can't fault but which
+ * can fall back to slower paths that arrange things so faulting is OK.
+ */
+
+static inline int
+__copy_from_user_inatomic(void *kernel_addr __unused,
+const void *user_addr __unused, size_t len __unused)
+{
+	return -EFAULT;
+}
+
+static inline int
+__copy_to_user_inatomic(void *user_addr __unused,
+const void *kernel_addr __unused, size_t len __unused)
+{
+	return -EFAULT;
+}
+#endif	/* 0 */
+
+static inline int
+__copy_from_user_inatomic_nocache(void *kernel_addr __unused,
+const void *user_addr __unused, size_t len __unused)
+{
+	return -EFAULT;
+}
+
 #endif  /* _ASM_UACCESS_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:35:06 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: io.h

Log Message:
Define page_to_phys in Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/include/asm/io.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/io.h
diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3 src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3	Wed Jul 24 03:44:10 2013
+++ src/sys/external/bsd/drm2/include/asm/io.h	Sun Sep  8 15:35:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.h,v 1.1.2.3 2013/07/24 03:44:10 riastradh Exp $	*/
+/*	$NetBSD: io.h,v 1.1.2.4 2013/09/08 15:35:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,12 @@
 #ifndef _ASM_IO_H_
 #define _ASM_IO_H_
 
+#include 
+
+#include 
+
+#include 
+
 /*
  * XXX This is bollocks, and is wrong on various architectures (should
  * work for x86; who knows what else), but bus_space_barrier won't work
@@ -43,4 +49,16 @@
 #define	memcpy_toio	memcpy
 #define	memset_io	memset
 
+/*
+ * XXX Not sure why this is here, but so it is in Linux...  Also, not
+ * sure what the right type is: Linux uses dma_addr_t, but I don't
+ * think bus_addr_t is right here -- paddr_t sounds more appropriate.
+ */
+
+static inline bus_addr_t
+page_to_phys(struct page *page)
+{
+	return VM_PAGE_TO_PHYS(&page->p_vmp);
+}
+
 #endif  /* _ASM_IO_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 03:44:10 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: io.h

Log Message:
Define memcpy_*io as memcpy in drm2 Linux .

These work only for memory-mapped I/O anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/include/asm/io.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/io.h
diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.2 src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3
--- src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.2	Wed Jul 24 03:39:52 2013
+++ src/sys/external/bsd/drm2/include/asm/io.h	Wed Jul 24 03:44:10 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.h,v 1.1.2.2 2013/07/24 03:39:52 riastradh Exp $	*/
+/*	$NetBSD: io.h,v 1.1.2.3 2013/07/24 03:44:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -39,4 +39,8 @@
  */
 #define	mmiowb()	__insn_barrier()
 
+#define	memcpy_fromio	memcpy
+#define	memcpy_toio	memcpy
+#define	memset_io	memset
+
 #endif  /* _ASM_IO_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 03:43:55 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h

Log Message:
Implement BUILD_BUG_ON via CTASSERT in drm2 Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.7 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.8
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.7	Wed Jul 24 03:35:34 2013
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Wed Jul 24 03:43:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.1.2.7 2013/07/24 03:35:34 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.1.2.8 2013/07/24 03:43:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,6 +38,8 @@
 #define	BUG()			panic("%s:%d: BUG!", __FILE__, __LINE__)
 #define	BUG_ON(CONDITION)	KASSERT(!(CONDITION))
 
+#define	BUILD_BUG_ON(CONDITION)	CTASSERT(!(CONDITION))
+
 /* XXX Rate limit?  */
 #define WARN(CONDITION, FMT, ...)	\
 	linux_warning((CONDITION)?	\



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 03:39:52 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: io.h

Log Message:
Add bogus x86-specific mmiowb to Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/include/asm/io.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/io.h
diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.1 src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.1	Wed Jul 24 00:33:11 2013
+++ src/sys/external/bsd/drm2/include/asm/io.h	Wed Jul 24 03:39:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.h,v 1.1.2.1 2013/07/24 00:33:11 riastradh Exp $	*/
+/*	$NetBSD: io.h,v 1.1.2.2 2013/07/24 03:39:52 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,11 @@
 #ifndef _ASM_IO_H_
 #define _ASM_IO_H_
 
+/*
+ * XXX This is bollocks, and is wrong on various architectures (should
+ * work for x86; who knows what else), but bus_space_barrier won't work
+ * because we have no bus space tag or handle or offset or anything.
+ */
+#define	mmiowb()	__insn_barrier()
+
 #endif  /* _ASM_IO_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 03:35:34 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h

Log Message:
Define WARN_ONCE in Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.6 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.7
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.6	Wed Jul 24 03:25:28 2013
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Wed Jul 24 03:35:34 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.1.2.6 2013/07/24 03:25:28 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.1.2.7 2013/07/24 03:35:34 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -45,6 +45,9 @@
 		##__VA_ARGS__), 1)	\
 	: 0)
 
+#define	WARN_ONCE(CONDITION, FMT, ...)	\
+	WARN(CONDITION, FMT, ##__VA_ARGS__) /* XXX */
+
 #define	WARN_ON(CONDITION)	WARN(CONDITION, "%s\n", #CONDITION)
 #define	WARN_ON_SMP(CONDITION)	WARN_ON(CONDITION) /* XXX */
 #define	WARN_ON_ONCE(CONDITION)	WARN_ON(CONDITION) /* XXX */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 03:25:28 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h

Log Message:
Use an intermediate call in WARN* to avoid GCC compiler warnings.

For some reason this shuts it up about statements without effect.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.5 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.6
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.5	Wed Jul 24 03:02:51 2013
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Wed Jul 24 03:25:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.1.2.5 2013/07/24 03:02:51 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.1.2.6 2013/07/24 03:25:28 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 /* XXX Rate limit?  */
 #define WARN(CONDITION, FMT, ...)	\
-	((CONDITION)?			\
+	linux_warning((CONDITION)?	\
 	(printf("warning: %s:%d: " FMT, __FILE__, __LINE__,		\
 		##__VA_ARGS__), 1)	\
 	: 0)
@@ -49,4 +49,11 @@
 #define	WARN_ON_SMP(CONDITION)	WARN_ON(CONDITION) /* XXX */
 #define	WARN_ON_ONCE(CONDITION)	WARN_ON(CONDITION) /* XXX */
 
+/* XXX Kludge to avoid GCC warning about statements without effect.  */
+static inline int
+linux_warning(int x)
+{
+	return x;
+}
+
 #endif  /* _ASM_BUG_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 03:10:21 UTC 2013

Added Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: processor.h

Log Message:
Add Linux  with cpu_relax() (= DELAY(1), for now).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/asm/processor.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/external/bsd/drm2/include/asm/processor.h
diff -u /dev/null src/sys/external/bsd/drm2/include/asm/processor.h:1.1.2.1
--- /dev/null	Wed Jul 24 03:10:21 2013
+++ src/sys/external/bsd/drm2/include/asm/processor.h	Wed Jul 24 03:10:21 2013
@@ -0,0 +1,39 @@
+/*	$NetBSD: processor.h,v 1.1.2.1 2013/07/24 03:10:21 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ASM_PROCESSOR_H_
+#define _ASM_CURRENT_H_
+
+#include 
+
+#define	cpu_relax()	DELAY(1)	/* XXX */
+
+#endif  /* _ASM_PROCESSOR_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 03:02:51 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h

Log Message:
Make Linux WARN_* macros expand to expressions, not statements.

These are to return the value of the condition.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.4 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.4	Wed Jul 24 02:56:03 2013
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Wed Jul 24 03:02:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.1.2.4 2013/07/24 02:56:03 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.1.2.5 2013/07/24 03:02:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -39,14 +39,14 @@
 #define	BUG_ON(CONDITION)	KASSERT(!(CONDITION))
 
 /* XXX Rate limit?  */
-#define WARN(CONDITION, FMT, ...)	do\
-{	\
-	if (CONDITION)			\
-		printf("warning: %s:%d: " FMT, __FILE__, __LINE__,	\
-		##__VA_ARGS__);	\
-} while (0)
+#define WARN(CONDITION, FMT, ...)	\
+	((CONDITION)?			\
+	(printf("warning: %s:%d: " FMT, __FILE__, __LINE__,		\
+		##__VA_ARGS__), 1)	\
+	: 0)
 
 #define	WARN_ON(CONDITION)	WARN(CONDITION, "%s\n", #CONDITION)
 #define	WARN_ON_SMP(CONDITION)	WARN_ON(CONDITION) /* XXX */
+#define	WARN_ON_ONCE(CONDITION)	WARN_ON(CONDITION) /* XXX */
 
 #endif  /* _ASM_BUG_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:56:38 UTC 2013

Added Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: byteorder.h

Log Message:
Add Linux  with cpu_to_le16 &c.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/asm/byteorder.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/external/bsd/drm2/include/asm/byteorder.h
diff -u /dev/null src/sys/external/bsd/drm2/include/asm/byteorder.h:1.1.2.1
--- /dev/null	Wed Jul 24 02:56:38 2013
+++ src/sys/external/bsd/drm2/include/asm/byteorder.h	Wed Jul 24 02:56:38 2013
@@ -0,0 +1,51 @@
+/*	$NetBSD: byteorder.h,v 1.1.2.1 2013/07/24 02:56:38 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ASM_BYTEORDER_H_
+#define _ASM_BYTEORDER_H_
+
+#include 
+
+#define	cpu_to_le16	htole16
+#define	cpu_to_le32	htole32
+#define	cpu_to_le64	htole64
+#define	cpu_to_be16	htobe16
+#define	cpu_to_be32	htobe32
+#define	cpu_to_be64	htobe64
+
+#define	le16_to_cpu	le16toh
+#define	le32_to_cpu	le32toh
+#define	le64_to_cpu	le64toh
+#define	be16_to_cpu	be16toh
+#define	be32_to_cpu	be32toh
+#define	be64_to_cpu	be64toh
+
+#endif	/* _ASM_BYTEORDER_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:56:03 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h

Log Message:
Fix #endif comment in Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.3 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.3	Wed Jul 24 02:51:20 2013
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Wed Jul 24 02:56:03 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.1.2.3 2013/07/24 02:51:20 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.1.2.4 2013/07/24 02:56:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -49,4 +49,4 @@
 #define	WARN_ON(CONDITION)	WARN(CONDITION, "%s\n", #CONDITION)
 #define	WARN_ON_SMP(CONDITION)	WARN_ON(CONDITION) /* XXX */
 
-#endif  /* _LINUX_KERNEL_H_ */
+#endif  /* _ASM_BUG_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:51:20 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h

Log Message:
Add BUG() to Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.2 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.3
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.2	Wed Jul 24 02:26:39 2013
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Wed Jul 24 02:51:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.1.2.2 2013/07/24 02:26:39 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.1.2.3 2013/07/24 02:51:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,6 +35,7 @@
 #include 
 #include 
 
+#define	BUG()			panic("%s:%d: BUG!", __FILE__, __LINE__)
 #define	BUG_ON(CONDITION)	KASSERT(!(CONDITION))
 
 /* XXX Rate limit?  */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:26:39 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: bug.h

Log Message:
Define WARN_ON_SMP to be the same as WARN_ON in Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.1 src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.1.2.1	Wed Jul 24 02:21:43 2013
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Wed Jul 24 02:26:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.1.2.1 2013/07/24 02:21:43 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.1.2.2 2013/07/24 02:26:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -46,5 +46,6 @@
 } while (0)
 
 #define	WARN_ON(CONDITION)	WARN(CONDITION, "%s\n", #CONDITION)
+#define	WARN_ON_SMP(CONDITION)	WARN_ON(CONDITION) /* XXX */
 
 #endif  /* _LINUX_KERNEL_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:15:53 UTC 2013

Added Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: param.h

Log Message:
Add Linuxoid  with hokey HZ.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/asm/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/external/bsd/drm2/include/asm/param.h
diff -u /dev/null src/sys/external/bsd/drm2/include/asm/param.h:1.1.2.1
--- /dev/null	Wed Jul 24 02:15:53 2013
+++ src/sys/external/bsd/drm2/include/asm/param.h	Wed Jul 24 02:15:53 2013
@@ -0,0 +1,41 @@
+/*	$NetBSD: param.h,v 1.1.2.1 2013/07/24 02:15:53 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ASM_PARAM_H_
+#define _ASM_PARAM_H_
+
+#include 
+#include 
+
+/* XXX Urk...  */
+#define	HZ	hz
+
+#endif  /* _ASM_PARAM_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:12:14 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: uaccess.h

Log Message:
Add hokey (but typeof-free) get_user and put_user to .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \
src/sys/external/bsd/drm2/include/asm/uaccess.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/uaccess.h
diff -u src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.3 src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.3	Wed Jul 24 02:04:16 2013
+++ src/sys/external/bsd/drm2/include/asm/uaccess.h	Wed Jul 24 02:12:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaccess.h,v 1.1.2.3 2013/07/24 02:04:16 riastradh Exp $	*/
+/*	$NetBSD: uaccess.h,v 1.1.2.4 2013/07/24 02:12:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -49,5 +49,10 @@ copy_to_user(void *user_addr, const void
 	return -copyout(kernel_addr, user_addr, len);
 }
 
+#define	get_user(KERNEL_LOC, USER_ADDR)	\
+	copy_from_user(&(KERNEL_LOC), (USER_ADDR), sizeof(KERNEL_LOC))
+
+#define	put_user(KERNEL_LOC, USER_ADDR)	\
+	copy_to_user((USER_ADDR), &(KERNEL_LOC), sizeof(KERNEL_LOC))
 
 #endif  /* _ASM_UACCESS_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:03:46 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: mtrr.h

Log Message:
Partially implement Linux .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/include/asm/mtrr.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/mtrr.h
diff -u src/sys/external/bsd/drm2/include/asm/mtrr.h:1.1.2.1 src/sys/external/bsd/drm2/include/asm/mtrr.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/asm/mtrr.h:1.1.2.1	Wed Jul 24 00:33:11 2013
+++ src/sys/external/bsd/drm2/include/asm/mtrr.h	Wed Jul 24 02:03:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: mtrr.h,v 1.1.2.1 2013/07/24 00:33:11 riastradh Exp $	*/
+/*	$NetBSD: mtrr.h,v 1.1.2.2 2013/07/24 02:03:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,51 @@
 #ifndef _ASM_MTRR_H_
 #define _ASM_MTRR_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_mtrr.h"
+#endif
+
+#include 
+
+#define	MTRR_TYPE_WRCOMB	MTRR_TYPE_WC
+
+static inline int
+mtrr_add(unsigned long base, unsigned long size, int type,
+bool increment __unused)
+{
+#ifdef MTRR
+	struct mtrr mtrr;
+	int n = 1;
+
+	mtrr.base = base;
+	mtrr.len = size;
+	mtrr.type = type;
+	mtrr.flags = MTRR_VALID;
+
+	/* XXX errno NetBSD->Linux */
+	return -mtrr_set(&mtrr, &n, NULL, MTRR_GETSET_KERNEL);
+#else
+	return 0;
+#endif
+}
+
+static inline int
+mtrr_del(int handle __unused, unsigned long base, unsigned long size)
+{
+#ifdef MTRR
+	struct mtrr mtrr;
+	int n = 1;
+
+	mtrr.base = base;
+	mtrr.len = size;
+	mtrr.type = 0;
+	mtrr.flags = 0;		/* not MTRR_VALID */
+
+	/* XXX errno NetBSD->Linux */
+	return -mtrr_set(&mtrr, &n, NULL, MTRR_GETSET_KERNEL);
+#else
+	return 0;
+#endif
+}
+
 #endif  /* _ASM_MTRR_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 02:01:13 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: shmparam.h

Log Message:
Define SHMLBA to be PAGE_SIZE in .

XXX Wait, what?


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/include/asm/shmparam.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/shmparam.h
diff -u src/sys/external/bsd/drm2/include/asm/shmparam.h:1.1.2.1 src/sys/external/bsd/drm2/include/asm/shmparam.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/asm/shmparam.h:1.1.2.1	Wed Jul 24 00:33:11 2013
+++ src/sys/external/bsd/drm2/include/asm/shmparam.h	Wed Jul 24 02:01:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: shmparam.h,v 1.1.2.1 2013/07/24 00:33:11 riastradh Exp $	*/
+/*	$NetBSD: shmparam.h,v 1.1.2.2 2013/07/24 02:01:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,8 @@
 #ifndef _ASM_SHMPARAM_H_
 #define _ASM_SHMPARAM_H_
 
+#include 
+
+#define	SHMLBA	PAGE_SIZE
+
 #endif  /* _ASM_SHMPARAM_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 01:56:33 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: barrier.h

Log Message:
Include "opt_multiprocessor.h" for MULTIPROCESSOR in .


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/include/asm/barrier.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/barrier.h
diff -u src/sys/external/bsd/drm2/include/asm/barrier.h:1.1.2.1 src/sys/external/bsd/drm2/include/asm/barrier.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/asm/barrier.h:1.1.2.1	Wed Jul 24 01:54:57 2013
+++ src/sys/external/bsd/drm2/include/asm/barrier.h	Wed Jul 24 01:56:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: barrier.h,v 1.1.2.1 2013/07/24 01:54:57 riastradh Exp $	*/
+/*	$NetBSD: barrier.h,v 1.1.2.2 2013/07/24 01:56:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,6 +34,10 @@
 
 #include 
 
+#ifdef _KERNEL_OPT
+#include "opt_multiprocessor.h"
+#endif
+
 #define	mb	membar_sync
 #define	wmb	membar_producer
 #define	rmb	membar_consumer



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 24 01:54:57 UTC 2013

Added Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: barrier.h

Log Message:
Implement Linux memory barriers in .


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/include/asm/barrier.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/external/bsd/drm2/include/asm/barrier.h
diff -u /dev/null src/sys/external/bsd/drm2/include/asm/barrier.h:1.1.2.1
--- /dev/null	Wed Jul 24 01:54:57 2013
+++ src/sys/external/bsd/drm2/include/asm/barrier.h	Wed Jul 24 01:54:57 2013
@@ -0,0 +1,59 @@
+/*	$NetBSD: barrier.h,v 1.1.2.1 2013/07/24 01:54:57 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ASM_BARRIER_H_
+#define _ASM_BARRIER_H_
+
+#include 
+
+#define	mb	membar_sync
+#define	wmb	membar_producer
+#define	rmb	membar_consumer
+
+#ifdef __alpha__		/* XXX As if...  */
+#  define	read_barrier_depends	membar_sync
+#else
+#  define	read_barrier_depends()	do {} while (0)
+#endif
+
+#ifdef MULTIPROCESSOR
+#  define	smp_mbmb
+#  define	smp_wmbwmb
+#  define	smp_rmbrmb
+#  define	smp_read_barrier_depends	read_barrier_depends
+#else
+#  define	smp_mb()			do {} while (0)
+#  define	smp_wmb()			do {} while (0)
+#  define	smp_rmb()			do {} while (0)
+#  define	smp_read_barrier_depends()	do {} while (0)
+#endif
+
+#endif  /* _ASM_BARRIER_H_ */