CVS commit: src/sys/external/bsd

2015-08-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 18 21:10:57 UTC 2015

Added Files:
src/sys/external/bsd/common/include/linux: err.h
Removed Files:
src/sys/external/bsd/drm2/include/linux: err.h

Log Message:
Move linux/err.h into common/include.

OK riastradh@


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/linux/err.h
cvs rdiff -u -r1.3 -r0 src/sys/external/bsd/drm2/include/linux/err.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/common/include/linux/err.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/err.h:1.1
--- /dev/null	Tue Aug 18 21:10:57 2015
+++ src/sys/external/bsd/common/include/linux/err.h	Tue Aug 18 21:10:56 2015
@@ -0,0 +1,87 @@
+/*	$NetBSD: err.h,v 1.1 2015/08/18 21:10:56 skrll 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 _LINUX_ERR_H_
+#define _LINUX_ERR_H_
+
+/* XXX Linux uses long and int inconsistently here.  Hope this works out.  */
+
+#include 
+#include 
+#include 
+
+#define	MAX_ERRNO	ELAST
+
+static inline bool
+IS_ERR_VALUE(uintptr_t n)
+{
+	return (n >= (uintptr_t)-MAX_ERRNO);
+}
+
+static inline void *
+ERR_PTR(long error)
+{
+	KASSERT(error < 0);
+	return (void *)(intptr_t)error;
+}
+
+static inline long
+PTR_ERR(const void *ptr)
+{
+	KASSERT(ptr == (void *)(intptr_t)(long)(intptr_t)ptr); /* XXX Hurk!  */
+	return (long)(intptr_t)ptr;
+}
+
+static inline bool
+IS_ERR(const void *ptr)
+{
+	return IS_ERR_VALUE((uintptr_t)ptr);
+}
+
+static inline bool
+IS_ERR_OR_NULL(const void *ptr)
+{
+	return ((ptr == NULL) || IS_ERR(ptr));
+}
+
+static inline void *
+ERR_CAST(void *ptr)		/* XXX Linux declares with const.  */
+{
+	return ptr;
+}
+
+static inline long
+PTR_RET(const void *ptr)
+{
+	return (IS_ERR(ptr)? PTR_ERR(ptr) : 0);
+}
+
+#endif  /* _LINUX_ERR_H_ */



CVS commit: src/sys/external/bsd

2015-08-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Aug 20 21:41:12 UTC 2015

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
src/sys/external/bsd/drm2/dist/drm/radeon: atombios_encoders.c
radeon_legacy_encoders.c
src/sys/external/bsd/drm2/drm: files.drmkms
src/sys/external/bsd/drm2/i915drm: files.i915drmkms

Log Message:
Tweak IS_ENABLED to allow CONFIG_FOO values.

No functional change to drm2.

LGTM from riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/i915drm/files.i915drmkms

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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.7 src/sys/external/bsd/common/include/linux/kernel.h:1.8
--- src/sys/external/bsd/common/include/linux/kernel.h:1.7	Mon Apr 20 15:22:18 2015
+++ src/sys/external/bsd/common/include/linux/kernel.h	Thu Aug 20 21:41:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.7 2015/04/20 15:22:18 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.8 2015/08/20 21:41:12 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #define	oops_in_progress	(panicstr != NULL)
 
-#define	IS_ENABLED(option)	0 /* XXX Hmm...  */
+#define	IS_ENABLED(option)	(option)
 
 #define	__printf	__printflike
 #define	__user

Index: src/sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c:1.2	Wed Jul 16 20:59:57 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c	Thu Aug 20 21:41:12 2015
@@ -133,7 +133,7 @@ atombios_set_backlight_level(struct rade
 	}
 }
 
-#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) || IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
 
 static u8 radeon_atom_bl_level(struct backlight_device *bd)
 {

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c:1.1.1.1	Wed Jul 16 19:35:28 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c	Thu Aug 20 21:41:12 2015
@@ -310,7 +310,7 @@ radeon_legacy_set_backlight_level(struct
 	radeon_legacy_lvds_update(&radeon_encoder->base, dpms_mode);
 }
 
-#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) || IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
 
 static uint8_t radeon_legacy_lvds_level(struct backlight_device *bd)
 {

Index: src/sys/external/bsd/drm2/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.11 src/sys/external/bsd/drm2/drm/files.drmkms:1.12
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.11	Thu Mar  5 17:50:41 2015
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Thu Aug 20 21:41:12 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.11 2015/03/05 17:50:41 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.12 2015/08/20 21:41:12 skrll Exp $
 
 include "external/bsd/drm2/linux/files.drmkms_linux"
 
@@ -26,6 +26,10 @@ makeoptions 	drmkms 	"CWARNFLAGS.drm_edi
 # XXX Should probably be in a header file.  opt_drmkms.h?
 makeoptions	drmkms	CPPFLAGS+="-D__KERNEL__"
 
+makeoptions	drmkms	CPPFLAGS+="-DCONFIG_FB=0"
+makeoptions	drmkms	CPPFLAGS+="-DCONFIG_BACKLIGHT_CLASS_DEVICE=0"
+makeoptions	drmkms	CPPFLAGS+="-DCONFIG_BACKLIGHT_CLASS_DEVICE_MODULE=0"
+
 file	external/bsd/drm2/dist/drm/drm_auth.c		drmkms
 file	external/bsd/drm2/dist/drm/drm_buffer.c		drmkms
 file	external/bsd/drm2/dist/drm/drm_bufs.c		drmkms

Index: src/sys/external/bsd/drm2/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.10 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.11
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.10	Thu Mar  5 17:50:41 2015
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Thu Aug 20 21:41:12 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.10 2015/03/05 17:50:41 riastradh Exp $
+#	$NetBSD: files.i915drmkms,v 1.11 2015/08/20 21:41:12 skrll Exp $
 
 define	intelfbbus	{ }
 device	i915drmkms: drmkms, drmkms_pci, intelfbbus, agp_i810
@@ -17,7 +17,8 @

CVS commit: src/sys/external/bsd

2014-03-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 25 15:33:22 UTC 2014

Modified Files:
src/sys/external/bsd/drm/dist/libdrm: xf86drm.c xf86drmMode.c
src/sys/external/bsd/drm/dist/libdrm/nouveau: nouveau_dma.h
src/sys/external/bsd/drm/dist/tests: dristat.c drmstat.c
src/sys/external/bsd/drm2/dist/drm: drm_debugfs.c drm_pci.c
drm_platform.c drm_proc.c
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c
vchiq_proc.c

Log Message:
kill sprintf


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm/dist/libdrm/xf86drm.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm/dist/libdrm/xf86drmMode.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm/dist/libdrm/nouveau/nouveau_dma.h
cvs rdiff -u -r1.1.1.2 -r1.2 src/sys/external/bsd/drm/dist/tests/dristat.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/external/bsd/drm/dist/tests/drmstat.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/external/bsd/drm2/dist/drm/drm_debugfs.c \
src/sys/external/bsd/drm2/dist/drm/drm_pci.c \
src/sys/external/bsd/drm2/dist/drm/drm_platform.c \
src/sys/external/bsd/drm2/dist/drm/drm_proc.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_proc.c

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/drm/dist/libdrm/xf86drm.c
diff -u src/sys/external/bsd/drm/dist/libdrm/xf86drm.c:1.2 src/sys/external/bsd/drm/dist/libdrm/xf86drm.c:1.3
--- src/sys/external/bsd/drm/dist/libdrm/xf86drm.c:1.2	Fri Jun 19 21:07:10 2009
+++ src/sys/external/bsd/drm/dist/libdrm/xf86drm.c	Tue Mar 25 11:33:22 2014
@@ -292,7 +292,8 @@ static int drmOpenDevice(long dev, int m
 uid_t   user= DRM_DEV_UID;
 gid_t   group   = DRM_DEV_GID, serv_group;
 
-sprintf(buf, type ? DRM_DEV_NAME : DRM_CONTROL_DEV_NAME, DRM_DIR_NAME, minor);
+snprintf(buf, sizeof(buf), type ? DRM_DEV_NAME : DRM_CONTROL_DEV_NAME,
+	DRM_DIR_NAME, minor);
 drmMsg("drmOpenDevice: node name is %s\n", buf);
 
 if (drm_server_info) {
@@ -399,7 +400,8 @@ static int drmOpenMinor(int minor, int c
 if (create)
 	return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type);
 
-sprintf(buf, type ? DRM_DEV_NAME : DRM_CONTROL_DEV_NAME, DRM_DIR_NAME, minor);
+snprintf(buf, sizeof(buf), type ? DRM_DEV_NAME : DRM_CONTROL_DEV_NAME,
+	DRM_DIR_NAME, minor);
 if ((fd = open(buf, O_RDWR, 0)) >= 0)
 	return fd;
 return -errno;
@@ -553,7 +555,7 @@ static int drmOpenByName(const char *nam
 	char *driver, *pt, *devstring;
 	int  retcode;
 	
-	sprintf(proc_name, "/proc/dri/%d/name", i);
+	snprintf(proc_name, sizeof(proc_name), "/proc/dri/%d/name", i);
 	if ((fd = open(proc_name, 0, 0)) >= 0) {
 	retcode = read(fd, buf, sizeof(buf)-1);
 	close(fd);

Index: src/sys/external/bsd/drm/dist/libdrm/xf86drmMode.c
diff -u src/sys/external/bsd/drm/dist/libdrm/xf86drmMode.c:1.1.1.1 src/sys/external/bsd/drm/dist/libdrm/xf86drmMode.c:1.2
--- src/sys/external/bsd/drm/dist/libdrm/xf86drmMode.c:1.1.1.1	Thu Jun 18 23:22:23 2009
+++ src/sys/external/bsd/drm/dist/libdrm/xf86drmMode.c	Tue Mar 25 11:33:22 2014
@@ -585,7 +585,8 @@ int drmCheckModesettingSupported(const c
 	if (ret != 4)
 		return -EINVAL;
 
-	sprintf(pci_dev_dir, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/drm",
+	snprintf(pci_dev_dir, sizeof(pci_dev_dir),
+		"/sys/bus/pci/devices/%04x:%02x:%02x.%d/drm",
 		domain, bus, dev, func);
 
 	sysdir = opendir(pci_dev_dir);
@@ -604,7 +605,8 @@ int drmCheckModesettingSupported(const c
 			return 0;
 	}
 
-	sprintf(pci_dev_dir, "/sys/bus/pci/devices/%04x:%02x:%02x.%d/",
+	snprintf(pci_dev_dir, sizeof(pci_dev_dir),
+		"/sys/bus/pci/devices/%04x:%02x:%02x.%d/",
 		domain, bus, dev, func);
 
 	sysdir = opendir(pci_dev_dir);

Index: src/sys/external/bsd/drm/dist/libdrm/nouveau/nouveau_dma.h
diff -u src/sys/external/bsd/drm/dist/libdrm/nouveau/nouveau_dma.h:1.1.1.1 src/sys/external/bsd/drm/dist/libdrm/nouveau/nouveau_dma.h:1.2
--- src/sys/external/bsd/drm/dist/libdrm/nouveau/nouveau_dma.h:1.1.1.1	Thu Jun 18 23:22:24 2009
+++ src/sys/external/bsd/drm/dist/libdrm/nouveau/nouveau_dma.h	Tue Mar 25 11:33:22 2014
@@ -136,7 +136,7 @@ nouveau_dma_begin(struct nouveau_channel
 		   dma->push_free, faulty);
 		return;
 	}
-	sprintf(faulty,"%s:%d",file,line);
+	snprintf(faulty, sizeof(faulty), "%s:%d", file, line);
 #endif
 
 	nouveau_dma_space(chan, (size + 1));

Index: src/sys/external/bsd/drm/dist/tests/dristat.c
diff -u src/sys/external/bsd/drm/dist/tests/dristat.c:1.1.1.2 src/sys/external/bsd/drm/dist/tests/dristat.c:1.2
--- src/sys/external/bsd/drm/dist/tests/dristat.c:1.1.1.2	Thu Jun 18 23:22:25 2009
+++ src/sys/external/bsd/drm/dist/tests/dristat.c	Tue Mar 25 11:33:22 2014
@@ -130,7 +130,7 @@ stati

CVS commit: src/sys/external/bsd

2014-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 29 19:54:46 UTC 2014

Modified Files:
src/sys/external/bsd/drm/dist/bsd-core: drm_irq.c
src/sys/external/bsd/drm2/pci: drm_pci.c

Log Message:
fix pci_intr_string


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/pci/drm_pci.c

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/drm/dist/bsd-core/drm_irq.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.14 src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.15
--- src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c:1.14	Sat Mar  5 16:43:38 2011
+++ src/sys/external/bsd/drm/dist/bsd-core/drm_irq.c	Sat Mar 29 15:54:46 2014
@@ -186,6 +186,7 @@ int drm_irq_install(struct drm_device *d
 #ifdef __NetBSD__
 	pci_intr_handle_t ih;
 	const char *istr;
+	char intrbuf[PCI_INTRSTR_LEN];
 #endif
 
 	if (dev->irq == 0 || dev->dev_private == NULL)
@@ -224,7 +225,7 @@ int drm_irq_install(struct drm_device *d
 		retcode = ENOENT;
 		goto err;
 	}
-	istr = pci_intr_string(dev->pa.pa_pc, ih);
+	istr = pci_intr_string(dev->pa.pa_pc, ih, intrbuf, sizeof(intrbuf));
 	dev->irqh = pci_intr_establish(dev->pa.pa_pc, ih, IPL_TTY,
 	drm_irq_handler_wrap, dev);
 	if (!dev->irqh) {

Index: src/sys/external/bsd/drm2/pci/drm_pci.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci.c:1.2 src/sys/external/bsd/drm2/pci/drm_pci.c:1.3
--- src/sys/external/bsd/drm2/pci/drm_pci.c:1.2	Tue Mar 18 14:20:43 2014
+++ src/sys/external/bsd/drm2/pci/drm_pci.c	Sat Mar 29 15:54:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_pci.c,v 1.2 2014/03/18 18:20:43 riastradh Exp $	*/
+/*	$NetBSD: drm_pci.c,v 1.3 2014/03/29 19:54:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.2 2014/03/18 18:20:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.3 2014/03/29 19:54:46 christos Exp $");
 
 #include 
 #include 
@@ -197,11 +197,12 @@ drm_pci_irq_install(struct drm_device *d
 	pci_intr_handle_t ih;
 	const char *intrstr;
 	void *ih_cookie;
+	char intrbuf[PCI_INTRSTR_LEN];
 
 	if (pci_intr_map(pa, &ih))
 		return -ENOENT;
 
-	intrstr = pci_intr_string(pa->pa_pc, ih);
+	intrstr = pci_intr_string(pa->pa_pc, ih, intrbuf, sizeof(intrbuf));
 	ih_cookie = pci_intr_establish(pa->pa_pc, ih, IPL_DRM, handler, arg);
 	if (ih_cookie == NULL) {
 		aprint_error_dev(dev->dev,



CVS commit: src/sys/external/bsd

2014-04-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  1 15:12:38 UTC 2014

Added Files:
src/sys/external/bsd/common/include/linux: completion.h
Removed Files:
src/sys/external/bsd/drm2/include/linux: completion.h

Log Message:
Move  from drm2 to external/bsd/common.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/linux/completion.h
cvs rdiff -u -r1.3 -r0 src/sys/external/bsd/drm2/include/linux/completion.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/common/include/linux/completion.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/completion.h:1.1
--- /dev/null	Tue Apr  1 15:12:38 2014
+++ src/sys/external/bsd/common/include/linux/completion.h	Tue Apr  1 15:12:38 2014
@@ -0,0 +1,266 @@
+/*	$NetBSD: completion.h,v 1.1 2014/04/01 15:12: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 _LINUX_COMPLETION_H_
+#define _LINUX_COMPLETION_H_
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+struct completion {
+	kmutex_t	c_lock;
+	kcondvar_t	c_cv;
+
+	/*
+	 * c_done is either
+	 *
+	 *   . -1, meaning it's open season and we're done for good and
+	 * nobody need wait any more;
+	 *
+	 *   . 0, meaning nothing is done, so waiters must block; or
+	 *
+	 *   . a positive integer, meaning that many waiters can
+	 * proceed before further waiters must block.
+	 *
+	 * Negative values other than -1 are not allowed.
+	 */
+	int		c_done;
+};
+
+/*
+ * Initialize a new completion object.
+ */
+static inline void
+init_completion(struct completion *completion)
+{
+
+	mutex_init(&completion->c_lock, MUTEX_DEFAULT, IPL_NONE);
+	cv_init(&completion->c_cv, "lnxcmplt");
+	completion->c_done = 0;
+}
+
+/*
+ * Destroy a completion object.
+ */
+static inline void
+destroy_completion(struct completion *completion)
+{
+	KASSERT(!cv_has_waiters(&completion->c_cv));
+	cv_destroy(&completion->c_cv);
+	mutex_destroy(&completion->c_lock);
+}
+
+/*
+ * Notify one waiter of completion, but not any future ones.
+ */
+static inline void
+complete(struct completion *completion)
+{
+
+	mutex_enter(&completion->c_lock);
+
+	/* If it's not open season, wake one waiter.  */
+	if (completion->c_done >= 0) {
+		KASSERT(completion->c_done < INT_MAX); /* XXX check */
+		completion->c_done++;
+		cv_signal(&completion->c_cv);
+	} else {
+		KASSERT(completion->c_done == -1);
+	}
+
+	mutex_exit(&completion->c_lock);
+}
+
+/*
+ * Notify all waiters, present and future (until INIT_COMPLETION), of
+ * completion.
+ */
+static inline void
+complete_all(struct completion *completion)
+{
+
+	mutex_enter(&completion->c_lock);
+
+	/* If it's not open season, make it open season and wake everyone.  */
+	if (completion->c_done >= 0) {
+		completion->c_done = -1;
+		cv_broadcast(&completion->c_cv);
+	} else {
+		KASSERT(completion->c_done == -1);
+	}
+
+	mutex_exit(&completion->c_lock);
+}
+
+/*
+ * Reverse the effect of complete_all so that subsequent waiters block
+ * until someone calls complete or complete_all.
+ *
+ * This operation is very different from its lowercase counterpart.
+ *
+ * For some reason this works on the completion object itself, not on a
+ * pointer thereto, so it must be a macro.
+ */
+#define	INIT_COMPLETION(COMPLETION)	INIT_COMPLETION_blorp(&(COMPLETION))
+
+static inline void
+INIT_COMPLETION_blorp(struct completion *completion)
+{
+
+	mut

CVS commit: src/sys/external/bsd

2014-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr  7 11:55:29 UTC 2014

Added Files:
src/sys/external/bsd/common/include/linux: errno.h
Removed Files:
src/sys/external/bsd/drm2/include/linux: errno.h

Log Message:
Move  from drm2 to common.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/linux/errno.h
cvs rdiff -u -r1.2 -r0 src/sys/external/bsd/drm2/include/linux/errno.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/common/include/linux/errno.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/errno.h:1.1
--- /dev/null	Mon Apr  7 11:55:29 2014
+++ src/sys/external/bsd/common/include/linux/errno.h	Mon Apr  7 11:55:29 2014
@@ -0,0 +1,39 @@
+/*	$NetBSD: errno.h,v 1.1 2014/04/07 11:55:29 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 _LINUX_ERRNO_H_
+#define _LINUX_ERRNO_H_
+
+#include 
+
+#define	ERESTARTSYS	ERESTART
+
+#endif  /* _LINUX_ERRNO_H_ */



CVS commit: src/sys/external/bsd

2017-09-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Sep 11 05:20:17 UTC 2017

Added Files:
src/sys/external/bsd/common/include/asm: barrier.h
Removed Files:
src/sys/external/bsd/drm2/include/asm: barrier.h

Log Message:
Move barrier to common so it can be shared with vchiq


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/asm/barrier.h
cvs rdiff -u -r1.2 -r0 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/common/include/asm/barrier.h
diff -u /dev/null src/sys/external/bsd/common/include/asm/barrier.h:1.1
--- /dev/null	Mon Sep 11 05:20:17 2017
+++ src/sys/external/bsd/common/include/asm/barrier.h	Mon Sep 11 05:20:17 2017
@@ -0,0 +1,63 @@
+/*	$NetBSD: barrier.h,v 1.1 2017/09/11 05:20:17 maya 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 
+
+#ifdef _KERNEL_OPT
+#include "opt_multiprocessor.h"
+#endif
+
+#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_ */



CVS commit: src/sys/external/bsd

2017-09-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Sep 11 07:33:45 UTC 2017

Modified Files:
src/sys/external/bsd/common/include/asm: barrier.h
src/sys/external/bsd/vchiq/dist/interface/compat: vchi_bsd.h

Log Message:
keep dsb in vchiq code.

dsb refers to an arm instruction, so it won't be used on MI code.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/common/include/asm/barrier.h
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.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/common/include/asm/barrier.h
diff -u src/sys/external/bsd/common/include/asm/barrier.h:1.2 src/sys/external/bsd/common/include/asm/barrier.h:1.3
--- src/sys/external/bsd/common/include/asm/barrier.h:1.2	Mon Sep 11 05:22:10 2017
+++ src/sys/external/bsd/common/include/asm/barrier.h	Mon Sep 11 07:33:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: barrier.h,v 1.2 2017/09/11 05:22:10 maya Exp $	*/
+/*	$NetBSD: barrier.h,v 1.3 2017/09/11 07:33:45 maya Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,7 +41,6 @@
 #define	mb	membar_sync
 #define	wmb	membar_producer
 #define	rmb	membar_consumer
-#define	dsb	membar_producer
 
 #ifdef __alpha__		/* XXX As if...  */
 #  define	read_barrier_depends	membar_sync

Index: src/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h
diff -u src/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h:1.12 src/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h:1.13
--- src/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h:1.12	Mon Sep 11 05:25:53 2017
+++ src/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h	Mon Sep 11 07:33:45 2017
@@ -328,6 +328,8 @@ typedef	off_t	loff_t;
 #define BCM2835_MBOX_CHAN_VCHIQ	3
 #define bcm_mbox_write	bcmmbox_write
 
+#define dsb	membar_producer
+
 #define device_print_prettyname(dev)	device_printf((dev), "")
 
 #endif /* __VCHI_NETBSD_H__ */



CVS commit: src/sys/external/bsd

2019-12-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Dec  5 20:03:09 UTC 2019

Modified Files:
src/sys/external/bsd/common/include/linux: bitops.h
src/sys/external/bsd/drm2/dist/drm/i915: i915_cmd_parser.c i915_dma.c
i915_drv.c i915_drv.h i915_gem_context.c i915_gem_execbuffer.c
i915_gem_gtt.c i915_gem_gtt.h i915_reg.h intel_display.c
intel_drv.h intel_pm.c intel_ringbuffer.c intel_ringbuffer.h

Log Message:
Add what appears to be the fixes to CVE-2019-0154, CVE-2019-0155.
This commit requires review, but I'd also like it to be tested by others
while it is being reviewed.

CVE-2019-0155:
It was discovered that the Intel i915 graphics chipsets allowed userspace
to modify page table entries via writes to MMIO from the Blitter Command
Streamer and expose kernel memory information. A local attacker could use
this to expose sensitive information or possibly elevate privileges.

CVE-2019-0154:
It was discovered that the Intel i915 graphics chipsets could cause
a system hang when userspace performed a read from GT memory mapped
input output (MMIO) when the product is in certain low power states.
A local attacker could use this to cause a denial of service.

>From upstream commits to linux-4.4.y:

---
>From 6d0cfddc7afc715835f0e17827106f832b14dd2a Mon Sep 17 00:00:00 2001
From: Jon Bloomfield 
Date: Thu, 12 Jul 2018 19:53:10 +0100
Subject: [PATCH] drm/i915/gtt: Add read only pages to gen8_pte_encode

We can set a bit inside the ppGTT PTE to indicate a page is read-only;
writes from the GPU will be discarded. We can use this to protect pages
and in particular support read-only userptr mappings (necessary for
importing PROT_READ vma).
---
>From 774b68aa2105c70b40c3b1777feb7ab500d716dd Mon Sep 17 00:00:00 2001
From: Jon Bloomfield 
Date: Mon, 6 Aug 2018 14:10:48 -0700
Subject: [PATCH] drm/i915/gtt: Read-only pages for insert_entries on bdw+

Hook up the flags to allow read-only ppGTT mappings for gen8+

v2: Include a selftest to check that writes to a readonly PTE are
dropped
v3: Don't duplicate cpu_check() as we can just reuse it, and even worse
don't wholesale copy the theory-of-operation comment from igt_ctx_exec
without changing it to explain the intention behind the new test!
v4: Joonas really likes magic mystery values
---
>From 3fd1c2e65c60c1c513155e1d1d74138b141aa8a3 Mon Sep 17 00:00:00 2001
From: Chris Wilson 
Date: Thu, 12 Jul 2018 19:53:12 +0100
Subject: [PATCH] drm/i915/gtt: Disable read-only support under GVT

GVT is not propagating the PTE bits, and is always setting the
read-write bit, thus breaking read-only support.
---
>From e5e3c0154c19f2d8213e0af88b7a10d9de7fbafd Mon Sep 17 00:00:00 2001
From: Jon Bloomfield 
Date: Fri, 20 Apr 2018 14:26:01 -0700
Subject: [PATCH] drm/i915: Rename gen7 cmdparser tables

We're about to introduce some new tables for later gens, and the
current naming for the gen7 tables will no longer make sense.

v2: rebase
---
>From 3122671a5df3ee13f5cf22b7bdacf422b7b4319a Mon Sep 17 00:00:00 2001
From: Jon Bloomfield 
Date: Fri, 8 Jun 2018 08:53:46 -0700
Subject: [PATCH] drm/i915: Disable Secure Batches for gen6+

Retroactively stop reporting support for secure batches
through the api for gen6+ so that older binaries trigger
the fallback path instead.

Older binaries use secure batches pre gen6 to access resources
that are not available to normal usermode processes. However,
all known userspace explicitly checks for HAS_SECURE_BATCHES
before relying on the secure batch feature.

Since there are no known binaries relying on this for newer gens
we can kill secure batches from gen6, via I915_PARAM_HAS_SECURE_BATCHES.

v2: rebase (Mika)
v3: rebase (Mika)
---
>From 544fd7d9d4cfe32357beab2f1dc543637d42e69f Mon Sep 17 00:00:00 2001
From: Jon Bloomfield 
Date: Fri, 8 Jun 2018 10:05:26 -0700
Subject: [PATCH] drm/i915: Remove Master tables from cmdparser

The previous patch has killed support for secure batches
on gen6+, and hence the cmdparsers master tables are
now dead code. Remove them.
---
>From 17e89f38212d8b3cba470efca91b997ac03c592c Mon Sep 17 00:00:00 2001
From: Jon Bloomfield 
Date: Wed, 1 Aug 2018 09:33:59 -0700
Subject: [PATCH] drm/i915: Add support for mandatory cmdparsing

The existing cmdparser for gen7 can be bypassed by specifying
batch_len=0 in the execbuf call. This is safe because bypassing
simply reduces the cmd-set available.

In a later patch we will introduce cmdparsing for gen9, as a
security measure, which must be strictly enforced since without
it we are vulnerable to DoS attacks.

Introduce the concept of 'required' cmd parsing that cannot be
bypassed by submitting zero-length bb's.

v2: rebase (Mika)
v2: rebase (Mika)
v3: fix conflict on engine flags (Mika)
---
>From 77524398bccea3592a25cbe92a9a54fa555013af Mon Sep 17 00:00:00 2001
From: Jon Bloomfield 
Date: Tue, 22 May 2018 1

CVS commit: src/sys/external/bsd

2018-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 06:06:10 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
Added Files:
src/sys/external/bsd/common/include/linux: printk.h
Removed Files:
src/sys/external/bsd/drm2/include/linux: printk.h

Log Message:
move printk to common so we can reasonably include it from kernel.h
(linux side-loads the same)

Author: coypu 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/linux/printk.h
cvs rdiff -u -r1.4 -r0 src/sys/external/bsd/drm2/include/linux/printk.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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.9 src/sys/external/bsd/common/include/linux/kernel.h:1.10
--- src/sys/external/bsd/common/include/linux/kernel.h:1.9	Mon Aug  6 00:30:33 2018
+++ src/sys/external/bsd/common/include/linux/kernel.h	Mon Aug 27 06:06:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.9 2018/08/06 00:30:33 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.10 2018/08/27 06:06:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@
 #include 
 
 #include 
+#include 
 
 #define	oops_in_progress	(panicstr != NULL)
 

Added files:

Index: src/sys/external/bsd/common/include/linux/printk.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/printk.h:1.1
--- /dev/null	Mon Aug 27 06:06:10 2018
+++ src/sys/external/bsd/common/include/linux/printk.h	Mon Aug 27 06:06:10 2018
@@ -0,0 +1,130 @@
+/*	$NetBSD: printk.h,v 1.1 2018/08/27 06:06:10 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 _LINUX_PRINTK_H_
+#define _LINUX_PRINTK_H_
+
+#include 
+#include 
+
+#define	printk		printf
+#define	vprintk		vprintf
+#define	printk_once	printf
+#define	pr_err		printf	/* XXX */
+#define	pr_cont		printf	/* XXX */
+#define	pr_info		printf	/* XXX */
+#define	pr_info_once	printf	/* XXX */
+#define	pr_warn_once	printf	/* XXX */
+#define	KERN_DEBUG	"drm kern debug: "
+#define	KERN_INFO	"drm kern info: "
+#define	KERN_WARNING	"drm kern warning: "
+#define	KERN_ERR	"drm kern error: "
+#define	KERN_CRIT	"drm kern crit: "
+#define	KERN_CONT	""
+
+#define	DUMP_PREFIX_NONE	0
+#define	DUMP_PREFIX_OFFSET	1
+#define	DUMP_PREFIX_ADDRESS	2
+
+static inline void
+hex_dump_to_buffer(const void *buf, size_t buf_size, int bytes_per_line,
+int bytes_per_group, char *output, size_t output_size, bool ascii __unused)
+{
+	const uint8_t *bytes = buf;
+	size_t i = 0, n;
+
+	KASSERT(output_size >= 1);
+	KASSERT((bytes_per_line == 16) || (bytes_per_line == 32));
+	KASSERT(powerof2(bytes_per_group));
+	KASSERT(0 < bytes_per_group);
+	KASSERT(bytes_per_group <= 8);
+
+	output[output_size - 1] = '\0';
+	while (i < buf_size) {
+		n = snprintf(output, output_size, "%02x", bytes[i++]);
+		if (n >= output_size)
+			break;
+		output += n; output_size -= n;
+		if ((i == buf_size) || (0 == (i % bytes_per_line)))
+			n = snprintf(output, output_size, "\n");
+		else if ((0 < i) && (0 == (i % bytes_per_group)))
+			n = snprintf(output, output_size, " ");
+		else
+			n = 0;
+		if (n >= output_size)
+			break;
+		output += n; output_size -= n;
+	}
+}
+
+static inline void
+print_hex_dump(const char *level, cons

CVS commit: src/sys/external/bsd

2018-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 06:07:20 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
src/sys/external/bsd/drm2/include/linux: pm.h

Log Message:
more declarations of things we need.

more power management ops.

Author: coypu 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/pm.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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.10 src/sys/external/bsd/common/include/linux/kernel.h:1.11
--- src/sys/external/bsd/common/include/linux/kernel.h:1.10	Mon Aug 27 06:06:10 2018
+++ src/sys/external/bsd/common/include/linux/kernel.h	Mon Aug 27 06:07:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.10 2018/08/27 06:06:10 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.11 2018/08/27 06:07:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -43,6 +43,7 @@
 #define	oops_in_progress	(panicstr != NULL)
 
 #define	IS_ENABLED(option)	(option)
+#define	IS_BUILTIN(option)	(1) /* Probably... */
 
 #define	__printf	__printflike
 #define	__user

Index: src/sys/external/bsd/drm2/include/linux/pm.h
diff -u src/sys/external/bsd/drm2/include/linux/pm.h:1.4 src/sys/external/bsd/drm2/include/linux/pm.h:1.5
--- src/sys/external/bsd/drm2/include/linux/pm.h:1.4	Thu Mar  5 17:35:56 2015
+++ src/sys/external/bsd/drm2/include/linux/pm.h	Mon Aug 27 06:07:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm.h,v 1.4 2015/03/05 17:35:56 riastradh Exp $	*/
+/*	$NetBSD: pm.h,v 1.5 2018/08/27 06:07:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,6 +40,7 @@ typedef struct {
 
 #define	PM_EVENT_PRETHAW		0
 #define	PM_EVENT_SUSPEND		1
+#define	PM_EVENT_FREEZE			2
 
 struct dev_pm_domain {
 	char dummy;		/* XXX */
@@ -47,6 +48,19 @@ struct dev_pm_domain {
 
 struct dev_pm_ops {
 	int	(*resume)(struct device *);
+	int	(*resume_early)(struct device *);
+	int	(*suspend)(struct device *);
+	int	(*suspend_late)(struct device *);
+	int	(*freeze)(struct device *);
+	int	(*freeze_late)(struct device *);
+	int	(*thaw_early)(struct device *);
+	int	(*thaw)(struct device *);
+	int	(*poweroff)(struct device *);
+	int	(*poweroff_late)(struct device *);
+	int	(*restore_early)(struct device *);
+	int	(*restore)(struct device *);
+	int	(*runtime_suspend)(struct device *);
+	int	(*runtime_resume)(struct device *);
 };
 
 #endif  /* _LINUX_PM_H_ */



CVS commit: src/sys/external/bsd

2018-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 06:08:25 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
src/sys/external/bsd/drm2/dist/drm/i915: i915_gem_gtt.c i915_gem_gtt.h
i915_gem_stolen.c i915_gpu_error.c
src/sys/external/bsd/drm2/include/linux: hashtable.h

Log Message:
some more definitions necessary

ifdef out all the i915 gtt virtual memory stuff that errors,
unless it looks exactly like the old code and then merge the
netbsd ifdefs for it.

we don't want to use their ALIGN(, which has more arguments,
use the old alt function.
merge in the old intel_acpi.c code.
don't duplicate DECLARE_BITMAP

Author: coypu 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.h
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/hashtable.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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.11 src/sys/external/bsd/common/include/linux/kernel.h:1.12
--- src/sys/external/bsd/common/include/linux/kernel.h:1.11	Mon Aug 27 06:07:20 2018
+++ src/sys/external/bsd/common/include/linux/kernel.h	Mon Aug 27 06:08:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.11 2018/08/27 06:07:20 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.12 2018/08/27 06:08:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,6 +40,10 @@
 #include 
 #include 
 
+#define U16_MAX UINT16_MAX
+#define U32_MAX UINT32_MAX
+#define U64_MAX UINT64_MAX
+
 #define	oops_in_progress	(panicstr != NULL)
 
 #define	IS_ENABLED(option)	(option)

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c:1.5	Mon Aug 27 04:58:23 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c	Mon Aug 27 06:08:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.5 2018/08/27 04:58:23 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.6 2018/08/27 06:08:25 riastradh Exp $	*/
 
 /*
  * Copyright © 2010 Daniel Vetter
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.5 2018/08/27 04:58:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.6 2018/08/27 06:08:25 riastradh Exp $");
 
 #include 
 #include 
@@ -1686,7 +1686,6 @@ static void gen6_write_pde(struct i915_p
 #else
 	writel(pd_entry, ppgtt->pd_addr + pde);
 #endif
-
 }
 
 /* Write all the page tables found in the ppgtt structure to incrementing page
@@ -3321,7 +3320,6 @@ static int gen6_gmch_probe(struct drm_de
 
 static void gen6_gmch_remove(struct i915_address_space *vm)
 {
-
 	struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);
 
 #ifdef __NetBSD__
@@ -3574,6 +3572,9 @@ rotate_pages(dma_addr_t *in, unsigned in
 	 unsigned int width, unsigned int height,
 	 struct sg_table *st, struct scatterlist *sg)
 {
+#ifdef __NetBSD__
+	panic("XXX");
+#else
 	unsigned int column, row;
 	unsigned int src_idx;
 
@@ -3599,12 +3600,16 @@ rotate_pages(dma_addr_t *in, unsigned in
 	}
 
 	return sg;
+#endif
 }
 
 static struct sg_table *
 intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
 			  struct drm_i915_gem_object *obj)
 {
+#ifdef __NetBSD__
+	panic("XXX");
+#else
 	struct intel_rotation_info *rot_info = &ggtt_view->rotation_info;
 	unsigned int size_pages = rot_info->size >> PAGE_SHIFT;
 	unsigned int size_pages_uv;
@@ -3688,12 +3693,16 @@ err_st_alloc:
 		  rot_info->height_pages, size_pages + size_pages_uv,
 		  size_pages);
 	return ERR_PTR(ret);
+#endif
 }
 
 static struct sg_table *
 intel_partial_pages(const struct i915_ggtt_view *view,
 		struct drm_i915_gem_object *obj)
 {
+#ifdef __NetBSD__
+	panic("XXX");
+#else
 	struct sg_table *st;
 	struct scatterlist *sg;
 	struct sg_page_iter obj_sg_iter;
@@ -3729,6 +3738,7 @@ err_sg_alloc:
 	kfree(st);
 err_st_alloc:
 	return ERR_PTR(ret);
+#endif
 }
 
 static int
Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.5	Mon Aug 27 04:58:23 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c	Mon Aug 27 06:08:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i91

CVS commit: src/sys/external/bsd

2018-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 06:15:32 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
Added Files:
src/sys/external/bsd/common/include/linux: bitops.h
Removed Files:
src/sys/external/bsd/drm2/include/linux: bitops.h

Log Message:
move bitops.h so we can include it from kernel.h

match linux side-loading of this header.

Author: coypu 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/linux/bitops.h
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.13 -r0 src/sys/external/bsd/drm2/include/linux/bitops.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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.12 src/sys/external/bsd/common/include/linux/kernel.h:1.13
--- src/sys/external/bsd/common/include/linux/kernel.h:1.12	Mon Aug 27 06:08:25 2018
+++ src/sys/external/bsd/common/include/linux/kernel.h	Mon Aug 27 06:15:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.12 2018/08/27 06:08:25 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.13 2018/08/27 06:15:32 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #define U16_MAX UINT16_MAX

Added files:

Index: src/sys/external/bsd/common/include/linux/bitops.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/bitops.h:1.1
--- /dev/null	Mon Aug 27 06:15:32 2018
+++ src/sys/external/bsd/common/include/linux/bitops.h	Mon Aug 27 06:15:32 2018
@@ -0,0 +1,186 @@
+/*	$NetBSD: bitops.h,v 1.1 2018/08/27 06:15:32 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 _LINUX_BITOPS_H_
+#define _LINUX_BITOPS_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+/*
+ * Linux __ffs/__ffs64 is zero-based; zero input is undefined.  Our
+ * ffs/ffs64 is one-based; zero input yields zero.
+ */
+static inline unsigned long
+__ffs(unsigned long x)
+{
+
+	KASSERT(x != 0);
+	return ffs64(x) - 1;
+}
+
+static inline unsigned long
+__ffs64(uint64_t x)
+{
+
+	KASSERT(x != 0);
+	return ffs64(x) - 1;
+}
+
+static inline unsigned int
+hweight16(uint16_t n)
+{
+	return popcount32(n);
+}
+
+static inline unsigned int
+hweight32(uint32_t n)
+{
+	return popcount32(n);
+}
+
+/*
+ * XXX Don't define BITS_PER_LONG as sizeof(unsigned long)*CHAR_BIT
+ * because that won't work in preprocessor conditionals, where it often
+ * turns up.
+ */
+
+#define	BITS_TO_LONGS(n)		\
+	roundup2((n), (sizeof(unsigned long) * CHAR_BIT))
+
+#define	BIT(n)	((uintmax_t)1 << (n))
+
+static inline int
+test_bit(unsigned int n, const volatile unsigned long *p)
+{
+	const unsigned units = (sizeof(unsigned long) * CHAR_BIT);
+
+	return ((p[n / units] & (1UL << (n % units))) != 0);
+}
+
+static inline void
+__set_bit(unsigned int n, volatile unsigned long *p)
+{
+	const unsigned units = (sizeof(unsigned long) * CHAR_BIT);
+
+	p[n / units] |= (1UL << (n % units));
+}
+
+static inline void
+__clear_bit(unsigned int n, volatile unsigned long *p)
+{
+	const unsigned units = (sizeof(unsigned long) * CHAR_BIT);
+
+	p[n / units] &= ~(1UL << (n % units));
+}
+
+static inline void
+__change_bit(unsigned int n, volatile unsigned long *p)
+{
+	const unsigned units = (si

CVS commit: src/sys/external/bsd

2018-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 06:19:05 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux: printk.h
src/sys/external/bsd/drm2/dist/drm/i915: i915_dma.c
src/sys/external/bsd/drm2/include/linux: async.h atomic.h sched.h

Log Message:
provide pr_notice
avoid needing unregister_oom_notifier
use intel_register_dsm_handler(dev), as older drm does
provide dummy async_schedule
provide atomic_or
match side-loading

Author: coypu 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/common/include/linux/printk.h
cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/async.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/atomic.h \
src/sys/external/bsd/drm2/include/linux/sched.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/common/include/linux/printk.h
diff -u src/sys/external/bsd/common/include/linux/printk.h:1.1 src/sys/external/bsd/common/include/linux/printk.h:1.2
--- src/sys/external/bsd/common/include/linux/printk.h:1.1	Mon Aug 27 06:06:10 2018
+++ src/sys/external/bsd/common/include/linux/printk.h	Mon Aug 27 06:19:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: printk.h,v 1.1 2018/08/27 06:06:10 riastradh Exp $	*/
+/*	$NetBSD: printk.h,v 1.2 2018/08/27 06:19:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -43,6 +43,7 @@
 #define	pr_info		printf	/* XXX */
 #define	pr_info_once	printf	/* XXX */
 #define	pr_warn_once	printf	/* XXX */
+#define	pr_notice	printf	/* XXX */
 #define	KERN_DEBUG	"drm kern debug: "
 #define	KERN_INFO	"drm kern info: "
 #define	KERN_WARNING	"drm kern warning: "

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.19 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.20
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.19	Mon Aug 27 04:58:23 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Mon Aug 27 06:19:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_dma.c,v 1.19 2018/08/27 04:58:23 riastradh Exp $	*/
+/*	$NetBSD: i915_dma.c,v 1.20 2018/08/27 06:19:05 riastradh Exp $	*/
 
 /* i915_dma.c -- DMA support for the I915 -*- linux-c -*-
  */
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_dma.c,v 1.19 2018/08/27 04:58:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_dma.c,v 1.20 2018/08/27 06:19:05 riastradh Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -1145,7 +1145,9 @@ out_power_well:
 	intel_power_domains_fini(dev_priv);
 	drm_vblank_cleanup(dev);
 out_gem_unload:
+#ifndef __NetBSD__
 	WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
+#endif
 	unregister_shrinker(&dev_priv->mm.shrinker);
 	/* XXX i915_gem_unload */
 #ifdef __NetBSD__
@@ -1229,7 +1231,9 @@ int i915_driver_unload(struct drm_device
 
 	i915_teardown_sysfs(dev);
 
+#ifndef __NetBSD__
 	WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
+#endif
 	unregister_shrinker(&dev_priv->mm.shrinker);
 
 	io_mapping_free(dev_priv->gtt.mappable);

Index: src/sys/external/bsd/drm2/include/linux/async.h
diff -u src/sys/external/bsd/drm2/include/linux/async.h:1.2 src/sys/external/bsd/drm2/include/linux/async.h:1.3
--- src/sys/external/bsd/drm2/include/linux/async.h:1.2	Mon Aug 27 06:07:07 2018
+++ src/sys/external/bsd/drm2/include/linux/async.h	Mon Aug 27 06:19:05 2018
@@ -1,8 +1,16 @@
 #ifndef _LINUX_ASYNC_H_
 #define _LINUX_ASYNC_H_
 
+#include  /* panic */
+
 typedef struct async_cookie_t {
 
 } async_cookie_t;
-#endif /* _LINUX_ASYNC_H_ */
 
+static inline void
+async_schedule(void (*func)(void *, async_cookie_t), void *cookie)
+{
+	panic("XXX defer function");
+}
+
+#endif /* _LINUX_ASYNC_H_ */

Index: src/sys/external/bsd/drm2/include/linux/atomic.h
diff -u src/sys/external/bsd/drm2/include/linux/atomic.h:1.7 src/sys/external/bsd/drm2/include/linux/atomic.h:1.8
--- src/sys/external/bsd/drm2/include/linux/atomic.h:1.7	Thu Jul 17 14:30:33 2014
+++ src/sys/external/bsd/drm2/include/linux/atomic.h	Mon Aug 27 06:19:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.h,v 1.7 2014/07/17 14:30:33 riastradh Exp $	*/
+/*	$NetBSD: atomic.h,v 1.8 2018/08/27 06:19:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -108,6 +108,12 @@ atomic_dec_and_test(atomic_t *atomic)
 }
 
 static inline void
+atomic_or(int value, atomic_t *atomic)
+{
+	atomic_or_uint(&atomic->a_u.au_uint, value);
+}
+
+static inline void
 atomic_set_mask(unsigned long mask, atomic_t *atomic)
 {
 	atomic_or_uint(&atomic->a_u.au_uint, mask);
Index: src/sys/external/bsd/drm2/include/linux/sched.h
diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.7 src/sys/external/bsd/drm2/include/linux/sched.h:1.8
--- src/sys/external/bsd

CVS commit: src/sys/external/bsd

2018-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 06:23:19 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux: list.h
src/sys/external/bsd/drm2/include/linux: hashtable.h

Log Message:
Rewrite hashtable.h locally so it might work here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/common/include/linux/list.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/hashtable.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/common/include/linux/list.h
diff -u src/sys/external/bsd/common/include/linux/list.h:1.5 src/sys/external/bsd/common/include/linux/list.h:1.6
--- src/sys/external/bsd/common/include/linux/list.h:1.5	Wed Aug 20 15:26:52 2014
+++ src/sys/external/bsd/common/include/linux/list.h	Mon Aug 27 06:23:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: list.h,v 1.5 2014/08/20 15:26:52 riastradh Exp $	*/
+/*	$NetBSD: list.h,v 1.6 2018/08/27 06:23:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -259,6 +259,25 @@ struct hlist_node {
 	LIST_ENTRY(hlist_node) hln_entry;
 };
 
+/*
+ * XXX This works only because LIST_HEAD_INITIALIZER doesn't actually
+ * use the name.  Really, this is just initialization to a null
+ * pointer.
+ */
+#define	HLIST_HEAD_INIT	LIST_HEAD_INITIALIZER(dummy)
+
+static inline void
+INIT_HLIST_HEAD(struct hlist_head *head)
+{
+	LIST_INIT(head);
+}
+
+static inline bool
+hlist_empty(struct hlist_head *head)
+{
+	return LIST_EMPTY(head);
+}
+
 static inline struct hlist_node *
 hlist_first(struct hlist_head *head)
 {
@@ -306,6 +325,14 @@ hlist_del_init(struct hlist_node *node)
 	(VAR) = hlist_entry(LIST_NEXT(&(VAR)->FIELD, hln_entry),  \
 		typeof(*(VAR)), FIELD))
 
+#define	hlist_for_each_entry_safe(VAR, NEXT, HEAD, FIELD)		  \
+	for ((VAR) = hlist_entry(LIST_FIRST((HEAD)), typeof(*(VAR)), FIELD),  \
+		(NEXT) = (&(VAR)->FIELD == NULL ? NULL :		  \
+		hlist_entry(LIST_NEXT(&(VAR)->FIELD, hln_entry),	  \
+			typeof(*(VAR)), FIELD));			  \
+	 &(VAR)->FIELD != NULL;	  \
+	(VAR) = (NEXT))
+
 /*
  * XXX The nominally RCU-safe APIs below lack dependent read barriers,
  * so they're not actually RCU-safe...on the alpha, anyway.  Someone^TM

Index: src/sys/external/bsd/drm2/include/linux/hashtable.h
diff -u src/sys/external/bsd/drm2/include/linux/hashtable.h:1.3 src/sys/external/bsd/drm2/include/linux/hashtable.h:1.4
--- src/sys/external/bsd/drm2/include/linux/hashtable.h:1.3	Mon Aug 27 06:08:25 2018
+++ src/sys/external/bsd/drm2/include/linux/hashtable.h	Mon Aug 27 06:23:19 2018
@@ -1,61 +1,76 @@
-/*	$OpenBSD$	*/
-/*
- * Copyright (c) 2013, 2014, 2015 Mark Kettenis
- * Copyright (c) 2017 Martin Pieuchot
+/*	$NetBSD: hashtable.h,v 1.4 2018/08/27 06:23:19 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
  *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
  *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * 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
+ * CON

CVS commit: src/sys/external/bsd

2018-08-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 07:02:51 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
src/sys/external/bsd/drm2/include/linux: math64.h

Log Message:
Define DIV_ROUND_CLOSEST_ULL and div_s64.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/math64.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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.16 src/sys/external/bsd/common/include/linux/kernel.h:1.17
--- src/sys/external/bsd/common/include/linux/kernel.h:1.16	Mon Aug 27 06:55:32 2018
+++ src/sys/external/bsd/common/include/linux/kernel.h	Mon Aug 27 07:02:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.16 2018/08/27 06:55:32 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.17 2018/08/27 07:02:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -86,6 +86,8 @@
 	((0 < (N)) ? (((N) + ((D) / 2)) / (D))\
 	: (((N) - ((D) / 2)) / (D)))
 
+#define	DIV_ROUND_CLOSEST_ULL(N, D)	(((N) + (D)/2)/(D))
+
 /*
  * Rounding to what may or may not be powers of two.
  */

Index: src/sys/external/bsd/drm2/include/linux/math64.h
diff -u src/sys/external/bsd/drm2/include/linux/math64.h:1.5 src/sys/external/bsd/drm2/include/linux/math64.h:1.6
--- src/sys/external/bsd/drm2/include/linux/math64.h:1.5	Mon Aug 27 06:51:07 2018
+++ src/sys/external/bsd/drm2/include/linux/math64.h	Mon Aug 27 07:02:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: math64.h,v 1.5 2018/08/27 06:51:07 riastradh Exp $	*/
+/*	$NetBSD: math64.h,v 1.6 2018/08/27 07:02:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -54,6 +54,12 @@ div64_s64(int64_t dividend, int64_t divi
 	return dividend / divisor;
 }
 
+static inline int64_t
+div_s64(int64_t dividend, int32_t divisor)
+{
+	return dividend / divisor;
+}
+
 static inline uint64_t
 div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *rem)
 {



CVS commit: src/sys/external/bsd

2018-08-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 27 15:45:06 UTC 2018

Added Files:
src/sys/external/bsd/common/include/linux: gfp.h slab.h
Removed Files:
src/sys/external/bsd/drm2/include/linux: gfp.h slab.h

Log Message:
gfp.h and slab.h are now used in kernel.h, so move to common.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/linux/gfp.h \
src/sys/external/bsd/common/include/linux/slab.h
cvs rdiff -u -r1.6 -r0 src/sys/external/bsd/drm2/include/linux/gfp.h \
src/sys/external/bsd/drm2/include/linux/slab.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/common/include/linux/gfp.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/gfp.h:1.1
--- /dev/null	Mon Aug 27 15:45:06 2018
+++ src/sys/external/bsd/common/include/linux/gfp.h	Mon Aug 27 15:45:06 2018
@@ -0,0 +1,74 @@
+/*	$NetBSD: gfp.h,v 1.1 2018/08/27 15:45:06 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	_LINUX_GFP_H_
+#define	_LINUX_GFP_H_
+
+/* GFP: `Get Free Page' */
+
+#include 
+#include 
+
+typedef int gfp_t;
+
+#define	GFP_ATOMIC	(__GFP_HIGH)
+#define	GFP_DMA32	(__GFP_DMA32)
+#define	GFP_HIGHUSER	(__GFP_FS | __GFP_HARDWALL | __GFP_HIGHMEM | \
+			__GFP_IO | __GFP_WAIT)
+#define	GFP_KERNEL	(__GFP_FS | __GFP_IO | __GFP_WAIT)
+#define	GFP_TEMPORARY	(__GFP_FS | __GFP_IO | __GFP_RECLAIMABLE | __GFP_WAIT)
+#define	GFP_USER	(__GFP_FS | __GFP_HARDWALL | __GFP_IO | __GFP_WAIT)
+
+#define	GFP_NOWAIT	(GFP_ATOMIC & ~__GFP_HIGH)
+
+#define	__GFP_COMP		__BIT(0)
+#define	__GFP_DMA32		__BIT(1)
+#define	__GFP_FS		__BIT(2)
+#define	__GFP_HARDWALL		__BIT(3)
+#define	__GFP_HIGH		__BIT(4)
+#define	__GFP_HIGHMEM		__BIT(5)
+#define	__GFP_IO		__BIT(6)
+#define	__GFP_NORETRY		__BIT(7)
+#define	__GFP_NOWARN		__BIT(8)
+#define	__GFP_NO_KSWAPD		__BIT(9)
+#define	__GFP_RECLAIMABLE	__BIT(10)
+#define	__GFP_WAIT		__BIT(11)
+#define	__GFP_ZERO		__BIT(12)
+
+/*
+ * XXX Linux sez nobody should be using this in new code.  We never
+ * fail in the wait case anyway, so the point is moot.
+ */
+#define	__GFP_NOFAIL		0
+
+struct page;
+
+#endif	/* _LINUX_GFP_H_ */
Index: src/sys/external/bsd/common/include/linux/slab.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/slab.h:1.1
--- /dev/null	Mon Aug 27 15:45:06 2018
+++ src/sys/external/bsd/common/include/linux/slab.h	Mon Aug 27 15:45:06 2018
@@ -0,0 +1,209 @@
+/*	$NetBSD: slab.h,v 1.1 2018/08/27 15:45:06 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 AN

CVS commit: src/sys/external/bsd

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:38:36 UTC 2020

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
src/sys/external/bsd/drm2/dist/drm: drm_modes.c

Log Message:
Implement (obsolete) simple_strtol stub; reduce diff.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/drm_modes.c

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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.23 src/sys/external/bsd/common/include/linux/kernel.h:1.24
--- src/sys/external/bsd/common/include/linux/kernel.h:1.23	Mon Sep 30 12:20:54 2019
+++ src/sys/external/bsd/common/include/linux/kernel.h	Fri Feb 14 04:38:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.23 2019/09/30 12:20:54 christos Exp $	*/
+/*	$NetBSD: kernel.h,v 1.24 2020/02/14 04:38:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -196,6 +196,18 @@ kstrtol(const char *s, unsigned base, lo
 	return 0;
 }
 
+static inline long
+simple_strtol(const char *s, char **endp, unsigned base)
+{
+	long v;
+
+	*endp = NULL;		/* paranoia */
+	v = strtoll(s, endp, base);
+	if (v < LONG_MIN || LONG_MAX < v)
+		return 0;
+	return v;
+}
+
 static __inline char * __printflike(2, 0)
 kvasprintf(gfp_t gfp, const char *fmt, va_list va)
 {

Index: src/sys/external/bsd/drm2/dist/drm/drm_modes.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.7 src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.7	Mon Aug 27 04:58:19 2018
+++ src/sys/external/bsd/drm2/dist/drm/drm_modes.c	Fri Feb 14 04:38:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_modes.c,v 1.7 2018/08/27 04:58:19 riastradh Exp $	*/
+/*	$NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $	*/
 
 /*
  * Copyright © 1997-2003 by The XFree86 Project, Inc.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.7 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $");
 
 #include 
 #include 
@@ -1236,7 +1236,7 @@ bool drm_mode_parse_command_line_for_con
 	const char *name;
 	unsigned int namelen;
 	bool res_specified = false, bpp_specified = false, refresh_specified = false;
-	long xres = 0, yres = 0, bpp = 32, refresh = 0;
+	unsigned int xres = 0, yres = 0, bpp = 32, refresh = 0;
 	bool yres_specified = false, cvt = false, rb = false;
 	bool interlace = false, margins = false, was_digit = false;
 	int i;
@@ -1261,35 +1261,26 @@ bool drm_mode_parse_command_line_for_con
 		case '@':
 			if (!refresh_specified && !bpp_specified &&
 			!yres_specified && !cvt && !rb && was_digit) {
-if (kstrtol(&name[i+1], 10, &refresh) == 0) {
-	refresh_specified = true;
-	was_digit = false;
-} else {
-	goto done;
-}
+refresh = simple_strtol(&name[i+1], NULL, 10);
+refresh_specified = true;
+was_digit = false;
 			} else
 goto done;
 			break;
 		case '-':
 			if (!bpp_specified && !yres_specified && !cvt &&
 			!rb && was_digit) {
-if (kstrtol(&name[i+1], 10, &bpp) == 0) {
-	bpp_specified = true;
-	was_digit = false;
-} else {
-	goto done;
-}
+bpp = simple_strtol(&name[i+1], NULL, 10);
+bpp_specified = true;
+was_digit = false;
 			} else
 goto done;
 			break;
 		case 'x':
 			if (!yres_specified && was_digit) {
-if (kstrtol(&name[i+1], 10, &yres) == 0) {
-	yres_specified = true;
-	was_digit = false;
-} else {
-	goto done;
-}
+yres = simple_strtol(&name[i+1], NULL, 10);
+yres_specified = true;
+was_digit = false;
 			} else
 goto done;
 			break;
@@ -1347,8 +1338,8 @@ bool drm_mode_parse_command_line_for_con
 	}
 
 	if (i < 0 && yres_specified) {
-		char *ch = NULL;
-		xres = strtoll(name, &ch, 10);
+		char *ch;
+		xres = simple_strtol(name, &ch, 10);
 		if ((ch != NULL) && (*ch == 'x'))
 			res_specified = true;
 		else



CVS commit: src/sys/external/bsd

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:38:48 UTC 2020

Modified Files:
src/sys/external/bsd/common/include/linux: list.h
src/sys/external/bsd/drm2/dist/drm: drm_edid.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_drm.c nouveau_gem.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/timer:
nouveau_nvkm_subdev_timer_base.c
src/sys/external/bsd/drm2/include/linux: nbsd-namespace.h

Log Message:
Add LIST_HEAD to  too.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/common/include/linux/list.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/drm_edid.c
cvs rdiff -u -r1.18 -r1.19 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/timer/nouveau_nvkm_subdev_timer_base.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/include/linux/nbsd-namespace.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/common/include/linux/list.h
diff -u src/sys/external/bsd/common/include/linux/list.h:1.18 src/sys/external/bsd/common/include/linux/list.h:1.19
--- src/sys/external/bsd/common/include/linux/list.h:1.18	Mon Aug 27 13:56:58 2018
+++ src/sys/external/bsd/common/include/linux/list.h	Fri Feb 14 04:38:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: list.h,v 1.18 2018/08/27 13:56:58 riastradh Exp $	*/
+/*	$NetBSD: list.h,v 1.19 2020/02/14 04:38:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -61,6 +61,8 @@ struct list_head {
 
 #define	LIST_HEAD_INIT(name)	{ .prev = &(name), .next = &(name) }
 
+#define	LINUX_LIST_HEAD(name)	struct list_head name = LIST_HEAD_INIT(name)
+
 static inline void
 INIT_LIST_HEAD(struct list_head *head)
 {

Index: src/sys/external/bsd/drm2/dist/drm/drm_edid.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.6 src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.6	Mon Aug 27 04:58:19 2018
+++ src/sys/external/bsd/drm2/dist/drm/drm_edid.c	Fri Feb 14 04:38:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_edid.c,v 1.6 2018/08/27 04:58:19 riastradh Exp $	*/
+/*	$NetBSD: drm_edid.c,v 1.7 2020/02/14 04:38:48 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Luc Verhaegen (quirks list)
@@ -30,7 +30,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v 1.6 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v 1.7 2020/02/14 04:38:48 riastradh Exp $");
 
 #include 
 #include 
@@ -48,6 +48,8 @@ __KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v
 #include 
 #include 
 
+#include 
+
 #define version_greater(edid, maj, min) \
 	(((edid)->version > (maj)) || \
 	 ((edid)->version == (maj) && (edid)->revision > (min)))
@@ -2673,7 +2675,7 @@ add_alternate_cea_modes(struct drm_conne
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *mode, *tmp;
-	struct list_head list = LIST_HEAD_INIT(list);
+	LIST_HEAD(list);
 	int modes = 0;
 
 	/* Don't add CEA modes if the CEA extension block is missing */

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.18 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.19
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.18	Fri Feb 14 04:35:20 2020
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c	Fri Feb 14 04:38:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_drm.c,v 1.18 2020/02/14 04:35:20 riastradh Exp $	*/
+/*	$NetBSD: nouveau_drm.c,v 1.19 2020/02/14 04:38:48 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.18 2020/02/14 04:35:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.19 2020/02/14 04:38:48 riastradh Exp $");
 
 #include 
 #include 
@@ -61,7 +61,11 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_drm.
 #include "nouveau_platform.h"
 #include "nouveau_ttm.h"
 
+#ifdef __NetBSD__
+#include 
+#include 
 #include 
+#endif
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
 char *nouveau_config;
@@ -949,8 +953,6 @@ nouveau_ioctls[] = {
 };
 
 #ifdef __NetBSD__
-#include 
-#include 
 static int			/* XXX expose to ioc32 */
 nouveau_ioctl_override(struct file *fp, unsigned long cmd, void *data)
 {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.9 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.9	Sun Jan 27 02:08:42 2019
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c	Fri Feb 14 04:38:48 2020
@@ -1,4 +1

CVS commit: src/sys/external/bsd

2020-02-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 09:38:51 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_dp_helper.c
Added Files:
src/sys/external/bsd/common/include/asm: div64.h
Removed Files:
src/sys/external/bsd/drm2/include/asm: div64.h

Log Message:
Fix undoing of -Wpointer-arith workaround.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/asm/div64.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c
cvs rdiff -u -r1.1 -r0 src/sys/external/bsd/drm2/include/asm/div64.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/dist/drm/drm_dp_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c:1.10 src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c:1.10	Fri Feb 14 04:35:19 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c	Fri Feb 14 09:38:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_dp_helper.c,v 1.10 2020/02/14 04:35:19 riastradh Exp $	*/
+/*	$NetBSD: drm_dp_helper.c,v 1.11 2020/02/14 09:38:51 riastradh Exp $	*/
 
 /*
  * Copyright © 2009 Keith Packard
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_dp_helper.c,v 1.10 2020/02/14 04:35:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_dp_helper.c,v 1.11 2020/02/14 09:38:51 riastradh Exp $");
 
 #include 
 #include 
@@ -668,7 +668,7 @@ static int drm_dp_i2c_drain_msg(struct d
 		}
 
 		msg.size -= err;
-		msg.buffer = msg.buffer + err;
+		msg.buffer += err;
 	}
 
 	return ret;

Added files:

Index: src/sys/external/bsd/common/include/asm/div64.h
diff -u /dev/null src/sys/external/bsd/common/include/asm/div64.h:1.1
--- /dev/null	Fri Feb 14 09:38:52 2020
+++ src/sys/external/bsd/common/include/asm/div64.h	Fri Feb 14 09:38:51 2020
@@ -0,0 +1,49 @@
+/*	$NetBSD: div64.h,v 1.1 2020/02/14 09:38:51 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2014 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_DIV64_H_
+#define _ASM_DIV64_H_
+
+#include 
+
+#define	do_div(n_q, d)	_do_div(&(n_q), (d))
+
+static inline uint32_t
+_do_div(uint64_t *n_q, uint32_t d)
+{
+	const uint32_t r = *n_q % d;
+	const uint32_t q = *n_q / d;
+
+	*n_q = q;
+	return r;
+}
+
+#endif  /* _ASM_DIV64_H_ */



CVS commit: src/sys/external/bsd

2020-02-14 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Feb 14 14:35:00 UTC 2020

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
src/sys/external/bsd/drm2/dist/drm: drm_agpsupport.c drm_atomic.c
drm_atomic_helper.c drm_bufs.c drm_context.c drm_crtc.c
drm_crtc_helper.c drm_dp_helper.c drm_dp_mst_topology.c drm_drv.c
drm_edid.c drm_fb_helper.c drm_flip_work.c drm_gem.c drm_global.c
drm_irq.c drm_mm.c drm_modeset_lock.c drm_plane_helper.c
drm_probe_helper.c
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_atom.c
amdgpu_atombios.c amdgpu_atombios_crtc.c amdgpu_atombios_dp.c
amdgpu_atombios_encoders.c amdgpu_atombios_i2c.c amdgpu_cgs.c
amdgpu_ci_dpm.c amdgpu_ci_smc.c amdgpu_cik_ih.c amdgpu_cik_sdma.c
amdgpu_cz_dpm.c amdgpu_cz_ih.c amdgpu_cz_smc.c amdgpu_dpm.c
amdgpu_fence.c amdgpu_fiji_dpm.c amdgpu_fiji_smc.c
amdgpu_gfx_v7_0.c amdgpu_gfx_v8_0.c amdgpu_gmc_v7_0.c
amdgpu_gmc_v8_0.c amdgpu_i2c.c amdgpu_iceland_dpm.c
amdgpu_iceland_ih.c amdgpu_iceland_smc.c amdgpu_ih.c
amdgpu_kv_dpm.c amdgpu_object.h amdgpu_ring.c amdgpu_sdma_v2_4.c
amdgpu_sdma_v3_0.c amdgpu_tonga_dpm.c amdgpu_tonga_ih.c
amdgpu_tonga_smc.c amdgpu_ucode.c amdgpu_uvd.c amdgpu_uvd_v4_2.c
amdgpu_uvd_v5_0.c amdgpu_uvd_v6_0.c amdgpu_vce.c amdgpu_vce_v3_0.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_cmd_parser.c i915_drv.c
i915_gem.c i915_gem_context.c i915_gem_execbuffer.c i915_gem_gtt.c
i915_gem_stolen.c i915_gpu_error.c i915_irq.c i915_params.c
intel_csr.c intel_display.c intel_dp.c intel_drv.h intel_fbdev.c
intel_guc_loader.c intel_hdmi.c intel_i2c.c intel_lvds.c
intel_opregion.c intel_overlay.c intel_panel.c intel_pm.c
intel_ringbuffer.c intel_ringbuffer.h intel_sdvo.c intel_uncore.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_bios.h
nouveau_connector.c nouveau_display.c nouveau_fence.c nouveau_gem.c
nouveau_nv50_display.c
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04:
nouveau_dispnv04_disp.c nouveau_dispnv04_tvmodesnv17.c
nouveau_dispnv04_tvnv04.c
src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core: device.h
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp:
nouveau_nvkm_engine_disp_gf119.c nouveau_nvkm_engine_disp_nv50.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/gr:
nouveau_nvkm_engine_gr_gf100.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon.h radeon_bios.c
radeon_cik_sdma.c radeon_device.c radeon_display.c radeon_drv.c
radeon_evergreen.c radeon_i2c.c radeon_r600.c radeon_ring.c
radeon_si_dpm.c
src/sys/external/bsd/drm2/dist/drm/ttm: ttm_bo.c ttm_bo_manager.c
ttm_bo_util.c ttm_execbuf_util.c ttm_memory.c ttm_tt.c
src/sys/external/bsd/drm2/dist/drm/via: via_dma.c via_dmablit.c
src/sys/external/bsd/drm2/dist/include/drm: drmP.h
src/sys/external/bsd/drm2/include/linux: atomic.h fs.h interrupt.h
jiffies.h ktime.h mm_types.h mutex.h pci.h pm_qos.h pm_runtime.h

Log Message:
Reduce diffs by side-loading some header files like Linux.

>From riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/drm_atomic.c \
src/sys/external/bsd/drm2/dist/drm/drm_edid.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c \
src/sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c \
src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c \
src/sys/external/bsd/drm2/dist/drm/drm_drv.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/drm_context.c \
src/sys/external/bsd/drm2/dist/drm/drm_crtc_helper.c \
src/sys/external/bsd/drm2/dist/drm/drm_global.c \
src/sys/external/bsd/drm2/dist/drm/drm_mm.c
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c \
src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c \
src/sys/external/bsd/drm2/dist/drm/drm_irq.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/drm_flip_work.c \
src/sys/external/bsd/drm2/dist/drm/drm_modeset_lock.c \
src/sys/external/bsd/drm2/dist/drm/drm_plane_helper.c \
src/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/dist/drm/drm_gem.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atom.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgp

CVS commit: src/sys/external/bsd

2020-02-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 16 06:50:14 UTC 2020

Added Files:
src/sys/external/bsd/common/include/asm: byteorder.h
Removed Files:
src/sys/external/bsd/drm2/include/asm: byteorder.h

Log Message:
Missed a drm2 -> common move.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/asm/byteorder.h
cvs rdiff -u -r1.3 -r0 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/common/include/asm/byteorder.h
diff -u /dev/null src/sys/external/bsd/common/include/asm/byteorder.h:1.1
--- /dev/null	Sun Feb 16 06:50:14 2020
+++ src/sys/external/bsd/common/include/asm/byteorder.h	Sun Feb 16 06:50:14 2020
@@ -0,0 +1,58 @@
+/*	$NetBSD: byteorder.h,v 1.1 2020/02/16 06:50:14 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
+
+#define	be16_to_cpup	be16dec
+#define	be32_to_cpup	be32dec
+#define	be64_to_cpup	be64dec
+#define	le16_to_cpup	le16dec
+#define	le32_to_cpup	le32dec
+#define	le64_to_cpup	le64dec
+
+#endif	/* _ASM_BYTEORDER_H_ */



CVS commit: src/sys/external/bsd

2020-02-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 16 07:29:48 UTC 2020

Added Files:
src/sys/external/bsd/common/include/linux: log2.h
Removed Files:
src/sys/external/bsd/drm2/include/linux: log2.h

Log Message:
Move another file from drm2 to common for .


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/common/include/linux/log2.h
cvs rdiff -u -r1.5 -r0 src/sys/external/bsd/drm2/include/linux/log2.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/common/include/linux/log2.h
diff -u /dev/null src/sys/external/bsd/common/include/linux/log2.h:1.1
--- /dev/null	Sun Feb 16 07:29:48 2020
+++ src/sys/external/bsd/common/include/linux/log2.h	Sun Feb 16 07:29:48 2020
@@ -0,0 +1,76 @@
+/*	$NetBSD: log2.h,v 1.1 2020/02/16 07:29:48 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 _LINUX_LOG2_H_
+#define _LINUX_LOG2_H_
+
+#include 
+#include 
+
+#include 
+
+static inline bool
+is_power_of_2(unsigned long x)
+{
+	return ((x != 0) && (((x - 1) & x) == 0));
+}
+
+static inline unsigned long
+roundup_pow_of_two(unsigned long n)
+{
+	unsigned i;
+
+	if (n == 0)
+		return 1;
+
+	n -= 1;
+	for (i = 1; i < CHAR_BIT * sizeof n; i <<= 1)
+		n |= (n >> i);
+
+	return (n + 1);
+}
+
+static inline unsigned long
+rounddown_pow_of_two(unsigned long n)
+{
+
+	/* XXX fls64 is not fls_ulong, but it'll do for now.  */
+	return (1UL << (fls64(n) - 1));
+}
+
+static inline unsigned
+order_base_2(unsigned long n)
+{
+
+	return ilog2(roundup_pow_of_two(n));
+}
+
+#endif  /* _LINUX_LOG2_H_ */



CVS commit: src/sys/external/bsd

2019-03-19 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Mar 19 08:17:46 UTC 2019

Modified Files:
src/sys/external/bsd/common/linux: linux_work.c
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
- dwc2 need calling linux_workqueue_init() to avoid panic.
- use INIT_ONCE/FINI_ONCE to linux_workqueue_{init,fini}() for being called 
from dwc2.

TODO: dwc2 should be written as kernel module depenging on a linux module.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/external/bsd/common/linux/linux_work.c
cvs rdiff -u -r1.58 -r1.59 src/sys/external/bsd/dwc2/dwc2.c

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/common/linux/linux_work.c
diff -u src/sys/external/bsd/common/linux/linux_work.c:1.43 src/sys/external/bsd/common/linux/linux_work.c:1.44
--- src/sys/external/bsd/common/linux/linux_work.c:1.43	Mon Aug 27 15:25:43 2018
+++ src/sys/external/bsd/common/linux/linux_work.c	Tue Mar 19 08:17:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.43 2018/08/27 15:25:43 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.44 2019/03/19 08:17:46 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.43 2018/08/27 15:25:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.44 2019/03/19 08:17:46 ryo Exp $");
 
 #include 
 #include 
@@ -41,6 +41,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_work.c
 #include 
 #include 
 #include 
+#ifndef _MODULE
+#include 
+#endif
 #include 
 #include 
 
@@ -130,8 +133,8 @@ atomic_cas_uintptr(volatile uintptr_t *p
  *	Initialize the Linux workqueue subsystem.  Return 0 on success,
  *	NetBSD error on failure.
  */
-int
-linux_workqueue_init(void)
+static int
+linux_workqueue_init0(void)
 {
 	int error;
 
@@ -173,8 +176,8 @@ fail0:	KASSERT(error);
  *
  *	Destroy the Linux workqueue subsystem.  Never fails.
  */
-void
-linux_workqueue_fini(void)
+static void
+linux_workqueue_fini0(void)
 {
 
 	destroy_workqueue(system_power_efficient_wq);
@@ -182,6 +185,30 @@ linux_workqueue_fini(void)
 	destroy_workqueue(system_wq);
 	lwp_specific_key_delete(workqueue_key);
 }
+
+#ifndef _MODULE
+static ONCE_DECL(linux_workqueue_init_once);
+#endif
+
+int
+linux_workqueue_init(void)
+{
+#ifdef _MODULE
+	return linux_workqueue_init0();
+#else
+	return INIT_ONCE(&linux_workqueue_init_once, &linux_workqueue_init0);
+#endif
+}
+
+void
+linux_workqueue_fini(void)
+{
+#ifdef _MODULE
+	return linux_workqueue_fini0();
+#else
+	return FINI_ONCE(&linux_workqueue_init_once, &linux_workqueue_fini0);
+#endif
+}
 
 /*
  * Workqueues

Index: src/sys/external/bsd/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.58 src/sys/external/bsd/dwc2/dwc2.c:1.59
--- src/sys/external/bsd/dwc2/dwc2.c:1.58	Sun Feb 17 04:17:52 2019
+++ src/sys/external/bsd/dwc2/dwc2.c	Tue Mar 19 08:17:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.58 2019/02/17 04:17:52 rin Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.59 2019/03/19 08:17:46 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.58 2019/02/17 04:17:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.59 2019/03/19 08:17:46 ryo Exp $");
 
 #include "opt_usb.h"
 
@@ -1273,6 +1273,10 @@ dwc2_init(struct dwc2_softc *sc)
 {
 	int err = 0;
 
+	err = linux_workqueue_init();
+	if (err)
+		return err;
+
 	sc->sc_bus.ub_hcpriv = sc;
 	sc->sc_bus.ub_revision = USBREV_2_0;
 	sc->sc_bus.ub_methods = &dwc2_bus_methods;



CVS commit: src/sys/external/bsd

2019-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Apr 16 10:00:04 UTC 2019

Modified Files:
src/sys/external/bsd/common/include/linux: err.h errno.h
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_drm.c
nouveau_fence.c
src/sys/external/bsd/drm2/drm: drm_cdevsw.c
src/sys/external/bsd/drm2/include/drm: drm_wait_netbsd.h
src/sys/external/bsd/drm2/linux: linux_fence.c linux_ww_mutex.c

Log Message:
fix various problems i've seen where cv_*wait*() return ERESTART,
which is -3 in netbsd, which we have mapped linux ERESTARTSYS to.

this has a problem because linux code often returns errors and
pointers in the same value, and pointer values between -4095 and
-1 are considered as error returns, but -3 ends up as 3 and thus
is not considered an error, and mayhem ensues.

with this in place my kabylake system seems actually stable, i
have not triggered any of my prior issues in almost 4 weeks now.

Taylor asked me to write up a description and then wrote most of
the text below for me :-)

In Linux code, we always work with ERESTARTSYS so the code meaning
start over is a positive NetBSD errno safe for PTR_ERR/ERR_PTR.
To achieve this:
1. adapt all cv_waits that return to Linux so they map ERESTART to
   ERESTARTSYS, and
2. adapt all returns to userland so they convert ERESTARTSYS to
   ERESTART.
Leave EINTR and all other error codes alone.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/common/include/linux/err.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/common/include/linux/errno.h
cvs rdiff -u -r1.16 -r1.17 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/drm/drm_cdevsw.c
cvs rdiff -u -r1.14 -r1.15 \
src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/linux/linux_fence.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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/common/include/linux/err.h
diff -u src/sys/external/bsd/common/include/linux/err.h:1.2 src/sys/external/bsd/common/include/linux/err.h:1.3
--- src/sys/external/bsd/common/include/linux/err.h:1.2	Mon Aug 27 07:20:25 2018
+++ src/sys/external/bsd/common/include/linux/err.h	Tue Apr 16 10:00:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.h,v 1.2 2018/08/27 07:20:25 riastradh Exp $	*/
+/*	$NetBSD: err.h,v 1.3 2019/04/16 10:00:04 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 #include 
 
-#define	MAX_ERRNO	ELAST
+#define	MAX_ERRNO	4095
 
 static inline bool
 IS_ERR_VALUE(uintptr_t n)

Index: src/sys/external/bsd/common/include/linux/errno.h
diff -u src/sys/external/bsd/common/include/linux/errno.h:1.3 src/sys/external/bsd/common/include/linux/errno.h:1.4
--- src/sys/external/bsd/common/include/linux/errno.h:1.3	Wed Jul 16 20:56:24 2014
+++ src/sys/external/bsd/common/include/linux/errno.h	Tue Apr 16 10:00:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: errno.h,v 1.3 2014/07/16 20:56:24 riastradh Exp $	*/
+/*	$NetBSD: errno.h,v 1.4 2019/04/16 10:00:04 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,10 @@
  * - Linux consistently passes around negative errno values.  NetBSD
  *   consistently passes around positive ones, except the special magic
  *   in-kernel ones (EJUSTRETURN, ERESTART, &c.) which should not be
- *   exposed to userland.  Be careful!
+ *   exposed to userland *or* linux-only code using the negative pointer
+ *   means error return pattern.  Be careful!  If Using ERESTARTSYS from
+ *   Linux code, be sure it is remapped back to ERESTART before NetBSD
+ *   code sees it.
  */
 
 #ifndef _LINUX_ERRNO_H_
@@ -43,7 +46,7 @@
 
 #include 
 
-#define	ERESTARTSYS	ERESTART
+#define	ERESTARTSYS	(ELAST+1)	/* XXX */
 #define	ENOTSUPP	ENOTSUP	/* XXX ???  */
 #define	EREMOTEIO	EIO	/* XXX Urk...  */
 #define	ECHRNG		ERANGE	/* XXX ??? */

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.16 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.17
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.16	Fri Dec 21 07:51:17 2018
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c	Tue Apr 16 10:00:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_drm.c,v 1.16 2018/12/21 07:51:17 maya Exp $	*/
+/*	$NetBSD: nouveau_drm.c,v 1.17 2019/04/16 10:00:04 mrg Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.16 2018/12/21 07:51:17 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.17 2019/04/16 10:00:04 mrg Exp $");
 
 #include 
 #include 
@@ -966,11 +966,12 @@ nou

CVS commit: src/sys/external/bsd/dwc2

2021-01-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan  7 13:25:51 UTC 2021

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
More converstion from usbd_status to int for function error reporting.
This time it's the turn of usb_allocmem.

(missed in previous commit)


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.75 src/sys/external/bsd/dwc2/dwc2.c:1.76
--- src/sys/external/bsd/dwc2/dwc2.c:1.75	Tue Dec 22 01:07:23 2020
+++ src/sys/external/bsd/dwc2/dwc2.c	Thu Jan  7 13:25:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.75 2020/12/22 01:07:23 riastradh Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.76 2021/01/07 13:25:51 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.75 2020/12/22 01:07:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.76 2021/01/07 13:25:51 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -375,7 +375,6 @@ dwc2_open(struct usbd_pipe *pipe)
 	usb_endpoint_descriptor_t *ed = pipe->up_endpoint->ue_edesc;
 	uint8_t addr = dev->ud_addr;
 	uint8_t xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
-	usbd_status err;
 
 	DPRINTF("pipe %p addr %d xfertype %d dir %s\n", pipe, addr, xfertype,
 	UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN ? "in" : "out");
@@ -404,10 +403,10 @@ dwc2_open(struct usbd_pipe *pipe)
 	switch (xfertype) {
 	case UE_CONTROL:
 		pipe->up_methods = &dwc2_device_ctrl_methods;
-		err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t),
+		int err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t),
 		0, USBMALLOC_COHERENT, &dpipe->req_dma);
 		if (err)
-			return err;
+			return USBD_NOMEM;
 		break;
 	case UE_INTERRUPT:
 		pipe->up_methods = &dwc2_device_intr_methods;



CVS commit: src/sys/external/bsd/acpica

2011-02-17 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Feb 17 12:08:15 UTC 2011

Modified Files:
src/sys/external/bsd/acpica/conf: files.acpica
src/sys/external/bsd/acpica/dist/debugger: dbdisply.c
src/sys/external/bsd/acpica/dist/include: acutils.h
src/sys/external/bsd/acpica/dist/utilities: utdebug.c utdecode.c

Log Message:
Fix ACPI_DEBUG build.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/acpica/conf/files.acpica
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/acpica/dist/debugger/dbdisply.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/acpica/dist/include/acutils.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/acpica/dist/utilities/utdebug.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/acpica/dist/utilities/utdecode.c

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/acpica/conf/files.acpica
diff -u src/sys/external/bsd/acpica/conf/files.acpica:1.2 src/sys/external/bsd/acpica/conf/files.acpica:1.3
--- src/sys/external/bsd/acpica/conf/files.acpica:1.2	Thu Feb 17 10:13:35 2011
+++ src/sys/external/bsd/acpica/conf/files.acpica	Thu Feb 17 12:08:14 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.acpica,v 1.2 2011/02/17 10:13:35 jruoho Exp $
+# $NetBSD: files.acpica,v 1.3 2011/02/17 12:08:14 jruoho Exp $
 
 define		acpica
 makeoptions	acpi	CPPFLAGS+="-I$S/external/bsd/acpica/dist/include"
@@ -10,6 +10,8 @@
 file	external/bsd/acpica/dist/debugger/dbfileio.c		acpica & acpi_debug & ddb
 file	external/bsd/acpica/dist/debugger/dbhistry.c		acpica & acpi_debug & ddb
 file	external/bsd/acpica/dist/debugger/dbinput.c		acpica & acpi_debug & ddb
+file	external/bsd/acpica/dist/debugger/dbmethod.c		acpica & acpi_debug & ddb
+file	external/bsd/acpica/dist/debugger/dbnames.c		acpica & acpi_debug & ddb
 file	external/bsd/acpica/dist/debugger/dbstats.c		acpica & acpi_debug & ddb
 file	external/bsd/acpica/dist/debugger/dbutils.c		acpica & acpi_debug & ddb
 file	external/bsd/acpica/dist/debugger/dbxface.c		acpica & acpi_debug & ddb

Index: src/sys/external/bsd/acpica/dist/debugger/dbdisply.c
diff -u src/sys/external/bsd/acpica/dist/debugger/dbdisply.c:1.3 src/sys/external/bsd/acpica/dist/debugger/dbdisply.c:1.4
--- src/sys/external/bsd/acpica/dist/debugger/dbdisply.c:1.3	Thu Feb 17 10:09:40 2011
+++ src/sys/external/bsd/acpica/dist/debugger/dbdisply.c	Thu Feb 17 12:08:14 2011
@@ -925,7 +925,7 @@
 typedef struct acpi_handler_info
 {
 void*Handler;
-char*Name;
+const char  *Name;
 
 } ACPI_HANDLER_INFO;
 

Index: src/sys/external/bsd/acpica/dist/include/acutils.h
diff -u src/sys/external/bsd/acpica/dist/include/acutils.h:1.4 src/sys/external/bsd/acpica/dist/include/acutils.h:1.5
--- src/sys/external/bsd/acpica/dist/include/acutils.h:1.4	Thu Feb 17 11:21:40 2011
+++ src/sys/external/bsd/acpica/dist/include/acutils.h	Thu Feb 17 12:08:14 2011
@@ -133,7 +133,7 @@
 
 #endif
 
-const char *
+char *
 AcpiUtGetTypeName (
 ACPI_OBJECT_TYPEType);
 
@@ -375,7 +375,7 @@
 const char  *FunctionName,
 const char  *ModuleName,
 UINT32  ComponentId,
-char*String);
+const char  *String);
 
 void
 AcpiUtExit (

Index: src/sys/external/bsd/acpica/dist/utilities/utdebug.c
diff -u src/sys/external/bsd/acpica/dist/utilities/utdebug.c:1.3 src/sys/external/bsd/acpica/dist/utilities/utdebug.c:1.4
--- src/sys/external/bsd/acpica/dist/utilities/utdebug.c:1.3	Thu Feb 17 10:09:43 2011
+++ src/sys/external/bsd/acpica/dist/utilities/utdebug.c	Thu Feb 17 12:08:15 2011
@@ -374,7 +374,7 @@
 const char  *FunctionName,
 const char  *ModuleName,
 UINT32  ComponentId,
-char*String)
+const char  *String)
 {
 
 AcpiGbl_NestingLevel++;

Index: src/sys/external/bsd/acpica/dist/utilities/utdecode.c
diff -u src/sys/external/bsd/acpica/dist/utilities/utdecode.c:1.2 src/sys/external/bsd/acpica/dist/utilities/utdecode.c:1.3
--- src/sys/external/bsd/acpica/dist/utilities/utdecode.c:1.2	Thu Feb 17 11:21:40 2011
+++ src/sys/external/bsd/acpica/dist/utilities/utdecode.c	Thu Feb 17 12:08:15 2011
@@ -312,7 +312,7 @@
 };
 
 
-const char *
+char *
 AcpiUtGetTypeName (
 ACPI_OBJECT_TYPEType)
 {
@@ -522,7 +522,7 @@
 
 /* Names for internal mutex objects, used for debug output */
 
-static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
+static const char  *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
 {
 "ACPI_MTX_Interpreter",
 "ACPI_MTX_Namespace",



CVS commit: src/sys/external/bsd/drm

2011-03-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Mar 27 08:45:12 UTC 2011

Modified Files:
src/sys/external/bsd/drm/conf: files.drm
src/sys/external/bsd/drm/dist/shared-core: radeon_cp.c

Log Message:
Make code compile when the kernel has no support for AGP. For now this also
rules out PCIE support without AGP because all the code is drm_agpsupport.c


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm/conf/files.drm
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm/dist/shared-core/radeon_cp.c

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/drm/conf/files.drm
diff -u src/sys/external/bsd/drm/conf/files.drm:1.6 src/sys/external/bsd/drm/conf/files.drm:1.7
--- src/sys/external/bsd/drm/conf/files.drm:1.6	Fri Feb 18 14:26:09 2011
+++ src/sys/external/bsd/drm/conf/files.drm	Sun Mar 27 08:45:11 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drm,v 1.6 2011/02/18 14:26:09 jmcneill Exp $
+#	$NetBSD: files.drm,v 1.7 2011/03/27 08:45:11 mlelstv Exp $
 
 # direct rendering modules
 define	drmbase
@@ -8,7 +8,7 @@
 
 makeoptions	drmbase		CPPFLAGS+="-I$S/external/bsd/drm/dist/bsd-core -I$S/external/bsd/drm/dist/shared-core"
 
-file	external/bsd/drm/dist/bsd-core/drm_agpsupport.c		drmbase
+file	external/bsd/drm/dist/bsd-core/drm_agpsupport.c		drmbase & agp
 file	external/bsd/drm/dist/bsd-core/drm_auth.c		drmbase
 file	external/bsd/drm/dist/bsd-core/drm_bufs.c		drmbase
 file	external/bsd/drm/dist/bsd-core/drm_context.c		drmbase

Index: src/sys/external/bsd/drm/dist/shared-core/radeon_cp.c
diff -u src/sys/external/bsd/drm/dist/shared-core/radeon_cp.c:1.9 src/sys/external/bsd/drm/dist/shared-core/radeon_cp.c:1.10
--- src/sys/external/bsd/drm/dist/shared-core/radeon_cp.c:1.9	Sat Nov  6 22:06:10 2010
+++ src/sys/external/bsd/drm/dist/shared-core/radeon_cp.c	Sun Mar 27 08:45:11 2011
@@ -2006,11 +2006,13 @@
 	}
 
 	dev_priv->chip_family = flags & RADEON_FAMILY_MASK;
+#if !defined(__NetBSD__) || NAGP > 0
 	if (drm_device_is_agp(dev))
 		dev_priv->flags |= RADEON_IS_AGP;
 	else if (drm_device_is_pcie(dev))
 		dev_priv->flags |= RADEON_IS_PCIE;
 	else
+#endif
 		dev_priv->flags |= RADEON_IS_PCI;
 
 	ret = drm_vblank_init(dev, 2);



CVS commit: src/sys/external/bsd/sljit

2012-10-06 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat Oct  6 18:29:44 UTC 2012

Added Files:
src/sys/external/bsd/sljit: README.import

Log Message:
Add import notes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/sljit/README.import

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/sljit/README.import
diff -u /dev/null src/sys/external/bsd/sljit/README.import:1.1
--- /dev/null	Sat Oct  6 18:29:44 2012
+++ src/sys/external/bsd/sljit/README.import	Sat Oct  6 18:29:44 2012
@@ -0,0 +1,6 @@
+There are no CVS/SVN ids in sljit repository but don't forget to
+remove .svn before importing the new version.
+
+Current sljit import is @ r175:
+
+svn co https://sljit.svn.sourceforge.net/svnroot/sljit@175 dist



CVS commit: src/sys/external/bsd/sljit

2012-10-13 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat Oct 13 19:38:24 UTC 2012

Modified Files:
src/sys/external/bsd/sljit/dist/sljit_src: sljitConfig.h
sljitNativeX86_common.c
Added Files:
src/sys/external/bsd/sljit/conf: files.sljit

Log Message:
Fix compilation.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/sljit/conf/files.sljit
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_common.c

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/sljit/dist/sljit_src/sljitConfig.h
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h:1.3 src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h:1.4
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h:1.3	Mon Oct  8 22:39:15 2012
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h	Sat Oct 13 19:38:24 2012
@@ -87,6 +87,7 @@
 #ifdef _KERNEL
 #include 
 #include 
+#include 
 #endif
 
 /* - */

Index: src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_common.c
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_common.c:1.1.1.1 src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_common.c:1.2
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_common.c:1.1.1.1	Sat Oct  6 18:24:24 2012
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_common.c	Sat Oct 13 19:38:24 2012
@@ -24,7 +24,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name()
+SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
 {
 	return "x86" SLJIT_CPUINFO;
 }
@@ -2021,7 +2021,7 @@ SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
 static sljit_i sse2_data[3 + 4 + 4];
 static sljit_i *sse2_buffer;
 
-static void init_compiler()
+static void init_compiler(void)
 {
 	sse2_buffer = (sljit_i*)(((sljit_uw)sse2_data + 15) & ~0xf);
 	sse2_buffer[0] = 0;

Added files:

Index: src/sys/external/bsd/sljit/conf/files.sljit
diff -u /dev/null src/sys/external/bsd/sljit/conf/files.sljit:1.1
--- /dev/null	Sat Oct 13 19:38:24 2012
+++ src/sys/external/bsd/sljit/conf/files.sljit	Sat Oct 13 19:38:24 2012
@@ -0,0 +1,7 @@
+# $NetBSD: files.sljit,v 1.1 2012/10/13 19:38:24 alnsn Exp $
+
+defflag		SLJIT
+
+makeoptions	sljit	CPPFLAGS+="-I$S/external/bsd/sljit/dist/sljit_src"
+
+file	external/bsd/sljit/dist/sljit_src/sljitLir.c	sljit



CVS commit: src/sys/external/bsd/sljit

2012-10-21 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Oct 21 19:15:10 UTC 2012

Modified Files:
src/sys/external/bsd/sljit: README.import

Log Message:
Update README.import.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/sljit/README.import

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/sljit/README.import
diff -u src/sys/external/bsd/sljit/README.import:1.1 src/sys/external/bsd/sljit/README.import:1.2
--- src/sys/external/bsd/sljit/README.import:1.1	Sat Oct  6 18:29:44 2012
+++ src/sys/external/bsd/sljit/README.import	Sun Oct 21 19:15:10 2012
@@ -1,6 +1,6 @@
 There are no CVS/SVN ids in sljit repository but don't forget to
 remove .svn before importing the new version.
 
-Current sljit import is @ r175:
+Current sljit import is @ r176:
 
-svn co https://sljit.svn.sourceforge.net/svnroot/sljit@175 dist
+svn co https://sljit.svn.sourceforge.net/svnroot/sljit@176 dist



CVS commit: src/sys/external/bsd/sljit

2012-10-28 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Oct 28 09:41:12 UTC 2012

Modified Files:
src/sys/external/bsd/sljit: README.import

Log Message:
Update sljit revision in README.import.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/sljit/README.import

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/sljit/README.import
diff -u src/sys/external/bsd/sljit/README.import:1.2 src/sys/external/bsd/sljit/README.import:1.3
--- src/sys/external/bsd/sljit/README.import:1.2	Sun Oct 21 19:15:10 2012
+++ src/sys/external/bsd/sljit/README.import	Sun Oct 28 09:41:12 2012
@@ -1,6 +1,6 @@
 There are no CVS/SVN ids in sljit repository but don't forget to
 remove .svn before importing the new version.
 
-Current sljit import is @ r176:
+Current sljit import is @ r186:
 
-svn co https://sljit.svn.sourceforge.net/svnroot/sljit@176 dist
+svn co https://sljit.svn.sourceforge.net/svnroot/sljit@186 dist



CVS commit: src/sys/external/bsd/compiler_rt

2016-02-27 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 27 19:12:05 UTC 2016

Modified Files:
src/sys/external/bsd/compiler_rt: prepare-import.sh

Log Message:
Synchronise with new components we are currently not interested in.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/compiler_rt/prepare-import.sh

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/compiler_rt/prepare-import.sh
diff -u src/sys/external/bsd/compiler_rt/prepare-import.sh:1.4 src/sys/external/bsd/compiler_rt/prepare-import.sh:1.5
--- src/sys/external/bsd/compiler_rt/prepare-import.sh:1.4	Fri May 16 00:08:17 2014
+++ src/sys/external/bsd/compiler_rt/prepare-import.sh	Sat Feb 27 19:12:05 2016
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: prepare-import.sh,v 1.4 2014/05/16 00:08:17 joerg Exp $
+# $NetBSD: prepare-import.sh,v 1.5 2016/02/27 19:12:05 joerg Exp $
 #
 # Checkout compiler_rt into dist.
 # Run this script and check for additional files and directories to prune,
@@ -11,9 +11,13 @@ cd dist
 rm -rf .svn
 rm -rf SDKs android cmake include make third_party unittests www
 rm -f .arcconfig .gitignore CMakeLists.txt Makefile
-rm -rf lib/BlocksRuntime lib/asan lib/dfsan lib/interception lib/lsan
-rm -rf lib/msan lib/msandr lib/sanitizer_common lib/tsan lib/ubsan
-rm -rf test/BlocksRuntime test/asan test/dfsan test/lit.* test/lsan test/msan test/sanitizer_common test/tsan test/ubsan
+rm -rf lib/BlocksRuntime lib/asan lib/dfsan lib/interception lib/lsan lib/cfi
+rm -rf lib/msan lib/msandr lib/sanitizer_common lib/safestack lib/tsan lib/ubsan
+rm -rf  lib/builtins/Darwin-excludes lib/builtins/macho_embedded
+rm -rf test/BlocksRuntime test/asan test/cfi test/dfsan test/lit.* test/lsan
+rm -rf test/msan test/sanitizer_common test/safestack test/tsan test/ubsan
 rm -f lib/*/*/Makefile.mk lib/*/Makefile.mk */Makefile.mk
 rm -f lib/*/CMakeLists.txt */CMakeLists.txt
 rm -f lib/builtins/apple_versioning.c lib/lit.common.*
+cd ..
+find dist -type d -delete 2> /dev/null



CVS commit: src/sys/external/bsd/drm2

2016-04-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 24 04:26:12 UTC 2016

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_bo.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_ttm.c
src/sys/external/bsd/drm2/dist/drm/ttm: ttm_tt.c
src/sys/external/bsd/drm2/dist/include/drm/ttm: ttm_bo_driver.h
src/sys/external/bsd/drm2/include/drm/ttm: ttm_page_alloc.h
src/sys/external/bsd/drm2/ttm: ttm_bus_dma.c

Log Message:
Rework ttm tt swapin/swapout logic.

Rather than handling `swapping in/out' here, per se, we let uvm do
that, we interpret `swap out' as `deactivate pages', and we add
generic ttm operations to wire and unwire pages, for the ttm_tt
driver to use.

This fixes certain graphics buffer eviction logic, which enables
nouveau to suspend/resume on one of my machines.  (The machine
doesn't resume overall for other reasons, but the nouveau device
suspends and resumes in isolation.)

XXX pullup to netbsd-7 after a couple weeks


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/include/drm/ttm/ttm_bo_driver.h
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/include/drm/ttm/ttm_page_alloc.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c

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/dist/drm/nouveau/nouveau_bo.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c:1.6 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c:1.6	Thu Oct 29 08:08:52 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c	Sun Apr 24 04:26:12 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_bo.c,v 1.6 2015/10/29 08:08:52 mrg Exp $	*/
+/*	$NetBSD: nouveau_bo.c,v 1.7 2016/04/24 04:26:12 riastradh Exp $	*/
 
 /*
  * Copyright 2007 Dave Airlied
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.6 2015/10/29 08:08:52 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.7 2016/04/24 04:26:12 riastradh Exp $");
 
 #include 
 #include 
@@ -1524,6 +1524,16 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt 
 #endif
 }
 
+#ifdef __NetBSD__
+static void
+nouveau_ttm_tt_swapout(struct ttm_tt *ttm)
+{
+	struct ttm_dma_tt *ttm_dma = container_of(ttm, struct ttm_dma_tt, ttm);
+
+	ttm_bus_dma_swapout(ttm_dma);
+}
+#endif
+
 void
 nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence)
 {
@@ -1581,6 +1591,7 @@ struct ttm_bo_driver nouveau_bo_driver =
 	.ttm_tt_populate = &nouveau_ttm_tt_populate,
 	.ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate,
 #ifdef __NetBSD__
+	.ttm_tt_swapout = &nouveau_ttm_tt_swapout,
 	.ttm_uvm_ops = &nouveau_uvm_ops,
 #endif
 	.invalidate_caches = nouveau_bo_invalidate_caches,

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.7 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.7	Fri Apr 10 17:44:35 2015
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c	Sun Apr 24 04:26:12 2016
@@ -716,6 +716,15 @@ static void radeon_ttm_tt_unpopulate(str
 }
 
 #ifdef __NetBSD__
+static void radeon_ttm_tt_swapout(struct ttm_tt *ttm)
+{
+	struct radeon_ttm_tt *gtt = container_of(ttm, struct radeon_ttm_tt,
+	ttm.ttm);
+	struct ttm_dma_tt *ttm_dma = >t->ttm;
+
+	ttm_bus_dma_swapout(ttm_dma);
+}
+
 static int	radeon_ttm_fault(struct uvm_faultinfo *, vaddr_t,
 		struct vm_page **, int, int, vm_prot_t, int);
 
@@ -731,6 +740,7 @@ static struct ttm_bo_driver radeon_bo_dr
 	.ttm_tt_populate = &radeon_ttm_tt_populate,
 	.ttm_tt_unpopulate = &radeon_ttm_tt_unpopulate,
 #ifdef __NetBSD__
+	.ttm_tt_swapout = &radeon_ttm_tt_swapout,
 	.ttm_uvm_ops = &radeon_uvm_ops,
 #endif
 	.invalidate_caches = &radeon_invalidate_caches,

Index: src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
diff -u src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c:1.6 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c:1.6	Sun Jul 27 00:40:39 2014
+++ src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c	Sun Apr 24 04:26:12 2016
@@ -349,15 +349,30 @@ int ttm_tt_bind(struct ttm_tt *ttm, stru
 }
 EXPORT_SYMBOL(ttm_tt_bind);
 
-int ttm_tt_swapin(struct ttm_tt *ttm)
-{
 #ifdef __NetBSD__
+/*
+ * ttm_tt_wire(ttm)
+ *
+ *	Wire the uvm pages of ttm and fill the ttm page array.  ttm
+ *	must be unpopulated or unbound, and must be marked swapped.
+ *	This does not change either state -- the caller is expected to
+ *	include it among other operations for

CVS commit: src/sys/external/bsd/acpica

2016-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 11 21:11:32 UTC 2016

Modified Files:
src/sys/external/bsd/acpica/conf: files.acpica
src/sys/external/bsd/acpica/dist/common: dmtbdump.c dmtbinfo.c
src/sys/external/bsd/acpica/dist/compiler: aslcompiler.h aslutils.c
aslxref.c dtfield.c dtparser.y dttable.c dtutils.c prparser.y
src/sys/external/bsd/acpica/dist/debugger: dbexec.c dbinput.c
dbmethod.c
src/sys/external/bsd/acpica/dist/disassembler: dmbuffer.c dmcstyle.c
dmresrcl.c
src/sys/external/bsd/acpica/dist/events: evrgnini.c
src/sys/external/bsd/acpica/dist/executer: exconfig.c
src/sys/external/bsd/acpica/dist/include: acapps.h acdebug.h acdisasm.h
acglobal.h aclocal.h acnamesp.h acpiosxf.h acpixf.h actables.h
actypes.h acutils.h
src/sys/external/bsd/acpica/dist/include/platform: acgcc.h acnetbsd.h
src/sys/external/bsd/acpica/dist/tables: tbdata.c tbfadt.c tbinstal.c
tbutils.c tbxface.c tbxfload.c tbxfroot.c
src/sys/external/bsd/acpica/dist/tools/acpidump: apfiles.c
src/sys/external/bsd/acpica/dist/utilities: utdebug.c utosi.c utprint.c
uttrack.c
Removed Files:
src/sys/external/bsd/acpica/dist/include/platform: acwinex.h
src/sys/external/bsd/acpica/dist/os_specific/service_layers: osefitbl.c
osefixf.c oslibcfs.c

Log Message:
Adjust to new acpica


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/acpica/conf/files.acpica
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/acpica/dist/common/dmtbdump.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/common/dmtbinfo.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h
cvs rdiff -u -r1.14 -r1.15 \
src/sys/external/bsd/acpica/dist/compiler/aslutils.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/acpica/dist/compiler/aslxref.c \
src/sys/external/bsd/acpica/dist/compiler/dtparser.y \
src/sys/external/bsd/acpica/dist/compiler/dttable.c \
src/sys/external/bsd/acpica/dist/compiler/prparser.y
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/acpica/dist/compiler/dtfield.c \
src/sys/external/bsd/acpica/dist/compiler/dtutils.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/debugger/dbexec.c
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/acpica/dist/debugger/dbinput.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/acpica/dist/debugger/dbmethod.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/acpica/dist/disassembler/dmbuffer.c \
src/sys/external/bsd/acpica/dist/disassembler/dmcstyle.c
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/acpica/dist/disassembler/dmresrcl.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/acpica/dist/events/evrgnini.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/acpica/dist/executer/exconfig.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/acpica/dist/include/acapps.h \
src/sys/external/bsd/acpica/dist/include/actables.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/include/acdebug.h \
src/sys/external/bsd/acpica/dist/include/acdisasm.h \
src/sys/external/bsd/acpica/dist/include/aclocal.h \
src/sys/external/bsd/acpica/dist/include/actypes.h
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/acpica/dist/include/acglobal.h \
src/sys/external/bsd/acpica/dist/include/acpixf.h \
src/sys/external/bsd/acpica/dist/include/acutils.h
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/acpica/dist/include/acnamesp.h \
src/sys/external/bsd/acpica/dist/include/acpiosxf.h
cvs rdiff -u -r1.1.1.8 -r1.2 \
src/sys/external/bsd/acpica/dist/include/platform/acgcc.h
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/acpica/dist/include/platform/acnetbsd.h
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/external/bsd/acpica/dist/include/platform/acwinex.h
cvs rdiff -u -r1.1.1.4 -r0 \
src/sys/external/bsd/acpica/dist/os_specific/service_layers/osefitbl.c \
src/sys/external/bsd/acpica/dist/os_specific/service_layers/osefixf.c
cvs rdiff -u -r1.1.1.3 -r0 \
src/sys/external/bsd/acpica/dist/os_specific/service_layers/oslibcfs.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/acpica/dist/tables/tbdata.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/acpica/dist/tables/tbfadt.c \
src/sys/external/bsd/acpica/dist/tables/tbxface.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/acpica/dist/tables/tbinstal.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/tables/tbutils.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/acpica/dist/tables/tbxfload.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/acpica/dist/tables/tbxfroot.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/acpica/dist/utilities/utdebug.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/acpica/dist/utilities/ut

CVS commit: src/sys/external/bsd/dwc2

2016-12-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec  4 16:59:49 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Add a missing usb_syncmem(... BUS_DMASYNC_PRE{READ,WRITE}) for the
transfer buffer


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.44 src/sys/external/bsd/dwc2/dwc2.c:1.45
--- src/sys/external/bsd/dwc2/dwc2.c:1.44	Sun Aug 14 14:42:22 2016
+++ src/sys/external/bsd/dwc2/dwc2.c	Sun Dec  4 16:59:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.44 2016/08/14 14:42:22 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.45 2016/12/04 16:59:49 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.44 2016/08/14 14:42:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.45 2016/12/04 16:59:49 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1012,6 +1012,10 @@ dwc2_device_start(struct usbd_xfer *xfer
 		dwc2_urb->usbdma = &xfer->ux_dmabuf;
 		dwc2_urb->buf = KERNADDR(dwc2_urb->usbdma, 0);
 		dwc2_urb->dma = DMAADDR(dwc2_urb->usbdma, 0);
+
+		usb_syncmem(&xfer->ux_dmabuf, 0, len,
+		dir == UE_DIR_IN ?
+			BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
  	}
 	dwc2_urb->length = len;
  	dwc2_urb->flags = flags;



CVS commit: src/sys/external/bsd/drm2

2016-12-12 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Dec 12 19:45:56 UTC 2016

Modified Files:
src/sys/external/bsd/drm2/drm: drmfb.c
src/sys/external/bsd/drm2/i915drm: intelfb.c
src/sys/external/bsd/drm2/include/drm: drmfb.h
src/sys/external/bsd/drm2/nouveau: nouveaufb.c

Log Message:
add da_fb_linebytes to drmfb_attach_args and use it to pass linebytes
from nouveau code to drmfb. keep the same linebytes logic for i915.

nvidia hardware needs 256 byte alignment, so aligning to just 64 was
not enough.

fixes broken console with a width of 1440px (PR kern/51181)
ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/drm/drmfb.c
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/i915drm/intelfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/drm/drmfb.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/nouveau/nouveaufb.c

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/drm/drmfb.c
diff -u src/sys/external/bsd/drm2/drm/drmfb.c:1.2 src/sys/external/bsd/drm2/drm/drmfb.c:1.3
--- src/sys/external/bsd/drm2/drm/drmfb.c:1.2	Mon Nov  9 23:11:18 2015
+++ src/sys/external/bsd/drm2/drm/drmfb.c	Mon Dec 12 19:45:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmfb.c,v 1.2 2015/11/09 23:11:18 jmcneill Exp $	*/
+/*	$NetBSD: drmfb.c,v 1.3 2016/12/12 19:45:56 maya Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.2 2015/11/09 23:11:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.3 2016/12/12 19:45:56 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -103,9 +103,7 @@ drmfb_attach(struct drmfb_softc *sc, con
 	prop_dictionary_set_uint32(dict, "width", sizes->surface_width);
 	prop_dictionary_set_uint32(dict, "height", sizes->surface_height);
 	prop_dictionary_set_uint8(dict, "depth", sizes->surface_bpp);
-	prop_dictionary_set_uint16(dict, "linebytes",
-	roundup2((sizes->surface_width * howmany(sizes->surface_bpp, 8)),
-		64));
+	prop_dictionary_set_uint16(dict, "linebytes", da->da_fb_linebytes);
 	prop_dictionary_set_uint32(dict, "address", 0); /* XXX >32-bit */
 	CTASSERT(sizeof(uintptr_t) <= sizeof(uint64_t));
 	prop_dictionary_set_uint64(dict, "virtual_address",

Index: src/sys/external/bsd/drm2/i915drm/intelfb.c
diff -u src/sys/external/bsd/drm2/i915drm/intelfb.c:1.13 src/sys/external/bsd/drm2/i915drm/intelfb.c:1.14
--- src/sys/external/bsd/drm2/i915drm/intelfb.c:1.13	Sat Apr  4 15:12:39 2015
+++ src/sys/external/bsd/drm2/i915drm/intelfb.c	Mon Dec 12 19:45:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $	*/
+/*	$NetBSD: intelfb.c,v 1.14 2016/12/12 19:45:56 maya Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.14 2016/12/12 19:45:56 maya Exp $");
 
 #include 
 #include 
@@ -164,11 +164,14 @@ intelfb_attach_task(struct i915drmkms_ta
 	struct intelfb_softc *const sc = container_of(task,
 	struct intelfb_softc, sc_attach_task);
 	const struct intelfb_attach_args *const ifa = &sc->sc_ifa;
+	const struct drm_fb_helper_surface_size *const sizes = &ifa->ifa_fb_sizes;
 	const struct drmfb_attach_args da = {
 		.da_dev = sc->sc_dev,
 		.da_fb_helper = ifa->ifa_fb_helper,
 		.da_fb_sizes = &ifa->ifa_fb_sizes,
 		.da_fb_vaddr = bus_space_vaddr(ifa->ifa_fb_bst, sc->sc_fb_bsh),
+		.da_fb_linebytes = roundup2((sizes->surface_width *
+		howmany(sizes->surface_bpp, 8)), 64),
 		.da_params = &intelfb_drmfb_params,
 	};
 	int error;

Index: src/sys/external/bsd/drm2/include/drm/drmfb.h
diff -u src/sys/external/bsd/drm2/include/drm/drmfb.h:1.1 src/sys/external/bsd/drm2/include/drm/drmfb.h:1.2
--- src/sys/external/bsd/drm2/include/drm/drmfb.h:1.1	Thu Mar  5 17:50:41 2015
+++ src/sys/external/bsd/drm2/include/drm/drmfb.h	Mon Dec 12 19:45:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmfb.h,v 1.1 2015/03/05 17:50:41 riastradh Exp $	*/
+/*	$NetBSD: drmfb.h,v 1.2 2016/12/12 19:45:56 maya Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -76,6 +76,7 @@ struct drmfb_attach_args {
 	struct drm_fb_helper		*da_fb_helper;
 	const struct drm_fb_helper_surface_size	*da_fb_sizes;
 	void*da_fb_vaddr;
+	uint32_t			da_fb_linebytes;
 	const struct drmfb_params	*da_params;
 };
 

Index: src/sys/external/bsd/drm2/nouveau/nouveaufb.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.3 src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.4
--- src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.3	Sat Oct 17 12:02:44 2015
+++ src/sys/external/bsd/drm2/nouveau/nouveaufb.c	Mon Dec 12 19:45:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveaufb.c,v 1.3 2015/10/17 12:02:44 jmcneill Exp $	*/
+/*	$NetBSD: nouveaufb.c,v 1.4

CVS commit: src/sys/external/bsd/dwc2

2015-08-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 18 12:01:16 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.32 src/sys/external/bsd/dwc2/dwc2.c:1.33
--- src/sys/external/bsd/dwc2/dwc2.c:1.32	Tue Sep  2 23:26:20 2014
+++ src/sys/external/bsd/dwc2/dwc2.c	Tue Aug 18 12:01:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.33 2015/08/18 12:01:16 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.33 2015/08/18 12:01:16 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -240,15 +240,15 @@ dwc2_allocm(struct usbd_bus *bus, usb_dm
 Static void
 dwc2_freem(struct usbd_bus *bus, usb_dma_t *dma)
 {
-struct dwc2_softc *sc = DWC2_BUS2SC(bus);
+	struct dwc2_softc *sc = DWC2_BUS2SC(bus);
 
 	DPRINTFN(10, "\n");
 
-if (dma->block->flags & USB_DMA_RESERVE) {
-usb_reserve_freem(&sc->sc_dma_reserve, dma);
-return;
-}
-usb_freemem(&sc->sc_bus, dma);
+	if (dma->block->flags & USB_DMA_RESERVE) {
+		usb_reserve_freem(&sc->sc_dma_reserve, dma);
+		return;
+	}
+	usb_freemem(&sc->sc_bus, dma);
 }
 
 usbd_xfer_handle
@@ -343,7 +343,7 @@ dwc2_softintr(void *v)
 	mutex_spin_enter(&hsotg->lock);
 	while ((dxfer = TAILQ_FIRST(&sc->sc_complete)) != NULL) {
 
-		KASSERTMSG(!callout_pending(&dxfer->xfer.timeout_handle), 
+		KASSERTMSG(!callout_pending(&dxfer->xfer.timeout_handle),
 		"xfer %p pipe %p\n", dxfer, dxfer->xfer.pipe);
 
 		/*
@@ -1228,7 +1228,7 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	struct dwc2_pipe *dpipe = DWC2_XFER2DPIPE(xfer);
 	struct dwc2_softc *sc = DWC2_XFER2SC(xfer);
 	struct dwc2_hsotg *hsotg = sc->sc_hsotg;
-struct dwc2_hcd_urb *dwc2_urb;
+	struct dwc2_hcd_urb *dwc2_urb;
 
 	usbd_device_handle dev = xfer->pipe->device;
 	usb_endpoint_descriptor_t *ed = xfer->pipe->endpoint->edesc;
@@ -1672,7 +1672,7 @@ int dwc2_host_get_speed(struct dwc2_hsot
  * Must be called with interrupt disabled and spinlock held
  */
 void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
-int status)
+int status)
 {
 	usbd_xfer_handle xfer;
 	struct dwc2_xfer *dxfer;



CVS commit: src/sys/external/bsd/dwc2

2015-08-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 23 11:15:08 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Do BUS_DMASYNC_POST{READ,WRITE} on transfer buffers appropriately


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.33 src/sys/external/bsd/dwc2/dwc2.c:1.34
--- src/sys/external/bsd/dwc2/dwc2.c:1.33	Tue Aug 18 12:01:16 2015
+++ src/sys/external/bsd/dwc2/dwc2.c	Sun Aug 23 11:15:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.33 2015/08/18 12:01:16 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.34 2015/08/23 11:15:08 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.33 2015/08/18 12:01:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.34 2015/08/23 11:15:08 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1754,6 +1754,20 @@ void dwc2_host_complete(struct dwc2_hsot
 		printf("%s: unknown error status %d\n", __func__, status);
 	}
 
+	if (xfer->status == USBD_NORMAL_COMPLETION) {
+		int rd = usbd_xfer_isread(xfer);
+
+		/*
+		 * control transfers with no data phase don't touch dmabuf, but
+		 * everything else does.
+		 */
+		if (!(xfertype == UE_CONTROL &&
+		UGETW(xfer->request.wLength) == 0)) {
+			usb_syncmem(&xfer->dmabuf, 0, xfer->actlen,
+			rd ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+		}
+	}
+
 	if (xfertype == UE_ISOCHRONOUS ||
 	xfertype == UE_INTERRUPT) {
 		struct dwc2_pipe *dpipe = DWC2_XFER2DPIPE(xfer);



CVS commit: src/sys/external/bsd/dwc2

2015-08-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 23 13:18:44 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Move rd assignment. Spotted by christos@. Thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.34 src/sys/external/bsd/dwc2/dwc2.c:1.35
--- src/sys/external/bsd/dwc2/dwc2.c:1.34	Sun Aug 23 11:15:08 2015
+++ src/sys/external/bsd/dwc2/dwc2.c	Sun Aug 23 13:18:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.34 2015/08/23 11:15:08 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.35 2015/08/23 13:18:44 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.34 2015/08/23 11:15:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.35 2015/08/23 13:18:44 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1755,14 +1755,14 @@ void dwc2_host_complete(struct dwc2_hsot
 	}
 
 	if (xfer->status == USBD_NORMAL_COMPLETION) {
-		int rd = usbd_xfer_isread(xfer);
-
 		/*
 		 * control transfers with no data phase don't touch dmabuf, but
 		 * everything else does.
 		 */
 		if (!(xfertype == UE_CONTROL &&
 		UGETW(xfer->request.wLength) == 0)) {
+			int rd = usbd_xfer_isread(xfer);
+
 			usb_syncmem(&xfer->dmabuf, 0, xfer->actlen,
 			rd ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
 		}



CVS commit: src/sys/external/bsd/dwc2

2015-08-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 30 10:48:15 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.35 src/sys/external/bsd/dwc2/dwc2.c:1.36
--- src/sys/external/bsd/dwc2/dwc2.c:1.35	Sun Aug 23 13:18:44 2015
+++ src/sys/external/bsd/dwc2/dwc2.c	Sun Aug 30 10:48:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.35 2015/08/23 13:18:44 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.36 2015/08/30 10:48:15 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.35 2015/08/23 13:18:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.36 2015/08/30 10:48:15 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1070,7 +1070,7 @@ Static void
 dwc2_device_bulk_done(usbd_xfer_handle xfer)
 {
 
-	DPRINTF("xfer=%p\n", xfer);
+	DPRINTF("xfer=%p\n", xfer);
 }
 
 /***/
@@ -1317,7 +1317,7 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	 * everything else does.
 	 */
 	if (!(xfertype == UE_CONTROL && len == 0)) {
-		dwc2_urb->usbdma = &xfer->dmabuf;
+		dwc2_urb->usbdma = &xfer->dmabuf;
 		dwc2_urb->buf = KERNADDR(dwc2_urb->usbdma, 0);
 		dwc2_urb->dma = DMAADDR(dwc2_urb->usbdma, 0);
  	}



CVS commit: src/sys/external/bsd/dwc2

2015-08-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 30 12:26:29 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwc2.h

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/dwc2/dwc2.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/dwc2/dwc2.h
diff -u src/sys/external/bsd/dwc2/dwc2.h:1.5 src/sys/external/bsd/dwc2/dwc2.h:1.6
--- src/sys/external/bsd/dwc2/dwc2.h:1.5	Thu Jul 30 07:32:40 2015
+++ src/sys/external/bsd/dwc2/dwc2.h	Sun Aug 30 12:26:29 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.h,v 1.5 2015/07/30 07:32:40 skrll Exp $	*/
+/*	$NetBSD: dwc2.h,v 1.6 2015/08/30 12:26:29 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,10 +33,10 @@
 #define _EXTERNAL_BSD_DWC2_DWC2_H_
 
 #include 
-#include 
 
-#include 
 #include 
+#include 
+#include 
 
 #include 
 



CVS commit: src/sys/external/bsd/dwc2

2015-08-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 30 13:03:00 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwctwo2netbsd

Log Message:
Note where we're tracking dwc2 from now.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/dwc2/dwctwo2netbsd

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/dwc2/dwctwo2netbsd
diff -u src/sys/external/bsd/dwc2/dwctwo2netbsd:1.3 src/sys/external/bsd/dwc2/dwctwo2netbsd:1.4
--- src/sys/external/bsd/dwc2/dwctwo2netbsd:1.3	Thu Apr  3 06:07:22 2014
+++ src/sys/external/bsd/dwc2/dwctwo2netbsd	Sun Aug 30 13:03:00 2015
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: dwctwo2netbsd,v 1.3 2014/04/03 06:07:22 skrll Exp $
+#	$NetBSD: dwctwo2netbsd,v 1.4 2015/08/30 13:03:00 skrll Exp $
 #
 # Copyright (c) 2013 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -34,7 +34,7 @@
 #
 #	$ DATE=$(date +%F)
 #	$ cd /some/where/temporary
-#	$ git clone -b staging.next git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
+#	$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 #	$ DWC2SRCS=$(pwd)/drivers/usb/dwc2
 #	$ WRKDIR=/an/other/temporary
 #	$ sh /usr/src/sys/external/bsd/dwc2/dwctwo2netbsd $DWC2SRCS $WRKDIR



CVS commit: src/sys/external/bsd/drm2

2015-03-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  5 17:29:18 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/include/linux: i2c.h
src/sys/external/bsd/drm2/linux: linux_i2c.c

Log Message:
Reorganize Linux i2c header file and add a few more shims.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/i2c.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/linux/linux_i2c.c

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/linux/i2c.h
diff -u src/sys/external/bsd/drm2/include/linux/i2c.h:1.7 src/sys/external/bsd/drm2/include/linux/i2c.h:1.8
--- src/sys/external/bsd/drm2/include/linux/i2c.h:1.7	Thu Mar  5 15:02:36 2015
+++ src/sys/external/bsd/drm2/include/linux/i2c.h	Thu Mar  5 17:29:18 2015
@@ -1,7 +1,7 @@
-/*	$NetBSD: i2c.h,v 1.7 2015/03/05 15:02:36 riastradh Exp $	*/
+/*	$NetBSD: i2c.h,v 1.8 2015/03/05 17:29:18 riastradh Exp $	*/
 
 /*-
- * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -35,20 +35,86 @@
 #include 
 #include 
 #include 		/* XXX include order botch: i2cvar.h needs */
+#include 
 
 #include 
 
+#include 
+
 struct i2c_adapter;
 struct i2c_algorithm;
 struct i2c_msg;
 
 #define	I2C_NAME_SIZE	20
 
+/*
+ * I2C_M_*: i2c_msg flags
+ */
+#define	I2C_M_RD		0x01 /* xfer is read, not write */
+#define	I2C_M_NOSTART		0x02 /* don't initiate xfer */
+#define	I2C_M_TEN		0x04 /* 10-bit chip address */
+
+/*
+ * I2C_CLASS_*: i2c_adapter classes
+ */
 #define	I2C_CLASS_DDC	0x01
 
+/*
+ * I2C_FUNC_*: i2c_adapter functionality bits
+ */
+#define	I2C_FUNC_I2C			0x01
+#define	I2C_FUNC_NOSTART		0x02
+#define	I2C_FUNC_SMBUS_EMUL		0x04
+#define	I2C_FUNC_SMBUS_READ_BLOCK_DATA	0x08
+#define	I2C_FUNC_SMBUS_BLOCK_PROC_CALL	0x10
+#define	I2C_FUNC_10BIT_ADDR		0x20
+
+/*
+ * struct i2c_msg: A single i2c message request on a particular
+ * address.  Read if I2C_M_RD is set, write otherwise.
+ */
+struct i2c_msg {
+	i2c_addr_t	addr;
+	uint16_t	flags;	/* I2C_M_* */
+	uint16_t	len;
+	uint8_t		*buf;
+};
+
+/*
+ * struct i2c_adapter: An i2c bus controller.
+ */
+struct i2c_adapter {
+	char		 		name[I2C_NAME_SIZE];
+	const struct i2c_algorithm	*algo;
+	void*algo_data;
+	intretries;
+	struct module			*owner;
+	unsigned int			class; /* I2C_CLASS_* */
+	struct {
+		device_t	parent;
+	}dev;
+	void*i2ca_adapdata;
+};
+
+/*
+ * struct i2c_algorithm: A procedure for transferring an i2c message on
+ * an i2c bus, along with a set of flags describing its functionality.
+ */
+struct i2c_algorithm {
+	int		(*master_xfer)(struct i2c_adapter *, struct i2c_msg *,
+			int);
+	uint32_t	(*functionality)(struct i2c_adapter *);
+};
+
+/*
+ * struct i2c_board_info: Parameters to find an i2c bus and a slave on
+ * it.  type is the name of an i2c driver; addr is the slave address;
+ * platform_data is an extra parameter to pass to the i2c driver.
+ */
 struct i2c_board_info {
 	char			type[I2C_NAME_SIZE];
 	uint16_t		addr;
+	uint16_t		flags;
 	void			*platform_data;
 };
 
@@ -56,46 +122,46 @@ struct i2c_board_info {
 	.type = (board_type),\
 	.addr = (board_addr)
 
-static inline void
-i2c_new_device(const struct i2c_adapter *adapter __unused,
-const struct i2c_board_info *board __unused)
-{
-}
-
-struct i2c_driver {
+/*
+ * struct i2c_client: An i2c slave device at a particular address on a
+ * particular bus.
+ */
+struct i2c_client {
+	struct i2c_adapter	*adapter;
+	uint16_t		addr;
+	uint16_t		flags;
 };
 
-struct module;
-static inline int
-i2c_register_driver(const struct module *owner __unused,
-const struct i2c_driver *driver __unused)
-{
-	return 0;
-}
-
-static inline void
-i2c_del_driver(const struct i2c_driver *driver __unused)
-{
-}
-
-struct i2c_client;
+/*
+ * struct i2c_device_id: Device id naming a class of i2c slave devices
+ * and parameters to the driver for the devices.
+ */
+struct i2c_device_id {
+	char		name[I2C_NAME_SIZE];
+	unsigned long	driver_data;
+};
 
-struct i2c_adapter {
-	char		 		name[I2C_NAME_SIZE];
-	const struct i2c_algorithm	*algo;
-	void*algo_data;
-	intretries;
-	struct module			*owner;
-	unsigned int			class;
+/*
+ * struct i2c_driver: A driver for a class of i2c slave devices.  We
+ * don't actually use this.
+ */
+struct i2c_driver {
+	int	(*probe)(struct i2c_client *, const struct i2c_device_id *);
+	int	(*remove)(struct i2c_client *);
 	struct {
-		device_t	parent;
-	}dev;
-	void*i2ca_adapdata;
+		char			name[I2C_NAME_SIZE];
+		const struct dev_pm_ops	pm;
+	}	driver;
 };
 
+/*
+ * Adapter management.  We don't register these in a global database
+ * like Linux, so these are just stubs.
+ */
 static inline int
 i2c_add_adapter(struct i2c_adapter *adapter __unused)
 {
+
 	return 0;
 }
 
@@ -118,3

CVS commit: src/sys/external/bsd/drm2

2015-03-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  5 17:56:39 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/i915drm: intelfb.c
src/sys/external/bsd/drm2/include/drm: drmfb_pci.h
src/sys/external/bsd/drm2/pci: drmfb_pci.c

Log Message:
Factor out intelfb_is_vga_console to drmfb_pci.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/i915drm/intelfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/drm/drmfb_pci.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/pci/drmfb_pci.c

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/i915drm/intelfb.c
diff -u src/sys/external/bsd/drm2/i915drm/intelfb.c:1.11 src/sys/external/bsd/drm2/i915drm/intelfb.c:1.12
--- src/sys/external/bsd/drm2/i915drm/intelfb.c:1.11	Thu Mar  5 17:50:41 2015
+++ src/sys/external/bsd/drm2/i915drm/intelfb.c	Thu Mar  5 17:56:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intelfb.c,v 1.11 2015/03/05 17:50:41 riastradh Exp $	*/
+/*	$NetBSD: intelfb.c,v 1.12 2015/03/05 17:56:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,28 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.11 2015/03/05 17:50:41 riastradh Exp $");
-
-#ifdef _KERNEL_OPT
-#include "vga.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.12 2015/03/05 17:56:39 riastradh Exp $");
 
 #include 
 #include 
 #include 
 
-#if NVGA > 0
-/*
- * XXX All we really need is vga_is_console from vgavar.h, but the
- * header files are missing their own dependencies, so we need to
- * explicitly drag in the other crap.
- */
-#include 
-#include 
-#include 
-#include 
-#endif
-
 #include 
 #include 
 #include 
@@ -66,7 +50,6 @@ static int	intelfb_detach(device_t, int)
 
 static void	intelfb_attach_task(struct i915drmkms_task *);
 
-static bool	intel_is_vga_console(struct drm_device *);
 static bool	intelfb_shutdown(device_t, int);
 
 static paddr_t	intelfb_drmfb_mmapfb(struct drmfb_softc *, off_t, int);
@@ -86,7 +69,7 @@ static const struct drmfb_params intelfb
 	.dp_mmapfb = intelfb_drmfb_mmapfb,
 	.dp_mmap = drmfb_pci_mmap,
 	.dp_ioctl = drmfb_pci_ioctl,
-	.dp_is_vga_console = intel_is_vga_console,
+	.dp_is_vga_console = drmfb_pci_is_vga_console,
 	.dp_disable_vga = i915_disable_vga,
 };
 
@@ -205,17 +188,6 @@ intelfb_attach_task(struct i915drmkms_ta
 }
 
 static bool
-intel_is_vga_console(struct drm_device *dev)
-{
-
-#if NVGA > 0
-	return vga_is_console(dev->pdev->pd_pa.pa_iot, -1);
-#else
-	return false;
-#endif
-}
-
-static bool
 intelfb_shutdown(device_t self, int flags)
 {
 	struct intelfb_softc *const sc = device_private(self);

Index: src/sys/external/bsd/drm2/include/drm/drmfb_pci.h
diff -u src/sys/external/bsd/drm2/include/drm/drmfb_pci.h:1.1 src/sys/external/bsd/drm2/include/drm/drmfb_pci.h:1.2
--- src/sys/external/bsd/drm2/include/drm/drmfb_pci.h:1.1	Thu Mar  5 17:50:41 2015
+++ src/sys/external/bsd/drm2/include/drm/drmfb_pci.h	Thu Mar  5 17:56:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmfb_pci.h,v 1.1 2015/03/05 17:50:41 riastradh Exp $	*/
+/*	$NetBSD: drmfb_pci.h,v 1.2 2015/03/05 17:56:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -40,5 +40,6 @@ struct lwp;
 paddr_t	drmfb_pci_mmap(struct drmfb_softc *, off_t, int);
 int	drmfb_pci_ioctl(struct drmfb_softc *, unsigned long, void *, int,
 	struct lwp *);
+bool	drmfb_pci_is_vga_console(struct drm_device *);
 
 #endif	/* _DRM_DRMFB_PCI_H_ */

Index: src/sys/external/bsd/drm2/pci/drmfb_pci.c
diff -u src/sys/external/bsd/drm2/pci/drmfb_pci.c:1.1 src/sys/external/bsd/drm2/pci/drmfb_pci.c:1.2
--- src/sys/external/bsd/drm2/pci/drmfb_pci.c:1.1	Thu Mar  5 17:50:41 2015
+++ src/sys/external/bsd/drm2/pci/drmfb_pci.c	Thu Mar  5 17:56:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmfb_pci.c,v 1.1 2015/03/05 17:50:41 riastradh Exp $	*/
+/*	$NetBSD: drmfb_pci.c,v 1.2 2015/03/05 17:56:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drmfb_pci.c,v 1.1 2015/03/05 17:50:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drmfb_pci.c,v 1.2 2015/03/05 17:56:39 riastradh Exp $");
+
+#ifdef _KERNEL_OPT
+#include "vga.h"
+#endif
 
 #include 
 #include 
@@ -46,6 +50,18 @@ __KERNEL_RCSID(0, "$NetBSD: drmfb_pci.c,
 #include 
 #include 
 
+#if NVGA > 0
+/*
+ * XXX All we really need is vga_is_console from vgavar.h, but the
+ * header files are missing their own dependencies, so we need to
+ * explicitly drag in the other crap.
+ */
+#include 
+#include 
+#include 
+#include 
+#endif
+
 #include 
 #include 
 
@@ -132,3 +148,14 @@ drmfb_pci_ioctl(struct drmfb_softc *sc, 
 		return EPASSTHROUGH;
 	}
 }
+
+bool
+drmfb_pci_is_vga_console(struct drm_device *dev)
+{
+
+#if NVGA > 0
+	return vga_is_console(dev->pdev->pd_pa.pa_iot, -1);
+#else
+	return false;
+#endif
+}



CVS commit: src/sys/external/bsd/drm2

2015-03-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar  6 01:24:24 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drmP.h
src/sys/external/bsd/drm2/pci: drm_pci.c drm_pci_module.c

Log Message:
Adapt drmkms_pci module initialization to work as builtin, for agp.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/pci/drm_pci.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/pci/drm_pci_module.c

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/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.9 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.10
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.9	Tue Dec  2 21:49:36 2014
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Fri Mar  6 01:24:24 2015
@@ -1751,6 +1751,7 @@ extern drm_dma_handle_t *drm_pci_alloc(s
 extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
 extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
 #ifdef __NetBSD__
+extern int drmkms_pci_agp_guarantee_initialized(void);
 extern int drm_pci_attach(device_t, const struct pci_attach_args *,
 struct pci_dev *, struct drm_driver *, unsigned long,
 struct drm_device **);

Index: src/sys/external/bsd/drm2/pci/drm_pci.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci.c:1.9 src/sys/external/bsd/drm2/pci/drm_pci.c:1.10
--- src/sys/external/bsd/drm2/pci/drm_pci.c:1.9	Thu Jan  1 01:15:43 2015
+++ src/sys/external/bsd/drm2/pci/drm_pci.c	Fri Mar  6 01:24:24 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_pci.c,v 1.9 2015/01/01 01:15:43 mrg Exp $	*/
+/*	$NetBSD: drm_pci.c,v 1.10 2015/03/06 01:24:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.9 2015/01/01 01:15:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.10 2015/03/06 01:24:24 riastradh Exp $");
 
 #include 
 #include 
@@ -94,6 +94,12 @@ drm_pci_attach(device_t self, const stru
 	unsigned int unit;
 	int ret;
 
+	/* Ensure the drm agp hooks are installed.  */
+	/* XXX errno NetBSD->Linux */
+	ret = -drmkms_pci_agp_guarantee_initialized();
+	if (ret)
+		goto fail0;
+
 	/* Initialize the Linux PCI device descriptor.  */
 	linux_pci_dev_init(pdev, self, pa, 0);
 

Index: src/sys/external/bsd/drm2/pci/drm_pci_module.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci_module.c:1.3 src/sys/external/bsd/drm2/pci/drm_pci_module.c:1.4
--- src/sys/external/bsd/drm2/pci/drm_pci_module.c:1.3	Sat Nov 22 19:18:07 2014
+++ src/sys/external/bsd/drm2/pci/drm_pci_module.c	Fri Mar  6 01:24:24 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_pci_module.c,v 1.3 2014/11/22 19:18:07 riastradh Exp $	*/
+/*	$NetBSD: drm_pci_module.c,v 1.4 2015/03/06 01:24:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_pci_module.c,v 1.3 2014/11/22 19:18:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci_module.c,v 1.4 2015/03/06 01:24:24 riastradh Exp $");
 
 #include 
+#include 
 
 #include 
 
@@ -52,19 +53,54 @@ const struct drm_agp_hooks drmkms_pci_ag
 };
 
 static int
+drmkms_pci_agp_init(void)
+{
+	int error;
+
+	error = drm_agp_register(&drmkms_pci_agp_hooks);
+	if (error)
+		return error;
+
+	return 0;
+}
+
+int
+drmkms_pci_agp_guarantee_initialized(void)
+{
+#ifdef _MODULE
+	return 0;
+#else
+	static ONCE_DECL(drmkms_pci_agp_init_once);
+
+	return RUN_ONCE(&drmkms_pci_agp_init_once, &drmkms_pci_agp_init);
+#endif
+}
+
+static void
+drmkms_pci_agp_fini(void)
+{
+
+	drm_agp_deregister(&drmkms_pci_agp_hooks);
+}
+
+static int
 drmkms_pci_modcmd(modcmd_t cmd, void *arg __unused)
 {
 	int error;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		error = drm_agp_register(&drmkms_pci_agp_hooks);
+#ifdef _MODULE
+		error = drmkms_pci_agp_init();
+#else
+		error = drmkms_pci_agp_guarantee_initialized();
+#endif
 		if (error)
 			return error;
 		return 0;
 
 	case MODULE_CMD_FINI:
-		drm_agp_deregister(&drmkms_pci_agp_hooks);
+		drmkms_pci_agp_fini();
 		return 0;
 
 	default:



CVS commit: src/sys/external/bsd/drm2

2015-03-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar  6 01:43:07 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_bo.h nouveau_drm.c
nouveau_fbcon.c nouveau_vga.h
src/sys/external/bsd/drm2/include/linux: pci.h reboot.h
src/sys/external/bsd/drm2/nouveau: files.nouveau
src/sys/external/bsd/drm2/pci: drm_pci.c
Added Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c nouveau_pci.h
nouveau_sysfs.c nouveau_vga.c nouveaufb.c nouveaufb.h

Log Message:
One last round for nouveau.  It links!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.h
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_vga.h
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/pci.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/reboot.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c \
src/sys/external/bsd/drm2/nouveau/nouveau_pci.h \
src/sys/external/bsd/drm2/nouveau/nouveau_sysfs.c \
src/sys/external/bsd/drm2/nouveau/nouveau_vga.c \
src/sys/external/bsd/drm2/nouveau/nouveaufb.c \
src/sys/external/bsd/drm2/nouveau/nouveaufb.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/pci/drm_pci.c

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/dist/drm/nouveau/nouveau_bo.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.h:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.h:1.2	Wed Aug  6 13:35:13 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.h	Fri Mar  6 01:43:07 2015
@@ -1,8 +1,12 @@
 #ifndef __NOUVEAU_BO_H__
 #define __NOUVEAU_BO_H__
 
+#include 
+
 struct nouveau_channel;
+struct nouveau_drm;
 struct nouveau_fence;
+struct nouveau_vm;
 struct nouveau_vma;
 
 struct nouveau_bo {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.3	Sat Aug 23 08:03:33 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c	Fri Mar  6 01:43:07 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_drm.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $	*/
+/*	$NetBSD: nouveau_drm.c,v 1.4 2015/03/06 01:43:07 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.4 2015/03/06 01:43:07 riastradh Exp $");
 
 #include 
 #include 
@@ -539,7 +539,6 @@ nouveau_drm_remove(struct pci_dev *pdev)
 }
 #endif
 
-#ifndef __NetBSD__		/* XXX nouveau pm */
 static int
 nouveau_do_suspend(struct drm_device *dev, bool runtime)
 {
@@ -625,9 +624,11 @@ int nouveau_pmops_suspend(struct device 
 	if (ret)
 		return ret;
 
+#ifndef __NetBSD__		/* pmf handles this for us.  */
 	pci_save_state(pdev);
 	pci_disable_device(pdev);
 	pci_set_power_state(pdev, PCI_D3hot);
+#endif
 	return 0;
 }
 
@@ -673,12 +674,14 @@ int nouveau_pmops_resume(struct device *
 	drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
 		return 0;
 
+#ifndef __NetBSD__		/* pmf handles this for us */
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 	ret = pci_enable_device(pdev);
 	if (ret)
 		return ret;
 	pci_set_master(pdev);
+#endif
 
 	ret = nouveau_do_resume(drm_dev);
 	if (ret)
@@ -692,6 +695,7 @@ int nouveau_pmops_resume(struct device *
 	return 0;
 }
 
+#ifndef __NetBSD__		/* XXX nouveau pm */
 static int nouveau_pmops_freeze(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c:1.1.1.2	Wed Aug  6 12:36:23 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c	Fri Mar  6 01:43:07 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_fbcon.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $	*/
+/*	$NetBSD: nouveau_fbcon.c,v 1.2 2015/03/06 01:43:07 riastradh Exp $	*/
 
 /*
  * Copyright © 2007 David Airlie
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_fbcon.c,v 1.1.1.2 2014/08/06 12:36:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_fbcon.c,v 1.2 2015/03/06 

CVS commit: src/sys/external/bsd/drm2

2015-03-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar  6 13:44:19 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
nouveau_engine_device_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core: device.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc:
nouveau_subdev_mc_base.c
src/sys/external/bsd/drm2/pci: drm_pci.c

Log Message:
Simplify drm shenanigans with irrelevant irq numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/pci/drm_pci.c

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/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.3	Sat Aug 23 08:03:33 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c	Fri Mar  6 13:44:18 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_engine_device_base.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $	*/
+/*	$NetBSD: nouveau_engine_device_base.c,v 1.4 2015/03/06 13:44:18 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.3 2014/08/23 08:03:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.4 2015/03/06 13:44:18 riastradh Exp $");
 
 #include 
 #include 
@@ -599,33 +599,18 @@ nv_device_unmap_page(struct nouveau_devi
 		pci_unmap_page(device->pdev, addr, PAGE_SIZE,
 			   PCI_DMA_BIDIRECTIONAL);
 }
-#endif
 
 int
 nv_device_get_irq(struct nouveau_device *device, bool stall)
 {
 	if (nv_device_is_pci(device)) {
-#ifdef __NetBSD__
-		pci_intr_handle_t ih;
-
-		CTASSERT(sizeof ih <= sizeof(int)); /* XXX */
-		if (pci_intr_map(&device->pdev->pd_pa, &ih))
-			panic("unable to map nouveau interrupt"); /* XXX */
-
-		return ih;
-#else
 		return device->pdev->irq;
-#endif
 	} else {
-#ifdef __NetBSD__
-		/* XXX nouveau platform device */
-		panic("can't handle non-PCI nouveau devices");
-#else
 		return platform_get_irq_byname(device->platformdev,
 	   stall ? "stall" : "nonstall");
-#endif
 	}
 }
+#endif
 
 static struct nouveau_oclass
 nouveau_device_oclass = {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h:1.3	Sat Aug 23 08:03:34 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h	Fri Mar  6 13:44:18 2015
@@ -173,9 +173,9 @@ nv_device_map_page(struct nouveau_device
 
 void
 nv_device_unmap_page(struct nouveau_device *device, dma_addr_t addr);
-#endif
 
 int
 nv_device_get_irq(struct nouveau_device *device, bool stall);
+#endif
 
 #endif

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c:1.2	Wed Feb 25 17:29:43 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c	Fri Mar  6 13:44:18 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_subdev_mc_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $	*/
+/*	$NetBSD: nouveau_subdev_mc_base.c,v 1.3 2015/03/06 13:44:18 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mc_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mc_base.c,v 1.3 2015/03/06 13:44:18 riastradh Exp $");
 
 #include 
 #include 
@@ -162,22 +162,25 @@ nouveau_mc_create_(struct nouveau_object
 		}
 	}
 
-	ret = nv_device_get_irq(device, true);
-	if (ret < 0)
-		return ret;
-	pmc->irq = ret;
-
-#ifdef __NetBSD__
+#ifdef __NetBSD__		/* XXX nouveau platform */
 	if (nv_device_is_pci(device)) {
 		const pci_chipset_tag_t pc = device->pdev->pd_pa.pa_pc;
+		pci_intr_handle_t ih;
 
-		__CTASSERT(sizeof(pci_intr_handle_t) <=

CVS commit: src/sys/external/bsd/drm2

2015-03-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar  6 15:39:28 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_drm.c
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
Create the nouveau device object so the driver can start.

I get a lot of messages on the console and then it hangs.  Progress!

Next to try with a breakfast console.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

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/dist/drm/nouveau/nouveau_drm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.4	Fri Mar  6 01:43:07 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c	Fri Mar  6 15:39:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_drm.c,v 1.4 2015/03/06 01:43:07 riastradh Exp $	*/
+/*	$NetBSD: nouveau_drm.c,v 1.5 2015/03/06 15:39:28 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.4 2015/03/06 01:43:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.5 2015/03/06 15:39:28 riastradh Exp $");
 
 #include 
 #include 
@@ -64,11 +64,11 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_drm.
 #include "nouveau_debugfs.h"
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
-static char *nouveau_config;
+char *nouveau_config;
 module_param_named(config, nouveau_config, charp, 0400);
 
 MODULE_PARM_DESC(debug, "debug string to pass to driver core");
-static char *nouveau_debug;
+char *nouveau_debug;
 module_param_named(debug, nouveau_debug, charp, 0400);
 
 MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration");

Index: src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.2 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.3
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.2	Fri Mar  6 15:08:02 2015
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Fri Mar  6 15:39:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.2 2015/03/06 15:08:02 riastradh Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.3 2015/03/06 15:39:28 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.2 2015/03/06 15:08:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.3 2015/03/06 15:39:28 riastradh Exp $");
 
 #include 
 #include 
@@ -39,6 +39,8 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.
 
 #include 
 
+#include 
+
 #include "nouveau_drm.h"
 #include "nouveau_pci.h"
 
@@ -56,6 +58,7 @@ struct nouveau_softc {
 	}			sc_task_u;
 	struct drm_device	*sc_drm_dev;
 	struct pci_dev		sc_pci_dev;
+	struct nouveau_device	*sc_nv_dev;
 };
 
 static int	nouveau_match(device_t, cfdata_t, void *);
@@ -96,11 +99,15 @@ nouveau_match(device_t parent, cfdata_t 
 	return 6;		/* XXX Beat genfb_pci...  */
 }
 
+extern char *nouveau_config;
+extern char *nouveau_debug;
+
 static void
 nouveau_attach(device_t parent, device_t self, void *aux)
 {
 	struct nouveau_softc *const sc = device_private(self);
 	const struct pci_attach_args *const pa = aux;
+	uint64_t devname;
 	int error;
 
 	pci_aprint_devinfo(pa, NULL);
@@ -114,6 +121,18 @@ nouveau_attach(device_t parent, device_t
 	sc->sc_task_state = NOUVEAU_TASK_ATTACH;
 	SIMPLEQ_INIT(&sc->sc_task_u.attach);
 
+	devname = (uint64_t)device_unit(device_parent(self)) << 32;
+	devname |= pa->pa_bus << 16;
+	/* XXX errno Linux->NetBSD */
+	error = -nouveau_device_create(&sc->sc_pci_dev, NOUVEAU_BUS_PCI,
+	devname, device_xname(self), nouveau_config, nouveau_debug,
+	&sc->sc_nv_dev);
+	if (error) {
+		aprint_error_dev(self, "unable to create nouveau device: %d\n",
+		error);
+		return;
+	}
+
 	/* XXX errno Linux->NetBSD */
 	error = -drm_pci_attach(self, pa, &sc->sc_pci_dev, nouveau_drm_driver,
 	0, &sc->sc_drm_dev);
@@ -153,14 +172,17 @@ nouveau_detach(device_t self, int flags)
 		return error;
 
 	if (sc->sc_task_state == NOUVEAU_TASK_ATTACH)
-		goto out;
+		goto out0;
 	if (sc->sc_task_u.workqueue != NULL) {
 		workqueue_destroy(sc->sc_task_u.workqueue);
 		sc->sc_task_u.workqueue = NULL;
 	}
 
+	if (sc->sc_nv_dev == NULL)
+		goto out0;
+
 	if (sc->sc_drm_dev == NULL)
-		goto out;
+		goto out1;
 	/* XXX errno Linux->NetBSD */
 	error = -drm_pci_detach(sc->sc_drm_dev, flags);
 	if (error)
@@ -168,7 +190,8 @@ nouveau_detach(device_t self, int flags)
 		return error;
 	sc->sc_drm_dev = NULL;
 
-out:	pmf_device_deregister(self);
+out1:	nouveau_object_ref(NULL, (void *)&sc->sc_nv_dev);
+out0:	pmf_device_deregister(self);

CVS commit: src/sys/external/bsd/drm2

2015-04-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr  4 15:12:39 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/i915drm: intelfb.c
src/sys/external/bsd/drm2/nouveau: nouveaufb.c

Log Message:
pmf_device_register returns false on failure, not true


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/i915drm/intelfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/nouveau/nouveaufb.c

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/i915drm/intelfb.c
diff -u src/sys/external/bsd/drm2/i915drm/intelfb.c:1.12 src/sys/external/bsd/drm2/i915drm/intelfb.c:1.13
--- src/sys/external/bsd/drm2/i915drm/intelfb.c:1.12	Thu Mar  5 17:56:39 2015
+++ src/sys/external/bsd/drm2/i915drm/intelfb.c	Sat Apr  4 15:12:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intelfb.c,v 1.12 2015/03/05 17:56:39 riastradh Exp $	*/
+/*	$NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.12 2015/03/05 17:56:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $");
 
 #include 
 #include 
@@ -180,7 +180,7 @@ intelfb_attach_task(struct i915drmkms_ta
 		return;
 	}
 
-	if (pmf_device_register1(sc->sc_dev, NULL, NULL, &intelfb_shutdown))
+	if (!pmf_device_register1(sc->sc_dev, NULL, NULL, &intelfb_shutdown))
 		aprint_error_dev(sc->sc_dev,
 		"failed to register shutdown handler\n");
 

Index: src/sys/external/bsd/drm2/nouveau/nouveaufb.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.1 src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.2
--- src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.1	Fri Mar  6 01:43:07 2015
+++ src/sys/external/bsd/drm2/nouveau/nouveaufb.c	Sat Apr  4 15:12:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveaufb.c,v 1.1 2015/03/06 01:43:07 riastradh Exp $	*/
+/*	$NetBSD: nouveaufb.c,v 1.2 2015/04/04 15:12:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveaufb.c,v 1.1 2015/03/06 01:43:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveaufb.c,v 1.2 2015/04/04 15:12:39 jmcneill Exp $");
 
 #include 
 #include 
@@ -158,7 +158,7 @@ nouveaufb_attach_task(struct nouveau_tas
 		return;
 	}
 
-	if (pmf_device_register1(sc->sc_dev, NULL, NULL, &nouveaufb_shutdown))
+	if (!pmf_device_register1(sc->sc_dev, NULL, NULL, &nouveaufb_shutdown))
 		aprint_error_dev(sc->sc_dev,
 		"failed to register shutdown handler\n");
 



CVS commit: src/sys/external/bsd/drm2

2015-04-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Apr 13 22:24:34 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/drm: drm_module.c
src/sys/external/bsd/drm2/linux: linux_module.c

Log Message:
Update module dependencies:

drmkms does not depend on iic
drmkms_linux depends on i2cexec


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/drm/drm_module.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/linux/linux_module.c

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/drm/drm_module.c
diff -u src/sys/external/bsd/drm2/drm/drm_module.c:1.10 src/sys/external/bsd/drm2/drm/drm_module.c:1.11
--- src/sys/external/bsd/drm2/drm/drm_module.c:1.10	Thu Mar  5 17:42:48 2015
+++ src/sys/external/bsd/drm2/drm/drm_module.c	Mon Apr 13 22:24:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_module.c,v 1.10 2015/03/05 17:42:48 riastradh Exp $	*/
+/*	$NetBSD: drm_module.c,v 1.11 2015/04/13 22:24:34 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.10 2015/03/05 17:42:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.11 2015/04/13 22:24:34 pgoyette Exp $");
 
 #include 
 #include 
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: drm_module.c
 /*
  * XXX I2C stuff should be moved to a separate drmkms_i2c module.
  */
-MODULE(MODULE_CLASS_DRIVER, drmkms, "iic,drmkms_linux");
+MODULE(MODULE_CLASS_DRIVER, drmkms, "drmkms_linux");
 
 struct mutex	drm_global_mutex;
 

Index: src/sys/external/bsd/drm2/linux/linux_module.c
diff -u src/sys/external/bsd/drm2/linux/linux_module.c:1.5 src/sys/external/bsd/drm2/linux/linux_module.c:1.6
--- src/sys/external/bsd/drm2/linux/linux_module.c:1.5	Tue Nov 11 02:37:17 2014
+++ src/sys/external/bsd/drm2/linux/linux_module.c	Mon Apr 13 22:24:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_module.c,v 1.5 2014/11/11 02:37:17 christos Exp $	*/
+/*	$NetBSD: linux_module.c,v 1.6 2015/04/13 22:24:34 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_module.c,v 1.5 2014/11/11 02:37:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_module.c,v 1.6 2015/04/13 22:24:34 pgoyette Exp $");
 
 #include 
 #ifndef _MODULE
@@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_module
 #include 
 #include 
 
-MODULE(MODULE_CLASS_MISC, drmkms_linux, NULL);
+MODULE(MODULE_CLASS_MISC, drmkms_linux, "i2cexec");
 
 DEFINE_WW_CLASS(reservation_ww_class __cacheline_aligned);
 



CVS commit: src/sys/external/bsd/drm2

2015-04-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 29 04:38:56 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_bufs.c
src/sys/external/bsd/drm2/dist/include/drm: drmP.h
src/sys/external/bsd/drm2/drm: drm_memory.c
src/sys/external/bsd/drm2/pci: drm_pci.c

Log Message:
Replace drm_ioremap by drm_core_ioremap, reducing diff a little.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/drm/drm_memory.c
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/pci/drm_pci.c

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/dist/drm/drm_bufs.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.6 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.6	Wed Jul 16 20:56:24 2014
+++ src/sys/external/bsd/drm2/dist/drm/drm_bufs.c	Wed Apr 29 04:38:55 2015
@@ -213,7 +213,7 @@ static int drm_addmap_core(struct drm_de
 		}
 		if (map->type == _DRM_REGISTERS) {
 #ifdef __NetBSD__
-			map->handle = drm_ioremap(dev, map);
+			drm_core_ioremap(map, dev);
 #else
 			if (map->flags & _DRM_WRITE_COMBINING)
 map->handle = ioremap_wc(map->offset,
@@ -351,7 +351,7 @@ static int drm_addmap_core(struct drm_de
 	if (!list) {
 		if (map->type == _DRM_REGISTERS)
 #ifdef __NetBSD__
-			drm_iounmap(dev, map);
+			drm_core_ioremapfree(map, dev);
 #else
 			iounmap(map->handle);
 #endif
@@ -372,7 +372,7 @@ static int drm_addmap_core(struct drm_de
 	if (ret) {
 		if (map->type == _DRM_REGISTERS)
 #ifdef __NetBSD__		/* XXX What about other map types...?  */
-			drm_iounmap(dev, map);
+			drm_core_ioremapfree(map, dev);
 #else
 			iounmap(map->handle);
 #endif
@@ -494,7 +494,7 @@ int drm_rmmap_locked(struct drm_device *
 	switch (map->type) {
 	case _DRM_REGISTERS:
 #ifdef __NetBSD__
-		drm_iounmap(dev, map);
+		drm_core_ioremapfree(map, dev);
 #else
 		iounmap(map->handle);
 #endif

Index: src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.10 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.11
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.10	Fri Mar  6 01:24:24 2015
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Wed Apr 29 04:38:55 2015
@@ -1437,9 +1437,7 @@ extern unsigned int drm_poll(struct file
 
 /* Memory management support (drm_memory.h) */
 #include 
-#ifdef __NetBSD__		/* XXX move to drm_memory.h */
-extern void *drm_ioremap(struct drm_device *dev, struct drm_local_map *map);
-extern void drm_iounmap(struct drm_device *dev, struct drm_local_map *map);
+#ifdef __NetBSD__
 extern int drm_limit_dma_space(struct drm_device *, resource_size_t,
 resource_size_t);
 #endif

Index: src/sys/external/bsd/drm2/drm/drm_memory.c
diff -u src/sys/external/bsd/drm2/drm/drm_memory.c:1.6 src/sys/external/bsd/drm2/drm/drm_memory.c:1.7
--- src/sys/external/bsd/drm2/drm/drm_memory.c:1.6	Wed Jul 16 20:56:25 2014
+++ src/sys/external/bsd/drm2/drm/drm_memory.c	Wed Apr 29 04:38:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_memory.c,v 1.6 2014/07/16 20:56:25 riastradh Exp $	*/
+/*	$NetBSD: drm_memory.c,v 1.7 2015/04/29 04:38:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_memory.c,v 1.6 2014/07/16 20:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_memory.c,v 1.7 2015/04/29 04:38:55 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "agp_i810.h"
@@ -74,8 +74,8 @@ drm_bus_borrow(bus_addr_t base, bus_size
 	return false;
 }
 
-void *
-drm_ioremap(struct drm_device *dev, struct drm_local_map *map)
+void
+drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
 {
 	const bus_space_tag_t bst = dev->bst;
 	unsigned int unit;
@@ -125,19 +125,20 @@ drm_ioremap(struct drm_device *dev, stru
 	}
 
 	/* Failure!  */
-	return NULL;
+	return;
 
 win:	map->lm_data.bus_space.bst = bst;
-	return bus_space_vaddr(bst, map->lm_data.bus_space.bsh);
+	map->handle = bus_space_vaddr(bst, map->lm_data.bus_space.bsh);
 }
 
 void
-drm_iounmap(struct drm_device *dev, struct drm_local_map *map)
+drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
 {
 	if (map->lm_data.bus_space.bus_map != NULL) {
 		bus_space_unmap(map->lm_data.bus_space.bst,
 		map->lm_data.bus_space.bsh, map->size);
 		map->lm_data.bus_space.bus_map = NULL;
+		map->handle = NULL;
 	}
 }
 

Index: src/sys/external/bsd/drm2/pci/drm_pci.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci.c:1.12 src/sys/external/bsd/drm2/pci/drm_pci.c:1.13
--- src/sys/external/bsd/drm2/pci/drm_pci.c:1.12	Fri Mar  6 13:44:18 2015
+++ src/sys/external/bsd/drm2/pci/drm_pci.c	Wed Apr 29 04:38:55 2015
@@ -1,4 +1,4 @

CVS commit: src/sys/external/bsd/drm2

2015-04-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 29 04:45:03 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/via: via_drv.c via_drv.h via_irq.c
src/sys/external/bsd/drm2/pci: files.drmkms_pci
src/sys/external/bsd/drm2/via: files.via

Log Message:
Make viadrm (UMS) almost build.

Missing part: something needs to issue config_found_ia("drmums_pci"),
and config(5) needs to be told that it will do that.  The sensible
approach is for vga_pci to do so.  But config(5) doesn't seem to
understand that *only* vga_pci will do that, not all vga.

The old scheme was to tell config(5) that vga would always attach
drm, and actually attach it in vga_pci, and hope that nobody would
ever consider trying to attach non-PCI devices but quietly leave the
token `pci' out of the name of the drm interface attribute so it
didn't look wrong to have it outside dev/pci/files.pci.

Maybe that's still the right thing, as far as anything UMS can be
right.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/sys/external/bsd/drm2/dist/drm/via/via_drv.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/via/via_drv.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/via/via_irq.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/pci/files.drmkms_pci
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/via/files.via

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/dist/drm/via/via_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_drv.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/via/via_drv.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/via/via_drv.c:1.1.1.2	Wed Jul 16 19:35:29 2014
+++ src/sys/external/bsd/drm2/dist/drm/via/via_drv.c	Wed Apr 29 04:45:03 2015
@@ -53,6 +53,7 @@ static void via_driver_postclose(struct 
 	kfree(file_priv);
 }
 
+#ifndef __NetBSD__
 static struct pci_device_id pciidlist[] = {
 	viadrv_PCI_IDS
 };
@@ -69,6 +70,7 @@ static const struct file_operations via_
 #endif
 	.llseek = noop_llseek,
 };
+#endif
 
 static struct drm_driver driver = {
 	.driver_features =
@@ -90,7 +92,9 @@ static struct drm_driver driver = {
 	.dma_quiescent = via_driver_dma_quiescent,
 	.lastclose = via_lastclose,
 	.ioctls = via_ioctls,
+#ifndef __NetBSD__
 	.fops = &via_driver_fops,
+#endif
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
 	.date = DRIVER_DATE,
@@ -99,9 +103,14 @@ static struct drm_driver driver = {
 	.patchlevel = DRIVER_PATCHLEVEL,
 };
 
+#ifdef __NetBSD__
+struct drm_driver *const via_drm_driver = &driver;
+#endif
+
+#ifndef __NetBSD__
 static struct pci_driver via_pci_driver = {
 	.name = DRIVER_NAME,
-	.id_table = pciidlist,
+	.id_table = viadrm_pciidlist,
 };
 
 static int __init via_init(void)
@@ -115,6 +124,7 @@ static void __exit via_exit(void)
 {
 	drm_pci_exit(&driver, &via_pci_driver);
 }
+#endif	/* __NetBSD__ */
 
 module_init(via_init);
 module_exit(via_exit);

Index: src/sys/external/bsd/drm2/dist/drm/via/via_drv.h
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_drv.h:1.3 src/sys/external/bsd/drm2/dist/drm/via/via_drv.h:1.4
--- src/sys/external/bsd/drm2/dist/drm/via/via_drv.h:1.3	Sat Feb 28 18:25:39 2015
+++ src/sys/external/bsd/drm2/dist/drm/via/via_drv.h	Wed Apr 29 04:45:03 2015
@@ -152,7 +152,7 @@ extern u32 via_get_vblank_counter(struct
 extern int via_enable_vblank(struct drm_device *dev, int crtc);
 extern void via_disable_vblank(struct drm_device *dev, int crtc);
 
-extern irqreturn_t via_driver_irq_handler(int irq, void *arg);
+extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
 extern void via_driver_irq_preinstall(struct drm_device *dev);
 extern int via_driver_irq_postinstall(struct drm_device *dev);
 extern void via_driver_irq_uninstall(struct drm_device *dev);

Index: src/sys/external/bsd/drm2/dist/drm/via/via_irq.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_irq.c:1.4 src/sys/external/bsd/drm2/dist/drm/via/via_irq.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/via/via_irq.c:1.4	Sat Feb 28 18:25:39 2015
+++ src/sys/external/bsd/drm2/dist/drm/via/via_irq.c	Wed Apr 29 04:45:03 2015
@@ -104,7 +104,7 @@ u32 via_get_vblank_counter(struct drm_de
 	return atomic_read(&dev_priv->vbl_received);
 }
 
-irqreturn_t via_driver_irq_handler(int irq, void *arg)
+irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;

Index: src/sys/external/bsd/drm2/pci/files.drmkms_pci
diff -u src/sys/external/bsd/drm2/pci/files.drmkms_pci:1.5 src/sys/external/bsd/drm2/pci/files.drmkms_pci:1.6
--- src/sys/external/bsd/drm2/pci/files.drmkms_pci:1.5	Thu Mar  5 17:50:41 2015
+++ src/sys/external/bsd/drm2/pci/files.drmkms_pci	Wed Apr 29 04:45:03 2015
@@ -1,7 +1,14 @@
-#	$NetBSD: files.drmkms_pci,v 1.5 2015/03/05 17:50:41 riastradh Exp $
+#	$NetBSD: files.drmkms_pci,v 1.6 2015/04/29 04:45:03 r

CVS commit: src/sys/external/bsd/drm2

2015-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 29 11:25:36 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/via: via_video.c
Added Files:
src/sys/external/bsd/drm2/via: via_module.c via_pci.c

Log Message:
Add the missing viadrm files omitted last night.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/via/via_video.c
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/via/via_module.c \
src/sys/external/bsd/drm2/via/via_pci.c

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/dist/drm/via/via_video.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_video.c:1.4 src/sys/external/bsd/drm2/dist/drm/via/via_video.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/via/via_video.c:1.4	Sat Feb 28 18:25:39 2015
+++ src/sys/external/bsd/drm2/dist/drm/via/via_video.c	Wed Apr 29 11:25:36 2015
@@ -116,10 +116,10 @@ int via_decoder_futex(struct drm_device 
 		return ret;
 	case VIA_FUTEX_WAKE:
 #ifdef __NetBSD__
-		mutex_lock(&dev_priv->decoder_lock[fx->lock]);
-		DRM_WAKEUP_ALL(&dev_priv->decoder_queue[fx->lock],
+		spin_lock(&dev_priv->decoder_lock[fx->lock]);
+		DRM_SPIN_WAKEUP_ALL(&dev_priv->decoder_queue[fx->lock],
 		&dev_priv->decoder_lock[fx->lock]);
-		mutex_unlock(&dev_priv->decoder_lock[fx->lock]);
+		spin_unlock(&dev_priv->decoder_lock[fx->lock]);
 #else
 		wake_up(&(dev_priv->decoder_queue[fx->lock]));
 #endif

Added files:

Index: src/sys/external/bsd/drm2/via/via_module.c
diff -u /dev/null src/sys/external/bsd/drm2/via/via_module.c:1.1
--- /dev/null	Wed Apr 29 11:25:36 2015
+++ src/sys/external/bsd/drm2/via/via_module.c	Wed Apr 29 11:25:36 2015
@@ -0,0 +1,139 @@
+/*	$NetBSD: via_module.c,v 1.1 2015/04/29 11:25:36 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2015 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.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: via_module.c,v 1.1 2015/04/29 11:25:36 riastradh Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "via_drv.h"
+
+MODULE(MODULE_CLASS_DRIVER, viadrmums, "drmkms,drmkms_pci");
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+extern struct drm_driver *const via_drm_driver; /* XXX */
+
+static int
+viadrm_init(void)
+{
+	extern int drm_guarantee_initialized(void);
+	int error;
+
+	via_init_command_verifier(); /* idempotent, no unwind needed */
+
+	error = drm_guarantee_initialized();
+	if (error)
+		return error;
+
+	error = drm_pci_init(via_drm_driver, NULL);
+	if (error) {
+		aprint_error("i915drmkms: failed to init pci: %d\n",
+		error);
+		return error;
+	}
+
+	return 0;
+}
+
+int	viadrm_guarantee_initialized(void); /* XXX */
+int
+viadrm_guarantee_initialized(void)
+{
+#ifdef _MODULE
+	return 0;
+#else
+	static ONCE_DECL(viadrm_init_once);
+
+	return RUN_ONCE(&viadrm_init_once, &viadrm_init);
+#endif
+}
+
+static void
+viadrm_fini(void)
+{
+
+	drm_pci_exit(via_drm_driver, NULL);
+}
+
+static int
+viadrmums_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	int error;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = viadrm_init();
+#else
+		error = viadrm_guarantee_initialized();
+#endif
+		if (error) {
+			aprint_error("viadrmums: failed to initialize: %d\n",
+			error);
+			return error;
+		}
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_viadrmums,
+		cfattach_ioconf_viadrmums, cfdata_ioconf_viadrmums);
+		if (error) {
+			aprint_error("viadrmums: failed

CVS commit: src/sys/external/bsd/drm2

2015-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 29 11:28:33 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/pci: files.drmkms_pci
src/sys/external/bsd/drm2/via: files.via

Log Message:
Just use `drm' for DRM/UMS PCI attachments at PCI devices.

It'll make life simpler.  No need to distinguish drm from drm2 here
because it's just an interface attribute, no content, and we use it
compatibly: parent provides pci_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/pci/files.drmkms_pci
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/via/files.via

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/pci/files.drmkms_pci
diff -u src/sys/external/bsd/drm2/pci/files.drmkms_pci:1.6 src/sys/external/bsd/drm2/pci/files.drmkms_pci:1.7
--- src/sys/external/bsd/drm2/pci/files.drmkms_pci:1.6	Wed Apr 29 04:45:03 2015
+++ src/sys/external/bsd/drm2/pci/files.drmkms_pci	Wed Apr 29 11:28:32 2015
@@ -1,14 +1,11 @@
-#	$NetBSD: files.drmkms_pci,v 1.6 2015/04/29 04:45:03 riastradh Exp $
+#	$NetBSD: files.drmkms_pci,v 1.7 2015/04/29 11:28:32 riastradh Exp $
 
 # Attribute for kernel components supporting PCI-based real graphics
-# drivers, a.k.a. `drmkms' (kernel mode-setting).
+# drivers, a.k.a. `KMS' (kernel mode-setting), as opposed to the legacy
+# `drm' interface attribute, which is where PCI-based fake graphics
+# drivers, a.k.a. `UMS' (user mode-setting), attach.
 define	drmkms_pci: drmkms
 
-# Interface attribute for attaching PCI-based fake graphics drivers,
-# a.k.a. `drmums' (user mode-setting).  This uses all the same support
-# code as PCI-based KMS drivers but has a bogus attachment via vga(4).
-define	drmums_pci {}: drmkms_pci
-
 # XXX Not quite right!  Should AGP stuff be kept separate?
 makeoptions	drmkms_pci	CPPFLAGS+="-DCONFIG_AGP"
 

Index: src/sys/external/bsd/drm2/via/files.via
diff -u src/sys/external/bsd/drm2/via/files.via:1.2 src/sys/external/bsd/drm2/via/files.via:1.3
--- src/sys/external/bsd/drm2/via/files.via:1.2	Wed Apr 29 04:45:03 2015
+++ src/sys/external/bsd/drm2/via/files.via	Wed Apr 29 11:28:32 2015
@@ -1,7 +1,7 @@
-#	$NetBSD: files.via,v 1.2 2015/04/29 04:45:03 riastradh Exp $
+#	$NetBSD: files.via,v 1.3 2015/04/29 11:28:32 riastradh Exp $
 
-device	viadrmums
-attach	viadrmums at drmums_pci
+device	viadrmums: drmkms, drmkms_pci
+attach	viadrmums at drm
 
 makeoptions	viadrmums	CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/via"
 makeoptions	viadrmums	CPPFLAGS+="-I$S/external/bsd/drm2/via"
@@ -19,3 +19,4 @@ file	external/bsd/drm2/dist/drm/via/via_
 file	external/bsd/drm2/dist/drm/via/via_video.c		viadrmums
 
 file	external/bsd/drm2/via/via_pci.cviadrmums
+file	external/bsd/drm2/via/via_module.c			viadrmums



CVS commit: src/sys/external/bsd/drm2

2015-10-17 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 17 21:13:38 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
nouveau_engine_device_base.c
src/sys/external/bsd/drm2/include/linux: platform_device.h

Log Message:
support for non-PCI devices


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/include/linux/platform_device.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/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.4	Fri Mar  6 13:44:18 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c	Sat Oct 17 21:13:38 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_engine_device_base.c,v 1.4 2015/03/06 13:44:18 riastradh Exp $	*/
+/*	$NetBSD: nouveau_engine_device_base.c,v 1.5 2015/10/17 21:13:38 jmcneill Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.4 2015/03/06 13:44:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.5 2015/10/17 21:13:38 jmcneill Exp $");
 
 #include 
 #include 
@@ -528,8 +528,8 @@ nv_device_resource_tag(struct nouveau_de
 		else
 			return pa->pa_iot;
 	} else {
-		/* XXX nouveau platform device */
-		panic("can't handle non-PCI nouveau devices");
+		KASSERT(bar < device->platformdev->nresource);
+		return device->platformdev->resource[bar].tag;
 	}
 }
 #endif
@@ -541,8 +541,9 @@ nv_device_resource_start(struct nouveau_
 		return pci_resource_start(device->pdev, bar);
 	} else {
 #ifdef __NetBSD__
-		/* XXX nouveau platform device */
-		panic("can't handle non-PCI nouveau devices");
+		if (bar >= device->platformdev->nresource)
+			return 0;
+		return device->platformdev->resource[bar].start;
 #else
 		struct resource *res;
 		res = platform_get_resource(device->platformdev,
@@ -561,8 +562,9 @@ nv_device_resource_len(struct nouveau_de
 		return pci_resource_len(device->pdev, bar);
 	} else {
 #ifdef __NetBSD__
-		/* XXX nouveau platform device */
-		panic("can't handle non-PCI nouveau devices");
+		if (bar >= device->platformdev->nresource)
+			return 0;
+		return device->platformdev->resource[bar].len;
 #else
 		struct resource *res;
 		res = platform_get_resource(device->platformdev,

Index: src/sys/external/bsd/drm2/include/linux/platform_device.h
diff -u src/sys/external/bsd/drm2/include/linux/platform_device.h:1.4 src/sys/external/bsd/drm2/include/linux/platform_device.h:1.5
--- src/sys/external/bsd/drm2/include/linux/platform_device.h:1.4	Wed Aug  6 15:01:33 2014
+++ src/sys/external/bsd/drm2/include/linux/platform_device.h	Sat Oct 17 21:13:38 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: platform_device.h,v 1.4 2014/08/06 15:01:33 riastradh Exp $	*/
+/*	$NetBSD: platform_device.h,v 1.5 2015/10/17 21:13:38 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,10 +33,20 @@
 #define _LINUX_PLATFORM_DEVICE_H_
 
 #include 
+#include 
+
+#define NUM_PLATFORM_RESOURCE	2
 
 struct platform_device {
 	struct device	dev;	/* XXX DON'T BELIEVE ME */
 	uint64_t	id;
+
+	unsigned int	nresource;
+	struct {
+		bus_space_tag_t	tag;
+		bus_addr_t	start;
+		bus_size_t	len;
+	}		resource[NUM_PLATFORM_RESOURCE];
 };
 
 #endif  /* _LINUX_PLATFORM_DEVICE_H_ */



CVS commit: src/sys/external/bsd/drm2

2015-10-18 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 18 15:42:00 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: Makefile
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
nouveau_engine_device_nve0.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph: ctxnvc0.h
nouveau_engine_graph_ctxnve4.c nouveau_engine_graph_nvc0.c
nouveau_engine_graph_nve4.c nvc0.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine: fifo.h
graph.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev: fb.h
ibus.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar:
nouveau_subdev_bar_base.c nouveau_subdev_bar_nvc0.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb: priv.h
src/sys/external/bsd/drm2/nouveau: files.nouveau
Added Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
nouveau_engine_fifo_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph:
nouveau_engine_graph_ctxgk20a.c nouveau_engine_graph_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb:
nouveau_subdev_fb_gk20a.c nouveau_subdev_fb_ramgk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus:
nouveau_subdev_ibus_gk20a.c

Log Message:
Backport GK20A support from linux-3.16.

commits:53d206bb4aadba255d20b70893ed5ba1d89f41e1
88ff3f5f63370a8ff5b0e34bdb58144bf1c2fa9b
90a5500c2bf0e83cd965128fce9ac1f5fa4f04f5
fef94f6272c6d1ce1c910f50f7281d61f5f6
86ebef722dab7f9ea4c5753640ef7d660c681985
b7c852a646b12051e61c4dde4ddaa6c14af9c80b
370eec76b67430f6055ebda07c820f02288d93b8
a4d4bbf130724c9a9a3dff673eb9342f1dbe2392
52e98f1a84094f9cfb36d02a73bc4271a71c70eb

ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_nve0.c
cvs rdiff -u -r0 -r1.1 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_gk20a.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/ctxnvc0.h \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnve4.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nve4.c
 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nvc0.h
cvs rdiff -u -r0 -r1.1 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxgk20a.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gk20a.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nvc0.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/graph.h
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/fb.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/ibus.h
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_nvc0.c
cvs rdiff -u -r0 -r1.1 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_gk20a.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/priv.h
cvs rdiff -u -r0 -r1.1 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus/nouveau_subdev_ibus_gk20a.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/nouveau/files.nouveau

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/dist/drm/nouveau/Makefile
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/Makefile:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/Makefile:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/Makefile:1.1.1.1	Wed Jul 16 19:35:26 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/Makefile	Sun Oct 18 15:41:59 2015
@@ -102,6 +102,7 @@ nouveau-y += core/subdev/fb/nvaa.o
 nouveau-y += core/subdev/fb/nvaf.o
 nouveau-y += core/subdev/fb/nvc0.o
 nouveau-y += core/subdev/fb/nve0.o
+nouveau-y += core/subdev/fb/gk20a.o
 nouveau-y += core/subdev/fb/gm107.o
 nouveau-y +=

CVS commit: src/sys/external/bsd/sljit

2016-05-29 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun May 29 17:56:20 UTC 2016

Modified Files:
src/sys/external/bsd/sljit: README.import

Log Message:
Update sljit revision to r313 after the import.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/sljit/README.import

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/sljit/README.import
diff -u src/sys/external/bsd/sljit/README.import:1.4 src/sys/external/bsd/sljit/README.import:1.5
--- src/sys/external/bsd/sljit/README.import:1.4	Tue Jun 17 16:49:11 2014
+++ src/sys/external/bsd/sljit/README.import	Sun May 29 17:56:20 2016
@@ -1,6 +1,6 @@
 There are no CVS/SVN ids in sljit repository but don't forget to
 remove .svn before importing the new version.
 
-Current sljit import is @ r257:
+Current sljit import is @ r313:
 
-svn co https://sljit.svn.sourceforge.net/svnroot/sljit@257 dist
+svn co https://svn.code.sf.net/p/sljit/code@r313 dist



CVS commit: src/sys/external/bsd/drm2

2014-12-31 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jan  1 01:15:43 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/drm: drm_drv.c
src/sys/external/bsd/drm2/include/drm: drm_irq_netbsd.h
src/sys/external/bsd/drm2/include/linux: spinlock.h ww_mutex.h
src/sys/external/bsd/drm2/linux: linux_idr.c linux_kmap.c linux_work.c
linux_writecomb.c
src/sys/external/bsd/drm2/pci: drm_pci.c

Log Message:
due to hangs seen by several folks, for now revert:
http://mail-index.netbsd.org/source-changes/2014/11/04/msg060120.html

Log Message:
This code should be MP-safe. Use IPL_SCHED in place of IPL_DRM/IPL_VM and set
D_MPSAFE flag in cdevsw.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/drm/drm_drv.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/spinlock.h
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/ww_mutex.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/linux/linux_idr.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/linux/linux_kmap.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/linux/linux_work.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/linux/linux_writecomb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/pci/drm_pci.c

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/drm/drm_drv.c
diff -u src/sys/external/bsd/drm2/drm/drm_drv.c:1.12 src/sys/external/bsd/drm2/drm/drm_drv.c:1.13
--- src/sys/external/bsd/drm2/drm/drm_drv.c:1.12	Sun Dec 14 23:48:58 2014
+++ src/sys/external/bsd/drm2/drm/drm_drv.c	Thu Jan  1 01:15:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.12 2014/12/14 23:48:58 chs Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.13 2015/01/01 01:15:42 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.12 2014/12/14 23:48:58 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.13 2015/01/01 01:15:42 mrg Exp $");
 
 #include 
 #include 
@@ -231,7 +231,8 @@ const struct cdevsw drm_cdevsw = {
 	.d_kqfilter = nokqfilter,
 	.d_discard = nodiscard,
 	/* XXX was D_TTY | D_NEGOFFSAFE */
-	.d_flag = D_NEGOFFSAFE | D_MPSAFE,
+	/* XXX Add D_MPSAFE some day... */
+	.d_flag = D_NEGOFFSAFE,
 };
 
 static const struct fileops drm_fileops = {

Index: src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h:1.3 src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h:1.4
--- src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h:1.3	Tue Nov  4 11:27:31 2014
+++ src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h	Thu Jan  1 01:15:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_irq_netbsd.h,v 1.3 2014/11/04 11:27:31 jmcneill Exp $	*/
+/*	$NetBSD: drm_irq_netbsd.h,v 1.4 2015/01/01 01:15:42 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,4 +41,6 @@ typedef int irqreturn_t;
 
 #define	IRQF_SHARED	0	/* XXX */
 
+#define	IPL_DRM		IPL_TTY	/* XXX */
+
 #endif  /* _DRM_DRM_IRQ_NETBSD_H_ */

Index: src/sys/external/bsd/drm2/include/linux/spinlock.h
diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.5 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.6
--- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.5	Tue Nov  4 11:27:31 2014
+++ src/sys/external/bsd/drm2/include/linux/spinlock.h	Thu Jan  1 01:15:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: spinlock.h,v 1.5 2014/11/04 11:27:31 jmcneill Exp $	*/
+/*	$NetBSD: spinlock.h,v 1.6 2015/01/01 01:15:42 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -88,7 +88,8 @@ spin_unlock_irqrestore(spinlock_t *spinl
 static inline void
 spin_lock_init(spinlock_t *spinlock)
 {
-	mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_SCHED);
+	/* XXX What's the right IPL?  IPL_DRM...?  */
+	mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_VM);
 }
 
 /*

Index: src/sys/external/bsd/drm2/include/linux/ww_mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.8 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.9
--- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.8	Tue Nov  4 11:27:31 2014
+++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h	Thu Jan  1 01:15:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ww_mutex.h,v 1.8 2014/11/04 11:27:31 jmcneill Exp $	*/
+/*	$NetBSD: ww_mutex.h,v 1.9 2015/01/01 01:15:42 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -147,7 +147,7 @@ ww_mutex_init(struct ww_mutex *mutex, st
 	 * XXX Apparently Linux takes these with spin locks held.  That
 	 * strikes me as a bad idea, but so it is...
 	 */
-	mutex_init(&mutex->wwm_lock, MUTEX_DEFAULT, IPL_SCHED);
+	mutex_init(&mutex->wwm_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex->wwm_state = WW_UNLOCKED;
 	mutex->wwm_class = class;

CVS commit: src/sys/external/bsd/drm2

2015-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 25 14:00:52 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/drm: drm_sysctl.c
src/sys/external/bsd/drm2/include/linux: moduleparam.h

Log Message:
Add string Linux module parameters.

Needed by nouveau.

>From chs@.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/drm/drm_sysctl.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/include/linux/moduleparam.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/drm/drm_sysctl.c
diff -u src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.4 src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.5
--- src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.4	Mon Nov 24 17:29:02 2014
+++ src/sys/external/bsd/drm2/drm/drm_sysctl.c	Wed Feb 25 14:00:52 2015
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.4 2014/11/24 17:29:02 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.5 2015/02/25 14:00:52 riastradh Exp $");
 
 #include 
 #include 
@@ -96,6 +96,8 @@ drm_sysctl_get_type(const struct linux_m
 		return CTLTYPE_BOOL;
 	case MTYPE_int:
 		return CTLTYPE_INT;
+	case MTYPE_charp:
+		return CTLTYPE_STRING;
 	default:
 		aprint_error("unhandled module param type %d for %s\n",
 		p->type, p->name);

Index: src/sys/external/bsd/drm2/include/linux/moduleparam.h
diff -u src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.4 src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.5
--- src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.4	Wed Nov 12 04:53:14 2014
+++ src/sys/external/bsd/drm2/include/linux/moduleparam.h	Wed Feb 25 14:00:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: moduleparam.h,v 1.4 2014/11/12 04:53:14 christos Exp $	*/
+/*	$NetBSD: moduleparam.h,v 1.5 2015/02/25 14:00:52 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@ struct linux_module_param_info {
 
 #define MTYPE_int	0
 #define MTYPE_bool	1
+#define MTYPE_charp	2
 
 #define	module_param_named(NAME, VAR, TYPE, MODE) \
 static __attribute__((__used__)) struct linux_module_param_info info_ ## NAME = { \



CVS commit: src/sys/external/bsd/drm2

2015-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 25 14:57:05 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_nv50_display.c
nouveau_nv84_fence.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core: os.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios:
nouveau_subdev_bios_base.c
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
Another round of nouveau whack-a-mole.

Derived from a patch by chs@.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_base.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/nouveau/files.nouveau

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/dist/drm/nouveau/nouveau_nv50_display.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.2	Sat Aug 23 08:03:33 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c	Wed Feb 25 14:57:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nv50_display.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $	*/
+/*	$NetBSD: nouveau_nv50_display.c,v 1.3 2015/02/25 14:57:04 riastradh Exp $	*/
 
 	/*
  * Copyright 2011 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.2 2014/08/23 08:03:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.3 2015/02/25 14:57:04 riastradh Exp $");
 
 #include 
 #include 
@@ -51,6 +51,37 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_nv50
 #include 
 #include 
 
+#ifdef __NetBSD__
+/*
+ * XXX Can't use bus_space here because this is all mapped through the
+ * nvbo_kmap abstraction.  Can't assume we're x86 because this is
+ * Nouveau, not Intel.
+ */
+
+#  define	__iomem		volatile
+#  define	readw		fake_readw
+#  define	writew		fake_writew
+
+static inline uint32_t
+fake_readw(const void __iomem *ptr)
+{
+	uint16_t v;
+
+	v = *(const uint16_t __iomem *)ptr;
+	membar_consumer();
+
+	return v;
+}
+
+static inline void
+fake_writew(uint16_t v, void __iomem *ptr)
+{
+
+	membar_producer();
+	*(uint16_t __iomem *)ptr = v;
+}
+#endif
+
 #define EVO_DMA_NR 9
 
 #define EVO_MASTER  (0x00)
@@ -151,17 +182,18 @@ static void
 nv50_dmac_destroy(struct nouveau_object *core, struct nv50_dmac *dmac)
 {
 	if (dmac->ptr) {
+		struct pci_dev *pdev = nv_device(core)->pdev;
 #ifdef __NetBSD__
-		const bus_dma_tag_t dmat = nv_device(core)->dmat;
+		/* XXX pa_dmat or pa_dmat64? */
+		const bus_dma_tag_t dmat = pdev->pd_pa.pa_dmat64;
 
-		bus_dmamem_unload(dmat, dmac->dmamap);
+		bus_dmamap_unload(dmat, dmac->dmamap);
 		bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE);
 		bus_dmamap_destroy(dmat, dmac->dmamap);
 		bus_dmamem_free(dmat, &dmac->dmaseg, 1);
 		dmac->handle = 0;
 		dmac->ptr = NULL;
 #else
-		struct pci_dev *pdev = nv_device(core)->pdev;
 		pci_free_consistent(pdev, PAGE_SIZE, dmac->ptr, dmac->handle);
 #endif
 	}
@@ -311,7 +343,7 @@ nv50_dmac_create(struct nouveau_object *
 
 #ifdef __NetBSD__
 {
-	const bus_dma_tag_t dmat = nv_device(core)->dmat;
+	const bus_dma_tag_t dmat = nv_device(core)->pdev->pd_pa.pa_dmat64;
 	int rsegs;
 
 	/* XXX errno NetBSD->Linux */
@@ -336,7 +368,7 @@ nv50_dmac_create(struct nouveau_object *
 		return ret;
 	}
 	ret = -bus_dmamap_load(dmat, dmac->dmamap, dmac->dmakva, PAGE_SIZE,
-	BUS_DMA_WAITOK);
+	NULL, BUS_DMA_WAITOK);
 	if (ret) {
 		bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE);
 		bus_dmamap_destroy(dmat, dmac->dmamap);
@@ -1262,13 +1294,13 @@ nv50_crtc_lut_load(struct drm_crtc *crtc
 		u16 b = nv_crtc->lut.b[i] >> 2;
 
 		if (nv_mclass(disp->core) < NVD0_DISP_CLASS) {
-			writew(r + 0x, lut + (i * 0x08) + 0);
-			writew(g + 0x, lut + (i * 0x08) + 2);
-			writew(b + 0x, lut + (i * 0x08) + 4);
+			writew(r + 0x, (char __iomem *)lut + (i * 0x08) + 0);
+			writew(g + 0x, (char __iomem *)lut + (i * 0x08) + 2);
+			writew(b + 0x, (char __iomem *)lut + (i * 0x08) + 4);
 		} else {
-			writew(r + 0x6000, lut + (i * 0x20) + 0);
-			writew(g + 0x6000, lut + (i * 0x20) + 2);
-			writew(b + 0x6000, lut + (i * 0x20) + 4);
+			writew(r + 0x6000, (char __iomem *)lut + (i * 0x20) + 0);
+			writew(g + 0x6000, (char __iomem *)lut + (i * 0x20) + 2);
+			writew(b + 0x6000, (char __iomem *)lut + (i * 0x20) + 4);
 		}
 	}
 }

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c
diff -u src/sys/external/bsd/drm2/d

CVS commit: src/sys/external/bsd/drm2

2015-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 25 17:29:43 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core: os.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev: mc.h
pwr.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios:
nouveau_subdev_bios_pll.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock:
nouveau_subdev_clock_base.c nouveau_subdev_clock_nv50.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit: fbmem.h
nouveau_subdev_devinit_nv04.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb:
nouveau_subdev_fb_nv50.c nouveau_subdev_fb_nvc0.c nv50.h nvc0.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc:
nouveau_subdev_mc_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mxm:
nouveau_subdev_mxm_nv50.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr:
nouveau_subdev_pwr_base.c
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
Another round of whack-a-mole with nouveau.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_base.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/clock/nouveau_subdev_clock_nv50.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/fbmem.h \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nv50.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nvc0.c
 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nv50.h \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nvc0.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mc/nouveau_subdev_mc_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/nouveau/files.nouveau

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/dist/drm/nouveau/core/os.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h:1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h:1.5
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h:1.4	Wed Feb 25 14:57:05 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h	Wed Feb 25 17:29:42 2015
@@ -27,6 +27,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h:1.1.1.1	Thu Jul 17 01:50:59 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/mc.h	Wed Feb 25 17:29:43 2015
@@ -13,6 +13,9 @@ struct nouveau_mc {
 	struct nouveau_subdev base;
 	bool use_msi;
 	unsigned int irq;
+#ifdef __NetBSD__
+	void *irq_cookie;
+#endif
 };
 
 static inline struct nouveau_mc *

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h:1.2	Sat Aug 23 08:03:34 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h	Wed Feb 25 17:29:43 2015
@@ -32,7 +32,6 @@ struct nouveau_pwr {
 
 		struct work_struct work;
 #ifdef __NetBSD__
-		struct mutex lock;
 		drm_waitqueue_t wait;
 #else
 		wait_queue_head_t wait;

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bios/nouveau_subdev_bios_pll.c:1.2
--- src/sys/externa

CVS commit: src/sys/external/bsd/drm2

2015-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 25 22:12:00 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_ttm.c nouveau_ttm.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev: pwr.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr:
nouveau_subdev_pwr_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm:
nouveau_subdev_therm_ic.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/timer:
nouveau_subdev_timer_nv04.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm:
nouveau_subdev_vm_base.c nouveau_subdev_vm_nv04.c
nouveau_subdev_vm_nv44.c nv04.h
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
Another round of nouveau whack-a-mole.

Nouveau compiles now, though it doesn't link yet.

Need to write driver attachment, wscons framebuffer, &c.  Probably
also some i2c stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.h
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev/pwr.h
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr/nouveau_subdev_pwr_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/therm/nouveau_subdev_therm_ic.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/timer/nouveau_subdev_timer_nv04.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_base.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv04.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv44.c
 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/nv04.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/nouveau/files.nouveau

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/dist/drm/nouveau/nouveau_ttm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.c:1.2	Wed Aug  6 13:35:13 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.c	Wed Feb 25 22:12:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_ttm.c,v 1.2 2014/08/06 13:35:13 riastradh Exp $	*/
+/*	$NetBSD: nouveau_ttm.c,v 1.3 2015/02/25 22:12:00 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_ttm.c,v 1.2 2014/08/06 13:35:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_ttm.c,v 1.3 2015/02/25 22:12:00 riastradh Exp $");
 
 #include 
 #include 
@@ -118,7 +118,7 @@ nouveau_vram_manager_debug(struct ttm_me
 
 	mutex_lock(&nv_subdev(pfb)->mutex);
 	list_for_each_entry(r, &mm->nodes, nl_entry) {
-		printk(KERN_DEBUG "%s %d: 0x%010llx 0x%010llx\n",
+		printk(KERN_DEBUG "%s %d: 0x%010"PRIx64" 0x%010"PRIx64"\n",
 		   prefix, r->type, ((u64)r->offset << 12),
 		   (((u64)r->offset + r->length) << 12));
 
@@ -128,7 +128,7 @@ nouveau_vram_manager_debug(struct ttm_me
 	}
 	mutex_unlock(&nv_subdev(pfb)->mutex);
 
-	printk(KERN_DEBUG "%s  total: 0x%010llx free: 0x%010llx\n",
+	printk(KERN_DEBUG "%s  total: 0x%010"PRIx64" free: 0x%010"PRIx64"\n",
 	   prefix, (u64)total << 12, (u64)free << 12);
 	printk(KERN_DEBUG "%s  block: 0x%08x\n",
 	   prefix, mm->block_size << 12);
@@ -283,6 +283,27 @@ const struct ttm_mem_type_manager_func n
 	nv04_gart_manager_debug
 };
 
+#ifdef __NetBSD__
+
+int
+nouveau_ttm_mmap_object(struct drm_device *dev, off_t offset, size_t size,
+vm_prot_t prot, struct uvm_object **uobjp, voff_t *uoffsetp,
+struct file *file)
+{
+	struct nouveau_drm *const drm = nouveau_drm(dev);
+
+	KASSERT(0 == (offset & (PAGE_SIZE - 1)));
+
+	if (__predict_false((offset >> PAGE_SHIFT) < DRM_FILE_PAGE_OFFSET))
+		return drm_mmap_object(dev, offset, size, prot, uobjp,
+		uoffsetp, file);
+	else
+		return ttm_bo_mmap_object(&drm->ttm.bdev, offset, size, prot,
+		uobjp, uoffsetp, file);
+}
+
+#else
+
 int
 nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
 {
@@ -295,6 +316,8 @@ nouveau_ttm_mmap(struct file *filp, stru
 	return ttm_bo_mmap(filp, vma, &drm->ttm.bdev);
 }
 
+#endif
+
 static int
 nouveau_ttm_mem_global_init(struct drm_global_reference *ref)
 {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_ttm.h:1.2
---

CVS commit: src/sys/external/bsd/drm2

2015-02-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 28 18:25:39 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_irq.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_dma.c
src/sys/external/bsd/drm2/dist/drm/via: via_dmablit.c via_drv.h
via_irq.c via_video.c
src/sys/external/bsd/drm2/include/drm: drm_wait_netbsd.h

Log Message:
New macro DRM_SPIN_WAIT_ON better reflects DRM_WAIT_ON.

We still need to adapt all waits from upstream to use an interlock,
so we can't implement DRM_WAIT_ON verbatim, but this more closely
reflects the API of DRM_WAIT_ON than DRM_*WAIT*_UNTIL do.

Major difference is that this polls every tick, like DRM_WAIT_ON,
unlike DRM_*WAIT*_UNTIL.  So it will mask missing wakeups, but it
wouldn't surprise me if there were such things upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/drm_irq.c
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c \
src/sys/external/bsd/drm2/dist/drm/via/via_irq.c \
src/sys/external/bsd/drm2/dist/drm/via/via_video.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/via/via_drv.h
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/dist/drm/drm_irq.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_irq.c:1.7 src/sys/external/bsd/drm2/dist/drm/drm_irq.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/drm_irq.c:1.7	Sat Feb 28 03:05:09 2015
+++ src/sys/external/bsd/drm2/dist/drm/drm_irq.c	Sat Feb 28 18:25:39 2015
@@ -1293,20 +1293,14 @@ int drm_wait_vblank(struct drm_device *d
 #ifdef __NetBSD__
 {
 	unsigned long irqflags;
+
 	spin_lock_irqsave(&dev->vbl_lock, irqflags);
-	DRM_SPIN_TIMED_WAIT_UNTIL(ret, &dev->vblank[crtc].queue,
-	&dev->vbl_lock,
-	(3 * HZ),
+	DRM_SPIN_WAIT_ON(ret, &dev->vblank[crtc].queue, &dev->vbl_lock,
+	3 * HZ,
 	(((drm_vblank_count(dev, crtc) -
 		vblwait->request.sequence) <= (1 << 23)) ||
 		!dev->irq_enabled));
 	spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
-	if (ret < 0)		/* Failed: return negative error as is.  */
-		;
-	else if (ret == 0)	/* Timed out: return -EBUSY like Linux.  */
-		ret = -EBUSY;
-	else			/* Succeeded (ret > 0): return 0.  */
-		ret = 0;
 }
 #else
 	DRM_WAIT_ON(ret, dev->vblank[crtc].queue, 3 * HZ,

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.14 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.15
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.14	Sat Feb 28 03:06:46 2015
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sat Feb 28 18:25:39 2015
@@ -812,16 +812,9 @@ static int i915_wait_irq(struct drm_devi
 #ifdef __NetBSD__
 		unsigned long flags;
 		spin_lock_irqsave(&dev_priv->irq_lock, flags);
-		DRM_SPIN_TIMED_WAIT_UNTIL(ret, &ring->irq_queue,
-		&dev_priv->irq_lock,
+		DRM_SPIN_WAIT_ON(ret, &ring->irq_queue, &dev_priv->irq_lock,
 		3 * DRM_HZ,
 		READ_BREADCRUMB(dev_priv) >= irq_nr);
-		if (ret < 0)	/* Failure: return negative error as is.  */
-			;
-		else if (ret == 0) /* Timed out: return -EBUSY like Linux.  */
-			ret = -EBUSY;
-		else		/* Succeeded (ret > 0): return 0.  */
-			ret = 0;
 		spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
 #else
 		DRM_WAIT_ON(ret, ring->irq_queue, 3 * HZ,

Index: src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.3 src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.3	Sat Feb 28 03:23:32 2015
+++ src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c	Sat Feb 28 18:25:39 2015
@@ -597,15 +597,8 @@ via_dmablit_sync(struct drm_device *dev,
 #ifdef __NetBSD__
 	spin_lock(&blitq->blit_lock);
 	if (via_dmablit_active(blitq, engine, handle, &queue)) {
-		DRM_SPIN_TIMED_WAIT_UNTIL(ret, queue, &blitq->blit_lock,
-		3*DRM_HZ,
+		DRM_SPIN_WAIT_ON(ret, queue, &blitq->blit_lock, 3*DRM_HZ,
 		!via_dmablit_active(blitq, engine, handle, NULL));
-		if (ret < 0)	/* Failure: return negative error as is.  */
-			;
-		else if (ret == 0) /* Timed out: return -EBUSY like Linux.  */
-			ret = -EBUSY;
-		else		/* Succeeded (ret > 0): return 0.  */
-			ret = 0;
 	}
 	spin_unlock(&blitq->blit_lock);
 #else
@@ -881,15 +874,9 @@ via_dmablit_grab_slot(drm_via_blitq_t *b
 	spin_lock_irqsave(&blitq->blit_lock, irqsave);
 	while (blitq->num_free == 0) {
 #ifdef __NetBSD__
-		DRM_SPIN_TIMED_WAIT_UNTIL(ret, &blitq->busy_queue,
-		&blitq->blit_lock, DRM_HZ,
+		DRM_SPIN_WAIT_ON(ret, &blitq->busy_queue, &blitq->blit_lock,
+		DRM_HZ,
 		blitq->num_free > 0);
-		if (ret < 0)	/* Failure: return ne

CVS commit: src/sys/external/bsd/dwc2

2015-04-30 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Fri May  1 06:58:40 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwc2var.h
src/sys/external/bsd/dwc2/dist: dwc2_core.c

Log Message:
Support external DMA mode and provide an interface for DMA address configuration


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/dwc2/dwc2var.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/dwc2/dist/dwc2_core.c

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/dwc2/dwc2var.h
diff -u src/sys/external/bsd/dwc2/dwc2var.h:1.3 src/sys/external/bsd/dwc2/dwc2var.h:1.4
--- src/sys/external/bsd/dwc2/dwc2var.h:1.3	Tue Oct 22 12:57:40 2013
+++ src/sys/external/bsd/dwc2/dwc2var.h	Fri May  1 06:58:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2var.h,v 1.3 2013/10/22 12:57:40 skrll Exp $	*/
+/*	$NetBSD: dwc2var.h,v 1.4 2015/05/01 06:58:40 hikaru Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -77,6 +77,7 @@ typedef struct dwc2_softc {
  	bus_space_handle_t	sc_ioh;
  	bus_dma_tag_t		sc_dmat;
 	struct dwc2_core_params *sc_params;
+	int			(*sc_set_dma_addr)(device_t, bus_addr_t, int);
 
 	/*
 	 * Private

Index: src/sys/external/bsd/dwc2/dist/dwc2_core.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.6 src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.7
--- src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.6	Thu Apr  3 06:34:58 2014
+++ src/sys/external/bsd/dwc2/dist/dwc2_core.c	Fri May  1 06:58:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_core.c,v 1.6 2014/04/03 06:34:58 skrll Exp $	*/
+/*	$NetBSD: dwc2_core.c,v 1.7 2015/05/01 06:58:40 hikaru Exp $	*/
 
 /*
  * core.c - DesignWare HS OTG Controller common routines
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.6 2014/04/03 06:34:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.7 2015/05/01 06:58:40 hikaru Exp $");
 
 #include 
 #include 
@@ -312,8 +312,13 @@ static int dwc2_gahbcfg_init(struct dwc2
 
 	switch (hsotg->hw_params.arch) {
 	case GHWCFG2_EXT_DMA_ARCH:
-		dev_err(hsotg->dev, "External DMA Mode not supported\n");
-		return -EINVAL;
+		dev_dbg(hsotg->dev, "External DMA Mode\n");
+		if (hsotg->core_params->ahbcfg != -1) {
+			ahbcfg &= GAHBCFG_CTRL_MASK;
+			ahbcfg |= hsotg->core_params->ahbcfg &
+  ~GAHBCFG_CTRL_MASK;
+		}
+		break;
 
 	case GHWCFG2_INT_DMA_ARCH:
 		dev_dbg(hsotg->dev, "Internal DMA Mode\n");
@@ -1396,10 +1401,18 @@ void dwc2_hc_start_transfer(struct dwc2_
 		} else {
 			dma_addr = chan->xfer_dma;
 		}
-		DWC2_WRITE_4(hsotg, HCDMA(chan->hc_num), (u32)dma_addr);
-		if (dbg_hc(chan))
-			dev_vdbg(hsotg->dev, "Wrote %08lx to HCDMA(%d)\n",
- (unsigned long)dma_addr, chan->hc_num);
+		if (hsotg->hsotg_sc->sc_set_dma_addr == NULL) {
+			DWC2_WRITE_4(hsotg, HCDMA(chan->hc_num),
+			(u32)dma_addr);
+			if (dbg_hc(chan))
+dev_vdbg(hsotg->dev,
+"Wrote %08lx to HCDMA(%d)\n",
+ (unsigned long)dma_addr,
+chan->hc_num);
+		} else {
+			(void)(*hsotg->hsotg_sc->sc_set_dma_addr)(
+			hsotg->dev, dma_addr, chan->hc_num);
+		}
 	}
 
 	/* Start the split */



CVS commit: src/sys/external/bsd/drm2

2015-05-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu May 21 21:55:55 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/include/linux: ww_mutex.h
src/sys/external/bsd/drm2/linux: linux_ww_mutex.c

Log Message:
Adapt ww_mutex to use LOCKDEBUG.

Should help track down PR 49862.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/linux/ww_mutex.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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/linux/ww_mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.10 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.11
--- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.10	Thu Jan  8 23:35:47 2015
+++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h	Thu May 21 21:55:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ww_mutex.h,v 1.10 2015/01/08 23:35:47 riastradh Exp $	*/
+/*	$NetBSD: ww_mutex.h,v 1.11 2015/05/21 21:55:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -56,7 +56,6 @@ struct ww_acquire_ctx {
 };
 
 struct ww_mutex {
-	kmutex_t		wwm_lock;
 	enum ww_mutex_state {
 		WW_UNLOCKED,	/* nobody owns it */
 		WW_OWNED,	/* owned by a lwp without a context */
@@ -67,9 +66,17 @@ struct ww_mutex {
 		struct lwp		*owner;
 		struct ww_acquire_ctx	*ctx;
 	}			wwm_u;
+	/*
+	 * XXX wwm_lock must *not* be first, so that the ww_mutex has a
+	 * different address from the kmutex for LOCKDEBUG purposes.
+	 */
+	kmutex_t		wwm_lock;
 	struct ww_class		*wwm_class;
 	struct rb_tree		wwm_waiters;
 	kcondvar_t		wwm_cv;
+#ifdef LOCKDEBUG
+	bool			wwm_debug;
+#endif
 };
 
 /* XXX Make the nm output a little more greppable...  */

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.1 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.1	Thu Jan  8 23:35:47 2015
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Thu May 21 21:55:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.1 2015/01/08 23:35:47 riastradh Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.2 2015/05/21 21:55:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,17 +30,28 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.1 2015/01/08 23:35:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2 2015/05/21 21:55:55 riastradh Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
 
+#define	WW_WANTLOCK(WW)			  \
+	LOCKDEBUG_WANTLOCK((WW)->wwm_debug, (WW),			  \
+	(uintptr_t)__builtin_return_address(0), 0)
+#define	WW_LOCKED(WW)			  \
+	LOCKDEBUG_LOCKED((WW)->wwm_debug, (WW), NULL,			  \
+	(uintptr_t)__builtin_return_address(0), 0)
+#define	WW_UNLOCKED(WW)			  \
+	LOCKDEBUG_UNLOCKED((WW)->wwm_debug, (WW),			  \
+	(uintptr_t)__builtin_return_address(0), 0)
+
 static int
 ww_acquire_ctx_compare(void *cookie __unused, const void *va, const void *vb)
 {
@@ -109,6 +120,53 @@ ww_acquire_fini(struct ww_acquire_ctx *c
 	ctx->wwx_owner = NULL;
 }
 
+#ifdef LOCKDEBUG
+static void
+ww_dump(volatile void *cookie)
+{
+	volatile struct ww_mutex *mutex = cookie;
+
+	printf_nolog("%-13s: ", "state");
+	switch (mutex->wwm_state) {
+	case WW_UNLOCKED:
+		printf_nolog("unlocked\n");
+		break;
+	case WW_OWNED:
+		printf_nolog("owned by lwp\n");
+		printf_nolog("%-13s: %p\n", "owner", mutex->wwm_u.owner);
+		printf_nolog("%-13s: %s\n", "waiters",
+		cv_has_waiters(__UNVOLATILE(&mutex->wwm_cv))
+			? "yes" : "no");
+		break;
+	case WW_CTX:
+		printf_nolog("owned via ctx\n");
+		printf_nolog("%-13s: %p\n", "context", mutex->wwm_u.ctx);
+		printf_nolog("%-13s: %p\n", "lwp",
+		mutex->wwm_u.ctx->wwx_owner);
+		printf_nolog("%-13s: %s\n", "waiters",
+		cv_has_waiters(__UNVOLATILE(&mutex->wwm_cv))
+			? "yes" : "no");
+		break;
+	case WW_WANTOWN:
+		printf_nolog("owned via ctx\n");
+		printf_nolog("%-13s: %p\n", "context", mutex->wwm_u.ctx);
+		printf_nolog("%-13s: %p\n", "lwp",
+		mutex->wwm_u.ctx->wwx_owner);
+		printf_nolog("%-13s: %s\n", "waiters", "yes (noctx)");
+		break;
+	default:
+		printf_nolog("unknown\n");
+		break;
+	}
+}
+
+static lockops_t ww_lockops = {
+	.lo_name = "Wait/wound mutex",
+	.lo_type = LOCKOPS_SLEEP,
+	.lo_dump = ww_dump,
+};
+#endif
+
 void
 ww_mutex_init(struct ww_mutex *mutex, struct ww_class *class)
 {
@@ -122,12 +180,21 @@ ww_mutex_init(struct ww_mutex *mutex, st
 	mutex->wwm_class = class;
 	rb_tree_init(&mutex->wwm_waiters, &ww_acquire_ctx_rb_ops);
 	cv_init(&mutex->wwm_cv, "linuxwwm");
+#ifdef LOCKDEBUG
+	mutex->wwm_debug = LOCKDEBUG_ALLOC(mutex, &ww_lockops,
+	(uintptr_t)__builtin_return_address(0));
+#endif
 }
 
 void
 ww_mutex_destroy(struct ww

CVS commit: src/sys/external/bsd/dwc2

2015-12-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 22 14:31:36 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Stop the callout if the transfer didn't get enqueued


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.37 src/sys/external/bsd/dwc2/dwc2.c:1.38
--- src/sys/external/bsd/dwc2/dwc2.c:1.37	Sun Aug 30 13:02:42 2015
+++ src/sys/external/bsd/dwc2/dwc2.c	Tue Dec 22 14:31:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.37 2015/08/30 13:02:42 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.38 2015/12/22 14:31:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.37 2015/08/30 13:02:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.38 2015/12/22 14:31:36 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1425,6 +1425,7 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	return USBD_IN_PROGRESS;
 
 fail2:
+	callout_stop(&xfer->timeout_handle);
 	dwc2_urb->priv = NULL;
 	mutex_spin_exit(&hsotg->lock);
 	pool_cache_put(sc->sc_qtdpool, qtd);



CVS commit: src/sys/external/bsd/drm2

2016-02-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 11 04:51:44 UTC 2016

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_drm.c nouveau_drm.h
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
Pass a sensible device state pointer to nouveau suspend/resume ops.

Gives nouveau half a chance of suspending and resuming -- not that it
works on my test laptop yet, but it's a start.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

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/dist/drm/nouveau/nouveau_drm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.7 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.7	Tue Oct 27 13:21:18 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c	Thu Feb 11 04:51:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_drm.c,v 1.7 2015/10/27 13:21:18 riastradh Exp $	*/
+/*	$NetBSD: nouveau_drm.c,v 1.8 2016/02/11 04:51:44 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.7 2015/10/27 13:21:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.8 2016/02/11 04:51:44 riastradh Exp $");
 
 #include 
 #include 
@@ -612,12 +612,13 @@ fail_display:
 	return ret;
 }
 
-int nouveau_pmops_suspend(struct device *dev)
-{
 #ifdef __NetBSD__
-	struct drm_device *drm_dev = device_private(dev);
-	struct pci_dev *pdev __unused = drm_dev->pdev;
+int nouveau_pmops_suspend(struct drm_device *drm_dev)
 #else
+int nouveau_pmops_suspend(struct device *dev)
+#endif
+{
+#ifndef __NetBSD__
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct drm_device *drm_dev = pci_get_drvdata(pdev);
 #endif
@@ -674,12 +675,13 @@ nouveau_do_resume(struct drm_device *dev
 	return 0;
 }
 
-int nouveau_pmops_resume(struct device *dev)
-{
 #ifdef __NetBSD__
-	struct drm_device *drm_dev = device_private(dev);
-	struct pci_dev *pdev __unused = drm_dev->pdev;
+int nouveau_pmops_resume(struct drm_device *drm_dev)
 #else
+int nouveau_pmops_resume(struct device *dev)
+#endif
+{
+#ifndef __NetBSD__
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct drm_device *drm_dev = pci_get_drvdata(pdev);
 #endif

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h:1.3	Thu Oct 29 08:08:52 2015
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h	Thu Feb 11 04:51:44 2016
@@ -160,8 +160,13 @@ nouveau_dev(struct drm_device *dev)
 	return nv_device(nouveau_drm(dev)->device);
 }
 
+#ifdef __NetBSD__
+int nouveau_pmops_suspend(struct drm_device *);
+int nouveau_pmops_resume(struct drm_device *);
+#else
 int nouveau_pmops_suspend(struct device *);
 int nouveau_pmops_resume(struct device *);
+#endif
 
 #define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args)
 #define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args)

Index: src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.6 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.7
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.6	Tue Oct 27 21:46:42 2015
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Thu Feb 11 04:51:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.6 2015/10/27 21:46:42 mrg Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.7 2016/02/11 04:51:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.6 2015/10/27 21:46:42 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.7 2016/02/11 04:51:44 riastradh Exp $");
 
 #include 
 #include 
@@ -208,15 +208,17 @@ out0:	pmf_device_deregister(self);
 static bool
 nouveau_pci_suspend(device_t self, const pmf_qual_t *qual __unused)
 {
+	struct nouveau_pci_softc *const sc = device_private(self);
 
-	return nouveau_pmops_suspend(self) == 0;
+	return nouveau_pmops_suspend(sc->sc_drm_dev) == 0;
 }
 
 static bool
 nouveau_pci_resume(device_t self, const pmf_qual_t *qual)
 {
+	struct nouveau_pci_softc *const sc = device_private(self);
 
-	return nouveau_pmops_resume(self) == 0;
+	return nouveau_pmops_resume(sc->sc_drm_dev) == 0;
 }
 
 static void



CVS commit: src/sys/external/bsd/dwc2

2016-02-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 14 10:56:23 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Update for latest dwc2 dist


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.38 src/sys/external/bsd/dwc2/dwc2.c:1.39
--- src/sys/external/bsd/dwc2/dwc2.c:1.38	Tue Dec 22 14:31:36 2015
+++ src/sys/external/bsd/dwc2/dwc2.c	Sun Feb 14 10:56:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.38 2015/12/22 14:31:36 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.39 2016/02/14 10:56:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.38 2015/12/22 14:31:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.39 2016/02/14 10:56:22 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1685,7 +1685,7 @@ dwc2_init(struct dwc2_softc *sc)
 		retval = dwc2_hcd_init(hsotg);
 		if (retval) {
 			if (hsotg->gadget_enabled)
-s3c_hsotg_remove(hsotg);
+dwc2_hsotg_remove(hsotg);
 			goto fail2;
 		}
 	hsotg->hcd_enabled = 1;
@@ -1788,30 +1788,30 @@ void dwc2_host_complete(struct dwc2_hsot
 	ed = xfer->pipe->endpoint->edesc;
 	xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
 
-	xfer->actlen = dwc2_hcd_urb_get_actual_length(qtd->urb);
+	struct dwc2_hcd_urb *urb = qtd->urb;
+	xfer->actlen = dwc2_hcd_urb_get_actual_length(urb);
 
 	DPRINTFN(3, "xfer=%p actlen=%d\n", xfer, xfer->actlen);
 
-	if (xfertype == UE_ISOCHRONOUS && dbg_perio()) {
-		int i;
-
-		for (i = 0; i < xfer->nframes; i++)
-			dev_vdbg(hsotg->dev, " ISO Desc %d status %d\n",
- i, qtd->urb->iso_descs[i].status);
-	}
-
 	if (xfertype == UE_ISOCHRONOUS) {
 		int i;
-
 		xfer->actlen = 0;
 		for (i = 0; i < xfer->nframes; ++i) {
 			xfer->frlengths[i] =
 dwc2_hcd_urb_get_iso_desc_actual_length(
-		qtd->urb, i);
+		urb, i);
 			xfer->actlen += xfer->frlengths[i];
 		}
 	}
 
+	if (xfertype == UE_ISOCHRONOUS && dbg_perio()) {
+		int i;
+
+		for (i = 0; i < xfer->nframes; i++)
+			dev_vdbg(hsotg->dev, " ISO Desc %d status %d\n",
+ i, urb->iso_descs[i].status);
+	}
+
 	if (!status) {
 		if (!(xfer->flags & USBD_SHORT_XFER_OK) &&
 		xfer->actlen < xfer->length)
@@ -1838,6 +1838,7 @@ void dwc2_host_complete(struct dwc2_hsot
 		xfer->status = USBD_IOERROR;
 		break;
 	default:
+		xfer->status = USBD_IOERROR;
 		printf("%s: unknown error status %d\n", __func__, status);
 	}
 
@@ -1884,6 +1885,13 @@ _dwc2_hcd_start(struct dwc2_hsotg *hsotg
 
 	mutex_spin_enter(&hsotg->lock);
 
+	hsotg->lx_state = DWC2_L0;
+	
+	if (dwc2_is_device_mode(hsotg)) {
+		mutex_spin_exit(&hsotg->lock);
+		return 0;	/* why 0 ?? */
+	}
+
 	dwc2_hcd_reinit(hsotg);
 
 	mutex_spin_exit(&hsotg->lock);



CVS commit: src/sys/external/bsd/dwc2

2016-02-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 19 21:10:18 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2: dwc2.h

Log Message:
In msleep use udelay if cold or sleep is small enough.  This is mostly
copied from the drm2 version.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/dwc2/dwc2.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/dwc2/dwc2.h
diff -u src/sys/external/bsd/dwc2/dwc2.h:1.7 src/sys/external/bsd/dwc2/dwc2.h:1.8
--- src/sys/external/bsd/dwc2/dwc2.h:1.7	Sun Aug 30 13:02:42 2015
+++ src/sys/external/bsd/dwc2/dwc2.h	Fri Feb 19 21:10:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.h,v 1.7 2015/08/30 13:02:42 skrll Exp $	*/
+/*	$NetBSD: dwc2.h,v 1.8 2016/02/19 21:10:18 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -260,10 +260,13 @@ ndelay(unsigned long nsecs)
 }
 
 static inline void
-msleep(unsigned int msecs)
+msleep(unsigned int msec)
 {
-
-	kpause("mdelay", false, mstohz(msecs), NULL);
+	if (cold ||
+	((hz < 1000) && (msec < (1000/hz
+		udelay(msec * 1000);
+	else
+		(void)kpause("mdelay", false, mstohz(msec), NULL);
 }
 
 #define	EREMOTEIO	EIO



CVS commit: src/sys/external/bsd/dwc2

2016-02-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb 24 22:09:09 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.39 src/sys/external/bsd/dwc2/dwc2.c:1.40
--- src/sys/external/bsd/dwc2/dwc2.c:1.39	Sun Feb 14 10:56:22 2016
+++ src/sys/external/bsd/dwc2/dwc2.c	Wed Feb 24 22:09:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.39 2016/02/14 10:56:22 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.40 2016/02/24 22:09:09 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.39 2016/02/14 10:56:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.40 2016/02/24 22:09:09 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1886,7 +1886,7 @@ _dwc2_hcd_start(struct dwc2_hsotg *hsotg
 	mutex_spin_enter(&hsotg->lock);
 
 	hsotg->lx_state = DWC2_L0;
-	
+
 	if (dwc2_is_device_mode(hsotg)) {
 		mutex_spin_exit(&hsotg->lock);
 		return 0;	/* why 0 ?? */



CVS commit: src/sys/external/bsd/dwc2

2016-02-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb 24 22:17:54 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c dwc2.h
src/sys/external/bsd/dwc2/conf: files.dwc2
src/sys/external/bsd/dwc2/dist: dwc2_core.c dwc2_core.h dwc2_coreintr.c
dwc2_hcd.c dwc2_hcd.h

Log Message:
Reduce diff to upstream by using

sys/external/bsd/{include/workqueue.h,linux/linux_work.c}

This also fixes CI20 dwctwo start up as reported by macallan@


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/external/bsd/dwc2/dwc2.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/dwc2/dwc2.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/dwc2/conf/files.dwc2
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/dwc2/dist/dwc2_core.c \
src/sys/external/bsd/dwc2/dist/dwc2_hcd.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/dwc2/dist/dwc2_core.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/dwc2/dist/dwc2_coreintr.c
cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.40 src/sys/external/bsd/dwc2/dwc2.c:1.41
--- src/sys/external/bsd/dwc2/dwc2.c:1.40	Wed Feb 24 22:09:09 2016
+++ src/sys/external/bsd/dwc2/dwc2.c	Wed Feb 24 22:17:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.40 2016/02/24 22:09:09 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.41 2016/02/24 22:17:54 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.40 2016/02/24 22:09:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.41 2016/02/24 22:17:54 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1453,45 +1453,6 @@ fail:
 
 }
 
-#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
-void
-dwc2_worker(struct work *wk, void *priv)
-{
-	struct dwc2_softc *sc = priv;
-	struct dwc2_hsotg *hsotg = sc->sc_hsotg;
-
-Debugger();
-#if 0
-	usbd_xfer_handle xfer = dwork->xfer;
-	struct dwc2_xfer *dxfer = DWC2_XFER2DXFER(xfer);
-
-	dwc2_hcd_endpoint_disable(sc->dwc_dev.hcd, dpipe->priv, 250);
-	dwc_free(NULL, dpipe->urb);
-#endif
-
-	mutex_enter(&sc->sc_lock);
-	if (wk == &hsotg->wf_otg) {
-		dwc2_conn_id_status_change(wk);
-	} else if (wk == &hsotg->start_work.work) {
-		dwc2_hcd_start_func(wk);
-	} else if (wk == &hsotg->reset_work.work) {
-		dwc2_hcd_reset_func(wk);
-	} else {
-#if 0
-		KASSERT(dwork->xfer != NULL);
-		KASSERT(dxfer->queued == true);
-
-		if (!(xfer->hcflags & UXFER_ABORTING)) {
-			dwc2_start_standard_chain(xfer);
-		}
-		dxfer->queued = false;
-		cv_broadcast(&xfer->hccv);
-#endif
-	}
-	mutex_exit(&sc->sc_lock);
-}
-#endif
-
 int dwc2_intr(void *p)
 {
 	struct dwc2_softc *sc = p;
@@ -1723,15 +1684,6 @@ static const char * const intnames[32] =
 
 #endif
 
-
-void
-dw_callout(void *arg)
-{
-	struct delayed_work *dw = arg;
-
-	workqueue_enqueue(dw->dw_wq, &dw->work, NULL);
-}
-
 void dwc2_host_hub_info(struct dwc2_hsotg *hsotg, void *context, int *hub_addr,
 			int *hub_port)
 {

Index: src/sys/external/bsd/dwc2/dwc2.h
diff -u src/sys/external/bsd/dwc2/dwc2.h:1.8 src/sys/external/bsd/dwc2/dwc2.h:1.9
--- src/sys/external/bsd/dwc2/dwc2.h:1.8	Fri Feb 19 21:10:18 2016
+++ src/sys/external/bsd/dwc2/dwc2.h	Wed Feb 24 22:17:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.h,v 1.8 2016/02/19 21:10:18 skrll Exp $	*/
+/*	$NetBSD: dwc2.h,v 1.9 2016/02/24 22:17:54 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,6 +40,7 @@
 #include 
 
 #include 
+#include 
 
 #include "opt_usb.h"
 // #define VERBOSE_DEBUG
@@ -277,26 +278,4 @@ msleep(unsigned int msec)
 
 #define USB_RESUME_TIMEOUT	40 /* ms */
 
-void dw_callout(void *);
-void dwc2_worker(struct work *, void *);
-
-struct delayed_work {
-	struct work work;
-	struct callout dw_timer;
-
-	struct workqueue *dw_wq;
-};
-
-static inline void
-INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct work *))
-{
-	callout_init(&dw->dw_timer, CALLOUT_MPSAFE);
-}
-
-static inline void
-queue_delayed_work(struct workqueue *wq, struct delayed_work *dw, int j)
-{
-	callout_reset(&dw->dw_timer, j, dw_callout, dw);
-}
-
 #endif

Index: src/sys/external/bsd/dwc2/conf/files.dwc2
diff -u src/sys/external/bsd/dwc2/conf/files.dwc2:1.2 src/sys/external/bsd/dwc2/conf/files.dwc2:1.3
--- src/sys/external/bsd/dwc2/conf/files.dwc2:1.2	Fri Sep 12 16:40:38 2014
+++ src/sys/external/bsd/dwc2/conf/files.dwc2	Wed Feb 24 22:17:54 2016
@@ -1,11 +1,12 @@
-#	$NetBSD: files.dwc2,v 1.2 2014/09/12 16:40:38 skrll Exp $
+#	$NetBSD: files.dwc2,v 1.3 2016/02/24 22:17:54 skrll Exp $
 
 # DesignWare HS OTG Controller
 #
-device dwctwo: usbus, usbroothub, usb_dma
+
+device dwctwo: usbus, usbroothub, usb_dma, linux
 file	external/bsd/dwc2/dwc2.c			dwctwo	needs-flag
 
-makeoptions	dwctwo	CPPFLAGS+=" -I$S/external/bsd/common/include -I$

CVS commit: src/sys/external/bsd/drm2

2014-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 12 02:24:40 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
src/sys/external/bsd/drm2/i915drm: i915_module.c
src/sys/external/bsd/drm2/include/linux: module.h moduleparam.h
Added Files:
src/sys/external/bsd/drm2/drm: drm_sysctl.c
src/sys/external/bsd/drm2/include/drm: drm_sysctl.h

Log Message:
Add __link_set based code to automatically convert the linux module parameters
into sysctls.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/drm/drm_sysctl.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/i915drm/i915_module.c
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/include/drm/drm_sysctl.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/module.h
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/include/linux/moduleparam.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/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.8 src/sys/external/bsd/drm2/drm/files.drmkms:1.9
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.8	Sun Sep 14 15:06:00 2014
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Tue Nov 11 21:24:40 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.8 2014/09/14 19:06:00 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.9 2014/11/12 02:24:40 christos Exp $
 
 include "external/bsd/drm2/linux/files.drmkms_linux"
 
@@ -65,5 +65,6 @@ file	external/bsd/drm2/drm/drm_vma_manag
 
 file	external/bsd/drm2/drm/drm_gem_vm.c		drmkms
 file	external/bsd/drm2/drm/drm_module.c		drmkms
+file	external/bsd/drm2/drm/drm_sysctl.c		drmkms
 
 include "external/bsd/drm2/ttm/files.ttm"

Index: src/sys/external/bsd/drm2/i915drm/i915_module.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_module.c:1.3 src/sys/external/bsd/drm2/i915drm/i915_module.c:1.4
--- src/sys/external/bsd/drm2/i915drm/i915_module.c:1.3	Wed Jul 16 16:56:25 2014
+++ src/sys/external/bsd/drm2/i915drm/i915_module.c	Tue Nov 11 21:24:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_module.c,v 1.3 2014/07/16 20:56:25 riastradh Exp $	*/
+/*	$NetBSD: i915_module.c,v 1.4 2014/11/12 02:24:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.3 2014/07/16 20:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.4 2014/11/12 02:24:40 christos Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: i915_module.
 #include 
 
 #include 
+#include 
 
 #include "i915_drv.h"
 
@@ -54,6 +55,10 @@ extern struct drm_driver *const i915_drm
 extern const struct pci_device_id *const i915_device_ids;
 extern const size_t i915_n_device_ids;
 
+static struct sysctllog *i915_sysctllog;
+__link_set_decl(linux_module_param_info, struct linux_module_param_info);
+__link_set_decl(linux_module_param_desc, struct linux_module_param_desc);
+
 static int
 i915drmkms_init(void)
 {
@@ -74,6 +79,13 @@ i915drmkms_init(void)
 		error);
 		return error;
 	}
+	const void *v[] = {
+	__link_set_start(linux_module_param_info),
+	__link_set_end(linux_module_param_info),
+	__link_set_start(linux_module_param_desc),
+	__link_set_end(linux_module_param_desc),
+	};
+	drm_sysctl_init(v, &i915_sysctllog);
 
 	return 0;
 }
@@ -96,6 +108,7 @@ i915drmkms_fini(void)
 {
 
 	drm_pci_exit(i915_drm_driver, NULL);
+	drm_sysctl_fini(&i915_sysctllog);
 }
 
 static int

Index: src/sys/external/bsd/drm2/include/linux/module.h
diff -u src/sys/external/bsd/drm2/include/linux/module.h:1.4 src/sys/external/bsd/drm2/include/linux/module.h:1.5
--- src/sys/external/bsd/drm2/include/linux/module.h:1.4	Wed Aug  6 09:49:33 2014
+++ src/sys/external/bsd/drm2/include/linux/module.h	Tue Nov 11 21:24:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: module.h,v 1.4 2014/08/06 13:49:33 riastradh Exp $	*/
+/*	$NetBSD: module.h,v 1.5 2014/11/12 02:24:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -43,7 +43,17 @@
 #define	MODULE_DEVICE_TABLE(DESCRIPTION, IDLIST)
 #define	MODULE_FIRMWARE(FIRMWARE)
 #define	MODULE_LICENSE(LICENSE)
-#define	MODULE_PARM_DESC(PARAMETER, DESCRIPTION)
+struct linux_module_param_desc {
+	const char *name;
+	const char *description;
+};
+#define	MODULE_PARM_DESC(PARAMETER, DESCRIPTION) \
+static __attribute__((__used__)) \
+const struct linux_module_param_desc PARAMETER ## _desc = { \
+.name = # PARAMETER, \
+.description = DESCRIPTION, \
+}; \
+__link_set_add_rodata(linux_module_param_desc, PARAMETER ## _desc)
 
 #define	THIS_MODULE	0
 

Index: src/sys/external/bsd/drm2/include/linux/moduleparam.h
diff -u src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.2 src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.3
--- src/sys/externa

CVS commit: src/sys/external/bsd/drm2

2014-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 12 03:14:00 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/drm: drm_module.c drm_sysctl.c
src/sys/external/bsd/drm2/i915drm: i915_module.c
src/sys/external/bsd/drm2/include/drm: drm_sysctl.h
src/sys/external/bsd/drm2/nouveau: nouveau_module.c
src/sys/external/bsd/drm2/radeon: radeon_module.c

Log Message:
prettify and add to all the modules that have it.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/drm/drm_module.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/drm/drm_sysctl.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/i915drm/i915_module.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/drm/drm_sysctl.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/nouveau/nouveau_module.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/radeon/radeon_module.c

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/drm/drm_module.c
diff -u src/sys/external/bsd/drm2/drm/drm_module.c:1.8 src/sys/external/bsd/drm2/drm/drm_module.c:1.9
--- src/sys/external/bsd/drm2/drm/drm_module.c:1.8	Sun Sep 14 16:08:21 2014
+++ src/sys/external/bsd/drm2/drm/drm_module.c	Tue Nov 11 22:14:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_module.c,v 1.8 2014/09/14 20:08:21 riastradh Exp $	*/
+/*	$NetBSD: drm_module.c,v 1.9 2014/11/12 03:14:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.8 2014/09/14 20:08:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.9 2014/11/12 03:14:00 christos Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: drm_module.c
 #include 
 
 #include 
+#include 
 
 /*
  * XXX I2C stuff should be moved to a separate drmkms_i2c module.
@@ -53,6 +54,8 @@ MODULE(MODULE_CLASS_DRIVER, drmkms, "iic
 
 struct mutex	drm_global_mutex;
 
+struct drm_sysctl_def drm_def = DRM_SYSCTL_INIT();
+
 static int
 drm_init(void)
 {
@@ -71,6 +74,7 @@ drm_init(void)
 	linux_mutex_init(&drm_global_mutex);
 	drm_connector_ida_init();
 	drm_global_init();
+	drm_sysctl_init(&drm_def);
 
 	return 0;
 }
@@ -91,7 +95,7 @@ drm_guarantee_initialized(void)
 static void
 drm_fini(void)
 {
-
+	drm_sysctl_fini(&drm_def);
 	drm_global_release();
 	drm_connector_ida_destroy();
 	linux_mutex_destroy(&drm_global_mutex);

Index: src/sys/external/bsd/drm2/drm/drm_sysctl.c
diff -u src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.1 src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.2
--- src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.1	Tue Nov 11 21:24:40 2014
+++ src/sys/external/bsd/drm2/drm/drm_sysctl.c	Tue Nov 11 22:14:00 2014
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.1 2014/11/12 02:24:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.2 2014/11/12 03:14:00 christos Exp $");
 
 #include 
 #include 
@@ -41,9 +41,10 @@ __KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c
 #include 
 
 static const char *
-drm_sysctl_get_description(const struct linux_module_param_info *p, const void **v)
+drm_sysctl_get_description(const struct linux_module_param_info *p,
+const struct drm_sysctl_def *def)
 {
-	const void * const *b = v[0], * const *e = v[1];
+	const void * const *b = def->bd, * const *e = def->ed;
 
 	for (; b < e; b++) {
 		const struct linux_module_param_desc *d = *b;
@@ -112,14 +113,14 @@ drm_sysctl_node(const char *name, const 
 	
 
 void
-drm_sysctl_init(const void **v, struct sysctllog **log)
+drm_sysctl_init(struct drm_sysctl_def *def)
 {
-	const void * const *b = v[0], * const *e = v[1];
+	const void * const *b = def->bp, * const *e = def->ep;
 	const struct sysctlnode *rnode = NULL, *cnode;
 	const char *name = "drm2";
 
 	int error;
-	if ((error = sysctl_createv(log, 0, NULL, &rnode,
+	if ((error = sysctl_createv(&def->log, 0, NULL, &rnode,
 	CTLFLAG_PERMANENT, CTLTYPE_NODE, name,
 	SYSCTL_DESCR("DRM driver parameters"),
 	NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL)) != 0) {
@@ -135,17 +136,18 @@ drm_sysctl_init(const void **v, struct s
 		cnode = rnode;
 		for (n = copy; (nn = strchr(n, '.')) != NULL; n = nn) {
 			*nn++ = '\0';
-			if ((error = drm_sysctl_node(n, &cnode, log)) != 0) {
+			if ((error = drm_sysctl_node(n, &cnode, &def->log))
+			!= 0) {
 aprint_error("sysctl_createv returned %d, "
 "for %s ignoring\n", error, n);
 continue;
 			}
 		}
 			
-	if ((error = sysctl_createv(log, 0, &cnode,
+	if ((error = sysctl_createv(&def->log, 0, &cnode,
 		&cnode, p->mode == 0600 ? CTLFLAG_READWRITE : 0,
 		drm_sysctl_get_type(p), n,
-		SYSCTL_DESCR(drm_sysctl_get_description(p, v + 2)),
+		SYSCTL_DESCR(drm_sysctl_get_description(p, def)),
 		NULL, 0, p->ptr, 0, CTL_CREATE, CTL_EOL))

CVS commit: src/sys/external/bsd/drm2

2014-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 12 04:53:14 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/drm: drm_sysctl.c
src/sys/external/bsd/drm2/include/linux: moduleparam.h

Log Message:
fix description setting.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/drm/drm_sysctl.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/include/linux/moduleparam.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/drm/drm_sysctl.c
diff -u src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.2 src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.3
--- src/sys/external/bsd/drm2/drm/drm_sysctl.c:1.2	Tue Nov 11 22:14:00 2014
+++ src/sys/external/bsd/drm2/drm/drm_sysctl.c	Tue Nov 11 23:53:13 2014
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.2 2014/11/12 03:14:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.3 2014/11/12 04:53:13 christos Exp $");
 
 #include 
 #include 
@@ -48,7 +48,7 @@ drm_sysctl_get_description(const struct 
 
 	for (; b < e; b++) {
 		const struct linux_module_param_desc *d = *b;
-		if (strcmp(p->name, d->name) == 0)
+		if (strcmp(p->dname, d->name) == 0)
 			return d->description;
 	}
 	return NULL;

Index: src/sys/external/bsd/drm2/include/linux/moduleparam.h
diff -u src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.3 src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.4
--- src/sys/external/bsd/drm2/include/linux/moduleparam.h:1.3	Tue Nov 11 21:24:40 2014
+++ src/sys/external/bsd/drm2/include/linux/moduleparam.h	Tue Nov 11 23:53:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: moduleparam.h,v 1.3 2014/11/12 02:24:40 christos Exp $	*/
+/*	$NetBSD: moduleparam.h,v 1.4 2014/11/12 04:53:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,10 +35,11 @@
 #include 
 
 struct linux_module_param_info {
-	const char *name;
-	void *ptr;
-	int type;
-	mode_t mode;
+	const char *dname;	// Name used for description
+	const char *name;	// Name for sysctl
+	void *ptr;		// Pointer to variable value
+	int type;		// MTYPE_ 
+	mode_t mode;		// 600 (rw) or 400 (r)
 };
 
 #define MTYPE_int	0
@@ -46,6 +47,7 @@ struct linux_module_param_info {
 
 #define	module_param_named(NAME, VAR, TYPE, MODE) \
 static __attribute__((__used__)) struct linux_module_param_info info_ ## NAME = { \
+	.dname = # NAME, \
 	.name = # VAR, \
 	.ptr = & VAR, \
 	.type = MTYPE_ ## TYPE, \



CVS commit: src/sys/external/bsd/drm2

2014-11-18 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Nov 18 09:28:37 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_fb.c
src/sys/external/bsd/drm2/radeon: radeondrmkmsfb.c radeondrmkmsfb.h

Log Message:
Use correct linebytes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.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/dist/drm/radeon/radeon_fb.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c:1.4 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c:1.4	Sat Jul 26 06:37:53 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c	Tue Nov 18 09:28:36 2014
@@ -255,6 +255,7 @@ static int radeonfb_create(struct drm_fb
 	rfa.rfa_fb_helper = helper;
 	rfa.rfa_fb_sizes = *sizes;
 	rfa.rfa_fb_ptr = rbo->kptr;
+	rfa.rfa_fb_linebytes = mode_cmd.pitches[0];
 
 	helper->fbdev = config_found_ia(rdev->ddev->dev, "radeonfbbus", &rfa,
 	NULL);

Index: src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
diff -u src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.4 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.5
--- src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.4	Wed Nov 12 16:07:17 2014
+++ src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c	Tue Nov 18 09:28:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeondrmkmsfb.c,v 1.4 2014/11/12 16:07:17 chs Exp $	*/
+/*	$NetBSD: radeondrmkmsfb.c,v 1.5 2014/11/18 09:28:36 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.4 2014/11/12 16:07:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.5 2014/11/18 09:28:36 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -171,8 +171,7 @@ radeonfb_setconfig_task(struct radeon_ta
 	prop_dictionary_set_uint32(dict, "width", sizes->fb_width);
 	prop_dictionary_set_uint32(dict, "height", sizes->fb_height);
 	prop_dictionary_set_uint8(dict, "depth", sizes->surface_bpp);
-	prop_dictionary_set_uint16(dict, "linebytes",
-	roundup2((sizes->fb_width * howmany(sizes->surface_bpp, 8)), 64));
+	prop_dictionary_set_uint16(dict, "linebytes", rfa->rfa_fb_linebytes);
 	prop_dictionary_set_uint32(dict, "address", 0); /* XXX >32-bit */
 	CTASSERT(sizeof(uintptr_t) <= sizeof(uint64_t));
 	prop_dictionary_set_uint64(dict, "virtual_address",

Index: src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.h
diff -u src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.h:1.1 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.h:1.2
--- src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.h:1.1	Fri Jul 25 12:35:03 2014
+++ src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.h	Tue Nov 18 09:28:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeondrmkmsfb.h,v 1.1 2014/07/25 12:35:03 riastradh Exp $	*/
+/*	$NetBSD: radeondrmkmsfb.h,v 1.2 2014/11/18 09:28:36 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -39,6 +39,7 @@ struct radeonfb_attach_args {
 	struct drm_fb_helper			*rfa_fb_helper;
 	struct drm_fb_helper_surface_size	rfa_fb_sizes;
 	void	*rfa_fb_ptr;
+	uint32_trfa_fb_linebytes;
 };
 
 #endif	/* _RADEON_RADEONDRMKMS_H_ */



CVS commit: src/sys/external/bsd/dwc2

2014-12-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec 23 16:20:06 UTC 2014

Modified Files:
src/sys/external/bsd/dwc2: dwc2.h

Log Message:
#include "opt_usb.h"


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/dwc2/dwc2.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/dwc2/dwc2.h
diff -u src/sys/external/bsd/dwc2/dwc2.h:1.3 src/sys/external/bsd/dwc2/dwc2.h:1.4
--- src/sys/external/bsd/dwc2/dwc2.h:1.3	Tue Sep  2 14:55:56 2014
+++ src/sys/external/bsd/dwc2/dwc2.h	Tue Dec 23 16:20:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.h,v 1.3 2014/09/02 14:55:56 skrll Exp $	*/
+/*	$NetBSD: dwc2.h,v 1.4 2014/12/23 16:20:06 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,6 +40,7 @@
 
 #include 
 
+#include "opt_usb.h"
 // #define VERBOSE_DEBUG
 // #define DWC2_DUMP_FRREM
 // #define CONFIG_USB_DWC2_TRACK_MISSED_SOFS



CVS commit: src/sys/external/bsd/drm2

2014-09-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep 14 19:06:01 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
Added Files:
src/sys/external/bsd/drm2/ttm: files.ttm

Log Message:
Split drm ttm config into a separate file.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/ttm/files.ttm

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/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.7 src/sys/external/bsd/drm2/drm/files.drmkms:1.8
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.7	Wed Jul 16 20:59:57 2014
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Sun Sep 14 19:06:00 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.7 2014/07/16 20:59:57 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.8 2014/09/14 19:06:00 riastradh Exp $
 
 include "external/bsd/drm2/linux/files.drmkms_linux"
 
@@ -66,27 +66,4 @@ file	external/bsd/drm2/drm/drm_vma_manag
 file	external/bsd/drm2/drm/drm_gem_vm.c		drmkms
 file	external/bsd/drm2/drm/drm_module.c		drmkms
 
-# TTM, the texture and tiling manager.
-
-define	drmkms_ttm: drmkms
-
-file	external/bsd/drm2/ttm/ttm_agp_backend.c			drmkms_ttm
-file	external/bsd/drm2/dist/drm/ttm/ttm_memory.c		drmkms_ttm
-file	external/bsd/drm2/dist/drm/ttm/ttm_tt.c			drmkms_ttm
-file	external/bsd/drm2/dist/drm/ttm/ttm_bo.c			drmkms_ttm
-file	external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c		drmkms_ttm
-file	external/bsd/drm2/ttm/ttm_bo_vm.c			drmkms_ttm
-# Linux module goo.
-#file	external/bsd/drm2/dist/drm/ttm/ttm_module.c		drmkms_ttm
-# Used only by vmwgfx.  Needs porting for rcu -> pserialize.
-#file	external/bsd/drm2/dist/drm/ttm/ttm_object.c		drmkms_ttm
-# Used only by vmwgfx.  Needs porting.  Does silly things like SIGKILL.
-#file	external/bsd/drm2/dist/drm/ttm/ttm_lock.c		drmkms_ttm
-file	external/bsd/drm2/dist/drm/ttm/ttm_execbuf_util.c	drmkms_ttm
-# Replaced locally by ttm_bus_dma.c.
-#file	external/bsd/drm2/dist/drm/ttm/ttm_page_alloc.c		drmkms_ttm
-file	external/bsd/drm2/dist/drm/ttm/ttm_bo_manager.c		drmkms_ttm
-# Replaced locally by ttm_bus_dma.c.
-#file	external/bsd/drm2/dist/drm/ttm/ttm_page_alloc_dma.c	drmkms_ttm
-
-file	external/bsd/drm2/ttm/ttm_bus_dma.c			drmkms_ttm
+include "external/bsd/drm2/ttm/files.ttm"

Added files:

Index: src/sys/external/bsd/drm2/ttm/files.ttm
diff -u /dev/null src/sys/external/bsd/drm2/ttm/files.ttm:1.1
--- /dev/null	Sun Sep 14 19:06:01 2014
+++ src/sys/external/bsd/drm2/ttm/files.ttm	Sun Sep 14 19:06:01 2014
@@ -0,0 +1,26 @@
+#	$NetBSD: files.ttm,v 1.1 2014/09/14 19:06:01 riastradh Exp $
+
+# TTM, the texture and tiling manager.
+
+define	drmkms_ttm: drmkms
+
+file	external/bsd/drm2/ttm/ttm_agp_backend.c			drmkms_ttm
+file	external/bsd/drm2/dist/drm/ttm/ttm_memory.c		drmkms_ttm
+file	external/bsd/drm2/dist/drm/ttm/ttm_tt.c			drmkms_ttm
+file	external/bsd/drm2/dist/drm/ttm/ttm_bo.c			drmkms_ttm
+file	external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c		drmkms_ttm
+file	external/bsd/drm2/ttm/ttm_bo_vm.c			drmkms_ttm
+# Linux module goo.
+#file	external/bsd/drm2/dist/drm/ttm/ttm_module.c		drmkms_ttm
+# Used only by vmwgfx.  Needs porting for rcu -> pserialize.
+#file	external/bsd/drm2/dist/drm/ttm/ttm_object.c		drmkms_ttm
+# Used only by vmwgfx.  Needs porting.  Does silly things like SIGKILL.
+#file	external/bsd/drm2/dist/drm/ttm/ttm_lock.c		drmkms_ttm
+file	external/bsd/drm2/dist/drm/ttm/ttm_execbuf_util.c	drmkms_ttm
+# Replaced locally by ttm_bus_dma.c.
+#file	external/bsd/drm2/dist/drm/ttm/ttm_page_alloc.c		drmkms_ttm
+file	external/bsd/drm2/dist/drm/ttm/ttm_bo_manager.c		drmkms_ttm
+# Replaced locally by ttm_bus_dma.c.
+#file	external/bsd/drm2/dist/drm/ttm/ttm_page_alloc_dma.c	drmkms_ttm
+
+file	external/bsd/drm2/ttm/ttm_bus_dma.c			drmkms_ttm



CVS commit: src/sys/external/bsd/drm2

2014-11-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Nov  4 11:27:31 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/drm: drm_drv.c
src/sys/external/bsd/drm2/include/drm: drm_irq_netbsd.h
src/sys/external/bsd/drm2/include/linux: spinlock.h ww_mutex.h
src/sys/external/bsd/drm2/linux: linux_idr.c linux_kmap.c linux_work.c
linux_writecomb.c
src/sys/external/bsd/drm2/pci: drm_pci.c

Log Message:
This code should be MP-safe. Use IPL_SCHED in place of IPL_DRM/IPL_VM and set
D_MPSAFE flag in cdevsw.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/drm/drm_drv.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/spinlock.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/ww_mutex.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/linux/linux_idr.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/linux/linux_kmap.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/linux/linux_work.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/linux/linux_writecomb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/pci/drm_pci.c

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/drm/drm_drv.c
diff -u src/sys/external/bsd/drm2/drm/drm_drv.c:1.9 src/sys/external/bsd/drm2/drm/drm_drv.c:1.10
--- src/sys/external/bsd/drm2/drm/drm_drv.c:1.9	Sat Jul 26 21:15:45 2014
+++ src/sys/external/bsd/drm2/drm/drm_drv.c	Tue Nov  4 11:27:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.9 2014/07/26 21:15:45 riastradh Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.10 2014/11/04 11:27:31 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.9 2014/07/26 21:15:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.10 2014/11/04 11:27:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -234,8 +234,7 @@ const struct cdevsw drm_cdevsw = {
 	.d_kqfilter = nokqfilter,
 	.d_discard = nodiscard,
 	/* XXX was D_TTY | D_NEGOFFSAFE */
-	/* XXX Add D_MPSAFE some day... */
-	.d_flag = D_NEGOFFSAFE,
+	.d_flag = D_NEGOFFSAFE | D_MPSAFE,
 };
 
 static const struct fileops drm_fileops = {

Index: src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h:1.2 src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h:1.3
--- src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h:1.2	Tue Mar 18 18:20:43 2014
+++ src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h	Tue Nov  4 11:27:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_irq_netbsd.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $	*/
+/*	$NetBSD: drm_irq_netbsd.h,v 1.3 2014/11/04 11:27:31 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,6 +41,4 @@ typedef int irqreturn_t;
 
 #define	IRQF_SHARED	0	/* XXX */
 
-#define	IPL_DRM		IPL_TTY	/* XXX */
-
 #endif  /* _DRM_DRM_IRQ_NETBSD_H_ */

Index: src/sys/external/bsd/drm2/include/linux/spinlock.h
diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.4 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.5
--- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.4	Sat Aug 23 08:03:33 2014
+++ src/sys/external/bsd/drm2/include/linux/spinlock.h	Tue Nov  4 11:27:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: spinlock.h,v 1.4 2014/08/23 08:03:33 riastradh Exp $	*/
+/*	$NetBSD: spinlock.h,v 1.5 2014/11/04 11:27:31 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -88,8 +88,7 @@ spin_unlock_irqrestore(spinlock_t *spinl
 static inline void
 spin_lock_init(spinlock_t *spinlock)
 {
-	/* XXX What's the right IPL?  IPL_DRM...?  */
-	mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_VM);
+	mutex_init(&spinlock->sl_lock, MUTEX_DEFAULT, IPL_SCHED);
 }
 
 /*

Index: src/sys/external/bsd/drm2/include/linux/ww_mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.7 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.8
--- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.7	Mon Sep 15 20:24:55 2014
+++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h	Tue Nov  4 11:27:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ww_mutex.h,v 1.7 2014/09/15 20:24:55 riastradh Exp $	*/
+/*	$NetBSD: ww_mutex.h,v 1.8 2014/11/04 11:27:31 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -147,7 +147,7 @@ ww_mutex_init(struct ww_mutex *mutex, st
 	 * XXX Apparently Linux takes these with spin locks held.  That
 	 * strikes me as a bad idea, but so it is...
 	 */
-	mutex_init(&mutex->wwm_lock, MUTEX_DEFAULT, IPL_VM);
+	mutex_init(&mutex->wwm_lock, MUTEX_DEFAULT, IPL_SCHED);
 	mutex->wwm_state = WW_UNLOCKED;
 	mutex->wwm_class = class;
 	rb_tree_init(&mutex->wwm_waiters, &ww_acquire_ctx_rb_ops);

Index: src/sys/external/bsd/drm2/li

CVS commit: src/sys/external/bsd/drm2

2014-11-05 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Nov  5 23:46:09 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_dma.c i915_drv.h
intel_acpi.c intel_opregion.c
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/include/linux: acpi.h pci.h

Log Message:
i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo 
W330SU2).


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/i915/intel_acpi.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_opregion.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/acpi.h
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/pci.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/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.11 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.12
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.11	Sun Sep  7 23:03:11 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Wed Nov  5 23:46:09 2014
@@ -1375,7 +1375,11 @@ static int i915_load_modeset_init(struct
 		goto out;
 #endif
 
+#ifdef __NetBSD__
+	intel_register_dsm_handler(dev);
+#else
 	intel_register_dsm_handler();
+#endif
 
 #ifndef __NetBSD__		/* XXX vga */
 	ret = vga_switcheroo_register_client(dev->pdev, &i915_switcheroo_ops, false);

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.10
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.9	Sun Sep  7 23:03:11 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h	Wed Nov  5 23:46:09 2014
@@ -30,6 +30,13 @@
 #ifndef _I915_DRV_H_
 #define _I915_DRV_H_
 
+#if defined(__NetBSD__) && (defined(i386) || defined(amd64))
+#include "acpica.h"
+#if (NACPICA > 0)
+#define CONFIG_ACPI
+#endif
+#endif
+
 #include 
 
 #include "i915_reg.h"
@@ -2720,8 +2727,8 @@ extern void intel_i2c_reset(struct drm_d
 
 /* intel_opregion.c */
 struct intel_encoder;
-extern int intel_opregion_setup(struct drm_device *dev);
 #ifdef CONFIG_ACPI
+extern int intel_opregion_setup(struct drm_device *dev);
 extern void intel_opregion_init(struct drm_device *dev);
 extern void intel_opregion_fini(struct drm_device *dev);
 extern void intel_opregion_asle_intr(struct drm_device *dev);
@@ -2730,6 +2737,7 @@ extern int intel_opregion_notify_encoder
 extern int intel_opregion_notify_adapter(struct drm_device *dev,
 	 pci_power_t state);
 #else
+static inline int intel_opregion_setup(struct drm_device *dev) { return 0; }
 static inline void intel_opregion_init(struct drm_device *dev) { return; }
 static inline void intel_opregion_fini(struct drm_device *dev) { return; }
 static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
@@ -2747,10 +2755,22 @@ intel_opregion_notify_adapter(struct drm
 
 /* intel_acpi.c */
 #ifdef CONFIG_ACPI
+#ifdef __NetBSD__
+extern void intel_register_dsm_handler(struct drm_device *);
+#else
 extern void intel_register_dsm_handler(void);
+#endif
 extern void intel_unregister_dsm_handler(void);
 #else
+#ifdef __NetBSD__
+static inline void
+intel_register_dsm_handler(struct drm_device *dev)
+{
+	return;
+}
+#else
 static inline void intel_register_dsm_handler(void) { return; }
+#endif
 static inline void intel_unregister_dsm_handler(void) { return; }
 #endif /* CONFIG_ACPI */
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_acpi.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/intel_acpi.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_acpi.c:1.2	Wed Jul 16 20:56:25 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_acpi.c	Wed Nov  5 23:46:09 2014
@@ -9,11 +9,104 @@
 #include 
 #include "i915_drv.h"
 
+#ifdef CONFIG_ACPI
+
+#ifdef __NetBSD__
+static ACPI_OBJECT *
+acpi_evaluate_dsm(ACPI_HANDLE handle, const uint8_t *uuid, int rev, int func,
+ACPI_OBJECT *argv4)
+{
+	ACPI_OBJECT_LIST arg;
+	ACPI_OBJECT params[4];
+	ACPI_BUFFER buf;
+	ACPI_STATUS rv;
+
+	if (handle == NULL)
+		handle = ACPI_ROOT_OBJECT;
+
+	arg.Count = 4;
+	arg.Pointer = params;
+	params[0].Type = ACPI_TYPE_BUFFER;
+	params[0].Buffer.Length = 16;
+	params[0].Buffer.Pointer = (char *)__UNCONST(uuid);
+	params[1].Type = ACPI_TYPE_INTEGER;
+	params[1].Integer.Value = rev;
+	params[2].Type = ACPI_TYPE_INTEGER;
+	params[2].Integer.Value = func;
+	if (argv4 != NULL) {
+		params[3] = *argv4;
+	} else

CVS commit: src/sys/external/bsd/dwc2

2013-11-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov 28 06:56:36 UTC 2013

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Drop the intr_lock when calling usb_schedsoftintr so that we don't lock
against ourself in dwc2_softintr in the polling case.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.20 src/sys/external/bsd/dwc2/dwc2.c:1.21
--- src/sys/external/bsd/dwc2/dwc2.c:1.20	Tue Nov 19 10:07:11 2013
+++ src/sys/external/bsd/dwc2/dwc2.c	Thu Nov 28 06:56:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.20 2013/11/19 10:07:11 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.21 2013/11/28 06:56:36 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.20 2013/11/19 10:07:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.21 2013/11/28 06:56:36 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1764,7 +1764,9 @@ void dwc2_host_complete(struct dwc2_hsot
 
 	TAILQ_INSERT_TAIL(&sc->sc_complete, dxfer, xnext);
 
+	mutex_spin_exit(&hsotg->lock);
 	usb_schedsoftintr(&sc->sc_bus);
+	mutex_spin_enter(&hsotg->lock);
 }
 
 



CVS commit: src/sys/external/bsd/sljit

2013-12-17 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Dec 17 22:39:23 UTC 2013

Modified Files:
src/sys/external/bsd/sljit/dist/sljit_src: sljitConfig.h
sljitExecAllocator.c sljitUtils.c
src/sys/external/bsd/sljit/sljit: sljit_mod.c

Log Message:
Turn on executable allocator an use module_map with UVM_KMF_EXEC flag.

This should fix execution of code generated by librumpkern_sljit.
Also enable global lock.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitExecAllocator.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/sljit/sljit/sljit_mod.c

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/sljit/dist/sljit_src/sljitConfig.h
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h:1.7 src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h:1.8
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h:1.7	Mon Nov 18 07:13:13 2013
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitConfig.h	Tue Dec 17 22:39:23 2013
@@ -66,12 +66,6 @@
 #error "SLJIT_CACHE_FLUSH must be defined."
 #endif
 
-#if defined(_KERNEL)
-#define SLJIT_UTIL_GLOBAL_LOCK 0
-#define SLJIT_EXECUTABLE_ALLOCATOR 0
-#define SLJIT_MALLOC_EXEC(sz) SLJIT_MALLOC(sz)
-#define SLJIT_FREE_EXEC(ptr) SLJIT_FREE(ptr)
-#endif
 
 #ifdef _KERNEL
 

Index: src/sys/external/bsd/sljit/dist/sljit_src/sljitExecAllocator.c
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitExecAllocator.c:1.1.1.1 src/sys/external/bsd/sljit/dist/sljit_src/sljitExecAllocator.c:1.2
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitExecAllocator.c:1.1.1.1	Sat Oct  6 18:24:25 2012
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitExecAllocator.c	Tue Dec 17 22:39:23 2013
@@ -94,17 +94,32 @@ static SLJIT_INLINE void free_chunk(void
 
 #else
 
+#ifdef _KERNEL
+#include 
+#include  /* for module_map */
+#include 
+#else
 #include 
+#endif
 
 static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
 {
+#ifdef _KERNEL
+	return (void *)uvm_km_alloc(module_map, size,
+	PAGE_SIZE, UVM_KMF_WIRED | UVM_KMF_ZERO | UVM_KMF_EXEC);
+#else
 	void* retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);
 	return (retval != MAP_FAILED) ? retval : NULL;
+#endif
 }
 
 static SLJIT_INLINE void free_chunk(void* chunk, sljit_uw size)
 {
+#ifdef _KERNEL
+	uvm_km_free(module_map, (vaddr_t)chunk, size, UVM_KMF_WIRED);
+#else
 	munmap(chunk, size);
+#endif
 }
 
 #endif

Index: src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.2 src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.3
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.2	Sat Oct  6 19:23:01 2012
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c	Tue Dec 17 22:39:23 2013
@@ -108,6 +108,24 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL
 
 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
 
+#ifdef _KERNEL
+
+#include 
+
+/* Defined in sljit_mod.c */
+extern kmutex_t sljit_allocator_mutex;
+
+static SLJIT_INLINE void allocator_grab_lock(void)
+{
+	mutex_enter(&sljit_allocator_mutex);
+}
+
+static SLJIT_INLINE void allocator_release_lock(void)
+{
+	mutex_exit(&sljit_allocator_mutex);
+}
+#else
+
 #include 
 
 static pthread_mutex_t allocator_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -121,11 +139,30 @@ static SLJIT_INLINE void allocator_relea
 {
 	pthread_mutex_unlock(&allocator_mutex);
 }
+#endif
 
 #endif /* SLJIT_EXECUTABLE_ALLOCATOR */
 
 #if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)
 
+#ifdef _KERNEL
+
+#include 
+
+/* Defined in sljit_mod.c */
+extern kmutex_t sljit_global_mutex;
+
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
+{
+	mutex_enter(&sljit_global_mutex);
+}
+
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
+{
+	mutex_exit(&sljit_global_mutex);
+}
+#else
+
 #include 
 
 static pthread_mutex_t global_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -139,6 +176,7 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL
 {
 	pthread_mutex_unlock(&global_mutex);
 }
+#endif
 
 #endif /* SLJIT_UTIL_GLOBAL_LOCK */
 

Index: src/sys/external/bsd/sljit/sljit/sljit_mod.c
diff -u src/sys/external/bsd/sljit/sljit/sljit_mod.c:1.1 src/sys/external/bsd/sljit/sljit/sljit_mod.c:1.2
--- src/sys/external/bsd/sljit/sljit/sljit_mod.c:1.1	Mon Oct 22 21:21:07 2012
+++ src/sys/external/bsd/sljit/sljit/sljit_mod.c	Tue Dec 17 22:39:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sljit_mod.c,v 1.1 2012/10/22 21:21:07 christos Exp $	*/
+/*	$NetBSD: sljit_mod.c,v 1.2 2013/12/17 22:39:23 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -27,14 +27,18 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$N

CVS commit: src/sys/external/bsd/dwc2

2013-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 31 09:10:44 UTC 2013

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
KASSERT that the transfer callout is not pending.

Removes a XXX


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.21 src/sys/external/bsd/dwc2/dwc2.c:1.22
--- src/sys/external/bsd/dwc2/dwc2.c:1.21	Thu Nov 28 06:56:36 2013
+++ src/sys/external/bsd/dwc2/dwc2.c	Tue Dec 31 09:10:43 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.21 2013/11/28 06:56:36 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.22 2013/12/31 09:10:43 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.21 2013/11/28 06:56:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.22 2013/12/31 09:10:43 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -342,6 +342,9 @@ dwc2_softintr(void *v)
 
 	mutex_spin_enter(&hsotg->lock);
 	while ((dxfer = TAILQ_FIRST(&sc->sc_complete)) != NULL) {
+
+		KASSERT(!callout_pending(&dxfer->xfer.timeout_handle));
+
 		/*
 		 * dwc2_abort_xfer will remove this transfer from the
 		 * sc_complete queue
@@ -353,8 +356,6 @@ dwc2_softintr(void *v)
 		}
 
 		TAILQ_REMOVE(&sc->sc_complete, dxfer, xnext);
-		/* XXXNH Already done - can I assert this? */
-		callout_stop(&dxfer->xfer.timeout_handle);
 
 		mutex_spin_exit(&hsotg->lock);
 		usb_transfer_complete(&dxfer->xfer);



CVS commit: src/sys/external/bsd/dwc2

2014-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan  2 15:54:10 UTC 2014

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c
src/sys/external/bsd/dwc2/dist: dwc2_hcd.c dwc2_hcdqueue.c

Log Message:
Protect access of urb->hcpriv by adapting the following change from the
Raspberry PI dwc_otg driver.

https://github.com/raspberrypi/linux/commit/38753ce72d4f10d5d0f1ed27fa691a2ba8910941

dwc_otg: prevent OOPSes during device disconnects

The dwc_otg_urb_enqueue function is thread-unsafe. In particular the
access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and
friends does not occur within a critical section and so if a device
was unplugged during activity there was a high chance that the
usbcore hub_thread would try to disable the endpoint with partially-
formed entries in the URB queue. This would result in BUG() or null
pointer dereferences.

Fix so that access of urb->hcpriv, enqueuing to the hardware and
adding to usbcore endpoint URB lists is contained within a single
critical section.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/dwc2/dwc2.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.22 src/sys/external/bsd/dwc2/dwc2.c:1.23
--- src/sys/external/bsd/dwc2/dwc2.c:1.22	Tue Dec 31 09:10:43 2013
+++ src/sys/external/bsd/dwc2/dwc2.c	Thu Jan  2 15:54:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.22 2013/12/31 09:10:43 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.23 2014/01/02 15:54:10 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.22 2013/12/31 09:10:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.23 2014/01/02 15:54:10 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1298,7 +1298,6 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	memset(dwc2_urb, 0, sizeof(*dwc2_urb) +
 	sizeof(dwc2_urb->iso_descs[0]) * DWC2_MAXISOCPACKETS);
 
-	dwc2_urb->priv = xfer;
 	dwc2_hcd_urb_set_pipeinfo(hsotg, dwc2_urb, addr, epnum, xfertype, dir,
   mps);
 
@@ -1379,6 +1378,9 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	}
 
 	/* might need to check cpu_intr_p */
+	mutex_spin_enter(&hsotg->lock);
+
+	dwc2_urb->priv = xfer;
 	retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, &dpipe->priv, 0);
 	if (retval)
 		goto fail;
@@ -1389,14 +1391,14 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	}
 
 	if (alloc_bandwidth) {
-		mutex_spin_enter(&hsotg->lock);
 		dwc2_allocate_bus_bandwidth(hsotg,
 dwc2_hcd_get_ep_bandwidth(hsotg, dpipe),
 xfer);
-		mutex_spin_exit(&hsotg->lock);
 	}
 
 fail:
+	mutex_spin_exit(&hsotg->lock);
+
 // 	mutex_exit(&sc->sc_lock);
 
 	switch (retval) {

Index: src/sys/external/bsd/dwc2/dist/dwc2_hcd.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.9 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.10
--- src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.9	Sun Nov 24 12:25:19 2013
+++ src/sys/external/bsd/dwc2/dist/dwc2_hcd.c	Thu Jan  2 15:54:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_hcd.c,v 1.9 2013/11/24 12:25:19 skrll Exp $	*/
+/*	$NetBSD: dwc2_hcd.c,v 1.10 2014/01/02 15:54:10 skrll Exp $	*/
 
 /*
  * hcd.c - DesignWare HS OTG Controller host-mode routines
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.9 2013/11/24 12:25:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.10 2014/01/02 15:54:10 skrll Exp $");
 
 #include 
 #include 
@@ -367,7 +367,6 @@ dwc2_hcd_urb_enqueue(struct dwc2_hsotg *
 {
 	struct dwc2_softc *sc = hsotg->hsotg_sc;
 	struct dwc2_qtd *qtd;
-	unsigned long flags;
 	u32 intr_mask;
 	int retval;
 	int dev_speed;
@@ -421,11 +420,9 @@ dwc2_hcd_urb_enqueue(struct dwc2_hsotg *
 			 */
 			return 0;
 
-		spin_lock_irqsave(&hsotg->lock, flags);
 		tr_type = dwc2_hcd_select_transactions(hsotg);
 		if (tr_type != DWC2_TRANSACTION_NONE)
 			dwc2_hcd_queue_transactions(hsotg, tr_type);
-		spin_unlock_irqrestore(&hsotg->lock, flags);
 	}
 
 	return retval;

Index: src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c:1.6 src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c:1.7
--- src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c:1.6	Sun Nov 24 12:25:19 2013
+++ src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c	Thu Jan  2 15:54:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_hcdqueue.c,v 1.6 2013/11/24 12:25:19 skrll Exp $	*/
+/*	$NetBSD: dwc2_hcdqueue.c,v 1.7 2014/01/02 15:54:10 skrll Exp $	*/
 
 /*
  * hcd_queue.c - DesignWare HS OTG Controller host queuing routines
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcdqueue.c,v 1.6 2013/11/24 12:25:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcdqueue.c,v 1.7 2014/01/02 15

CVS commit: src/sys/external/bsd/dwc2

2014-01-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan  3 12:07:37 UTC 2014

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Change a KASSERT to a KASSERTMSG and add a DPRINTFN.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.23 src/sys/external/bsd/dwc2/dwc2.c:1.24
--- src/sys/external/bsd/dwc2/dwc2.c:1.23	Thu Jan  2 15:54:10 2014
+++ src/sys/external/bsd/dwc2/dwc2.c	Fri Jan  3 12:07:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.23 2014/01/02 15:54:10 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.24 2014/01/03 12:07:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.23 2014/01/02 15:54:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.24 2014/01/03 12:07:37 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -343,7 +343,8 @@ dwc2_softintr(void *v)
 	mutex_spin_enter(&hsotg->lock);
 	while ((dxfer = TAILQ_FIRST(&sc->sc_complete)) != NULL) {
 
-		KASSERT(!callout_pending(&dxfer->xfer.timeout_handle));
+		KASSERTMSG(!callout_pending(&dxfer->xfer.timeout_handle), 
+		"xfer %p pipe %p\n", dxfer, dxfer->xfer.pipe);
 
 		/*
 		 * dwc2_abort_xfer will remove this transfer from the
@@ -1702,6 +1703,8 @@ void dwc2_host_complete(struct dwc2_hsot
 
 	xfer->actlen = dwc2_hcd_urb_get_actual_length(qtd->urb);
 
+	DPRINTFN(3, "xfer=%p actlen=%d\n", xfer, xfer->actlen);
+
 	if (xfertype == UE_ISOCHRONOUS && dbg_perio()) {
 		int i;
 



CVS commit: src/sys/external/bsd/dwc2

2014-01-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan  3 12:20:26 UTC 2014

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Call callout_reset on the xfer timeoute_handle before calling
dwc2_hcd_urb_enqueue


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.24 src/sys/external/bsd/dwc2/dwc2.c:1.25
--- src/sys/external/bsd/dwc2/dwc2.c:1.24	Fri Jan  3 12:07:37 2014
+++ src/sys/external/bsd/dwc2/dwc2.c	Fri Jan  3 12:20:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.24 2014/01/03 12:07:37 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.25 2014/01/03 12:20:26 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.24 2014/01/03 12:07:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.25 2014/01/03 12:20:26 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1381,16 +1381,16 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	/* might need to check cpu_intr_p */
 	mutex_spin_enter(&hsotg->lock);
 
-	dwc2_urb->priv = xfer;
-	retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, &dpipe->priv, 0);
-	if (retval)
-		goto fail;
-
 	if (xfer->timeout && !sc->sc_bus.use_polling) {
 		callout_reset(&xfer->timeout_handle, mstohz(xfer->timeout),
 		dwc2_timeout, xfer);
 	}
 
+	dwc2_urb->priv = xfer;
+	retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, &dpipe->priv, 0);
+	if (retval)
+		goto fail;
+
 	if (alloc_bandwidth) {
 		dwc2_allocate_bus_bandwidth(hsotg,
 dwc2_hcd_get_ep_bandwidth(hsotg, dpipe),



CVS commit: src/sys/external/bsd/dwc2

2014-01-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan  3 14:41:57 UTC 2014

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Small bit of tidyup and remove a XXX now that it's possible.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.25 src/sys/external/bsd/dwc2/dwc2.c:1.26
--- src/sys/external/bsd/dwc2/dwc2.c:1.25	Fri Jan  3 12:20:26 2014
+++ src/sys/external/bsd/dwc2/dwc2.c	Fri Jan  3 14:41:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.25 2014/01/03 12:20:26 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.26 2014/01/03 14:41:57 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.25 2014/01/03 12:20:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.26 2014/01/03 14:41:57 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1313,14 +1313,15 @@ dwc2_device_start(usbd_xfer_handle xfer)
 	}
 	flags |= URB_GIVEBACK_ASAP;
 
-	/* XXXNH this shouldn't be required */
-	if (xfertype == UE_CONTROL && len == 0) {
-		dwc2_urb->usbdma = &dpipe->req_dma;
-	} else {
-		dwc2_urb->usbdma = &xfer->dmabuf;
-	}
-	dwc2_urb->buf = KERNADDR(dwc2_urb->usbdma, 0);
-	dwc2_urb->dma = DMAADDR(dwc2_urb->usbdma, 0);
+	/*
+	 * control transfers with no data phase don't touch usbdma, but
+	 * everything else does.
+	 */
+	if (!(xfertype == UE_CONTROL && len == 0)) {
+		dwc2_urb->usbdma = &xfer->dmabuf;
+		dwc2_urb->buf = KERNADDR(dwc2_urb->usbdma, 0);
+		dwc2_urb->dma = DMAADDR(dwc2_urb->usbdma, 0);
+ 	}
 	dwc2_urb->length = len;
  	dwc2_urb->flags = flags;
 	dwc2_urb->status = -EINPROGRESS;



CVS commit: src/sys/external/bsd/compiler_rt

2014-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jan 15 21:07:19 UTC 2014

Modified Files:
src/sys/external/bsd/compiler_rt: prepare-import.sh

Log Message:
More sanitizers we are still not interested in.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/compiler_rt/prepare-import.sh

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/compiler_rt/prepare-import.sh
diff -u src/sys/external/bsd/compiler_rt/prepare-import.sh:1.1 src/sys/external/bsd/compiler_rt/prepare-import.sh:1.2
--- src/sys/external/bsd/compiler_rt/prepare-import.sh:1.1	Thu Jul  4 22:12:40 2013
+++ src/sys/external/bsd/compiler_rt/prepare-import.sh	Wed Jan 15 21:07:19 2014
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: prepare-import.sh,v 1.1 2013/07/04 22:12:40 joerg Exp $
+# $NetBSD: prepare-import.sh,v 1.2 2014/01/15 21:07:19 joerg Exp $
 #
 # Checkout compiler_rt into dist.
 # Run this script and check for additional files and directories to prune,
@@ -11,8 +11,7 @@ cd dist
 rm -rf .svn
 rm -rf BlocksRuntime SDKs cmake include make www
 rm -f .arcconfig .gitignore CMakeLists.txt Makefile
-rm -rf lib/asan lib/interception lib/msan lib/msandr lib/sanitizer_common
-rm -rf lib/tsan lib/ubsan
+rm -rf lib/asan lib/dfsan lib/interception lib/lsan lib/msan lib/msandr
+rm -rf lib/sanitizer_common lib/tsan lib/ubsan
 rm -f lib/*/Makefile.mk lib/Makefile.mk lib/CMakeLists.txt
 rm -f lib/apple_versioning.c lib/lit.common.* lib/profile/CMakeLists.txt
-rmdir lib/sparc64



CVS commit: src/sys/external/bsd/drm2

2014-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 25 16:35:43 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/i915drm: intelfb.c
src/sys/external/bsd/drm2/radeon: radeondrmkmsfb.c

Log Message:
Prettify intelfb/radeondrmkmsfb autoconf output.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/i915drm/intelfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c

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/i915drm/intelfb.c
diff -u src/sys/external/bsd/drm2/i915drm/intelfb.c:1.4 src/sys/external/bsd/drm2/i915drm/intelfb.c:1.5
--- src/sys/external/bsd/drm2/i915drm/intelfb.c:1.4	Thu Jul 24 21:45:03 2014
+++ src/sys/external/bsd/drm2/i915drm/intelfb.c	Fri Jul 25 16:35:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: intelfb.c,v 1.4 2014/07/24 21:45:03 riastradh Exp $	*/
+/*	$NetBSD: intelfb.c,v 1.5 2014/07/25 16:35:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.4 2014/07/24 21:45:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intelfb.c,v 1.5 2014/07/25 16:35:43 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -114,6 +114,9 @@ intelfb_attach(device_t parent, device_t
 	sc->sc_scheduled = false;
 	sc->sc_attached = false;
 
+	aprint_naive("\n");
+	aprint_normal("\n");
+
 	/* XXX Defer this too?  */
 	error = bus_space_map(ifa->ifa_fb_bst, ifa->ifa_fb_addr,
 	ifa->ifa_fb_size,

Index: src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
diff -u src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.1 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.2
--- src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c:1.1	Fri Jul 25 12:35:03 2014
+++ src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c	Fri Jul 25 16:35:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeondrmkmsfb.c,v 1.1 2014/07/25 12:35:03 riastradh Exp $	*/
+/*	$NetBSD: radeondrmkmsfb.c,v 1.2 2014/07/25 16:35:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.1 2014/07/25 12:35:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.2 2014/07/25 16:35:43 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -111,6 +111,9 @@ radeonfb_attach(device_t parent, device_
 	sc->sc_scheduled = false;
 	sc->sc_attached = false;
 
+	aprint_naive("\n");
+	aprint_normal("\n");
+
 	radeon_task_init(&sc->sc_setconfig_task, &radeonfb_setconfig_task);
 	error = radeon_task_schedule(parent, &sc->sc_setconfig_task);
 	if (error) {



CVS commit: src/sys/external/bsd/drm2

2014-07-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 26 18:13:44 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h

Log Message:
Move CONFIG_X86 from files.i915drmkms to drm_os_netbsd.h.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.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/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.4 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.5
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.4	Thu Jul 24 21:18:40 2014
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Sat Jul 26 18:13:44 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.4 2014/07/24 21:18:40 riastradh Exp $
+#	$NetBSD: files.i915drmkms,v 1.5 2014/07/26 18:13:44 riastradh Exp $
 
 define	intelfbbus	{ }
 device	i915drmkms: drmkms, drmkms_pci, intelfbbus
@@ -16,7 +16,6 @@ makeoptions 	i915drmkms 	"CWARNFLAGS.int
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_pm.c"+="-Wno-shadow"
 
 # XXX x86 kludge.
-makeoptions	i915drmkms	CPPFLAGS+="-DCONFIG_X86"
 #makeoptions	i915drmkms	CPPFLAGS+="-DCONFIG_ACPI"
 makeoptions	i915drmkms	CPPFLAGS+="-DCONFIG_DRM_I915_FBDEV"
 

Index: src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.2 src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.3
--- src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.2	Tue Mar 18 18:20:43 2014
+++ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h	Sat Jul 26 18:13:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_os_netbsd.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $	*/
+/*	$NetBSD: drm_os_netbsd.h,v 1.3 2014/07/26 18:13:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,6 +36,14 @@
 #include "opt_drmkms.h"
 #endif
 
+/*
+ * XXX Better to get rid of CONFIG_X86, but that's not convenient at
+ * the moment.
+ */
+#if defined(__i386__) || defined(__x86_64__)
+#define	CONFIG_X86	1
+#endif
+
 #include 
 #include 
 #include 



CVS commit: src/sys/external/bsd/drm2

2014-07-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 26 21:15:45 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_drv.c radeon_ttm.c
src/sys/external/bsd/drm2/dist/include/drm: drmP.h
src/sys/external/bsd/drm2/drm: drm_drv.c drm_gem_vm.c drm_vm.c

Log Message:
Let the drm driver decide what part of what object gets mmapped.

Pass the file around too so radeon/ttm can get at it to verify access.

Add drm_gem_or_legacy_mmap_object for drivers to choose the previous
behaviour, like i915.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/drm/drm_drv.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/drm/drm_gem_vm.c \
src/sys/external/bsd/drm2/drm/drm_vm.c

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/dist/drm/i915/i915_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.5	Wed Jul 16 23:25:18 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c	Sat Jul 26 21:15:45 2014
@@ -1049,6 +1049,8 @@ static struct drm_driver driver = {
 #endif
 	.gem_free_object = i915_gem_free_object,
 #ifdef __NetBSD__
+	/* XXX Not clear the `or legacy' part is important here.  */
+	.mmap_object = &drm_gem_or_legacy_mmap_object,
 	.gem_uvm_ops = &i915_gem_uvm_ops,
 #else
 	.gem_vm_ops = &i915_gem_vm_ops,

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.c:1.3 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.c:1.3	Thu Jul 17 15:09:00 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.c	Sat Jul 26 21:15:45 2014
@@ -119,7 +119,10 @@ extern int radeon_get_crtc_scanoutpos(st
 extern bool radeon_is_px(struct drm_device *dev);
 extern const struct drm_ioctl_desc radeon_ioctls_kms[];
 extern int radeon_max_kms_ioctl;
-#ifndef __NetBSD__
+#ifdef __NetBSD__
+int radeon_mmap_object(struct drm_device *, off_t, size_t, vm_prot_t,
+struct uvm_object **, voff_t *, struct file *);
+#else
 int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
 #endif
 int radeon_mode_dumb_mmap(struct drm_file *filp,
@@ -563,6 +566,7 @@ static struct drm_driver kms_driver = {
 	.dumb_destroy = drm_gem_dumb_destroy,
 #ifdef __NetBSD__
 	.fops = NULL,
+	.mmap_object = &radeon_mmap_object,
 	.gem_uvm_ops = &radeon_gem_uvm_ops,
 #else
 	.fops = &radeon_driver_kms_fops,
Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.3 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.3	Thu Jul 17 03:34:13 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c	Sat Jul 26 21:15:45 2014
@@ -879,7 +879,7 @@ radeon_mmap_object(struct drm_device *de
 
 	if (__predict_false((offset >> PAGE_SHIFT) < DRM_FILE_PAGE_OFFSET))
 		return drm_mmap_object(dev, offset, size, prot, uobjp,
-		uoffsetp /* , file */);
+		uoffsetp, file);
 	else
 		return ttm_bo_mmap_object(&rdev->mman.bdev, offset, size, prot,
 		uobjp, uoffsetp, file);

Index: src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.6 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.7
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.6	Wed Jul 16 20:56:25 2014
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Sat Jul 26 21:15:45 2014
@@ -1097,6 +1097,8 @@ struct drm_driver {
 
 	/* Driver private ops for this object */
 #ifdef __NetBSD__
+	int (*mmap_object)(struct drm_device *, off_t, size_t, int,
+	struct uvm_object **, voff_t *, struct file *);
 	const struct uvm_pagerops *gem_uvm_ops;
 #else
 	const struct vm_operations_struct *gem_vm_ops;
@@ -1422,7 +1424,7 @@ extern int drm_release(struct inode *ino
 /* Mapping support (drm_vm.h) */
 #ifdef __NetBSD__
 extern int drm_mmap_object(struct drm_device *, off_t, size_t, int,
-struct uvm_object **, voff_t *);
+struct uvm_object **, voff_t *, struct file *);
 extern paddr_t drm_mmap_paddr(struct drm_device *, off_t, int);
 #else
 extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
@@ -1775,7 +1777,9 @@ void drm_gem_private_object_init(struct 
 void drm_gem_pager_reference(struct uvm_object *);
 void drm_gem_pager_detach(struct uvm_object *);
 int drm_gem_mmap_

CVS commit: src/sys/external/bsd/drm2

2014-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  6 15:01:34 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_bios.h nouveau_bo.c
nouveau_connector.c nouveau_display.c nouveau_dma.c nouveau_drm.c
nouveau_fbcon.h nouveau_gem.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core: os.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/core:
nouveau_core_printk.c nouveau_core_subdev.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
nouveau_engine_device_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
nouveau_engine_fifo_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core: device.h
object.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine: fifo.h
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04:
nouveau_dispnv04_arb.c nouveau_dispnv04_disp.c
nouveau_dispnv04_hw.c nouveau_dispnv04_overlay.c
nouveau_dispnv04_tvmodesnv17.c nouveau_dispnv04_tvnv04.c
nouveau_dispnv04_tvnv17.c tvnv17.h
src/sys/external/bsd/drm2/include/linux: i2c.h mutex.h
platform_device.h
src/sys/external/bsd/drm2/nouveau: files.nouveau

Log Message:
Whack some nouveau moles.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dma.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/os.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_printk.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_subdev.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/device.h
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core/object.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine/fifo.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_disp.c 
\
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_hw.c \

src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c \

src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvmodesnv17.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv04.c \

src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_tvnv17.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/tvnv17.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/i2c.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/mutex.h
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/include/linux/platform_device.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/nouveau/files.nouveau

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/dist/drm/nouveau/nouveau_bios.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h:1.1.1.1	Wed Jul 16 19:35:26 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bios.h	Wed Aug  6 15:01:33 2014
@@ -24,6 +24,8 @@
 #ifndef __NOUVEAU_DISPBIOS_H__
 #define __NOUVEAU_DISPBIOS_H__
 
+#include 
+
 #define DCB_MAX_NUM_ENTRIES 16
 #define DCB_MAX_NUM_I2C_ENTRIES 16
 #define DCB_MAX_NUM_GPIO_ENTRIES 32
Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h:1.2
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h:1.1.1.1	Wed Jul 16 19:35:26 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.h	Wed Aug  6 15:01:33 2014
@@ -41,6 +41,7 @@ struct nouveau_fbdev {
 
 void nouveau_fbcon_

CVS commit: src/sys/external/bsd/drm2

2014-08-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug 18 16:55:34 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.h
src/sys/external/bsd/drm2/i915drm: files.i915drmkms

Log Message:
Restore Intel opregion stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/i915drm/files.i915drmkms

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/dist/drm/i915/i915_drv.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.7	Thu Jul 24 21:18:40 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h	Mon Aug 18 16:55:34 2014
@@ -2720,8 +2720,8 @@ extern void intel_i2c_reset(struct drm_d
 
 /* intel_opregion.c */
 struct intel_encoder;
-#ifdef CONFIG_ACPI
 extern int intel_opregion_setup(struct drm_device *dev);
+#ifdef CONFIG_ACPI
 extern void intel_opregion_init(struct drm_device *dev);
 extern void intel_opregion_fini(struct drm_device *dev);
 extern void intel_opregion_asle_intr(struct drm_device *dev);
@@ -2730,7 +2730,6 @@ extern int intel_opregion_notify_encoder
 extern int intel_opregion_notify_adapter(struct drm_device *dev,
 	 pci_power_t state);
 #else
-static inline int intel_opregion_setup(struct drm_device *dev) { return 0; }
 static inline void intel_opregion_init(struct drm_device *dev) { return; }
 static inline void intel_opregion_fini(struct drm_device *dev) { return; }
 static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }

Index: src/sys/external/bsd/drm2/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.5 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.6
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.5	Sat Jul 26 18:13:44 2014
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Mon Aug 18 16:55:34 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.5 2014/07/26 18:13:44 riastradh Exp $
+#	$NetBSD: files.i915drmkms,v 1.6 2014/08/18 16:55:34 riastradh Exp $
 
 define	intelfbbus	{ }
 device	i915drmkms: drmkms, drmkms_pci, intelfbbus
@@ -60,8 +60,7 @@ file	external/bsd/drm2/dist/drm/i915/int
 file	external/bsd/drm2/dist/drm/i915/intel_i2c.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/intel_lvds.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/intel_modes.c	i915drmkms
-# XXX Restore once I figure out what this does...
-#file	external/bsd/drm2/dist/drm/i915/intel_opregion.c	i915drmkms
+file	external/bsd/drm2/dist/drm/i915/intel_opregion.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/intel_overlay.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/intel_panel.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/intel_pm.c	i915drmkms



CVS commit: src/sys/external/bsd/drm2

2014-08-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug 20 13:48:08 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_gem.c
src/sys/external/bsd/drm2/ttm: ttm_bo_vm.c

Log Message:
Drop take the {ttm,gem} vmobjlock in the fault handler.

- We don't need this lock.
- uvm does nothing between taking it and calling the fault handler.
- Now that the uvm_aobj shares vmobjlock with the {ttm,gem} uvm
  object, we must not hold the lock when we call uvm_obj_wirepages on
  the uvm_aobj.

XXX pullup to netbsd-7


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c

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/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.14 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.15
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.14	Wed Jul 16 21:48:53 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Wed Aug 20 13:48:08 2014
@@ -1842,6 +1842,9 @@ i915_gem_fault(struct uvm_faultinfo *ufi
 
 	intel_runtime_pm_get(dev_priv);
 
+	/* Thanks, uvm, but we don't need this lock.  */
+	mutex_exit(uobj->vmobjlock);
+
 	ret = i915_mutex_lock_interruptible(dev);
 	if (ret)
 		goto out;
@@ -1880,6 +1883,7 @@ unpin:
 unlock:
 	mutex_unlock(&dev->struct_mutex);
 out:
+	mutex_enter(uobj->vmobjlock);
 	uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
 	if (ret == -ERESTART)
 		uvm_wait("i915flt");

Index: src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.3 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.4
--- src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.3	Mon Aug 18 01:17:34 2014
+++ src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c	Wed Aug 20 13:48:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bo_vm.c,v 1.3 2014/08/18 01:17:34 riastradh Exp $	*/
+/*	$NetBSD: ttm_bo_vm.c,v 1.4 2014/08/20 13:48:08 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.3 2014/08/18 01:17:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.4 2014/08/20 13:48:08 riastradh Exp $");
 
 #include 
 
@@ -92,6 +92,9 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 	unsigned mmapflags;
 	int ret;
 
+	/* Thanks, uvm, but we don't need this lock.  */
+	mutex_exit(uobj->vmobjlock);
+
 	/* Copy-on-write mappings make no sense for the graphics aperture.  */
 	if (UVM_ET_ISCOPYONWRITE(ufi->entry)) {
 		ret = -EIO;
@@ -199,7 +202,8 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 out3:	pmap_update(ufi->orig_map->pmap);
 out2:	ttm_mem_io_unlock(man);
 out1:	ttm_bo_unreserve(bo);
-out0:	uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
+out0:	mutex_enter(uobj->vmobjlock);
+	uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
 	/* XXX errno Linux->NetBSD */
 	return -ret;
 }



CVS commit: src/sys/external/bsd/drm2

2014-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 23 08:03:34 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_bo.c nouveau_drm.c
nouveau_drm.h nouveau_fence.c nouveau_gem.c nouveau_nv10_fence.c
nouveau_nv50_display.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine:
nouveau_engine_xtensa.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy:
nouveau_engine_copy_nva3.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt:
nouveau_engine_crypt_nv84.c nouveau_engine_crypt_nv98.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
nouveau_engine_device_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp:
nouveau_engine_disp_dacnv50.c nouveau_engine_disp_nv04.c
nouveau_engine_disp_nv50.c nouveau_engine_disp_nvd0.c nv50.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
nouveau_engine_fifo_base.c nouveau_engine_fifo_nvc0.c
nouveau_engine_fifo_nve0.c nve0.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph:
nouveau_engine_graph_ctxnvd7.c nouveau_engine_graph_gm107.c
nouveau_engine_graph_nv50.c nouveau_engine_graph_nvc0.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/perfmon:
nouveau_engine_perfmon_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/core: device.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/engine:
device.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/include/subdev: bar.h
fb.h pwr.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar:
nouveau_subdev_bar_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem:
nouveau_subdev_instmem_nv04.c nouveau_subdev_instmem_nv40.c nv04.h
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/pwr:
nouveau_subdev_pwr_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04:
nouveau_dispnv04_tvmodesnv17.c nouveau_dispnv04_tvnv17.c
src/sys/external/bsd/drm2/include/drm: drm_agp_netbsd.h
src/sys/external/bsd/drm2/include/linux: bitops.h i2c.h mutex.h
pagemap.h pm_runtime.h spinlock.h vmalloc.h
src/sys/external/bsd/drm2/nouveau: files.nouveau nouveau_module.c

Log Message:
Another round of nouveau whack-a-mole.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.h \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv10_fence.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/nouveau_engine_xtensa.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/copy/nouveau_engine_copy_nva3.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv84.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/crypt/nouveau_engine_crypt_nv98.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_dacnv50.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv04.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nv50.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c
 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nv50.h
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nvc0.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c
 \
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nve0.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxnvd7.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gm107.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_nv50.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/gr

CVS commit: src/sys/external/bsd/drm2

2014-08-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug 26 17:28:15 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/via: via_dma.c via_dmablit.c
via_dmablit.h via_drv.h via_irq.c via_video.c
Added Files:
src/sys/external/bsd/drm2/via: files.via

Log Message:
Partial viadrm2 snapshot.

To do:

- autoconf attachment (shouldn't be hard)
- viafb (maybe steal unichromefb and adapt attachment structure)
- actually run it (no hardware here)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/sys/external/bsd/drm2/dist/drm/via/via_dma.c \
src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c \
src/sys/external/bsd/drm2/dist/drm/via/via_drv.h \
src/sys/external/bsd/drm2/dist/drm/via/via_irq.c \
src/sys/external/bsd/drm2/dist/drm/via/via_video.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.h
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/via/files.via

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/dist/drm/via/via_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_dma.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/via/via_dma.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/via/via_dma.c:1.1.1.2	Wed Jul 16 19:35:29 2014
+++ src/sys/external/bsd/drm2/dist/drm/via/via_dma.c	Tue Aug 26 17:28:14 2014
@@ -39,6 +39,8 @@
 #include "via_drv.h"
 #include "via_3d_reg.h"
 
+#include 
+
 #define CMDBUF_ALIGNMENT_SIZE   (0x100)
 #define CMDBUF_ALIGNMENT_MASK   (0x0ff)
 
@@ -234,13 +236,21 @@ static int via_dma_init(struct drm_devic
 
 	switch (init->func) {
 	case VIA_INIT_DMA:
+#ifdef __NetBSD__
+		if (!DRM_SUSER())
+#else
 		if (!capable(CAP_SYS_ADMIN))
+#endif
 			retcode = -EPERM;
 		else
 			retcode = via_initialize(dev, dev_priv, init);
 		break;
 	case VIA_CLEANUP_DMA:
+#ifdef __NetBSD__
+		if (!DRM_SUSER())
+#else
 		if (!capable(CAP_SYS_ADMIN))
+#endif
 			retcode = -EPERM;
 		else
 			retcode = via_dma_cleanup(dev);
@@ -586,13 +596,11 @@ static inline void via_dummy_bitblt(drm_
 
 static void via_cmdbuf_jump(drm_via_private_t *dev_priv)
 {
-	uint32_t agp_base;
 	uint32_t pause_addr_lo, pause_addr_hi;
 	uint32_t jump_addr_lo, jump_addr_hi;
 	volatile uint32_t *last_pause_ptr;
 	uint32_t dma_low_save1, dma_low_save2;
 
-	agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
 	via_align_cmd(dev_priv, HC_HAGPBpID_JUMP, 0, &jump_addr_hi,
 		  &jump_addr_lo, 0);
 
Index: src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.1.1.2	Wed Jul 16 19:35:29 2014
+++ src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c	Tue Aug 26 17:28:14 2014
@@ -41,6 +41,7 @@
 
 #include 
 #include 
+#include 
 
 #define VIA_PGDN(x)	 (((unsigned long)(x)) & PAGE_MASK)
 #define VIA_PGOFF(x)	(((unsigned long)(x)) & ~PAGE_MASK)
@@ -61,8 +62,12 @@ typedef struct _drm_via_descriptor {
 
 
 static void
-via_unmap_blit_from_device(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
+via_unmap_blit_from_device(struct drm_device *dev, struct pci_dev *pdev,
+drm_via_sg_info_t *vsg)
 {
+#ifdef __NetBSD__
+	bus_dmamap_unload(dev->dmat, vsg->dmamap);
+#else
 	int num_desc = vsg->num_desc;
 	unsigned cur_descriptor_page = num_desc / vsg->descriptors_per_page;
 	unsigned descriptor_this_page = num_desc % vsg->descriptors_per_page;
@@ -82,6 +87,7 @@ via_unmap_blit_from_device(struct pci_de
 		next = (dma_addr_t) desc_ptr->next;
 		desc_ptr--;
 	}
+#endif
 }
 
 /*
@@ -101,7 +107,9 @@ via_map_blit_for_device(struct pci_dev *
 	unsigned num_descriptors_this_page = 0;
 	unsigned char *mem_addr = xfer->mem_addr;
 	unsigned char *cur_mem;
+#ifndef __NetBSD__
 	unsigned char *first_addr = (unsigned char *)VIA_PGDN(mem_addr);
+#endif
 	uint32_t fb_addr = xfer->fb_addr;
 	uint32_t cur_fb;
 	unsigned long line_len;
@@ -126,18 +134,31 @@ via_map_blit_for_device(struct pci_dev *
 			line_len -= remaining_len;
 
 			if (mode == 1) {
+#ifdef __NetBSD__
+const bus_dma_segment_t *const seg =
+&vsg->dmamap->dm_segs[atop(cur_mem)];
+desc_ptr->mem_addr =
+seg->ds_addr + trunc_page((vaddr_t)cur_mem);
+#else
 desc_ptr->mem_addr =
 	dma_map_page(&pdev->dev,
 		 vsg->pages[VIA_PFN(cur_mem) -
 VIA_PFN(first_addr)],
 		 VIA_PGOFF(cur_mem), remaining_len,
 		 vsg->direction);
+#endif
 desc_ptr->dev_addr = cur_fb;
 
 desc_ptr->size = remaining_len;
 desc_ptr->next = (uint32_t) next;
+#ifdef __NetBSD__
+next = vsg->desc_dmamap
+->dm_segs[cur_descriptor_page].ds_addr
++ num_descriptors_this_page;
+#else
 next = dma_map_single(&pdev->dev, desc_ptr, sizeof(*desc_ptr),
 		  DMA_TO_DEVICE);
+#endif
 desc_ptr++;
 if (++num_descriptors_this_p

CVS commit: src/sys/external/bsd/dwc2

2014-09-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep  2 23:26:20 UTC 2014

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
dwc2_hubd appears to be unused so #if 0 it in order to appease clang


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.31 src/sys/external/bsd/dwc2/dwc2.c:1.32
--- src/sys/external/bsd/dwc2/dwc2.c:1.31	Tue Aug  5 10:33:46 2014
+++ src/sys/external/bsd/dwc2/dwc2.c	Tue Sep  2 23:26:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.31 2014/08/05 10:33:46 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.31 2014/08/05 10:33:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $");
 
 #include "opt_usb.h"
 
@@ -667,6 +667,8 @@ Static const struct dwc2_config_desc dwc
 };
 
 #define	HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
+#if 0
+/* appears to be unused */
 Static const usb_hub_descriptor_t dwc2_hubd = {
 	.bDescLength = USB_HUB_DESCRIPTOR_SIZE,
 	.bDescriptorType = UDESC_HUB,
@@ -676,6 +678,7 @@ Static const usb_hub_descriptor_t dwc2_h
 	.bHubContrCurrent = 0,
 	.DeviceRemovable = {0},		/* port is removable */
 };
+#endif
 
 Static usbd_status
 dwc2_root_ctrl_transfer(usbd_xfer_handle xfer)



CVS commit: src/sys/external/bsd/compiler_rt

2014-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 16 00:08:17 UTC 2014

Modified Files:
src/sys/external/bsd/compiler_rt: prepare-import.sh

Log Message:
Clean up a few more directories.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/compiler_rt/prepare-import.sh

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/compiler_rt/prepare-import.sh
diff -u src/sys/external/bsd/compiler_rt/prepare-import.sh:1.3 src/sys/external/bsd/compiler_rt/prepare-import.sh:1.4
--- src/sys/external/bsd/compiler_rt/prepare-import.sh:1.3	Wed Feb 26 22:37:56 2014
+++ src/sys/external/bsd/compiler_rt/prepare-import.sh	Fri May 16 00:08:17 2014
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: prepare-import.sh,v 1.3 2014/02/26 22:37:56 joerg Exp $
+# $NetBSD: prepare-import.sh,v 1.4 2014/05/16 00:08:17 joerg Exp $
 #
 # Checkout compiler_rt into dist.
 # Run this script and check for additional files and directories to prune,
@@ -9,7 +9,7 @@ set -e
 
 cd dist
 rm -rf .svn
-rm -rf SDKs cmake include make third_party unittests www
+rm -rf SDKs android cmake include make third_party unittests www
 rm -f .arcconfig .gitignore CMakeLists.txt Makefile
 rm -rf lib/BlocksRuntime lib/asan lib/dfsan lib/interception lib/lsan
 rm -rf lib/msan lib/msandr lib/sanitizer_common lib/tsan lib/ubsan



CVS commit: src/sys/external/bsd/sljit

2014-06-17 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Jun 17 16:49:11 UTC 2014

Modified Files:
src/sys/external/bsd/sljit: README.import

Log Message:
New sljit version is r257.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/sljit/README.import

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/sljit/README.import
diff -u src/sys/external/bsd/sljit/README.import:1.3 src/sys/external/bsd/sljit/README.import:1.4
--- src/sys/external/bsd/sljit/README.import:1.3	Sun Oct 28 09:41:12 2012
+++ src/sys/external/bsd/sljit/README.import	Tue Jun 17 16:49:11 2014
@@ -1,6 +1,6 @@
 There are no CVS/SVN ids in sljit repository but don't forget to
 remove .svn before importing the new version.
 
-Current sljit import is @ r186:
+Current sljit import is @ r257:
 
-svn co https://sljit.svn.sourceforge.net/svnroot/sljit@186 dist
+svn co https://sljit.svn.sourceforge.net/svnroot/sljit@257 dist



CVS commit: src/sys/external/bsd/dwc2

2014-06-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 27 07:28:26 UTC 2014

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Use the right macro in dwc2_root_intr_start


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/dwc2/dwc2.c

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/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.26 src/sys/external/bsd/dwc2/dwc2.c:1.27
--- src/sys/external/bsd/dwc2/dwc2.c:1.26	Fri Jan  3 14:41:57 2014
+++ src/sys/external/bsd/dwc2/dwc2.c	Fri Jun 27 07:28:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.26 2014/01/03 14:41:57 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.27 2014/06/27 07:28:26 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.26 2014/01/03 14:41:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.27 2014/06/27 07:28:26 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -885,7 +885,7 @@ dwc2_root_intr_transfer(usbd_xfer_handle
 Static usbd_status
 dwc2_root_intr_start(usbd_xfer_handle xfer)
 {
-	struct dwc2_softc *sc = DWC2_PIPE2SC(xfer);
+	struct dwc2_softc *sc = DWC2_XFER2SC(xfer);
 
 	DPRINTF("\n");
 



  1   2   3   4   5   6   7   8   9   10   >