CVS commit: src/sys/dev/pci

2013-12-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Dec 30 07:08:24 UTC 2013

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add ASPEED AST2000.


To generate a diff of this commit:
cvs rdiff -u -r1.1174 -r1.1175 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1174 src/sys/dev/pci/pcidevs:1.1175
--- src/sys/dev/pci/pcidevs:1.1174	Fri Dec 27 08:39:56 2013
+++ src/sys/dev/pci/pcidevs	Mon Dec 30 07:08:24 2013
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1174 2013/12/27 08:39:56 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1175 2013/12/30 07:08:24 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -629,6 +629,7 @@ vendor RENESAS		0x1912	Renesas Technolog
 vendor FREESCALE	0x1957	Freescale Semiconductor
 vendor ATTANSIC		0x1969	Attansic Technologies
 vendor JMICRON		0x197b	JMicron Technology
+vendor ASPEED		0x1a03	ASPEED Technology
 vendor EVE		0x1adb	EVE
 vendor QUMRANET		0x1af4	Qumranet
 vendor ASMEDIA		0x1b21  ASMedia
@@ -1533,6 +1534,9 @@ product AMCIRCUITS PCISYNC	0x812f	FZJ/ZE
 product AMCIRCUITS ADDI7800	0x818e	ADDI-DATA APCI-7800 8-port Serial
 product AMCIRCUITS S5920	0x5920	S5920 PCI Target
 
+/* ASPEED Technology products */
+product ASPEED AST2000		0x2000	AST2000
+
 /* Atheros Communications products */
 product ATHEROS AR5201		0x0007 AR5201 Wireless LAN
 product ATHEROS AR5311		0x0011 AR5211 Wireless LAN



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:52:21 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Don't put work flush items on the stack; worker kmem_frees them.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/external/bsd/drm2/linux/linux_work.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/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.7 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.8
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.7	Mon Dec 30 04:51:06 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:52:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.7 2013/12/30 04:51:06 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.8 2013/12/30 04:52:21 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.7 2013/12/30 04:51:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.8 2013/12/30 04:52:21 riastradh Exp $");
 
 #include 
 #include 
@@ -204,15 +204,15 @@ flush_workqueue(struct workqueue_struct 
 	cv_init(&wqf.wqf_cv, "lnxwflsh");
 
 	if (1) {
-		static const struct wq_flush_work zero_wqfw;
-		struct wq_flush_work wqfw = zero_wqfw;
+		struct wq_flush_work *const wqfw = kmem_zalloc(sizeof(*wqfw),
+		KM_SLEEP);
 
 		wqf.wqf_n = 1;
-		wqfw.wqfw_flush = &wqf;
-		INIT_WORK(&wqfw.wqfw_work, &linux_wq_barrier);
-		wqfw.wqfw_work.w_wq = wq;
-		wqfw.wqfw_work.w_state = WORK_PENDING;
-		workqueue_enqueue(wq->wq_workqueue, &wqfw.wqfw_work.w_wk,
+		wqfw->wqfw_flush = &wqf;
+		INIT_WORK(&wqfw->wqfw_work, &linux_wq_barrier);
+		wqfw->wqfw_work.w_wq = wq;
+		wqfw->wqfw_work.w_state = WORK_PENDING;
+		workqueue_enqueue(wq->wq_workqueue, &wqfw->wqfw_work.w_wk,
 		NULL);
 	} else {
 		struct cpu_info *ci;



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:52:11 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: idr.h
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_idr.c

Log Message:
Rewrite idr to use a dumber algorithm that admits pserialized use.

drm2 doesn't use them with RCU, but it does use them under spin locks,
so an rwlock is not kosher.

This algorithm is super-dumb, but the idr API has changed upstream,
and this is not performance-critical, so it's not worth investing
time in a better algorithm at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 \
src/sys/external/bsd/drm2/include/linux/idr.h
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/external/bsd/drm2/linux/linux_idr.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/idr.h
diff -u src/sys/external/bsd/drm2/include/linux/idr.h:1.1.2.6 src/sys/external/bsd/drm2/include/linux/idr.h:1.1.2.7
--- src/sys/external/bsd/drm2/include/linux/idr.h:1.1.2.6	Wed Jul 24 03:13:59 2013
+++ src/sys/external/bsd/drm2/include/linux/idr.h	Mon Dec 30 04:52:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: idr.h,v 1.1.2.6 2013/07/24 03:13:59 riastradh Exp $	*/
+/*	$NetBSD: idr.h,v 1.1.2.7 2013/12/30 04:52:11 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,15 +33,16 @@
 #define _LINUX_IDR_H_
 
 #include 
-#include 
-#include 
+#include 
+#include 
 
 /* XXX Stupid expedient algorithm should be replaced by something better.  */
 
 struct idr {
-	krwlock_t idr_lock;
-	rb_tree_t idr_tree;
-	struct idr_node *idr_temp;
+	kmutex_t		idr_lock;
+	pserialize_t		idr_psz;
+	struct idr_state	*idr_state;
+	struct idr_state	*volatile idr_temp;
 };
 
 /* XXX Make the nm output a little more greppable...  */

Index: src/sys/external/bsd/drm2/linux/linux_idr.c
diff -u src/sys/external/bsd/drm2/linux/linux_idr.c:1.1.2.9 src/sys/external/bsd/drm2/linux/linux_idr.c:1.1.2.10
--- src/sys/external/bsd/drm2/linux/linux_idr.c:1.1.2.9	Wed Jul 24 04:02:58 2013
+++ src/sys/external/bsd/drm2/linux/linux_idr.c	Mon Dec 30 04:52:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_idr.c,v 1.1.2.9 2013/07/24 04:02:58 riastradh Exp $	*/
+/*	$NetBSD: linux_idr.c,v 1.1.2.10 2013/12/30 04:52:11 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,215 +30,226 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.1.2.9 2013/07/24 04:02:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.1.2.10 2013/12/30 04:52:11 riastradh Exp $");
 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
 
 #include 
 #include 
+#include 
 
-struct idr_node {
-	rb_node_t in_rb_node;
-	int in_index;
-	void *in_data;
+struct idr_state {
+	size_t			is_n_allocated;
+	size_t			is_n_used;
+	void			**is_data;
 };
 
-static signed int idr_tree_compare_nodes(void *, const void *, const void *);
-static signed int idr_tree_compare_key(void *, const void *, const void *);
-
-static const rb_tree_ops_t idr_rb_ops = {
-	.rbto_compare_nodes = &idr_tree_compare_nodes,
-	.rbto_compare_key = &idr_tree_compare_key,
-	.rbto_node_offset = offsetof(struct idr_node, in_rb_node),
-	.rbto_context = NULL,
-};
-
-static signed int
-idr_tree_compare_nodes(void *ctx __unused, const void *na, const void *nb)
+void
+idr_init(struct idr *idr)
 {
-	const int a = ((const struct idr_node *)na)->in_index;
-	const int b = ((const struct idr_node *)nb)->in_index;
 
-	if (a < b)
-		return -1;
-	else if (b < a)
-		 return +1;
-	else
-		return 0;
+	mutex_init(&idr->idr_lock, MUTEX_DEFAULT, IPL_VM);
+	idr->idr_psz = pserialize_create();
+	idr->idr_state = kmalloc(sizeof(*idr->idr_state), GFP_KERNEL);
+	KASSERT(idr->idr_state != NULL);
+	idr->idr_state->is_n_allocated = 1;
+	idr->idr_state->is_n_used = 0;
+	idr->idr_state->is_data = kcalloc(1, sizeof(void *), GFP_KERNEL);
+	KASSERT(idr->idr_state->is_data != NULL);
+	idr->idr_temp = NULL;
 }
 
-static signed int
-idr_tree_compare_key(void *ctx __unused, const void *n, const void *key)
+static struct idr_state *
+idr_state(struct idr *idr)
 {
-	const int a = ((const struct idr_node *)n)->in_index;
-	const int b = *(const int *)key;
+	struct idr_state *const is = idr->idr_state;
 
-	if (a < b)
-		return -1;
-	else if (b < a)
-		return +1;
-	else
-		return 0;
+	membar_consumer();		/* match state */
+
+	return is;
 }
 
 void
-idr_init(struct idr *idr)
+idr_destroy(struct idr *idr)
 {
+	struct idr_state *const is = idr_state(idr);
 
-	rw_init(&idr->idr_lock);
-	rb_tree_init(&idr->idr_tree, &idr_rb_ops);
-	idr->idr_temp = NULL;
+	kfree(is->is_data);
+	kfree(is);
+	KASSERT(idr->idr_temp == NULL);
+
+	pserialize_destroy(idr->idr_psz);
+	mutex_destroy(&idr->idr_lock);
 }
 
-void
-idr_destroy(struct idr *idr)
+static void **
+idr_find_ptr(struct idr *idr, int id)
 {
+	if (id < 0)
+		return NULL;
 
-	if (

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:52:02 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c

Log Message:
flush_workqueue should work now, so don't work around it i915 unload.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.33 -r1.1.1.1.2.34 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_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/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.33 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.34
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.33	Mon Dec 30 04:51:53 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Mon Dec 30 04:52:02 2013
@@ -1853,18 +1853,7 @@ int i915_driver_unload(struct drm_device
 
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 		/* Flush any outstanding unpin_work. */
-#ifdef __NetBSD__
-		/*
-		 * XXX Keep this updated!  (XXX How?)
-		 * (XXX Well, do work queues for real...)
-		 */
-		cancel_work_sync(&dev_priv->l3_parity.error_work);
-#  if 0/* XXX How do we get the CRTCs? */
-		cancel_work_sync(&...intel_crtc->unpin_work);
-#  endif
-#else
 		flush_workqueue(dev_priv->wq);
-#endif
 
 		mutex_lock(&dev->struct_mutex);
 		i915_gem_free_all_phys_object(dev);



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:51:24 UTC 2013

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

Log Message:
Avoid dividing by zero when allocating empty array in kcalloc.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \
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.

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/slab.h
diff -u src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.9
--- src/sys/external/bsd/drm2/include/linux/slab.h:1.1.2.8	Wed Jul 24 04:01:51 2013
+++ src/sys/external/bsd/drm2/include/linux/slab.h	Mon Dec 30 04:51:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: slab.h,v 1.1.2.8 2013/07/24 04:01:51 riastradh Exp $	*/
+/*	$NetBSD: slab.h,v 1.1.2.9 2013/12/30 04:51:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -76,7 +76,8 @@ kzalloc(size_t size, gfp_t gfp)
 static inline void *
 kcalloc(size_t n, size_t size, gfp_t gfp)
 {
-	KASSERT(size <= (SIZE_MAX / n));
+	KASSERT(size != 0);
+	KASSERT(n <= (SIZE_MAX / size));
 	return malloc((n * size), M_TEMP, (linux_gfp_to_malloc(gfp) | M_ZERO));
 }
 



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:51:16 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_fb_helper.c

Log Message:
Tweak drm_fb_helper_single_fb_probe so we needn't reconnect the screen.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.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_fb_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.1.1.1.2.3 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.1.1.1.2.4
--- src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.1.1.1.2.3	Sun Sep  8 16:38:51 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c	Mon Dec 30 04:51:15 2013
@@ -855,6 +855,12 @@ int drm_fb_helper_single_fb_probe(struct
 		dev_info(fb_helper->dev->dev, "fb%d: %s frame buffer device\n",
 info->node, info->fix.id);
 
+#else
+		/*
+		 * XXX Not sure this is right, but this logic will get
+		 * cleaned up in a newer import of drm2.
+		 */
+		drm_fb_helper_set_config(fb_helper);
 #endif
 	} else {
 #ifdef __NetBSD__		/* XXX fb info */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:51:53 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c

Log Message:
i915_gem_context_close destroys the idr; i915_driver_postclose needn't.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.32 -r1.1.1.1.2.33 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_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/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.32 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.33
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.32	Mon Dec 30 04:51:35 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Mon Dec 30 04:51:53 2013
@@ -1983,7 +1983,6 @@ void i915_driver_postclose(struct drm_de
 	struct drm_i915_file_private *file_priv = file->driver_priv;
 
 #ifdef __NetBSD__
-	idr_destroy(&file_priv->context_idr);
 	spin_lock_destroy(&file_priv->mm.lock);
 #endif
 



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:51:43 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_pci.c

Log Message:
Detach framebuffer stuff before drm device in i915drm_detach.

Detaching the drm device calls the i915_driver_unload routine, which
nukes the i915 private data structures, so that we can't use them any
more to detach the framebuffer.

Now i915drm2 unloads!


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/external/bsd/drm2/i915drm/i915_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/i915_pci.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_pci.c:1.1.2.4 src/sys/external/bsd/drm2/i915drm/i915_pci.c:1.1.2.5
--- src/sys/external/bsd/drm2/i915drm/i915_pci.c:1.1.2.4	Sun Sep  8 16:41:07 2013
+++ src/sys/external/bsd/drm2/i915drm/i915_pci.c	Mon Dec 30 04:51:43 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_pci.c,v 1.1.2.4 2013/09/08 16:41:07 riastradh Exp $	*/
+/*	$NetBSD: i915_pci.c,v 1.1.2.5 2013/12/30 04:51:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.1.2.4 2013/09/08 16:41:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.1.2.5 2013/12/30 04:51:43 riastradh Exp $");
 
 #include 
 #include 
@@ -165,12 +165,17 @@ i915drm_detach(device_t self, int flags)
 	struct i915drm_softc *const sc = device_private(self);
 	int error;
 
-	/* Detach the drm driver first.  */
-	error = config_detach_children(self, flags);
+	/*
+	 * XXX OK to do this first?  Detaching the drm driver runs
+	 * i915_driver_unload, which frees all the i915 private data
+	 * structures.
+	 */
+	error = i915drm_detach_framebuffer(self, flags);
 	if (error)
 		return error;
 
-	error = i915drm_detach_framebuffer(self, flags);
+	/* Detach the drm driver first.  */
+	error = config_detach_children(self, flags);
 	if (error)
 		return error;
 



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:51:35 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c
i915_gem.c

Log Message:
Initialize and destroy the pending flip lock.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.31 -r1.1.1.1.2.32 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.1.1.1.2.15 -r1.1.1.1.2.16 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.31 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.32
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.31	Sun Sep  8 16:28:27 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Mon Dec 30 04:51:35 2013
@@ -1750,6 +1750,7 @@ out_gem_unload:
 	spin_lock_destroy(&dev_priv->dpio_lock);
 	linux_mutex_destroy(&dev_priv->rps.hw_lock);
 	DRM_DESTROY_WAITQUEUE(&dev_priv->pending_flip_queue);
+	linux_mutex_destroy(&dev_priv->pending_flip_lock);
 	destroy_completion(&dev_priv->error_completion);
 #endif
 
@@ -1884,6 +1885,7 @@ int i915_driver_unload(struct drm_device
 #ifdef __NetBSD__
 	/* XXX Not sure this is the right place, but it looks safe.  */
 	DRM_DESTROY_WAITQUEUE(&dev_priv->pending_flip_queue);
+	linux_mutex_destroy(&dev_priv->pending_flip_lock);
 	destroy_completion(&dev_priv->error_completion);
 #endif
 

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.1.1.1.2.15 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.16
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.15	Sun Sep  8 16:28:27 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Mon Dec 30 04:51:35 2013
@@ -4633,6 +4633,7 @@ i915_gem_load(struct drm_device *dev)
 	i915_gem_detect_bit_6_swizzle(dev);
 #ifdef __NetBSD__
 	DRM_INIT_WAITQUEUE(&dev_priv->pending_flip_queue, "i915flip");
+	linux_mutex_init(&dev_priv->pending_flip_lock);
 #else
 	init_waitqueue_head(&dev_priv->pending_flip_queue);
 #endif



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:51:06 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Initialize the workqueue flush structures correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/external/bsd/drm2/linux/linux_work.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/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.6 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.7
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.6	Mon Dec 30 04:50:57 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:51:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.6 2013/12/30 04:50:57 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.7 2013/12/30 04:51:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.6 2013/12/30 04:50:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.7 2013/12/30 04:51:06 riastradh Exp $");
 
 #include 
 #include 
@@ -208,6 +208,7 @@ flush_workqueue(struct workqueue_struct 
 		struct wq_flush_work wqfw = zero_wqfw;
 
 		wqf.wqf_n = 1;
+		wqfw.wqfw_flush = &wqf;
 		INIT_WORK(&wqfw.wqfw_work, &linux_wq_barrier);
 		wqfw.wqfw_work.w_wq = wq;
 		wqfw.wqfw_work.w_state = WORK_PENDING;
@@ -226,6 +227,7 @@ flush_workqueue(struct workqueue_struct 
 			mutex_enter(&wqf.wqf_lock);
 			wqf.wqf_n++;
 			mutex_exit(&wqf.wqf_lock);
+			wqfw->wqfw_flush = &wqf;
 			INIT_WORK(&wqfw->wqfw_work, &linux_wq_barrier);
 			wqfw->wqfw_work.w_state = WORK_PENDING;
 			wqfw->wqfw_work.w_wq = wq;



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:50:48 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Pass the wq to linux_worker as it expects, not NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/external/bsd/drm2/linux/linux_work.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/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.4 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.5
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.4	Mon Dec 30 04:50:39 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:50:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.4 2013/12/30 04:50:39 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.5 2013/12/30 04:50:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.4 2013/12/30 04:50:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.5 2013/12/30 04:50:48 riastradh Exp $");
 
 #include 
 #include 
@@ -116,7 +116,7 @@ alloc_ordered_workqueue(const char *name
 
 	wq = kmem_alloc(sizeof(*wq), KM_SLEEP);
 	error = workqueue_create(&wq->wq_workqueue, name, &linux_worker,
-	NULL, PRI_NONE, IPL_NONE, flags);
+	wq, PRI_NONE, IPL_NONE, flags);
 	if (error) {
 		kmem_free(wq, sizeof(*wq));
 		return NULL;
@@ -440,6 +440,8 @@ linux_worker(struct work *wk, void *arg)
 		break;
 
 	case WORK_PENDING:
+		KASSERT(work->w_wq == wq);
+
 		/* Get ready to invoke this one.  */
 		mutex_enter(&wq->wq_lock);
 		work->w_state = WORK_INVOKED;
@@ -464,6 +466,8 @@ linux_worker(struct work *wk, void *arg)
 		break;
 
 	case WORK_CANCELLED:
+		KASSERT(work->w_wq == wq);
+
 		/* Return to idle; notify anyone waiting for cancellation.  */
 		mutex_enter(&wq->wq_lock);
 		work->w_state = WORK_IDLE;



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:50:57 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Make Linux workqueues at IPL_VM for now.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/external/bsd/drm2/linux/linux_work.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/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.5 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.6
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.5	Mon Dec 30 04:50:48 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:50:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.5 2013/12/30 04:50:48 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.6 2013/12/30 04:50:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.5 2013/12/30 04:50:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.6 2013/12/30 04:50:57 riastradh Exp $");
 
 #include 
 #include 
@@ -116,7 +116,7 @@ alloc_ordered_workqueue(const char *name
 
 	wq = kmem_alloc(sizeof(*wq), KM_SLEEP);
 	error = workqueue_create(&wq->wq_workqueue, name, &linux_worker,
-	wq, PRI_NONE, IPL_NONE, flags);
+	wq, PRI_NONE, IPL_VM, flags);
 	if (error) {
 		kmem_free(wq, sizeof(*wq));
 		return NULL;



CVS commit: [riastradh-drm2] src/sys

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:50:12 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_module.c
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h
src/sys/modules/drm2 [riastradh-drm2]: Makefile
Added Files:
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
First (plausible) draft of Linux workqueue implementation rework.

Untested, but this looks better than what was there before, or any of
the drafts leading up to this which got torn out of the typewriter,
crumpled up, and crudely tossed in frustration toward the wastepaper
basket by my desk alongside the empty bottles of Jack Daniels that
fueled them, or something like that.

Can't use multiple CPUs per workqueue.  That requires some explicit
management of per-CPU workqueue state, since NetBSD's workqueue(9)
doesn't provide that or cancellation or flushing.  Oops.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/external/bsd/drm2/drm/drm_module.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 \
src/sys/external/bsd/drm2/include/linux/workqueue.h
cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/linux/linux_work.c
cvs rdiff -u -r1.1.2.42 -r1.1.2.43 src/sys/modules/drm2/Makefile

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.1.2.6 src/sys/external/bsd/drm2/drm/drm_module.c:1.1.2.7
--- src/sys/external/bsd/drm2/drm/drm_module.c:1.1.2.6	Sun Sep  8 15:26:24 2013
+++ src/sys/external/bsd/drm2/drm/drm_module.c	Mon Dec 30 04:50:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_module.c,v 1.1.2.6 2013/09/08 15:26:24 riastradh Exp $	*/
+/*	$NetBSD: drm_module.c,v 1.1.2.7 2013/12/30 04:50:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.1.2.6 2013/09/08 15:26:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.1.2.7 2013/12/30 04:50:12 riastradh Exp $");
 
 #include 
 #include 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: drm_module.c
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -75,12 +76,20 @@ drm2_modcmd(modcmd_t cmd, void *arg __un
 			" %d", error);
 			return error;
 		}
+		error = linux_workqueue_init();
+		if (error) {
+			aprint_error("drm: unable to initialize workqueues:"
+			" %d", error);
+			linux_kmap_fini();
+			return error;
+		}
 #ifdef _MODULE
 		error = config_init_component(cfdriver_ioconf_drm,
 		cfattach_ioconf_drm, cfdata_ioconf_drm);
 		if (error) {
 			aprint_error("drm: unable to init component: %d\n",
 			error);
+			linux_workqueue_fini();
 			linux_kmap_fini();
 			return error;
 		}
@@ -91,6 +100,7 @@ drm2_modcmd(modcmd_t cmd, void *arg __un
 			error);
 			(void)config_fini_component(cfdriver_ioconf_drm,
 			cfattach_ioconf_drm, cfdata_ioconf_drm);
+			linux_workqueue_fini();
 			linux_kmap_fini();
 			return error;
 		}
@@ -108,6 +118,7 @@ drm2_modcmd(modcmd_t cmd, void *arg __un
 			/* XXX Now what?  Reattach the devsw?  */
 			return error;
 #endif
+		linux_workqueue_fini();
 		linux_kmap_fini();
 		linux_mutex_destroy(&drm_global_mutex);
 		return 0;

Index: src/sys/external/bsd/drm2/include/linux/workqueue.h
diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.10 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.11
--- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.10	Sun Sep  8 16:40:36 2013
+++ src/sys/external/bsd/drm2/include/linux/workqueue.h	Mon Dec 30 04:50:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: workqueue.h,v 1.1.2.10 2013/09/08 16:40:36 riastradh Exp $	*/
+/*	$NetBSD: workqueue.h,v 1.1.2.11 2013/12/30 04:50:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,258 +32,80 @@
 #ifndef _LINUX_WORKQUEUE_H_
 #define _LINUX_WORKQUEUE_H_
 
+#include 
 #include 
-#include 
-#include 
+#include 
 #include 
 
-#include 
 #include 
 
-/*
- * XXX This implementation is a load of bollocks -- callouts and
- * workqueues are expedient, but wrong, if for no reason other than
- * that there is no destroy operation.
- *
- * XXX The amount of code in here is absurd; it should be given a
- * proper source file.
- */
+#define	INIT_DELAYED_WORK		linux_INIT_DELAYED_WORK
+#define	INIT_WORK			linux_INIT_WORK
+#define	alloc_ordered_workqueue		linux_alloc_ordered_workqueue
+#define	cancel_delayed_work		linux_cancel_delayed_work
+#define	cancel_delayed_work_sync	linux_cancel_delayed_work_sync
+#define	cancel_work			linux_cancel_work
+#define	cancel_work_sync		linux_cancel_work_sync
+#define	destroy_workqueue		linux_destroy_workqueue
+#define	flush_workqueue			linux_flush_workqueue
+#define	queue_delayed_work		linux_queue_delayed_work
+#define	queue_work			linux_queue_work
+#define	

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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:50:39 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Actually insert the delayed work into the workqueue.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/linux/linux_work.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/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.3 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.4
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.3	Mon Dec 30 04:50:30 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:50:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.3 2013/12/30 04:50:30 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.4 2013/12/30 04:50:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.3 2013/12/30 04:50:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.4 2013/12/30 04:50:39 riastradh Exp $");
 
 #include 
 #include 
@@ -520,6 +520,7 @@ queue_delayed_work(struct workqueue_stru
 		callout_reset(&dw->dw_callout, ticks, &linux_worker_intr, dw);
 		dw->work.w_state = WORK_DELAYED;
 		dw->work.w_wq = wq;
+		TAILQ_INSERT_HEAD(&wq->wq_delayed, dw, dw_entry);
 		break;
 
 	case WORK_DELAYED:



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:50:21 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Add flush_scheduled_work back.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 \
src/sys/external/bsd/drm2/include/linux/workqueue.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/linux/linux_work.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/workqueue.h
diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.11 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.12
--- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.11	Mon Dec 30 04:50:12 2013
+++ src/sys/external/bsd/drm2/include/linux/workqueue.h	Mon Dec 30 04:50:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: workqueue.h,v 1.1.2.11 2013/12/30 04:50:12 riastradh Exp $	*/
+/*	$NetBSD: workqueue.h,v 1.1.2.12 2013/12/30 04:50:21 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -94,6 +94,7 @@ struct workqueue_struct *
 	alloc_ordered_workqueue(const char *, int);
 void	destroy_workqueue(struct workqueue_struct *);
 void	flush_workqueue(struct workqueue_struct *);
+void	flush_scheduled_work(void);
 
 void	INIT_WORK(struct work_struct *, void (*)(struct work_struct *));
 void	schedule_work(struct work_struct *);

Index: src/sys/external/bsd/drm2/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.1 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.2
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.1	Mon Dec 30 04:50:12 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:50:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.1 2013/12/30 04:50:12 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.2 2013/12/30 04:50:21 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.1 2013/12/30 04:50:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.2 2013/12/30 04:50:21 riastradh Exp $");
 
 #include 
 #include 
@@ -172,6 +172,12 @@ destroy_workqueue(struct workqueue_struc
  * match what Linux does (or, doesn't do).
  */
 
+void
+flush_scheduled_work(void)
+{
+	flush_workqueue(system_wq);
+}
+
 struct wq_flush_work {
 	struct work_struct	wqfw_work;
 	struct wq_flush		*wqfw_flush;



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

2013-12-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 30 04:50:30 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_work.c

Log Message:
Helps to actually allocate and free the workqueue memory!


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/linux/linux_work.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/linux/linux_work.c
diff -u src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.2 src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.3
--- src/sys/external/bsd/drm2/linux/linux_work.c:1.1.2.2	Mon Dec 30 04:50:21 2013
+++ src/sys/external/bsd/drm2/linux/linux_work.c	Mon Dec 30 04:50:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.1.2.2 2013/12/30 04:50:21 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.1.2.3 2013/12/30 04:50:30 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.2 2013/12/30 04:50:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.1.2.3 2013/12/30 04:50:30 riastradh Exp $");
 
 #include 
 #include 
@@ -114,10 +114,13 @@ alloc_ordered_workqueue(const char *name
 
 	KASSERT(linux_flags == 0);
 
+	wq = kmem_alloc(sizeof(*wq), KM_SLEEP);
 	error = workqueue_create(&wq->wq_workqueue, name, &linux_worker,
 	NULL, PRI_NONE, IPL_NONE, flags);
-	if (error)
+	if (error) {
+		kmem_free(wq, sizeof(*wq));
 		return NULL;
+	}
 
 	mutex_init(&wq->wq_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&wq->wq_cv, name);
@@ -163,6 +166,8 @@ destroy_workqueue(struct workqueue_struc
 
 	cv_destroy(&wq->wq_cv);
 	mutex_destroy(&wq->wq_lock);
+
+	kmem_free(wq, sizeof(*wq));
 }
 
 /*



CVS commit: src/external/bsd/smbfs/dist/smbutil

2013-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 30 01:55:54 UTC 2013

Modified Files:
src/external/bsd/smbfs/dist/smbutil: login.c

Log Message:
remove unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/smbfs/dist/smbutil/login.c

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

Modified files:

Index: src/external/bsd/smbfs/dist/smbutil/login.c
diff -u src/external/bsd/smbfs/dist/smbutil/login.c:1.3 src/external/bsd/smbfs/dist/smbutil/login.c:1.4
--- src/external/bsd/smbfs/dist/smbutil/login.c:1.3	Thu Dec 26 11:52:36 2013
+++ src/external/bsd/smbfs/dist/smbutil/login.c	Sun Dec 29 20:55:54 2013
@@ -54,7 +54,7 @@ int
 cmd_login(int argc, char *argv[])
 {
 	struct smb_ctx sctx, *ctx = &sctx;
-	int error, opt, setprimary = 0, level;
+	int error, opt, level;
 
 	if (argc < 2)
 		login_usage();
@@ -72,7 +72,6 @@ cmd_login(int argc, char *argv[])
 exit(1);
 			break;
 		case 'D':
-			setprimary = 1;
 			break;
 		default:
 			login_usage();



CVS commit: src/external/bsd/ntp/dist

2013-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 30 01:34:23 UTC 2013

Modified Files:
src/external/bsd/ntp/dist/ntpd: ntp_config.c
src/external/bsd/ntp/dist/ntpq: ntpq-subs.c
src/external/bsd/ntp/dist/sntp: main.c

Log Message:
remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ntp/dist/ntpd/ntp_config.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ntp/dist/ntpq/ntpq-subs.c
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/ntp/dist/sntp/main.c

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

Modified files:

Index: src/external/bsd/ntp/dist/ntpd/ntp_config.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.6 src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.7
--- src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.6	Fri Dec 27 22:20:14 2013
+++ src/external/bsd/ntp/dist/ntpd/ntp_config.c	Sun Dec 29 20:34:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_config.c,v 1.6 2013/12/28 03:20:14 christos Exp $	*/
+/*	$NetBSD: ntp_config.c,v 1.7 2013/12/30 01:34:22 christos Exp $	*/
 
 /* ntp_config.c
  *
@@ -2595,9 +2595,7 @@ config_rlimit(
 	)
 {
 	attr_val *	rlimit_av;
-	int		item;
 
-	item = -1;	/* quiet warning */
 	rlimit_av = HEAD_PFIFO(ptree->rlimit);
 	for (; rlimit_av != NULL; rlimit_av = rlimit_av->link) {
 		switch (rlimit_av->attr) {

Index: src/external/bsd/ntp/dist/ntpq/ntpq-subs.c
diff -u src/external/bsd/ntp/dist/ntpq/ntpq-subs.c:1.5 src/external/bsd/ntp/dist/ntpq/ntpq-subs.c:1.6
--- src/external/bsd/ntp/dist/ntpq/ntpq-subs.c:1.5	Fri Dec 27 22:20:14 2013
+++ src/external/bsd/ntp/dist/ntpq/ntpq-subs.c	Sun Dec 29 20:34:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntpq-subs.c,v 1.5 2013/12/28 03:20:14 christos Exp $	*/
+/*	$NetBSD: ntpq-subs.c,v 1.6 2013/12/30 01:34:22 christos Exp $	*/
 
 /*
  * ntpq-subs.c - subroutines which are called to perform ntpq commands.
@@ -3174,7 +3174,6 @@ ifstats(
 	char *		tag;
 	char *		val;
 	int		fields;
-	u_int		ifnum;
 	u_int		ui;
 	ifstats_row	row;
 	int		comprende;
@@ -3193,7 +3192,6 @@ ifstats(
 
 	ZERO(row);
 	fields = 0;
-	ifnum = 0;
 	ui = 0;
 	while (nextvar(&dsize, &datap, &tag, &val)) {
 		if (debug > 1)
@@ -3391,7 +3389,6 @@ reslist(
 	char *		tag;
 	char *		val;
 	int		fields;
-	u_int		idx;
 	u_int		ui;
 	reslist_row	row;
 	int		comprende;
@@ -3410,7 +3407,6 @@ reslist(
 
 	ZERO(row);
 	fields = 0;
-	idx = 0;
 	ui = 0;
 	while (nextvar(&dsize, &datap, &tag, &val)) {
 		if (debug > 1)

Index: src/external/bsd/ntp/dist/sntp/main.c
diff -u src/external/bsd/ntp/dist/sntp/main.c:1.9 src/external/bsd/ntp/dist/sntp/main.c:1.10
--- src/external/bsd/ntp/dist/sntp/main.c:1.9	Sat Dec 28 22:26:07 2013
+++ src/external/bsd/ntp/dist/sntp/main.c	Sun Dec 29 20:34:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.9 2013/12/29 03:26:07 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.10 2013/12/30 01:34:23 christos Exp $	*/
 
 #include 
 
@@ -297,9 +297,7 @@ open_sockets(
 	)
 {
 	sockaddr_u	name;
-	int		one_fam_works;
 
-	one_fam_works = FALSE;
 	if (-1 == sock4) {
 		sock4 = socket(PF_INET, SOCK_DGRAM, 0);
 		if (-1 == sock4) {
@@ -330,7 +328,6 @@ open_sockets(
 			msyslog(LOG_ERR,
 "open_sockets: event_new(base, sock4) failed!");
 		} else {
-			one_fam_works = TRUE;
 			event_add(ev_sock4, &wakeup_tv);
 		}
 	}
@@ -365,7 +362,6 @@ open_sockets(
 			msyslog(LOG_ERR,
 "open_sockets: event_new(base, sock6) failed!");
 		} else {
-			one_fam_works = TRUE;
 			event_add(ev_sock6, &wakeup_tv);
 		}
 	}



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

2013-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 29 23:26:00 UTC 2013

Modified Files:
src/sys/external/bsd/sljit/dist/sljit_src: sljitUtils.c

Log Message:
Simplify previous, don't even set the variables if they are not going to
be used.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.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/sljitUtils.c
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.4 src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.5
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.4	Sun Dec 29 18:07:34 2013
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c	Sun Dec 29 18:26:00 2013
@@ -298,16 +298,13 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL
 
 SLJIT_API_FUNC_ATTRIBUTE sljit_w SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit)
 {
-#ifdef _WIN32
-	sljit_uw aligned_old_limit;
-	sljit_uw aligned_new_limit;
-#endif
-
 	if ((new_limit > stack->max_limit) || (new_limit < stack->base))
 		return -1;
 #ifdef _WIN32
-	aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
-	aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
+	sljit_uw aligned_new_limit =
+	(new_limit + sljit_page_align) & ~sljit_page_align;
+	sljit_uw aligned_old_limit =
+	(stack->limit + sljit_page_align) & ~sljit_page_align;
 	if (aligned_new_limit != aligned_old_limit) {
 		if (aligned_new_limit > aligned_old_limit) {
 			if (!VirtualAlloc((void*)aligned_old_limit, aligned_new_limit - aligned_old_limit, MEM_COMMIT, PAGE_READWRITE))
@@ -325,15 +322,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_w SLJIT_C
 		stack->limit = new_limit;
 		return 0;
 	}
-	aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
-	aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
-	/* If madvise is available, we release the unnecessary space. */
 #if defined(POSIX_MADV_DONTNEED)
-	if (aligned_new_limit < aligned_old_limit)
-		posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED);
+# define MADVISE(new, old) posix_madvise((new), (old), POSIX_MADV_DONTNEED)
 #elif defined(MADV_DONTNEED)
+# define MADVISE(new, old) madvise((new), (old), MADV_DONTNEED)
+#endif
+#ifdef MADVISE
+	sljit_uw aligned_new_limit =
+	(new_limit + sljit_page_align) & ~sljit_page_align;
+	sljit_uw aligned_old_limit =
+	(stack->limit + sljit_page_align) & ~sljit_page_align;
+	/* If madvise is available, we release the unnecessary space. */
 	if (aligned_new_limit < aligned_old_limit)
-		madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED);
+		MADVISE((void*)aligned_new_limit,
+		aligned_old_limit - aligned_new_limit);
 #endif
 	stack->limit = new_limit;
 	return 0;



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

2013-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 29 23:07:34 UTC 2013

Modified Files:
src/sys/external/bsd/sljit/dist/sljit_src: sljitUtils.c

Log Message:
ifdef unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.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/sljitUtils.c
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.3 src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.4
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c:1.3	Tue Dec 17 17:39:23 2013
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c	Sun Dec 29 18:07:34 2013
@@ -298,8 +298,10 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL
 
 SLJIT_API_FUNC_ATTRIBUTE sljit_w SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit)
 {
+#ifdef _WIN32
 	sljit_uw aligned_old_limit;
 	sljit_uw aligned_new_limit;
+#endif
 
 	if ((new_limit > stack->max_limit) || (new_limit < stack->base))
 		return -1;



CVS commit: src/external/bsd/openpam/dist/lib

2013-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 29 22:55:32 UTC 2013

Modified Files:
src/external/bsd/openpam/dist/lib: openpam_set_option.c
openpam_straddch.c openpam_subst.c openpam_ttyconv.c
pam_getenvlist.c pam_putenv.c pam_start.c

Log Message:
- add casts for sign-changing conversions
- fix types


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/bsd/openpam/dist/lib/openpam_set_option.c \
src/external/bsd/openpam/dist/lib/openpam_subst.c \
src/external/bsd/openpam/dist/lib/pam_getenvlist.c \
src/external/bsd/openpam/dist/lib/pam_putenv.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/bsd/openpam/dist/lib/openpam_straddch.c
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/openpam/dist/lib/openpam_ttyconv.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/openpam/dist/lib/pam_start.c

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

Modified files:

Index: src/external/bsd/openpam/dist/lib/openpam_set_option.c
diff -u src/external/bsd/openpam/dist/lib/openpam_set_option.c:1.4 src/external/bsd/openpam/dist/lib/openpam_set_option.c:1.5
--- src/external/bsd/openpam/dist/lib/openpam_set_option.c:1.4	Fri Dec 27 15:10:21 2013
+++ src/external/bsd/openpam/dist/lib/openpam_set_option.c	Sun Dec 29 17:55:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: openpam_set_option.c,v 1.4 2013/12/27 20:10:21 christos Exp $	*/
+/*	$NetBSD: openpam_set_option.c,v 1.5 2013/12/29 22:55:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -93,7 +93,8 @@ openpam_set_option(pam_handle_t *pamh,
 		RETURNC(PAM_BUF_ERR);
 	if (i == cur->optc) {
 		/* add */
-		optv = realloc(cur->optv, sizeof(char *) * (cur->optc + 2));
+		optv = realloc(cur->optv,
+		sizeof(*optv) * ((size_t)cur->optc + 2));
 		if (optv == NULL) {
 			FREE(opt);
 			RETURNC(PAM_BUF_ERR);
Index: src/external/bsd/openpam/dist/lib/openpam_subst.c
diff -u src/external/bsd/openpam/dist/lib/openpam_subst.c:1.4 src/external/bsd/openpam/dist/lib/openpam_subst.c:1.5
--- src/external/bsd/openpam/dist/lib/openpam_subst.c:1.4	Fri Dec 27 15:10:21 2013
+++ src/external/bsd/openpam/dist/lib/openpam_subst.c	Sun Dec 29 17:55:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: openpam_subst.c,v 1.4 2013/12/27 20:10:21 christos Exp $	*/
+/*	$NetBSD: openpam_subst.c,v 1.5 2013/12/29 22:55:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 Dag-Erling Smørgrav
@@ -40,7 +40,7 @@
 #include "openpam_impl.h"
 
 #define subst_char(ch) do {			\
-	int ch_ = (ch);\
+	char ch_ = (ch);			\
 	if (buf && len < *bufsize)		\
 		*buf++ = ch_;			\
 	++len;	\
Index: src/external/bsd/openpam/dist/lib/pam_getenvlist.c
diff -u src/external/bsd/openpam/dist/lib/pam_getenvlist.c:1.4 src/external/bsd/openpam/dist/lib/pam_getenvlist.c:1.5
--- src/external/bsd/openpam/dist/lib/pam_getenvlist.c:1.4	Fri Dec 27 15:10:21 2013
+++ src/external/bsd/openpam/dist/lib/pam_getenvlist.c	Sun Dec 29 17:55:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_getenvlist.c,v 1.4 2013/12/27 20:10:21 christos Exp $	*/
+/*	$NetBSD: pam_getenvlist.c,v 1.5 2013/12/29 22:55:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -64,7 +64,7 @@ pam_getenvlist(pam_handle_t *pamh)
 	ENTER();
 	if (pamh == NULL)
 		RETURNP(NULL);
-	envlist = malloc(sizeof(char *) * (pamh->env_count + 1));
+	envlist = malloc(sizeof(*envlist) * ((size_t)pamh->env_count + 1));
 	if (envlist == NULL) {
 		openpam_log(PAM_LOG_ERROR, "%s",
 			pam_strerror(pamh, PAM_BUF_ERR));
Index: src/external/bsd/openpam/dist/lib/pam_putenv.c
diff -u src/external/bsd/openpam/dist/lib/pam_putenv.c:1.4 src/external/bsd/openpam/dist/lib/pam_putenv.c:1.5
--- src/external/bsd/openpam/dist/lib/pam_putenv.c:1.4	Fri Dec 27 15:10:21 2013
+++ src/external/bsd/openpam/dist/lib/pam_putenv.c	Sun Dec 29 17:55:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_putenv.c,v 1.4 2013/12/27 20:10:21 christos Exp $	*/
+/*	$NetBSD: pam_putenv.c,v 1.5 2013/12/29 22:55:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -83,7 +83,7 @@ pam_putenv(pam_handle_t *pamh,
 	/* grow the environment list if necessary */
 	if (pamh->env_count == pamh->env_size) {
 		env = realloc(pamh->env,
-		sizeof(char *) * (pamh->env_size * 2 + 1));
+		sizeof(*env) * ((size_t)pamh->env_size * 2 + 1));
 		if (env == NULL)
 			RETURNC(PAM_BUF_ERR);
 		pamh->env = env;

Index: src/external/bsd/openpam/dist/lib/openpam_straddch.c
diff -u src/external/bsd/openpam/dist/lib/openpam_straddch.c:1.1.1.2 src/external/bsd/openpam/dist/lib/openpam_straddch.c:1.2
--- src/external/bsd/openpam/dist/lib/openpam_straddch.c:1.1.1.2	Fri Dec 27 14:27:42 2013
+++ src/external/bsd/openpam/dist/lib/openpam_straddch.c	Sun Dec 29 17:55:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: openpam_straddch.c,v 1.1.1.2 2013/12/27 19:27:42 christos Exp $	*/
+/*	$NetBSD: openpam_straddch.c,v 1.2 2013/12/29 22:55:32 christo

CVS commit: src/lib/libpam/modules

2013-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 29 22:54:58 UTC 2013

Modified Files:
src/lib/libpam/modules/pam_exec: pam_exec.c
src/lib/libpam/modules/pam_ksu: pam_ksu.c
src/lib/libpam/modules/pam_login_access: login_access.c
src/lib/libpam/modules/pam_nologin: pam_nologin.c
src/lib/libpam/modules/pam_unix: pam_unix.c

Log Message:
Fix incorrect types


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libpam/modules/pam_exec/pam_exec.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libpam/modules/pam_ksu/pam_ksu.c
cvs rdiff -u -r1.6 -r1.7 \
src/lib/libpam/modules/pam_login_access/login_access.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libpam/modules/pam_nologin/pam_nologin.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libpam/modules/pam_unix/pam_unix.c

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

Modified files:

Index: src/lib/libpam/modules/pam_exec/pam_exec.c
diff -u src/lib/libpam/modules/pam_exec/pam_exec.c:1.6 src/lib/libpam/modules/pam_exec/pam_exec.c:1.7
--- src/lib/libpam/modules/pam_exec/pam_exec.c:1.6	Tue Jan  3 14:02:54 2012
+++ src/lib/libpam/modules/pam_exec/pam_exec.c	Sun Dec 29 17:54:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_exec.c,v 1.6 2012/01/03 19:02:54 christos Exp $	*/
+/*	$NetBSD: pam_exec.c,v 1.7 2013/12/29 22:54:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001,2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_exec/pam_exec.c,v 1.4 2005/02/01 10:37:07 des Exp $");
 #else
-__RCSID("$NetBSD: pam_exec.c,v 1.6 2012/01/03 19:02:54 christos Exp $");
+__RCSID("$NetBSD: pam_exec.c,v 1.7 2013/12/29 22:54:58 christos Exp $");
 #endif
 
 #include 
@@ -70,7 +70,8 @@ static int
 _pam_exec(pam_handle_t *pamh __unused, int flags __unused,
 int argc, const char *argv[])
 {
-	int envlen, i, nitems, pam_err, status;
+	size_t envlen, i, nitems;
+	int pam_err, status;
 	char **envlist, **tmp;
 	volatile int childerr;
 	pid_t pid;

Index: src/lib/libpam/modules/pam_ksu/pam_ksu.c
diff -u src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.7 src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.8
--- src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.7	Sat Dec 28 13:04:03 2013
+++ src/lib/libpam/modules/pam_ksu/pam_ksu.c	Sun Dec 29 17:54:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ksu.c,v 1.7 2013/12/28 18:04:03 christos Exp $	*/
+/*	$NetBSD: pam_ksu.c,v 1.8 2013/12/29 22:54:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 Jacques A. Vidrine 
@@ -29,7 +29,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ksu/pam_ksu.c,v 1.5 2004/02/10 10:13:21 des Exp $");
 #else
-__RCSID("$NetBSD: pam_ksu.c,v 1.7 2013/12/28 18:04:03 christos Exp $");
+__RCSID("$NetBSD: pam_ksu.c,v 1.8 2013/12/29 22:54:58 christos Exp $");
 #endif
 
 #include 
@@ -53,8 +53,8 @@ static const char superuser[] = "root";
 
 static void	log_krb5(krb5_context, krb5_error_code, const char *, ...)
 __printflike(3, 4);
-static long	get_su_principal(krb5_context, const char *, const char *,
-		char **, krb5_principal *);
+static krb5_error_code	get_su_principal(krb5_context, const char *,
+const char *, char **, krb5_principal *);
 static int	auth_krb5(pam_handle_t *, krb5_context, const char *,
 		krb5_principal);
 
@@ -67,7 +67,7 @@ pam_sm_authenticate(pam_handle_t *pamh, 
 	const char	*user;
 	const void	*ruser;
 	char		*su_principal_name;
-	long		 rv;
+	krb5_error_code	 rv;
 	int		 pamret;
 
 	pamret = pam_get_user(pamh, &user, NULL);
@@ -125,7 +125,7 @@ auth_krb5(pam_handle_t *pamh, krb5_conte
 	krb5_verify_init_creds_opt vic_opt;
 	const char	*pass;
 	char		 prompt[80];
-	long		 rv;
+	krb5_error_code	 rv;
 	int		 pamret;
 
 	rv = krb5_get_init_creds_opt_alloc(context, &gic_opt);
@@ -200,14 +200,14 @@ log_krb5(krb5_context ctx, krb5_error_co
  *
  * Returns 0 for success, or a com_err error code on failure.
  */
-static long
+static krb5_error_code
 get_su_principal(krb5_context context, const char *target_user, const char *current_user,
 char **su_principal_name, krb5_principal *su_principal)
 {
 	krb5_principal	 default_principal;
 	krb5_ccache	 ccache;
 	char		*principal_name, *ccname, *p;
-	long		 rv;
+	krb5_error_code	 rv;
 	uid_t		 euid, ruid;
 
 	*su_principal = NULL;

Index: src/lib/libpam/modules/pam_login_access/login_access.c
diff -u src/lib/libpam/modules/pam_login_access/login_access.c:1.6 src/lib/libpam/modules/pam_login_access/login_access.c:1.7
--- src/lib/libpam/modules/pam_login_access/login_access.c:1.6	Tue Jan  3 14:02:55 2012
+++ src/lib/libpam/modules/pam_login_access/login_access.c	Sun Dec 29 17:54:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: login_access.c,v 1.6 2012/01/03 19:02:55 christos Exp $	*/
+/*	$NetBSD: login_access.c,v 1.7 2013/12/29 22:54:58 christos Exp $	*/
 
 /*
  * This module implements a simple but effective form of login access
@@ -19,7 +19,7 @@ static char sccsid[] = "%Z% %M% %I% %E% 
 #ifdef

CVS commit: src/doc

2013-12-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec 29 21:31:17 UTC 2013

Modified Files:
src/doc: CHANGES

Log Message:
Add note about wm(4)'s I354 support.


To generate a diff of this commit:
cvs rdiff -u -r1.1874 -r1.1875 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1874 src/doc/CHANGES:1.1875
--- src/doc/CHANGES:1.1874	Sat Dec 28 09:26:41 2013
+++ src/doc/CHANGES	Sun Dec 29 21:31:17 2013
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1874 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1875 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -323,3 +323,5 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	ntp: import ntp 4.2.7p404.  [christos 20131227]
 	luna68k: Add preleminary support of 4bpp framebuffer.
 		[tsutsui 20131227]
+	wm(4): Add support for I354 (C2000 Internal) Ethernet
+		[msaitoh 20131230]



CVS commit: src

2013-12-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec 29 21:28:41 UTC 2013

Modified Files:
src/share/man/man4: wm.4
src/sys/dev/pci: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Add support For I354(C2000 interna Ethernet controller):
 - Add I354 support.
 - Fix SGMII+MDIO case. SGMII+I2C is not supported yet.
 - Not tested well.
 - Sprinkle "XXX" to check later.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/share/man/man4/wm.4
cvs rdiff -u -r1.264 -r1.265 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/if_wmvar.h

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

Modified files:

Index: src/share/man/man4/wm.4
diff -u src/share/man/man4/wm.4:1.28 src/share/man/man4/wm.4:1.29
--- src/share/man/man4/wm.4:1.28	Sat Jul 20 21:39:58 2013
+++ src/share/man/man4/wm.4	Sun Dec 29 21:28:41 2013
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wm.4,v 1.28 2013/07/20 21:39:58 wiz Exp $
+.\"	$NetBSD: wm.4,v 1.29 2013/12/29 21:28:41 msaitoh Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 2, 2013
+.Dd December 30, 2013
 .Dt WM 4
 .Os
 .Sh NAME
@@ -142,6 +142,8 @@ Intel 82583 1000BASE-T Ethernet
 .It
 Intel I350 Ethernet (Copper, Fiber)
 .It
+Intel I354 (C2000 Internal) Ethernet (Copper, Fiber)
+.It
 Intel I210 Ethernet (Copper, Fiber)
 .It
 Intel I211 Ethernet

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.264 src/sys/dev/pci/if_wm.c:1.265
--- src/sys/dev/pci/if_wm.c:1.264	Fri Sep 13 21:22:10 2013
+++ src/sys/dev/pci/if_wm.c	Sun Dec 29 21:28:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.264 2013/09/13 21:22:10 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.265 2013/12/29 21:28:41 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.264 2013/09/13 21:22:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.265 2013/12/29 21:28:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -543,11 +543,13 @@ static int	wm_gmii_hv_readreg(device_t, 
 static void	wm_gmii_hv_writereg(device_t, int, int, int);
 static int	wm_gmii_82580_readreg(device_t, int, int);
 static void	wm_gmii_82580_writereg(device_t, int, int, int);
+static bool	wm_sgmii_uses_mdio(struct wm_softc *);
 static int	wm_sgmii_readreg(device_t, int, int);
 static void	wm_sgmii_writereg(device_t, int, int, int);
 
 static void	wm_gmii_statchg(struct ifnet *);
 
+static int	wm_get_phy_id_82575(struct wm_softc *);
 static void	wm_gmii_mediainit(struct wm_softc *, pci_product_id_t);
 static int	wm_gmii_mediachange(struct ifnet *);
 static void	wm_gmii_mediastatus(struct ifnet *, struct ifmediareq *);
@@ -1024,6 +1026,9 @@ static const struct wm_product {
 	  "I350 Gigabit Connection",
 	  WM_T_I350,		WMP_F_1000T },
 #endif
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_C2000_SGMII,
+	  "I354 Gigabit Connection",
+	  WM_T_I354,		WMP_F_1000T },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I210_T1,
 	  "I210-T1 Ethernet Server Adapter",
 	  WM_T_I210,		WMP_F_1000T },
@@ -1210,8 +1215,8 @@ wm_attach(device_t parent, device_t self
 
 	if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
 	|| (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
-	|| (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I210)
-	|| (sc->sc_type == WM_T_I211))
+	|| (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354)
+	|| (sc->sc_type == WM_T_I210) || (sc->sc_type == WM_T_I211))
 		sc->sc_flags |= WM_F_NEWQUEUE;
 
 	/* Set device properties (mactype) */
@@ -1326,7 +1331,7 @@ wm_attach(device_t parent, device_t self
 	|| (sc->sc_type ==  WM_T_82571) || (sc->sc_type == WM_T_80003)
 	|| (sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
 	|| (sc->sc_type == WM_T_82580) || (sc->sc_type == WM_T_82580ER)
-	|| (sc->sc_type == WM_T_I350))
+	|| (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354))
 		sc->sc_funcid = (CSR_READ(sc, WMREG_STATUS)
 		>> STATUS_FUNCID_SHIFT) & STATUS_FUNCID_MASK;
 	else
@@ -1597,6 +1602,7 @@ wm_attach(device_t parent, device_t self
 	case WM_T_82580:
 	case WM_T_82580ER:
 	case WM_T_I350:
+	case WM_T_I354: /*  ok? */
 	case WM_T_80003:
 		/* SPI */
 		wm_set_spiaddrbits(sc);
@@ -1771,6 +1777,7 @@ wm_attach(device_t parent, device_t self
 	case WM_T_82580:
 	case WM_T_82580ER:
 	case WM_T_I350:
+	case WM_T_I354: /* XXX ok? */
 	case WM_T_ICH8:
 	case WM_T_ICH9:
 	case WM_T_ICH10:
@@ -1897,20 +1904,30 @@ wm_attach(device_t parent, device_t self
 		case WM_T_82580:
 		case WM_T_82580ER:
 		case WM_T_I350:
+		case WM_T_I354:
 		case WM_T_I210:
 		case WM_T_I211:
 			reg = CSR_READ(sc, WMREG_CTRL_EXT);
 			switch (reg & CTRL_EXT_LINK_MODE_MASK) {
-		

CVS commit: src/sys/modules

2013-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec 29 18:20:42 UTC 2013

Added Files:
src/sys/modules/crypto: Makefile
src/sys/modules/opencrypto: Makefile
src/sys/modules/swcrypto: Makefile

Log Message:
Start modularizing the opencrypto framework.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/modules/crypto/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/opencrypto/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/swcrypto/Makefile

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

Added files:

Index: src/sys/modules/crypto/Makefile
diff -u /dev/null src/sys/modules/crypto/Makefile:1.1
--- /dev/null	Sun Dec 29 18:20:42 2013
+++ src/sys/modules/crypto/Makefile	Sun Dec 29 18:20:42 2013
@@ -0,0 +1,12 @@
+#	$NetBSD: Makefile,v 1.1 2013/12/29 18:20:42 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+CPPFLAGS+=	-DCOMPAT_50
+
+.PATH:	${S}/opencrypto
+
+KMOD=	crypto
+SRCS=	cryptodev.c ocryptodev.c
+
+.include 

Index: src/sys/modules/opencrypto/Makefile
diff -u /dev/null src/sys/modules/opencrypto/Makefile:1.1
--- /dev/null	Sun Dec 29 18:20:42 2013
+++ src/sys/modules/opencrypto/Makefile	Sun Dec 29 18:20:42 2013
@@ -0,0 +1,10 @@
+#	$NetBSD: Makefile,v 1.1 2013/12/29 18:20:42 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH:	${S}/opencrypto
+
+KMOD=	opencrypto
+SRCS=	criov.c crypto.c xform.c
+
+.include 

Index: src/sys/modules/swcrypto/Makefile
diff -u /dev/null src/sys/modules/swcrypto/Makefile:1.1
--- /dev/null	Sun Dec 29 18:20:42 2013
+++ src/sys/modules/swcrypto/Makefile	Sun Dec 29 18:20:42 2013
@@ -0,0 +1,10 @@
+#	$NetBSD: Makefile,v 1.1 2013/12/29 18:20:42 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH:	${S}/opencrypto
+
+KMOD=	swcrypto
+SRCS=	aesxcbcmac.c cryptosoft.c deflate.c gmac.c
+
+.include 



CVS commit: src/distrib/notes/amiga

2013-12-29 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sun Dec 29 18:11:15 UTC 2013

Modified Files:
src/distrib/notes/amiga: hardware

Log Message:
Note ACA500 support.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/distrib/notes/amiga/hardware

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

Modified files:

Index: src/distrib/notes/amiga/hardware
diff -u src/distrib/notes/amiga/hardware:1.55 src/distrib/notes/amiga/hardware:1.56
--- src/distrib/notes/amiga/hardware:1.55	Sun Aug 11 13:21:25 2013
+++ src/distrib/notes/amiga/hardware	Sun Dec 29 18:11:15 2013
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.55 2013/08/11 13:21:25 rkujawa Exp $
+.\"	$NetBSD: hardware,v 1.56 2013/12/29 18:11:15 rkujawa Exp $
 .
 .Nx \*V
 runs on any Amiga that has a 68020 or better CPU with
@@ -41,6 +41,8 @@ A4000/A1200 IDE controller, including AT
 .It
 ELBOX FastATA 1200 Mk-III/Mk-IV
 .It
+Individual Computers ACA500 (both CF slots) 
+.It
 Individual Computers X-Surf IDE
 .bullet)
 .It



CVS commit: src/sys/modules

2013-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec 29 16:32:32 UTC 2013

Modified Files:
src/sys/modules: Makefile

Log Message:
Re-sort in alphabetic sequence.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/modules/Makefile

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

Modified files:

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.131 src/sys/modules/Makefile:1.132
--- src/sys/modules/Makefile:1.131	Sun Dec 29 08:09:44 2013
+++ src/sys/modules/Makefile	Sun Dec 29 16:32:32 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.131 2013/12/29 08:09:44 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.132 2013/12/29 16:32:32 pgoyette Exp $
 
 .include 
 
@@ -9,15 +9,15 @@ SUBDIR+=	accf_httpready
 SUBDIR+=	adosfs
 SUBDIR+=	aio
 SUBDIR+=	bpf
-SUBDIR+=	cd9660
 SUBDIR+=	ccd
+SUBDIR+=	cd9660
 SUBDIR+=	cgd
+SUBDIR+=	chfs
 SUBDIR+=	coda
 SUBDIR+=	coda5
 SUBDIR+=	compat
 SUBDIR+=	compat_ossaudio
 SUBDIR+=	coredump
-SUBDIR+=	chfs
 SUBDIR+=	dbcool
 SUBDIR+=	dk_subr
 SUBDIR+=	efs



CVS commit: src/sys/arch/sparc64/sparc64

2013-12-29 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Sun Dec 29 12:36:30 UTC 2013

Modified Files:
src/sys/arch/sparc64/sparc64: locore.s

Log Message:
Make buildable w/o options SUN4V.


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/sys/arch/sparc64/sparc64/locore.s

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.351 src/sys/arch/sparc64/sparc64/locore.s:1.352
--- src/sys/arch/sparc64/sparc64/locore.s:1.351	Fri Dec 27 21:11:19 2013
+++ src/sys/arch/sparc64/sparc64/locore.s	Sun Dec 29 12:36:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.351 2013/12/27 21:11:19 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.352 2013/12/29 12:36:30 nakayama Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -4071,11 +4071,19 @@ ENTRY_NOPROFILE(cpu_initialize)	/* for c
 	mov	%l1, %l7			! save cpu_info pointer
 	ldx	[%l1 + CI_PADDR], %l1		! Load the interrupt stack's PA
 
+#ifdef SUN4V
 	cmp	%l6, CPU_SUN4V
-	be,pn	%icc, 3f
+	bne,pt	%icc, 3f
 	 nop
 
-	/* sun4u */	
+	/* sun4v */
+	call	_C_LABEL(pmap_setup_intstack_sun4v)	! Call nice C function for mapping INTSTACK
+	 mov	%l1, %o0
+	ba	4f
+	 nop
+3:
+#endif
+	/* sun4u */
 	sethi	%hi(0xa000), %l2		! V=1|SZ=01|NFO=0|IE=0
 	sllx	%l2, 32, %l2			! Shift it into place
 
@@ -4096,14 +4104,8 @@ ENTRY_NOPROFILE(cpu_initialize)	/* for c
 	stxa	%l0, [%l5] ASI_DMMU		! Make DMMU point to it
 	stxa	%l2, [%g0] ASI_DMMU_DATA_IN	! Store it
 	membar	#Sync
-	
-	ba	4f
-	 nop
-3:
-	/* sun4v */
-	call	_C_LABEL(pmap_setup_intstack_sun4v)	! Call nice C function for mapping INTSTACK
-	 mov	%l1, %o0
-4:		
+4:
+
 	!! Setup kernel stack (we rely on curlwp on this cpu
 	!! being lwp0 here and it's uarea is mapped special
 	!! and already accessible here)
@@ -4142,11 +4144,19 @@ ENTRY_NOPROFILE(cpu_initialize)	/* for c
 	 * install our TSB pointers
 	 */
 
+#ifdef SUN4V
 	cmp	%l6, CPU_SUN4V
-	be,pn	%icc, 5f
+	bne,pt	%icc, 5f
 	 nop
 
-	/* sun4u */	
+	/* sun4v */
+	call	_C_LABEL(pmap_setup_tsb_sun4v)
+	 nop
+	ba	1f
+	 nop
+5:
+#endif
+	/* sun4u */
 	sethi	%hi(_C_LABEL(tsbsize)), %l2
 	sethi	%hi(0x1fff), %l3
 	sethi	%hi(TSB), %l4
@@ -4167,14 +4177,7 @@ ENTRY_NOPROFILE(cpu_initialize)	/* for c
 	set	1f, %l1
 	flush	%l1
 1:
-	ba	6f
-	 nop
-
-5:	/* sun4v */
-	call	_C_LABEL(pmap_setup_tsb_sun4v)
-	 nop
 
-6:		
 	/* set trap table */
 	set	_C_LABEL(trapbase), %l1
 	call	_C_LABEL(prom_set_trap_table)	! Now we should be running 100% from our handlers



CVS commit: src/distrib/sets/lists/modules

2013-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec 29 08:10:14 UTC 2013

Modified Files:
src/distrib/sets/lists/modules: mi

Log Message:
Add new zlib module


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/distrib/sets/lists/modules/mi

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

Modified files:

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.63 src/distrib/sets/lists/modules/mi:1.64
--- src/distrib/sets/lists/modules/mi:1.63	Sat Dec 28 19:46:00 2013
+++ src/distrib/sets/lists/modules/mi	Sun Dec 29 08:10:14 2013
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.63 2013/12/28 19:46:00 pgoyette Exp $
+# $NetBSD: mi,v 1.64 2013/12/29 08:10:14 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -218,6 +218,8 @@
 ./@MODULEDIR@/vnd/vnd.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/zfsbase-kernel-modules kmod,zfs
 ./@MODULEDIR@/zfs/zfs.kmod			base-kernel-modules kmod,zfs
+./@MODULEDIR@/zlibbase-kernel-modules kmod
+./@MODULEDIR@/zlib/zlib.kmod			base-kernel-modules kmod
 ./etc/mtree/set.modulesmodules-sys-root	kmod
 ./stand/@MACHINE@base-kernel-modules	kmod
 ./stand/@MACHINE@/@OSRELEASE@			base-kernel-modules	kmod



CVS commit: src/sys

2013-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec 29 08:09:45 UTC 2013

Modified Files:
src/sys/dev: vnd.c
src/sys/modules: Makefile
src/sys/net: zlib.c
Added Files:
src/sys/modules/zlib: Makefile

Log Message:
Modularize net/zlib so it can be used by the vnd module (and, eventually,
by an opencrypto module).


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/dev/vnd.c
cvs rdiff -u -r1.130 -r1.131 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/zlib/Makefile
cvs rdiff -u -r1.33 -r1.34 src/sys/net/zlib.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/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.226 src/sys/dev/vnd.c:1.227
--- src/sys/dev/vnd.c:1.226	Sun Sep 15 16:05:51 2013
+++ src/sys/dev/vnd.c	Sun Dec 29 08:09:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.226 2013/09/15 16:05:51 martin Exp $	*/
+/*	$NetBSD: vnd.c,v 1.227 2013/12/29 08:09:44 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.226 2013/09/15 16:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.227 2013/12/29 08:09:44 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -2014,7 +2014,7 @@ vnd_set_geometry(struct vnd_softc *vnd)
 
 #include 
 
-MODULE(MODULE_CLASS_DRIVER, vnd, NULL);
+MODULE(MODULE_CLASS_DRIVER, vnd, "zlib");
 CFDRIVER_DECL(vnd, DV_DISK, NULL);
 
 static int

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.130 src/sys/modules/Makefile:1.131
--- src/sys/modules/Makefile:1.130	Sat Dec 28 19:45:13 2013
+++ src/sys/modules/Makefile	Sun Dec 29 08:09:44 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.130 2013/12/28 19:45:13 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.131 2013/12/29 08:09:44 pgoyette Exp $
 
 .include 
 
@@ -92,6 +92,7 @@ SUBDIR+=	usbverbose
 SUBDIR+=	vcoda
 SUBDIR+=	v7fs
 SUBDIR+=	vnd
+SUBDIR+=	zlib
 SUBDIR+=	tprof
 .if (defined(NOTYET))
 SUBDIR+=	unionfs

Index: src/sys/net/zlib.c
diff -u src/sys/net/zlib.c:1.33 src/sys/net/zlib.c:1.34
--- src/sys/net/zlib.c:1.33	Wed Mar 18 10:22:42 2009
+++ src/sys/net/zlib.c	Sun Dec 29 08:09:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $	*/
+/*	$NetBSD: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $	*/
 /*
  * This file is derived from various .h and .c files from the zlib-1.0.4
  * distribution by Jean-loup Gailly and Mark Adler, with some additions
@@ -11,7 +11,7 @@
  * - added inflateIncomp and deflateOutputPending
  * - allow strm->next_out to be NULL, meaning discard the output
  *
- * $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $
+ * $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $
  */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $");
 
 #define NO_DUMMY_DECL
 #define NO_ZCFUNCS
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.3
subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
+/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
 
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H
@@ -294,7 +294,7 @@ void   zcfree(voidpf opaque, voidpf ptr)
subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
+/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
 
 #ifndef _DEFLATE_H
 #define _DEFLATE_H
@@ -656,7 +656,7 @@ void _tr_stored_type_only(deflate_state 
  *
  */
 
-/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
+/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
 
 /* #include "deflate.h" */
 
@@ -1999,7 +1999,7 @@ local block_state deflate_slow(deflate_s
  *  Addison-Wesley, 1983. ISBN 0-201-06672-6.
  */
 
-/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
+/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
 
 /* #define GEN_TREES_H */
 
@@ -5813,7 +5813,7 @@ void  zcfree (opaque, ptr)
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
+/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
 
 /* #include "zlib.h" */
 
@@ -5855,3 +5855,31 @@ uLong ZEXPORT adler32(uLong adler, const
 }
 /* --- adler32.c */
 
+#if defined(_KERNEL)
+
+/*
+ * NetBSD module glue - this code is required for the vnd and swcrypto
+ * pseudo-devices.
+ */
+#include 
+
+static int zlib_modcmd(modcmd_t, void *);
+
+MODULE(MODULE_CLASS_MISC, zlib, NULL);
+ 
+static int
+zlib_modcmd(modcmd_t cmd, void *arg)
+{
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+	case MODULE_CMD_FINI:
+		return 0;
+	case MODULE_CMD_STAT:
+	case MODULE_CMD_