CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:27:30 UTC 2009

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixlvar.h

Log Message:
- add inline to simplify recognizing RMI Company ID
- add inlines to simplify use of RMI company specific flags in pridtab entry


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/mips/rmi/rmixlvar.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/arch/mips/rmi/rmixlvar.h
diff -u src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.5 src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.6
--- src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.5	Mon Nov  9 10:08:40 2009
+++ src/sys/arch/mips/rmi/rmixlvar.h	Fri Nov 13 05:27:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlvar.h,v 1.1.2.5 2009/11/09 10:08:40 cliff Exp $	*/
+/*	$NetBSD: rmixlvar.h,v 1.1.2.6 2009/11/13 05:27:30 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -35,9 +35,49 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _MIPS_RMI_RMIXLVAR_H_
+#define _MIPS_RMI_RMIXLVAR_H_
+
+#include 
 #include 
 #include 
 
+static inline bool
+cpu_rmixl(const struct pridtab *ct)
+{
+	if (ct->cpu_cid == MIPS_PRID_CID_RMI)
+		return true;
+	return false;
+}
+
+static inline bool
+cpu_rmixlr(const struct pridtab *ct)
+{
+	u_int type = ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
+	if (cpu_rmixl(ct) && type == CIDFL_RMI_TYPE_XLR)
+		return true;
+	return false;
+}
+
+static inline bool
+cpu_rmixls(const struct pridtab *ct)
+{
+	u_int type = ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
+	if (cpu_rmixl(ct) && type == CIDFL_RMI_TYPE_XLS)
+		return true;
+	return false;
+}
+
+static inline bool
+cpu_rmixlp(const struct pridtab *ct)
+{
+	u_int type = ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
+	if (cpu_rmixl(ct) && type == CIDFL_RMI_TYPE_XLP)
+		return true;
+	return false;
+}
+
+
 typedef enum {
 	RMIXL_INTR_EDGE=0,
 	RMIXL_INTR_LEVEL,
@@ -83,6 +123,7 @@
 extern void rmixl_addr_error_init(void);
 extern int  rmixl_addr_error_check(void);
 
-extern uint64_t rmixls_mfcr(u_int);
-extern void rmixls_mtcr(uint64_t, u_int);
+extern uint64_t rmixl_mfcr(u_int);
+extern void rmixl_mtcr(uint64_t, u_int);
 
+#endif	/* _MIPS_RMI_RMIXLVAR_H_ */



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:27:09 UTC 2009

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_intr.c

Log Message:
- KASSERT this interrupt code being used on XLS family CPU


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_intr.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/arch/mips/rmi/rmixl_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.4 src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.5
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.1.2.4	Mon Nov  9 10:03:04 2009
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Fri Nov 13 05:27:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.1.2.4 2009/11/09 10:03:04 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.1.2.5 2009/11/13 05:27:09 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_intr.c,v 1.1.2.4 2009/11/09 10:03:04 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_intr.c,v 1.1.2.5 2009/11/13 05:27:09 cliff Exp $");
 
 #include "opt_ddb.h"
 
@@ -78,7 +78,9 @@
 #include 
 #include 
 
+#include 
 #include 
+
 #include 
 #include 
 
@@ -314,6 +316,8 @@
 	uint32_t r;
 	int i;
 
+	KASSERT(cpu_rmixls(mycpu));
+
 #ifdef DIAGNOSTIC
 	if (evbmips_intr_init_done != 0)
 		panic("%s: evbmips_intr_init_done %d",



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:26:42 UTC 2009

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_comvar.h rmixl_obiovar.h

Log Message:
- define used to prevent recursive include gets renamed according to convention


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_comvar.h
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/rmi/rmixl_obiovar.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/arch/mips/rmi/rmixl_comvar.h
diff -u src/sys/arch/mips/rmi/rmixl_comvar.h:1.1.2.1 src/sys/arch/mips/rmi/rmixl_comvar.h:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_comvar.h:1.1.2.1	Sun Sep 13 03:27:38 2009
+++ src/sys/arch/mips/rmi/rmixl_comvar.h	Fri Nov 13 05:26:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_comvar.h,v 1.1.2.1 2009/09/13 03:27:38 cliff Exp $	*/
+/*	$NetBSD: rmixl_comvar.h,v 1.1.2.2 2009/11/13 05:26:42 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,8 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _MIPS_RMIXL_RMIXL_COMVAR_H_
-#define _MIPS_RMIXL_RMIXL_COMVAR_H_
+#ifndef _MIPS_RMI_RMIXL_COMVAR_H_
+#define _MIPS_RMI_RMIXL_COMVAR_H_
 
 #include 
 
@@ -42,4 +42,4 @@
 void rmixl_puthex32(uint32_t);		/* XXX DEBUG */
 void rmixl_puthex64(uint64_t);		/* XXX DEBUG */
 
-#endif /* _MIPS_RMIXL_RMIXL_COMVAR_H_ */
+#endif /* _MIPS_RMI_RMIXL_COMVAR_H_ */

Index: src/sys/arch/mips/rmi/rmixl_obiovar.h
diff -u src/sys/arch/mips/rmi/rmixl_obiovar.h:1.1.2.4 src/sys/arch/mips/rmi/rmixl_obiovar.h:1.1.2.5
--- src/sys/arch/mips/rmi/rmixl_obiovar.h:1.1.2.4	Mon Nov  9 10:05:50 2009
+++ src/sys/arch/mips/rmi/rmixl_obiovar.h	Fri Nov 13 05:26:42 2009
@@ -1,7 +1,7 @@
-/*	$NetBSD: rmixl_obiovar.h,v 1.1.2.4 2009/11/09 10:05:50 cliff Exp $	*/
+/*	$NetBSD: rmixl_obiovar.h,v 1.1.2.5 2009/11/13 05:26:42 cliff Exp $	*/
 
-#ifndef _MIPS_RMIXL_OBIOVAR_H_
-#define _MIPS_RMIXL_OBIOVAR_H_
+#ifndef _MIPS_RMI_RMIXL_OBIOVAR_H_
+#define _MIPS_RMI_RMIXL_OBIOVAR_H_
 
 #include 
 #include 
@@ -30,4 +30,4 @@
 	bus_size_t		sc_size;
 } obio_softc_t;
 
-#endif /* _MIPS_OMAP_RMIXL_OBIOVAR_H_ */
+#endif /* _MIPS_RMI_RMIXL_OBIOVAR_H_ */



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:25:50 UTC 2009

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c

Log Message:
- pridtab definition is removed to cpu.h
- pritab entries now initialize cpu_cp0flags and cpu_cidflags
except for RMI XLS entries, these are all 0 for now.
- pridtab entries for RMI XLS use those new fields and CPU_MIPS_HAVE_MxCR


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.16 -r1.205.4.1.2.1.2.17 \
src/sys/arch/mips/mips/mips_machdep.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/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.16 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.17
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.16	Tue Nov  3 16:30:58 2009
+++ src/sys/arch/mips/mips/mips_machdep.c	Fri Nov 13 05:25:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.16 2009/11/03 16:30:58 uebayasi Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.17 2009/11/13 05:25:49 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.16 2009/11/03 16:30:58 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.17 2009/11/13 05:25:49 cliff Exp $");
 
 #include "opt_cputype.h"
 #include "opt_compat_netbsd32.h"
@@ -153,6 +153,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -235,16 +236,6 @@
 char	machine_arch[] = MACHINE_ARCH;	/* from  */
 char	cpu_model[128];
 
-struct pridtab {
-	int	cpu_cid;
-	int	cpu_pid;
-	int	cpu_rev;	/* -1 == wildcard */
-	int	cpu_copts;	/* -1 == wildcard */
-	int	cpu_isa;	/* -1 == probed (mips32/mips64) */
-	int	cpu_ntlb;	/* -1 == unknown, 0 == probed */
-	int	cpu_flags;
-	const char	*cpu_name;
-};
 
 /*
  * Assumptions:
@@ -260,19 +251,19 @@
 #define	MIPS32_FLAGS	CPU_MIPS_R4K_MMU | CPU_MIPS_CAUSE_IV | CPU_MIPS_USE_WAIT
 #define	MIPS64_FLAGS	MIPS32_FLAGS	/* same as MIPS32 flags (for now) */
 
-static const struct pridtab *mycpu;
+const struct pridtab *mycpu;
 
 static const struct pridtab cputab[] = {
 	{ 0, MIPS_R2000, -1, -1,		CPU_ARCH_MIPS1, 64,
-	  CPU_MIPS_NO_LLSC,			"MIPS R2000 CPU"	},
+	  CPU_MIPS_NO_LLSC, 0, 0,		"MIPS R2000 CPU"	},
 	{ 0, MIPS_R3000, MIPS_REV_R2000A, -1,	CPU_ARCH_MIPS1, 64,
-	  CPU_MIPS_NO_LLSC,			"MIPS R2000A CPU"	},
+	  CPU_MIPS_NO_LLSC, 0, 0,		"MIPS R2000A CPU"	},
 	{ 0, MIPS_R3000, MIPS_REV_R3000, -1,	CPU_ARCH_MIPS1, 64,
-	  CPU_MIPS_NO_LLSC,			"MIPS R3000 CPU"	},
+	  CPU_MIPS_NO_LLSC, 0, 0,		"MIPS R3000 CPU"	},
 	{ 0, MIPS_R3000, MIPS_REV_R3000A, -1,	CPU_ARCH_MIPS1, 64,
-	  CPU_MIPS_NO_LLSC,			"MIPS R3000A CPU"	},
+	  CPU_MIPS_NO_LLSC, 0, 0,		"MIPS R3000A CPU"	},
 	{ 0, MIPS_R6000, -1, -1,		CPU_ARCH_MIPS2, 32,
-	  MIPS_NOT_SUPP,			"MIPS R6000 CPU"	},
+	  MIPS_NOT_SUPP, 0, 0,			"MIPS R6000 CPU"	},
 
 	/*
 	 * rev 0x00, 0x22 and 0x30 are R4000, 0x40, 0x50 and 0x60 are R4400.
@@ -280,52 +271,55 @@
 	 * 0x40 - 0xff for R4400?
 	 */
 	{ 0, MIPS_R4000, MIPS_REV_R4000_A, -1,	CPU_ARCH_MIPS3, 48,
-	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT,
+	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0,
 		"MIPS R4000 CPU"	},
 	{ 0, MIPS_R4000, MIPS_REV_R4000_B, -1,	CPU_ARCH_MIPS3, 48,
-	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT,
+	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0,
 		"MIPS R4000 CPU"	},
 	{ 0, MIPS_R4000, MIPS_REV_R4000_C, -1,	CPU_ARCH_MIPS3, 48,
-	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT,
+	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0,
 		"MIPS R4000 CPU"	},
 	{ 0, MIPS_R4000, MIPS_REV_R4400_A, -1,	CPU_ARCH_MIPS3, 48,
-	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT,
+	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0,
 		"MIPS R4400 CPU"	},
 	{ 0, MIPS_R4000, MIPS_REV_R4400_B, -1,	CPU_ARCH_MIPS3, 48,
-	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT,
+	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0,
 		"MIPS R4400 CPU"	},
 	{ 0, MIPS_R4000, MIPS_REV_R4400_C, -1,	CPU_ARCH_MIPS3, 48,
-	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT,
+	  CPU_MIPS_R4K_MMU | CPU_MIPS_DOUBLE_COUNT, 0, 0,
 		"MIPS R4400 CPU"	},
 
 	{ 0, MIPS_R3LSI, -1, -1,		CPU_ARCH_MIPS1, -1,
-	  MIPS_NOT_SUPP,			"LSI Logic R3000 derivative" },
+	  MIPS_NOT_SUPP, 0, 0,			"LSI Logic R3000 derivative" },
 	{ 0, MIPS_R6000A, -1, -1,		CPU_ARCH_MIPS2, 32,
-	  MIPS_NOT_SUPP,			"MIPS R6000A CPU"	},
+	  MIPS_NOT_SUPP, 0, 0,			"MIPS R6000A CPU"	},
 	{ 0, MIPS_R3IDT, -1, -1,		CPU_ARCH_MIPS1, -1,
-	  MIPS_NOT_SUPP,			"IDT R3041 or RC36100 CPU" },
+	  MIPS_NOT_SUPP, 0, 0,			"IDT R3041 or RC36100 CPU" },
 	{ 0, MIPS_R4100, -1, -1,		CPU_ARCH_MIPS3, 32,
-	  CPU_MIPS_R4K_MMU | CPU_MIPS_NO_LLSC,	"NEC VR4100 CPU"	},
+	  CPU_MIPS_R4K_MMU | CPU_MIPS_NO_LLSC, 0, 0,
+		"NEC VR4100 CPU"	},
 	{ 0, MIPS_R4200, -1, -1,		CPU_ARCH_MIPS3

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:25:16 UTC 2009

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: mipsX_subr.S

Log Message:
- KSEG and XK labels, useful for address representation in ddb,
moved here from RMI specific code
- replace .word XXX with proper mnemonics for mfcr ops in cacheException
now that binutils knows these ops


To generate a diff of this commit:
cvs rdiff -u -r1.26.36.1.2.10 -r1.26.36.1.2.11 \
src/sys/arch/mips/mips/mipsX_subr.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/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.10 src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.11
--- src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.10	Mon Nov  9 10:01:14 2009
+++ src/sys/arch/mips/mips/mipsX_subr.S	Fri Nov 13 05:25:15 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.10 2009/11/09 10:01:14 cliff Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.11 2009/11/13 05:25:15 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -301,6 +301,27 @@
 
 
 /*
+ * some useful labels for debugging
+ */
+.global	mips_kseg0
+.equiv	mips_kseg0,		MIPS_KSEG0_START
+.global	mips_kseg1
+.equiv	mips_kseg1,		MIPS_KSEG1_START
+.global	mips_kseg2
+.equiv	mips_kseg2,		MIPS_KSEG2_START
+.global	mips_xkphys
+.equiv	mips_xkphys,		MIPS_XKPHYS_START
+.global	mips_xkphys_u
+.equiv	mips_xkphys_u,		MIPS_XKPHYS_UNCACHED
+.global	mips_xkphys_cca3
+.equiv	mips_xkphys_cca3,	MIPS_XKPHYS_CCA3
+.global	mips_xkphys_cca4
+.equiv	mips_xkphys_cca4,	MIPS_XKPHYS_CCA4
+.global	mips_xkseg
+.equiv	mips_xkseg,		MIPS_XKSEG_START
+
+
+/*
  *
  *
  * mips3_TLBMiss --
@@ -1055,9 +1076,9 @@
 	_MFC0	a1, MIPS_COP_0_ERROR_PC
 #if defined(MIPS64_XLS)
 	li	k1, 0x309	/* L1D_CACHE_ERROR_LOG */
-	.word	0x73660018	/* mfcr	a2, k1 */
+	mfcr	a2, k1
 	li	k1, 0x30b	/* L1D_CACHE_INTERRUPT */
-	.word	0x73670018	/* mfcr	a3, k1 */
+	mfcr	a3, k1
 	mfc0	a4, MIPS_COP_0_STATUS
 	mfc0	a5, MIPS_COP_0_CAUSE
 #else



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:24:43 UTC 2009

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: db_interface.c

Log Message:
- in SHOW64 macro remove extraneous 'x' in printf format
- in MIPS64_SHOW32 macro add push and pop directives
- use mycpu->cpu_cp0flags to determine whether various CP0 regs exist
- use CPU_MIPS_HAVE_MxCR to determine whether mfcr, mtcr insns are available
- use asm() to inline mfcr, mtcr ops instead of calling
MIPS-implementation-specific subroutines


To generate a diff of this commit:
cvs rdiff -u -r1.64.16.7 -r1.64.16.8 src/sys/arch/mips/mips/db_interface.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/arch/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.64.16.7 src/sys/arch/mips/mips/db_interface.c:1.64.16.8
--- src/sys/arch/mips/mips/db_interface.c:1.64.16.7	Mon Nov  9 10:00:02 2009
+++ src/sys/arch/mips/mips/db_interface.c	Fri Nov 13 05:24:43 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.64.16.7 2009/11/09 10:00:02 cliff Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.64.16.8 2009/11/13 05:24:43 cliff Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64.16.7 2009/11/09 10:00:02 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64.16.8 2009/11/13 05:24:43 cliff Exp $");
 
 #include "opt_cputype.h"	/* which mips CPUs do we support? */
 #include "opt_ddb.h"
@@ -433,7 +433,7 @@
 		"dsrl %M0,$1,32			\n\t"			\
 		".set pop"		\
 	: "=r"(__val));		\
-	printf("  %s:%*s %#"PRIx64"x\n", name, FLDWIDTH - (int) strlen(name), \
+	printf("  %s:%*s %#"PRIx64"\n", name, FLDWIDTH - (int) strlen(name), \
 	"", __val);			\
 } while (0)
 
@@ -442,8 +442,10 @@
 	uint32_t __val;			\
 	\
 	__asm volatile(			\
+		".set push			\n\t"			\
 		".set mips64			\n\t"			\
 		"mfc0 %0,$" ___STRING(num) "," ___STRING(sel) "\n\t"	\
+		".set pop			\n\t"			\
 	: "=r"(__val));		\
 	printf("  %s:%*s %#x\n", name, FLDWIDTH - (int) strlen(name),	\
 	"", __val);			\
@@ -464,7 +466,7 @@
 		"dsrl %M0,$1,32			\n\t"			\
 		".set pop"		\
 	: "=r"(__val));		\
-	printf("  %s:%*s %#"PRIx64"x\n", name, FLDWIDTH - (int) strlen(name), \
+	printf("  %s:%*s %#"PRIx64"\n", name, FLDWIDTH - (int) strlen(name), \
 	"", __val);			\
 } while (0)
 
@@ -472,25 +474,7 @@
 db_cp0dump_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
 	   const char *modif)
 {
-	int is_rmi_xls=0;
-
-	/* XXX FIXME what class define to use here ? */
-	switch (MIPS_PRID_IMPL(cpu_id)) {
-	case MIPS_XLS104:
-	case MIPS_XLS108:
-	case MIPS_XLS204:
-	case MIPS_XLS208:
-	case MIPS_XLS404LITE:
-	case MIPS_XLS408LITE:
-	case MIPS_XLS404:
-	case MIPS_XLS408:
-	case MIPS_XLS416:
-	case MIPS_XLS608:
-	case MIPS_XLS616:
-		is_rmi_xls = 1;
-		break;
-	}
-
+	u_int cp0flags = mycpu->cpu_cp0flags;
 
 	SHOW32(MIPS_COP_0_TLB_INDEX, "index");
 	SHOW32(MIPS_COP_0_TLB_RANDOM, "random");
@@ -528,11 +512,10 @@
 		SHOW32(MIPS_COP_0_COUNT, "count");
 	}
 
-	/* XXX FIXME what class define to use here ? */
-	if (is_rmi_xls) {
+	if ((cp0flags & MIPS_CP0FL_EIRR) != 0)
 		MIPS64_SHOW64(9, 6, "eirr");
+	if ((cp0flags & MIPS_CP0FL_EIMR) != 0)
 		MIPS64_SHOW64(9, 7, "eimr");
-	}
 
 	if (CPUIS64BITS) {
 		SHOW64(MIPS_COP_0_TLB_HI, "entryhi");
@@ -555,12 +538,27 @@
 
 	SHOW32(MIPS_COP_0_PRID, "prid");
 
-	/* XXX FIXME what class define to use here ? */
-	if (is_rmi_xls) {
-		MIPS64_SHOW32(15, 1, "ebase");
-		MIPS64_SHOW32(16, 0, "config0");
-		MIPS64_SHOW32(16, 1, "config1");
-		MIPS64_SHOW32(16, 7, "config7");
+	if ((cp0flags & MIPS_CP0FL_USE) != 0) {
+		if ((cp0flags & MIPS_CP0FL_EBASE) != 0)
+			MIPS64_SHOW32(15, 1, "ebase");
+		if ((cp0flags & MIPS_CP0FL_CONFIG) != 0)
+			SHOW32(MIPS_COP_0_CONFIG, "config");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(0)) != 0)
+			MIPS64_SHOW32(16, 0, "config0");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(1)) != 0)
+			MIPS64_SHOW32(16, 1, "config1");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(2)) != 0)
+			MIPS64_SHOW32(16, 2, "config2");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(3)) != 0)
+			MIPS64_SHOW32(16, 3, "config3");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(4)) != 0)
+			MIPS64_SHOW32(16, 4, "config4");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(5)) != 0)
+			MIPS64_SHOW32(16, 5, "config5");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(6)) != 0)
+			MIPS64_SHOW32(16, 6, "config6");
+		if ((cp0flags & MIPS_CP0FL_CONFIGn(7)) != 0)
+			MIPS64_SHOW32(16, 7, "config7");
 	} else {
 		SHOW32(MIPS_COP_0_CONFIG, "config");
 #if defined(MIPS32) || defined(MIPS64)
@@ -598,11 +596,13 @@
 			}
 		}
 
-		/* CP0 ECC and CACHE_ERR "not implemented" on XLS */
-		if (!is_rmi_xls) {
+		if (((cp0flags & MIPS_CP0FL_USE) == 0) ||
+		((cp0flags & MIPS_CP0FL_ECC) != 0))
 			SHOW32(MIPS_COP_0_ECC, "ecc");
+
+		if (((cp0flags & MIPS_CP0FL_USE) == 0) ||
+		

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:23:23 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpuregs.h

Log Message:
- move #ifndef LOCORE up a few lines to wrap more XSEG, XKSEG stuff


To generate a diff of this commit:
cvs rdiff -u -r1.74.28.10 -r1.74.28.11 src/sys/arch/mips/include/cpuregs.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/arch/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.74.28.10 src/sys/arch/mips/include/cpuregs.h:1.74.28.11
--- src/sys/arch/mips/include/cpuregs.h:1.74.28.10	Mon Nov  9 09:57:27 2009
+++ src/sys/arch/mips/include/cpuregs.h	Fri Nov 13 05:23:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuregs.h,v 1.74.28.10 2009/11/09 09:57:27 cliff Exp $	*/
+/*	$NetBSD: cpuregs.h,v 1.74.28.11 2009/11/13 05:23:23 cliff Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -111,11 +111,11 @@
 #define	MIPS3_VA_TO_CINDEX(x) \
 		(((intptr_t)(x) & 0xff) | MIPS_KSEG0_START) 
 
+#ifndef _LOCORE
 #define	MIPS_XSEG_MASK		(0x3fffLL)
 #define	MIPS_XKSEG_START	(0x3ULL << 62)
 #define	MIPS_XKSEG_P(x)		(((uint64_t)(x) >> 62) == 3)
 
-#ifndef _LOCORE
 #define	MIPS_XKPHYS_START	(0x2ULL << 62)
 #define	MIPS_PHYS_TO_XKPHYS_UNCACHED(x) \
 	(MIPS_XKPHYS_START | ((uint64_t)(CCA_UNCACHED) << 59) | (x))



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/include

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:22:50 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h

Log Message:
- struct pridtab definition is moved here from mips_machdep.c
- 'mycpu' is now global (was static); uh, a name change might be nice?
- new bit for cpu_flags 'CPU_MIPS_HAVE_MxCR' denotes
mfcr, mtcr instructions are available on this CPU
- new field 'cpu_cp0flags' in pridtab tracks whether (some) CP0 regs exist
- define bits in cpu_cp0flags, including a "USE" bit that,
if clear means cpu_cp0flags can be ignored. common CP0 regs do not
need to be represented here, only newer optional ones are.
- new field 'cpu_cidflags' in pridtab allows defining company-specific flags
- some RMI company specific flags are defined to track chip family


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.4 -r1.90.16.5 src/sys/arch/mips/include/cpu.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/arch/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.4 src/sys/arch/mips/include/cpu.h:1.90.16.5
--- src/sys/arch/mips/include/cpu.h:1.90.16.4	Tue Sep 15 06:10:14 2009
+++ src/sys/arch/mips/include/cpu.h	Fri Nov 13 05:22:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.90.16.4 2009/09/15 06:10:14 matt Exp $	*/
+/*	$NetBSD: cpu.h,v 1.90.16.5 2009/11/13 05:22:50 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -51,6 +51,45 @@
 #include "opt_lockdebug.h"
 #endif
 
+struct pridtab {
+	int	cpu_cid;
+	int	cpu_pid;
+	int	cpu_rev;	/* -1 == wildcard */
+	int	cpu_copts;	/* -1 == wildcard */
+	int	cpu_isa;	/* -1 == probed (mips32/mips64) */
+	int	cpu_ntlb;	/* -1 == unknown, 0 == probed */
+	int	cpu_flags;
+	u_int	cpu_cp0flags;	/* presence of some cp0 regs */
+	u_int	cpu_cidflags;	/* company-specific flags */
+	const char	*cpu_name;
+};
+
+extern const struct pridtab *mycpu;
+
+/*
+ * bitfield defines for cpu_cp0flags
+ */
+#define  MIPS_CP0FL_USE		__BIT(0)	/* use these flags */
+#define  MIPS_CP0FL_ECC		__BIT(1)
+#define  MIPS_CP0FL_CACHE_ERR	__BIT(2)
+#define  MIPS_CP0FL_EIRR	__BIT(3)
+#define  MIPS_CP0FL_EIMR	__BIT(4)
+#define  MIPS_CP0FL_EBASE	__BIT(5)
+#define  MIPS_CP0FL_CONFIG	__BIT(6)
+#define  MIPS_CP0FL_CONFIGn(n)	(__BIT(7) << ((n) & 7))
+
+/*
+ * cpu_cidflags defines, by company
+ */
+/*
+ * RMI company-specific cpu_cidflags
+ */
+#define MIPS_CIDFL_RMI_TYPE __BITS(0,2)
+#define  CIDFL_RMI_TYPE_XLR 0
+#define  CIDFL_RMI_TYPE_XLS 1
+#define  CIDFL_RMI_TYPE_XLP 2
+
+
 struct cpu_info {
 	struct cpu_data ci_data;	/* MI per-cpu data */
 	struct cpu_info *ci_next;	/* Next CPU in list */
@@ -174,6 +213,7 @@
 #define	CPU_MIPS_D_CACHE_COHERENT	0x0400	/* D-cache is fully coherent */
 #define	CPU_MIPS_I_D_CACHE_COHERENT	0x0800	/* I-cache funcs don't need to flush the D-cache */
 #define	CPU_MIPS_NO_LLADDR		0x1000
+#define	CPU_MIPS_HAVE_MxCR		0x2000	/* have mfcr, mtcr insns */
 #define	MIPS_NOT_SUPP			0x8000
 
 #endif	/* !_LOCORE */



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:22:19 UTC 2009

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_pcie.c
Added Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_subr.S
Removed Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixls_subr.S

Log Message:
- rmixls_subr.S is replaced by rmixl_subr.S
- those subroutine names changed accordingly


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/rmi/rmixl_pcie.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_subr.S
cvs rdiff -u -r1.1.2.1 -r0 src/sys/arch/mips/rmi/rmixls_subr.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/mips/rmi/rmixl_pcie.c
diff -u src/sys/arch/mips/rmi/rmixl_pcie.c:1.1.2.1 src/sys/arch/mips/rmi/rmixl_pcie.c:1.1.2.2
--- src/sys/arch/mips/rmi/rmixl_pcie.c:1.1.2.1	Mon Nov  9 10:17:06 2009
+++ src/sys/arch/mips/rmi/rmixl_pcie.c	Fri Nov 13 05:22:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcie.c,v 1.1.2.1 2009/11/09 10:17:06 cliff Exp $	*/
+/*	$NetBSD: rmixl_pcie.c,v 1.1.2.2 2009/11/13 05:22:19 cliff Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_pcie.c,v 1.1.2.1 2009/11/09 10:17:06 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_pcie.c,v 1.1.2.2 2009/11/13 05:22:19 cliff Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -224,9 +224,9 @@
 {
 	uint64_t r;
 
-	r = rmixls_mfcr(RMIXL_PCR_L1D_CONFIG0);
-	rmixls_mtcr(RMIXL_PCR_L1D_CONFIG0, r & ~0x2e);
-	rmixls_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
+	r = rmixl_mfcr(RMIXL_PCR_L1D_CONFIG0);
+	rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r & ~0x2e);
+	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
 	return r;
 }
 
@@ -239,16 +239,16 @@
 static inline void
 rmixl_cache_err_restore(uint64_t r)
 {
-	rmixls_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
-	rmixls_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_OVF_LO, 0);
-	rmixls_mtcr(RMIXL_PCR_L1D_CACHE_INTERRUPT, 0);
-	rmixls_mtcr(RMIXL_PCR_L1D_CONFIG0, r);
+	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
+	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_OVF_LO, 0);
+	rmixl_mtcr(RMIXL_PCR_L1D_CACHE_INTERRUPT, 0);
+	rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r);
 }
 
 static inline uint64_t
 rmixl_cache_err_check(void)
 {
-	return rmixls_mfcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG);
+	return rmixl_mfcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG);
 }
 
 static int  

Added files:

Index: src/sys/arch/mips/rmi/rmixl_subr.S
diff -u /dev/null src/sys/arch/mips/rmi/rmixl_subr.S:1.1.2.1
--- /dev/null	Fri Nov 13 05:22:19 2009
+++ src/sys/arch/mips/rmi/rmixl_subr.S	Fri Nov 13 05:22:19 2009
@@ -0,0 +1,35 @@
+/*	$NetBSD: rmixl_subr.S,v 1.1.2.1 2009/11/13 05:22:19 cliff Exp $	*/
+
+#include "opt_cputype.h"
+
+#include 
+
+#include 
+#include 
+
+	.set	push
+.setnoreorder
+.setmips64
+.text
+
+/*
+ * read XLS Processor Control register
+ *
+ * uint64_t rmixl_mfcr(u_int cr);
+ */
+LEAF(rmixl_mfcr)
+	j	ra
+	mfcr	v0, a0
+END(rmixl_mfcr)
+
+/*
+ * write XLS Processor Control register
+ *
+ * void rmixl_mtcr(u_int cr, uint64_t val);
+ */
+LEAF(rmixl_mtcr)
+	j	ra
+	mtcr	a1, a0
+END(rmixl_mtcr)
+
+	.set	pop



CVS commit: [matt-nb5-mips64] src/sys/arch/evbmips/conf

2009-11-12 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Fri Nov 13 05:19:22 UTC 2009

Modified Files:
src/sys/arch/evbmips/conf [matt-nb5-mips64]: XLS6ATX_7A

Log Message:
- (re-) configure ksyms
- SYMTAB_SPACE can now shrink by almost 10x now that local symbols
are properly stripped  (!)


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/evbmips/conf/XLS6ATX_7A

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/evbmips/conf/XLS6ATX_7A
diff -u src/sys/arch/evbmips/conf/XLS6ATX_7A:1.1.2.3 src/sys/arch/evbmips/conf/XLS6ATX_7A:1.1.2.4
--- src/sys/arch/evbmips/conf/XLS6ATX_7A:1.1.2.3	Mon Nov  9 09:42:33 2009
+++ src/sys/arch/evbmips/conf/XLS6ATX_7A	Fri Nov 13 05:19:22 2009
@@ -1,11 +1,11 @@
 #
-#	$NetBSD: XLS6ATX_7A,v 1.1.2.3 2009/11/09 09:42:33 cliff Exp $
+#	$NetBSD: XLS6ATX_7A,v 1.1.2.4 2009/11/13 05:19:22 cliff Exp $
 
 include 	"arch/evbmips/conf/std.rmixl"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"XLS6ATX_7A-$Revision: 1.1.2.3 $"
+#ident 		"XLS6ATX_7A-$Revision: 1.1.2.4 $"
 
 maxusers	32
 
@@ -43,7 +43,7 @@
 options 	DDB		# kernel dynamic debugger
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG="-g"	# compile full symbol table
-##options 	SYMTAB_SPACE=0x50	# size for embedded symbol table
+options 	SYMTAB_SPACE=0x6	# size for embedded symbol table
 #options	DDB_COMMANDONENTER="trace;show registers"
 options		DB_MAX_LINE=-1
 
@@ -188,7 +188,7 @@
 #pseudo-device	sequencer	1		# MIDI sequencer
 pseudo-device	rnd# /dev/random & kernel generator
 pseudo-device	clockctl			# user control of clock subsystem
-##pseudo-device	ksyms# /dev/ksyms
+pseudo-device	ksyms# /dev/ksyms
 
 # A pseudo device needed for Coda		# also needs CODA (above)
 #pseudo-device	vcoda		4		# coda minicache <-> venus comm.



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Nov 13 02:04:49 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: ehci.c

Log Message:
Reduce the diff a little.


To generate a diff of this commit:
cvs rdiff -u -r1.123.12.5 -r1.123.12.6 src/sys/dev/usb/ehci.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/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.123.12.5 src/sys/dev/usb/ehci.c:1.123.12.6
--- src/sys/dev/usb/ehci.c:1.123.12.5	Thu Nov 12 09:04:11 2009
+++ src/sys/dev/usb/ehci.c	Fri Nov 13 02:04:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.123.12.5 2009/11/12 09:04:11 uebayasi Exp $ */
+/*	$NetBSD: ehci.c,v 1.123.12.6 2009/11/13 02:04:49 uebayasi Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005, 2007 The NetBSD Foundation, Inc.
@@ -40,9 +40,9 @@
  * USB Enhanced Host Controller Driver, a.k.a. USB 2.0 controller.
  *
  * The EHCI 1.0 spec can be found at
- * http://developer.intel.com/technology/usb/download/ehci-r10.pdf
+ * http://www.intel.com/technology/usb/spec.htm
  * and the USB 2.0 spec at
- * http://www.usb.org/developers/docs/usb_20.zip
+ * http://www.usb.org/developers/docs/
  *
  */
 
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.123.12.5 2009/11/12 09:04:11 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.123.12.6 2009/11/13 02:04:49 uebayasi Exp $");
 /* __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/ehci.c,v 1.52 2006/10/19 01:15:58 iedowse Exp $"); */
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -145,7 +145,10 @@
 			u_int length;
 		} bulk;
 		/* Iso pipe */
-		/* XXX */
+		struct {
+			u_int next_frame;
+			u_int cur_xfers;
+		} isoc;
 	} u;
 };
 



CVS commit: src/sys/dev/pcmcia

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Nov 13 01:14:35 UTC 2009

Modified Files:
src/sys/dev/pcmcia: if_xi.c mhzc.c xirc.c

Log Message:
Don't use com_activate(), it's gone away.  Thanks to Andreas Wrede
for pointing out that these drivers still used com_activate().

Use device_private().  Join some lines.

Remove superfluous activation hooks.

Add child-detachment hooks (not used, yet).

TBD: device_t/softc split.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pcmcia/if_xi.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pcmcia/mhzc.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pcmcia/xirc.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/pcmcia/if_xi.c
diff -u src/sys/dev/pcmcia/if_xi.c:1.67 src/sys/dev/pcmcia/if_xi.c:1.68
--- src/sys/dev/pcmcia/if_xi.c:1.67	Tue May 12 14:42:18 2009
+++ src/sys/dev/pcmcia/if_xi.c	Fri Nov 13 01:14:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xi.c,v 1.67 2009/05/12 14:42:18 cegger Exp $ */
+/*	$NetBSD: if_xi.c,v 1.68 2009/11/13 01:14:35 dyoung Exp $ */
 /*	OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp 	*/
 
 /*
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.67 2009/05/12 14:42:18 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.68 2009/11/13 01:14:35 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipx.h"
@@ -259,7 +259,7 @@
 int
 xi_detach(device_t self, int flags)
 {
-	struct xi_softc *sc = (void *)self;
+	struct xi_softc *sc = device_private(self);
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 
 	DPRINTF(XID_CONFIG, ("xi_detach()\n"));
@@ -279,28 +279,6 @@
 }
 
 int
-xi_activate(device_t self, enum devact act)
-{
-	struct xi_softc *sc = (void *)self;
-	int s, rv = 0;
-
-	DPRINTF(XID_CONFIG, ("xi_activate()\n"));
-
-	s = splnet();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		if_deactivate(&sc->sc_ethercom.ec_if);
-		break;
-	}
-	splx(s);
-	return (rv);
-}
-
-int
 xi_intr(void *arg)
 {
 	struct xi_softc *sc = arg;
@@ -597,7 +575,7 @@
 STATIC int
 xi_mdi_read(device_t self, int phy, int reg)
 {
-	struct xi_softc *sc = (struct xi_softc *)self;
+	struct xi_softc *sc = device_private(self);
 	int i;
 	u_int32_t mask;
 	u_int32_t data = 0;
@@ -627,7 +605,7 @@
 STATIC void
 xi_mdi_write(device_t self, int phy, int reg, int value)
 {
-	struct xi_softc *sc = (struct xi_softc *)self;
+	struct xi_softc *sc = device_private(self);
 	int i;
 
 	PAGE(sc, 2);

Index: src/sys/dev/pcmcia/mhzc.c
diff -u src/sys/dev/pcmcia/mhzc.c:1.46 src/sys/dev/pcmcia/mhzc.c:1.47
--- src/sys/dev/pcmcia/mhzc.c:1.46	Tue May 12 14:42:19 2009
+++ src/sys/dev/pcmcia/mhzc.c	Fri Nov 13 01:14:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mhzc.c,v 1.46 2009/05/12 14:42:19 cegger Exp $	*/
+/*	$NetBSD: mhzc.c,v 1.47 2009/11/13 01:14:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.46 2009/05/12 14:42:19 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mhzc.c,v 1.47 2009/11/13 01:14:35 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "bpfilter.h"
@@ -129,11 +129,11 @@
 
 int	mhzc_match(device_t, cfdata_t, void *);
 void	mhzc_attach(device_t, device_t, void *);
+void	mhzc_childdet(device_t, device_t);
 int	mhzc_detach(device_t, int);
-int	mhzc_activate(device_t, enum devact);
 
 CFATTACH_DECL(mhzc, sizeof(struct mhzc_softc),
-mhzc_match, mhzc_attach, mhzc_detach, mhzc_activate);
+mhzc_match, mhzc_attach, mhzc_detach, NULL);
 
 int	mhzc_em3336_enaddr(struct mhzc_softc *, u_int8_t *);
 int	mhzc_em3336_enable(struct mhzc_softc *);
@@ -165,8 +165,7 @@
 int	mhzc_intr(void *);
 
 int
-mhzc_match(device_t parent, cfdata_t match,
-void *aux)
+mhzc_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pcmcia_attach_args *pa = aux;
 
@@ -179,7 +178,7 @@
 void
 mhzc_attach(device_t parent, device_t self, void *aux)
 {
-	struct mhzc_softc *sc = (void *)self;
+	struct mhzc_softc *sc = device_private(self);
 	struct pcmcia_attach_args *pa = aux;
 	struct pcmcia_config_entry *cfe;
 	int error;
@@ -323,24 +322,31 @@
 	return (UNCONF);
 }
 
+void
+mhzc_childdet(device_t self, device_t child)
+{
+	struct mhzc_softc *sc = device_private(self);
+
+	if (sc->sc_ethernet == child)
+		sc->sc_ethernet = NULL;
+	if (sc->sc_modem == child)
+		sc->sc_modem = NULL;
+}
+
 int
 mhzc_detach(device_t self, int flags)
 {
-	struct mhzc_softc *sc = (void *)self;
+	struct mhzc_softc *sc = device_private(self);
 	int rv;
 
 	if (sc->sc_ethernet != NULL) {
-		rv = config_detach(sc->sc_ethernet, flags);
-		if (rv != 0)
-			return (rv);
-		sc->sc_ethernet = NULL;
+		if ((rv = config_detach(sc->sc_ethernet, flags)) != 0)
+			return rv;
 	}
 
 	if (sc->sc_modem != NULL) {
-		rv = config_detach(sc->sc_modem, flags);
-		if (rv != 0)
-			return (rv);
-		sc->sc_modem = NULL;
+		if ((rv = conf

CVS commit: src/sys/kern

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 23:16:28 UTC 2009

Modified Files:
src/sys/kern: subr_autoconf.c

Log Message:
Use TAILQ_FOREACH() instead of open-coding it.

I applied this patch with Coccinelle's semantic patch tool, spatch(1).
I installed Coccinelle from pkgsrc: devel/coccinelle/.  I wrote
tailq.spatch and kdefs.h (see below) and ran this command,

spatch -debug -macro_file_builtins ./kdefs.h -outplace \
-sp_file sys/kern/tailq.spatch sys/kern/subr_autoconf.c

which wrote the transformed source file to /tmp/subr_autoconf.c.  Then I
used indent(1) to fix the indentation.


::: tailq.spatch :::


@@
identifier I, N;
expression H;
statement S;
iterator name TAILQ_FOREACH;
@@

- for (I = TAILQ_FIRST(H); I != NULL; I = TAILQ_NEXT(I, N)) S
+ TAILQ_FOREACH(I, H, N) S

:::
::: kdefs.h :::
:::

#define MAXUSERS 64
#define _KERNEL
#define _KERNEL_OPT
#define i386

/*
 * Tail queue definitions.
 */
#define _TAILQ_HEAD(name, type, qual)   \
struct name {   \
qual type *tqh_first;   /* first element */ \
qual type *qual *tqh_last;  /* addr of last next element */ \
}
#define TAILQ_HEAD(name, type)  _TAILQ_HEAD(name, struct type,)

#define TAILQ_HEAD_INITIALIZER(head)\
{ NULL, &(head).tqh_first }

#define _TAILQ_ENTRY(type, qual)\
struct {\
qual type *tqe_next;/* next element */  \
qual type *qual *tqe_prev;  /* address of previous next element */\
}
#define TAILQ_ENTRY(type)   _TAILQ_ENTRY(struct type,)

#define PMF_FN_PROTO1   pmf_qual_t
#define PMF_FN_ARGS1pmf_qual_t qual
#define PMF_FN_CALL1qual

#define PMF_FN_PROTO, pmf_qual_t
#define PMF_FN_ARGS , pmf_qual_t qual
#define PMF_FN_CALL , qual

#define __KERNEL_RCSID(a, b)


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/kern/subr_autoconf.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/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.187 src/sys/kern/subr_autoconf.c:1.188
--- src/sys/kern/subr_autoconf.c:1.187	Thu Nov 12 19:10:30 2009
+++ src/sys/kern/subr_autoconf.c	Thu Nov 12 23:16:28 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.187 2009/11/12 19:10:30 dyoung Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.188 2009/11/12 23:16:28 dyoung Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.187 2009/11/12 19:10:30 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.188 2009/11/12 23:16:28 dyoung Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1629,8 +1629,7 @@
 		panic("config_defer: can't defer config of a root device");
 
 #ifdef DIAGNOSTIC
-	for (dc = TAILQ_FIRST(&deferred_config_queue); dc != NULL;
-	 dc = TAILQ_NEXT(dc, dc_queue)) {
+	TAILQ_FOREACH(dc, &deferred_config_queue, dc_queue) {
 		if (dc->dc_dev == dev)
 			panic("config_defer: deferred twice");
 	}
@@ -1664,8 +1663,7 @@
 	}
 
 #ifdef DIAGNOSTIC
-	for (dc = TAILQ_FIRST(&interrupt_config_queue); dc != NULL;
-	 dc = TAILQ_NEXT(dc, dc_queue)) {
+	TAILQ_FOREACH(dc, &interrupt_config_queue, dc_queue) {
 		if (dc->dc_dev == dev)
 			panic("config_interrupts: deferred twice");
 	}



CVS commit: src/sys/dev/pcmcia

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 22:46:47 UTC 2009

Modified Files:
src/sys/dev/pcmcia: pcmcom.c

Log Message:
Don't use com_activate(), it's gone away.  Delete superfluous
activation hook, pcmcom_activate().

Add a child-detachment hook and use it.

Use device_private().

Cosmetic: use __arraycount().  Join a couple of lines.  Delete a
set of superfluous parentheses.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pcmcia/pcmcom.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/pcmcia/pcmcom.c
diff -u src/sys/dev/pcmcia/pcmcom.c:1.37 src/sys/dev/pcmcia/pcmcom.c:1.38
--- src/sys/dev/pcmcia/pcmcom.c:1.37	Tue May 12 14:42:19 2009
+++ src/sys/dev/pcmcia/pcmcom.c	Thu Nov 12 22:46:47 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcmcom.c,v 1.37 2009/05/12 14:42:19 cegger Exp $	*/
+/*	$NetBSD: pcmcom.c,v 1.38 2009/11/12 22:46:47 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.37 2009/05/12 14:42:19 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.38 2009/11/12 22:46:47 dyoung Exp $");
 
 #include 
 #include 
@@ -92,10 +92,10 @@
 int	pcmcom_validate_config(struct pcmcia_config_entry *);
 void	pcmcom_attach(device_t, device_t, void *);
 int	pcmcom_detach(device_t, int);
-int	pcmcom_activate(device_t, enum devact);
+void	pcmcom_childdet(device_t, device_t);
 
 CFATTACH_DECL(pcmcom, sizeof(struct pcmcom_softc),
-pcmcom_match, pcmcom_attach, pcmcom_detach, pcmcom_activate);
+pcmcom_match, pcmcom_attach, pcmcom_detach, NULL);
 
 const struct pcmcia_product pcmcom_products[] = {
 	{ PCMCIA_VENDOR_SOCKET, PCMCIA_PRODUCT_SOCKET_DUAL_RS232,
@@ -105,8 +105,7 @@
 	  PCMCIA_CIS_INVALID },
 #endif
 };
-const size_t pcmcom_nproducts =
-sizeof(pcmcom_products) / sizeof(pcmcom_products[0]);
+const size_t pcmcom_nproducts = __arraycount(pcmcom_products);
 
 int	pcmcom_print(void *, const char *);
 
@@ -116,8 +115,7 @@
 int	pcmcom_intr(void *);
 
 int
-pcmcom_match(device_t parent, cfdata_t cf,
-void *aux)
+pcmcom_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pcmcia_attach_args *pa = aux;
 
@@ -139,7 +137,7 @@
 void
 pcmcom_attach(device_t parent, device_t self, void *aux)
 {
-	struct pcmcom_softc *sc = (void *)self;
+	struct pcmcom_softc *sc = device_private(self);
 	struct pcmcia_attach_args *pa = aux;
 	struct pcmcia_config_entry *cfe;
 	int slave;
@@ -150,8 +148,7 @@
 
 	error = pcmcia_function_configure(pa->pf, pcmcom_validate_config);
 	if (error) {
-		aprint_error_dev(self, "configure failed, error=%d\n",
-		error);
+		aprint_error_dev(self, "configure failed, error=%d\n", error);
 		return;
 	}
 
@@ -187,10 +184,22 @@
 	pcmcia_function_unconfigure(pa->pf);
 }
 
+void
+pcmcom_childdet(device_t self, device_t child)
+{
+	struct pcmcom_softc *sc = device_private(self);
+	int slave;
+
+	for (slave = sc->sc_nslaves - 1; slave >= 0; slave--) {
+		if (sc->sc_slaves[slave] == child)
+			sc->sc_slaves[slave] = NULL;
+	}
+}
+
 int
 pcmcom_detach(device_t self, int flags)
 {
-	struct pcmcom_softc *sc = (void *)self;
+	struct pcmcom_softc *sc = device_private(self);
 	int slave, error;
 
 	if (sc->sc_state != PCMCOM_ATTACHED)
@@ -202,7 +211,6 @@
 			error = config_detach(sc->sc_slaves[slave], flags);
 			if (error)
 return (error);
-			sc->sc_slaves[slave] = 0;
 		}
 	}
 
@@ -212,37 +220,6 @@
 }
 
 int
-pcmcom_activate(device_t self, enum devact act)
-{
-	struct pcmcom_softc *sc = (void *)self;
-	int slave, error = 0, s;
-
-	s = splserial();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		for (slave = sc->sc_nslaves - 1; slave >= 0; slave--) {
-			if (sc->sc_slaves[slave]) {
-/*
- * Deactivate the child.  Doing so will cause
- * our own enabled count to drop to 0, once all
- * children are deactivated.
- */
-error = config_deactivate(sc->sc_slaves[slave]);
-if (error)
-	break;
-			}
-		}
-		break;
-	}
-	splx(s);
-	return (error);
-}
-
-int
 pcmcom_print(void *aux, const char *pnp)
 {
 	struct pcmcom_attach_args *pca = aux;
@@ -320,7 +297,7 @@
 
 /* No pcmcom-specific goo in the softc; it's all in the parent. */
 CFATTACH_DECL(com_pcmcom, sizeof(struct com_softc),
-com_pcmcom_match, com_pcmcom_attach, com_detach, com_activate);
+com_pcmcom_match, com_pcmcom_attach, com_detach, NULL);
 
 int	com_pcmcom_enable(struct com_softc *);
 void	com_pcmcom_disable(struct com_softc *);
@@ -356,8 +333,7 @@
 int
 com_pcmcom_enable(struct com_softc *sc)
 {
-
-	return (pcmcom_enable(device_private(device_parent(sc->sc_dev;
+	return pcmcom_enable(device_private(device_parent(sc->sc_dev)));
 }
 
 void



CVS commit: xsrc/external/mit/xf86-video-sunffb/dist/src

2009-11-12 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Nov 12 21:40:05 UTC 2009

Modified Files:
xsrc/external/mit/xf86-video-sunffb/dist/src: VISmoveImage.s

Log Message:
reapply 64bit fixes


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/xf86-video-sunffb/dist/src/VISmoveImage.s

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

Modified files:

Index: xsrc/external/mit/xf86-video-sunffb/dist/src/VISmoveImage.s
diff -u xsrc/external/mit/xf86-video-sunffb/dist/src/VISmoveImage.s:1.1.1.2 xsrc/external/mit/xf86-video-sunffb/dist/src/VISmoveImage.s:1.2
--- xsrc/external/mit/xf86-video-sunffb/dist/src/VISmoveImage.s:1.1.1.2	Mon Nov  9 05:32:23 2009
+++ xsrc/external/mit/xf86-video-sunffb/dist/src/VISmoveImage.s	Thu Nov 12 21:40:05 2009
@@ -77,6 +77,10 @@
  */
 
 #if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
+
+ .register %g2, #scratch
+ .register %g3, #scratch
+
 #define SMUL			mulx
 #define ICC			xcc
 #else
@@ -178,7 +182,11 @@
 	.globl			VISmoveImageLR
 	.align			32
 VISmoveImageLR:
-	save			%sp, -160, %sp! Group 0
+#ifdef __arch64__
+	save			%sp, -192, %sp! Group 0
+#else
+	save			%sp, -96, %sp! Group 0
+#endif
 0:	rd			%pc, %tmp3! Group 1
 	sub			%src, %dst, %mode			! Group 7
 	brz,pn			%h, return
@@ -779,7 +787,11 @@
 	 sub			%tmp3, %rightw, %curw
 
 return: return			%i7+8
+#if defined(__NetBSD__)
+	 wr			%g0, 4, %fprs
+#else
 	 wr			%g0, 0, %fprs
+#endif
 
 narrowst:
 	and			%leftw, 0x38, %tmp1
@@ -1142,7 +1154,11 @@
 	.globl			VISmoveImageRL
 	.align			32
 VISmoveImageRL:
-	save			%sp, -160, %sp! Group 0
+#ifdef __arch64__
+	save			%sp, -192, %sp! Group 0
+#else
+	save			%sp, -96, %sp! Group 0
+#endif
 0:	rd			%pc, %tmp3! Group 1
 	and			%dst, 63, %leftw			! Group 7
 	mov			64, %tmp1
@@ -2174,7 +2190,11 @@
 	 sub			%curw, %rightw, %curw
 
 rreturn:return			%i7+8
+#if defined(__NetBSD__)
+	 wr			%g0, 4, %fprs
+#else
 	 wr			%g0, 0, %fprs
+#endif
 
 narrowstr:
 	cmp			%rightw, 64



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:38:35 UTC 2009

Modified Files:
src/sys/dev/ic: com.c

Log Message:
Remove some dead code.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/dev/ic/com.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/ic/com.c
diff -u src/sys/dev/ic/com.c:1.289 src/sys/dev/ic/com.c:1.290
--- src/sys/dev/ic/com.c:1.289	Thu Nov 12 20:37:09 2009
+++ src/sys/dev/ic/com.c	Thu Nov 12 20:38:35 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.289 2009/11/12 20:37:09 dyoung Exp $ */
+/* $NetBSD: com.c,v 1.290 2009/11/12 20:38:35 dyoung Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.289 2009/11/12 20:37:09 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.290 2009/11/12 20:38:35 dyoung Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -177,11 +177,6 @@
 
 int	cominit(struct com_regs *, int, int, int, tcflag_t);
 
-#if 0
-static int	comcngetc_detached(dev_t);
-static void	comcnputc_detached(dev_t, int);
-#endif
-
 static int comcnreattach(void);
 
 int	comcngetc(dev_t);
@@ -209,13 +204,6 @@
 
 static struct comcons_info comcons_info;
 
-#if 0
-static struct consdev comcons_detached = {
-	NULL, NULL, comcngetc_detached, comcnputc_detached, comcnpollc,
-	NULL, NULL, NULL, NODEV, CN_NULL
-};
-#endif
-
 /*
  * Following are all routines needed for COM to act as console
  */
@@ -632,19 +620,6 @@
 		com_enable_debugport(sc);
 }
 
-#if 0
-static int
-comcngetc_detached(dev_t dev)
-{
-	return 0;
-}
-
-static void
-comcnputc_detached(dev_t dev, int c)
-{
-}
-#endif
-
 int
 com_detach(device_t self, int flags)
 {
@@ -2421,11 +2396,6 @@
 {
 	struct com_softc *sc = device_private(self);
 
-#if 0
-	if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE) && cn_tab == &comcons)
-		cn_tab = &comcons_suspend;
-#endif
-
 	CSR_WRITE_1(&sc->sc_regs, COM_REG_IER, 0);
 	(void)CSR_READ_1(&sc->sc_regs, COM_REG_IIR);
 



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:37:44 UTC 2009

Modified Files:
src/sys/dev/ic: comvar.h

Log Message:
Delete definition of com_activate(), it's been removed.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/comvar.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/dev/ic/comvar.h
diff -u src/sys/dev/ic/comvar.h:1.67 src/sys/dev/ic/comvar.h:1.68
--- src/sys/dev/ic/comvar.h:1.67	Thu Nov 12 20:37:09 2009
+++ src/sys/dev/ic/comvar.h	Thu Nov 12 20:37:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: comvar.h,v 1.67 2009/11/12 20:37:09 dyoung Exp $	*/
+/*	$NetBSD: comvar.h,v 1.68 2009/11/12 20:37:44 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -238,7 +238,6 @@
 int com_probe_subr(struct com_regs *);
 int com_detach(device_t, int);
 bool com_resume(device_t PMF_FN_PROTO);
-int com_activate(device_t, enum devact);
 bool com_cleanup(device_t, int);
 bool com_suspend(device_t PMF_FN_PROTO);
 



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:37:09 UTC 2009

Modified Files:
src/sys/dev/ic: com.c comvar.h

Log Message:
Move the code in com_activate() to com_detach(), where it always
belonged.  Remove com_activate().

Consolidate information about the console on com(4) in a new struct
comcons_info.

Support detachment & re-attachment of a system console on com(4).
Re-attachment is somehow incomplete.  Ideally, if some other device
could take over as console, it would, but we're not quite there,
yet.


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/dev/ic/com.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/ic/comvar.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/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.288 src/sys/dev/ic/com.c:1.289
--- src/sys/dev/ic/com.c:1.288	Wed May  6 07:27:42 2009
+++ src/sys/dev/ic/com.c	Thu Nov 12 20:37:09 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.288 2009/05/06 07:27:42 cegger Exp $ */
+/* $NetBSD: com.c,v 1.289 2009/11/12 20:37:09 dyoung Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.288 2009/05/06 07:27:42 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.289 2009/11/12 20:37:09 dyoung Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -173,10 +173,17 @@
 void	com_iflush(struct com_softc *);
 
 int	com_common_getc(dev_t, struct com_regs *);
-void	com_common_putc(dev_t, struct com_regs *, int);
+static void	com_common_putc(dev_t, struct com_regs *, int);
 
 int	cominit(struct com_regs *, int, int, int, tcflag_t);
 
+#if 0
+static int	comcngetc_detached(dev_t);
+static void	comcnputc_detached(dev_t, int);
+#endif
+
+static int comcnreattach(void);
+
 int	comcngetc(dev_t);
 void	comcnputc(dev_t, int);
 void	comcnpollc(dev_t, int);
@@ -200,6 +207,24 @@
 dev_type_tty(comtty);
 dev_type_poll(compoll);
 
+static struct comcons_info comcons_info;
+
+#if 0
+static struct consdev comcons_detached = {
+	NULL, NULL, comcngetc_detached, comcnputc_detached, comcnpollc,
+	NULL, NULL, NULL, NODEV, CN_NULL
+};
+#endif
+
+/*
+ * Following are all routines needed for COM to act as console
+ */
+static struct consdev comcons = {
+	NULL, NULL, comcngetc, comcnputc, comcnpollc, NULL, NULL, NULL,
+	NODEV, CN_NORMAL
+};
+
+
 const struct cdevsw com_cdevsw = {
 	comopen, comclose, comread, comwrite, comioctl,
 	comstop, comtty, compoll, nommap, ttykqfilter, D_TTY
@@ -215,10 +240,7 @@
 u_int com_rbuf_hiwat = (COM_RING_SIZE * 1) / 4;
 u_int com_rbuf_lowat = (COM_RING_SIZE * 3) / 4;
 
-static struct com_regs comconsregs;
 static int comconsattached;
-static int comconsrate;
-static tcflag_t comconscflag;
 static struct cnm_state com_cnm_state;
 
 #ifdef KGDB
@@ -383,10 +405,15 @@
 
 	CSR_WRITE_1(regsp, COM_REG_IER, sc->sc_ier);
 
-	if (regsp->cr_iot == comconsregs.cr_iot &&
-	regsp->cr_iobase == comconsregs.cr_iobase) {
+	if (regsp->cr_iot == comcons_info.regs.cr_iot &&
+	regsp->cr_iobase == comcons_info.regs.cr_iobase) {
 		comconsattached = 1;
 
+		if (cn_tab == NULL && comcnreattach() != 0) {
+			printf("can't re-init serial console @%zx\n",
+			(size_t)comcons_info.regs.cr_iobase);
+		}
+
 		/* Make sure the console is always "hardwired". */
 		delay(1);			/* wait for output to finish */
 		SET(sc->sc_hwflags, COM_HW_CONSOLE);
@@ -605,15 +632,42 @@
 		com_enable_debugport(sc);
 }
 
+#if 0
+static int
+comcngetc_detached(dev_t dev)
+{
+	return 0;
+}
+
+static void
+comcnputc_detached(dev_t dev, int c)
+{
+}
+#endif
+
 int
 com_detach(device_t self, int flags)
 {
 	struct com_softc *sc = device_private(self);
 	int maj, mn;
 
-if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
+	if (ISSET(sc->sc_hwflags, COM_HW_KGDB))
+		return EBUSY;
+
+if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE) &&
+	(flags & DETACH_SHUTDOWN) != 0)
 		return EBUSY;
 
+	if (sc->disable != NULL && sc->enabled != 0) {
+		(*sc->disable)(sc);
+		sc->enabled = 0;
+	}
+
+if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
+		comconsattached = 0;
+		cn_tab = NULL;
+	}
+
 	/* locate the major number */
 	maj = cdevsw_lookup_major(&com_cdevsw);
 
@@ -655,33 +709,6 @@
 	return (0);
 }
 
-int
-com_activate(device_t self, enum devact act)
-{
-	struct com_softc *sc = device_private(self);
-	int rv = 0;
-
-	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		if (sc->sc_hwflags & (COM_HW_CONSOLE|COM_HW_KGDB)) {
-			rv = EBUSY;
-			break;
-		}
-
-		if (sc->disable != NULL && sc->enabled != 0) {
-			(*sc->disable)(sc);
-			sc->enabled = 0;
-		}
-		break;
-	}
-
-	return (rv);
-}
-
 void
 com_shutdown(struct com_softc *sc)
 {
@@ -811,8 +838,8 @@
 		 * sticky bits from TIOCSFLAGS.
 		 */
 		if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
-			t.c_ospeed = comconsrate;
-			t.c_cflag = comconscflag;
+			t.c_

CVS commit: src/sys/dev/cardbus

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:30:29 UTC 2009

Modified Files:
src/sys/dev/cardbus: com_cardbus.c

Log Message:
Don't use com_activate(), it's going away.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/cardbus/com_cardbus.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/cardbus/com_cardbus.c
diff -u src/sys/dev/cardbus/com_cardbus.c:1.22 src/sys/dev/cardbus/com_cardbus.c:1.23
--- src/sys/dev/cardbus/com_cardbus.c:1.22	Tue Jun 24 19:44:52 2008
+++ src/sys/dev/cardbus/com_cardbus.c	Thu Nov 12 20:30:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: com_cardbus.c,v 1.22 2008/06/24 19:44:52 drochner Exp $ */
+/* $NetBSD: com_cardbus.c,v 1.23 2009/11/12 20:30:29 dyoung Exp $ */
 
 /*
  * Copyright (c) 2000 Johan Danielsson
@@ -40,7 +40,7 @@
updated below.  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_cardbus.c,v 1.22 2008/06/24 19:44:52 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_cardbus.c,v 1.23 2009/11/12 20:30:29 dyoung Exp $");
 
 #include 
 #include 
@@ -80,7 +80,7 @@
 static void com_cardbus_disable(struct com_softc*);
 
 CFATTACH_DECL_NEW(com_cardbus, sizeof(struct com_cardbus_softc),
-com_cardbus_match, com_cardbus_attach, com_cardbus_detach, com_activate);
+com_cardbus_match, com_cardbus_attach, com_cardbus_detach, NULL);
 
 static struct csdev {
 	int		vendor;



CVS commit: src/sys/dev/acpi

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:30:10 UTC 2009

Modified Files:
src/sys/dev/acpi: com_acpi.c

Log Message:
Don't use com_activate(), it's going away.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/acpi/com_acpi.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/acpi/com_acpi.c
diff -u src/sys/dev/acpi/com_acpi.c:1.29 src/sys/dev/acpi/com_acpi.c:1.30
--- src/sys/dev/acpi/com_acpi.c:1.29	Mon Jul 13 12:57:04 2009
+++ src/sys/dev/acpi/com_acpi.c	Thu Nov 12 20:30:10 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: com_acpi.c,v 1.29 2009/07/13 12:57:04 kiyohara Exp $ */
+/* $NetBSD: com_acpi.c,v 1.30 2009/11/12 20:30:10 dyoung Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.29 2009/07/13 12:57:04 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.30 2009/11/12 20:30:10 dyoung Exp $");
 
 #include 
 #include 
@@ -57,7 +57,7 @@
 };
 
 CFATTACH_DECL_NEW(com_acpi, sizeof(struct com_acpi_softc), com_acpi_match,
-com_acpi_attach, NULL, com_activate);
+com_acpi_attach, NULL, NULL);
 
 /*
  * Supported device IDs



CVS commit: src/sys/dev/pcmcia

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:29:30 UTC 2009

Modified Files:
src/sys/dev/pcmcia: com_pcmcia.c

Log Message:
Call com_detach() before doing any bus-specific detachment.

Don't use com_activate(), it's going away.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/pcmcia/com_pcmcia.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/pcmcia/com_pcmcia.c
diff -u src/sys/dev/pcmcia/com_pcmcia.c:1.59 src/sys/dev/pcmcia/com_pcmcia.c:1.60
--- src/sys/dev/pcmcia/com_pcmcia.c:1.59	Wed Aug 27 05:39:01 2008
+++ src/sys/dev/pcmcia/com_pcmcia.c	Thu Nov 12 20:29:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_pcmcia.c,v 1.59 2008/08/27 05:39:01 christos Exp $	 */
+/*	$NetBSD: com_pcmcia.c,v 1.60 2009/11/12 20:29:30 dyoung Exp $	 */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_pcmcia.c,v 1.59 2008/08/27 05:39:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_pcmcia.c,v 1.60 2009/11/12 20:29:30 dyoung Exp $");
 
 #include 
 #include 
@@ -107,7 +107,7 @@
 };
 
 CFATTACH_DECL_NEW(com_pcmcia, sizeof(struct com_pcmcia_softc),
-com_pcmcia_match, com_pcmcia_attach, com_pcmcia_detach, com_activate);
+com_pcmcia_match, com_pcmcia_attach, com_pcmcia_detach, NULL);
 
 static const struct pcmcia_product com_pcmcia_products[] = {
 	{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
@@ -230,11 +230,11 @@
 	if (!psc->sc_attached)
 		return (0);
 
-	pmf_device_deregister(self);
-
 	if ((error = com_detach(self, flags)) != 0)
 		return error;
 
+	pmf_device_deregister(self);
+
 	pcmcia_function_unconfigure(psc->sc_pf);
 	return (0);
 }



CVS commit: src/sys/dev/isa

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:28:32 UTC 2009

Modified Files:
src/sys/dev/isa: com_isa.c

Log Message:
Call the common detach routine, com_detach(), and get out on error,
before starting the bus-specific detachment.

com_activate() is going away, so don't use it any more.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/isa/com_isa.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/isa/com_isa.c
diff -u src/sys/dev/isa/com_isa.c:1.35 src/sys/dev/isa/com_isa.c:1.36
--- src/sys/dev/isa/com_isa.c:1.35	Thu Apr  2 00:09:33 2009
+++ src/sys/dev/isa/com_isa.c	Thu Nov 12 20:28:32 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_isa.c,v 1.35 2009/04/02 00:09:33 dyoung Exp $	*/
+/*	$NetBSD: com_isa.c,v 1.36 2009/11/12 20:28:32 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_isa.c,v 1.35 2009/04/02 00:09:33 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_isa.c,v 1.36 2009/11/12 20:28:32 dyoung Exp $");
 
 #include 
 #include 
@@ -108,7 +108,7 @@
 
 
 CFATTACH_DECL3_NEW(com_isa, sizeof(struct com_isa_softc),
-com_isa_probe, com_isa_attach, com_isa_detach, com_activate,
+com_isa_probe, com_isa_attach, com_isa_detach, NULL,
 NULL, NULL, DVF_DETACH_SHUTDOWN);
 
 int
@@ -252,14 +252,14 @@
 	const struct com_regs *cr = &sc->sc_regs;
 	int rc;
 
+	if ((rc = com_detach(self, flags)) != 0)
+		return rc;
+
 	if (isc->sc_ih != NULL)
 		isa_intr_disestablish(isc->sc_ic, isc->sc_ih);
 
 	pmf_device_deregister(self);
 
-	if ((rc = com_detach(self, flags)) != 0)
-		return rc;
-
 	com_cleanup(self, 0);
 
 #ifdef COM_HAYESP



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:15:02 UTC 2009

Modified Files:
src/sys/dev/ic: mb89352var.h

Log Message:
Remove definition of spc_activate(), it has gone away.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/mb89352var.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/dev/ic/mb89352var.h
diff -u src/sys/dev/ic/mb89352var.h:1.14 src/sys/dev/ic/mb89352var.h:1.15
--- src/sys/dev/ic/mb89352var.h:1.14	Thu Nov 12 20:14:04 2009
+++ src/sys/dev/ic/mb89352var.h	Thu Nov 12 20:15:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb89352var.h,v 1.14 2009/11/12 20:14:04 dyoung Exp $	*/
+/*	$NetBSD: mb89352var.h,v 1.15 2009/11/12 20:15:02 dyoung Exp $	*/
 /*	NecBSD: mb89352var.h,v 1.4 1998/03/14 07:31:22 kmatsuda Exp 	*/
 
 /*-
@@ -229,7 +229,6 @@
 #define SPC_START(s)	SPC_PRINT(SPC_SHOWSTART, s)
 
 void	spc_attach(struct spc_softc *);
-int	spc_activate(device_t, enum devact);
 void	spc_childdet(device_t, device_t);
 int	spc_detach(device_t, int);
 int	spc_intr(void *);



CVS commit: src/sys/dev

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:14:04 UTC 2009

Modified Files:
src/sys/dev/ic: mb89352.c mb89352var.h
src/sys/dev/pcmcia: spc_pcmcia.c

Log Message:
Remove superfluous activation hook.

Add a child-detachment hook.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/ic/mb89352.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/mb89352var.h
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pcmcia/spc_pcmcia.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/ic/mb89352.c
diff -u src/sys/dev/ic/mb89352.c:1.49 src/sys/dev/ic/mb89352.c:1.50
--- src/sys/dev/ic/mb89352.c:1.49	Thu Jun 12 22:30:30 2008
+++ src/sys/dev/ic/mb89352.c	Thu Nov 12 20:14:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb89352.c,v 1.49 2008/06/12 22:30:30 cegger Exp $	*/
+/*	$NetBSD: mb89352.c,v 1.50 2009/11/12 20:14:04 dyoung Exp $	*/
 /*	NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp	*/
 
 /*-
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.49 2008/06/12 22:30:30 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.50 2009/11/12 20:14:04 dyoung Exp $");
 
 #ifdef DDB
 #define	integrate
@@ -307,26 +307,13 @@
 	scsipi_adapter_delref(adapt);
 }
 
-int
-spc_activate(device_t self, enum devact act)
+void
+spc_childdet(device_t self, device_t child)
 {
 	struct spc_softc *sc = device_private(self);
-	int s, rv = 0;
 
-	s = splhigh();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		if (sc->sc_child != NULL)
-			rv = config_deactivate(sc->sc_child);
-		break;
-	}
-	splx(s);
-
-	return (rv);
+	if (sc->sc_child == child)
+		sc->sc_child = NULL;
 }
 
 int

Index: src/sys/dev/ic/mb89352var.h
diff -u src/sys/dev/ic/mb89352var.h:1.13 src/sys/dev/ic/mb89352var.h:1.14
--- src/sys/dev/ic/mb89352var.h:1.13	Tue May 12 14:25:17 2009
+++ src/sys/dev/ic/mb89352var.h	Thu Nov 12 20:14:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb89352var.h,v 1.13 2009/05/12 14:25:17 cegger Exp $	*/
+/*	$NetBSD: mb89352var.h,v 1.14 2009/11/12 20:14:04 dyoung Exp $	*/
 /*	NecBSD: mb89352var.h,v 1.4 1998/03/14 07:31:22 kmatsuda Exp 	*/
 
 /*-
@@ -230,6 +230,7 @@
 
 void	spc_attach(struct spc_softc *);
 int	spc_activate(device_t, enum devact);
+void	spc_childdet(device_t, device_t);
 int	spc_detach(device_t, int);
 int	spc_intr(void *);
 int	spc_find(bus_space_tag_t, bus_space_handle_t, int);

Index: src/sys/dev/pcmcia/spc_pcmcia.c
diff -u src/sys/dev/pcmcia/spc_pcmcia.c:1.20 src/sys/dev/pcmcia/spc_pcmcia.c:1.21
--- src/sys/dev/pcmcia/spc_pcmcia.c:1.20	Mon Apr 28 20:23:56 2008
+++ src/sys/dev/pcmcia/spc_pcmcia.c	Thu Nov 12 20:14:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: spc_pcmcia.c,v 1.20 2008/04/28 20:23:56 martin Exp $	*/
+/*	$NetBSD: spc_pcmcia.c,v 1.21 2009/11/12 20:14:04 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spc_pcmcia.c,v 1.20 2008/04/28 20:23:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spc_pcmcia.c,v 1.21 2009/11/12 20:14:04 dyoung Exp $");
 
 #include 
 #include 
@@ -67,8 +67,9 @@
 static int	spc_pcmcia_detach(device_t, int);
 static int	spc_pcmcia_enable(device_t, int);
 
-CFATTACH_DECL_NEW(spc_pcmcia, sizeof(struct spc_pcmcia_softc),
-spc_pcmcia_match, spc_pcmcia_attach, spc_pcmcia_detach, spc_activate);
+CFATTACH_DECL2_NEW(spc_pcmcia, sizeof(struct spc_pcmcia_softc),
+spc_pcmcia_match, spc_pcmcia_attach, spc_pcmcia_detach, NULL, NULL,
+spc_childdet);
 
 static const struct pcmcia_product spc_pcmcia_products[] = {
 	{ PCMCIA_VENDOR_FUJITSU, PCMCIA_PRODUCT_FUJITSU_SCSI600,



CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:11:35 UTC 2009

Modified Files:
src/sys/dev/usb: uhub.c usb.c usb_subr.c usbdivar.h

Log Message:
Re-order operations in usb_detach() so that if a usb(4) instance's
children will not detach, the instance is not left in an inconsistent
state.

If uhub(4) port is disconnected, forcefully detach the children on
that port.

Simplify detachment hooks.  (sc_dying must die!)

Pass along and respect detachment flags, esp. DETACH_FORCE,
throughout.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/usb/uhub.c
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/usb/usbdivar.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/dev/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.107 src/sys/dev/usb/uhub.c:1.108
--- src/sys/dev/usb/uhub.c:1.107	Fri Sep  4 18:14:41 2009
+++ src/sys/dev/usb/uhub.c	Thu Nov 12 20:11:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.107 2009/09/04 18:14:41 dyoung Exp $	*/
+/*	$NetBSD: uhub.c,v 1.108 2009/11/12 20:11:35 dyoung Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.107 2009/09/04 18:14:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.108 2009/11/12 20:11:35 dyoung Exp $");
 
 #include 
 #include 
@@ -98,13 +98,12 @@
 int uhub_rescan(device_t, const char *, const int *);
 void uhub_childdet(device_t, device_t);
 int uhub_detach(device_t, int);
-int uhub_activate(device_t, enum devact);
 extern struct cfdriver uhub_cd;
 CFATTACH_DECL3_NEW(uhub, sizeof(struct uhub_softc), uhub_match,
-uhub_attach, uhub_detach, uhub_activate, uhub_rescan, uhub_childdet,
+uhub_attach, uhub_detach, NULL, uhub_rescan, uhub_childdet,
 DVF_DETACH_SHUTDOWN);
 CFATTACH_DECL2_NEW(uroothub, sizeof(struct uhub_softc), uhub_match,
-uhub_attach, uhub_detach, uhub_activate, uhub_rescan, uhub_childdet);
+uhub_attach, uhub_detach, NULL, uhub_rescan, uhub_childdet);
 
 int
 uhub_match(device_t parent, cfdata_t match, void *aux)
@@ -470,7 +469,7 @@
 			/* Disconnected */
 			DPRINTF(("uhub_explore: device addr=%d disappeared "
  "on port %d\n", up->device->address, port));
-			usb_disconnect_port(up, sc->sc_dev);
+			usb_disconnect_port(up, sc->sc_dev, DETACH_FORCE);
 			usbd_clear_port_feature(dev, port,
 		UHF_C_PORT_CONNECTION);
 		}
@@ -554,35 +553,6 @@
 	return (USBD_NORMAL_COMPLETION);
 }
 
-int
-uhub_activate(device_t self, enum devact act)
-{
-	struct uhub_softc *sc = device_private(self);
-	struct usbd_hub *hub = sc->sc_hub->hub;
-	usbd_device_handle dev;
-	int nports, port, i;
-
-	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
-	case DVACT_DEACTIVATE:
-		if (hub == NULL) /* malfunctioning hub */
-			break;
-		nports = hub->hubdesc.bNbrPorts;
-		for(port = 0; port < nports; port++) {
-			dev = hub->ports[port].device;
-			if (!dev)
-continue;
-			for (i = 0; i < dev->subdevlen; i++)
-if (dev->subdevs[i])
-	config_deactivate(dev->subdevs[i]);
-		}
-		break;
-	}
-	return (0);
-}
-
 /*
  * Called from process context when the hub is gone.
  * Detach all devices on active ports.
@@ -593,24 +563,26 @@
 	struct uhub_softc *sc = device_private(self);
 	struct usbd_hub *hub = sc->sc_hub->hub;
 	struct usbd_port *rup;
-	int port, nports;
+	int nports, port, rc;
 
 	DPRINTF(("uhub_detach: sc=%p flags=%d\n", sc, flags));
 
 	if (hub == NULL)		/* Must be partially working */
 		return (0);
 
-	pmf_device_deregister(self);
-	usbd_abort_pipe(sc->sc_ipipe);
-	usbd_close_pipe(sc->sc_ipipe);
-
 	nports = hub->hubdesc.bNbrPorts;
 	for(port = 0; port < nports; port++) {
 		rup = &hub->ports[port];
-		if (rup->device != NULL)
-			usb_disconnect_port(rup, self);
+		if (rup->device == NULL)
+			continue;
+		if ((rc = usb_disconnect_port(rup, self, flags)) != 0)
+			return rc;
 	}
 
+	pmf_device_deregister(self);
+	usbd_abort_pipe(sc->sc_ipipe);
+	usbd_close_pipe(sc->sc_ipipe);
+
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_hub, sc->sc_dev);
 
 #if 0

Index: src/sys/dev/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.118 src/sys/dev/usb/usb.c:1.119
--- src/sys/dev/usb/usb.c:1.118	Tue Jun 16 19:42:44 2009
+++ src/sys/dev/usb/usb.c	Thu Nov 12 20:11:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.118 2009/06/16 19:42:44 dyoung Exp $	*/
+/*	$NetBSD: usb.c,v 1.119 2009/11/12 20:11:35 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.118 2009/06/16 19:42:44 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.119 2009/11/12 20:11:35 dyoung Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -937,25 +937,14 @@
 usb_activate(device_t self, enum devact act)
 {
 	s

CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 20:01:15 UTC 2009

Modified Files:
src/sys/dev/usb: uslsa.c ustir.c uvideo.c uvisor.c uvscom.c
xboxcontroller.c

Log Message:
Simplify activation hooks.  (sc_dying must die!)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/usb/uslsa.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/ustir.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/usb/uvideo.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/usb/uvisor.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/uvscom.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/xboxcontroller.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/usb/uslsa.c
diff -u src/sys/dev/usb/uslsa.c:1.10 src/sys/dev/usb/uslsa.c:1.11
--- src/sys/dev/usb/uslsa.c:1.10	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uslsa.c	Thu Nov 12 20:01:15 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: uslsa.c,v 1.10 2009/09/23 19:07:19 plunky Exp $ */
+/* $NetBSD: uslsa.c,v 1.11 2009/11/12 20:01:15 dyoung Exp $ */
 
 /* from ugensa.c */
 
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.10 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.11 2009/11/12 20:01:15 dyoung Exp $");
 
 #include 
 #include 
@@ -327,20 +327,14 @@
 uslsa_activate(device_t self, enum devact act)
 {
 	struct uslsa_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-		break;
-
 	case DVACT_DEACTIVATE:
 		sc->sc_dying = 1;
-		if (sc->sc_subdev)
-			rv = config_deactivate(sc->sc_subdev);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 void

Index: src/sys/dev/usb/ustir.c
diff -u src/sys/dev/usb/ustir.c:1.27 src/sys/dev/usb/ustir.c:1.28
--- src/sys/dev/usb/ustir.c:1.27	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/ustir.c	Thu Nov 12 20:01:15 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ustir.c,v 1.27 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: ustir.c,v 1.28 2009/11/12 20:01:15 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ustir.c,v 1.27 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ustir.c,v 1.28 2009/11/12 20:01:15 dyoung Exp $");
 
 #include 
 #include 
@@ -858,19 +858,14 @@
 ustir_activate(device_t self, enum devact act)
 {
 	struct ustir_softc *sc = device_private(self);
-	int error = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return EOPNOTSUPP;
-
 	case DVACT_DEACTIVATE:
 		sc->sc_dying = 1;
-		if (sc->sc_child != NULL)
-			error = config_deactivate(sc->sc_child);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return error;
 }
 
 /* ARGSUSED */

Index: src/sys/dev/usb/uvideo.c
diff -u src/sys/dev/usb/uvideo.c:1.29 src/sys/dev/usb/uvideo.c:1.30
--- src/sys/dev/usb/uvideo.c:1.29	Mon Mar  9 15:59:33 2009
+++ src/sys/dev/usb/uvideo.c	Thu Nov 12 20:01:15 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvideo.c,v 1.29 2009/03/09 15:59:33 uebayasi Exp $	*/
+/*	$NetBSD: uvideo.c,v 1.30 2009/11/12 20:01:15 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.29 2009/03/09 15:59:33 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.30 2009/11/12 20:01:15 dyoung Exp $");
 
 #ifdef _MODULE
 #include 
@@ -622,23 +622,16 @@
 int
 uvideo_activate(device_t self, enum devact act)
 {
-	struct uvideo_softc *sc;
-	int rv;
+	struct uvideo_softc *sc = device_private(self);
 	
-	sc = device_private(self);
-	rv = 0;
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return EOPNOTSUPP;
-
 	case DVACT_DEACTIVATE:
 		DPRINTF(("uvideo_activate: deactivating\n"));
-		if (sc->sc_videodev != NULL)
-			rv = config_deactivate(sc->sc_videodev);
 		sc->sc_dying = 1;
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return rv;
 }
 
 

Index: src/sys/dev/usb/uvisor.c
diff -u src/sys/dev/usb/uvisor.c:1.41 src/sys/dev/usb/uvisor.c:1.42
--- src/sys/dev/usb/uvisor.c:1.41	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uvisor.c	Thu Nov 12 20:01:15 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvisor.c,v 1.41 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uvisor.c,v 1.42 2009/11/12 20:01:15 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.41 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.42 2009/11/12 20:01:15 dyoung Exp $");
 
 #include 
 #include 
@@ -377,22 +377,14 @@
 uvisor_activate(device_ptr_t self, enum devact act)
 {
 	struct uvisor_softc *sc = device_private(self);
-	int rv = 0;
-	int i;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-		break;
-
 	case DVACT_DEACTIVATE:
-		for (i = 0; i < sc->sc_numcon; i++)
-			if (sc->sc_subdevs[i] != NULL)
-rv |= config_deactivate(sc->sc_subdevs[i]);
 		sc->sc_dyi

CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:58:27 UTC 2009

Modified Files:
src/sys/dev/usb: uhidev.c uhmodem.c uipaq.c uirda.c ukbd.c umass.c
umct.c umidi.c umodem_common.c ums.c uplcom.c

Log Message:
Simplify activation hooks.  (sc_dying must die!)


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/usb/uhidev.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/usb/uhmodem.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/uipaq.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/uirda.c
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/ukbd.c
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/usb/umct.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/umidi.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/umodem_common.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/usb/ums.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/usb/uplcom.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/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.44 src/sys/dev/usb/uhidev.c:1.45
--- src/sys/dev/usb/uhidev.c:1.44	Fri Nov  6 04:42:27 2009
+++ src/sys/dev/usb/uhidev.c	Thu Nov 12 19:58:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhidev.c,v 1.44 2009/11/06 04:42:27 rafal Exp $	*/
+/*	$NetBSD: uhidev.c,v 1.45 2009/11/12 19:58:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.44 2009/11/06 04:42:27 rafal Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.45 2009/11/12 19:58:27 dyoung Exp $");
 
 #include 
 #include 
@@ -356,25 +356,14 @@
 uhidev_activate(device_t self, enum devact act)
 {
 	struct uhidev_softc *sc = device_private(self);
-	int i, rv;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
 	case DVACT_DEACTIVATE:
-		rv = 0;
-		for (i = 0; i < sc->sc_nrepid; i++)
-			if (sc->sc_subdevs[i] != NULL)
-rv |= config_deactivate(
-	sc->sc_subdevs[i]);
 		sc->sc_dying = 1;
-		break;
+		return 0;
 	default:
-		rv = 0;
-		break;
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 void

Index: src/sys/dev/usb/uhmodem.c
diff -u src/sys/dev/usb/uhmodem.c:1.8 src/sys/dev/usb/uhmodem.c:1.9
--- src/sys/dev/usb/uhmodem.c:1.8	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uhmodem.c	Thu Nov 12 19:58:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhmodem.c,v 1.8 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uhmodem.c,v 1.9 2009/11/12 19:58:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2008 Yojiro UO .
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhmodem.c,v 1.8 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhmodem.c,v 1.9 2009/11/12 19:58:27 dyoung Exp $");
 
 #include 
 #include 
@@ -422,22 +422,14 @@
 uhmodem_activate(device_t self, enum devact act)
 {
 	struct uhmodem_softc *sc = device_private(self);
-	int rv = 0;
-	int i;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
 	case DVACT_DEACTIVATE:
-		for (i = 0; i < sc->sc_ubsa.sc_numif; i++) {
-			if (sc->sc_ubsa.sc_subdevs[i] != NULL)
-rv |= config_deactivate(sc->sc_ubsa.sc_subdevs[i]);
-		}
 		sc->sc_ubsa.sc_dying = 1;
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 Static int

Index: src/sys/dev/usb/uipaq.c
diff -u src/sys/dev/usb/uipaq.c:1.14 src/sys/dev/usb/uipaq.c:1.15
--- src/sys/dev/usb/uipaq.c:1.14	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uipaq.c	Thu Nov 12 19:58:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipaq.c,v 1.14 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uipaq.c,v 1.15 2009/11/12 19:58:27 dyoung Exp $	*/
 /*	$OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $	*/
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipaq.c,v 1.14 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipaq.c,v 1.15 2009/11/12 19:58:27 dyoung Exp $");
 
 #include 
 #include 
@@ -362,20 +362,14 @@
 uipaq_activate(device_t self, enum devact act)
 {
 	struct uipaq_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-		break;
-
 	case DVACT_DEACTIVATE:
-		if (sc->sc_subdev != NULL)
-			rv = config_deactivate(sc->sc_subdev);
 		sc->sc_dying = 1;
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 void

Index: src/sys/dev/usb/uirda.c
diff -u src/sys/dev/usb/uirda.c:1.32 src/sys/dev/usb/uirda.c:1.33
--- src/sys/dev/usb/uirda.c:1.32	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uirda.c	Thu Nov 12 19:58:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uirda.c,v 1.32 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uirda.c,v 1.33 2009/11/12 19:58:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.32 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.33 2009/11/12 19:58:27 dyoung Exp $");
 
 #include 
 #

CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:53:56 UTC 2009

Modified Files:
src/sys/dev/usb: uhci.c

Log Message:
Simplify activation hook.  (sc_dying must die!)

unifdef -D__NetBSD__ -U__FreeBSD__ -U__OpenBSD__.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/dev/usb/uhci.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/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.229 src/sys/dev/usb/uhci.c:1.230
--- src/sys/dev/usb/uhci.c:1.229	Sun Nov  1 06:36:44 2009
+++ src/sys/dev/usb/uhci.c	Thu Nov 12 19:53:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.229 2009/11/01 06:36:44 uebayasi Exp $	*/
+/*	$NetBSD: uhci.c,v 1.230 2009/11/12 19:53:56 dyoung Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $	*/
 
 /*
@@ -42,25 +42,16 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.229 2009/11/01 06:36:44 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.230 2009/11/12 19:53:56 dyoung Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include 
 #include 
 #include 
 #include 
-#elif defined(__FreeBSD__)
-#include 
-#include 
-#include 
-#if defined(DIAGNOSTIC) && defined(__i386__)
-#include 
-#endif
-#endif
 #include 
 #include 
 #include 
@@ -80,17 +71,7 @@
 /* Use bandwidth reclamation for control transfers. Some devices choke on it. */
 /*#define UHCI_CTL_LOOP */
 
-#if defined(__FreeBSD__)
-#include 
-
-#define delay(d)		DELAY(d)
-#endif
 
-#if defined(__OpenBSD__)
-struct cfdriver uhci_cd = {
-	NULL, "uhci", DV_DULL
-};
-#endif
 
 #ifdef UHCI_DEBUG
 uhci_softc_t *thesc;
@@ -98,9 +79,6 @@
 #define DPRINTFN(n,x)	if (uhcidebug>(n)) printf x
 int uhcidebug = 0;
 int uhcinoloop = 0;
-#ifndef __NetBSD__
-#define snprintb((q), (f), "%b", q,f,b,l) snprintf((b), (l))
-#endif
 #else
 #define DPRINTF(x)
 #define DPRINTFN(n,x)
@@ -110,15 +88,6 @@
  * The UHCI controller is little endian, so on big endian machines
  * the data stored in memory needs to be swapped.
  */
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
-#if BYTE_ORDER == BIG_ENDIAN
-#define htole32(x) (bswap32(x))
-#define le32toh(x) (bswap32(x))
-#else
-#define htole32(x) (x)
-#define le32toh(x) (x)
-#endif
-#endif
 
 struct uhci_pipe {
 	struct usbd_pipe pipe;
@@ -434,10 +403,8 @@
 	uhci_globalreset(sc);			/* reset the controller */
 	uhci_reset(sc);
 
-#ifdef __NetBSD__
 	usb_setup_reserve(sc->sc_dev, &sc->sc_dma_reserve, sc->sc_bus.dmatag,
 	USB_MEM_RESERVE);
-#endif
 
 	/* Allocate and initialize real frame array. */
 	err = usb_allocmem(&sc->sc_bus,
@@ -570,24 +537,18 @@
 	return err;
 }
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int
 uhci_activate(device_t self, enum devact act)
 {
 	struct uhci_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
 	case DVACT_DEACTIVATE:
 		sc->sc_dying = 1;
-		if (sc->sc_child != NULL)
-			rv = config_deactivate(sc->sc_child);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 void
@@ -627,7 +588,6 @@
 
 	return (rv);
 }
-#endif
 
 usbd_status
 uhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
@@ -660,23 +620,19 @@
 
 
 	status = usb_allocmem(&sc->sc_bus, size, 0, dma);
-#ifdef __NetBSD__
 	if (status == USBD_NOMEM)
 		status = usb_reserve_allocm(&sc->sc_dma_reserve, dma, size);
-#endif
 	return status;
 }
 
 void
 uhci_freem(struct usbd_bus *bus, usb_dma_t *dma)
 {
-#ifdef __NetBSD__
 	if (dma->block->flags & USB_DMA_RESERVE) {
 		usb_reserve_freem(&((struct uhci_softc *)bus)->sc_dma_reserve,
 		dma);
 		return;
 	}
-#endif
 	usb_freemem(&((struct uhci_softc *)bus)->sc_bus, dma);
 }
 



CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:53:15 UTC 2009

Modified Files:
src/sys/dev/usb: moscom.c

Log Message:
Simplify activation hook.  (sc_dying must die!)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/moscom.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/usb/moscom.c
diff -u src/sys/dev/usb/moscom.c:1.2 src/sys/dev/usb/moscom.c:1.3
--- src/sys/dev/usb/moscom.c:1.2	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/moscom.c	Thu Nov 12 19:53:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: moscom.c,v 1.2 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: moscom.c,v 1.3 2009/11/12 19:53:14 dyoung Exp $	*/
 /*	$OpenBSD: moscom.c,v 1.11 2007/10/11 18:33:14 deraadt Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: moscom.c,v 1.2 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: moscom.c,v 1.3 2009/11/12 19:53:14 dyoung Exp $");
 
 #include 
 #include 
@@ -300,19 +300,14 @@
 moscom_activate(device_t self, enum devact act)
 {
 	struct moscom_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
 	case DVACT_DEACTIVATE:
-		if (sc->sc_subdev != NULL)
-			rv = config_deactivate(sc->sc_subdev);
 		sc->sc_dying = 1;
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 int



CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:52:14 UTC 2009

Modified Files:
src/sys/dev/usb: u3g.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/u3g.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/usb/u3g.c
diff -u src/sys/dev/usb/u3g.c:1.7 src/sys/dev/usb/u3g.c:1.8
--- src/sys/dev/usb/u3g.c:1.7	Fri May 29 18:49:21 2009
+++ src/sys/dev/usb/u3g.c	Thu Nov 12 19:52:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: u3g.c,v 1.7 2009/05/29 18:49:21 plunky Exp $	*/
+/*	$NetBSD: u3g.c,v 1.8 2009/11/12 19:52:14 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2008 AnyWi Technologies
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.7 2009/05/29 18:49:21 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.8 2009/11/12 19:52:14 dyoung Exp $");
 
 #include 
 #include 
@@ -500,26 +500,5 @@
 	}
 }
 
-static int
-u3g_activate(device_t self, enum devact act)
-{
-	struct u3g_softc *sc = device_private(self);
-	int i, rv = 0;
-
-	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-		break;
-
-	case DVACT_DEACTIVATE:
-		for (i = 0; i < sc->numports; i++) {
-			if (sc->sc_ucom[i] && config_deactivate(sc->sc_ucom[i]))
-rv = -1;
-		}
-		break;
-	}
-	return (rv);
-}
-
 CFATTACH_DECL2_NEW(u3g, sizeof(struct u3g_softc), u3g_match,
-u3g_attach, u3g_detach, u3g_activate, NULL, u3g_childdet);
+u3g_attach, u3g_detach, NULL, NULL, u3g_childdet);



CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:51:45 UTC 2009

Modified Files:
src/sys/dev/usb: ubsa.c uchcom.c udsbr.c uep.c uftdi.c ugensa.c

Log Message:
Simplify activation hooks.  (sc_dying must die!)


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/ubsa.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/usb/uchcom.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/udsbr.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/uep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/uftdi.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/ugensa.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/usb/ubsa.c
diff -u src/sys/dev/usb/ubsa.c:1.24 src/sys/dev/usb/ubsa.c:1.25
--- src/sys/dev/usb/ubsa.c:1.24	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/ubsa.c	Thu Nov 12 19:51:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsa.c,v 1.24 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: ubsa.c,v 1.25 2009/11/12 19:51:44 dyoung Exp $	*/
 /*-
  * Copyright (c) 2002, Alexander Kabaev .
  * All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.24 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.25 2009/11/12 19:51:44 dyoung Exp $");
 
 #include 
 #include 
@@ -354,21 +354,12 @@
 ubsa_activate(device_ptr_t self, enum devact act)
 {
 	struct ubsa_softc *sc = device_private(self);
-	int rv = 0;
-	int i;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
 	case DVACT_DEACTIVATE:
-		for (i = 0; i < sc->sc_numif; i++) {
-			if (sc->sc_subdevs[i] != NULL)
-rv |= config_deactivate(sc->sc_subdevs[i]);
-		}
 		sc->sc_dying = 1;
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
-

Index: src/sys/dev/usb/uchcom.c
diff -u src/sys/dev/usb/uchcom.c:1.8 src/sys/dev/usb/uchcom.c:1.9
--- src/sys/dev/usb/uchcom.c:1.8	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uchcom.c	Thu Nov 12 19:51:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uchcom.c,v 1.8 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uchcom.c,v 1.9 2009/11/12 19:51:44 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.8 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.9 2009/11/12 19:51:44 dyoung Exp $");
 
 /*
  * driver for WinChipHead CH341/340, the worst USB-serial chip in the world.
@@ -339,20 +339,15 @@
 uchcom_activate(device_t self, enum devact act)
 {
 	struct uchcom_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
 	case DVACT_DEACTIVATE:
 		close_intr_pipe(sc);
 		sc->sc_dying = 1;
-		if (sc->sc_subdev != NULL)
-			rv = config_deactivate(sc->sc_subdev);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return rv;
 }
 
 static int

Index: src/sys/dev/usb/udsbr.c
diff -u src/sys/dev/usb/udsbr.c:1.16 src/sys/dev/usb/udsbr.c:1.17
--- src/sys/dev/usb/udsbr.c:1.16	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/udsbr.c	Thu Nov 12 19:51:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: udsbr.c,v 1.16 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: udsbr.c,v 1.17 2009/11/12 19:51:44 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udsbr.c,v 1.16 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udsbr.c,v 1.17 2009/11/12 19:51:44 dyoung Exp $");
 
 #include 
 #include 
@@ -176,20 +176,14 @@
 udsbr_activate(device_ptr_t self, enum devact act)
 {
 	struct udsbr_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-		break;
-
 	case DVACT_DEACTIVATE:
 		sc->sc_dying = 1;
-		if (sc->sc_child != NULL)
-			rv = config_deactivate(sc->sc_child);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 int

Index: src/sys/dev/usb/uep.c
diff -u src/sys/dev/usb/uep.c:1.13 src/sys/dev/usb/uep.c:1.14
--- src/sys/dev/usb/uep.c:1.13	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uep.c	Thu Nov 12 19:51:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uep.c,v 1.13 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uep.c,v 1.14 2009/11/12 19:51:44 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uep.c,v 1.13 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uep.c,v 1.14 2009/11/12 19:51:44 dyoung Exp $");
 
 #include 
 #include 
@@ -258,20 +258,14 @@
 uep_activate(device_t self, enum devact act)
 {
 	struct uep_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return EOPNOTSUPP;
-
 	case DVACT_DEACTIVATE:
-		if (sc->sc_wsmousedev != NULL)
-			rv = config_deactivate(sc->sc_wsmousedev);
 		sc->sc_dying = 1;
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-

CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:50:01 UTC 2009

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Simplify activation hook.  (sc_dying must die!)

s/device_ptr_t/device_t/.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/usb/uaudio.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/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.116 src/sys/dev/usb/uaudio.c:1.117
--- src/sys/dev/usb/uaudio.c:1.116	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uaudio.c	Thu Nov 12 19:50:01 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.116 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.117 2009/11/12 19:50:01 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.116 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.117 2009/11/12 19:50:01 dyoung Exp $");
 
 #include 
 #include 
@@ -173,7 +173,7 @@
 	int		sc_mode;	/* play/record capability */
 	struct mixerctl *sc_ctls;	/* mixer controls */
 	int		sc_nctls;	/* # of mixer controls */
-	device_ptr_t	sc_audiodev;
+	device_t	sc_audiodev;
 	struct audio_format *sc_formats;
 	int		sc_nformats;
 	struct audio_encoding_set *sc_encodings;
@@ -471,24 +471,17 @@
 }
 
 int
-uaudio_activate(device_ptr_t self, enum devact act)
+uaudio_activate(device_t self, enum devact act)
 {
-	struct uaudio_softc *sc;
-	int rv;
+	struct uaudio_softc *sc = device_private(self);
 
-	sc = device_private(self);
-	rv = 0;
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return EOPNOTSUPP;
-
 	case DVACT_DEACTIVATE:
-		if (sc->sc_audiodev != NULL)
-			rv = config_deactivate(sc->sc_audiodev);
 		sc->sc_dying = 1;
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return rv;
 }
 
 void



CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:49:03 UTC 2009

Modified Files:
src/sys/dev/usb: ohci.c

Log Message:
Simplify activation hook.  (sc_dying must die!)

unifdef -D__NetBSD__ -U__FreeBSD__ -U__OpenBSD__.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/sys/dev/usb/ohci.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/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.202 src/sys/dev/usb/ohci.c:1.203
--- src/sys/dev/usb/ohci.c:1.202	Thu Nov 12 08:54:00 2009
+++ src/sys/dev/usb/ohci.c	Thu Nov 12 19:49:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.202 2009/11/12 08:54:00 uebayasi Exp $	*/
+/*	$NetBSD: ohci.c,v 1.203 2009/11/12 19:49:03 dyoung Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $	*/
 
 /*
@@ -41,25 +41,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.202 2009/11/12 08:54:00 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.203 2009/11/12 19:49:03 dyoung Exp $");
 
 #include 
 #include 
 #include 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include 
 #include 
 #include 
 #include 
-#elif defined(__FreeBSD__)
-#include 
-#include 
-#include 
-#include 
-#if defined(DIAGNOSTIC) && defined(__i386__) && defined(__FreeBSD__)
-#include 
-#endif
-#endif
 #include 
 #include 
 
@@ -76,25 +66,12 @@
 #include 
 #include 
 
-#if defined(__FreeBSD__)
-#include 
-
-#define delay(d)DELAY(d)
-#endif
 
-#if defined(__OpenBSD__)
-struct cfdriver ohci_cd = {
-	NULL, "ohci", DV_DULL
-};
-#endif
 
 #ifdef OHCI_DEBUG
 #define DPRINTF(x)	if (ohcidebug) logprintf x
 #define DPRINTFN(n,x)	if (ohcidebug>(n)) logprintf x
 int ohcidebug = 0;
-#ifndef __NetBSD__
-#define snprintb((q), (f), "%b", q,f,b,l) snprintf((b), (l))
-#endif
 #else
 #define DPRINTF(x)
 #define DPRINTFN(n,x)
@@ -352,24 +329,18 @@
 	ohci_device_isoc_done,
 };
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int
 ohci_activate(device_t self, enum devact act)
 {
 	struct ohci_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
 	case DVACT_DEACTIVATE:
 		sc->sc_dying = 1;
-		if (sc->sc_child != NULL)
-			rv = config_deactivate(sc->sc_child);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 void
@@ -407,7 +378,6 @@
 
 	return (rv);
 }
-#endif
 
 ohci_soft_ed_t *
 ohci_alloc_sed(ohci_softc_t *sc)
@@ -712,10 +682,8 @@
 	}
 	sc->sc_bus.usbrev = USBREV_1_0;
 
-#ifdef __NetBSD__
 	usb_setup_reserve(sc->sc_dev, &sc->sc_dma_reserve, sc->sc_bus.dmatag,
 	USB_MEM_RESERVE);
-#endif
 
 	/* XXX determine alignment by R/W */
 	/* Allocate the HCCA area. */
@@ -927,9 +895,7 @@
 	sc->sc_bus.methods = &ohci_bus_methods;
 	sc->sc_bus.pipe_size = sizeof(struct ohci_pipe);
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	sc->sc_control = sc->sc_intre = 0;
-#endif
 
 	/* Finally, turn on interrupts. */
 	DPRINTFN(1,("ohci_init: enabling\n"));
@@ -955,31 +921,23 @@
 usbd_status
 ohci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
 {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	struct ohci_softc *sc = bus->hci_private;
-#endif
 	usbd_status status;
 
 	status = usb_allocmem(&sc->sc_bus, size, 0, dma);
-#ifdef __NetBSD__
 	if (status == USBD_NOMEM)
 		status = usb_reserve_allocm(&sc->sc_dma_reserve, dma, size);
-#endif
 	return status;
 }
 
 void
 ohci_freem(struct usbd_bus *bus, usb_dma_t *dma)
 {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	struct ohci_softc *sc = bus->hci_private;
-#endif
-#ifdef __NetBSD__
 	if (dma->block->flags & USB_DMA_RESERVE) {
 		usb_reserve_freem(&sc->sc_dma_reserve, dma);
 		return;
 	}
-#endif
 	usb_freemem(&sc->sc_bus, dma);
 }
 



CVS commit: src/sys/dev/usb

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:46:01 UTC 2009

Modified Files:
src/sys/dev/usb: ehci.c

Log Message:
Simplify activation hook.

(sc_dying must die!)


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/usb/ehci.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/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.162 src/sys/dev/usb/ehci.c:1.163
--- src/sys/dev/usb/ehci.c:1.162	Sun Nov  1 13:26:50 2009
+++ src/sys/dev/usb/ehci.c	Thu Nov 12 19:46:01 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.162 2009/11/01 13:26:50 uebayasi Exp $ */
+/*	$NetBSD: ehci.c,v 1.163 2009/11/12 19:46:01 dyoung Exp $ */
 
 /*
  * Copyright (c) 2004-2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.162 2009/11/01 13:26:50 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.163 2009/11/12 19:46:01 dyoung Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1102,19 +1102,14 @@
 ehci_activate(device_t self, enum devact act)
 {
 	struct ehci_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-
 	case DVACT_DEACTIVATE:
 		sc->sc_dying = 1;
-		if (sc->sc_child != NULL)
-			rv = config_deactivate(sc->sc_child);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return (rv);
 }
 
 /*



CVS commit: src/sys/dev/scsipi

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:44:17 UTC 2009

Modified Files:
src/sys/dev/scsipi: atapiconf.c scsiconf.c

Log Message:
Remove superfluous activation hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/scsipi/atapiconf.c
cvs rdiff -u -r1.254 -r1.255 src/sys/dev/scsipi/scsiconf.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/scsipi/atapiconf.c
diff -u src/sys/dev/scsipi/atapiconf.c:1.80 src/sys/dev/scsipi/atapiconf.c:1.81
--- src/sys/dev/scsipi/atapiconf.c:1.80	Mon Oct 19 18:41:16 2009
+++ src/sys/dev/scsipi/atapiconf.c	Thu Nov 12 19:44:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: atapiconf.c,v 1.80 2009/10/19 18:41:16 bouyer Exp $	*/
+/*	$NetBSD: atapiconf.c,v 1.81 2009/11/12 19:44:17 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.80 2009/10/19 18:41:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.81 2009/11/12 19:44:17 dyoung Exp $");
 
 #include 
 #include 
@@ -53,7 +53,6 @@
 
 static int	atapibusmatch(device_t, cfdata_t, void *);
 static void	atapibusattach(device_t, device_t, void *);
-static int	atapibusactivate(device_t, enum devact);
 static int	atapibusdetach(device_t, int flags);
 static void	atapibuschilddet(device_t, device_t);
 
@@ -64,7 +63,7 @@
 static int	atapibusprint(void *, const char *);
 
 CFATTACH_DECL3_NEW(atapibus, sizeof(struct atapibus_softc),
-atapibusmatch, atapibusattach, atapibusdetach, atapibusactivate, NULL,
+atapibusmatch, atapibusattach, atapibusdetach, NULL, NULL,
 atapibuschilddet, DVF_DETACH_SHUTDOWN);
 
 extern struct cfdriver atapibus_cd;
@@ -164,36 +163,6 @@
 	atapi_probe_bus(sc, -1);
 }
 
-static int
-atapibusactivate(device_t self, enum devact act)
-{
-	struct atapibus_softc *sc = device_private(self);
-	struct scsipi_channel *chan = sc->sc_channel;
-	struct scsipi_periph *periph;
-	int target, error = 0, s;
-
-	s = splbio();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		for (target = 0; target < chan->chan_ntargets; target++) {
-			periph = scsipi_lookup_periph(chan, target, 0);
-			if (periph == NULL)
-continue;
-			error = config_deactivate(periph->periph_dev);
-			if (error)
-goto out;
-		}
-		break;
-	}
- out:
-	splx(s);
-	return (error);
-}
-
 static void
 atapibuschilddet(device_t self, device_t child)
 {

Index: src/sys/dev/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.254 src/sys/dev/scsipi/scsiconf.c:1.255
--- src/sys/dev/scsipi/scsiconf.c:1.254	Wed Oct 21 21:12:05 2009
+++ src/sys/dev/scsipi/scsiconf.c	Thu Nov 12 19:44:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.254 2009/10/21 21:12:05 rmind Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.255 2009/11/12 19:44:17 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.254 2009/10/21 21:12:05 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.255 2009/11/12 19:44:17 dyoung Exp $");
 
 #include 
 #include 
@@ -89,13 +89,12 @@
 
 static int	scsibusmatch(device_t, cfdata_t, void *);
 static void	scsibusattach(device_t, device_t, void *);
-static int	scsibusactivate(device_t, enum devact);
 static int	scsibusdetach(device_t, int flags);
 static int	scsibusrescan(device_t, const char *, const int *);
 static void	scsidevdetached(device_t, device_t);
 
 CFATTACH_DECL3_NEW(scsibus, sizeof(struct scsibus_softc),
-scsibusmatch, scsibusattach, scsibusdetach, scsibusactivate,
+scsibusmatch, scsibusattach, scsibusdetach, NULL,
 scsibusrescan, scsidevdetached, DVF_DETACH_SHUTDOWN);
 
 extern struct cfdriver scsibus_cd;
@@ -236,42 +235,6 @@
 }
 
 static int
-scsibusactivate(device_t self, enum devact act)
-{
-	struct scsibus_softc *sc = device_private(self);
-	struct scsipi_channel *chan = sc->sc_channel;
-	struct scsipi_periph *periph;
-	int target, lun, error = 0, s;
-
-	s = splbio();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		for (target = 0; target < chan->chan_ntargets;
-		 target++) {
-			if (target == chan->chan_id)
-continue;
-			for (lun = 0; lun < chan->chan_nluns; lun++) {
-periph = scsipi_lookup_periph(chan,
-target, lun);
-if (periph == NULL)
-	continue;
-error = config_deactivate(periph->periph_dev);
-if (error)
-	goto out;
-			}
-		}
-		break;
-	}
- out:
-	splx(s);
-	return (error);
-}
-
-static int
 scsibusdetach(device_t self, int flags)
 {
 	struct scsibus_softc *sc = device_private(self);



CVS commit: src/sys/dev/pci

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:41:05 UTC 2009

Modified Files:
src/sys/dev/pci: oboe.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/oboe.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/pci/oboe.c
diff -u src/sys/dev/pci/oboe.c:1.35 src/sys/dev/pci/oboe.c:1.36
--- src/sys/dev/pci/oboe.c:1.35	Tue May 12 08:23:01 2009
+++ src/sys/dev/pci/oboe.c	Thu Nov 12 19:41:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: oboe.c,v 1.35 2009/05/12 08:23:01 cegger Exp $	*/
+/*	$NetBSD: oboe.c,v 1.36 2009/11/12 19:41:05 dyoung Exp $	*/
 
 /*	FVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.35 2009/05/12 08:23:01 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.36 2009/11/12 19:41:05 dyoung Exp $");
 
 #include 
 #include 
@@ -66,7 +66,6 @@
 
 static int oboe_match(device_t parent, cfdata_t match, void *aux);
 static void oboe_attach(device_t parent, device_t self, void *aux);
-static int oboe_activate(device_t self, enum devact act);
 static int oboe_detach(device_t self, int flags);
 
 static int oboe_open(void *h, int flag, int mode, struct lwp *l);
@@ -153,7 +152,7 @@
 static int oboe_setbaud(struct oboe_softc *, int);
 
 CFATTACH_DECL(oboe, sizeof(struct oboe_softc),
-oboe_match, oboe_attach, oboe_detach, oboe_activate);
+oboe_match, oboe_attach, oboe_detach, NULL);
 
 static struct irframe_methods oboe_methods = {
 	oboe_open, oboe_close, oboe_read, oboe_write, oboe_poll,
@@ -244,27 +243,6 @@
 }
 
 static int
-oboe_activate(device_t self, enum devact act)
-{
-	struct oboe_softc *sc = device_private(self);
-	int error = 0;
-
-	DPRINTF(("%s: sc=%p\n", __func__, sc));
-
-	switch (act) {
-	case DVACT_ACTIVATE:
-		return (EOPNOTSUPP);
-		break;
-
-	case DVACT_DEACTIVATE:
-		if (sc->sc_child != NULL)
-			error = config_deactivate(sc->sc_child);
-		break;
-	}
-	return (error);
-}
-
-static int
 oboe_detach(device_t self, int flags)
 {
 	struct oboe_softc *sc = device_private(self);



CVS commit: src/sys/dev/pci

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:40:19 UTC 2009

Modified Files:
src/sys/dev/pci: azalia.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/azalia.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/pci/azalia.c
diff -u src/sys/dev/pci/azalia.c:1.69 src/sys/dev/pci/azalia.c:1.70
--- src/sys/dev/pci/azalia.c:1.69	Wed May  6 09:25:14 2009
+++ src/sys/dev/pci/azalia.c	Thu Nov 12 19:40:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: azalia.c,v 1.69 2009/05/06 09:25:14 cegger Exp $	*/
+/*	$NetBSD: azalia.c,v 1.70 2009/11/12 19:40:19 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: azalia.c,v 1.69 2009/05/06 09:25:14 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: azalia.c,v 1.70 2009/11/12 19:40:19 dyoung Exp $");
 
 #include 
 #include 
@@ -155,7 +155,6 @@
 /* prototypes */
 static int	azalia_pci_match(device_t, cfdata_t, void *);
 static void	azalia_pci_attach(device_t, device_t, void *);
-static int	azalia_pci_activate(device_t, enum devact);
 static int	azalia_pci_detach(device_t, int);
 static bool	azalia_pci_resume(device_t PMF_FN_PROTO);
 static void	azalia_childdet(device_t, device_t);
@@ -226,7 +225,7 @@
 
 /* variables */
 CFATTACH_DECL2_NEW(azalia, sizeof(azalia_t),
-azalia_pci_match, azalia_pci_attach, azalia_pci_detach, azalia_pci_activate,
+azalia_pci_match, azalia_pci_attach, azalia_pci_detach, NULL,
 NULL, azalia_childdet);
 
 static const struct audio_hw_if azalia_hw_if = {
@@ -364,25 +363,6 @@
 	config_interrupts(self, azalia_attach_intr);
 }
 
-static int
-azalia_pci_activate(device_t self, enum devact act)
-{
-	azalia_t *sc;
-	int ret;
-
-	sc = device_private(self);
-	ret = 0;
-	switch (act) {
-	case DVACT_ACTIVATE:
-		return EOPNOTSUPP;
-	case DVACT_DEACTIVATE:
-		if (sc->audiodev != NULL)
-			ret = config_deactivate(sc->audiodev);
-		return ret;
-	}
-	return EOPNOTSUPP;
-}
-
 static void
 azalia_childdet(device_t self, device_t child)
 {



CVS commit: src/sys/dev/pci

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:39:26 UTC 2009

Modified Files:
src/sys/dev/pci: auich.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/pci/auich.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/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.130 src/sys/dev/pci/auich.c:1.131
--- src/sys/dev/pci/auich.c:1.130	Thu Sep  3 14:29:42 2009
+++ src/sys/dev/pci/auich.c	Thu Nov 12 19:39:26 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: auich.c,v 1.130 2009/09/03 14:29:42 sborrill Exp $	*/
+/*	$NetBSD: auich.c,v 1.131 2009/11/12 19:39:26 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.130 2009/09/03 14:29:42 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.131 2009/11/12 19:39:26 dyoung Exp $");
 
 #include 
 #include 
@@ -248,12 +248,10 @@
 static void	auich_attach(device_t, device_t, void *);
 static int	auich_detach(device_t, int);
 static void	auich_childdet(device_t, device_t);
-static int	auich_activate(device_t, enum devact);
 static int	auich_intr(void *);
 
 CFATTACH_DECL2_NEW(auich, sizeof(struct auich_softc),
-auich_match, auich_attach, auich_detach, auich_activate, NULL,
-auich_childdet);
+auich_match, auich_attach, auich_detach, NULL, NULL, auich_childdet);
 
 static int	auich_open(void *, int);
 static void	auich_close(void *);
@@ -689,24 +687,6 @@
 	return;			/* failure of sysctl is not fatal. */
 }
 
-static int
-auich_activate(device_t self, enum devact act)
-{
-	struct auich_softc *sc = device_private(self);
-	int ret;
-
-	ret = 0;
-	switch (act) {
-	case DVACT_ACTIVATE:
-		return EOPNOTSUPP;
-	case DVACT_DEACTIVATE:
-		if (sc->sc_audiodev != NULL)
-			ret = config_deactivate(sc->sc_audiodev);
-		return ret;
-	}
-	return EOPNOTSUPP;
-}
- 
 static void
 auich_childdet(device_t self, device_t child)
 {



CVS commit: src/sys/dev/mii

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:38:35 UTC 2009

Modified Files:
src/sys/dev/mii: mii.c

Log Message:
Simplify activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/mii/mii.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/mii/mii.c
diff -u src/sys/dev/mii/mii.c:1.48 src/sys/dev/mii/mii.c:1.49
--- src/sys/dev/mii/mii.c:1.48	Mon May  5 01:37:56 2008
+++ src/sys/dev/mii/mii.c	Thu Nov 12 19:38:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii.c,v 1.48 2008/05/05 01:37:56 tsutsui Exp $	*/
+/*	$NetBSD: mii.c,v 1.49 2009/11/12 19:38:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.48 2008/05/05 01:37:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.49 2009/11/12 19:38:35 dyoung Exp $");
 
 #include 
 #include 
@@ -176,9 +176,7 @@
 			break;
 
 		case DVACT_DEACTIVATE:
-			if (config_deactivate(child->mii_dev) != 0)
-panic("%s: config_activate(%d) failed",
-device_xname(child->mii_dev), act);
+			break;
 		}
 	}
 }



CVS commit: src/sys/dev

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:37:17 UTC 2009

Modified Files:
src/sys/dev/ic: wdc.c
src/sys/dev/pcmcia: wdc_pcmcia.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pcmcia/wdc_pcmcia.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/ic/wdc.c
diff -u src/sys/dev/ic/wdc.c:1.259 src/sys/dev/ic/wdc.c:1.260
--- src/sys/dev/ic/wdc.c:1.259	Mon Oct 19 18:41:13 2009
+++ src/sys/dev/ic/wdc.c	Thu Nov 12 19:37:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc.c,v 1.259 2009/10/19 18:41:13 bouyer Exp $ */
+/*	$NetBSD: wdc.c,v 1.260 2009/11/12 19:37:17 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.259 2009/10/19 18:41:13 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.260 2009/11/12 19:37:17 dyoung Exp $");
 
 #include "opt_ata.h"
 
@@ -775,34 +775,6 @@
 	ata_channel_attach(chp);
 }
 
-int
-wdcactivate(device_t self, enum devact act)
-{
-	struct atac_softc *atac = device_private(self);
-	struct ata_channel *chp;
-	int s, i, error = 0;
-
-	s = splbio();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		for (i = 0; i < atac->atac_nchannels; i++) {
-			chp = atac->atac_channels[i];
-			if (chp->atabus == NULL)
-continue;
-			error = config_deactivate(chp->atabus);
-			if (error)
-break;
-		}
-		break;
-	}
-	splx(s);
-	return (error);
-}
-
 void
 wdc_childdetached(device_t self, device_t child)
 {

Index: src/sys/dev/pcmcia/wdc_pcmcia.c
diff -u src/sys/dev/pcmcia/wdc_pcmcia.c:1.116 src/sys/dev/pcmcia/wdc_pcmcia.c:1.117
--- src/sys/dev/pcmcia/wdc_pcmcia.c:1.116	Tue May 12 14:42:19 2009
+++ src/sys/dev/pcmcia/wdc_pcmcia.c	Thu Nov 12 19:37:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_pcmcia.c,v 1.116 2009/05/12 14:42:19 cegger Exp $ */
+/*	$NetBSD: wdc_pcmcia.c,v 1.117 2009/11/12 19:37:17 dyoung Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.116 2009/05/12 14:42:19 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.117 2009/11/12 19:37:17 dyoung Exp $");
 
 #include 
 #include 
@@ -89,7 +89,7 @@
 static int wdc_pcmcia_detach(device_t, int);
 
 CFATTACH_DECL_NEW(wdc_pcmcia, sizeof(struct wdc_pcmcia_softc),
-wdc_pcmcia_match, wdc_pcmcia_attach, wdc_pcmcia_detach, wdcactivate);
+wdc_pcmcia_match, wdc_pcmcia_attach, wdc_pcmcia_detach, NULL);
 
 static const struct wdc_pcmcia_product {
 	struct pcmcia_product wdc_product;



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:35:59 UTC 2009

Modified Files:
src/sys/dev/ic: sl811hs.c

Log Message:
Simplify activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/sl811hs.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/ic/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.23 src/sys/dev/ic/sl811hs.c:1.24
--- src/sys/dev/ic/sl811hs.c:1.23	Tue May 12 14:25:18 2009
+++ src/sys/dev/ic/sl811hs.c	Thu Nov 12 19:35:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sl811hs.c,v 1.23 2009/05/12 14:25:18 cegger Exp $	*/
+/*	$NetBSD: sl811hs.c,v 1.24 2009/11/12 19:35:59 dyoung Exp $	*/
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -86,7 +86,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.23 2009/05/12 14:25:18 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.24 2009/11/12 19:35:59 dyoung Exp $");
 
 #include 
 #include 
@@ -1231,19 +1231,15 @@
 int
 slhci_activate(device_t self, enum devact act)
 {
-	struct slhci_softc *sc;
-
-	sc = device_private(self);
-
-	if (act != DVACT_DEACTIVATE)
-		return EOPNOTSUPP;
-
-	slhci_lock_call(sc, &slhci_halt, NULL, NULL);
+	struct slhci_softc *sc = device_private(self);
 
-	if (sc->sc_child)
-		return config_deactivate(sc->sc_child);
-	else
+	switch (act) {
+	case DVACT_DEACTIVATE:
+		slhci_lock_call(sc, &slhci_halt, NULL, NULL);
 		return 0;
+	default:
+		return EOPNOTSUPP;
+	}
 }
 
 void



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:32:14 UTC 2009

Modified Files:
src/sys/dev/ic: awi.c awivar.h

Log Message:
Simplify activation hook.  Replace each use of sc_invalid by either
calling config_deactivate(9) or device_is_active(9).


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/awi.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/awivar.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/dev/ic/awi.c
diff -u src/sys/dev/ic/awi.c:1.84 src/sys/dev/ic/awi.c:1.85
--- src/sys/dev/ic/awi.c:1.84	Tue Sep 15 18:37:02 2009
+++ src/sys/dev/ic/awi.c	Thu Nov 12 19:32:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: awi.c,v 1.84 2009/09/15 18:37:02 dyoung Exp $	*/
+/*	$NetBSD: awi.c,v 1.85 2009/11/12 19:32:14 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.84 2009/09/15 18:37:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.85 2009/11/12 19:32:14 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "bpfilter.h"
@@ -202,13 +202,13 @@
 	sc->sc_attached = 0;
 	sc->sc_substate = AWI_ST_NONE;
 	if ((error = awi_hw_init(sc)) != 0) {
-		sc->sc_invalid = 1;
+		config_deactivate(&sc->sc_dev);
 		splx(s);
 		return error;
 	}
 	error = awi_init_mibs(sc);
 	if (error != 0) {
-		sc->sc_invalid = 1;
+		config_deactivate(&sc->sc_dev);
 		splx(s);
 		return error;
 	}
@@ -303,7 +303,6 @@
 		return 0;
 
 	s = splnet();
-	sc->sc_invalid = 1;
 	awi_stop(ifp, 1);
 
 	while (sc->sc_sleep_cnt > 0) {
@@ -323,21 +322,14 @@
 awi_activate(device_t self, enum devact act)
 {
 	struct awi_softc *sc = device_private(self);
-	struct ifnet *ifp = &sc->sc_if;
-	int s, error = 0;
 
-	s = splnet();
 	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
 	case DVACT_DEACTIVATE:
-		sc->sc_invalid = 1;
-		if_deactivate(ifp);
-		break;
+		if_deactivate(&sc->sc_if);
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	splx(s);
-	return error;
 }
 
 void
@@ -397,10 +389,12 @@
 	};
 #endif
 
-	if (!sc->sc_enabled || !sc->sc_enab_intr || sc->sc_invalid) {
+	if (!sc->sc_enabled || !sc->sc_enab_intr ||
+	!device_is_active(&sc->sc_dev)) {
 		DPRINTF(("awi_intr: stray interrupt: "
 		"enabled %d enab_intr %d invalid %d\n",
-		sc->sc_enabled, sc->sc_enab_intr, sc->sc_invalid));
+		sc->sc_enabled, sc->sc_enab_intr,
+		!device_is_active(&sc->sc_dev)));
 		return 0;
 	}
 
@@ -619,7 +613,7 @@
 
 	ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1);
 
-	if (!sc->sc_invalid) {
+	if (device_is_active(&sc->sc_dev)) {
 		if (sc->sc_cmd_inprog)
 			(void)awi_cmd_wait(sc);
 		(void)awi_cmd(sc, AWI_CMD_KILL_RX, AWI_WAIT);
@@ -641,7 +635,7 @@
 	IFQ_PURGE(&ifp->if_snd);
 
 	if (disable) {
-		if (!sc->sc_invalid)
+		if (device_is_active(&sc->sc_dev))
 			am79c930_gcr_setbits(&sc->sc_chip,
 			AM79C930_GCR_CORESET);
 		if (sc->sc_disable)
@@ -663,7 +657,7 @@
 	u_int32_t txd, frame, ntxd;
 	u_int8_t rate;
 
-	if (!sc->sc_enabled || sc->sc_invalid)
+	if (!sc->sc_enabled || !device_is_active(&sc->sc_dev))
 		return;
 
 	for (;;) {
@@ -797,7 +791,7 @@
 	int ocansleep;
 
 	ifp->if_timer = 0;
-	if (!sc->sc_enabled || sc->sc_invalid)
+	if (!sc->sc_enabled || !device_is_active(&sc->sc_dev))
 		return;
 
 	ocansleep = sc->sc_cansleep;
@@ -1258,7 +1252,6 @@
 	int i, error;
 
 	sc->sc_enab_intr = 0;
-	sc->sc_invalid = 0;	/* XXX: really? */
 	awi_drvstate(sc, AWI_DRV_RESET);
 
 	/* reset firmware */
@@ -1272,7 +1265,7 @@
 
 	/* wait for selftest completion */
 	for (i = 0; ; i++) {
-		if (sc->sc_invalid)
+		if (!device_is_active(&sc->sc_dev))
 			return ENXIO;
 		if (i >= AWI_SELFTEST_TIMEOUT*hz/1000) {
 			printf("%s: failed to complete selftest (timeout)\n",
@@ -1565,12 +1558,12 @@
 
 	i = 0;
 	while (sc->sc_cmd_inprog) {
-		if (sc->sc_invalid)
+		if (!device_is_active(&sc->sc_dev))
 			return ENXIO;
 		if (awi_read_1(sc, AWI_CMD) != sc->sc_cmd_inprog) {
 			printf("%s: failed to access hardware\n",
 			sc->sc_if.if_xname);
-			sc->sc_invalid = 1;
+			config_deactivate(&sc->sc_dev);
 			return ENXIO;
 		}
 		if (sc->sc_cansleep) {
@@ -1672,7 +1665,7 @@
 		 * ioctl requests in progress.
 		 */
 		if (sc->sc_busy) {
-			if (sc->sc_invalid)
+			if (!device_is_active(&sc->sc_dev))
 return ENXIO;
 			return EWOULDBLOCK;
 		}
@@ -1681,7 +1674,7 @@
 		return 0;
 	}
 	while (sc->sc_busy) {
-		if (sc->sc_invalid)
+		if (!device_is_active(&sc->sc_dev))
 			return ENXIO;
 		sc->sc_sleep_cnt++;
 		error = tsleep(sc, PWAIT | PCATCH, "awilck", 0);

Index: src/sys/dev/ic/awivar.h
diff -u src/sys/dev/ic/awivar.h:1.25 src/sys/dev/ic/awivar.h:1.26
--- src/sys/dev/ic/awivar.h:1.25	Tue Sep 15 18:32:00 2009
+++ src/sys/dev/ic/awivar.h	Thu Nov 12 19:32:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: awivar.h,v 1.25 2009/09/15 18:32:00 dyoung Exp $	*/
+/*	$NetBSD: awivar.h,v 1.26 2009/11/12 19:32:14 dyoun

CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:30:49 UTC 2009

Modified Files:
src/sys/dev/ic: atw.c

Log Message:
Simplify activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/dev/ic/atw.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/ic/atw.c
diff -u src/sys/dev/ic/atw.c:1.146 src/sys/dev/ic/atw.c:1.147
--- src/sys/dev/ic/atw.c:1.146	Wed Sep 16 16:34:50 2009
+++ src/sys/dev/ic/atw.c	Thu Nov 12 19:30:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: atw.c,v 1.146 2009/09/16 16:34:50 dyoung Exp $  */
+/*	$NetBSD: atw.c,v 1.147 2009/11/12 19:30:49 dyoung Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.146 2009/09/16 16:34:50 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.147 2009/11/12 19:30:49 dyoung Exp $");
 
 #include "bpfilter.h"
 
@@ -310,20 +310,14 @@
 atw_activate(device_t self, enum devact act)
 {
 	struct atw_softc *sc = device_private(self);
-	int rv = 0, s;
 
-	s = splnet();
 	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
 	case DVACT_DEACTIVATE:
 		if_deactivate(&sc->sc_if);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	splx(s);
-	return rv;
 }
 
 bool



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:29:00 UTC 2009

Modified Files:
src/sys/dev/ic: an.c anvar.h

Log Message:
Simplify activation hook.  Replace each use of sc_invalid by either
calling config_deactivate(9) or device_is_active(9).


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/ic/an.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/anvar.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/dev/ic/an.c
diff -u src/sys/dev/ic/an.c:1.56 src/sys/dev/ic/an.c:1.57
--- src/sys/dev/ic/an.c:1.56	Tue May 12 14:25:17 2009
+++ src/sys/dev/ic/an.c	Thu Nov 12 19:28:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: an.c,v 1.56 2009/05/12 14:25:17 cegger Exp $	*/
+/*	$NetBSD: an.c,v 1.57 2009/11/12 19:28:59 dyoung Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999
  *	Bill Paul .  All rights reserved.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.56 2009/05/12 14:25:17 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.57 2009/11/12 19:28:59 dyoung Exp $");
 
 #include "bpfilter.h"
 
@@ -173,11 +173,10 @@
 	int chan, chan_min, chan_max;
 
 	s = splnet();
-	sc->sc_invalid = 0;
 
 	an_wait(sc);
 	if (an_reset(sc) != 0) {
-		sc->sc_invalid = 1;
+		config_deactivate(sc->sc_dev);
 		splx(s);
 		return 1;
 	}
@@ -417,7 +416,6 @@
 		return 0;
 
 	s = splnet();
-	sc->sc_invalid = 1;
 	an_stop(ifp, 1);
 	ieee80211_ifdetach(ic);
 	if_detach(ifp);
@@ -428,23 +426,15 @@
 int
 an_activate(device_t self, enum devact act)
 {
-	struct an_softc *sc = (struct an_softc *)self;
-	int s, error = 0;
+	struct an_softc *sc = device_private(self);
 
-	s = splnet();
 	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
 	case DVACT_DEACTIVATE:
-		sc->sc_invalid = 1;
 		if_deactivate(&sc->sc_if);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	splx(s);
-
-	return error;
 }
 
 int
@@ -455,8 +445,7 @@
 	int i;
 	u_int16_t status;
 
-	if (!sc->sc_enabled || sc->sc_invalid ||
-	!device_is_active(sc->sc_dev) ||
+	if (!sc->sc_enabled || !device_is_active(sc->sc_dev) ||
 	(ifp->if_flags & IFF_RUNNING) == 0)
 		return 0;
 
@@ -468,12 +457,12 @@
 
 	/* maximum 10 loops per interrupt */
 	for (i = 0; i < 10; i++) {
-		if (!sc->sc_enabled || sc->sc_invalid)
+		if (!sc->sc_enabled || !device_is_active(sc->sc_dev))
 			return 1;
 		if (CSR_READ_2(sc, AN_SW0) != AN_MAGIC) {
 			DPRINTF(("an_intr: magic number changed: %x\n",
 			CSR_READ_2(sc, AN_SW0)));
-			sc->sc_invalid = 1;
+			config_deactivate(sc->sc_dev);
 			return 1;
 		}
 		status = CSR_READ_2(sc, AN_EVENT_STAT);
@@ -665,7 +654,7 @@
 
 	s = splnet();
 	ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1);
-	if (!sc->sc_invalid) {
+	if (device_is_active(sc->sc_dev)) {
 		an_cmd(sc, AN_CMD_FORCE_SYNCLOSS, 0);
 		CSR_WRITE_2(sc, AN_INT_EN, 0);
 		an_cmd(sc, AN_CMD_DISABLE, 0);
@@ -699,9 +688,9 @@
 	u_int16_t len;
 	int cur, fid;
 
-	if (!sc->sc_enabled || sc->sc_invalid) {
+	if (!sc->sc_enabled || !device_is_active(sc->sc_dev)) {
 		DPRINTF(("an_start: noop: enabled %d invalid %d\n",
-		sc->sc_enabled, sc->sc_invalid));
+		sc->sc_enabled, !device_is_active(sc->sc_dev)));
 		return;
 	}
 

Index: src/sys/dev/ic/anvar.h
diff -u src/sys/dev/ic/anvar.h:1.18 src/sys/dev/ic/anvar.h:1.19
--- src/sys/dev/ic/anvar.h:1.18	Tue May 12 14:25:17 2009
+++ src/sys/dev/ic/anvar.h	Thu Nov 12 19:28:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: anvar.h,v 1.18 2009/05/12 14:25:17 cegger Exp $	*/
+/*	$NetBSD: anvar.h,v 1.19 2009/11/12 19:28:59 dyoung Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999
  *	Bill Paul .  All rights reserved.
@@ -114,7 +114,6 @@
 enum ieee80211_state, int);
 
 	int			sc_enabled;
-	int			sc_invalid;
 	int			sc_attached;
 
 	int			sc_bap_id;



CVS commit: src/sys/dev/ic

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:25:08 UTC 2009

Modified Files:
src/sys/dev/ic: aic6360.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/ic/aic6360.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/ic/aic6360.c
diff -u src/sys/dev/ic/aic6360.c:1.97 src/sys/dev/ic/aic6360.c:1.98
--- src/sys/dev/ic/aic6360.c:1.97	Tue Sep 22 12:56:06 2009
+++ src/sys/dev/ic/aic6360.c	Thu Nov 12 19:25:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic6360.c,v 1.97 2009/09/22 12:56:06 tsutsui Exp $	*/
+/*	$NetBSD: aic6360.c,v 1.98 2009/11/12 19:25:08 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995, 1996 Charles M. Hannum.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.97 2009/09/22 12:56:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.98 2009/11/12 19:25:08 dyoung Exp $");
 
 #include "opt_ddb.h"
 
@@ -297,28 +297,6 @@
 }
 
 int
-aic_activate(device_t self, enum devact act)
-{
-	struct aic_softc *sc = device_private(self);
-	int s, rv = 0;
-
-	s = splhigh();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		if (sc->sc_child != NULL)
-			rv = config_deactivate(sc->sc_child);
-		break;
-	}
-	splx(s);
-
-	return (rv);
-}
-
-int
 aic_detach(device_t self, int flags)
 {
 	struct aic_softc *sc = device_private(self);



CVS commit: src/sys/dev/pcmcia

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:24:06 UTC 2009

Modified Files:
src/sys/dev/pcmcia: aic_pcmcia.c

Log Message:
Don't use the superfluous activation hook.

Cosmetic: while I'm here, join two lines.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pcmcia/aic_pcmcia.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/pcmcia/aic_pcmcia.c
diff -u src/sys/dev/pcmcia/aic_pcmcia.c:1.42 src/sys/dev/pcmcia/aic_pcmcia.c:1.43
--- src/sys/dev/pcmcia/aic_pcmcia.c:1.42	Tue Sep 22 13:20:36 2009
+++ src/sys/dev/pcmcia/aic_pcmcia.c	Thu Nov 12 19:24:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic_pcmcia.c,v 1.42 2009/09/22 13:20:36 tsutsui Exp $	*/
+/*	$NetBSD: aic_pcmcia.c,v 1.43 2009/11/12 19:24:06 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.42 2009/09/22 13:20:36 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.43 2009/11/12 19:24:06 dyoung Exp $");
 
 #include 
 #include 
@@ -69,7 +69,7 @@
 static int	aic_pcmcia_enable(device_t, int);
 
 CFATTACH_DECL_NEW(aic_pcmcia, sizeof(struct aic_pcmcia_softc),
-aic_pcmcia_match, aic_pcmcia_attach, aic_pcmcia_detach, aic_activate);
+aic_pcmcia_match, aic_pcmcia_attach, aic_pcmcia_detach, NULL);
 
 static const struct pcmcia_product aic_pcmcia_products[] = {
 	{ PCMCIA_VENDOR_ADAPTEC, PCMCIA_PRODUCT_ADAPTEC_APA1460,
@@ -119,8 +119,7 @@
 
 	error = pcmcia_function_configure(pf, aic_pcmcia_validate_config);
 	if (error) {
-		aprint_error_dev(self, "configure failed, error=%d\n",
-		error);
+		aprint_error_dev(self, "configure failed, error=%d\n", error);
 		return;
 	}
 



CVS commit: src/sys/dev/gpio

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:22:08 UTC 2009

Modified Files:
src/sys/dev/gpio: gpioow.c

Log Message:
Simplify activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/gpio/gpioow.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/gpio/gpioow.c
diff -u src/sys/dev/gpio/gpioow.c:1.11 src/sys/dev/gpio/gpioow.c:1.12
--- src/sys/dev/gpio/gpioow.c:1.11	Sat Aug  8 10:38:17 2009
+++ src/sys/dev/gpio/gpioow.c	Thu Nov 12 19:22:08 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioow.c,v 1.11 2009/08/08 10:38:17 mbalmer Exp $ */
+/* $NetBSD: gpioow.c,v 1.12 2009/11/12 19:22:08 dyoung Exp $ */
 /*	$OpenBSD: gpioow.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpioow.c,v 1.11 2009/08/08 10:38:17 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioow.c,v 1.12 2009/11/12 19:22:08 dyoung Exp $");
 
 /*
  * 1-Wire bus bit-banging through GPIO pin.
@@ -175,18 +175,14 @@
 gpioow_activate(device_t self, enum devact act)
 {
 	struct gpioow_softc *sc = device_private(self);
-	int rv = 0;
 
 	switch (act) {
-	case DVACT_ACTIVATE:
-		return EOPNOTSUPP;
 	case DVACT_DEACTIVATE:
 		sc->sc_dying = 1;
-		if (sc->sc_ow_dev != NULL)
-			rv = config_deactivate(sc->sc_ow_dev);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	return rv;
 }
 
 int



CVS commit: src/sys/dev/cardbus

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:21:04 UTC 2009

Modified Files:
src/sys/dev/cardbus: ahc_cardbus.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/cardbus/ahc_cardbus.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/cardbus/ahc_cardbus.c
diff -u src/sys/dev/cardbus/ahc_cardbus.c:1.28 src/sys/dev/cardbus/ahc_cardbus.c:1.29
--- src/sys/dev/cardbus/ahc_cardbus.c:1.28	Sat May 16 06:44:05 2009
+++ src/sys/dev/cardbus/ahc_cardbus.c	Thu Nov 12 19:21:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahc_cardbus.c,v 1.28 2009/05/16 06:44:05 tsutsui Exp $	*/
+/*	$NetBSD: ahc_cardbus.c,v 1.29 2009/11/12 19:21:03 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2005 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.28 2009/05/16 06:44:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.29 2009/11/12 19:21:03 dyoung Exp $");
 
 #include "opt_ahc_cardbus.h"
 
@@ -88,10 +88,9 @@
 int	ahc_cardbus_match(device_t, cfdata_t, void *);
 void	ahc_cardbus_attach(device_t, device_t, void *);
 int	ahc_cardbus_detach(device_t, int);
-int	ahc_activate(device_t self, enum devact act);
 
 CFATTACH_DECL_NEW(ahc_cardbus, sizeof(struct ahc_cardbus_softc),
-ahc_cardbus_match, ahc_cardbus_attach, ahc_cardbus_detach, ahc_activate);
+ahc_cardbus_match, ahc_cardbus_attach, ahc_cardbus_detach, NULL);
 
 int
 ahc_cardbus_match(device_t parent, cfdata_t match, void *aux)
@@ -285,27 +284,3 @@
 
 	return (0);
 }
-
-
-int
-ahc_activate(device_t self, enum devact act)
-{
-	struct ahc_cardbus_softc *csc = device_private(self);
-	struct ahc_softc *ahc = &csc->sc_ahc;
-	int s, rv = 0;
-
-	s = splhigh();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		if (ahc->sc_child != NULL)
-			rv = config_deactivate(ahc->sc_child);
-		break;
-	}
-	splx(s);
-
-	return (rv);
-}



CVS commit: src/sys/dev/ata

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:20:08 UTC 2009

Modified Files:
src/sys/dev/ata: ata.c

Log Message:
Remove superfluous activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.108 src/sys/dev/ata/ata.c:1.109
--- src/sys/dev/ata/ata.c:1.108	Mon Oct 19 18:41:12 2009
+++ src/sys/dev/ata/ata.c	Thu Nov 12 19:20:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.108 2009/10/19 18:41:12 bouyer Exp $	*/
+/*	$NetBSD: ata.c,v 1.109 2009/11/12 19:20:08 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.108 2009/10/19 18:41:12 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.109 2009/11/12 19:20:08 dyoung Exp $");
 
 #include "opt_ata.h"
 
@@ -474,66 +474,6 @@
 }
 
 /*
- * atabus_activate:
- *
- *	Autoconfiguration activation routine.
- */
-static int
-atabus_activate(device_t self, enum devact act)
-{
-	struct atabus_softc *sc = device_private(self);
-	struct ata_channel *chp = sc->sc_chan;
-	device_t dev = NULL;
-	int s, i, error = 0;
-
-	s = splbio();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
-	case DVACT_DEACTIVATE:
-		/*
-		 * We might deactivate the children of atapibus twice
-		 * (once bia atapibus, once directly), but since the
-		 * generic autoconfiguration code maintains the DVF_ACTIVE
-		 * flag, it's safe.
-		 */
-		if ((dev = chp->atapibus) != NULL) {
-			error = config_deactivate(dev);
-			if (error)
-goto out;
-		}
-
-		for (i = 0; i < chp->ch_ndrive; i++) {
-			if (chp->ch_drive[i].drive_flags & DRIVE_ATAPI)
-continue;
-			if ((dev = chp->ch_drive[i].drv_softc) != NULL) {
-ATADEBUG_PRINT(("atabus_activate: %s: "
-"deactivating %s\n", device_xname(self),
-device_xname(dev)),
-DEBUG_DETACH);
-error = config_deactivate(dev);
-if (error)
-	goto out;
-			}
-		}
-		break;
-	}
- out:
-	splx(s);
-
-#ifdef ATADEBUG
-	if (dev != NULL && error != 0)
-		ATADEBUG_PRINT(("atabus_activate: %s: "
-		"error %d deactivating %s\n", device_xname(self),
-		error, device_xname(dev)), DEBUG_DETACH);
-#endif /* ATADEBUG */
-
-	return (error);
-}
-
-/*
  * atabus_detach:
  *
  *	Autoconfiguration detach routine.
@@ -638,7 +578,7 @@
 }
 
 CFATTACH_DECL3_NEW(atabus, sizeof(struct atabus_softc),
-atabus_match, atabus_attach, atabus_detach, atabus_activate, NULL,
+atabus_match, atabus_attach, atabus_detach, NULL, NULL,
 atabus_childdetached, DVF_DETACH_SHUTDOWN);
 
 /*



CVS commit: src/sys/arch/mips/atheros/dev

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:18:56 UTC 2009

Modified Files:
src/sys/arch/mips/atheros/dev: if_ae.c

Log Message:
Simplify activation hook.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/atheros/dev/if_ae.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/arch/mips/atheros/dev/if_ae.c
diff -u src/sys/arch/mips/atheros/dev/if_ae.c:1.15 src/sys/arch/mips/atheros/dev/if_ae.c:1.16
--- src/sys/arch/mips/atheros/dev/if_ae.c:1.15	Fri Nov  7 00:20:02 2008
+++ src/sys/arch/mips/atheros/dev/if_ae.c	Thu Nov 12 19:18:55 2009
@@ -1,4 +1,4 @@
-/* $Id: if_ae.c,v 1.15 2008/11/07 00:20:02 dyoung Exp $ */
+/* $Id: if_ae.c,v 1.16 2009/11/12 19:18:55 dyoung Exp $ */
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -98,7 +98,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.15 2008/11/07 00:20:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.16 2009/11/12 19:18:55 dyoung Exp $");
 
 #include "bpfilter.h"
 
@@ -453,22 +453,14 @@
 ae_activate(device_t self, enum devact act)
 {
 	struct ae_softc *sc = device_private(self);
-	int s, error = 0;
 
-	s = splnet();
 	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
 	case DVACT_DEACTIVATE:
-		mii_activate(&sc->sc_mii, act, MII_PHY_ANY, MII_OFFSET_ANY);
 		if_deactivate(&sc->sc_ethercom.ec_if);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	splx(s);
-
-	return (error);
 }
 
 /*



CVS commit: src/sys

2009-11-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov 12 19:10:31 UTC 2009

Modified Files:
src/sys/kern: subr_autoconf.c
src/sys/sys: device.h

Log Message:
Move a device-deactivation pattern that is replicated throughout
the system into config_deactivate(dev): deactivate dev and all of
its descendants.  Block all interrupts while calling each device's
activation hook, ca_activate.  Now it is possible to simplify or
to delete several device-activation hooks throughout the system.

Do not deactivate a driver while detaching it!  If the driver was
already deactivated (because of accidental/emergency removal), let
the driver cope with the knowledge that DVF_ACTIVE has been cleared.
Otherwise, let the driver access the underlying hardware (so that
it can flush caches, restore original register settings, et cetera)
until it exits its device-detachment hook.

Let multiple readers and writers simultaneously access the system's
device_t list, alldevs, from either interrupt or thread context:
postpone changing alldevs linkages and freeing autoconf device
structures until a garbage-collection phase that runs after all
readers & writers have left the list.

Give device iterators (deviter(9)) a consistent view of alldevs no
matter whether device_t's are added and deleted during iteration:
keep a global alldevs generation number.  When an iterator enters
alldevs, record the current generation number in the iterator and
increase the global number.  When a device_t is created, label it
with the current global generation number.  When a device_t is
deleted, add a second label, the current global generation number.
During iteration, compare a device_t's added- and deleted-generation
with the iterator's generation and skip a device_t that was deleted
before the iterator entered the list or added after the iterator
entered the list.

The alldevs generation number is never 0.  The garbage collector
reaps device_t's whose delete-generation number is non-zero.

Make alldevs private to sys/kern/subr_autoconf.c.  Use deviter(9)
to access it.


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.124 -r1.125 src/sys/sys/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/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.186 src/sys/kern/subr_autoconf.c:1.187
--- src/sys/kern/subr_autoconf.c:1.186	Mon Oct 12 23:33:02 2009
+++ src/sys/kern/subr_autoconf.c	Thu Nov 12 19:10:30 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.186 2009/10/12 23:33:02 yamt Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.187 2009/11/12 19:10:30 dyoung Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.186 2009/10/12 23:33:02 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.187 2009/11/12 19:10:30 dyoung Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -165,10 +165,13 @@
 static char *number(char *, int);
 static void mapply(struct matchinfo *, cfdata_t);
 static device_t config_devalloc(const device_t, const cfdata_t, const int *);
-static void config_devdealloc(device_t);
+static void config_devdelete(device_t);
 static void config_makeroom(int, struct cfdriver *);
 static void config_devlink(device_t);
-static void config_devunlink(device_t);
+static void config_alldevs_unlock(int);
+static int config_alldevs_lock(void);
+
+static void config_collect_garbage(void);
 
 static void pmflock_debug(device_t, const char *, int);
 
@@ -202,12 +205,12 @@
 static int config_finalize_done;
 
 /* list of all devices */
-struct devicelist alldevs = TAILQ_HEAD_INITIALIZER(alldevs);
-kcondvar_t alldevs_cv;
-kmutex_t alldevs_mtx;
-static int alldevs_nread = 0;
-static int alldevs_nwrite = 0;
-static lwp_t *alldevs_writer = NULL;
+static struct devicelist alldevs = TAILQ_HEAD_INITIALIZER(alldevs);
+static kmutex_t alldevs_mtx;
+static volatile bool alldevs_garbage = false;
+static volatile devgen_t alldevs_gen = 1;
+static volatile int alldevs_nread = 0;
+static volatile int alldevs_nwrite = 0;
 
 static int config_pending;		/* semaphore for mountroot */
 static kmutex_t config_misc_lock;
@@ -238,8 +241,7 @@
 
 	KASSERT(config_initialized == false);
 
-	mutex_init(&alldevs_mtx, MUTEX_DEFAULT, IPL_NONE);
-	cv_init(&alldevs_cv, "alldevs");
+	mutex_init(&alldevs_mtx, MUTEX_DEFAULT, IPL_HIGH);
 
 	mutex_init(&config_misc_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&config_misc_cv, "cfgmisc");
@@ -366,13 +368,21 @@
 int
 config_cfdriver_detach(struct cfdriver *cd)
 {
-	int i;
+	int i, rc = 0, s;
 
+	s = config_alldevs_lock();
+	config_collect_garbage();
 	/* Make sure there are no active instances. */
 	for (i = 0; i < cd->cd_ndevs; i++) {
-		if (cd->cd_devs[i] != NULL)
-			return EBUSY;
+		if (cd->cd_devs[i] != NULL) {
+			rc = EBUSY;
+			break;
+		}
 	}
+	co

CVS commit: src/sys/conf

2009-11-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Nov 12 18:37:10 UTC 2009

Modified Files:
src/sys/conf: files

Log Message:
igsfb needs videomode.


To generate a diff of this commit:
cvs rdiff -u -r1.962 -r1.963 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.962 src/sys/conf/files:1.963
--- src/sys/conf/files:1.962	Wed Nov  4 16:54:00 2009
+++ src/sys/conf/files	Thu Nov 12 18:37:10 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.962 2009/11/04 16:54:00 pooka Exp $
+#	$NetBSD: files,v 1.963 2009/11/12 18:37:10 snj Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20090313
@@ -1079,7 +1079,7 @@
 file	dev/ic/vga_common.c	vga | vga_rasterconsole
 # Integraphics Systems IGA168x and CyberPro framebuffers (linear non-VGA mode)
 #
-device	igsfb: wsemuldisplaydev, wsrasteremulops, rasops8, vcons
+device	igsfb: wsemuldisplaydev, wsrasteremulops, rasops8, vcons, videomode
 file	dev/ic/igsfb.c			igsfb			needs-flag
 file	dev/ic/igsfb_subr.c		igsfb
 



CVS commit: src/sys/arch/i386/conf

2009-11-12 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Thu Nov 12 14:58:09 UTC 2009

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
Turn on Stack Smash Protection (SSP) for the "ALL" kernel to get at least
compile time coverage during a full release build.

Suggested by Mindaugas Rasiukevicius.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/arch/i386/conf/ALL

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/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.218 src/sys/arch/i386/conf/ALL:1.219
--- src/sys/arch/i386/conf/ALL:1.218	Fri Oct  2 18:50:49 2009
+++ src/sys/arch/i386/conf/ALL	Thu Nov 12 14:58:09 2009
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.218 2009/10/02 18:50:49 jmcneill Exp $
+# $NetBSD: ALL,v 1.219 2009/11/12 14:58:09 tron Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,10 +17,12 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.218 $"
+#ident 		"ALL-$Revision: 1.219 $"
 
 maxusers	32		# estimated number of users
 
+makeoptions	USE_SSP=yes
+
 # CPU-related options.
 options 	VM86		# virtual 8086 emulation
 options 	USER_LDT	# user-settable LDT; used by WINE



CVS commit: src/share/mk

2009-11-12 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Thu Nov 12 14:46:37 UTC 2009

Modified Files:
src/share/mk: bsd.README

Log Message:
Remove "USE_SSP_DEFAULT".


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/share/mk/bsd.README

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.257 src/share/mk/bsd.README:1.258
--- src/share/mk/bsd.README:1.257	Thu Nov 12 13:22:34 2009
+++ src/share/mk/bsd.README	Thu Nov 12 14:46:37 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.257 2009/11/12 13:22:34 tron Exp $
+#	$NetBSD: bsd.README,v 1.258 2009/11/12 14:46:37 tron Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -388,11 +388,7 @@
 		detects stack overflows and aborts the program. The
 		stack protecion code imposes a performance penalty
 		of about 5%
-		Default: no, unless "USE_FORT" is set to "yes"
-
-USE_SSP_DEFAULT	The default of "USE_SSP" for part of the tree (e.g. kernels)
-		that are not compiled with "USE_FORT" set to "yes".
-		Default: "yes" for amd64 and i386, "no" otherwise
+		Default: "no", unless "USE_FORT" is set to "yes"
 
 USE_FORT 	If "yes" turns on substitute wrappers for commonly used
 		functions that do not do bounds checking regularly, but



CVS commit: src/share/mk

2009-11-12 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Thu Nov 12 14:30:34 UTC 2009

Modified Files:
src/share/mk: bsd.sys.mk

Log Message:
Revert SSP changes because at least rmind@, pooka@ and haad@ consider
5% more performance more important than the gain in security.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/share/mk/bsd.sys.mk

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

Modified files:

Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.184 src/share/mk/bsd.sys.mk:1.185
--- src/share/mk/bsd.sys.mk:1.184	Thu Nov 12 13:22:34 2009
+++ src/share/mk/bsd.sys.mk	Thu Nov 12 14:30:34 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.184 2009/11/12 13:22:34 tron Exp $
+#	$NetBSD: bsd.sys.mk,v 1.185 2009/11/12 14:30:34 tron Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -59,13 +59,6 @@
 HAS_SSP=	yes
 .endif
 
-.if ((${MACHINE_ARCH} == "amd64") || (${MACHINE_ARCH} == "i386")) && \
- defined(_SRC_TOP_) && (${_SRC_TOP_} != "")
-USE_SSP_DEFAULT?=	yes
-.else
-USE_SSP_DEFAULT?=	no
-.endif
-
 .if defined(USE_FORT) && (${USE_FORT} != "no")
 USE_SSP?=	yes
 .if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules
@@ -73,9 +66,7 @@
 .endif
 .endif
 
-USE_SSP?=	${USE_SSP_DEFAULT}
-
-.if (${USE_SSP} != "no") && (${BINDIR:Ux} != "/usr/mdec")
+.if defined(USE_SSP) && (${USE_SSP} != "no") && (${BINDIR:Ux} != "/usr/mdec")
 .if ${HAS_SSP} == "yes"
 COPTS+=		-fstack-protector -Wstack-protector --param ssp-buffer-size=1
 .endif



CVS commit: src/share/mk

2009-11-12 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Thu Nov 12 13:22:34 UTC 2009

Modified Files:
src/share/mk: bsd.README bsd.sys.mk

Log Message:
Invent a new flag "USE_SSP_DEFAULT" which defines whether we want to use
SSP for building the whole source tree. Set this to "yes" for
NetBSD/amd64 and NetBSD/i386. It is now possible to get the old
behavior (build libs and certain programs with SSP) by setting
"USE_SSP_DEFAULT" to "no".


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/share/mk/bsd.README
cvs rdiff -u -r1.183 -r1.184 src/share/mk/bsd.sys.mk

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.256 src/share/mk/bsd.README:1.257
--- src/share/mk/bsd.README:1.256	Fri Oct 23 22:14:37 2009
+++ src/share/mk/bsd.README	Thu Nov 12 13:22:34 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.256 2009/10/23 22:14:37 joerg Exp $
+#	$NetBSD: bsd.README,v 1.257 2009/11/12 13:22:34 tron Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -385,9 +385,14 @@
 		Default: no
 
 USE_SSP		If "no", disables GCC stack protection code, which
-		detects stack overflows and aborts the program. This
-		imposes some performance penalty.
-		Default: no
+		detects stack overflows and aborts the program. The
+		stack protecion code imposes a performance penalty
+		of about 5%
+		Default: no, unless "USE_FORT" is set to "yes"
+
+USE_SSP_DEFAULT	The default of "USE_SSP" for part of the tree (e.g. kernels)
+		that are not compiled with "USE_FORT" set to "yes".
+		Default: "yes" for amd64 and i386, "no" otherwise
 
 USE_FORT 	If "yes" turns on substitute wrappers for commonly used
 		functions that do not do bounds checking regularly, but
@@ -395,7 +400,7 @@
 		__builtin_object_size() function to determine the buffer 
 		size where it is known and detect buffer overflows.
 		These substitute functions are in /usr/include/ssp.
-		Default: no
+		Default: depends on the part of the source tree
 
 USE_YP		If "no", disables building YP (NIS) support into
 		various system utilities/libraries that support it.

Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.183 src/share/mk/bsd.sys.mk:1.184
--- src/share/mk/bsd.sys.mk:1.183	Thu Nov 12 08:51:50 2009
+++ src/share/mk/bsd.sys.mk	Thu Nov 12 13:22:34 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.183 2009/11/12 08:51:50 tron Exp $
+#	$NetBSD: bsd.sys.mk,v 1.184 2009/11/12 13:22:34 tron Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -61,7 +61,9 @@
 
 .if ((${MACHINE_ARCH} == "amd64") || (${MACHINE_ARCH} == "i386")) && \
  defined(_SRC_TOP_) && (${_SRC_TOP_} != "")
-USE_SSP?=	yes
+USE_SSP_DEFAULT?=	yes
+.else
+USE_SSP_DEFAULT?=	no
 .endif
 
 .if defined(USE_FORT) && (${USE_FORT} != "no")
@@ -71,7 +73,9 @@
 .endif
 .endif
 
-.if defined(USE_SSP) && (${USE_SSP} != "no") && (${BINDIR:Ux} != "/usr/mdec")
+USE_SSP?=	${USE_SSP_DEFAULT}
+
+.if (${USE_SSP} != "no") && (${BINDIR:Ux} != "/usr/mdec")
 .if ${HAS_SSP} == "yes"
 COPTS+=		-fstack-protector -Wstack-protector --param ssp-buffer-size=1
 .endif



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

2009-11-12 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Thu Nov 12 13:17:46 UTC 2009

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

Log Message:
Use proper tag ".man" for man files.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/distrib/sets/lists/xbase/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/xbase/mi
diff -u src/distrib/sets/lists/xbase/mi:1.82 src/distrib/sets/lists/xbase/mi:1.83
--- src/distrib/sets/lists/xbase/mi:1.82	Mon Nov  9 00:36:22 2009
+++ src/distrib/sets/lists/xbase/mi	Thu Nov 12 13:17:46 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.82 2009/11/09 00:36:22 mrg Exp $
+# $NetBSD: mi,v 1.83 2009/11/12 13:17:46 nakayama Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2742,12 +2742,12 @@
 ./usr/X11R7/man/man1/xhost.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xinit.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xinput.1-unknown-	.man,xorg
-./usr/X11R7/man/man1/xkbbell.1-unknown-	man,xorg
+./usr/X11R7/man/man1/xkbbell.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xkbcomp.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xkbevd.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xkbprint.1-unknown-	.man,xorg
-./usr/X11R7/man/man1/xkbvleds.1-unknown-	man,xorg
-./usr/X11R7/man/man1/xkbwatch.1-unknown-	man,xorg
+./usr/X11R7/man/man1/xkbvleds.1-unknown-	.man,xorg
+./usr/X11R7/man/man1/xkbwatch.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xkill.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xload.1-unknown-	.man,xorg
 ./usr/X11R7/man/man1/xlogo.1-unknown-	.man,xorg



CVS commit: src/usr.bin/xinstall

2009-11-12 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Thu Nov 12 10:10:49 UTC 2009

Modified Files:
src/usr.bin/xinstall: xinstall.c

Log Message:
Don't assume that "id_t", "gid_t" and "uid_t" use the same underlying type
and use the appropriate types instead. Tested under NetBSD 5.99.22
and Darwin 10.2.0.

This should fix one of the cross-builds under FreeBSD as reported by
Rhialto on the "current-users" mailing list.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/xinstall/xinstall.c

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

Modified files:

Index: src/usr.bin/xinstall/xinstall.c
diff -u src/usr.bin/xinstall/xinstall.c:1.113 src/usr.bin/xinstall/xinstall.c:1.114
--- src/usr.bin/xinstall/xinstall.c:1.113	Fri Oct 30 20:57:30 2009
+++ src/usr.bin/xinstall/xinstall.c	Thu Nov 12 10:10:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: xinstall.c,v 1.113 2009/10/30 20:57:30 joerg Exp $	*/
+/*	$NetBSD: xinstall.c,v 1.114 2009/11/12 10:10:49 tron Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)xinstall.c	8.1 (Berkeley) 7/21/93";
 #else
-__RCSID("$NetBSD: xinstall.c,v 1.113 2009/10/30 20:57:30 joerg Exp $");
+__RCSID("$NetBSD: xinstall.c,v 1.114 2009/11/12 10:10:49 tron Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,7 +88,8 @@
 int	numberedbackup;
 int	mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
 char	pathbuf[MAXPATHLEN];
-id_t	uid = -1, gid = -1;
+uid_t	uid = -1;
+gid_t	gid = -1;
 char	*group, *owner, *fflags, *tags;
 FILE	*metafp;
 char	*metafile;
@@ -312,13 +313,21 @@
 
 	/* get group and owner id's */
 	if (group && !dounpriv) {
-		if (gid_from_group(group, &gid) == -1 && ! parseid(group, &gid))
-			errx(1, "unknown group %s", group);
+		if (gid_from_group(group, &gid) == -1) {
+			id_t id;
+			if (!parseid(group, &id))
+errx(1, "unknown group %s", group);
+			gid = id;
+		}
 		iflags |= HASGID;
 	}
 	if (owner && !dounpriv) {
-		if (uid_from_user(owner, &uid) == -1 && ! parseid(owner, &uid))
-			errx(1, "unknown user %s", owner);
+		if (uid_from_user(owner, &uid) == -1) {
+			id_t id;
+			if (!parseid(owner, &id))
+errx(1, "unknown user %s", owner);
+			uid = id;
+		}
 		iflags |= HASUID;
 	}
 



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 09:04:30 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: uhci.c

Log Message:
Sort struct usbd_bus_methods member initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.208.12.6 -r1.208.12.7 src/sys/dev/usb/uhci.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/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.208.12.6 src/sys/dev/usb/uhci.c:1.208.12.7
--- src/sys/dev/usb/uhci.c:1.208.12.6	Wed May 21 05:03:27 2008
+++ src/sys/dev/usb/uhci.c	Thu Nov 12 09:04:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.208.12.6 2008/05/21 05:03:27 itohy Exp $	*/
+/*	$NetBSD: uhci.c,v 1.208.12.7 2009/11/12 09:04:30 uebayasi Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhci.c,v 1.172 2006/10/19 01:15:58 iedowse Exp $	*/
 
 /*-
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.208.12.6 2008/05/21 05:03:27 itohy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.208.12.7 2009/11/12 09:04:30 uebayasi Exp $");
 /* __FBSDID("$FreeBSD: src/sys/dev/usb/uhci.c,v 1.172 2006/10/19 01:15:58 iedowse Exp $"); */
 
 #include 
@@ -370,13 +370,13 @@
 	uhci_poll,
 	uhci_allocm,
 	uhci_freem,
+	uhci_allocx,
+	uhci_freex,
 	uhci_map_alloc,
 	uhci_map_free,
 	uhci_mapm,
 	uhci_mapm_mbuf,
 	uhci_unmapm,
-	uhci_allocx,
-	uhci_freex,
 };
 
 const struct usbd_pipe_methods uhci_root_ctrl_methods = {



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 09:04:11 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: ehci.c

Log Message:
Sort struct usbd_bus_methods member initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.123.12.4 -r1.123.12.5 src/sys/dev/usb/ehci.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/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.123.12.4 src/sys/dev/usb/ehci.c:1.123.12.5
--- src/sys/dev/usb/ehci.c:1.123.12.4	Wed May 21 05:26:13 2008
+++ src/sys/dev/usb/ehci.c	Thu Nov 12 09:04:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.123.12.4 2008/05/21 05:26:13 itohy Exp $ */
+/*	$NetBSD: ehci.c,v 1.123.12.5 2009/11/12 09:04:11 uebayasi Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005, 2007 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.123.12.4 2008/05/21 05:26:13 itohy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.123.12.5 2009/11/12 09:04:11 uebayasi Exp $");
 /* __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/ehci.c,v 1.52 2006/10/19 01:15:58 iedowse Exp $"); */
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -300,13 +300,13 @@
 	ehci_poll,
 	ehci_allocm,
 	ehci_freem,
+	ehci_allocx,
+	ehci_freex,
 	ehci_map_alloc,
 	ehci_map_free,
 	ehci_mapm,
 	ehci_mapm_mbuf,
 	ehci_unmapm,
-	ehci_allocx,
-	ehci_freex,
 };
 
 Static const struct usbd_pipe_methods ehci_root_ctrl_methods = {



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:59:08 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: ohci.c

Log Message:
Sort struct usbd_bus_methods member initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.182.12.5 -r1.182.12.6 src/sys/dev/usb/ohci.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/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.182.12.5 src/sys/dev/usb/ohci.c:1.182.12.6
--- src/sys/dev/usb/ohci.c:1.182.12.5	Thu Nov 12 08:50:05 2009
+++ src/sys/dev/usb/ohci.c	Thu Nov 12 08:59:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.182.12.5 2009/11/12 08:50:05 uebayasi Exp $	*/
+/*	$NetBSD: ohci.c,v 1.182.12.6 2009/11/12 08:59:08 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2004, 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.182.12.5 2009/11/12 08:50:05 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.182.12.6 2009/11/12 08:59:08 uebayasi Exp $");
 /* __FBSDID("$FreeBSD: src/sys/dev/usb/ohci.c,v 1.167 2006/10/19 01:15:58 iedowse Exp $"); */
 
 #include 
@@ -341,13 +341,13 @@
 	ohci_poll,
 	ohci_allocm,
 	ohci_freem,
+	ohci_allocx,
+	ohci_freex,
 	ohci_map_alloc,
 	ohci_map_free,
 	ohci_mapm,
 	ohci_mapm_mbuf,
 	ohci_unmapm,
-	ohci_allocx,
-	ohci_freex,
 };
 
 Static const struct usbd_pipe_methods ohci_root_ctrl_methods = {



CVS commit: src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:54:00 UTC 2009

Modified Files:
src/sys/dev/usb: ohci.c

Log Message:
Comment & whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/dev/usb/ohci.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/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.201 src/sys/dev/usb/ohci.c:1.202
--- src/sys/dev/usb/ohci.c:1.201	Sun Nov  1 06:36:44 2009
+++ src/sys/dev/usb/ohci.c	Thu Nov 12 08:54:00 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.201 2009/11/01 06:36:44 uebayasi Exp $	*/
+/*	$NetBSD: ohci.c,v 1.202 2009/11/12 08:54:00 uebayasi Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $	*/
 
 /*
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.201 2009/11/01 06:36:44 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.202 2009/11/12 08:54:00 uebayasi Exp $");
 
 #include 
 #include 
@@ -1231,7 +1231,7 @@
 		 */
 		ohci_rhsc(sc, sc->sc_intrxfer);
 		/* Do not allow RHSC interrupts > 1 per second */
-usb_callout(sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
+		usb_callout(sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
 	}
 
 	sc->sc_bus.intr_context--;
@@ -1812,7 +1812,7 @@
 	opipe->tail.td = tail;
 	OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
 	if (xfer->timeout && !sc->sc_bus.use_polling) {
-usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
+		usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
 			ohci_timeout, xfer);
 	}
 	splx(s);
@@ -2416,7 +2416,7 @@
 	{0x00, 0x01},		/* USB version */
 	UDCLASS_HUB,		/* class */
 	UDSUBCLASS_HUB,		/* subclass */
-	UDPROTO_FSHUB,
+	UDPROTO_FSHUB,		/* protocol */
 	64,			/* max packet */
 	{0},{0},{0x00,0x01},	/* device id */
 	1,2,0,			/* string indicies */
@@ -3041,7 +3041,7 @@
 	BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 	OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF);
 	if (xfer->timeout && !sc->sc_bus.use_polling) {
-usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
+		usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
 			ohci_timeout, xfer);
 	}
 



CVS commit: src/share/mk

2009-11-12 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Thu Nov 12 08:51:50 UTC 2009

Modified Files:
src/share/mk: bsd.sys.mk

Log Message:
Fix broken conditional to get manual builds (not using "build.sh")
working again.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/share/mk/bsd.sys.mk

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

Modified files:

Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.182 src/share/mk/bsd.sys.mk:1.183
--- src/share/mk/bsd.sys.mk:1.182	Wed Nov 11 16:35:45 2009
+++ src/share/mk/bsd.sys.mk	Thu Nov 12 08:51:50 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.182 2009/11/11 16:35:45 tron Exp $
+#	$NetBSD: bsd.sys.mk,v 1.183 2009/11/12 08:51:50 tron Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -59,8 +59,8 @@
 HAS_SSP=	yes
 .endif
 
-.if ((${MACHINE_ARCH} == "amd64") || (${MACHINE_ARCH} == "i386") && \
- (_SRC_TOP_ != ""))
+.if ((${MACHINE_ARCH} == "amd64") || (${MACHINE_ARCH} == "i386")) && \
+ defined(_SRC_TOP_) && (${_SRC_TOP_} != "")
 USE_SSP?=	yes
 .endif
 



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:50:26 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: ohci.c

Log Message:
USB_DEBUG -> OHCI_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.182.12.4 -r1.182.12.5 src/sys/dev/usb/ohci.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/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.182.12.4 src/sys/dev/usb/ohci.c:1.182.12.5
--- src/sys/dev/usb/ohci.c:1.182.12.4	Wed May 21 05:26:13 2008
+++ src/sys/dev/usb/ohci.c	Thu Nov 12 08:50:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.182.12.4 2008/05/21 05:26:13 itohy Exp $	*/
+/*	$NetBSD: ohci.c,v 1.182.12.5 2009/11/12 08:50:05 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2004, 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.182.12.4 2008/05/21 05:26:13 itohy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.182.12.5 2009/11/12 08:50:05 uebayasi Exp $");
 /* __FBSDID("$FreeBSD: src/sys/dev/usb/ohci.c,v 1.167 2006/10/19 01:15:58 iedowse Exp $"); */
 
 #include 
@@ -93,7 +93,7 @@
 };
 #endif
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 #define DPRINTF(x)	if (ohcidebug) logprintf x
 #define DPRINTFN(n,x)	if (ohcidebug>(n)) logprintf x
 int ohcidebug = 0;
@@ -252,7 +252,7 @@
 Static void		ohci_aux_dma_sync(ohci_softc_t *,
 			struct ohci_aux_mem *, int /*op*/);
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 Static void		ohci_dumpregs(ohci_softc_t *);
 Static void		ohci_dump_tds(ohci_softc_t *, ohci_soft_td_t *);
 Static void		ohci_dump_td(ohci_softc_t *, ohci_soft_td_t *);
@@ -1059,7 +1059,7 @@
 	USB_MEM_SYNC(&sc->sc_dmatag, &sc->sc_hccadma,
 	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 15) {
 		for (i = 0; i < OHCI_NO_EDS; i++) {
 			printf("ed#%d ", i);
@@ -1174,7 +1174,7 @@
 		printf("%s: reset timeout\n", USBDEVNAME(sc->sc_bus.bdev));
 		return (USBD_IOERROR);
 	}
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 15)
 		ohci_dumpregs(sc);
 #endif
@@ -1223,7 +1223,7 @@
 		sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A));
 	}
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 5)
 		ohci_dumpregs(sc);
 #endif
@@ -1668,7 +1668,7 @@
 	u_int32_t ctl;
 	int s;
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	DPRINTF(("ohci_power: sc=%p, why=%d\n", sc, why));
 	ohci_dumpregs(sc);
 #endif
@@ -1721,7 +1721,7 @@
 	splx(s);
 }
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 void
 ohci_dumpregs(ohci_softc_t *sc)
 {
@@ -1897,7 +1897,7 @@
 	splx(s);
 }
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 const char *ohci_cc_strs[] = {
 	"NO_ERROR",
 	"CRC",
@@ -1977,7 +1977,7 @@
 
 	DPRINTFN(10,("ohci_softintr: sdone=%p sidone=%p\n", sdone, sidone));
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 10) {
 		DPRINTF(("ohci_process_done: TD done:\n"));
 		ohci_dump_tds(sc, sdone);
@@ -2061,7 +2061,7 @@
 		ohci_transfer_complete(xfer, 0);
 	}
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 10) {
 		DPRINTF(("ohci_softintr: ITD done:\n"));
 		ohci_dump_itds(sc, sidone);
@@ -2257,7 +2257,7 @@
 			break;
 		intrs = OREAD4(sc, OHCI_INTERRUPT_STATUS) & sc->sc_eintrs;
 		DPRINTFN(15,("ohci_waitintr: 0x%04x\n", intrs));
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 		if (ohcidebug > 15)
 			ohci_dumpregs(sc);
 #endif
@@ -2278,7 +2278,7 @@
 ohci_poll(struct usbd_bus *bus)
 {
 	ohci_softc_t *sc = (ohci_softc_t *)bus;
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	static int last;
 	int new;
 	new = OREAD4(sc, OHCI_INTERRUPT_STATUS);
@@ -2377,7 +2377,7 @@
 	stat->xfer = xfer;
 	OHCI_STD_SYNC(sc, stat, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 5) {
 		DPRINTF(("ohci_device_request:\n"));
 		ohci_dump_ed(sc, sed);
@@ -2398,7 +2398,7 @@
 	}
 	splx(s);
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 20) {
 		delay(1);
 		DPRINTF(("ohci_device_request: status=%x\n",
@@ -2581,7 +2581,7 @@
 	splx(s);
 }
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 void
 ohci_dump_tds(ohci_softc_t *sc, ohci_soft_td_t *std)
 {
@@ -2803,7 +2803,7 @@
 #ifdef USB_DEBUG
 		usbd_dump_pipe(&opipe->pipe);
 #endif
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 		ohci_dump_ed(sc, sed);
 		if (std)
 			ohci_dump_td(sc, std);
@@ -2926,7 +2926,7 @@
 		return;
 	}
 #endif
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 1) {
 		DPRINTF(("ohci_abort_xfer: sed=\n"));
 		ohci_dump_ed(sc, sed);
@@ -3620,7 +3620,7 @@
 		(int)O32TOH(data->td.td_cbp),
 		(int)O32TOH(data->td.td_be)));
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 5) {
 		ohci_dump_ed(sc, sed);
 		ohci_dump_tds(sc, data);
@@ -3799,7 +3799,7 @@
 	xfer->actlen = 0;
 	OHCI_STD_SYNC(sc, data, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 	if (ohcidebug > 5) {
 		DPRINTF(("ohci_device_intr_insert:\n"));
 		ohci_dump_ed(sc, sed);
@@ -4224,7 +4224,

CVS commit: src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:41:49 UTC 2009

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/usb/usb_subr.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/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.165 src/sys/dev/usb/usb_subr.c:1.166
--- src/sys/dev/usb/usb_subr.c:1.165	Wed Nov 11 15:49:05 2009
+++ src/sys/dev/usb/usb_subr.c	Thu Nov 12 08:41:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.165 2009/11/11 15:49:05 pooka Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.166 2009/11/12 08:41:49 uebayasi Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.165 2009/11/11 15:49:05 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.166 2009/11/12 08:41:49 uebayasi Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usbverbose.h"
@@ -68,10 +68,8 @@
 
 Static usbd_status usbd_set_config(usbd_device_handle, int);
 Static void usbd_devinfo(usbd_device_handle, int, char *, size_t);
-Static void usbd_devinfo_vp(usbd_device_handle dev,
-			char *v,
-			char *p, int usedev,
-			int useencoded );
+Static void usbd_devinfo_vp(usbd_device_handle dev, char *v, char *p,
+			int usedev, int useencoded);
 Static int usbd_getnewaddr(usbd_bus_handle bus);
 Static int usbd_print(void *, const char *);
 Static int usbd_ifprint(void *, const char *);
@@ -190,8 +188,8 @@
 }
 
 Static void
-usbd_devinfo_vp(usbd_device_handle dev, char *v,
-		char *p, int usedev, int useencoded)
+usbd_devinfo_vp(usbd_device_handle dev, char *v, char *p, int usedev,
+		int useencoded)
 {
 	usb_device_descriptor_t *udd = &dev->ddesc;
 #ifdef USBVERBOSE



CVS commit: src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:32:57 UTC 2009

Modified Files:
src/sys/dev/usb: usbdi_util.h

Log Message:
Whitespace & style.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/usbdi_util.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/dev/usb/usbdi_util.h
diff -u src/sys/dev/usb/usbdi_util.h:1.40 src/sys/dev/usb/usbdi_util.h:1.41
--- src/sys/dev/usb/usbdi_util.h:1.40	Fri Sep  4 17:53:12 2009
+++ src/sys/dev/usb/usbdi_util.h	Thu Nov 12 08:32:57 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi_util.h,v 1.40 2009/09/04 17:53:12 dyoung Exp $	*/
+/*	$NetBSD: usbdi_util.h,v 1.41 2009/11/12 08:32:57 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -63,8 +63,8 @@
 usbd_status	usbd_get_report(usbd_interface_handle iface, int type, int id,
 void *data, int len);
 usbd_status	usbd_set_idle(usbd_interface_handle iface, int duration,int id);
-usbd_status	usbd_read_report_desc(usbd_interface_handle, void **,
-  int *, struct malloc_type *);
+usbd_status	usbd_read_report_desc(usbd_interface_handle ifc, void **descp,
+  int *sizep, struct malloc_type *mem);
 usbd_status	usbd_get_config(usbd_device_handle dev, u_int8_t *conf);
 usbd_status	usbd_get_string_desc(usbd_device_handle dev, int sindex,
  int langid,usb_string_descriptor_t *sdesc,



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:30:16 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: usbdi_util.h

Log Message:
_USBI_UTIL_H_ -> _USBDI_UTIL_H_


To generate a diff of this commit:
cvs rdiff -u -r1.36.12.1 -r1.36.12.2 src/sys/dev/usb/usbdi_util.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/dev/usb/usbdi_util.h
diff -u src/sys/dev/usb/usbdi_util.h:1.36.12.1 src/sys/dev/usb/usbdi_util.h:1.36.12.2
--- src/sys/dev/usb/usbdi_util.h:1.36.12.1	Tue May 22 14:57:50 2007
+++ src/sys/dev/usb/usbdi_util.h	Thu Nov 12 08:30:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi_util.h,v 1.36.12.1 2007/05/22 14:57:50 itohy Exp $	*/
+/*	$NetBSD: usbdi_util.h,v 1.36.12.2 2009/11/12 08:30:16 uebayasi Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi_util.h,v 1.21 2007/01/03 10:50:03 luigi Exp $	*/
 
 /*-
@@ -38,8 +38,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _USBI_UTIL_H_
-#define _USBI_UTIL_H_
+#ifndef _USBDI_UTIL_H_
+#define _USBDI_UTIL_H_
 
 usbd_status	usbd_get_desc(usbd_device_handle dev, int type,
 			  int index, int len, void *desc);
@@ -106,4 +106,4 @@
 	 usb_interface_descriptor_t *id);
 #define USBD_CDCSUBTYPE_ANY (~0)
 
-#endif	/* _USBI_UTIL_H_ */
+#endif	/* _USBDI_UTIL_H_ */



CVS commit: src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:28:31 UTC 2009

Modified Files:
src/sys/dev/usb: usbdi_util.c

Log Message:
usbd_do_request_flags(..., 0, 0, USBD_CONFIG_TIMEOUT) is equivalent to
usbd_do_request(...).  Remove an unneeded cast.  No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/usb/usbdi_util.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/usb/usbdi_util.c
diff -u src/sys/dev/usb/usbdi_util.c:1.52 src/sys/dev/usb/usbdi_util.c:1.53
--- src/sys/dev/usb/usbdi_util.c:1.52	Sun Aug 16 13:20:40 2009
+++ src/sys/dev/usb/usbdi_util.c	Thu Nov 12 08:28:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi_util.c,v 1.52 2009/08/16 13:20:40 martin Exp $	*/
+/*	$NetBSD: usbdi_util.c,v 1.53 2009/11/12 08:28:31 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.52 2009/08/16 13:20:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.53 2009/11/12 08:28:31 uebayasi Exp $");
 
 #include 
 #include 
@@ -68,8 +68,7 @@
 	USETW2(req.wValue, type, index);
 	USETW(req.wIndex, 0);
 	USETW(req.wLength, len);
-	return (usbd_do_request_flags(dev, &req, desc, 0, 0,
-	USBD_CONFIG_TIMEOUT));
+	return (usbd_do_request(dev, &req, desc));
 }
 
 usbd_status
@@ -440,7 +439,7 @@
 		splx(s);
 		return (err);
 	}
-	error = tsleep((void *)xfer, PZERO | PCATCH, lbl, 0);
+	error = tsleep(xfer, PZERO | PCATCH, lbl, 0);
 	splx(s);
 	if (error) {
 		DPRINTF(("usbd_bulk_transfer: tsleep=%d\n", error));



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:17:32 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: usbdivar.h

Log Message:
Sort members in struct usbd_bus_methods.  Comments.


To generate a diff of this commit:
cvs rdiff -u -r1.80.12.4 -r1.80.12.5 src/sys/dev/usb/usbdivar.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/dev/usb/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.80.12.4 src/sys/dev/usb/usbdivar.h:1.80.12.5
--- src/sys/dev/usb/usbdivar.h:1.80.12.4	Wed May 21 05:04:03 2008
+++ src/sys/dev/usb/usbdivar.h	Thu Nov 12 08:17:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.80.12.4 2008/05/21 05:04:03 itohy Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.80.12.5 2009/11/12 08:17:31 uebayasi Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.47 2006/09/07 00:06:42 imp Exp $	*/
 
 /*-
@@ -67,18 +67,31 @@
 	usbd_status	  (*open_pipe)(struct usbd_pipe *pipe);
 	void		  (*soft_intr)(void *);
 	void		  (*do_poll)(struct usbd_bus *);
+/* XXX API change */
+#if 0
+	usbd_status	  (*allocm)(struct usbd_bus *, usb_dma_t *,
+	u_int32_t bufsize);
+	void		  (*freem)(struct usbd_bus *, usb_dma_t *);
+#else
 	usbd_status	  (*allocm)(struct usbd_bus *, usbd_xfer_handle,
 	void *, size_t);
 	void		  (*freem)(struct usbd_bus *, usbd_xfer_handle,
    enum usbd_waitflg);
+#endif
+/* XXX API change */
+#if 0
+	struct usbd_xfer *(*allocx)(struct usbd_bus *);
+#else
+	struct usbd_xfer *(*allocx)(struct usbd_bus *, usbd_pipe_handle,
+	enum usbd_waitflg);
+#endif
+	void		  (*freex)(struct usbd_bus *, struct usbd_xfer *);
 	usbd_status	  (*map_alloc)(usbd_xfer_handle);
 	void		  (*map_free)(usbd_xfer_handle);
 	void		  (*mapm)(usbd_xfer_handle, void *, size_t);
+	/* XXXUEBAYASI should not belong here */
 	usbd_status	  (*mapm_mbuf)(usbd_xfer_handle, struct mbuf *);
 	void		  (*unmapm)(usbd_xfer_handle);
-	struct usbd_xfer *(*allocx)(struct usbd_bus *, usbd_pipe_handle,
-	enum usbd_waitflg);
-	void		  (*freex)(struct usbd_bus *, struct usbd_xfer *);
 };
 
 struct usbd_pipe_methods {



CVS commit: src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:16:50 UTC 2009

Modified Files:
src/sys/dev/usb: usbdivar.h

Log Message:
Indent.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/usb/usbdivar.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/dev/usb/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.89 src/sys/dev/usb/usbdivar.h:1.90
--- src/sys/dev/usb/usbdivar.h:1.89	Fri Sep  4 17:53:12 2009
+++ src/sys/dev/usb/usbdivar.h	Thu Nov 12 08:16:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.89 2009/09/04 17:53:12 dyoung Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.90 2009/11/12 08:16:50 uebayasi Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $	*/
 
 /*
@@ -239,9 +239,9 @@
 usbd_interface_handle iface,
 struct usbd_endpoint *, int,
 usbd_pipe_handle *pipe);
-usbd_status usbd_new_device(device_t, usbd_bus_handle, int, int, int,
+usbd_status	usbd_new_device(device_t, usbd_bus_handle, int, int, int,
 struct usbd_port *);
-usbd_status usbd_reattach_device(device_t, usbd_device_handle,
+usbd_status	usbd_reattach_device(device_t, usbd_device_handle,
  int, const int *);
 
 void		usbd_remove_device(usbd_device_handle, struct usbd_port *);
@@ -251,7 +251,7 @@
 
 usbd_status	usb_insert_transfer(usbd_xfer_handle);
 void		usb_transfer_complete(usbd_xfer_handle);
-void usb_disconnect_port(struct usbd_port *, device_t);
+void		usb_disconnect_port(struct usbd_port *, device_t);
 
 /* Routines from usb.c */
 void		usb_needs_explore(usbd_device_handle);



CVS commit: [itohy-usb1] src/sys/dev/usb

2009-11-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 12 08:04:05 UTC 2009

Modified Files:
src/sys/dev/usb [itohy-usb1]: usbdi.c

Log Message:
Reduce diff to HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.119.12.7 -r1.119.12.8 src/sys/dev/usb/usbdi.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/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.119.12.7 src/sys/dev/usb/usbdi.c:1.119.12.8
--- src/sys/dev/usb/usbdi.c:1.119.12.7	Thu Nov 12 07:55:42 2009
+++ src/sys/dev/usb/usbdi.c	Thu Nov 12 08:04:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.119.12.7 2009/11/12 07:55:42 uebayasi Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.119.12.8 2009/11/12 08:04:04 uebayasi Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.c,v 1.99 2006/11/27 18:39:02 marius Exp $	*/
 
 /*-
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.119.12.7 2009/11/12 07:55:42 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.119.12.8 2009/11/12 08:04:04 uebayasi Exp $");
 /* __FBSDID("$FreeBSD: src/sys/dev/usb/usbdi.c,v 1.99 2006/11/27 18:39:02 marius Exp $"); */
 
 #ifdef __NetBSD__
@@ -738,9 +738,9 @@
 }
 
 usbd_status
-usbd_abort_default_pipe(usbd_device_handle dev)
+usbd_abort_default_pipe(usbd_device_handle device)
 {
-	return (usbd_abort_pipe(dev->default_pipe));
+	return usbd_abort_pipe(device->default_pipe);
 }
 
 usbd_status