CVS commit: src/sys/dev/dkwedge

2009-07-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul  2 00:56:48 UTC 2009

Modified Files:
src/sys/dev/dkwedge: dk.c

Log Message:
Extract subroutine dklastclose().  This is a step toward detachable
dk(4).


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.45 src/sys/dev/dkwedge/dk.c:1.46
--- src/sys/dev/dkwedge/dk.c:1.45	Tue May 12 14:19:40 2009
+++ src/sys/dev/dkwedge/dk.c	Thu Jul  2 00:56:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.45 2009/05/12 14:19:40 cegger Exp $	*/
+/*	$NetBSD: dk.c,v 1.46 2009/07/02 00:56:48 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.45 2009/05/12 14:19:40 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.46 2009/07/02 00:56:48 dyoung Exp $);
 
 #include opt_dkwedge.h
 
@@ -94,6 +94,8 @@
 static void	dkiodone(struct buf *);
 static void	dkrestart(void *);
 
+static int	dklastclose(struct dkwedge_softc *);
+
 static dev_type_open(dkopen);
 static dev_type_close(dkclose);
 static dev_type_read(dkread);
@@ -954,6 +956,23 @@
 }
 
 /*
+ * Caller must hold sc-sc_dk.dk_openlock and sc-sc_parent-dk_rawlock.
+ */
+static int
+dklastclose(struct dkwedge_softc *sc)
+{
+	int error = 0;
+
+	if (sc-sc_parent-dk_rawopens-- == 1) {
+		KASSERT(sc-sc_parent-dk_rawvp != NULL);
+		error = vn_close(sc-sc_parent-dk_rawvp,
+		FREAD | FWRITE, NOCRED);
+		sc-sc_parent-dk_rawvp = NULL;
+	}
+	return error;
+}
+
+/*
  * dkclose:		[devsw entry point]
  *
  *	Close a wedge.
@@ -976,14 +995,8 @@
 	sc-sc_dk.dk_openmask =
 	sc-sc_dk.dk_copenmask | sc-sc_dk.dk_bopenmask;
 
-	if (sc-sc_dk.dk_openmask == 0) {
-		if (sc-sc_parent-dk_rawopens-- == 1) {
-			KASSERT(sc-sc_parent-dk_rawvp != NULL);
-			error = vn_close(sc-sc_parent-dk_rawvp,
-			FREAD | FWRITE, NOCRED);
-			sc-sc_parent-dk_rawvp = NULL;
-		}
-	}
+	if (sc-sc_dk.dk_openmask == 0)
+		error = dklastclose(sc);
 
 	mutex_exit(sc-sc_parent-dk_rawlock);
 	mutex_exit(sc-sc_dk.dk_openlock);



CVS commit: src/sys/dev

2009-07-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul  2 02:06:11 UTC 2009

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

Log Message:
In vndopen(), release the lock before returning ENXIO.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/dev/vnd.c

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

Modified files:

Index: src/sys/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.201 src/sys/dev/vnd.c:1.202
--- src/sys/dev/vnd.c:1.201	Thu May  7 09:13:13 2009
+++ src/sys/dev/vnd.c	Thu Jul  2 02:06:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.201 2009/05/07 09:13:13 cegger Exp $	*/
+/*	$NetBSD: vnd.c,v 1.202 2009/07/02 02:06:11 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.201 2009/05/07 09:13:13 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.202 2009/07/02 02:06:11 dyoung Exp $);
 
 #if defined(_KERNEL_OPT)
 #include fs_nfs.h
@@ -356,8 +356,10 @@
 	if ((error = vndlock(sc)) != 0)
 		return error;
 
-	if ((sc-sc_flags  VNF_CLEARING) != 0)
-		return ENXIO;
+	if ((sc-sc_flags  VNF_CLEARING) != 0) {
+		error = ENXIO;
+		goto done;
+	}
 
 	lp = sc-sc_dkdev.dk_label;
 



CVS commit: src

2009-07-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul  2 17:45:26 UTC 2009

Modified Files:
src/sbin/ifconfig: ifconfig.8
src/usr.sbin/wiconfig: wiconfig.8

Log Message:
Deprecate wiconfig's -r, -g, -m options.  Note that equivalent
options are available in ifconfig(8).


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sbin/ifconfig/ifconfig.8
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/wiconfig/wiconfig.8

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.96 src/sbin/ifconfig/ifconfig.8:1.97
--- src/sbin/ifconfig/ifconfig.8:1.96	Wed Apr  8 14:32:05 2009
+++ src/sbin/ifconfig/ifconfig.8	Thu Jul  2 17:45:25 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: ifconfig.8,v 1.96 2009/04/08 14:32:05 joerg Exp $
+.\	$NetBSD: ifconfig.8,v 1.97 2009/07/02 17:45:25 dyoung Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)ifconfig.8	8.4 (Berkeley) 6/1/94
 .\
-.Dd March 27, 2009
+.Dd July 2, 2009
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -372,6 +372,15 @@
 .Pq IEEE 802.11 devices only
 Configure the fragmentation threshold for IEEE 802.11-based wireless
 network interfaces.
+.It Cm rts Ar threshold
+.Pq IEEE 802.11 devices only
+Configure the RTS/CTS threshold for IEEE 802.11-based wireless
+network interfaces.
+This controls the number of bytes used for the RTS/CTS handshake boundary.
+The
+.Ar threshold
+can be any value between 0 and 2347.
+The default is 2347, which indicates the RTS/CTS mechanism should not be used.
 .It Cm ssid Ar id
 .Pq IEEE 802.11 devices only
 Configure the Service Set Identifier (a.k.a. the network name)

Index: src/usr.sbin/wiconfig/wiconfig.8
diff -u src/usr.sbin/wiconfig/wiconfig.8:1.30 src/usr.sbin/wiconfig/wiconfig.8:1.31
--- src/usr.sbin/wiconfig/wiconfig.8:1.30	Wed Aug 25 18:48:54 2004
+++ src/usr.sbin/wiconfig/wiconfig.8	Thu Jul  2 17:45:26 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: wiconfig.8,v 1.30 2004/08/25 18:48:54 wiz Exp $
+.\	$NetBSD: wiconfig.8,v 1.31 2009/07/02 17:45:26 dyoung Exp $
 .\
 .\ Copyright (c) 1997, 1998, 1999
 .\	Bill Paul wp...@ctr.columbia.edu All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	From: wicontrol.8,v 1.6 1999/05/22 16:12:47 wpaul Exp $
 .\
-.Dd August 25, 2004
+.Dd July 2, 2009
 .Dt WICONFIG 8
 .Os
 .Sh NAME
@@ -52,21 +52,12 @@
 .Op Fl d Ar max_data_length
 .Ek
 .Bk -words
-.Op Fl g Ar fragmentation_threshold
-.Ek
-.Bk -words
 .Op Fl M Ar 0|1
 .Ek
 .Bk -words
-.Op Fl m Ar MAC_address
-.Ek
-.Bk -words
 .Op Fl R Ar 1|3
 .Ek
 .Bk -words
-.Op Fl r Ar RTS_threshold
-.Ek
-.Bk -words
 .Op Fl s Ar station_name
 .Ek
 .Sh DESCRIPTION
@@ -133,8 +124,6 @@
 .Ar max data length
 can be any number from 256 to 2346.
 The default is 2304.
-.It Fl g Ar fragmentation_threshold
-Set the fragmentation threshold.
 .It Fl h
 Display a short help.
 .It Fl M Ar 0|1
@@ -145,8 +134,8 @@
 .Pp
 In cases of slow performance where there is a good quality signal but
 also high levels of noise (i.e., the signal to noise ratio is bad but
-the signal strength is good), and there is an operating microwave oven
-in or near the signal path, this option may be of use.
+the signal strength is good), or a microwave oven is operating near the
+antenna of the WLAN peer or access point, this option may be of use.
 .Pp
 In bad signal-to-noise conditions, the link layer will switch to lower
 transmit rates.
@@ -159,13 +148,6 @@
 to be transmitted without error.
 .Pp
 Note that this does not impact the visible MTU of the link.
-.It Fl m Ar MAC_address
-Set the station address for the specified interface.
-The
-.Ar MAC address
-is specified as a series of six hexadecimal values separated by colons,
-e.g., 00:60:1d:12:34:56.
-This programs the new address into the card and updates the interface as well.
 .It Fl o
 Print out the statistics counters instead of the card settings.
 Note that, however, the statistics will only be updated every minute or so.
@@ -178,12 +160,14 @@
 (Roaming Disabled).
 The default is 1.
 .It Fl r Ar RTS_threshold
-Set the RTS/CTS threshold for a given interface.
-This controls the number of bytes used for the RTS/CTS handshake boundary.
-The
-.Ar RTS_threshold
-can be any value between 0 and 2347.
-The default is 2347, which indicates RTS/CTS mechanism never to be used.
+.It Fl f Ar fragmentation_threshold
+.It Fl m Ar MAC_address
+These options are deprecated since
+.Nx 6.0 .
+Use
+.Xr ifconfig 8
+to set the link-layer address, the fragmentation threshold, and the RTS
+threshold.
 .It Fl s Ar station_name
 Sets the
 .Ar station_name



CVS commit: src/sbin/ifconfig

2009-07-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul  2 18:43:47 UTC 2009

Modified Files:
src/sbin/ifconfig: ifconfig.8

Log Message:
Use the keyword 'MAC' so that people looking for a way to change
their MAC address can find the example.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sbin/ifconfig/ifconfig.8

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.97 src/sbin/ifconfig/ifconfig.8:1.98
--- src/sbin/ifconfig/ifconfig.8:1.97	Thu Jul  2 17:45:25 2009
+++ src/sbin/ifconfig/ifconfig.8	Thu Jul  2 18:43:47 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: ifconfig.8,v 1.97 2009/07/02 17:45:25 dyoung Exp $
+.\	$NetBSD: ifconfig.8,v 1.98 2009/07/02 18:43:47 dyoung Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -815,7 +815,7 @@
 .Pp
 Only the super-user may modify the configuration of a network interface.
 .Sh EXAMPLES
-Add a link-layer address to an Ethernet:
+Add a link-layer (MAC) address to an Ethernet:
 .Pp
 .Ic ifconfig sip0 link 00:11:22:33:44:55
 .Pp



CVS commit: src/sys/dev

2009-07-07 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Jul  7 19:51:22 UTC 2009

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

Log Message:
At the bottom of vndclear(), clear VNF_CLEARING: it is no longer
needed to exclude vndopen(), and it will prevent subsequent opens
if we leave it.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/sys/dev/vnd.c

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

Modified files:

Index: src/sys/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.202 src/sys/dev/vnd.c:1.203
--- src/sys/dev/vnd.c:1.202	Thu Jul  2 02:06:11 2009
+++ src/sys/dev/vnd.c	Tue Jul  7 19:51:22 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.202 2009/07/02 02:06:11 dyoung Exp $	*/
+/*	$NetBSD: vnd.c,v 1.203 2009/07/07 19:51:22 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.202 2009/07/02 02:06:11 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.203 2009/07/07 19:51:22 dyoung Exp $);
 
 #if defined(_KERNEL_OPT)
 #include fs_nfs.h
@@ -1618,7 +1618,7 @@
 #endif /* VND_COMPRESSION */
 	vnd-sc_flags =
 	~(VNF_INITED | VNF_READONLY | VNF_VLABEL
-	  | VNF_VUNCONF | VNF_COMP);
+	  | VNF_VUNCONF | VNF_COMP | VNF_CLEARING);
 	if (vp == NULL)
 		panic(vndclear: null vp);
 	(void) vn_close(vp, fflags, vnd-sc_cred);



CVS commit: src/sys/kern

2009-07-10 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jul 10 23:07:55 UTC 2009

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

Log Message:
In lwp_create(), take a reference to l2's filedesc_t instead of
taking a reference to curlwp's by calling fd_hold().  If lwp_create()
is called from fork1(), then l2 != curlwp, but l2's and not curlwp's
filedesc_t whose reference we should take.

This change stops the problem I describe in
http://mail-index.netbsd.org/tech-kern/2009/07/09/msg005422.html,
where /dev/rsd0a is never properly closed after fsck / runs on it.
This change seems to quiet my USB backup drive, sd0 at scsibus0 at
umass0, which had stopped spinning down when it was not in use:
The unit probably stayed open after mount(8) tried (and failed:
errant fstab entry) to mount it.

I am confident that this change is an improvement, but I doubt that
it is the last word on the matter.  I hate to get under the filedesc_t
abstraction by fiddling with fd_refcnt, and there may be something
I have missed, so somebody with greater understanding of the file
descriptors code should have a look.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/kern/kern_lwp.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/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.131 src/sys/kern/kern_lwp.c:1.132
--- src/sys/kern/kern_lwp.c:1.131	Sat May 23 18:28:06 2009
+++ src/sys/kern/kern_lwp.c	Fri Jul 10 23:07:54 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.131 2009/05/23 18:28:06 ad Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.132 2009/07/10 23:07:54 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -210,7 +210,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.131 2009/05/23 18:28:06 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.132 2009/07/10 23:07:54 dyoung Exp $);
 
 #include opt_ddb.h
 #include opt_lockdebug.h
@@ -606,7 +606,7 @@
 	l2-l_fd = p2-p_fd;
 	if (p2-p_nlwps != 0) {
 		KASSERT(l1-l_proc == p2);
-		fd_hold();
+		atomic_inc_uint(l2-l_fd-fd_refcnt);
 	} else {
 		KASSERT(l1-l_proc != p2);
 	}



CVS commit: src/doc

2009-07-14 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Jul 14 18:25:55 UTC 2009

Modified Files:
src/doc: CHANGES

Log Message:
Mention cpu_reboot(9) changes.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1253 src/doc/CHANGES:1.1254
--- src/doc/CHANGES:1.1253	Tue Jul 14 05:58:15 2009
+++ src/doc/CHANGES	Tue Jul 14 18:25:54 2009
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1253 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1254 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -312,6 +312,10 @@
 	postfix(1): Import version 2.6.2 [tron 20090623]
 	wake(8): New command to send Wake-on-LAN packets to machines on
 		the local Ethernet. [mbalmer 20090625]
+	cpu_reboot(9): tear down stacks of (pseudo-)devices and
+		filesystems in an orderly fashion during shutdown,
+		detaching the devices and unmounting the filesystems.
+		i386 and sparc64 are finished. [dyoung 20090625]
 	kernel: Ephemeral mapping (emap) implementation, i386/amd64 support.
 		[rmind 20090628]
 	dhcpcd(8): Import dhcpcd-5.0.5 [roy 20090704]



CVS commit: src/sys/dev

2009-07-15 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 16 01:01:47 UTC 2009

Modified Files:
src/sys/dev/ic: mfi.c mfivar.h
src/sys/dev/pci: mfi_pci.c

Log Message:
Add a rudimentary detachment hook for mfi(4).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/mfivar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/mfi_pci.c

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.23 src/sys/dev/ic/mfi.c:1.24
--- src/sys/dev/ic/mfi.c:1.23	Tue May 12 14:25:17 2009
+++ src/sys/dev/ic/mfi.c	Thu Jul 16 01:01:47 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.23 2009/05/12 14:25:17 cegger Exp $ */
+/* $NetBSD: mfi.c,v 1.24 2009/07/16 01:01:47 dyoung Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom ma...@peereboom.us
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.23 2009/05/12 14:25:17 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.24 2009/07/16 01:01:47 dyoung Exp $);
 
 #include bio.h
 
@@ -104,17 +104,20 @@
 struct bioc_setstate *);
 static int		mfi_bio_hs(struct mfi_softc *, int, int, void *);
 static int		mfi_create_sensors(struct mfi_softc *);
+static int		mfi_destroy_sensors(struct mfi_softc *);
 static void		mfi_sensor_refresh(struct sysmon_envsys *,
 envsys_data_t *);
 #endif /* NBIO  0 */
 
 static uint32_t 	mfi_xscale_fw_state(struct mfi_softc *sc);
 static void 		mfi_xscale_intr_ena(struct mfi_softc *sc);
+static void 		mfi_xscale_intr_dis(struct mfi_softc *sc);
 static int 		mfi_xscale_intr(struct mfi_softc *sc);
 static void 		mfi_xscale_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
 			  	 
 static const struct mfi_iop_ops mfi_iop_xscale = {
 	mfi_xscale_fw_state,
+	mfi_xscale_intr_dis,
 	mfi_xscale_intr_ena,
 	mfi_xscale_intr,
 	mfi_xscale_post
@@ -122,11 +125,13 @@
  	 
 static uint32_t 	mfi_ppc_fw_state(struct mfi_softc *sc);
 static void 		mfi_ppc_intr_ena(struct mfi_softc *sc);
+static void 		mfi_ppc_intr_dis(struct mfi_softc *sc);
 static int 		mfi_ppc_intr(struct mfi_softc *sc);
 static void 		mfi_ppc_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
 		  	 
 static const struct mfi_iop_ops mfi_iop_ppc = {
 	mfi_ppc_fw_state,
+	mfi_ppc_intr_dis,
 	mfi_ppc_intr_ena,
 	mfi_ppc_intr,
 	mfi_ppc_post
@@ -134,6 +139,7 @@
  	 
 #define mfi_fw_state(_s) 	((_s)-sc_iop-mio_fw_state(_s))
 #define mfi_intr_enable(_s) 	((_s)-sc_iop-mio_intr_ena(_s))
+#define mfi_intr_disable(_s) 	((_s)-sc_iop-mio_intr_dis(_s))
 #define mfi_my_intr(_s) 	((_s)-sc_iop-mio_intr(_s))
 #define mfi_post(_s, _c) 	((_s)-sc_iop-mio_post((_s), (_c)))
 
@@ -180,6 +186,28 @@
 }
 
 static int
+mfi_destroy_ccb(struct mfi_softc *sc)
+{
+	struct mfi_ccb		*ccb;
+	uint32_t		i;
+
+	DNPRINTF(MFI_D_CCB, %s: mfi_init_ccb\n, DEVNAME(sc));
+
+
+	for (i = 0; (ccb = mfi_get_ccb(sc)) != NULL; i++) {
+		/* create a dma map for transfer */
+		bus_dmamap_destroy(sc-sc_dmat, ccb-ccb_dmamap);
+	}
+
+	if (i  sc-sc_max_cmds)
+		return EBUSY;
+
+	free(sc-sc_ccb, M_DEVBUF);
+
+	return 0;
+}
+
+static int
 mfi_init_ccb(struct mfi_softc *sc)
 {
 	struct mfi_ccb		*ccb;
@@ -601,6 +629,37 @@
 }
 
 int
+mfi_detach(struct mfi_softc *sc, int flags)
+{
+	int			error;
+
+	DNPRINTF(MFI_D_MISC, %s: mfi_detach\n, DEVNAME(sc));
+
+#if NBIO  0
+	mfi_destroy_sensors(sc);
+	bio_unregister(sc-sc_dev);
+#endif /* NBIO  0 */
+
+	mfi_intr_disable(sc);
+
+	if ((error = config_detach_children(sc-sc_dev, flags)) != 0)
+		return error;
+
+	/* TBD: shutdown firmware */
+
+	if ((error = mfi_destroy_ccb(sc)) != 0)
+		return error;
+
+	mfi_freemem(sc, sc-sc_sense);
+
+	mfi_freemem(sc, sc-sc_frames);
+
+	mfi_freemem(sc, sc-sc_pcq);
+
+	return 0;
+}
+
+int
 mfi_attach(struct mfi_softc *sc, enum mfi_iop iop)
 {
 	struct scsipi_adapter *adapt = sc-sc_adapt;
@@ -1879,6 +1938,14 @@
 }
 
 static int
+mfi_destroy_sensors(struct mfi_softc *sc)
+{
+	sysmon_envsys_unregister(sc-sc_sme);
+	free(sc-sc_sensor, M_DEVBUF);
+	return 0;
+}
+
+static int
 mfi_create_sensors(struct mfi_softc *sc)
 {
 	int i;
@@ -1976,6 +2043,12 @@
 }
  	 
 static void
+mfi_xscale_intr_dis(struct mfi_softc *sc)
+{
+	mfi_write(sc, MFI_OMSK, 0);
+}
+
+static void
 mfi_xscale_intr_ena(struct mfi_softc *sc)
 {
 	mfi_write(sc, MFI_OMSK, MFI_ENABLE_INTR);
@@ -2016,6 +2089,14 @@
 }
  	 
 static void
+mfi_ppc_intr_dis(struct mfi_softc *sc)
+{
+	/* Taking a wild guess --dyoung */
+	mfi_write(sc, MFI_OMSK, ~(uint32_t)0x0);
+	mfi_write(sc, MFI_ODC, 0x);
+}
+
+static void
 mfi_ppc_intr_ena(struct mfi_softc *sc)
 {
 	mfi_write(sc, MFI_ODC, 0x);

Index: src/sys/dev/ic/mfivar.h
diff -u src/sys/dev/ic/mfivar.h:1.10 src/sys/dev/ic/mfivar.h:1.11
--- src/sys/dev/ic/mfivar.h:1.10	Tue Jun 24 10:09:24 2008
+++ src/sys/dev/ic/mfivar.h	Thu Jul 16 01:01:47 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: 

CVS commit: src/sys/dev

2009-07-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 16 18:10:01 UTC 2009

Modified Files:
src/sys/dev/ic: mfi.c mfivar.h
src/sys/dev/pci: mfi_pci.c

Log Message:
device_t/softc split.  Tested and shown to work on a Dell PowerEdge
1950.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/mfivar.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/mfi_pci.c

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.25 src/sys/dev/ic/mfi.c:1.26
--- src/sys/dev/ic/mfi.c:1.25	Thu Jul 16 01:30:10 2009
+++ src/sys/dev/ic/mfi.c	Thu Jul 16 18:10:00 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.25 2009/07/16 01:30:10 dyoung Exp $ */
+/* $NetBSD: mfi.c,v 1.26 2009/07/16 18:10:00 dyoung Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom ma...@peereboom.us
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.25 2009/07/16 01:30:10 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.26 2009/07/16 18:10:00 dyoung Exp $);
 
 #include bio.h
 
@@ -635,12 +635,12 @@
 
 	DNPRINTF(MFI_D_MISC, %s: mfi_detach\n, DEVNAME(sc));
 
-	if ((error = config_detach_children(sc-sc_dev, flags)) != 0)
+	if ((error = config_detach_children(sc-sc_dev, flags)) != 0)
 		return error;
 
 #if NBIO  0
 	mfi_destroy_sensors(sc);
-	bio_unregister(sc-sc_dev);
+	bio_unregister(sc-sc_dev);
 #endif /* NBIO  0 */
 
 	mfi_intr_disable(sc);
@@ -760,7 +760,7 @@
 		sc-sc_ld[i].ld_present = 1;
 
 	memset(adapt, 0, sizeof(*adapt));
-	adapt-adapt_dev = sc-sc_dev;
+	adapt-adapt_dev = sc-sc_dev;
 	adapt-adapt_nchannels = 1;
 	if (sc-sc_ld_cnt)
 		adapt-adapt_openings = sc-sc_max_cmds / sc-sc_ld_cnt;
@@ -779,13 +779,13 @@
 	chan-chan_ntargets = MFI_MAX_LD;
 	chan-chan_id = MFI_MAX_LD;
 
-	(void)config_found(sc-sc_dev, sc-sc_chan, scsiprint);
+	(void)config_found(sc-sc_dev, sc-sc_chan, scsiprint);
 
 	/* enable interrupts */
 	mfi_intr_enable(sc);
 
 #if NBIO  0
-	if (bio_register(sc-sc_dev, mfi_ioctl) != 0)
+	if (bio_register(sc-sc_dev, mfi_ioctl) != 0)
 		panic(%s: controller registration failed, DEVNAME(sc));
 	if (mfi_create_sensors(sc) != 0)
 		aprint_error(%s: unable to create sensors\n, DEVNAME(sc));
@@ -1062,7 +1062,7 @@
 	struct scsipi_periph	*periph;
 	struct scsipi_xfer	*xs;
 	struct scsipi_adapter	*adapt = chan-chan_adapter;
-	struct mfi_softc	*sc = (void *) adapt-adapt_dev;
+	struct mfi_softc	*sc = device_private(adapt-adapt_dev);
 	struct mfi_ccb		*ccb;
 	struct scsi_rw_6	*rw;
 	struct scsipi_rw_10	*rwb;
@@ -1146,7 +1146,7 @@
 	case SCSI_TEST_UNIT_READY:
 		/* save off sd? after autoconf */
 		if (!cold)	/* XXX bogus */
-			strlcpy(sc-sc_ld[target].ld_dev, device_xname(sc-sc_dev),
+			strlcpy(sc-sc_ld[target].ld_dev, device_xname(sc-sc_dev),
 			sizeof(sc-sc_ld[target].ld_dev));
 		/* FALLTHROUGH */
 
@@ -1377,7 +1377,7 @@
 int
 mfi_ioctl(device_t dev, u_long cmd, void *addr)
 {
-	struct mfi_softc	*sc = (struct mfi_softc *)dev;
+	struct mfi_softc *sc = device_private(dev);
 	int error = 0;
 	int s = splbio();
 

Index: src/sys/dev/ic/mfivar.h
diff -u src/sys/dev/ic/mfivar.h:1.11 src/sys/dev/ic/mfivar.h:1.12
--- src/sys/dev/ic/mfivar.h:1.11	Thu Jul 16 01:01:47 2009
+++ src/sys/dev/ic/mfivar.h	Thu Jul 16 18:10:00 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfivar.h,v 1.11 2009/07/16 01:01:47 dyoung Exp $ */
+/* $NetBSD: mfivar.h,v 1.12 2009/07/16 18:10:00 dyoung Exp $ */
 /* $OpenBSD: mfivar.h,v 1.28 2006/08/31 18:18:46 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom ma...@peereboom.us
@@ -19,7 +19,7 @@
 #include dev/sysmon/sysmonvar.h
 #include sys/envsys.h
 
-#define DEVNAME(_s) (device_xname((_s)-sc_dev))
+#define DEVNAME(_s) (device_xname((_s)-sc_dev))
 
 /* #define MFI_DEBUG */
 #ifdef MFI_DEBUG
@@ -110,7 +110,7 @@
 };
 
 struct mfi_softc {
-	struct device		sc_dev;
+	device_t		sc_dev;
 	struct scsipi_channel	sc_chan;
 	struct scsipi_adapter	sc_adapt;
 

Index: src/sys/dev/pci/mfi_pci.c
diff -u src/sys/dev/pci/mfi_pci.c:1.9 src/sys/dev/pci/mfi_pci.c:1.10
--- src/sys/dev/pci/mfi_pci.c:1.9	Thu Jul 16 01:01:46 2009
+++ src/sys/dev/pci/mfi_pci.c	Thu Jul 16 18:10:00 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi_pci.c,v 1.9 2009/07/16 01:01:46 dyoung Exp $ */
+/* $NetBSD: mfi_pci.c,v 1.10 2009/07/16 18:10:00 dyoung Exp $ */
 /* $OpenBSD: mfi_pci.c,v 1.11 2006/08/06 04:40:08 brad Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom ma...@peereboom.us
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mfi_pci.c,v 1.9 2009/07/16 01:01:46 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: mfi_pci.c,v 1.10 2009/07/16 18:10:00 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -50,7 +50,7 @@
 void	mfi_pci_attach(device_t, device_t, void *);
 int	mfi_pci_detach(device_t, int);
 
-CFATTACH_DECL(mfi_pci, sizeof(struct 

CVS commit: src/sys/dev

2009-07-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 16 18:58:38 UTC 2009

Modified Files:
src/sys/dev/ic: mfi.c mfivar.h
src/sys/dev/pci: mfi_pci.c

Log Message:
Let us detach  re-attach children of mfi0.  Detach mfi0 at shutdown.

Detachment may fail after freeing some but not all resources, so
take care not to re-release any resource during detachment.

Tested on a Dell PowerEdge 1950.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/mfivar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/mfi_pci.c

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.26 src/sys/dev/ic/mfi.c:1.27
--- src/sys/dev/ic/mfi.c:1.26	Thu Jul 16 18:10:00 2009
+++ src/sys/dev/ic/mfi.c	Thu Jul 16 18:58:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.26 2009/07/16 18:10:00 dyoung Exp $ */
+/* $NetBSD: mfi.c,v 1.27 2009/07/16 18:58:38 dyoung Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom ma...@peereboom.us
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.26 2009/07/16 18:10:00 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.27 2009/07/16 18:58:38 dyoung Exp $);
 
 #include bio.h
 
@@ -70,7 +70,7 @@
 static int		mfi_init_ccb(struct mfi_softc *);
 
 static struct mfi_mem	*mfi_allocmem(struct mfi_softc *, size_t);
-static void		mfi_freemem(struct mfi_softc *, struct mfi_mem *);
+static void		mfi_freemem(struct mfi_softc *, struct mfi_mem **);
 
 static int		mfi_transition_firmware(struct mfi_softc *);
 static int		mfi_initialize_firmware(struct mfi_softc *);
@@ -345,8 +345,15 @@
 }
 
 static void
-mfi_freemem(struct mfi_softc *sc, struct mfi_mem *mm)
+mfi_freemem(struct mfi_softc *sc, struct mfi_mem **mmp)
 {
+	struct mfi_mem *mm = *mmp;
+
+	if (mm == NULL)
+		return;
+
+	*mmp = NULL;
+
 	DNPRINTF(MFI_D_MEM, %s: mfi_freemem: %p\n, DEVNAME(sc), mm);
 
 	bus_dmamap_unload(sc-sc_dmat, mm-am_map);
@@ -629,6 +636,32 @@
 }
 
 int
+mfi_rescan(device_t self, const char *ifattr, const int *locators)
+{
+	struct mfi_softc *sc = device_private(self);
+
+	if (sc-sc_child != NULL)
+		return 0;
+
+	sc-sc_child = config_found_sm_loc(self, ifattr, locators, sc-sc_chan,
+	scsiprint, NULL);
+
+	return 0;
+}
+
+void
+mfi_childdetached(device_t self, device_t child)
+{
+	struct mfi_softc *sc = device_private(self);
+
+	KASSERT(self == sc-sc_dev);
+	KASSERT(child == sc-sc_child);
+
+	if (child == sc-sc_child)
+		sc-sc_child = NULL;
+}
+
+int
 mfi_detach(struct mfi_softc *sc, int flags)
 {
 	int			error;
@@ -650,11 +683,11 @@
 	if ((error = mfi_destroy_ccb(sc)) != 0)
 		return error;
 
-	mfi_freemem(sc, sc-sc_sense);
+	mfi_freemem(sc, sc-sc_sense);
 
-	mfi_freemem(sc, sc-sc_frames);
+	mfi_freemem(sc, sc-sc_frames);
 
-	mfi_freemem(sc, sc-sc_pcq);
+	mfi_freemem(sc, sc-sc_pcq);
 
 	return 0;
 }
@@ -779,7 +812,7 @@
 	chan-chan_ntargets = MFI_MAX_LD;
 	chan-chan_id = MFI_MAX_LD;
 
-	(void)config_found(sc-sc_dev, sc-sc_chan, scsiprint);
+	mfi_rescan(sc-sc_dev, scsi, NULL);
 
 	/* enable interrupts */
 	mfi_intr_enable(sc);
@@ -793,11 +826,11 @@
 
 	return 0;
 noinit:
-	mfi_freemem(sc, sc-sc_sense);
+	mfi_freemem(sc, sc-sc_sense);
 nosense:
-	mfi_freemem(sc, sc-sc_frames);
+	mfi_freemem(sc, sc-sc_frames);
 noframe:
-	mfi_freemem(sc, sc-sc_pcq);
+	mfi_freemem(sc, sc-sc_pcq);
 nopcq:
 	return 1;
 }
@@ -1940,7 +1973,10 @@
 static int
 mfi_destroy_sensors(struct mfi_softc *sc)
 {
+	if (sc-sc_sme == NULL)
+		return 0;
 	sysmon_envsys_unregister(sc-sc_sme);
+	sc-sc_sme = NULL;
 	free(sc-sc_sensor, M_DEVBUF);
 	return 0;
 }

Index: src/sys/dev/ic/mfivar.h
diff -u src/sys/dev/ic/mfivar.h:1.12 src/sys/dev/ic/mfivar.h:1.13
--- src/sys/dev/ic/mfivar.h:1.12	Thu Jul 16 18:10:00 2009
+++ src/sys/dev/ic/mfivar.h	Thu Jul 16 18:58:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfivar.h,v 1.12 2009/07/16 18:10:00 dyoung Exp $ */
+/* $NetBSD: mfivar.h,v 1.13 2009/07/16 18:58:38 dyoung Exp $ */
 /* $OpenBSD: mfivar.h,v 1.28 2006/08/31 18:18:46 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom ma...@peereboom.us
@@ -161,8 +161,11 @@
 	struct sysmon_envsys*sc_sme;
 	envsys_data_t		*sc_sensor;
 
+	device_t		sc_child;
 };
 
+int	mfi_rescan(device_t, const char *, const int *);
+void	mfi_childdetached(device_t, device_t);
 int	mfi_attach(struct mfi_softc *, enum mfi_iop);
 int	mfi_detach(struct mfi_softc *, int);
 int	mfi_intr(void *);

Index: src/sys/dev/pci/mfi_pci.c
diff -u src/sys/dev/pci/mfi_pci.c:1.10 src/sys/dev/pci/mfi_pci.c:1.11
--- src/sys/dev/pci/mfi_pci.c:1.10	Thu Jul 16 18:10:00 2009
+++ src/sys/dev/pci/mfi_pci.c	Thu Jul 16 18:58:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi_pci.c,v 1.10 2009/07/16 18:10:00 dyoung Exp $ */
+/* $NetBSD: mfi_pci.c,v 1.11 2009/07/16 18:58:38 dyoung Exp $ */
 /* $OpenBSD: mfi_pci.c,v 1.11 2006/08/06 

CVS commit: src/sbin/fsck

2009-07-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 16 23:50:32 UTC 2009

Modified Files:
src/sbin/fsck: partutil.c

Log Message:
Callers expect getdiskinfo() to return -1 on error, so do that.

Simplify getdiskinfo() a bit while I am here: don't save error
codes that we will never refer to again.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/fsck/partutil.c

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

Modified files:

Index: src/sbin/fsck/partutil.c
diff -u src/sbin/fsck/partutil.c:1.8 src/sbin/fsck/partutil.c:1.9
--- src/sbin/fsck/partutil.c:1.8	Sun Jun 14 21:06:18 2009
+++ src/sbin/fsck/partutil.c	Thu Jul 16 23:50:32 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: partutil.c,v 1.8 2009/06/14 21:06:18 haad Exp $	*/
+/*	$NetBSD: partutil.c,v 1.9 2009/07/16 23:50:32 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: partutil.c,v 1.8 2009/06/14 21:06:18 haad Exp $);
+__RCSID($NetBSD: partutil.c,v 1.9 2009/07/16 23:50:32 dyoung Exp $);
 
 #include sys/types.h
 #include sys/disklabel.h
@@ -155,10 +155,7 @@
 	struct disklabel lab;
 	struct disklabel *lp = lab;
 	prop_dictionary_t disk_dict, geom_dict;
-	int error;
 
-	error = 0;
-	
 	if (dt) {
 		lp = getdiskbyname(dt);
 		if (lp == NULL)
@@ -166,17 +163,16 @@
 	}
 
 	/* Get disk description dictionary */
-	if ((error = prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO,
-		disk_dict)) != 0) {
+	if (prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, disk_dict)) {
 		/*
 		 * Ask for disklabel if DIOCGDISKINFO failed. This is
 		 * compatibility call and can be removed when all devices
 		 * will support DIOCGDISKINFO.
 		 * cgd, ccd pseudo disk drives doesn't support DIOCGDDISKINFO
 		 */
-		if ((error = ioctl(fd, DIOCGDINFO, lp)) == -1) {
+		if (ioctl(fd, DIOCGDINFO, lp) == -1) {
 			printf(DIOCGDINFO on %s failed\n, s);
-			return (errno);
+			return -1;
 		}
 		label2geom(geo, lp);
 	} else {



CVS commit: src/sys/kern

2009-07-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 16 23:53:10 UTC 2009

Modified Files:
src/sys/kern: Make.tags.inc

Log Message:
A definition in aic79xxvar.h somehow shadows pci_attach_args (ctags
bug?), so leave  it out of the tags computation for now.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/Make.tags.inc

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/Make.tags.inc
diff -u src/sys/kern/Make.tags.inc:1.20 src/sys/kern/Make.tags.inc:1.21
--- src/sys/kern/Make.tags.inc:1.20	Mon Jun 29 18:03:37 2009
+++ src/sys/kern/Make.tags.inc	Thu Jul 16 23:53:10 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Make.tags.inc,v 1.20 2009/06/29 18:03:37 dyoung Exp $
+#	$NetBSD: Make.tags.inc,v 1.21 2009/07/16 23:53:10 dyoung Exp $
 #
 #	from: @(#)Make.tags.inc	8.1 (Berkeley) 6/11/93
 
@@ -15,7 +15,7 @@
 # This promises to be easier to maintain, considering how often the directory
 # structure of the kernel sources has been changing recently.
 SYSDIR?= ${.CURDIR:H:H}
-FINDCOMM=	find -H ${SYSDIR} \( -path '*/dist/ipf' -o -name arch -o -name rump -o -name coda \) -prune -o -type f -name *.[ch] \( \! -name 'altq.h' \! -name 'nbcompat.h' \! -name 'pf_osfp.c' \! -name 'unichromereg.h' \! -name 'usb_port.h' \! -name 'midway*' \! -name 'if_lmc.[ch]' \) -print | \
+FINDCOMM=	find -H ${SYSDIR} \( -path '*/dist/ipf' -o -name arch -o -name rump -o -name coda \) -prune -o -type f -name *.[ch] \( \! -name 'altq.h' \! -name 'nbcompat.h' \! -name 'pf_osfp.c' \! -name 'unichromereg.h' \! -name 'usb_port.h' \! -name 'midway*' \! -name 'if_lmc.[ch]' \! -name 'aic79xxvar.h' \) -print | \
 sort -t / -u
 COMM!=	${FINDCOMM}
 .endif



CVS commit: src/sys/kern

2009-07-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jul 17 22:17:37 UTC 2009

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

Log Message:
Fix spelling: situatations - situations.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/kern/kern_lock.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/kern_lock.c
diff -u src/sys/kern/kern_lock.c:1.148 src/sys/kern/kern_lock.c:1.149
--- src/sys/kern/kern_lock.c:1.148	Sat May 23 17:08:04 2009
+++ src/sys/kern/kern_lock.c	Fri Jul 17 22:17:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lock.c,v 1.148 2009/05/23 17:08:04 ad Exp $	*/
+/*	$NetBSD: kern_lock.c,v 1.149 2009/07/17 22:17:37 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_lock.c,v 1.148 2009/05/23 17:08:04 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_lock.c,v 1.149 2009/07/17 22:17:37 dyoung Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -71,7 +71,7 @@
 
 	/*
 	 * Avoid disabling/re-enabling preemption here since this
-	 * routine may be called in delicate situatations.
+	 * routine may be called in delicate situations.
 	 */
 	do {
 		pctr = lwp_pctr();



CVS commit: src/sys/arch/x86

2009-07-20 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Jul 20 19:11:30 UTC 2009

Modified Files:
src/sys/arch/x86/include: ipmivar.h
src/sys/arch/x86/x86: ipmi.c

Log Message:
Overhaul synchronization in ipmi(4): synchronize all access to
device registers with a mutex.  Convert tsleep/wakeup calls to
cv_wait/cv_signal.

Do not repeatedly malloc/free tiny buffers for sending/receiving
commands, but reserve a command buffer in the softc.

Tickle the watchdog in the sensors-refreshing thread.

I am fairly certain that after the device is attached, every register
access happens in the sensors-refreshing thread.  Moreover, no
software interrupt touches any register, now.  So I may get rid of
the mutex that protects register accesses, sc_cmd_mtx.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/ipmivar.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/x86/x86/ipmi.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/x86/include/ipmivar.h
diff -u src/sys/arch/x86/include/ipmivar.h:1.9 src/sys/arch/x86/include/ipmivar.h:1.10
--- src/sys/arch/x86/include/ipmivar.h:1.9	Mon Nov  3 12:25:53 2008
+++ src/sys/arch/x86/include/ipmivar.h	Mon Jul 20 19:11:30 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ipmivar.h,v 1.9 2008/11/03 12:25:53 cegger Exp $ */
+/* $NetBSD: ipmivar.h,v 1.10 2009/07/20 19:11:30 dyoung Exp $ */
 
 /*
  * Copyright (c) 2005 Jordan Hargrave
@@ -28,6 +28,7 @@
  */
 
 #include sys/mutex.h
+#include sys/condvar.h
 
 #include dev/sysmon/sysmonvar.h
 
@@ -45,13 +46,6 @@
 struct ipmi_thread;
 struct ipmi_softc;
 
-struct ipmi_bmc_args{
-	int			offset;
-	uint8_t		mask;
-	uint8_t		value;
-	volatile uint8_t	*v;
-};
-
 struct ipmi_attach_args {
 	bus_space_tag_t	iaa_iot;
 	bus_space_tag_t	iaa_memt;
@@ -92,22 +86,27 @@
 
 	struct lwp		*sc_kthread;
 
-	struct callout		sc_callout;
 	int			sc_max_retries;
-	int			sc_retries;
-	int			sc_wakeup;
 
-	kmutex_t		sc_lock;
+	kmutex_t		sc_poll_mtx;
+	kcondvar_t		sc_poll_cv;
+
+	kmutex_t		sc_cmd_mtx;
+	kcondvar_t		sc_cmd_sleep;
 
 	struct ipmi_bmc_args	*sc_iowait_args;
 
 	struct ipmi_sensor	*current_sensor;
-	volatile int		sc_thread_running;
+	volatile bool		sc_thread_running;
+	volatile bool		sc_tickle_due;
 	struct sysmon_wdog	sc_wdog;
 	struct sysmon_envsys	*sc_envsys;
 	envsys_data_t		*sc_sensor;
 	int 		sc_nsensors; /* total number of sensors */
 	int		sc_nsensors_typ[ENVSYS_NSENSORS]; /* number per type */
+
+	char		sc_buf[64];
+	bool		sc_buf_rsvd;
 };
 
 struct ipmi_thread {
@@ -115,26 +114,37 @@
 	volatile int	running;
 };
 
-#define IPMI_WDOG_USE_NLOG		0x80
-#define IPMI_WDOG_USE_NSTOP		0x40
-#define IPMI_WDOG_USE_USE_MASK		0x07
-#define IPMI_WDOG_USE_USE_FRB2		0x01
-#define IPMI_WDOG_USE_USE_POST		0x02
-#define IPMI_WDOG_USE_USE_OSLOAD	0x03
-#define IPMI_WDOG_USE_USE_OS		0x04
-#define IPMI_WDOG_USE_USE_EOM		0x05
-
-#define IPMI_WDOG_ACT_MASK		0x07
-#define IPMI_WDOG_ACT_DISABLED		0x00
-#define IPMI_WDOG_ACT_RESET		0x01
-#define IPMI_WDOG_ACT_PWROFF		0x02
-#define IPMI_WDOG_ACT_PWRCYCLE		0x03
-
-#define IPMI_WDOG_ACT_PRE_MASK		0x70
-#define IPMI_WDOG_ACT_PRE_DISABLED	0x00
-#define IPMI_WDOG_ACT_PRE_SMI		0x10
-#define IPMI_WDOG_ACT_PRE_NMI		0x20
-#define IPMI_WDOG_ACT_PRE_INTERRUPT	0x30
+#define IPMI_WDOG_USE_NOLOG		__BIT(7)
+#define IPMI_WDOG_USE_NOSTOP		__BIT(6)
+#define IPMI_WDOG_USE_RSVD1		__BITS(5, 3)
+#define IPMI_WDOG_USE_USE_MASK		__BITS(2, 0)
+#define IPMI_WDOG_USE_USE_RSVD		__SHIFTIN(0, IPMI_WDOG_USE_USE_MASK);
+#define IPMI_WDOG_USE_USE_FRB2		__SHIFTIN(1, IPMI_WDOG_USE_USE_MASK);
+#define IPMI_WDOG_USE_USE_POST		__SHIFTIN(2, IPMI_WDOG_USE_USE_MASK);
+#define IPMI_WDOG_USE_USE_OSLOAD	__SHIFTIN(3, IPMI_WDOG_USE_USE_MASK);
+#define IPMI_WDOG_USE_USE_OS		__SHIFTIN(4, IPMI_WDOG_USE_USE_MASK);
+#define IPMI_WDOG_USE_USE_OEM		__SHIFTIN(5, IPMI_WDOG_USE_USE_MASK);
+
+#define IPMI_WDOG_ACT_PRE_RSVD1		__BIT(7)
+#define IPMI_WDOG_ACT_PRE_MASK		__BITS(6, 4)
+#define IPMI_WDOG_ACT_PRE_DISABLED	__SHIFTIN(0, IPMI_WDOG_ACT_MASK)
+#define IPMI_WDOG_ACT_PRE_SMI		__SHIFTIN(1, IPMI_WDOG_ACT_MASK)
+#define IPMI_WDOG_ACT_PRE_NMI		__SHIFTIN(2, IPMI_WDOG_ACT_MASK)
+#define IPMI_WDOG_ACT_PRE_INTERRUPT	__SHIFTIN(3, IPMI_WDOG_ACT_MASK)
+#define IPMI_WDOG_ACT_PRE_RSVD0		__BIT(3)
+#define IPMI_WDOG_ACT_MASK		__BITS(2, 0)
+#define IPMI_WDOG_ACT_DISABLED		__SHIFTIN(0, IPMI_WDOG_ACT_MASK)
+#define IPMI_WDOG_ACT_RESET		__SHIFTIN(1, IPMI_WDOG_ACT_MASK)
+#define IPMI_WDOG_ACT_PWROFF		__SHIFTIN(2, IPMI_WDOG_ACT_MASK)
+#define IPMI_WDOG_ACT_PWRCYCLE		__SHIFTIN(3, IPMI_WDOG_ACT_MASK)
+
+#define IPMI_WDOG_FLAGS_RSVD1		__BITS(7, 6)
+#define IPMI_WDOG_FLAGS_OEM		__BIT(5)
+#define IPMI_WDOG_FLAGS_OS		__BIT(4)
+#define IPMI_WDOG_FLAGS_OSLOAD		__BIT(3)
+#define IPMI_WDOG_FLAGS_POST		__BIT(2)
+#define IPMI_WDOG_FLAGS_FRB2		__BIT(1)
+#define IPMI_WDOG_FLAGS_RSVD0		__BIT(0)
 
 struct ipmi_set_watchdog {
 	uint8_t		wdog_use;

Index: 

CVS commit: src/sys/arch/x86/x86

2009-07-20 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Jul 20 19:25:07 UTC 2009

Modified Files:
src/sys/arch/x86/x86: ipmi.c

Log Message:
In ipmi_match(), initialize the condition variable sc_cmd_sleep.
Fixes a bug in previous, exposed by

# drvctl -d ipmi0
# drvctl -r -a ipmibus mainbus0
*lockdebug panic here*


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/x86/ipmi.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/x86/x86/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.39 src/sys/arch/x86/x86/ipmi.c:1.40
--- src/sys/arch/x86/x86/ipmi.c:1.39	Mon Jul 20 19:11:30 2009
+++ src/sys/arch/x86/x86/ipmi.c	Mon Jul 20 19:25:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipmi.c,v 1.39 2009/07/20 19:11:30 dyoung Exp $ */
+/*	$NetBSD: ipmi.c,v 1.40 2009/07/20 19:25:07 dyoung Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -57,7 +57,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipmi.c,v 1.39 2009/07/20 19:11:30 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipmi.c,v 1.40 2009/07/20 19:25:07 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -1790,6 +1790,7 @@
 	sc.sc_if-probe(sc);
 
 	mutex_init(sc.sc_cmd_mtx, MUTEX_DEFAULT, IPL_SOFTCLOCK);
+	cv_init(sc.sc_cmd_sleep, ipmimatch);
 	mutex_enter(sc.sc_cmd_mtx);
 	/* Identify BMC device early to detect lying bios */
 	if (ipmi_sendcmd(sc, BMC_SA, 0, APP_NETFN, APP_GET_DEVICE_ID,
@@ -1809,6 +1810,7 @@
 	dbg_dump(1, bmc data, len, cmd);
 	rv = 1; /* GETID worked, we got IPMI */
 unmap:
+	cv_destroy(sc.sc_cmd_sleep);
 	mutex_destroy(sc.sc_cmd_mtx);
 	ipmi_unmap_regs(sc);
 



CVS commit: src/sys/arch/evbarm/ifpga

2009-07-21 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Jul 21 16:04:16 UTC 2009

Modified Files:
src/sys/arch/evbarm/ifpga: ifpga.c ifpga_clock.c ifpga_pci.c
ifpga_pcivar.h ifpgavar.h pl030_rtc.c

Log Message:
device_t/softc split.  Compiled, but never run.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/ifpga/ifpga.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/ifpga/ifpga_clock.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/ifpga/ifpga_pci.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/ifpga/ifpga_pcivar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/ifpga/ifpgavar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/ifpga/pl030_rtc.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/evbarm/ifpga/ifpga.c
diff -u src/sys/arch/evbarm/ifpga/ifpga.c:1.22 src/sys/arch/evbarm/ifpga/ifpga.c:1.23
--- src/sys/arch/evbarm/ifpga/ifpga.c:1.22	Sun Apr 27 18:58:46 2008
+++ src/sys/arch/evbarm/ifpga/ifpga.c	Tue Jul 21 16:04:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ifpga.c,v 1.22 2008/04/27 18:58:46 matt Exp $ */
+/*	$NetBSD: ifpga.c,v 1.23 2009/07/21 16:04:16 dyoung Exp $ */
 
 /*
  * Copyright (c) 2001 ARM Ltd
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ifpga.c,v 1.22 2008/04/27 18:58:46 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ifpga.c,v 1.23 2009/07/21 16:04:16 dyoung Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -66,12 +66,12 @@
 #include locators.h
 
 /* Prototypes */
-static int  ifpga_match		(struct device *, struct cfdata *, void *);
-static void ifpga_attach	(struct device *, struct device *, void *);
+static int  ifpga_match		(device_t, cfdata_t, void *);
+static void ifpga_attach	(device_t, device_t, void *);
 static int  ifpga_print		(void *, const char *);
 
 /* Drive and attach structures */
-CFATTACH_DECL(ifpga, sizeof(struct ifpga_softc),
+CFATTACH_DECL_NEW(ifpga, sizeof(struct ifpga_softc),
 ifpga_match, ifpga_attach, NULL, NULL);
 
 int ifpga_found;
@@ -91,6 +91,8 @@
 static struct bus_space ifpga_bs_tag;
 
 struct ifpga_softc *ifpga_sc;
+device_t ifpga_dev;
+
 /*
  * Print the configuration information for children
  */
@@ -109,10 +111,9 @@
 }
 
 static int
-ifpga_search(struct device *parent, struct cfdata *cf,
-	 const int *ldesc, void *aux)
+ifpga_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
-	struct ifpga_softc *sc = (struct ifpga_softc *)parent;
+	struct ifpga_softc *sc = device_private(parent);
 	struct ifpga_attach_args ifa;
 	int tryagain;
 
@@ -133,7 +134,7 @@
 }
 
 static int
-ifpga_match(struct device *parent, struct cfdata *cf, void *aux)
+ifpga_match(device_t parent, cfdata_t cf, void *aux)
 {
 #if 0
 	struct mainbus_attach_args *ma = aux;
@@ -151,9 +152,9 @@
 }
 
 static void
-ifpga_attach(struct device *parent, struct device *self, void *aux)
+ifpga_attach(device_t parent, device_t self, void *aux)
 {
-	struct ifpga_softc *sc = (struct ifpga_softc *)self;
+	struct ifpga_softc *sc = device_private(self);
 	u_int id, sysclk;
 #if defined(PCI_NETBSD_CONFIGURE)  NPCI  0
 	struct extent *ioext, *memext, *pmemext;
@@ -176,13 +177,14 @@
 
 	sc-sc_iot = ifpga_bs_tag;
 
+	ifpga_dev = self;
 	ifpga_sc = sc;
 
 	/* Now map in the IFPGA motherboard registers.  */
 	if (bus_space_map(sc-sc_iot, IFPGA_IO_SC_BASE, IFPGA_IO_SC_SIZE, 0,
 	sc-sc_sc_ioh))
 		panic(%s: Cannot map system controller registers, 
-		self-dv_xname);
+		device_xname(self));
 
 	id = bus_space_read_4(sc-sc_iot, sc-sc_sc_ioh, IFPGA_SC_ID);
 
@@ -221,7 +223,7 @@
 		panic( Unsupported bus);
 	}
 
-	printf(\n%s: FPGA , self-dv_xname);
+	printf(\n%s: FPGA , device_xname(self));
 
 	switch (id  IFPGA_SC_ID_FPGA_MASK)
 	{
@@ -246,20 +248,22 @@
 	if (bus_space_map(sc-sc_iot, IFPGA_IO_IRQ_BASE, IFPGA_IO_IRQ_SIZE, 
 	BUS_SPACE_MAP_LINEAR, sc-sc_irq_ioh))
 		panic(%s: Cannot map irq controller registers,
-		self-dv_xname);
+		device_xname(self));
 
 	/* We can write to the IRQ/FIQ controller now.  */
 	ifpga_intr_postinit();
 
 	/* Map the core module */
 	if (bus_space_map(sc-sc_iot, IFPGA_IO_CM_BASE, IFPGA_IO_CM_SIZE, 0,
-	sc-sc_cm_ioh))
-		panic(%s: Cannot map core module registers, self-dv_xname);
+	sc-sc_cm_ioh)) {
+		panic(%s: Cannot map core module registers,
+		device_xname(self));
+	}
 
 	/* Map the timers */
 	if (bus_space_map(sc-sc_iot, IFPGA_IO_TMR_BASE, IFPGA_IO_TMR_SIZE, 0,
 	sc-sc_tmr_ioh))
-		panic(%s: Cannot map timer registers, self-dv_xname);
+		panic(%s: Cannot map timer registers, device_xname(self));
 
 	printf(\n);
 
@@ -275,7 +279,7 @@
 	pci_sc-sc_conf_ioh)
 	|| bus_space_map(pci_sc-sc_memt, IFPGA_V360_REG_BASE,
 	IFPGA_V360_REG_SIZE, 0, pci_sc-sc_reg_ioh))
-		panic(%s: Cannot map pci memory, self-dv_xname);
+		panic(%s: Cannot map pci memory, device_xname(self));
 
 	{
 		pcireg_t id_reg, class_reg;
@@ -287,7 +291,7 @@
 		

CVS commit: src/sys/dev/pci

2009-07-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 23 21:22:25 UTC 2009

Modified Files:
src/sys/dev/pci: pccbb.c pccbbvar.h

Log Message:
Use kpause(9), cv_timedwait(9), and cv_signal(9) instead of tsleep(9)
and wakeup(9).

Use mstohz(9).

XXX Protection against spurious wakeups is still needed, but this patch
XXX makes the code no worse than before in this regard.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/dev/pci/pccbb.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/pccbbvar.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/pci/pccbb.c
diff -u src/sys/dev/pci/pccbb.c:1.188 src/sys/dev/pci/pccbb.c:1.189
--- src/sys/dev/pci/pccbb.c:1.188	Thu May 21 17:32:32 2009
+++ src/sys/dev/pci/pccbb.c	Thu Jul 23 21:22:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pccbb.c,v 1.188 2009/05/21 17:32:32 dyoung Exp $	*/
+/*	$NetBSD: pccbb.c,v 1.189 2009/07/23 21:22:25 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pccbb.c,v 1.188 2009/05/21 17:32:32 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pccbb.c,v 1.189 2009/07/23 21:22:25 dyoung Exp $);
 
 /*
 #define CBB_DEBUG
@@ -89,12 +89,12 @@
  * of delay() if you want to wait more than 1 ms.
  */
 static inline void
-delay_ms(int millis, void *param)
+delay_ms(int millis, struct pccbb_softc *sc)
 {
 	if (cold)
 		delay(millis * 1000);
 	else
-		tsleep(param, PWAIT, pccbb, MAX(2, hz * millis / 1000));
+		kpause(pccbb, false, mstohz(millis), NULL);
 }
 
 int pcicbbmatch(device_t, cfdata_t, void *);
@@ -422,6 +422,9 @@
 
 	sc-sc_dev = self;
 
+	mutex_init(sc-sc_pwr_mtx, MUTEX_DEFAULT, IPL_BIO);
+	cv_init(sc-sc_pwr_cv, pccpwr);
+
 	callout_init(sc-sc_insert_ch, 0);
 	callout_setfunc(sc-sc_insert_ch, pci113x_insert, sc);
 
@@ -1069,8 +1072,10 @@
 	if (sockevent  CB_SOCKET_EVENT_POWER) {
 		DPRINTF((Powercycling because of socket event\n));
 		/* XXX: Does not happen when attaching a 16-bit card */
+		mutex_enter(sc-sc_pwr_mtx);
 		sc-sc_pwrcycle++;
-		wakeup(sc-sc_pwrcycle);
+		cv_signal(sc-sc_pwr_cv);
+		mutex_exit(sc-sc_pwr_mtx);
 	}
 
 	/* Sometimes a change of CSTSCHG# accompanies the first
@@ -1129,7 +1134,7 @@
 			if (sc-sc_flags  CBB_INSERTING) {
 callout_stop(sc-sc_insert_ch);
 			}
-			callout_schedule(sc-sc_insert_ch, hz / 5);
+			callout_schedule(sc-sc_insert_ch, mstohz(200));
 			sc-sc_flags |= CBB_INSERTING;
 		}
 	}
@@ -1197,7 +1202,7 @@
 			/* who are you? */
 		}
 	} else {
-		callout_schedule(sc-sc_insert_ch, hz / 10);
+		callout_schedule(sc-sc_insert_ch, mstohz(100));
 	}
 }
 
@@ -1285,7 +1290,7 @@
 	u_int32_t status, osock_ctrl, sock_ctrl, reg_ctrl;
 	bus_space_tag_t memt = sc-sc_base_memt;
 	bus_space_handle_t memh = sc-sc_base_memh;
-	int on = 0, pwrcycle, s, times;
+	int on = 0, pwrcycle, times;
 	struct timeval before, after, diff;
 
 	DPRINTF((pccbb_power: %s and %s [0x%x]\n,
@@ -1352,13 +1357,13 @@
 		sock_ctrl |= CB_SOCKET_CTRL_VPP_12V;
 		break;
 	}
-
-	pwrcycle = sc-sc_pwrcycle;
 	aprint_debug_dev(sc-sc_dev, osock_ctrl %# PRIx32
 	 sock_ctrl %# PRIx32 \n, osock_ctrl, sock_ctrl);
 
 	microtime(before);
-	s = splbio();
+	mutex_enter(sc-sc_pwr_mtx);
+	pwrcycle = sc-sc_pwrcycle;
+
 	bus_space_write_4(memt, memh, CB_SOCKET_CTRL, sock_ctrl);
 
 	/*
@@ -1380,8 +1385,8 @@
 		if (cold)
 			DELAY(40 * 1000);
 		else {
-			(void)tsleep(sc-sc_pwrcycle, PWAIT, pccpwr,
-			hz / 25);
+			(void)cv_timedwait(sc-sc_pwr_cv, sc-sc_pwr_mtx,
+			mstohz(40));
 			if (pwrcycle == sc-sc_pwrcycle)
 continue;
 		}
@@ -1391,7 +1396,7 @@
 		if ((status  CB_SOCKET_STAT_PWRCYCLE) == 0  !on)
 			break;
 	}
-	splx(s);
+	mutex_exit(sc-sc_pwr_mtx);
 	microtime(after);
 	timersub(after, before, diff);
 	aprint_debug_dev(sc-sc_dev, wait took%s %lld.%06lds\n,
@@ -2307,7 +2312,7 @@
 		panic(pccbb_pcmcia_delay: called in interrupt context);
 #endif
 	DPRINTF((pccbb_pcmcia_delay: \%s\, sleep %d ms\n, wmesg, timo));
-	tsleep(pccbb_pcmcia_delay, PWAIT, wmesg, roundup(timo * hz, 1000) / 1000);
+	kpause(wmesg, false, max(mstohz(timo), 1), NULL);
 }
 
 /*

Index: src/sys/dev/pci/pccbbvar.h
diff -u src/sys/dev/pci/pccbbvar.h:1.37 src/sys/dev/pci/pccbbvar.h:1.38
--- src/sys/dev/pci/pccbbvar.h:1.37	Thu Jun 26 20:57:10 2008
+++ src/sys/dev/pci/pccbbvar.h	Thu Jul 23 21:22:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pccbbvar.h,v 1.37 2008/06/26 20:57:10 drochner Exp $	*/
+/*	$NetBSD: pccbbvar.h,v 1.38 2009/07/23 21:22:25 dyoung Exp $	*/
 /*
  * Copyright (c) 1999 HAYAKAWA Koichi.  All rights reserved.
  *
@@ -36,6 +36,9 @@
 #ifndef _DEV_PCI_PCCBBVAR_H_
 #define	_DEV_PCI_PCCBBVAR_H_
 
+#include sys/mutex.h
+#include sys/condvar.h
+
 #define	PCIC_FLAG_SOCKETP	0x0001
 #define	PCIC_FLAG_CARDP		0x0002
 
@@ -133,6 +136,8 @@
 #define	PCCBB_PCMCIA_MEM_32	0x02	/* 32-bit memory address ready */
 
 	volatile int sc_pwrcycle;
+	kcondvar_t sc_pwr_cv;
+	kmutex_t sc_pwr_mtx;
 
 	

CVS commit: src/sys/dev

2009-07-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 23 21:38:33 UTC 2009

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

Log Message:
Extract ldlastclose() and use it in ldclose().  At the top of
ldbegindetach(), call disk_begindetach(..., ldlastclose, ...).

Compiles.  Not tested.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ld.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/ld.c
diff -u src/sys/dev/ld.c:1.65 src/sys/dev/ld.c:1.66
--- src/sys/dev/ld.c:1.65	Thu May  7 09:11:42 2009
+++ src/sys/dev/ld.c	Thu Jul 23 21:38:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld.c,v 1.65 2009/05/07 09:11:42 cegger Exp $	*/
+/*	$NetBSD: ld.c,v 1.66 2009/07/23 21:38:33 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld.c,v 1.65 2009/05/07 09:11:42 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld.c,v 1.66 2009/07/23 21:38:33 dyoung Exp $);
 
 #include rnd.h
 
@@ -71,6 +71,7 @@
 static void	ldstart(struct ld_softc *, struct buf *);
 static void	ld_set_properties(struct ld_softc *);
 static void	ld_config_interrupts (device_t);
+static int	ldlastclose(device_t);
 
 extern struct	cfdriver ld_cd;
 
@@ -183,8 +184,10 @@
 	if ((sc-sc_flags  LDF_ENABLED) == 0)
 		return (0);
 
-	if ((flags  DETACH_FORCE) == 0  sc-sc_dk.dk_openmask != 0)
-		return (EBUSY);
+	rv = disk_begindetach(sc-sc_dk, ldlastclose, sc-sc_dv, flags);
+
+	if (rv != 0)
+		return rv;
 
 	s = splbio();
 	sc-sc_maxqueuecnt = 0;
@@ -321,6 +324,19 @@
 	return (error);
 }
 
+static int
+ldlastclose(device_t self)
+{
+	struct ld_softc *sc = device_private(self);
+
+	if (sc-sc_flush != NULL  (*sc-sc_flush)(sc, 0) != 0)
+		aprint_error_dev(self, unable to flush cache\n);
+	if ((sc-sc_flags  LDF_KLABEL) == 0)
+		sc-sc_flags = ~LDF_VLABEL;
+
+	return 0;
+}
+
 /* ARGSUSED */
 static int
 ldclose(dev_t dev, int flags, int fmt, struct lwp *l)
@@ -345,12 +361,8 @@
 	sc-sc_dk.dk_openmask =
 	sc-sc_dk.dk_copenmask | sc-sc_dk.dk_bopenmask;
 
-	if (sc-sc_dk.dk_openmask == 0) {
-		if (sc-sc_flush != NULL  (*sc-sc_flush)(sc, 0) != 0)
-			aprint_error_dev(sc-sc_dv, unable to flush cache\n);
-		if ((sc-sc_flags  LDF_KLABEL) == 0)
-			sc-sc_flags = ~LDF_VLABEL;
-	}
+	if (sc-sc_dk.dk_openmask == 0)
+		ldlastclose(sc-sc_dv);
 
 	mutex_exit(sc-sc_dk.dk_openlock);
 	return (0);



CVS commit: src/sys/dev/raidframe

2009-07-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 23 21:58:06 UTC 2009

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Move the RAID shutdown to the raid(4) detachment routine, and use
config_detach(9) to shutdown a RAID.

Detach raid(4) units at shutdown.

Ok by os...@.


To generate a diff of this commit:
cvs rdiff -u -r1.265 -r1.266 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.265 src/sys/dev/raidframe/rf_netbsdkintf.c:1.266
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.265	Wed Jun 10 14:17:13 2009
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Thu Jul 23 21:58:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.265 2009/06/10 14:17:13 pooka Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.266 2009/07/23 21:58:06 dyoung Exp $	*/
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -139,7 +139,7 @@
  ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.265 2009/06/10 14:17:13 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.266 2009/07/23 21:58:06 dyoung Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -260,6 +260,7 @@
 #define RAIDF_INITED	0x01	/* unit has been initialized */
 #define RAIDF_WLABEL	0x02	/* label area is writable */
 #define RAIDF_LABELLING	0x04	/* unit is currently being labelled */
+#define RAIDF_SHUTDOWN	0x08	/* unit is being shutdown */
 #define RAIDF_WANTED	0x40	/* someone is waiting to obtain a lock */
 #define RAIDF_LOCKED	0x80	/* unit is locked */
 
@@ -267,8 +268,9 @@
 int numraid = 0;
 
 extern struct cfdriver raid_cd;
-CFATTACH_DECL_NEW(raid, sizeof(struct raid_softc),
-raid_match, raid_attach, raid_detach, NULL);
+CFATTACH_DECL3_NEW(raid, sizeof(struct raid_softc),
+raid_match, raid_attach, raid_detach, NULL, NULL, NULL,
+DVF_DETACH_SHUTDOWN);
 
 /*
  * Allow RAIDOUTSTANDING number of simultaneous IO's to this RAID device.
@@ -305,6 +307,8 @@
 static int raidlock(struct raid_softc *);
 static void raidunlock(struct raid_softc *);
 
+static int raid_detach_unlocked(struct raid_softc *);
+
 static void rf_markalldirty(RF_Raid_t *);
 static void rf_set_properties(struct raid_softc *, RF_Raid_t *);
 
@@ -729,6 +733,12 @@
 
 	if ((error = raidlock(rs)) != 0)
 		return (error);
+
+	if ((rs-sc_flags  RAIDF_SHUTDOWN) != 0) {
+		error = EBUSY;
+		goto bad;
+	}
+
 	lp = rs-sc_dkdev.dk_label;
 
 	part = DISKPART(dev);
@@ -797,7 +807,6 @@
 raidclose(dev_t dev, int flags, int fmt, struct lwp *l)
 {
 	int unit = raidunit(dev);
-	cfdata_t cf;
 	struct raid_softc *rs;
 	int error = 0;
 	int part;
@@ -833,24 +842,10 @@
 
 		rf_update_component_labels(raidPtrs[unit],
 		 RF_FINAL_COMPONENT_UPDATE);
-		if (doing_shutdown) {
-			/* last one, and we're going down, so
-			   lights out for this RAID set too. */
-			error = rf_Shutdown(raidPtrs[unit]);
-
-			/* It's no longer initialized... */
-			rs-sc_flags = ~RAIDF_INITED;
 
-			/* detach the device */
-			
-			cf = device_cfdata(rs-sc_dev);
-			error = config_detach(rs-sc_dev, DETACH_QUIET);
-			free(cf, M_RAIDFRAME);
-			
-			/* Detach the disk. */
-			disk_detach(rs-sc_dkdev);
-			disk_destroy(rs-sc_dkdev);
-		}
+		/* If the kernel is shutting down, it will detach
+		 * this RAID set soon enough.
+		 */
 	}
 
 	raidunlock(rs);
@@ -964,6 +959,35 @@
 
 }
 
+static int
+raid_detach_unlocked(struct raid_softc *rs)
+{
+	int error;
+	RF_Raid_t *raidPtr;
+
+	raidPtr = raidPtrs[device_unit(rs-sc_dev)];
+
+	/*
+	 * If somebody has a partition mounted, we shouldn't
+	 * shutdown.
+	 */
+	if (rs-sc_dkdev.dk_openmask != 0)
+		return EBUSY;
+
+	if ((rs-sc_flags  RAIDF_INITED) == 0)
+		;	/* not initialized: nothing to do */
+	else if ((error = rf_Shutdown(raidPtr)) != 0)
+		return error;
+	else
+		rs-sc_flags = ~(RAIDF_INITED|RAIDF_SHUTDOWN);
+
+	/* Detach the disk. */
+	disk_detach(rs-sc_dkdev);
+	disk_destroy(rs-sc_dkdev);
+
+	return 0;
+}
+
 int
 raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
@@ -1173,41 +1197,34 @@
 		/* shutdown the system */
 	case RAIDFRAME_SHUTDOWN:
 
+		part = DISKPART(dev);
+		pmask = (1  part);
+
 		if ((error = raidlock(rs)) != 0)
 			return (error);
 
-		/*
-		 * If somebody has a partition mounted, we shouldn't
-		 * shutdown.
-		 */
-
-		part = DISKPART(dev);
-		pmask = (1  part);
 		if ((rs-sc_dkdev.dk_openmask  ~pmask) ||
 		((rs-sc_dkdev.dk_bopenmask  pmask) 
-			(rs-sc_dkdev.dk_copenmask  pmask))) {
-			raidunlock(rs);
-			return (EBUSY);
+			(rs-sc_dkdev.dk_copenmask  pmask)))
+			retcode = EBUSY;
+		else {
+			rs-sc_flags |= RAIDF_SHUTDOWN;
+			rs-sc_dkdev.dk_copenmask = ~pmask;
+			rs-sc_dkdev.dk_bopenmask = ~pmask;
+			rs-sc_dkdev.dk_openmask = 

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

2009-07-24 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jul 24 21:22:22 UTC 2009

Modified Files:
src/sys/arch/xen/conf: files.xen

Log Message:
There's no such file as arch/i386/i386/core_machdep.c, so don't
list it here.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/xen/conf/files.xen

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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.100 src/sys/arch/xen/conf/files.xen:1.101
--- src/sys/arch/xen/conf/files.xen:1.100	Tue Jun 16 21:05:34 2009
+++ src/sys/arch/xen/conf/files.xen	Fri Jul 24 21:22:22 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.100 2009/06/16 21:05:34 bouyer Exp $
+#	$NetBSD: files.xen,v 1.101 2009/07/24 21:22:22 dyoung Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -30,7 +30,6 @@
 ifdef i386
 file	arch/i386/i386/aout_machdep.c	exec_aout
 file	arch/i386/i386/busfunc.S
-file	arch/i386/i386/core_machdep.c	coredump
 file	arch/i386/i386/cpufunc.S
 file	arch/i386/i386/cpu_in_cksum.S   (inet | inet6)  cpu_in_cksum
 file	arch/i386/i386/db_dbgreg.S	ddb | kstack_check_dr0



CVS commit: src/sys/dev

2009-07-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Jul 27 18:10:54 UTC 2009

Modified Files:
src/sys/dev/ic: gem.c gemvar.h
src/sys/dev/pci: if_gem_pci.c
src/sys/dev/sbus: if_gem_sbus.c

Log Message:
Do a complete device_t/softc split for the PCI attachment.  I have
not finished the device_t/softc split for the SBus attachment
because I don't have an SBus gem(4) to test with.

Convert from legacy shutdownhooks to a PMF shutdown hook.  Add PMF
suspend/resume handlers.

Factor a detachment hook out of gem_attach().  During device
attachment, track which resources are reserved in sc_attach_state,
and release only those resources during detachment.

Tested on gem0 and gem1 at pci1 on a Sun Fire V120.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/gem.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/gemvar.h
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_gem_pci.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/sbus/if_gem_sbus.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/gem.c
diff -u src/sys/dev/ic/gem.c:1.84 src/sys/dev/ic/gem.c:1.85
--- src/sys/dev/ic/gem.c:1.84	Tue May 12 14:25:17 2009
+++ src/sys/dev/ic/gem.c	Mon Jul 27 18:10:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.84 2009/05/12 14:25:17 cegger Exp $ */
+/*	$NetBSD: gem.c,v 1.85 2009/07/27 18:10:53 dyoung Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gem.c,v 1.84 2009/05/12 14:25:17 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: gem.c,v 1.85 2009/07/27 18:10:53 dyoung Exp $);
 
 #include opt_inet.h
 #include bpfilter.h
@@ -88,12 +88,12 @@
 
 #define TRIES	1
 
+static void	gem_inten(struct gem_softc *);
 static void	gem_start(struct ifnet *);
 static void	gem_stop(struct ifnet *, int);
 int		gem_ioctl(struct ifnet *, u_long, void *);
 void		gem_tick(void *);
 void		gem_watchdog(struct ifnet *);
-void		gem_shutdown(void *);
 void		gem_pcs_start(struct gem_softc *sc);
 void		gem_pcs_stop(struct gem_softc *sc, int);
 int		gem_init(struct ifnet *);
@@ -126,6 +126,8 @@
 int		gem_ser_mediachange(struct ifnet *);
 void		gem_ser_mediastatus(struct ifnet *, struct ifmediareq *);
 
+static void	gem_partial_detach(struct gem_softc *, enum gem_attach_stage);
+
 struct mbuf	*gem_get(struct gem_softc *, int, int);
 int		gem_put(struct gem_softc *, int, struct mbuf *);
 void		gem_read(struct gem_softc *, int, int);
@@ -145,6 +147,97 @@
 
 #define ETHER_MIN_TX (ETHERMIN + sizeof(struct ether_header))
 
+int
+gem_detach(struct gem_softc *sc, int flags)
+{
+	char *nullbuf;
+	int i, rc;
+	struct ifnet *ifp = sc-sc_ethercom.ec_if;
+
+	nullbuf =
+	(char *)sc-sc_control_data + sizeof(struct gem_control_data);
+
+	/*
+	 * Free any resources we've allocated during the attach.
+	 * Do this in reverse order and fall through.
+	 */
+	switch (sc-sc_att_stage) {
+	case GEM_ATT_BACKEND_2:
+	case GEM_ATT_BACKEND_1:
+	case GEM_ATT_FINISHED:
+		gem_stop(sc-sc_ethercom.ec_if, 1);
+
+#ifdef GEM_COUNTERS
+		for (i = __arraycount(sc-sc_ev_rxhist); --i = 0; )
+			evcnt_detach(sc-sc_ev_rxhist[i]);
+		evcnt_detach(sc-sc_ev_rxnobuf);
+		evcnt_detach(sc-sc_ev_rxfull);
+		evcnt_detach(sc-sc_ev_rxint);
+		evcnt_detach(sc-sc_ev_txint);
+#endif
+		evcnt_detach(sc-sc_ev_intr);
+
+		callout_destroy(sc-sc_tick_ch);
+#if NRND  0
+		rnd_detach_source(sc-rnd_source);
+#endif
+		ether_ifdetach(ifp);
+		if_detach(ifp);
+		ifmedia_delete_instance(sc-sc_mii.mii_media, IFM_INST_ANY);
+		/*FALLTHROUGH*/
+	case GEM_ATT_MII:
+		sc-sc_att_stage = GEM_ATT_MII;
+		if ((rc = config_detach_children(sc-sc_dev, flags)) != 0)
+			return rc;
+		/*FALLTHROUGH*/
+	case GEM_ATT_7:
+		for (i = 0; i  GEM_NRXDESC; i++) {
+			if (sc-sc_rxsoft[i].rxs_dmamap != NULL)
+bus_dmamap_destroy(sc-sc_dmatag,
+sc-sc_rxsoft[i].rxs_dmamap);
+		}
+		/*FALLTHROUGH*/
+	case GEM_ATT_6:
+		for (i = 0; i  GEM_TXQUEUELEN; i++) {
+			if (sc-sc_txsoft[i].txs_dmamap != NULL)
+bus_dmamap_destroy(sc-sc_dmatag,
+sc-sc_txsoft[i].txs_dmamap);
+		}
+		bus_dmamap_unload(sc-sc_dmatag, sc-sc_cddmamap);
+		/*FALLTHROUGH*/
+	case GEM_ATT_5:
+		bus_dmamap_destroy(sc-sc_dmatag, sc-sc_nulldmamap);
+		/*FALLTHROUGH*/
+	case GEM_ATT_4:
+		bus_dmamem_unmap(sc-sc_dmatag, nullbuf, ETHER_MIN_TX);
+		/*FALLTHROUGH*/
+	case GEM_ATT_3:
+		bus_dmamap_destroy(sc-sc_dmatag, sc-sc_cddmamap);
+		/*FALLTHROUGH*/
+	case GEM_ATT_2:
+		bus_dmamem_unmap(sc-sc_dmatag, sc-sc_control_data,
+		sizeof(struct gem_control_data));
+		/*FALLTHROUGH*/
+	case GEM_ATT_1:
+		bus_dmamem_free(sc-sc_dmatag, sc-sc_cdseg, sc-sc_cdnseg);
+		/*FALLTHROUGH*/
+	case GEM_ATT_0:
+		sc-sc_att_stage = GEM_ATT_0;
+		/*FALLTHROUGH*/
+	case GEM_ATT_BACKEND_0:
+		break;
+	}
+	return 0;
+}
+
+static void
+gem_partial_detach(struct gem_softc *sc, enum gem_attach_stage stage)
+{
+	cfattach_t ca = device_cfattach(sc-sc_dev);
+
+	sc-sc_att_stage = stage;
+	

CVS commit: src/sys/dev

2009-07-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Jul 28 17:55:27 UTC 2009

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

Log Message:
Make mdopen() and mdclose() maintain the openmask.  md_detach()
depends on the openmask to know whether it should either return
EBUSY because the device is open, or tear the device down.

Alan Barrett reports that this fixes kern/41725, in part: it prevents
the UVM fault, and the kernel detaches /dev/md0a after unmounting
/ on /dev/md0a instead of before.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/md.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/md.c
diff -u src/sys/dev/md.c:1.59 src/sys/dev/md.c:1.60
--- src/sys/dev/md.c:1.59	Tue May 19 20:25:41 2009
+++ src/sys/dev/md.c	Tue Jul 28 17:55:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.59 2009/05/19 20:25:41 dyoung Exp $	*/
+/*	$NetBSD: md.c,v 1.60 2009/07/28 17:55:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: md.c,v 1.59 2009/05/19 20:25:41 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: md.c,v 1.60 2009/07/28 17:55:27 dyoung Exp $);
 
 #include opt_md.h
 #include opt_tftproot.h
@@ -59,6 +59,7 @@
 #include sys/bufq.h
 #include sys/device.h
 #include sys/disk.h
+#include sys/stat.h
 #include sys/proc.h
 #include sys/conf.h
 #include sys/disklabel.h
@@ -243,18 +244,23 @@
 mdopen(dev_t dev, int flag, int fmt, struct lwp *l)
 {
 	int unit;
+	int part = DISKPART(dev);
+	int pmask = 1  part;
 	struct md_softc *sc;
+	struct disk *dk;
 
 	unit = MD_UNIT(dev);
 	sc = device_lookup_private(md_cd, unit);
 	if (sc == NULL)
 		return ENXIO;
 
+	dk = sc-sc_dkdev;
+
 	/*
 	 * The raw partition is used for ioctl to configure.
 	 */
-	if (DISKPART(dev) == RAW_PART)
-		return 0;
+	if (part == RAW_PART)
+		goto ok;
 
 #ifdef	MEMORY_DISK_HOOKS
 	/* Call the open hook to allow loading the device. */
@@ -268,13 +274,52 @@
 	if (sc-sc_type == MD_UNCONFIGURED)
 		return ENXIO;
 
+ok:
+	/* XXX duplicates code in dk_open().  Call dk_open(), instead? */
+	mutex_enter(dk-dk_openlock);
+	/* Mark our unit as open. */
+	switch (fmt) {
+	case S_IFCHR:
+		dk-dk_copenmask |= pmask;
+		break;
+	case S_IFBLK:
+		dk-dk_bopenmask |= pmask;
+		break;
+	}
+
+	dk-dk_openmask = dk-dk_copenmask | dk-dk_bopenmask;
+
+	mutex_exit(dk-dk_openlock);
 	return 0;
 }
 
 static int
 mdclose(dev_t dev, int flag, int fmt, struct lwp *l)
 {
+	int part = DISKPART(dev);
+	int pmask = 1  part;
+	struct md_softc *sc;
+	struct disk *dk;
+
+	sc = device_lookup_private(md_cd, MD_UNIT(dev));
+	if (sc == NULL)
+		return ENXIO;
+
+	dk = sc-sc_dkdev;
+
+	mutex_enter(dk-dk_openlock);
+
+	switch (fmt) {
+	case S_IFCHR:
+		dk-dk_copenmask = ~pmask;
+		break;
+	case S_IFBLK:
+		dk-dk_bopenmask = ~pmask;
+		break;
+	}
+	dk-dk_openmask = dk-dk_copenmask | dk-dk_bopenmask;
 
+	mutex_exit(dk-dk_openlock);
 	return 0;
 }
 



CVS commit: src/sbin/ifconfig

2009-07-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Jul 28 18:22:33 UTC 2009

Modified Files:
src/sbin/ifconfig: vlan.c

Log Message:
Don't require a vlan argument with -vlanif.  ifconfig vlan0
-vlanif works as one would expect, now.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sbin/ifconfig/vlan.c

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

Modified files:

Index: src/sbin/ifconfig/vlan.c
diff -u src/sbin/ifconfig/vlan.c:1.12 src/sbin/ifconfig/vlan.c:1.13
--- src/sbin/ifconfig/vlan.c:1.12	Tue Jul 15 21:27:58 2008
+++ src/sbin/ifconfig/vlan.c	Tue Jul 28 18:22:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vlan.c,v 1.12 2008/07/15 21:27:58 dyoung Exp $	*/
+/*	$NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: vlan.c,v 1.12 2008/07/15 21:27:58 dyoung Exp $);
+__RCSID($NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $);
 #endif /* not lint */
 
 #include sys/param.h 
@@ -140,17 +140,17 @@
 	if (getvlan(env, vlr, false) == -1)
 		err(EXIT_FAILURE, %s: getsock, __func__);
 
-	if (!prop_dictionary_get_int64(env, vlantag, tag)) {
-		errno = ENOENT;
-		return -1;
-	}
-
 	if (!prop_dictionary_get_cstring_nocopy(env, vlanif, parent)) {
 		errno = ENOENT;
 		return -1;
 	}
 	strlcpy(vlr.vlr_parent, parent, sizeof(vlr.vlr_parent));
-	if (strcmp(parent, ) != 0)
+	if (strcmp(parent, ) == 0)
+		;
+	else if (!prop_dictionary_get_int64(env, vlantag, tag)) {
+		errno = ENOENT;
+		return -1;
+	} else
 		vlr.vlr_tag = (unsigned short)tag;
 
 	if (indirect_ioctl(env, SIOCSETVLAN, vlr) == -1)



CVS commit: src/sys/netinet6

2009-07-30 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Jul 30 17:28:36 UTC 2009

Modified Files:
src/sys/netinet6: in6_ifattach.c

Log Message:
Fix typo in comment, s/SIOCSIFADDR/SIOCINITIFADDR/.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/netinet6/in6_ifattach.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/netinet6/in6_ifattach.c
diff -u src/sys/netinet6/in6_ifattach.c:1.81 src/sys/netinet6/in6_ifattach.c:1.82
--- src/sys/netinet6/in6_ifattach.c:1.81	Fri Nov  7 00:20:18 2008
+++ src/sys/netinet6/in6_ifattach.c	Thu Jul 30 17:28:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_ifattach.c,v 1.81 2008/11/07 00:20:18 dyoung Exp $	*/
+/*	$NetBSD: in6_ifattach.c,v 1.82 2009/07/30 17:28:36 dyoung Exp $	*/
 /*	$KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in6_ifattach.c,v 1.81 2008/11/07 00:20:18 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: in6_ifattach.c,v 1.82 2009/07/30 17:28:36 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -579,7 +579,7 @@
 	IN6_IFAUPDATE_DADDELAY)) != 0) {
 		/*
 		 * XXX: When the interface does not support IPv6, this call
-		 * would fail in the SIOCSIFADDR ioctl.  I believe the
+		 * would fail in the SIOCINITIFADDR ioctl.  I believe the
 		 * notification is rather confusing in this case, so just
 		 * suppress it.  (jin...@kame.net 20010130)
 		 */



CVS commit: src/sys/netinet6

2009-08-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Aug  4 22:04:23 UTC 2009

Modified Files:
src/sys/netinet6: mld6.c

Log Message:
Use malloc(...|M_ZERO) instead of malloc(...) followed by memset(,0,).


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/netinet6/mld6.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/netinet6/mld6.c
diff -u src/sys/netinet6/mld6.c:1.50 src/sys/netinet6/mld6.c:1.51
--- src/sys/netinet6/mld6.c:1.50	Sat Apr 18 14:58:05 2009
+++ src/sys/netinet6/mld6.c	Tue Aug  4 22:04:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mld6.c,v 1.50 2009/04/18 14:58:05 tsutsui Exp $	*/
+/*	$NetBSD: mld6.c,v 1.51 2009/08/04 22:04:23 dyoung Exp $	*/
 /*	$KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.50 2009/04/18 14:58:05 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.51 2009/08/04 22:04:23 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -637,14 +637,13 @@
 		 * and link it into the interface's multicast list.
 		 */
 		in6m = (struct in6_multi *)
-			malloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT);
+			malloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT|M_ZERO);
 		if (in6m == NULL) {
 			splx(s);
 			*errorp = ENOBUFS;
 			return (NULL);
 		}
 
-		memset(in6m, 0, sizeof(*in6m));
 		in6m-in6m_addr = *maddr6;
 		in6m-in6m_ifp = ifp;
 		in6m-in6m_refcount = 1;
@@ -754,13 +753,12 @@
 {
 	struct in6_multi_mship *imm;
 
-	imm = malloc(sizeof(*imm), M_IPMADDR, M_NOWAIT);
-	if (!imm) {
+	imm = malloc(sizeof(*imm), M_IPMADDR, M_NOWAIT|M_ZERO);
+	if (imm == NULL) {
 		*errorp = ENOBUFS;
 		return NULL;
 	}
 
-	memset(imm, 0, sizeof(*imm));
 	imm-i6mm_maddr = in6_addmulti(addr, ifp, errorp, timer);
 	if (!imm-i6mm_maddr) {
 		/* *errorp is already set */
@@ -870,9 +868,8 @@
 			return;
 	}
 
-	mk = malloc(sizeof(*mk), M_IPMADDR, M_WAITOK);
+	mk = malloc(sizeof(*mk), M_IPMADDR, M_ZERO|M_WAITOK);
 
-	memset(mk, 0, sizeof(*mk));
 	LIST_INIT(mk-mk_head);
 	mk-mk_ifp = ifp;
 	LIST_INSERT_HEAD(in6_mk, mk, mk_entry);



CVS commit: src/sys/dev

2009-08-06 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Aug  7 00:07:39 UTC 2009

Modified Files:
src/sys/dev: dkvar.h

Log Message:
Put the entire expression that DK_BUSY() evaluates to in parentheses
for safety.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dkvar.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/dkvar.h
diff -u src/sys/dev/dkvar.h:1.13 src/sys/dev/dkvar.h:1.14
--- src/sys/dev/dkvar.h:1.13	Mon Apr 28 20:23:46 2008
+++ src/sys/dev/dkvar.h	Fri Aug  7 00:07:39 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: dkvar.h,v 1.13 2008/04/28 20:23:46 martin Exp $ */
+/* $NetBSD: dkvar.h,v 1.14 2009/08/07 00:07:39 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -85,9 +85,9 @@
 };
 
 #define DK_BUSY(_dksc, _pmask)\
-	((_dksc)-sc_dkdev.dk_openmask  ~(_pmask)) ||	\
+	(((_dksc)-sc_dkdev.dk_openmask  ~(_pmask)) ||	\
 	((_dksc)-sc_dkdev.dk_bopenmask  (_pmask)  	\
-	((_dksc)-sc_dkdev.dk_copenmask  (_pmask)))
+	((_dksc)-sc_dkdev.dk_copenmask  (_pmask
 
 /*
  * Functions that are exported to the pseudo disk implementations:



CVS commit: src/sys/dev

2009-08-06 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Aug  7 00:08:07 UTC 2009

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

Log Message:
Re-use DK_BUSY().


To generate a diff of this commit:
cvs rdiff -u -r1.203 -r1.204 src/sys/dev/vnd.c

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

Modified files:

Index: src/sys/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.203 src/sys/dev/vnd.c:1.204
--- src/sys/dev/vnd.c:1.203	Tue Jul  7 19:51:22 2009
+++ src/sys/dev/vnd.c	Fri Aug  7 00:08:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.203 2009/07/07 19:51:22 dyoung Exp $	*/
+/*	$NetBSD: vnd.c,v 1.204 2009/08/07 00:08:07 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.203 2009/07/07 19:51:22 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: vnd.c,v 1.204 2009/08/07 00:08:07 dyoung Exp $);
 
 #if defined(_KERNEL_OPT)
 #include fs_nfs.h
@@ -163,6 +163,7 @@
 #include miscfs/genfs/genfs.h
 #include miscfs/specfs/specdev.h
 
+#include dev/dkvar.h
 #include dev/vndvar.h
 
 #include prop/proplib.h
@@ -972,9 +973,7 @@
 	 * or if both the character and block flavors of this
 	 * partition are open.
 	 */
-	if (((vnd-sc_dkdev.dk_openmask  ~pmask) ||
-	((vnd-sc_dkdev.dk_bopenmask  pmask) 
-	(vnd-sc_dkdev.dk_copenmask  pmask)))  !force) {
+	if (DK_BUSY(vnd, pmask)  !force) {
 		vndunlock(vnd);
 		return EBUSY;
 	}



CVS commit: src/sbin/ifconfig

2009-08-07 Thread David Young
 @@
-/*	$NetBSD: util.c,v 1.11 2009/04/27 20:10:49 dyoung Exp $	*/
+/*	$NetBSD: util.c,v 1.12 2009/08/07 18:53:37 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: util.c,v 1.11 2009/04/27 20:10:49 dyoung Exp $);
+__RCSID($NetBSD: util.c,v 1.12 2009/08/07 18:53:37 dyoung Exp $);
 #endif /* not lint */
 
 #include ctype.h
@@ -52,6 +52,7 @@
 #include netinet/in.h		/* XXX */
 
 #include env.h
+#include extern.h
 #include util.h
 
 int
@@ -279,7 +280,8 @@
 			continue;
 
 		if (getnameinfo(ifa-ifa_addr, ifa-ifa_addr-sa_len,
-			hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) == 0 
+			hbuf, sizeof(hbuf), NULL, 0,
+			Nflag ? 0 : NI_NUMERICHOST) == 0 
 		hbuf[0] != '\0') {
 			printf(\t%s %s\n,
 			print_active_only ? address: : link, hbuf);



CVS commit: src/sbin/ifconfig

2009-08-07 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Aug  7 19:35:55 UTC 2009

Modified Files:
src/sbin/ifconfig: af_inet.c

Log Message:
Use getnameinfo(3) instead of inet_ntoa(3) to convert IPv4 addresses
to names.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sbin/ifconfig/af_inet.c

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

Modified files:

Index: src/sbin/ifconfig/af_inet.c
diff -u src/sbin/ifconfig/af_inet.c:1.12 src/sbin/ifconfig/af_inet.c:1.13
--- src/sbin/ifconfig/af_inet.c:1.12	Wed Jul  2 07:44:14 2008
+++ src/sbin/ifconfig/af_inet.c	Fri Aug  7 19:35:55 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inet.c,v 1.12 2008/07/02 07:44:14 dyoung Exp $	*/
+/*	$NetBSD: af_inet.c,v 1.13 2009/08/07 19:35:55 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: af_inet.c,v 1.12 2008/07/02 07:44:14 dyoung Exp $);
+__RCSID($NetBSD: af_inet.c,v 1.13 2009/08/07 19:35:55 dyoung Exp $);
 #endif /* not lint */
 
 #include sys/param.h 
@@ -79,6 +79,11 @@
 	int s;
 	unsigned short flags;
 	struct in_aliasreq in_addreq;
+	const struct sockaddr_in * const asin = in_addreq.ifra_addr;
+	const struct sockaddr_in * const dsin = in_addreq.ifra_dstaddr;
+	const struct sockaddr_in * const bsin = in_addreq.ifra_broadaddr;
+	char hbuf[NI_MAXHOST];
+	const int niflag = Nflag ? 0 : NI_NUMERICHOST;
 
 	if (lflag)
 		return;
@@ -109,20 +114,28 @@
 			warn(SIOCGIFALIAS);
 	}
 
-	printf(\tinet %s%s, alias ? alias  : ,
-	inet_ntoa(in_addreq.ifra_addr.sin_addr));
+	if (getnameinfo((const struct sockaddr *)asin, asin-sin_len,
+			hbuf, sizeof(hbuf), NULL, 0, niflag))
+		strlcpy(hbuf, , sizeof(hbuf));	/* some message? */
+	printf(\tinet %s%s, alias ? alias  : , hbuf);
 
 	if (getifflags(env, oenv, flags) == -1)
 		err(EXIT_FAILURE, %s: getifflags, __func__);
 
-	if (flags  IFF_POINTOPOINT)
-		printf( - %s, inet_ntoa(in_addreq.ifra_dstaddr.sin_addr));
+	if (flags  IFF_POINTOPOINT) {
+		if (getnameinfo((const struct sockaddr *)dsin, dsin-sin_len,
+hbuf, sizeof(hbuf), NULL, 0, niflag))
+			strlcpy(hbuf, , sizeof(hbuf)); /* some message? */
+		printf( - %s, hbuf);
+	}
 
 	printf( netmask 0x%x, ntohl(in_addreq.ifra_mask.sin_addr.s_addr));
 
 	if (flags  IFF_BROADCAST) {
-		printf( broadcast %s,
-		inet_ntoa(in_addreq.ifra_broadaddr.sin_addr));
+		if (getnameinfo((const struct sockaddr *)bsin, bsin-sin_len,
+hbuf, sizeof(hbuf), NULL, 0, niflag))
+			strlcpy(hbuf, , sizeof(hbuf)); /* some message? */
+		printf( broadcast %s, hbuf);
 	}
 }
 



CVS commit: src/sbin/ifconfig

2009-08-07 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Aug  7 20:13:12 UTC 2009

Modified Files:
src/sbin/ifconfig: ifconfig.8

Log Message:
Describe the -N flag.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sbin/ifconfig/ifconfig.8

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.99 src/sbin/ifconfig/ifconfig.8:1.100
--- src/sbin/ifconfig/ifconfig.8:1.99	Wed Jul 29 21:47:11 2009
+++ src/sbin/ifconfig/ifconfig.8	Fri Aug  7 20:13:12 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: ifconfig.8,v 1.99 2009/07/29 21:47:11 hubertf Exp $
+.\	$NetBSD: ifconfig.8,v 1.100 2009/08/07 20:13:12 dyoung Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)ifconfig.8	8.4 (Berkeley) 6/1/94
 .\
-.Dd July 2, 2009
+.Dd August 7, 2009
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Nd configure network interface parameters
 .Sh SYNOPSIS
 .Nm
+.Op Fl N
 .Ar interface address_family
 .Oo
 .Ar address
@@ -44,12 +45,12 @@
 .Oc
 .Op Ar parameters
 .Nm
-.Op Fl hLmvz
+.Op Fl hLmNvz
 .Ar interface
 .Op Ar protocol_family
 .Nm
 .Fl a
-.Op Fl bdhLmsuvz
+.Op Fl bdhLNmsuvz
 .Op Ar protocol_family
 .Nm
 .Fl l
@@ -813,6 +814,21 @@
 flag except that it zeros the interface input and output statistics
 after printing them.
 .Pp
+The
+.Fl N
+flag is just the opposite of the
+.Fl n
+flag in
+.Xr netstat 1
+or in
+.Xr route 8 :
+it tells
+.Nm
+to try to resolve numbers to hostnames or to service names.
+The default
+.Nm
+behavior is to print numbers instead of names.
+.Pp
 Only the super-user may modify the configuration of a network interface.
 .Sh EXAMPLES
 Add a link-layer (MAC) address to an Ethernet:



CVS commit: src/sys/kern

2011-01-31 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Jan 31 23:00:34 UTC 2011

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

Log Message:
If there are readers or writers in the alldevs list, don't remove a
device_t out from under them, but tag it for deletion, later.


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 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.210 src/sys/kern/subr_autoconf.c:1.211
--- src/sys/kern/subr_autoconf.c:1.210	Fri Jan 14 10:18:21 2011
+++ src/sys/kern/subr_autoconf.c	Mon Jan 31 23:00:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.210 2011/01/14 10:18:21 martin Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.210 2011/01/14 10:18:21 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_ddb.h
@@ -1700,8 +1700,14 @@
 	config_alldevs_enter(af);
 	KASSERT(alldevs_nwrite != 0);
 	--alldevs_nwrite;
-	if (rv == 0  dev-dv_del_gen == 0)
-		config_devunlink(dev, af.af_garbage);
+	if (rv == 0  dev-dv_del_gen == 0) {
+		if (alldevs_nwrite == 0  alldevs_nread == 0)
+			config_devunlink(dev, af.af_garbage);
+		else {
+			dev-dv_del_gen = alldevs_gen;
+			alldevs_garbage = true;
+		}
+	}
 	config_alldevs_exit(af);
 
 	return rv;



CVS commit: src/sys

2011-01-31 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Jan 31 23:07:17 UTC 2011

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

Log Message:
Let the linker instead of the C preprocessor configure the kernel: make
weak aliases device_register(9) and device_register_post_config(9)
for the stub routine voidop().  Get rid of __HAVE_DEVICE_REGISTER and
__HAVE_DEVICE_REGISTER_POST_CONFIG.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/kern_stub.c
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.137 -r1.138 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/kern_stub.c
diff -u src/sys/kern/kern_stub.c:1.29 src/sys/kern/kern_stub.c:1.30
--- src/sys/kern/kern_stub.c:1.29	Sun Jun 13 13:43:02 2010
+++ src/sys/kern/kern_stub.c	Mon Jan 31 23:07:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_stub.c,v 1.29 2010/06/13 13:43:02 simonb Exp $	*/
+/*	$NetBSD: kern_stub.c,v 1.30 2011/01/31 23:07:16 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_stub.c,v 1.29 2010/06/13 13:43:02 simonb Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_stub.c,v 1.30 2011/01/31 23:07:16 dyoung Exp $);
 
 #include opt_ptrace.h
 #include opt_ktrace.h
@@ -122,6 +122,8 @@
 __weak_alias(ktr_point,nullop);
 #endif	/* KTRACE */
 
+__weak_alias(device_register, voidop);
+__weak_alias(device_register_post_config, voidop);
 __weak_alias(spldebug_start, voidop);
 __weak_alias(spldebug_stop, voidop);
 __weak_alias(machdep_init,nullop);

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.211 src/sys/kern/subr_autoconf.c:1.212
--- src/sys/kern/subr_autoconf.c:1.211	Mon Jan 31 23:00:34 2011
+++ src/sys/kern/subr_autoconf.c	Mon Jan 31 23:07:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.212 2011/01/31 23:07:16 dyoung Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.212 2011/01/31 23:07:16 dyoung Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_ddb.h
@@ -1468,9 +1468,7 @@
 			}
 		}
 	}
-#ifdef __HAVE_DEVICE_REGISTER
 	device_register(dev, aux);
-#endif
 
 	/* Let userland know */
 	devmon_report_device(dev, true);
@@ -1490,9 +1488,7 @@
 
 	config_process_deferred(deferred_config_queue, dev);
 
-#ifdef __HAVE_DEVICE_REGISTER_POSTCONFIG
 	device_register_post_config(dev, aux);
-#endif
 	return dev;
 }
 
@@ -1531,10 +1527,8 @@
 	config_devlink(dev);
 
 #if 0	/* XXXJRT not yet */
-#ifdef __HAVE_DEVICE_REGISTER
 	device_register(dev, NULL);	/* like a root node */
 #endif
-#endif
 	(*dev-dv_cfattach-ca_attach)(ROOT, dev, NULL);
 	config_process_deferred(deferred_config_queue, dev);
 	return dev;

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.137 src/sys/sys/device.h:1.138
--- src/sys/sys/device.h:1.137	Fri Jun 25 15:10:42 2010
+++ src/sys/sys/device.h	Mon Jan 31 23:07:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.137 2010/06/25 15:10:42 tsutsui Exp $ */
+/* $NetBSD: device.h,v 1.138 2011/01/31 23:07:17 dyoung Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -495,12 +495,8 @@
 
 device_t	device_lookup(cfdriver_t, int);
 void		*device_lookup_private(cfdriver_t, int);
-#ifdef __HAVE_DEVICE_REGISTER
 void		device_register(device_t, void *);
-#endif
-#ifdef __HAVE_DEVICE_REGISTER_POSTCONFIG
 void		device_register_post_config(device_t, void *);
-#endif
 
 devclass_t	device_class(device_t);
 cfdata_t	device_cfdata(device_t);



CVS commit: src/share/man/man4

2011-02-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Feb  1 15:53:31 UTC 2011

Modified Files:
src/share/man/man4: pty.4

Log Message:
Describe TIOCEXT.  Improve description of TIOCPKT_IOCTL.  Tell the
width of some TIOCxxx parameters.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/share/man/man4/pty.4

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

Modified files:

Index: src/share/man/man4/pty.4
diff -u src/share/man/man4/pty.4:1.12 src/share/man/man4/pty.4:1.13
--- src/share/man/man4/pty.4:1.12	Fri Oct 13 20:30:16 2006
+++ src/share/man/man4/pty.4	Tue Feb  1 15:53:31 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: pty.4,v 1.12 2006/10/13 20:30:16 wiz Exp $
+.\	$NetBSD: pty.4,v 1.13 2011/02/01 15:53:31 dyoung Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)pty.4	8.2 (Berkeley) 11/30/93
 .\
-.Dd October 7, 2006
+.Dd February 1, 2011
 .Dt PTY 4
 .Os
 .Sh NAME
@@ -72,6 +72,21 @@
 .Xr ioctl 2
 calls apply only to pseudo terminals:
 .Bl -tag -width TIOCREMOTE
+.It Dv TIOCEXT
+Enable/disable
+.Dq external processing .
+This affects delivery of
+.Dv TIOCPKT_IOCTL
+packets.
+External processing is enabled by specifying (by reference) a nonzero
+.Vt int
+parameter and disabled by specifying (by reference) a zero
+.Vt int
+parameter.
+.Pp
+.Dv TIOCEXT
+is reset to its default (disabled) when the slave closes the
+.Nm .
 .It Dv TIOCSTOP
 Stops output to a terminal (e.g. like typing
 .Ql ^S ) .
@@ -88,7 +103,10 @@
 .Em packet
 mode.
 Packet mode is enabled by specifying (by reference) a nonzero
-parameter and disabled by specifying (by reference) a zero parameter.
+.Vt int
+parameter and disabled by specifying (by reference) a zero
+.Vt int
+parameter.
 When applied to the master side of a pseudo
 terminal, each subsequent
 .Xr read 2
@@ -139,13 +157,28 @@
 .It Dv TIOCPKT_IOCTL
 When this bit is set, the slave has changed the
 .Xr termios 4
-structure (TTY state), and the remainder of the data read from
+structure (TTY state),
+and the remainder of the data read from
 the master side of the
 .Nm
-is a copy of the new
+is the new
+.Xr termios 4
+structure.
+The master side of the
+.Nm
+can also use
+.Xr tcgetattr 3
+to read the new
 .Xr termios 4
 structure.
 .Pp
+The master will not read packets with the bit
+.Dv TIOCPKT_IOCTL
+set until it has activated
+.Dq external processing
+using 
+.Dv TIOCEXT .
+.Pp
 This is used by
 .Xr telnetd 8
 to implement TELNET line mode - it allows the
@@ -168,8 +201,12 @@
 modes are mutually exclusive.
 This mode is enabled from the master side of a pseudo terminal
 by specifying (by reference)
-a nonzero parameter and disabled by specifying (by reference)
-a zero parameter.
+a nonzero
+.Vt int
+parameter and disabled by specifying (by reference)
+a zero
+.Vt int
+parameter.
 Each subsequent
 .Xr read 2
 from the master side will return data written on the slave part of



CVS commit: src/sys/dev/pci

2011-02-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Feb  1 19:37:37 UTC 2011

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

Log Message:
During shutdown, restore the each PCI device's bus-mastering enable to
the state that we found it in before attaching a driver to it.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/pci/pci.c

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

Modified files:

Index: src/sys/dev/pci/pci.c
diff -u src/sys/dev/pci/pci.c:1.130 src/sys/dev/pci/pci.c:1.131
--- src/sys/dev/pci/pci.c:1.130	Sat Nov 13 13:52:08 2010
+++ src/sys/dev/pci/pci.c	Tue Feb  1 19:37:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.130 2010/11/13 13:52:08 uebayasi Exp $	*/
+/*	$NetBSD: pci.c,v 1.131 2011/02/01 19:37:37 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci.c,v 1.130 2010/11/13 13:52:08 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci.c,v 1.131 2011/02/01 19:37:37 dyoung Exp $);
 
 #include opt_pci.h
 
@@ -819,6 +819,7 @@
 	int p_pm_offset;
 	pcireg_t p_pm_cap;
 	pcireg_t p_class;
+	pcireg_t p_csr;
 };
 
 static bool
@@ -872,9 +873,10 @@
 	struct pci_child_power *priv = device_pmf_bus_private(dv);
 	pcireg_t csr;
 
-	/* disable busmastering */
+	/* restore original bus-mastering state */
 	csr = pci_conf_read(priv-p_pc, priv-p_tag, PCI_COMMAND_STATUS_REG);
 	csr = ~PCI_COMMAND_MASTER_ENABLE;
+	csr |= priv-p_csr  PCI_COMMAND_MASTER_ENABLE;
 	pci_conf_write(priv-p_pc, priv-p_tag, PCI_COMMAND_STATUS_REG, csr);
 	return true;
 }
@@ -905,6 +907,8 @@
 	priv-p_tag = pci_make_tag(priv-p_pc, sc-sc_bus, device,
 	function);
 	priv-p_class = pci_conf_read(priv-p_pc, priv-p_tag, PCI_CLASS_REG);
+	priv-p_csr = pci_conf_read(priv-p_pc, priv-p_tag,
+	PCI_COMMAND_STATUS_REG);
 
 	if (pci_get_capability(priv-p_pc, priv-p_tag,
 			   PCI_CAP_PWRMGMT, off, reg)) {



CVS commit: src/sys/netinet6

2011-02-06 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Feb  6 19:12:55 UTC 2011

Modified Files:
src/sys/netinet6: in6.c

Log Message:
Delete unnecessary casts to void *. No functional change intended.  Same
assembly generated before and after this change.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/netinet6/in6.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/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.156 src/sys/netinet6/in6.c:1.157
--- src/sys/netinet6/in6.c:1.156	Thu Apr 22 20:05:15 2010
+++ src/sys/netinet6/in6.c	Sun Feb  6 19:12:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.156 2010/04/22 20:05:15 dyoung Exp $	*/
+/*	$NetBSD: in6.c,v 1.157 2011/02/06 19:12:55 dyoung Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in6.c,v 1.156 2010/04/22 20:05:15 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: in6.c,v 1.157 2011/02/06 19:12:55 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_pfil_hooks.h
@@ -965,7 +965,7 @@
 		M_NOWAIT);
 		if (ia == NULL)
 			return ENOBUFS;
-		memset((void *)ia, 0, sizeof(*ia));
+		memset(ia, 0, sizeof(*ia));
 		LIST_INIT(ia-ia6_memberships);
 		/* Initialize the address and masks, and put time stamp */
 		ia-ia_ifa.ifa_addr = (struct sockaddr *)ia-ia_addr;
@@ -1607,7 +1607,7 @@
 		ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;
 		ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
 		ifra.ifra_flags = iflr-flags  ~IFLR_PREFIX;
-		return in6_control(so, SIOCAIFADDR_IN6, (void *)ifra, ifp, l);
+		return in6_control(so, SIOCAIFADDR_IN6, ifra, ifp, l);
 	}
 	case SIOCGLIFADDR:
 	case SIOCDLIFADDR:
@@ -1718,8 +1718,7 @@
 			ia-ia_prefixmask.sin6_len);
 
 			ifra.ifra_flags = ia-ia6_flags;
-			return in6_control(so, SIOCDIFADDR_IN6, (void *)ifra,
-			ifp, l);
+			return in6_control(so, SIOCDIFADDR_IN6, ifra, ifp, l);
 		}
 	}
 	}



CVS commit: src/sbin

2011-02-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Feb 16 17:53:31 UTC 2011

Modified Files:
src/sbin/reboot: reboot.8 reboot.c
src/sbin/shutdown: shutdown.8 shutdown.c

Log Message:
Add flags -v, -x, and -z for verbose, debug, and silent shutdowns,
respectively, by passing flags AB_VERBOSE, AB_DEBUG, and/or AB_SILENT to
reboot(2).


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sbin/reboot/reboot.8
cvs rdiff -u -r1.36 -r1.37 src/sbin/reboot/reboot.c
cvs rdiff -u -r1.28 -r1.29 src/sbin/shutdown/shutdown.8
cvs rdiff -u -r1.52 -r1.53 src/sbin/shutdown/shutdown.c

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

Modified files:

Index: src/sbin/reboot/reboot.8
diff -u src/sbin/reboot/reboot.8:1.27 src/sbin/reboot/reboot.8:1.28
--- src/sbin/reboot/reboot.8:1.27	Sun Dec 12 11:38:42 2010
+++ src/sbin/reboot/reboot.8	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: reboot.8,v 1.27 2010/12/12 11:38:42 pooka Exp $
+.\	$NetBSD: reboot.8,v 1.28 2011/02/16 17:53:31 dyoung Exp $
 .\
 .\ Copyright (c) 1990, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)reboot.8	8.1 (Berkeley) 6/9/93
 .\
-.Dd October 21, 2008
+.Dd February 16, 2011
 .Dt REBOOT 8
 .Os
 .Sh NAME
@@ -81,6 +81,27 @@
 software powerdown, the system will halt.
 This option is only valid for
 .Nm halt .
+.It Fl v
+To enable verbose messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_VERBOSE
+to
+.Xr reboot 2 .
+.It Fl x
+To enable debugging messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_DEBUG
+to
+.Xr reboot 2 .
+.It Fl z
+To silence some shutdown messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_SILENT
+to
+.Xr reboot 2 .
 .It Fl q
 Do not give processes a chance to shut down before halting or restarting.
 This option should not normally be used.

Index: src/sbin/reboot/reboot.c
diff -u src/sbin/reboot/reboot.c:1.36 src/sbin/reboot/reboot.c:1.37
--- src/sbin/reboot/reboot.c:1.36	Sun Jul 20 01:20:23 2008
+++ src/sbin/reboot/reboot.c	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $	*/
+/*	$NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = @(#)reboot.c	8.1 (Berkeley) 6/5/93;
 #else
-__RCSID($NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $);
+__RCSID($NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $);
 #endif
 #endif /* not lint */
 
@@ -85,7 +85,7 @@
 	} else
 		howto = 0;
 	lflag = nflag = qflag = 0;
-	while ((ch = getopt(argc, argv, dlnpq)) != -1)
+	while ((ch = getopt(argc, argv, dlnpqvxz)) != -1)
 		switch(ch) {
 		case 'd':
 			howto |= RB_DUMP;
@@ -105,6 +105,15 @@
 		case 'q':
 			qflag = 1;
 			break;
+		case 'v':
+			howto |= AB_VERBOSE;
+			break;
+		case 'x':
+			howto |= AB_DEBUG;
+			break;
+		case 'z':
+			howto |= AB_SILENT;
+			break;
 		case '?':
 		default:
 			usage();

Index: src/sbin/shutdown/shutdown.8
diff -u src/sbin/shutdown/shutdown.8:1.28 src/sbin/shutdown/shutdown.8:1.29
--- src/sbin/shutdown/shutdown.8:1.28	Tue Oct 21 02:35:51 2008
+++ src/sbin/shutdown/shutdown.8	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: shutdown.8,v 1.28 2008/10/21 02:35:51 lukem Exp $
+.\	$NetBSD: shutdown.8,v 1.29 2011/02/16 17:53:31 dyoung Exp $
 .\
 .\ Copyright (c) 1988, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)shutdown.8	8.2 (Berkeley) 4/27/95
 .\
-.Dd October 21, 2008
+.Dd February 16, 2011
 .Dt SHUTDOWN 8
 .Os
 .Sh NAME
@@ -110,6 +110,27 @@
 .Ar time ,
 using
 .Xr reboot 8 .
+.It Fl v
+To enable verbose messages on the console, pass
+.Fl v
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
+.It Fl x
+To enable debugging messages on the console, pass
+.Fl x
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
+.It Fl z
+To silence some shutdown messages on the console, pass
+.Fl z
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
 .It Fl D
 Prevents
 .Nm

Index: src/sbin/shutdown/shutdown.c
diff -u src/sbin/shutdown/shutdown.c:1.52 src/sbin/shutdown/shutdown.c:1.53
--- src/sbin/shutdown/shutdown.c:1.52	Wed Jun  9 04:51:53 2010
+++ src/sbin/shutdown/shutdown.c	Wed Feb 16 17:53:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $	*/
+/*	$NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)shutdown.c	8.4 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $);
+__RCSID($NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $);
 #endif
 #endif /* not lint */
 
@@ -91,6 +91,7 @@
 static int dofast, dohalt, doreboot, killflg, nofork, nosync, dodump;
 static size_t mbuflen;
 static int dopowerdown;
+static int dodebug, dosilent, doverbose;
 static const char 

CVS commit: src/sys/arch/i386/stand/lib

2011-02-20 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Feb 21 00:39:54 UTC 2011

Modified Files:
src/sys/arch/i386/stand/lib: libi386.h

Log Message:
biosdisk_getextinfo() returns 0 on success, non-zero on failure, so
change its return type from void to int.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/stand/lib/libi386.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/i386/stand/lib/libi386.h
diff -u src/sys/arch/i386/stand/lib/libi386.h:1.34 src/sys/arch/i386/stand/lib/libi386.h:1.35
--- src/sys/arch/i386/stand/lib/libi386.h:1.34	Sun Feb  6 23:16:05 2011
+++ src/sys/arch/i386/stand/lib/libi386.h	Mon Feb 21 00:39:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: libi386.h,v 1.34 2011/02/06 23:16:05 jmcneill Exp $	*/
+/*	$NetBSD: libi386.h,v 1.35 2011/02/21 00:39:54 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996
@@ -121,7 +121,7 @@
 int biosdisk_int13ext(int);
 int biosdisk_getinfo(int);
 struct biosdisk_extinfo;
-void biosdisk_getextinfo(int, struct biosdisk_extinfo *);
+int biosdisk_getextinfo(int, struct biosdisk_extinfo *);
 int get_harddrives(void);
 void biosdisk_probe(void);
 



CVS commit: src/sys/dev/pci

2011-02-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Feb 22 21:19:32 UTC 2011

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

Log Message:
Use /*FALLTHROUGH*/.


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.219 src/sys/dev/pci/if_wm.c:1.220
--- src/sys/dev/pci/if_wm.c:1.219	Sun Feb  6 16:23:00 2011
+++ src/sys/dev/pci/if_wm.c	Tue Feb 22 21:19:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.219 2011/02/06 16:23:00 bouyer Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.220 2011/02/22 21:19:30 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.219 2011/02/06 16:23:00 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.220 2011/02/22 21:19:30 dyoung Exp $);
 
 #include rnd.h
 
@@ -2797,7 +2797,7 @@
 			error = 0;
 			break;
 		}
-		/* Fall through for rest */
+		/*FALLTHROUGH*/
 	default:
 		if ((error = ether_ioctl(ifp, cmd, data)) != ENETRESET)
 			break;



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

2011-02-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Feb 22 23:57:22 UTC 2011

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

Log Message:
Add CardBus to PCI bridge, ppb at cardbus, but comment it out for now.


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.292 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.291 src/sys/arch/i386/conf/ALL:1.292
--- src/sys/arch/i386/conf/ALL:1.291	Sun Feb 20 15:41:22 2011
+++ src/sys/arch/i386/conf/ALL	Tue Feb 22 23:57:22 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.291 2011/02/20 15:41:22 jmcneill Exp $
+# $NetBSD: ALL,v 1.292 2011/02/22 23:57:22 dyoung Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.291 $
+#ident 		ALL-$Revision: 1.292 $
 
 maxusers	64		# estimated number of users
 
@@ -631,6 +631,9 @@
 # CardBus serial interfaces
 com*	at cardbus? function ?	# Modems and serial cards
 
+# Cardbus bridges
+#ppb*	at cardbus? function ?	# Cardbus-PCI bridges (www.magma.com)
+
 # ISA serial interfaces
 #options 	COM_HAYESP		# adds Hayes ESP serial board support
 com0	at isa? port 0x3f8 irq 4	# Standard PC serial ports



CVS commit: src/usr.sbin/mrouted

2011-02-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Feb 23 01:23:04 UTC 2011

Modified Files:
src/usr.sbin/mrouted: defs.h kern.c

Log Message:
Don't use bool as a variable name.

Remove a bunch of parameter names form function prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/mrouted/defs.h
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/mrouted/kern.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.sbin/mrouted/defs.h
diff -u src/usr.sbin/mrouted/defs.h:1.14 src/usr.sbin/mrouted/defs.h:1.15
--- src/usr.sbin/mrouted/defs.h:1.14	Wed Feb 21 21:01:10 2007
+++ src/usr.sbin/mrouted/defs.h	Wed Feb 23 01:23:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.14 2007/02/21 21:01:10 hubertf Exp $	*/
+/*	$NetBSD: defs.h,v 1.15 2011/02/23 01:23:03 dyoung Exp $	*/
 
 /*
  * The mrouted program is covered by the license in the accompanying file
@@ -255,19 +255,19 @@
 extern int		find_src_grp(u_int32_t, u_int32_t, u_int32_t);
 
 /* kern.c */
-extern void		k_set_rcvbuf(int bufsize);
-extern void		k_hdr_include(int bool);
-extern void		k_set_ttl(int t);
-extern void		k_set_loop(int l);
-extern void		k_set_if(u_int32_t ifa);
-extern void		k_join(u_int32_t grp, u_int32_t ifa);
-extern void		k_leave(u_int32_t grp, u_int32_t ifa);
+extern void		k_set_rcvbuf(int);
+extern void		k_hdr_include(int);
+extern void		k_set_ttl(int);
+extern void		k_set_loop(int);
+extern void		k_set_if(u_int32_t);
+extern void		k_join(u_int32_t, u_int32_t);
+extern void		k_leave(u_int32_t, u_int32_t);
 extern void		k_init_dvmrp(void);
 extern void		k_stop_dvmrp(void);
-extern void		k_add_vif(vifi_t vifi, struct uvif *v);
-extern void		k_del_vif(vifi_t vifi);
-extern void		k_add_rg(u_int32_t origin, struct gtable *g);
-extern int		k_del_rg(u_int32_t origin, struct gtable *g);
+extern void		k_add_vif(vifi_t, struct uvif *);
+extern void		k_del_vif(vifi_t);
+extern void		k_add_rg(u_int32_t, struct gtable *);
+extern int		k_del_rg(u_int32_t, struct gtable *);
 extern int		k_get_version(void);
 
 #ifdef SNMP

Index: src/usr.sbin/mrouted/kern.c
diff -u src/usr.sbin/mrouted/kern.c:1.10 src/usr.sbin/mrouted/kern.c:1.11
--- src/usr.sbin/mrouted/kern.c:1.10	Tue May  9 20:18:09 2006
+++ src/usr.sbin/mrouted/kern.c	Wed Feb 23 01:23:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.c,v 1.10 2006/05/09 20:18:09 mrg Exp $	*/
+/*	$NetBSD: kern.c,v 1.11 2011/02/23 01:23:03 dyoung Exp $	*/
 
 /*
  * The mrouted program is covered by the license in the accompanying file
@@ -21,12 +21,12 @@
 }
 
 
-void k_hdr_include(int bool)
+void k_hdr_include(int onoff)
 {
 #ifdef IP_HDRINCL
 if (setsockopt(igmp_socket, IPPROTO_IP, IP_HDRINCL,
-		   (char *)bool, sizeof(bool))  0)
-	logit(LOG_ERR, errno, setsockopt IP_HDRINCL %u, bool);
+		   (char *)onoff, sizeof(onoff))  0)
+	logit(LOG_ERR, errno, setsockopt IP_HDRINCL %u, onoff);
 #endif
 }
 



CVS commit: src/sys/dev

2011-02-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Feb 23 16:20:30 UTC 2011

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

Log Message:
Correct device_t/softc split and, while I am here, delete commented-out
code.  Patrick Welche says that this patch fixes the problem that he
reported on current-users@.

BTW, sc_dev is initialized in radioattach(), but I do not see where it
is used.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/radio.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/radio.c
diff -u src/sys/dev/radio.c:1.24 src/sys/dev/radio.c:1.25
--- src/sys/dev/radio.c:1.24	Thu Jan 21 02:19:55 2010
+++ src/sys/dev/radio.c	Wed Feb 23 16:20:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: radio.c,v 1.24 2010/01/21 02:19:55 dyoung Exp $ */
+/* $NetBSD: radio.c,v 1.25 2011/02/23 16:20:30 dyoung Exp $ */
 /* $OpenBSD: radio.c,v 1.2 2001/12/05 10:27:06 mickey Exp $ */
 /* $RuOBSD: radio.c,v 1.7 2001/12/04 06:03:05 tm Exp $ */
 
@@ -30,7 +30,7 @@
 /* This is the /dev/radio driver from OpenBSD */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: radio.c,v 1.24 2010/01/21 02:19:55 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: radio.c,v 1.25 2011/02/23 16:20:30 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,7 +78,7 @@
 static void
 radioattach(device_t parent, device_t self, void *aux)
 {
-	struct radio_softc *sc = (void *)self;
+	struct radio_softc *sc = device_private(self);
 	struct radio_attach_args *sa = aux;
 	const struct radio_hw_if *hwp = sa-hwif;
 	void  *hdlp = sa-hdl;
@@ -87,7 +87,7 @@
 	aprint_normal(\n);
 	sc-hw_if = hwp;
 	sc-hw_hdl = hdlp;
-	sc-sc_dev = parent;
+	sc-sc_dev = self;
 }
 
 static int
@@ -181,7 +181,6 @@
 static int
 radiodetach(device_t self, int flags)
 {
-	/*struct radio_softc *sc = (struct radio_softc *)self;*/
 	int maj, mn;
 
 	/* locate the major number */



CVS commit: src/sys/ufs/ffs

2011-02-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Feb 23 17:05:33 UTC 2011

Modified Files:
src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
Initialize blkno to 0 right before the snapblkaddr() call that GCC does
not understand so that if ffs_copyonwrite() sprouts a new code path that
does not initialize blkno, the compiler has the chance to reveal it.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/ufs/ffs/ffs_snapshot.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/ufs/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.108 src/sys/ufs/ffs/ffs_snapshot.c:1.109
--- src/sys/ufs/ffs/ffs_snapshot.c:1.108	Wed Feb 23 08:53:21 2011
+++ src/sys/ufs/ffs/ffs_snapshot.c	Wed Feb 23 17:05:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.108 2011/02/23 08:53:21 hannken Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.109 2011/02/23 17:05:33 dyoung Exp $	*/
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.108 2011/02/23 08:53:21 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.109 2011/02/23 17:05:33 dyoung Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -1826,8 +1826,6 @@
 	uint32_t gen;
 	int lower, upper, mid, snapshot_locked = 0, error = 0;
 
-	blkno = 0; /* XXX: GCC */
-
 	/*
 	 * Check for valid snapshots.
 	 */
@@ -1898,6 +1896,7 @@
 			blkno = db_get(ip, lbn);
 		} else {
 			mutex_exit(si-si_lock);
+			blkno = 0; /* XXX: GCC */
 			if ((error = snapblkaddr(vp, lbn, blkno)) != 0) {
 mutex_enter(si-si_lock);
 break;



CVS commit: src/usr.bin/netstat

2011-03-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar  1 19:01:59 UTC 2011

Modified Files:
src/usr.bin/netstat: Makefile inet.c
Added Files:
src/usr.bin/netstat: pfsync.c

Log Message:
Pull pfsync_stats() out of inet.c and into pfsync.c so that inet.c does
not have to #include PF header files that pollute the global namespace
by #defining v4 and v6 (sheesh).


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/netstat/Makefile
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/netstat/inet.c
cvs rdiff -u -r0 -r1.1 src/usr.bin/netstat/pfsync.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/netstat/Makefile
diff -u src/usr.bin/netstat/Makefile:1.32 src/usr.bin/netstat/Makefile:1.33
--- src/usr.bin/netstat/Makefile:1.32	Wed Dec 15 11:22:41 2010
+++ src/usr.bin/netstat/Makefile	Tue Mar  1 19:01:59 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2010/12/15 11:22:41 pooka Exp $
+#	$NetBSD: Makefile,v 1.33 2011/03/01 19:01:59 dyoung Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/12/93
 
 .include bsd.own.mk
@@ -7,7 +7,7 @@
 
 RUMPPRG=netstat
 SRCS=	atalk.c bpf.c fast_ipsec.c if.c inet.c inet6.c ipsec.c iso.c \
-	main.c mbuf.c mroute.c mroute6.c show.c route.c tp_astring.c \
+	main.c mbuf.c mroute.c mroute6.c pfsync.c show.c route.c tp_astring.c \
 	unix.c
 .PATH:	${NETBSDSRCDIR}/sys/netiso 
 BINGRP=	kmem

Index: src/usr.bin/netstat/inet.c
diff -u src/usr.bin/netstat/inet.c:1.93 src/usr.bin/netstat/inet.c:1.94
--- src/usr.bin/netstat/inet.c:1.93	Mon Dec 13 21:15:30 2010
+++ src/usr.bin/netstat/inet.c	Tue Mar  1 19:01:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet.c,v 1.93 2010/12/13 21:15:30 pooka Exp $	*/
+/*	$NetBSD: inet.c,v 1.94 2011/03/01 19:01:59 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = from: @(#)inet.c	8.4 (Berkeley) 4/20/94;
 #else
-__RCSID($NetBSD: inet.c,v 1.93 2010/12/13 21:15:30 pooka Exp $);
+__RCSID($NetBSD: inet.c,v 1.94 2011/03/01 19:01:59 dyoung Exp $);
 #endif
 #endif /* not lint */
 
@@ -76,8 +76,6 @@
 #include netinet/udp.h
 #include netinet/ip_carp.h
 #include netinet/udp_var.h
-#include net/pfvar.h
-#include net/if_pfsync.h
 
 #include arpa/inet.h
 #include kvm.h
@@ -690,52 +688,6 @@
 }
 
 /*
- * Dump PFSYNC statistics structure.
- */
-void
-pfsync_stats(u_long off, const char *name)
-{
-	uint64_t pfsyncstat[PFSYNC_NSTATS];
-
-	if (use_sysctl) {
-		size_t size = sizeof(pfsyncstat);
-
-		if (sysctlbyname(net.inet.pfsync.stats, pfsyncstat, size,
- NULL, 0) == -1)
-			return;
-	} else {
-		warnx(%s stats not available via KVM., name);
-		return;
-	}
-
-	printf(%s:\n, name);
-
-#define p(f, m) if (pfsyncstat[f] || sflag = 1) \
-	printf(m, pfsyncstat[f], plural(pfsyncstat[f]))
-#define p2(f, m) if (pfsyncstat[f] || sflag = 1) \
-	printf(m, pfsyncstat[f])
-
-	p(PFSYNC_STAT_IPACKETS, \t% PRIu64  packet%s received (IPv4)\n);
-	p(PFSYNC_STAT_IPACKETS6,\t% PRIu64  packet%s received (IPv6)\n);
-	p(PFSYNC_STAT_BADIF, \t\t% PRIu64  packet%s discarded for bad interface\n);
-	p(PFSYNC_STAT_BADTTL, \t\t% PRIu64  packet%s discarded for bad ttl\n);
-	p(PFSYNC_STAT_HDROPS, \t\t% PRIu64  packet%s shorter than header\n);
-	p(PFSYNC_STAT_BADVER, \t\t% PRIu64  packet%s discarded for bad version\n);
-	p(PFSYNC_STAT_BADAUTH, \t\t% PRIu64  packet%s discarded for bad HMAC\n);
-	p(PFSYNC_STAT_BADACT,\t\t% PRIu64  packet%s discarded for bad action\n);
-	p(PFSYNC_STAT_BADLEN, \t\t% PRIu64  packet%s discarded for short packet\n);
-	p(PFSYNC_STAT_BADVAL, \t\t% PRIu64  state%s discarded for bad values\n);
-	p(PFSYNC_STAT_STALE, \t\t% PRIu64  stale state%s\n);
-	p(PFSYNC_STAT_BADSTATE, \t\t% PRIu64  failed state lookup/insert%s\n);
-	p(PFSYNC_STAT_OPACKETS, \t% PRIu64  packet%s sent (IPv4)\n);
-	p(PFSYNC_STAT_OPACKETS6, \t% PRIu64  packet%s sent (IPv6)\n);
-	p2(PFSYNC_STAT_ONOMEM, \t\t% PRIu64  send failed due to mbuf memory error\n);
-	p2(PFSYNC_STAT_OERRORS, \t\t% PRIu64  send error\n);
-#undef p
-#undef p2
-}
-
-/*
  * Dump PIM statistics structure.
  */
 void

Added files:

Index: src/usr.bin/netstat/pfsync.c
diff -u /dev/null src/usr.bin/netstat/pfsync.c:1.1
--- /dev/null	Tue Mar  1 19:01:59 2011
+++ src/usr.bin/netstat/pfsync.c	Tue Mar  1 19:01:59 2011
@@ -0,0 +1,119 @@
+/*	$NetBSD: pfsync.c,v 1.1 2011/03/01 19:01:59 dyoung Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other 

CVS commit: src/usr.bin/netstat

2011-03-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar  2 19:52:04 UTC 2011

Modified Files:
src/usr.bin/netstat: inet.c

Log Message:
Use __arraycount() and PRIu64.  Delete unnecessary casts to unsigned
long long.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/netstat/inet.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/netstat/inet.c
diff -u src/usr.bin/netstat/inet.c:1.94 src/usr.bin/netstat/inet.c:1.95
--- src/usr.bin/netstat/inet.c:1.94	Tue Mar  1 19:01:59 2011
+++ src/usr.bin/netstat/inet.c	Wed Mar  2 19:52:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet.c,v 1.94 2011/03/01 19:01:59 dyoung Exp $	*/
+/*	$NetBSD: inet.c,v 1.95 2011/03/02 19:52:03 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = from: @(#)inet.c	8.4 (Berkeley) 4/20/94;
 #else
-__RCSID($NetBSD: inet.c,v 1.94 2011/03/01 19:01:59 dyoung Exp $);
+__RCSID($NetBSD: inet.c,v 1.95 2011/03/02 19:52:03 dyoung Exp $);
 #endif
 #endif /* not lint */
 
@@ -193,7 +193,7 @@
 		if (sysctlnametomib(mibname, mib, namelen) == -1)
 			err(1, sysctlnametomib: %s, mibname);
 
-		if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib),
+		if (prog_sysctl(mib, __arraycount(mib),
 		NULL, size, NULL, 0) == -1)
 			err(1, sysctl (query));
 
@@ -204,7 +204,7 @@
 	mib[6] = sizeof(*pcblist);
 	mib[7] = size / sizeof(*pcblist);
 
-		if (prog_sysctl(mib, sizeof(mib) / sizeof(*mib),
+		if (prog_sysctl(mib, __arraycount(mib),
 		pcblist, size, NULL, 0) == -1)
 			err(1, sysctl (copy));
 
@@ -299,102 +299,102 @@
 	printf (%s:\n, name);
 
 #define	ps(f, m) if (tcpstat[f] || sflag = 1) \
-printf(m, (unsigned long long)tcpstat[f])
+printf(m, tcpstat[f])
 #define	p(f, m) if (tcpstat[f] || sflag = 1) \
-printf(m, (unsigned long long)tcpstat[f], plural(tcpstat[f]))
+printf(m, tcpstat[f], plural(tcpstat[f]))
 #define	p2(f1, f2, m) if (tcpstat[f1] || tcpstat[f2] || sflag = 1) \
-printf(m, (unsigned long long)tcpstat[f1], plural(tcpstat[f1]), \
-(unsigned long long)tcpstat[f2], plural(tcpstat[f2]))
+printf(m, tcpstat[f1], plural(tcpstat[f1]), \
+tcpstat[f2], plural(tcpstat[f2]))
 #define	p2s(f1, f2, m) if (tcpstat[f1] || tcpstat[f2] || sflag = 1) \
-printf(m, (unsigned long long)tcpstat[f1], plural(tcpstat[f1]), \
-(unsigned long long)tcpstat[f2])
+printf(m, tcpstat[f1], plural(tcpstat[f1]), \
+tcpstat[f2])
 #define	p3(f, m) if (tcpstat[f] || sflag = 1) \
-printf(m, (unsigned long long)tcpstat[f], plurales(tcpstat[f]))
+printf(m, tcpstat[f], plurales(tcpstat[f]))
 
-	p(TCP_STAT_SNDTOTAL, \t%llu packet%s sent\n);
+	p(TCP_STAT_SNDTOTAL, \t% PRIu64  packet%s sent\n);
 	p2(TCP_STAT_SNDPACK,TCP_STAT_SNDBYTE,
-		\t\t%llu data packet%s (%llu byte%s)\n);
+		\t\t% PRIu64  data packet%s (% PRIu64  byte%s)\n);
 	p2(TCP_STAT_SNDREXMITPACK, TCP_STAT_SNDREXMITBYTE,
-		\t\t%llu data packet%s (%llu byte%s) retransmitted\n);
+		\t\t% PRIu64  data packet%s (% PRIu64  byte%s) retransmitted\n);
 	p2s(TCP_STAT_SNDACKS, TCP_STAT_DELACK,
-		\t\t%llu ack-only packet%s (%llu delayed)\n);
-	p(TCP_STAT_SNDURG, \t\t%llu URG only packet%s\n);
-	p(TCP_STAT_SNDPROBE, \t\t%llu window probe packet%s\n);
-	p(TCP_STAT_SNDWINUP, \t\t%llu window update packet%s\n);
-	p(TCP_STAT_SNDCTRL, \t\t%llu control packet%s\n);
+		\t\t% PRIu64  ack-only packet%s (% PRIu64  delayed)\n);
+	p(TCP_STAT_SNDURG, \t\t% PRIu64  URG only packet%s\n);
+	p(TCP_STAT_SNDPROBE, \t\t% PRIu64  window probe packet%s\n);
+	p(TCP_STAT_SNDWINUP, \t\t% PRIu64  window update packet%s\n);
+	p(TCP_STAT_SNDCTRL, \t\t% PRIu64  control packet%s\n);
 	p(TCP_STAT_SELFQUENCH,
-	\t\t%llu send attempt%s resulted in self-quench\n);
-	p(TCP_STAT_RCVTOTAL, \t%llu packet%s received\n);
+	\t\t% PRIu64  send attempt%s resulted in self-quench\n);
+	p(TCP_STAT_RCVTOTAL, \t% PRIu64  packet%s received\n);
 	p2(TCP_STAT_RCVACKPACK, TCP_STAT_RCVACKBYTE,
-		\t\t%llu ack%s (for %llu byte%s)\n);
-	p(TCP_STAT_RCVDUPACK, \t\t%llu duplicate ack%s\n);
-	p(TCP_STAT_RCVACKTOOMUCH, \t\t%llu ack%s for unsent data\n);
+		\t\t% PRIu64  ack%s (for % PRIu64  byte%s)\n);
+	p(TCP_STAT_RCVDUPACK, \t\t% PRIu64  duplicate ack%s\n);
+	p(TCP_STAT_RCVACKTOOMUCH, \t\t% PRIu64  ack%s for unsent data\n);
 	p2(TCP_STAT_RCVPACK, TCP_STAT_RCVBYTE,
-		\t\t%llu packet%s (%llu byte%s) received in-sequence\n);
+		\t\t% PRIu64  packet%s (% PRIu64  byte%s) received in-sequence\n);
 	p2(TCP_STAT_RCVDUPPACK, TCP_STAT_RCVDUPBYTE,
-		\t\t%llu completely duplicate packet%s (%llu byte%s)\n);
-	p(TCP_STAT_PAWSDROP, \t\t%llu old duplicate packet%s\n);
+		\t\t% PRIu64  completely duplicate packet%s (% PRIu64  byte%s)\n);
+	p(TCP_STAT_PAWSDROP, \t\t% PRIu64  old duplicate packet%s\n);
 	p2(TCP_STAT_RCVPARTDUPPACK, TCP_STAT_RCVPARTDUPBYTE,
-		\t\t%llu packet%s with some dup. data (%llu byte%s duped)\n);
+		\t\t% PRIu64  packet%s with 

CVS commit: src/sys/netiso

2011-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar  9 22:04:53 UTC 2011

Modified Files:
src/sys/netiso: if_eon.c

Log Message:
Remove ifa == NULL check, ifa cannot be NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/netiso/if_eon.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/netiso/if_eon.c
diff -u src/sys/netiso/if_eon.c:1.69 src/sys/netiso/if_eon.c:1.70
--- src/sys/netiso/if_eon.c:1.69	Fri Nov  7 00:20:18 2008
+++ src/sys/netiso/if_eon.c	Wed Mar  9 22:04:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eon.c,v 1.69 2008/11/07 00:20:18 dyoung Exp $	*/
+/*	$NetBSD: if_eon.c,v 1.70 2011/03/09 22:04:52 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_eon.c,v 1.69 2008/11/07 00:20:18 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_eon.c,v 1.70 2011/03/09 22:04:52 dyoung Exp $);
 
 #include opt_eon.h
 
@@ -191,8 +191,6 @@
 
 	switch (cmd) {
 	case SIOCINITIFADDR:
-		if (ifa == NULL)
-			break;
 		ifp-if_flags |= IFF_UP;
 		if (ifa-ifa_addr-sa_family != AF_LINK)
 			ifa-ifa_rtrequest = eonrtrequest;



CVS commit: src/sys/netnatm

2011-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar  9 22:06:42 UTC 2011

Modified Files:
src/sys/netnatm: natm.c

Log Message:
unifdef -U__OpenBSD__ -D__NetBSD__ -U__FreeBSD__ for readability.  No
functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/netnatm/natm.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/netnatm/natm.c
diff -u src/sys/netnatm/natm.c:1.23 src/sys/netnatm/natm.c:1.24
--- src/sys/netnatm/natm.c:1.23	Tue Feb  1 19:40:24 2011
+++ src/sys/netnatm/natm.c	Wed Mar  9 22:06:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: natm.c,v 1.23 2011/02/01 19:40:24 chuck Exp $	*/
+/*	$NetBSD: natm.c,v 1.24 2011/03/09 22:06:42 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Charles D. Cranor and Washington University.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: natm.c,v 1.23 2011/02/01 19:40:24 chuck Exp $);
+__KERNEL_RCSID(0, $NetBSD: natm.c,v 1.24 2011/03/09 22:06:42 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -63,22 +63,12 @@
  * user requests
  */
 
-#if defined(__NetBSD__)
 int natm_usrreq(so, req, m, nam, control, l)
-#elif defined(__OpenBSD__)
-int natm_usrreq(so, req, m, nam, control, p)
-#elif defined(__FreeBSD__)
-int natm_usrreq(so, req, m, nam, control)
-#endif
 
 struct socket *so;
 int req;
 struct mbuf *m, *nam, *control;
-#if defined(__NetBSD__)
 struct lwp *l;
-#elif deifned(__OpenBSD__)
-struct proc *p;
-#endif
 
 {
   int error = 0, s, s2;
@@ -270,12 +260,7 @@
   memset(snatm, 0, sizeof(*snatm));
   nam-m_len = snatm-snatm_len = sizeof(*snatm);
   snatm-snatm_family = AF_NATM;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
   memcpy(snatm-snatm_if, npcb-npcb_ifp-if_xname, sizeof(snatm-snatm_if));
-#elif defined(__FreeBSD__)
-  snprintf(snatm-snatm_if, sizeof(snatm-snatm_if), %s%d,
-  npcb-npcb_ifp-if_name, npcb-npcb_ifp-if_unit);
-#endif
   snatm-snatm_vci = npcb-npcb_vci;
   snatm-snatm_vpi = npcb-npcb_vpi;
   break;
@@ -411,52 +396,3 @@
 
   goto next;
 }
-
-#if defined(__FreeBSD__)
-NETISR_SET(NETISR_NATM, natmintr);
-#endif
-
-
-#ifdef notyet
-/*
- * natm0_sysctl: not used, but here in case we want to add something
- * later...
- */
-
-int natm0_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
-
-int *name;
-u_int namelen;
-void *oldp;
-size_t *oldlenp;
-void *newp;
-size_t newlen;
-
-{
-  /* All sysctl names at this level are terminal. */
-  if (namelen != 1)
-return (ENOTDIR);
-  return (ENOPROTOOPT);
-}
-
-/*
- * natm5_sysctl: not used, but here in case we want to add something
- * later...
- */
-
-int natm5_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
-
-int *name;
-u_int namelen;
-void *oldp;
-size_t *oldlenp;
-void *newp;
-size_t newlen;
-
-{
-  /* All sysctl names at this level are terminal. */
-  if (namelen != 1)
-return (ENOTDIR);
-  return (ENOPROTOOPT);
-}
-#endif



CVS commit: src/external/public-domain/xz/bin

2011-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 18 19:45:27 UTC 2011

Modified Files:
src/external/public-domain/xz/bin: Makefile

Log Message:
Obey MKNLS=no.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/public-domain/xz/bin/Makefile

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

Modified files:

Index: src/external/public-domain/xz/bin/Makefile
diff -u src/external/public-domain/xz/bin/Makefile:1.1 src/external/public-domain/xz/bin/Makefile:1.2
--- src/external/public-domain/xz/bin/Makefile:1.1	Tue Nov  2 16:34:36 2010
+++ src/external/public-domain/xz/bin/Makefile	Fri Mar 18 19:45:27 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2010/11/02 16:34:36 joerg Exp $
+# $NetBSD: Makefile,v 1.2 2011/03/18 19:45:27 dyoung Exp $
 
 PROG=	xz
 BINDIR=	/usr/bin
@@ -23,10 +23,12 @@
 
 .PATH:	${XZSRCDIR}/src/common ${XZSRCDIR}/src/xz
 
+.if ${MKNLS} != no
 .for lang in cs de it
 FILES+=	${XZSRCDIR}/po/${lang}.gmo
 FILESDIR_${XZSRCDIR}/po/${lang}.gmo=	/usr/share/locale/${lang}/LC_MESSAGES
 FILESNAME_${XZSRCDIR}/po/${lang}.gmo=	xz.mo
 .endfor
+.endif
 
 .include bsd.prog.mk



CVS commit: src/sys/arch/amd64

2011-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 18 19:46:20 UTC 2011

Modified Files:
src/sys/arch/amd64: Makefile

Log Message:
Fix tags target.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/Makefile

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

Modified files:

Index: src/sys/arch/amd64/Makefile
diff -u src/sys/arch/amd64/Makefile:1.6 src/sys/arch/amd64/Makefile:1.7
--- src/sys/arch/amd64/Makefile:1.6	Wed Apr 28 20:22:46 2010
+++ src/sys/arch/amd64/Makefile	Fri Mar 18 19:46:19 2011
@@ -1,12 +1,20 @@
-#	$NetBSD: Makefile,v 1.6 2010/04/28 20:22:46 dyoung Exp $
+#	$NetBSD: Makefile,v 1.7 2011/03/18 19:46:19 dyoung Exp $
 
 # Makefile for amd64 tags file and boot blocks
 
 TAMD64=		${SYSDIR}/arch/amd64/tags
 SAMD64=		${SYSDIR}/arch/amd64/amd64/*.[ch] \
-		${SYSDIR}/arch/amd64/include/*.h
-AAMD64=		${SYSDIR}/arch/amd64/amd64/*.S
-
+		${SYSDIR}/arch/amd64/include/*.h \
+		${SYSDIR}/external/isc/atheros_hal/dist/*.[ch] \
+		${SYSDIR}/external/isc/atheros_hal/dist/*/*.[ch] \
+		${SYSDIR}/external/isc/atheros_hal/ic/*.[ch]
+SAMD64+=	${SYSDIR}/arch/x86/x86/*.[ch] \
+		${SYSDIR}/arch/x86/acpi/*.[ch] \
+		${SYSDIR}/arch/x86/include/*.h \
+		${SYSDIR}/arch/x86/isa/*.[ch] \
+		${SYSDIR}/arch/x86/pci/*.[ch]
+AAMD64=		${SYSDIR}/arch/amd64/amd64/*.S \
+		${SYSDIR}/arch/amd64/acpi/*.S
 # Directories in which to place tags links
 DAMD64=		amd64 isa include pci
 
@@ -20,7 +28,7 @@
 	-${FINDCOMM} | xargs ctags -wadtf ${TAMD64}
 	egrep ^ENTRY(.*)|^ALTENTRY(.*) ${AAMD64} | \
 	${TOOL_SED} -e \
-		s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/; \
+		s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3	\1	/^\2(\3\4$$/; \
 		 ${TAMD64}
 	sort -o ${TAMD64} ${TAMD64}
 



CVS commit: src/sys/arch/i386

2011-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 18 19:48:12 UTC 2011

Modified Files:
src/sys/arch/i386: Makefile

Log Message:
Simplify tags target to reduce diffs with amd64/Makefile tags target.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/Makefile

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

Modified files:

Index: src/sys/arch/i386/Makefile
diff -u src/sys/arch/i386/Makefile:1.38 src/sys/arch/i386/Makefile:1.39
--- src/sys/arch/i386/Makefile:1.38	Sun Aug 30 02:00:56 2009
+++ src/sys/arch/i386/Makefile	Fri Mar 18 19:48:12 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2009/08/30 02:00:56 dyoung Exp $
+#	$NetBSD: Makefile,v 1.39 2011/03/18 19:48:12 dyoung Exp $
 
 # Makefile for i386 tags file and boot blocks
 
@@ -19,7 +19,7 @@
 	${SYSDIR}/arch/x86/include/*.h \
 	${SYSDIR}/arch/x86/isa/*.[ch] \
 	${SYSDIR}/arch/x86/pci/*.[ch]
-AI386=	${SYSDIR}/arch/i386/i386/*.[sS]
+AI386=	${SYSDIR}/arch/i386/i386/*.S
 
 # Directories in which to place tags links
 DI386=	i386 eisa isa include pci



CVS commit: src/sys/dev/ic

2010-03-15 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 15 23:21:08 UTC 2010

Modified Files:
src/sys/dev/ic: rtw.c rtwreg.h rtwvar.h

Log Message:
Make this compile on sparc64:

1 s/next_tick/next_tint/ because next_tick shadows a global on sparc64.

2 Fix the bus-barrier helper routines, which had the tag  handle
  swapped (!!).  Move the helpers from rtwreg.h to rtwvar.h, and
  change RTW_BARRIER() into an inline subroutine called rtw_barrier().


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/ic/rtw.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/rtwreg.h
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/rtwvar.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/rtw.c
diff -u src/sys/dev/ic/rtw.c:1.114 src/sys/dev/ic/rtw.c:1.115
--- src/sys/dev/ic/rtw.c:1.114	Wed Feb 24 22:37:58 2010
+++ src/sys/dev/ic/rtw.c	Mon Mar 15 23:21:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rtw.c,v 1.114 2010/02/24 22:37:58 dyoung Exp $ */
+/* $NetBSD: rtw.c,v 1.115 2010/03/15 23:21:08 dyoung Exp $ */
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 David Young.  All rights
  * reserved.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rtw.c,v 1.114 2010/02/24 22:37:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rtw.c,v 1.115 2010/03/15 23:21:08 dyoung Exp $);
 
 
 #include sys/param.h
@@ -2095,19 +2095,19 @@
 static inline void
 rtw_resume_ticks(struct rtw_softc *sc)
 {
-	uint32_t tsftrl0, tsftrl1, next_tick;
+	uint32_t tsftrl0, tsftrl1, next_tint;
 
 	tsftrl0 = RTW_READ(sc-sc_regs, RTW_TSFTRL);
 
 	tsftrl1 = RTW_READ(sc-sc_regs, RTW_TSFTRL);
-	next_tick = tsftrl1 + 100;
-	RTW_WRITE(sc-sc_regs, RTW_TINT, next_tick);
+	next_tint = tsftrl1 + 100;
+	RTW_WRITE(sc-sc_regs, RTW_TINT, next_tint);
 
 	sc-sc_do_tick = 1;
 
 	RTW_DPRINTF(RTW_DEBUG_TIMEOUT,
 	(%s: resume ticks delta %#08x now %#08x next %#08x\n,
-	device_xname(sc-sc_dev), tsftrl1 - tsftrl0, tsftrl1, next_tick));
+	device_xname(sc-sc_dev), tsftrl1 - tsftrl0, tsftrl1, next_tint));
 }
 
 static void

Index: src/sys/dev/ic/rtwreg.h
diff -u src/sys/dev/ic/rtwreg.h:1.27 src/sys/dev/ic/rtwreg.h:1.28
--- src/sys/dev/ic/rtwreg.h:1.27	Mon Oct 19 23:19:39 2009
+++ src/sys/dev/ic/rtwreg.h	Mon Mar 15 23:21:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtwreg.h,v 1.27 2009/10/19 23:19:39 rmind Exp $	*/
+/*	$NetBSD: rtwreg.h,v 1.28 2010/03/15 23:21:08 dyoung Exp $	*/
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
  *
@@ -1013,45 +1013,6 @@
 #endif
 
 /*
- * Bus barrier
- *
- * Complete outstanding read and/or write ops on [reg0, reg1]
- * ([reg1, reg0]) before starting new ops on the same region. See
- * acceptable bus_space_barrier(9) for the flag definitions.
- */
-#define RTW_BARRIER(regs, reg0, reg1, flags)			\
-	bus_space_barrier((regs)-r_bh, (regs)-r_bt,		\
-	MIN(reg0, reg1), MAX(reg0, reg1) - MIN(reg0, reg1) + 4, flags)
-
-/*
- * Barrier convenience macros.
- */
-/* sync */
-#define RTW_SYNC(regs, reg0, reg1)\
-	RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_SYNC)
-
-/* write-before-write */
-#define RTW_WBW(regs, reg0, reg1)\
-	RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
-
-/* write-before-read */
-#define RTW_WBR(regs, reg0, reg1)\
-	RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_READ)
-
-/* read-before-read */
-#define RTW_RBR(regs, reg0, reg1)\
-	RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_READ)
-
-/* read-before-write */
-#define RTW_RBW(regs, reg0, reg1)\
-	RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_WRITE)
-
-#define RTW_WBRW(regs, reg0, reg1)\
-		RTW_BARRIER(regs, reg0, reg1,			\
-		BUS_SPACE_BARRIER_WRITE_BEFORE_READ |	\
-		BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
-
-/*
  * Registers for RTL8180L's built-in baseband modem.
  */
 #define RTW_BBP_SYS1		0x00

Index: src/sys/dev/ic/rtwvar.h
diff -u src/sys/dev/ic/rtwvar.h:1.42 src/sys/dev/ic/rtwvar.h:1.43
--- src/sys/dev/ic/rtwvar.h:1.42	Wed Feb 24 22:37:58 2010
+++ src/sys/dev/ic/rtwvar.h	Mon Mar 15 23:21:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rtwvar.h,v 1.42 2010/02/24 22:37:58 dyoung Exp $ */
+/* $NetBSD: rtwvar.h,v 1.43 2010/03/15 23:21:08 dyoung Exp $ */
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
  *
@@ -112,6 +112,48 @@
 	enum rtw_access		r_access;
 };
 
+/*
+ * Bus barrier
+ *
+ * Complete outstanding read and/or write ops on [reg0, reg1]
+ * ([reg1, reg0]) before starting new ops on the same region. See
+ * acceptable bus_space_barrier(9) for the flag definitions.
+ */
+static inline void
+rtw_barrier(const struct rtw_regs *r, int reg0, int reg1, int flags)
+{
+	bus_space_barrier(r-r_bt, r-r_bh, MIN(reg0, reg1),
+	MAX(reg0, reg1) - MIN(reg0, reg1) + 4, flags);
+}
+
+/*
+ * Barrier convenience macros.
+ */
+/* sync */
+#define RTW_SYNC(regs, reg0, reg1)\
+	rtw_barrier(regs, reg0, reg1

CVS commit: src/sys/dev/cardbus

2010-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar 18 20:52:43 UTC 2010

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

Log Message:
Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted.  I will revisit this change if I get any
negative responses.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/cardbus/if_fxp_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/if_fxp_cardbus.c
diff -u src/sys/dev/cardbus/if_fxp_cardbus.c:1.46 src/sys/dev/cardbus/if_fxp_cardbus.c:1.47
--- src/sys/dev/cardbus/if_fxp_cardbus.c:1.46	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/if_fxp_cardbus.c	Thu Mar 18 20:52:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fxp_cardbus.c,v 1.46 2010/02/26 00:57:02 dyoung Exp $	*/
+/*	$NetBSD: if_fxp_cardbus.c,v 1.47 2010/03/18 20:52:43 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_fxp_cardbus.c,v 1.46 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_fxp_cardbus.c,v 1.47 2010/03/18 20:52:43 dyoung Exp $);
 
 #include opt_inet.h
 #include rnd.h
@@ -212,8 +212,7 @@
 fxp_cardbus_enable(struct fxp_softc * sc)
 {
 	struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *)sc;
-	cardbus_chipset_tag_t cc = csc-ct-ct_cc;
-	cardbus_function_tag_t cf = csc-ct-ct_cf;
+	cardbus_devfunc_t ct = csc-ct;
 
 	Cardbus_function_enable(csc-ct);
 
@@ -221,7 +220,7 @@
 
 	/* Map and establish the interrupt. */
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, csc-intrline, IPL_NET,
+	sc-sc_ih = Cardbus_intr_establish(ct, csc-intrline, IPL_NET,
 	fxp_intr, sc);
 	if (NULL == sc-sc_ih) {
 		aprint_error_dev(sc-sc_dev, couldn't establish interrupt\n);
@@ -235,12 +234,10 @@
 fxp_cardbus_disable(struct fxp_softc * sc)
 {
 	struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *)sc;
-	struct cardbus_devfunc *ct = csc-ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
+	cardbus_devfunc_t ct = csc-ct;
 
 	/* Remove interrupt handler. */
-	cardbus_intr_disestablish(cc, cf, sc-sc_ih);
+	Cardbus_intr_disestablish(ct, sc-sc_ih);
 
 	Cardbus_function_disable(csc-ct);
 }
@@ -263,7 +260,7 @@
 	/*
 	 * Unhook the interrupt handler.
 	 */
-	cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, sc-sc_ih);
+	Cardbus_intr_disestablish(ct, sc-sc_ih);
 
 	/*
 	 * release bus space and close window



CVS commit: src/sys/dev/cardbus

2010-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar 18 20:54:56 UTC 2010

Modified Files:
src/sys/dev/cardbus: adv_cardbus.c ahc_cardbus.c com_cardbus.c
siisata_cardbus.c uhci_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

The identical change to a few other CardBus NICs has not caused any
problems, as expected, so I'm going to commit this rather safe change
and get on with the work.

Testers have been enlisted.  I will revisit this change if I get any
negative responses.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/cardbus/adv_cardbus.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/cardbus/ahc_cardbus.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/cardbus/com_cardbus.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/cardbus/siisata_cardbus.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/cardbus/uhci_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/adv_cardbus.c
diff -u src/sys/dev/cardbus/adv_cardbus.c:1.26 src/sys/dev/cardbus/adv_cardbus.c:1.27
--- src/sys/dev/cardbus/adv_cardbus.c:1.26	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/adv_cardbus.c	Thu Mar 18 20:54:56 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: adv_cardbus.c,v 1.26 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: adv_cardbus.c,v 1.27 2010/03/18 20:54:56 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: adv_cardbus.c,v 1.26 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: adv_cardbus.c,v 1.27 2010/03/18 20:54:56 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -109,8 +109,6 @@
 	struct adv_cardbus_softc *csc = device_private(self);
 	struct asc_softc *sc = csc-sc_adv;
 	cardbus_devfunc_t ct = ca-ca_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 	bus_space_tag_t iot;
 	bus_space_handle_t ioh;
 	pcireg_t reg;
@@ -181,20 +179,20 @@
 	}
 
 	/* Enable the appropriate bits in the PCI CSR. */
-	reg = cardbus_conf_read(cc, cf, ca-ca_tag, PCI_COMMAND_STATUS_REG);
+	reg = Cardbus_conf_read(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG);
 	reg = ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
 	reg |= csc-sc_csr;
-	cardbus_conf_write(cc, cf, ca-ca_tag, PCI_COMMAND_STATUS_REG, reg);
+	Cardbus_conf_write(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG, reg);
 
 	/*
 	 * Make sure the latency timer is set to some reasonable
 	 * value.
 	 */
-	reg = cardbus_conf_read(cc, cf, ca-ca_tag, PCI_BHLC_REG);
+	reg = Cardbus_conf_read(ct, ca-ca_tag, PCI_BHLC_REG);
 	if (PCI_LATTIMER(reg)  latency) {
 		reg = ~(PCI_LATTIMER_MASK  PCI_LATTIMER_SHIFT);
 		reg |= (latency  PCI_LATTIMER_SHIFT);
-		cardbus_conf_write(cc, cf, ca-ca_tag, PCI_BHLC_REG, reg);
+		Cardbus_conf_write(ct, ca-ca_tag, PCI_BHLC_REG, reg);
 	}
 
 	ASC_SET_CHIP_CONTROL(iot, ioh, ASC_CC_HALT);
@@ -218,7 +216,7 @@
 	/*
 	 * Establish the interrupt.
 	 */
-	sc-sc_ih = cardbus_intr_establish(cc, cf, ca-ca_intrline, IPL_BIO,
+	sc-sc_ih = Cardbus_intr_establish(ct, ca-ca_intrline, IPL_BIO,
 	adv_intr, sc);
 	if (sc-sc_ih == NULL) {
 		aprint_error_dev(sc-sc_dev,
@@ -245,8 +243,7 @@
 		return rv;
 
 	if (sc-sc_ih) {
-		cardbus_intr_disestablish(csc-sc_ct-ct_cc,
-		csc-sc_ct-ct_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(csc-sc_ct, sc-sc_ih);
 		sc-sc_ih = 0;
 	}
 

Index: src/sys/dev/cardbus/ahc_cardbus.c
diff -u src/sys/dev/cardbus/ahc_cardbus.c:1.33 src/sys/dev/cardbus/ahc_cardbus.c:1.34
--- src/sys/dev/cardbus/ahc_cardbus.c:1.33	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/ahc_cardbus.c	Thu Mar 18 20:54:56 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahc_cardbus.c,v 1.33 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: ahc_cardbus.c,v 1.34 2010/03/18 20:54:56 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2005 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahc_cardbus.c,v 1.33 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahc_cardbus.c,v 1.34 2010/03/18 20:54:56 dyoung Exp $);
 
 #include opt_ahc_cardbus.h
 
@@ -110,8 +110,6 @@
 	struct ahc_cardbus_softc *csc = device_private(self);
 	struct ahc_softc *ahc = csc-sc_ahc;
 	cardbus_devfunc_t ct = ca-ca_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 	bus_space_tag_t bst;
 	bus_space_handle_t bsh;
 	pcireg_t reg;
@@ -146,20 +144,20 @@
 	}
 
 	/* Enable the appropriate bits in the PCI CSR. */
-	reg = cardbus_conf_read(cc, cf, ca-ca_tag, PCI_COMMAND_STATUS_REG);
+	reg = Cardbus_conf_read(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG);
 	reg = 

CVS commit: src/sys/dev/ic

2010-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 19 01:31:11 UTC 2010

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

Log Message:
Don't pick up the sys/sysctl.h definitions by chance,
but #include here.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/ath_netbsd.h

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

Modified files:

Index: src/sys/dev/ic/ath_netbsd.h
diff -u src/sys/dev/ic/ath_netbsd.h:1.9 src/sys/dev/ic/ath_netbsd.h:1.10
--- src/sys/dev/ic/ath_netbsd.h:1.9	Mon Oct 19 23:19:39 2009
+++ src/sys/dev/ic/ath_netbsd.h	Fri Mar 19 01:31:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ath_netbsd.h,v 1.9 2009/10/19 23:19:39 rmind Exp $ */
+/*	$NetBSD: ath_netbsd.h,v 1.10 2010/03/19 01:31:11 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2003, 2004 David Young
@@ -27,6 +27,8 @@
 #ifndef _ATH_NETBSD_H
 #define _ATH_NETBSD_H
 
+#include sys/sysctl.h
+
 #undef KASSERT
 #define KASSERT(__cond, __complaint) if (!(__cond)) panic __complaint
 



CVS commit: src/sys/dev/ic

2010-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 19 01:32:30 UTC 2010

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

Log Message:
Don't pick up the network-interface, ethernet, and 802.11-related
definitions by chance (or by the bus-specific front-end #including them!).
#include them here, instead.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/athvar.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/athvar.h
diff -u src/sys/dev/ic/athvar.h:1.32 src/sys/dev/ic/athvar.h:1.33
--- src/sys/dev/ic/athvar.h:1.32	Sun Mar 14 21:25:59 2010
+++ src/sys/dev/ic/athvar.h	Fri Mar 19 01:32:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: athvar.h,v 1.32 2010/03/14 21:25:59 dyoung Exp $	*/
+/*	$NetBSD: athvar.h,v 1.33 2010/03/19 01:32:30 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -44,6 +44,12 @@
 #ifndef _DEV_ATH_ATHVAR_H
 #define _DEV_ATH_ATHVAR_H
 
+#include net/if.h
+#include net/if_media.h
+#include net/if_ether.h
+
+#include net80211/ieee80211_netbsd.h
+#include net80211/ieee80211_var.h
 #include net80211/ieee80211_radiotap.h
 
 #include external/isc/atheros_hal/dist/ah.h



CVS commit: src/sys/dev/cardbus

2010-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 19 01:34:46 UTC 2010

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

Log Message:
Use Cardbus_intr_disestablish() instead of cardbus_intr_disestablish().

Get rid of a (short) staircase in ex_cardbus_detach().


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/cardbus/if_ex_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/if_ex_cardbus.c
diff -u src/sys/dev/cardbus/if_ex_cardbus.c:1.51 src/sys/dev/cardbus/if_ex_cardbus.c:1.52
--- src/sys/dev/cardbus/if_ex_cardbus.c:1.51	Wed Mar 10 21:00:36 2010
+++ src/sys/dev/cardbus/if_ex_cardbus.c	Fri Mar 19 01:34:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ex_cardbus.c,v 1.51 2010/03/10 21:00:36 dyoung Exp $	*/
+/*	$NetBSD: if_ex_cardbus.c,v 1.52 2010/03/19 01:34:46 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 and 1999
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.51 2010/03/10 21:00:36 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.52 2010/03/19 01:34:46 dyoung Exp $);
 
 /* #define EX_DEBUG 4 */	/* define to report information for debugging */
 
@@ -300,7 +300,7 @@
 }
 
 int
-ex_cardbus_detach(device_t self, int arg)
+ex_cardbus_detach(device_t self, int flags)
 {
 	struct ex_cardbus_softc *csc = device_private(self);
 	struct ex_softc *sc = csc-sc_softc;
@@ -313,23 +313,23 @@
 	}
 #endif
 
-	rv = ex_detach(sc);
-	if (rv == 0) {
-		/*
-		 * Unhook the interrupt handler.
-		 */
-		Cardbus_intr_disestablish(ct, sc-sc_ih);
+	if ((rv = ex_detach(sc)) != 0)
+		return rv;
 
-		if (csc-sc_cardtype == EX_CB_CYCLONE) {
-			Cardbus_mapreg_unmap(ct,
-			CARDBUS_3C575BTX_FUNCSTAT_PCIREG,
-			csc-sc_funct, csc-sc_funch, csc-sc_funcsize);
-		}
+	/*
+	 * Unhook the interrupt handler.
+	 */
+	Cardbus_intr_disestablish(ct, sc-sc_ih);
 
-		Cardbus_mapreg_unmap(ct, PCI_BAR0, sc-sc_iot,
-		sc-sc_ioh, csc-sc_mapsize);
+	if (csc-sc_cardtype == EX_CB_CYCLONE) {
+		Cardbus_mapreg_unmap(ct,
+		CARDBUS_3C575BTX_FUNCSTAT_PCIREG,
+		csc-sc_funct, csc-sc_funch, csc-sc_funcsize);
 	}
-	return (rv);
+
+	Cardbus_mapreg_unmap(ct, PCI_BAR0, sc-sc_iot,
+	sc-sc_ioh, csc-sc_mapsize);
+	return 0;
 }
 
 int
@@ -354,11 +354,11 @@
 ex_cardbus_disable(struct ex_softc *sc)
 {
 	struct ex_cardbus_softc *csc = (struct ex_cardbus_softc *)sc;
-	cardbus_function_tag_t cf = csc-sc_ct-ct_cf;
-	cardbus_chipset_tag_t cc = csc-sc_ct-ct_cc;
 
-	cardbus_intr_disestablish(cc, cf, sc-sc_ih);
-	sc-sc_ih = NULL;
+	if (sc-sc_ih != NULL) {
+		Cardbus_intr_disestablish(csc-sc_ct, sc-sc_ih);
+		sc-sc_ih = NULL;
+	}
 
  	Cardbus_function_disable(csc-sc_ct);
 



CVS commit: src/sys/dev/cardbus

2010-03-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 19 01:44:05 UTC 2010

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

Log Message:
Remove superfluous cast (device_t to device_t).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/cardbus/cardslot.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/cardslot.c
diff -u src/sys/dev/cardbus/cardslot.c:1.51 src/sys/dev/cardbus/cardslot.c:1.52
--- src/sys/dev/cardbus/cardslot.c:1.51	Tue Dec 15 22:17:12 2009
+++ src/sys/dev/cardbus/cardslot.c	Fri Mar 19 01:44:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardslot.c,v 1.51 2009/12/15 22:17:12 snj Exp $	*/
+/*	$NetBSD: cardslot.c,v 1.52 2010/03/19 01:44:05 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 and 2000
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cardslot.c,v 1.51 2009/12/15 22:17:12 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: cardslot.c,v 1.52 2010/03/19 01:44:05 dyoung Exp $);
 
 #include opt_cardslot.h
 
@@ -382,7 +382,7 @@
 			}
 			if (sc-sc_16_softc) {
 CARDSLOT_SET_CARDTYPE(sc-sc_status, CARDSLOT_STATUS_CARD_16);
-if (pcmcia_card_attach((device_t)sc-sc_16_softc)) {
+if (pcmcia_card_attach(sc-sc_16_softc)) {
 	/* Do not attach */
 	CARDSLOT_SET_WORK(sc-sc_status,
 	CARDSLOT_STATUS_NOTWORK);



CVS commit: src/share/man/man3

2010-03-19 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 19 18:02:22 UTC 2010

Added Files:
src/share/man/man3: rb.3

Log Message:
First draft of a manual page for Matt Thomas' red-black trees.  Please
review for correctness.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man3/rb.3

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

Added files:

Index: src/share/man/man3/rb.3
diff -u /dev/null src/share/man/man3/rb.3:1.1
--- /dev/null	Fri Mar 19 18:02:22 2010
+++ src/share/man/man3/rb.3	Fri Mar 19 18:02:22 2010
@@ -0,0 +1,213 @@
+.\ $NetBSD: rb.3,v 1.1 2010/03/19 18:02:22 dyoung Exp $
+.\
+.\ Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Matt Thomas, Niels Provos, and David Young.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\ POSSIBILITY OF SUCH DAMAGE.
+.\
+.Dd March 19, 2010
+.Dt RB 3
+.Os
+.Sh NAME
+.Nm rb
+.Nd red-black tree
+.Sh SYNOPSIS
+.In sys/rb.h
+.Ft void
+.Fn rb_tree_init struct rb_tree * const struct rb_tree_ops *
+.Ft bool
+.Fn rb_tree_insert_node struct rb_tree * struct rb_node *
+.Ft struct rb_node *
+.Fn rb_tree_find_node struct rb_tree * const void *
+.Ft struct rb_node *
+.Fn rb_tree_find_node_geq struct rb_tree * const void *
+.Ft struct rb_node *
+.Fn rb_tree_find_node_leq struct rb_tree * const void *
+.Ft struct rb_node *
+.Fn rb_tree_iterate struct rb_tree * struct rb_node * const unsigned int
+.Sh DESCRIPTION
+.Nm
+provides red-black trees.
+A red-black tree is a binary search tree with the node color as an
+extra attribute.
+It fulfills a set of conditions:
+.Bl -enum -compact -offset indent
+.It 
+every search path from the root to a leaf consists of the same number of
+black nodes,
+.It 
+each red node (except for the root) has a black parent,
+.It 
+each leaf node is black.
+.El 
+.Pp
+Every operation on a red-black tree is bounded as O(lg n).
+The maximum height of a red-black tree is 2lg (n+1).
+.Sh TYPES
+.Bl -tag -width compact
+.It Vt struct rb_tree
+A red-black tree.
+.It Vt typedef signed int (*const rbto_compare_nodes_fn)(const struct rb_node *, const struct rb_node *);
+The node-comparison operator.
+Defines an ordering on nodes.
+Returns a positive value if the first node precedes the second node.
+Returns a negative value if the first node follows the second node.
+Returns 0 if the first node and the second are identical according
+to the ordering.
+.It Vt typedef signed int (*const rbto_compare_key_fn)(const struct rb_node *, const void *);
+The node-key comparison operator.
+Defines the order of nodes and keys.
+Returns a positive value if the node precedes the key.
+Returns a negative value if the node follows the key.
+Returns 0 if the node is identical to the ey according to the ordering.
+.It Vt struct rb_tree_ops
+Defines the operators for comparing two nodes in the same tree,
+and for comparing a node in the tree with a key.
+Members of
+.Vt rb_tree_ops 
+are
+.Bd -literal
+rbto_compare_nodes_fn rbto_compare_nodes;
+rbto_compare_key_fn rbto_compare_key;
+.Ed
+.It Vt struct rb_node
+A node in a red-black tree.
+.Sh FUNCTIONS
+.Bl -tag -width compact
+.It Fn rb_tree_init rbt ops
+Initialize the red-black tree
+.Fa rbt .
+Let the comparison operators given by
+.Fa ops
+define the order of nodes in the tree for
+the purposes of insertion, search, and iteration.
+.Fn rb_tree_init
+always succeeds.
+.It Fn rb_tree_insert_node rbt rb
+Insert the node
+.Fa rb
+into the tree
+.Fa rbt .
+Return
+.Dv true
+on success,
+.Dv false
+on failure.
+.It Fn rb_tree_find_node rbt key
+Search the tree
+.Fa rbt

CVS commit: src/sys/arch/x86/include

2010-03-19 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat Mar 20 00:02:59 UTC 2010

Modified Files:
src/sys/arch/x86/include: pci_machdep_common.h

Log Message:
Add a prototype for pci_mmio_range_infer() that will infer the
range of memory forwarded by the host chipset to PCI.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/include/pci_machdep_common.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/x86/include/pci_machdep_common.h
diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.1 src/sys/arch/x86/include/pci_machdep_common.h:1.2
--- src/sys/arch/x86/include/pci_machdep_common.h:1.1	Sun Mar 14 20:19:06 2010
+++ src/sys/arch/x86/include/pci_machdep_common.h	Sat Mar 20 00:02:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep_common.h,v 1.1 2010/03/14 20:19:06 dyoung Exp $	*/
+/*	$NetBSD: pci_machdep_common.h,v 1.2 2010/03/20 00:02:59 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -154,4 +154,7 @@
 void pci_bridge_foreach(pci_chipset_tag_t, int, int,
 	void (*) (pci_chipset_tag_t, pcitag_t, void *), void *);
 
+void pci_mmio_range_infer(pci_chipset_tag_t, int, int, bus_addr_t *,
+bus_size_t *);
+
 #endif /* _X86_PCI_MACHDEP_COMMON_H_ */



CVS commit: src/sys/dev/pci

2010-03-19 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat Mar 20 00:23:42 UTC 2010

Modified Files:
src/sys/dev/pci: pcireg.h

Log Message:
Add PCI_BAR(n) for the nth Base Address Register.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/pcireg.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/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.66 src/sys/dev/pci/pcireg.h:1.67
--- src/sys/dev/pci/pcireg.h:1.66	Fri Feb 26 00:38:14 2010
+++ src/sys/dev/pci/pcireg.h	Sat Mar 20 00:23:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.66 2010/02/26 00:38:14 dyoung Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.67 2010/03/20 00:23:41 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -365,6 +365,8 @@
 #define PCI_BAR4		0x20
 #define PCI_BAR5		0x24
 
+#define	PCI_BAR(__n)		(0x10 + 4 * (__n))
+
 #define	PCI_MAPREG_TYPE(mr)		\
 	((mr)  PCI_MAPREG_TYPE_MASK)
 #define	PCI_MAPREG_TYPE_MASK			0x0001



CVS commit: src/sys/dev/ic

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 17:11:19 UTC 2010

Modified Files:
src/sys/dev/ic: elinkxl.c elinkxlvar.h

Log Message:
Add a self-suspensor.  It's not used, yet.

In ex_detach(), call ex_stop(), first.  ex_stop() stops the callout.
Destroy the callout in ex_detach().


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/ic/elinkxl.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/elinkxlvar.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/elinkxl.c
diff -u src/sys/dev/ic/elinkxl.c:1.110 src/sys/dev/ic/elinkxl.c:1.111
--- src/sys/dev/ic/elinkxl.c:1.110	Tue Jan 19 22:06:24 2010
+++ src/sys/dev/ic/elinkxl.c	Mon Mar 22 17:11:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: elinkxl.c,v 1.110 2010/01/19 22:06:24 pooka Exp $	*/
+/*	$NetBSD: elinkxl.c,v 1.111 2010/03/22 17:11:19 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: elinkxl.c,v 1.110 2010/01/19 22:06:24 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: elinkxl.c,v 1.111 2010/03/22 17:11:19 dyoung Exp $);
 
 #include rnd.h
 
@@ -181,6 +181,8 @@
 	bus_space_handle_t ioh = sc-sc_ioh;
 	int i, error, attach_stage;
 
+	pmf_self_suspensor_init(sc-sc_dev, sc-sc_suspensor, sc-sc_qual);
+
 	callout_init(sc-ex_mii_callout, 0);
 
 	ex_reset(sc);
@@ -1688,14 +1690,19 @@
 {
 	struct ifnet *ifp = sc-sc_ethercom.ec_if;
 	struct ex_rxdesc *rxd;
-	int i;
+	int i, s;
 
 	/* Succeed now if there's no work to do. */
 	if ((sc-ex_flags  EX_FLAGS_ATTACHED) == 0)
 		return (0);
 
-	/* Unhook our tick handler. */
-	callout_stop(sc-ex_mii_callout);
+	s = splnet();
+	/* Stop the interface. Callouts are stopped in it. */
+	ex_stop(ifp, 1);
+	splx(s);
+
+	/* Destroy our callout. */
+	callout_destroy(sc-ex_mii_callout);
 
 	if (sc-ex_conf  EX_CONF_MII) {
 		/* Detach all PHYs */

Index: src/sys/dev/ic/elinkxlvar.h
diff -u src/sys/dev/ic/elinkxlvar.h:1.20 src/sys/dev/ic/elinkxlvar.h:1.21
--- src/sys/dev/ic/elinkxlvar.h:1.20	Mon Apr 28 20:23:49 2008
+++ src/sys/dev/ic/elinkxlvar.h	Mon Mar 22 17:11:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: elinkxlvar.h,v 1.20 2008/04/28 20:23:49 martin Exp $	*/
+/*	$NetBSD: elinkxlvar.h,v 1.21 2010/03/22 17:11:19 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -40,6 +40,8 @@
  */
 struct ex_softc {
 	device_t sc_dev;
+	device_suspensor_t sc_suspensor;
+	pmf_qual_t sc_qual;
 	void *sc_ih;
 
 	struct ethercom sc_ethercom;	/* Ethernet common part		*/



CVS commit: src/sys/dev/ic

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 17:12:09 UTC 2010

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

Log Message:
Check whether the fxp(4) actually attached before calling fxp_stop().


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/ic/i82557.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/i82557.c
diff -u src/sys/dev/ic/i82557.c:1.133 src/sys/dev/ic/i82557.c:1.134
--- src/sys/dev/ic/i82557.c:1.133	Mon Mar 22 16:11:58 2010
+++ src/sys/dev/ic/i82557.c	Mon Mar 22 17:12:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82557.c,v 1.133 2010/03/22 16:11:58 dyoung Exp $	*/
+/*	$NetBSD: i82557.c,v 1.134 2010/03/22 17:12:09 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i82557.c,v 1.133 2010/03/22 16:11:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: i82557.c,v 1.134 2010/03/22 17:12:09 dyoung Exp $);
 
 #include rnd.h
 
@@ -2496,15 +2496,15 @@
 	struct ifnet *ifp = sc-sc_ethercom.ec_if;
 	int i, s;
 
+	/* Succeed now if there's no work to do. */
+	if ((sc-sc_flags  FXPF_ATTACHED) == 0)
+		return (0);
+
 	s = splnet();
 	/* Stop the interface. Callouts are stopped in it. */
 	fxp_stop(ifp, 1);
 	splx(s);
 
-	/* Succeed now if there's no work to do. */
-	if ((sc-sc_flags  FXPF_ATTACHED) == 0)
-		return (0);
-
 	/* Destroy our callout. */
 	callout_destroy(sc-sc_callout);
 



CVS commit: src/sys/dev/pci

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 16:17:43 UTC 2010

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

Log Message:
Add a detach routine.  Enable detachment at shutdown.

psc_pwrmgmt_csr_reg was never initialized to the actual offset of the
PCI PMCSR!  Just delete psc_pwrmgmt_csr_reg and all uses of it.  In
this way, fxp_pci_disable() becomes a no-op, so delete it, too.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/if_fxp_pci.c

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

Modified files:

Index: src/sys/dev/pci/if_fxp_pci.c
diff -u src/sys/dev/pci/if_fxp_pci.c:1.73 src/sys/dev/pci/if_fxp_pci.c:1.74
--- src/sys/dev/pci/if_fxp_pci.c:1.73	Wed Feb 24 22:38:00 2010
+++ src/sys/dev/pci/if_fxp_pci.c	Mon Mar 22 16:17:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fxp_pci.c,v 1.73 2010/02/24 22:38:00 dyoung Exp $	*/
+/*	$NetBSD: if_fxp_pci.c,v 1.74 2010/03/22 16:17:43 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_fxp_pci.c,v 1.73 2010/02/24 22:38:00 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_fxp_pci.c,v 1.74 2010/03/22 16:17:43 dyoung Exp $);
 
 #include rnd.h
 
@@ -80,22 +80,21 @@
 	pcireg_t psc_regs[0x202];	/* saved PCI config regs (sparse) */
 	pcitag_t psc_tag;		/* pci register tag */
 
-	int psc_pwrmgmt_csr_reg;	/* ACPI power management register */
-	pcireg_t psc_pwrmgmt_csr;	/* ...and the contents at D0 */
 	struct pci_conf_state psc_pciconf; /* standard PCI configuration regs */
 };
 
 static int	fxp_pci_match(device_t, cfdata_t, void *);
 static void	fxp_pci_attach(device_t, device_t, void *);
+static int	fxp_pci_detach(device_t, int);
 
 static int	fxp_pci_enable(struct fxp_softc *);
-static void	fxp_pci_disable(struct fxp_softc *);
 
 static void fxp_pci_confreg_restore(struct fxp_pci_softc *psc);
 static bool fxp_pci_resume(device_t dv, const pmf_qual_t *);
 
-CFATTACH_DECL_NEW(fxp_pci, sizeof(struct fxp_pci_softc),
-fxp_pci_match, fxp_pci_attach, NULL, NULL);
+CFATTACH_DECL3_NEW(fxp_pci, sizeof(struct fxp_pci_softc),
+fxp_pci_match, fxp_pci_attach, fxp_pci_detach, NULL, NULL,
+null_childdetached, DVF_DETACH_SHUTDOWN);
 
 static const struct fxp_pci_product {
 	uint32_t	fpp_prodid;	/* PCI product ID */
@@ -243,6 +242,26 @@
 	return true;
 }
 
+static int
+fxp_pci_detach(device_t self, int flags)
+{
+	struct fxp_pci_softc *psc = device_private(self);
+	struct fxp_softc *sc = psc-psc_fxp;
+	int error;
+
+	/* Finish off the attach. */
+	if ((error = fxp_detach(sc, flags)) != 0)
+		return error;
+
+	pmf_device_deregister(self);
+
+	pci_intr_disestablish(psc-psc_pc, sc-sc_ih);
+
+	bus_space_unmap(sc-sc_st, sc-sc_sh, sc-sc_size);
+
+	return 0;
+}
+
 static void
 fxp_pci_attach(device_t parent, device_t self, void *aux)
 {
@@ -258,7 +277,6 @@
 	bus_space_handle_t ioh, memh;
 	int ioh_valid, memh_valid;
 	bus_addr_t addr;
-	bus_size_t size;
 	int flags;
 	int error;
 
@@ -300,9 +318,9 @@
 	if (((pa-pa_flags  PCI_FLAGS_MEM_ENABLED) != 0) 
 	pci_mapreg_info(pa-pa_pc, pa-pa_tag, FXP_PCI_MMBA,
 	PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT,
-	addr, size, flags) == 0) {
+	addr, sc-sc_size, flags) == 0) {
 		flags = ~BUS_SPACE_MAP_PREFETCHABLE;
-		if (bus_space_map(memt, addr, size, flags, memh) == 0)
+		if (bus_space_map(memt, addr, sc-sc_size, flags, memh) == 0)
 			memh_valid = 1;
 	}
 
@@ -446,7 +464,7 @@
 		break;
 	case 0: 
 		sc-sc_enable = fxp_pci_enable;
-		sc-sc_disable = fxp_pci_disable;
+		sc-sc_disable = NULL;
 		break;
 	default:
 		aprint_error_dev(self, cannot activate %d\n, error);
@@ -497,34 +515,8 @@
 	printf(%s: going to power state D0\n, device_xname(self));
 #endif
 
-	/* Bring the device into D0 power state. */
-	pci_conf_write(psc-psc_pc, psc-psc_tag,
-	psc-psc_pwrmgmt_csr_reg, psc-psc_pwrmgmt_csr);
-
 	/* Now restore the configuration registers. */
 	fxp_pci_confreg_restore(psc);
 
 	return (0);
 }
-
-static void
-fxp_pci_disable(struct fxp_softc *sc)
-{
-	struct fxp_pci_softc *psc = (void *) sc;
-
-	/*
-	 * for some 82558_A4 and 82558_B0, entering D3 state makes
-	 * media detection disordered.
-	 */
-	if (sc-sc_rev = FXP_REV_82558_B0)
-		return;
-
-#if 0
-	printf(%s: going to power state D3\n, device_xname(self));
-#endif
-
-	/* Put the device into D3 state. */
-	pci_conf_write(psc-psc_pc, psc-psc_tag,
-	psc-psc_pwrmgmt_csr_reg, (psc-psc_pwrmgmt_csr 
-	~PCI_PMCSR_STATE_MASK) | PCI_PMCSR_STATE_D3);
-}



CVS commit: src/sys/dev/ic

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 16:11:58 UTC 2010

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

Log Message:
In fxp_detach(), fxp_stop(), first.  fxp_stop() stops the callout.
Destroy the callout in fxp_detach().


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/ic/i82557.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/i82557.c
diff -u src/sys/dev/ic/i82557.c:1.132 src/sys/dev/ic/i82557.c:1.133
--- src/sys/dev/ic/i82557.c:1.132	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/ic/i82557.c	Mon Mar 22 16:11:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82557.c,v 1.132 2010/02/25 23:40:39 dyoung Exp $	*/
+/*	$NetBSD: i82557.c,v 1.133 2010/03/22 16:11:58 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i82557.c,v 1.132 2010/02/25 23:40:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: i82557.c,v 1.133 2010/03/22 16:11:58 dyoung Exp $);
 
 #include rnd.h
 
@@ -2494,14 +2494,19 @@
 fxp_detach(struct fxp_softc *sc, int flags)
 {
 	struct ifnet *ifp = sc-sc_ethercom.ec_if;
-	int i;
+	int i, s;
+
+	s = splnet();
+	/* Stop the interface. Callouts are stopped in it. */
+	fxp_stop(ifp, 1);
+	splx(s);
 
 	/* Succeed now if there's no work to do. */
 	if ((sc-sc_flags  FXPF_ATTACHED) == 0)
 		return (0);
 
-	/* Unhook our tick handler. */
-	callout_stop(sc-sc_callout);
+	/* Destroy our callout. */
+	callout_destroy(sc-sc_callout);
 
 	if (sc-sc_flags  FXPF_MII) {
 		/* Detach all PHYs */



CVS commit: src/sys/dev/isa

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 22:30:58 UTC 2010

Modified Files:
src/sys/dev/isa: isadma.c pcdisplay.c

Log Message:
isadma.c: #if 0 some diagnostic code that compares two bus_space_tag_t's.

pcdisplay.c: #if 0 some code that compares two bus_space_tag_t's
in order to see if pcdisplay0 is console.  It does not seem to
be helpful to compare the tags; maybe the author intended to
compare some other bus property?

MI code should not compare an opaque type such as bus_space_tag_t!


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/isa/isadma.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/isa/pcdisplay.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/isadma.c
diff -u src/sys/dev/isa/isadma.c:1.62 src/sys/dev/isa/isadma.c:1.63
--- src/sys/dev/isa/isadma.c:1.62	Tue Aug 18 16:52:42 2009
+++ src/sys/dev/isa/isadma.c	Mon Mar 22 22:30:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: isadma.c,v 1.62 2009/08/18 16:52:42 dyoung Exp $	*/
+/*	$NetBSD: isadma.c,v 1.63 2010/03/22 22:30:58 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: isadma.c,v 1.62 2009/08/18 16:52:42 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: isadma.c,v 1.63 2010/03/22 22:30:58 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -155,8 +155,10 @@
 		 * configuration mechanisms, the space and dma tags
 		 * must be the same!
 		 */
+#if 0	/* XXX Comparing bus_space_tag_t is a no-no! */
 		if (ids-ids_bst != bst || ids-ids_dmat != dmat)
 			panic(_isa_dmainit: inconsistent ISA tags);
+#endif
 	} else {
 		ids-ids_bst = bst;
 		ids-ids_dmat = dmat;

Index: src/sys/dev/isa/pcdisplay.c
diff -u src/sys/dev/isa/pcdisplay.c:1.38 src/sys/dev/isa/pcdisplay.c:1.39
--- src/sys/dev/isa/pcdisplay.c:1.38	Tue May 12 09:10:15 2009
+++ src/sys/dev/isa/pcdisplay.c	Mon Mar 22 22:30:58 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pcdisplay.c,v 1.38 2009/05/12 09:10:15 cegger Exp $ */
+/* $NetBSD: pcdisplay.c,v 1.39 2010/03/22 22:30:58 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pcdisplay.c,v 1.38 2009/05/12 09:10:15 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: pcdisplay.c,v 1.39 2010/03/22 22:30:58 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -360,8 +360,11 @@
 pcdisplay_is_console(bus_space_tag_t iot)
 {
 	if (pcdisplayconsole 
-	!pcdisplay_console_attached 
-	iot == pcdisplay_console_dc.dc_ph.ph_iot)
+	!pcdisplay_console_attached
+#if 0	/* XXX Comparing bus_space_tag_t is a no-no! */
+	 iot == pcdisplay_console_dc.dc_ph.ph_iot
+#endif
+	)
 		return (1);
 	return (0);
 }



CVS commit: src/sys/dev/pci

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 22:36:07 UTC 2010

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

Log Message:
#if 0 some diagnostic code that compares two bus_space_tag_t's.

MI code should not compare an opaque type such as bus_space_tag_t!


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/cy82c693.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/cy82c693.c
diff -u src/sys/dev/pci/cy82c693.c:1.6 src/sys/dev/pci/cy82c693.c:1.7
--- src/sys/dev/pci/cy82c693.c:1.6	Mon Apr 28 20:23:54 2008
+++ src/sys/dev/pci/cy82c693.c	Mon Mar 22 22:36:07 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cy82c693.c,v 1.6 2008/04/28 20:23:54 martin Exp $ */
+/* $NetBSD: cy82c693.c,v 1.7 2010/03/22 22:36:07 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cy82c693.c,v 1.6 2008/04/28 20:23:54 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: cy82c693.c,v 1.7 2010/03/22 22:36:07 dyoung Exp $);
 
 #include opt_multiprocessor.h
 #include opt_lockdebug.h
@@ -79,8 +79,10 @@
 
 	if (cyhc_initialized) {
 		CYHC_UNLOCK(s);
+#if 0	/* XXX Comparing bus_space_tag_t is a no-no! */
 		if (iot != cyhc_handle.cyhc_iot)
 			panic(cy82c693_init);
+#endif
 		return (cyhc_handle);
 	}
 



CVS commit: src/sys/dev/pci

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 22:39:49 UTC 2010

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

Log Message:
Activate PCI memory-mapped I/O access in the PCI Control and Status
Register if the PCI BAR is the memory-mapped type.  The driver used to
decide whether to activate memory-mapped access by testing the truth of
pci_attach_args.pa_memt; that isn't MI, and it doesn't make sense.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/viaide.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/viaide.c
diff -u src/sys/dev/pci/viaide.c:1.68 src/sys/dev/pci/viaide.c:1.69
--- src/sys/dev/pci/viaide.c:1.68	Wed Feb 24 22:38:01 2010
+++ src/sys/dev/pci/viaide.c	Mon Mar 22 22:39:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: viaide.c,v 1.68 2010/02/24 22:38:01 dyoung Exp $	*/
+/*	$NetBSD: viaide.c,v 1.69 2010/03/22 22:39:48 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: viaide.c,v 1.68 2010/02/24 22:38:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: viaide.c,v 1.69 2010/03/22 22:39:48 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -851,18 +851,6 @@
 	pciide_mapreg_dma(sc, pa);
 	aprint_verbose(\n);
 
-	/*
-	 * Enable memory-space access if it isn't already there.
-	 */
-	if (pa-pa_memt  (pa-pa_flags  PCI_FLAGS_MEM_ENABLED) == 0) {
-		pcireg_t csr;
-
-		pa-pa_flags |= PCI_FLAGS_MEM_ENABLED;
-		csr = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG);
-		pci_conf_write(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG,
-		   csr | PCI_COMMAND_MEM_ENABLE);
-	}
-
 	if (sc-sc_dma_ok) {
 		sc-sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_UDMA | ATAC_CAP_DMA;
 		sc-sc_wdcdev.irqack = pciide_irqack;
@@ -890,6 +878,20 @@
 		NULL, satasize);
 		break;
 	case PCI_MAPREG_MEM_TYPE_32BIT:
+		/*
+		 * Enable memory-space access if it isn't already there.
+		 */
+		if ((pa-pa_flags  PCI_FLAGS_MEM_ENABLED) == 0) {
+			pcireg_t csr;
+
+			pa-pa_flags |= PCI_FLAGS_MEM_ENABLED;
+			csr = pci_conf_read(pa-pa_pc, pa-pa_tag,
+			PCI_COMMAND_STATUS_REG);
+			pci_conf_write(pa-pa_pc, pa-pa_tag,
+			PCI_COMMAND_STATUS_REG,
+			csr | PCI_COMMAND_MEM_ENABLE);
+		}
+
 		ret = pci_mapreg_map(pa, PCI_MAPREG_START + 0x14,
 		PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
 		0, sc-sc_ba5_st, sc-sc_ba5_sh,



CVS commit: src/sys/dev/ic

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 23:00:08 UTC 2010

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

Log Message:
MI code should not compare bus_space_tag_t!  Introduce tags_are_equal()
for comparing two bus_space_tag_t's.  It is always true.

Everywhere that com(4) compares two tags, it compares to I/O base
addresses, too; comparing the base addresses should suffice.

TBD Clean this up more thoroughly.


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 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.295 src/sys/dev/ic/com.c:1.296
--- src/sys/dev/ic/com.c:1.295	Wed Feb 24 22:37:58 2010
+++ src/sys/dev/ic/com.c	Mon Mar 22 23:00:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.295 2010/02/24 22:37:58 dyoung Exp $ */
+/* $NetBSD: com.c,v 1.296 2010/03/22 23:00:08 dyoung Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: com.c,v 1.295 2010/02/24 22:37:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: com.c,v 1.296 2010/03/22 23:00:08 dyoung Exp $);
 
 #include opt_com.h
 #include opt_ddb.h
@@ -263,6 +263,13 @@
 #define COM_BARRIER(r, f) \
 	bus_space_barrier((r)-cr_iot, (r)-cr_ioh, 0, (r)-cr_nports, (f))
 
+/* XXX Comparing bus_space_tag_t's is not allowed! */
+static bool
+tags_are_equal(const bus_space_tag_t lt, const bus_space_tag_t rt)
+{
+	return true;
+}
+
 /*ARGSUSED*/
 int
 comspeed(long speed, long frequency, int type)
@@ -392,7 +399,7 @@
 
 	CSR_WRITE_1(regsp, COM_REG_IER, sc-sc_ier);
 
-	if (regsp-cr_iot == comcons_info.regs.cr_iot 
+	if (tags_are_equal(regsp-cr_iot, comcons_info.regs.cr_iot) 
 	regsp-cr_iobase == comcons_info.regs.cr_iobase) {
 		comconsattached = 1;
 
@@ -541,7 +548,7 @@
 	 * exclusive use.  If it's the console _and_ the
 	 * kgdb device, it doesn't.
 	 */
-	if (regsp-cr_iot == comkgdbregs.cr_iot 
+	if (tags_are_equal(regsp-cr_iot, comkgdbregs.cr_iot) 
 	regsp-cr_iobase == comkgdbregs.cr_iobase) {
 		if (!ISSET(sc-sc_hwflags, COM_HW_CONSOLE)) {
 			com_kgdb_attached = 1;
@@ -2302,7 +2309,7 @@
 {
 	int res;
 
-	if (regsp-cr_iot == comcons_info.regs.cr_iot 
+	if (tags_are_equal(regsp-cr_iot, comcons_info.regs.cr_iot) 
 	regsp-cr_iobase == comcons_info.regs.cr_iobase) {
 #if !defined(DDB)
 		return (EBUSY); /* cannot share with console */
@@ -2371,12 +2378,12 @@
 	bus_space_handle_t help;
 
 	if (!comconsattached 
-	iot == comcons_info.regs.cr_iot 
+	tags_are_equal(iot, comcons_info.regs.cr_iot) 
 	iobase == comcons_info.regs.cr_iobase)
 		help = comcons_info.regs.cr_ioh;
 #ifdef KGDB
 	else if (!com_kgdb_attached 
-	iot == comkgdbregs.cr_iot  iobase == comkgdbregs.cr_iobase)
+	tags_are_equal(iot, comkgdbregs.cr_iot)  iobase == comkgdbregs.cr_iobase)
 		help = comkgdbregs.cr_ioh;
 #endif
 	else



CVS commit: src/sys/dev/ic

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 23:00:47 UTC 2010

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

Log Message:
sc_csr_memmapped is true iff the device registers are memory-mapped.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/ic/pdqvar.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/pdqvar.h
diff -u src/sys/dev/ic/pdqvar.h:1.43 src/sys/dev/ic/pdqvar.h:1.44
--- src/sys/dev/ic/pdqvar.h:1.43	Tue Jan 19 22:06:25 2010
+++ src/sys/dev/ic/pdqvar.h	Mon Mar 22 23:00:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pdqvar.h,v 1.43 2010/01/19 22:06:25 pooka Exp $	*/
+/*	$NetBSD: pdqvar.h,v 1.44 2010/03/22 23:00:47 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1996 Matt Thomas m...@3am-software.com
@@ -323,6 +323,7 @@
 void *sc_ats;			/* shutdown hook */
 struct ethercom sc_ec;
 bus_dma_tag_t sc_dmatag;
+bool sc_csr_memmapped;
 #define	sc_if		sc_ec.ec_if
 #elif defined(__FreeBSD__)
 struct kern_devconf *sc_kdc;	/* freebsd cruft */



CVS commit: src/sys/dev/eisa

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 23:01:10 UTC 2010

Modified Files:
src/sys/dev/eisa: if_fea.c

Log Message:
Set/test sc_csr_memmapped instead of comparing bus_space_tag_t's.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/eisa/if_fea.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/eisa/if_fea.c
diff -u src/sys/dev/eisa/if_fea.c:1.43 src/sys/dev/eisa/if_fea.c:1.44
--- src/sys/dev/eisa/if_fea.c:1.43	Mon Jan 18 19:00:58 2010
+++ src/sys/dev/eisa/if_fea.c	Mon Mar 22 23:01:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fea.c,v 1.43 2010/01/18 19:00:58 pooka Exp $	*/
+/*	$NetBSD: if_fea.c,v 1.44 2010/03/22 23:01:10 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1996 Matt Thomas m...@3am-software.com
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_fea.c,v 1.43 2010/01/18 19:00:58 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_fea.c,v 1.44 2010/03/22 23:01:10 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -164,7 +164,7 @@
 data = PDQ_OS_IORD_8(sc-sc_iotag, sc-sc_iobase, PDQ_EISA_BURST_HOLDOFF);
 #if defined(__NetBSD__)
 PDQ_OS_IOWR_8(sc-sc_iotag, sc-sc_iobase, PDQ_EISA_BURST_HOLDOFF,
-		  sc-sc_iotag == sc-sc_csrtag ? data  ~1 : data | 1);
+		  !sc-sc_csr_memmapped ? data  ~1 : data | 1);
 #elif defined(PDQ_IOMAPPED)
 PDQ_OS_IOWR_8(sc-sc_iotag, sc-sc_iobase, PDQ_EISA_BURST_HOLDOFF, data  ~1);
 #else
@@ -477,6 +477,7 @@
 pdq_eisa_subprobe(sc-sc_iotag, sc-sc_iobase, maddr, msiz, irq);
 
 if (maddr != 0  msiz != 0) {
+	sc-sc_csr_memmapped = true;
 	sc-sc_csrtag = ea-ea_memt;
 	if (bus_space_map(sc-sc_csrtag, maddr, msiz, 0, sc-sc_membase)) {
 	bus_space_unmap(sc-sc_iotag, sc-sc_iobase, EISA_SLOT_SIZE);
@@ -486,6 +487,7 @@
 	return;
 	}
 } else {
+	sc-sc_csr_memmapped = false;
 	sc-sc_csrtag = sc-sc_iotag;
 	sc-sc_membase = sc-sc_iobase;
 }
@@ -518,7 +520,7 @@
 sc-sc_ats = shutdownhook_establish((void (*)(void *)) pdq_hwreset, sc-sc_pdq);
 if (sc-sc_ats == NULL)
 	aprint_error_dev(self, warning: couldn't establish shutdown hook\n);
-if (sc-sc_csrtag != sc-sc_iotag)
+if (sc-sc_csr_memmapped)
 	printf(%s: using iomem 0x%x-0x%x\n, device_xname(sc-sc_dev), maddr, maddr + msiz - 1);
 if (intrstr != NULL)
 	printf(%s: interrupting at %s\n, device_xname(sc-sc_dev), intrstr);



CVS commit: src/sys/dev

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 23:03:30 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ex_cardbus.c
src/sys/dev/ic: elinkxlvar.h
src/sys/dev/pci: if_ex_pci.c

Log Message:
ex_softc.ex_bustype is written but never read.  Just get rid of it.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/cardbus/if_ex_cardbus.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/elinkxlvar.h
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/if_ex_pci.c

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

Modified files:

Index: src/sys/dev/cardbus/if_ex_cardbus.c
diff -u src/sys/dev/cardbus/if_ex_cardbus.c:1.53 src/sys/dev/cardbus/if_ex_cardbus.c:1.54
--- src/sys/dev/cardbus/if_ex_cardbus.c:1.53	Mon Mar 22 17:23:44 2010
+++ src/sys/dev/cardbus/if_ex_cardbus.c	Mon Mar 22 23:03:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ex_cardbus.c,v 1.53 2010/03/22 17:23:44 dyoung Exp $	*/
+/*	$NetBSD: if_ex_cardbus.c,v 1.54 2010/03/22 23:03:30 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 and 1999
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.53 2010/03/22 17:23:44 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.54 2010/03/22 23:03:30 dyoung Exp $);
 
 /* #define EX_DEBUG 4 */	/* define to report information for debugging */
 
@@ -221,7 +221,6 @@
 
 	sc-sc_dev = self;
 
-	sc-ex_bustype = EX_BUS_CARDBUS;
 	sc-sc_dmat = ca-ca_dmat;
 	csc-sc_ct = ca-ca_ct;
 	csc-sc_intrline = ca-ca_intrline;

Index: src/sys/dev/ic/elinkxlvar.h
diff -u src/sys/dev/ic/elinkxlvar.h:1.21 src/sys/dev/ic/elinkxlvar.h:1.22
--- src/sys/dev/ic/elinkxlvar.h:1.21	Mon Mar 22 17:11:19 2010
+++ src/sys/dev/ic/elinkxlvar.h	Mon Mar 22 23:03:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: elinkxlvar.h,v 1.21 2010/03/22 17:11:19 dyoung Exp $	*/
+/*	$NetBSD: elinkxlvar.h,v 1.22 2010/03/22 23:03:30 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -109,11 +109,6 @@
 #define EX_FLAGS_POWERMGMT		0x2000
 #define EX_FLAGS_ATTACHED		0x4000	/* attach has succeeded */
 
-	u_char	ex_bustype;		/* parent bus type (currently unused) */
-
-#define EX_BUS_PCI	0
-#define EX_BUS_CARDBUS	1
-
 #if NRND  0
 	rndsource_element_t rnd_source;
 #endif

Index: src/sys/dev/pci/if_ex_pci.c
diff -u src/sys/dev/pci/if_ex_pci.c:1.52 src/sys/dev/pci/if_ex_pci.c:1.53
--- src/sys/dev/pci/if_ex_pci.c:1.52	Mon Mar 22 17:20:42 2010
+++ src/sys/dev/pci/if_ex_pci.c	Mon Mar 22 23:03:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ex_pci.c,v 1.52 2010/03/22 17:20:42 dyoung Exp $	*/
+/*	$NetBSD: if_ex_pci.c,v 1.53 2010/03/22 23:03:30 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ex_pci.c,v 1.52 2010/03/22 17:20:42 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ex_pci.c,v 1.53 2010/03/22 23:03:30 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -233,7 +233,6 @@
 
 	sc-sc_dmat = pa-pa_dmat;
 
-	sc-ex_bustype = EX_BUS_PCI;
 	sc-ex_conf = epp-epp_flags;
 
 	/* Enable the card. */



CVS commit: src/sys/dev/ic

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 23:08:34 UTC 2010

Modified Files:
src/sys/dev/ic: pckbc.c tcic2.c vga.c

Log Message:
pckbc.c, vga.c: It doesn't appear to be helpful to compare two
bus_space_tag_t's in pckbc_is_console() and vga_is_console(), and MI
code should never do such a thing, so don't do it.

tcic2.c: #if 0 some diagnostic code that compares two bus_space_tag_t's.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/pckbc.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/tcic2.c
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/ic/vga.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/pckbc.c
diff -u src/sys/dev/ic/pckbc.c:1.48 src/sys/dev/ic/pckbc.c:1.49
--- src/sys/dev/ic/pckbc.c:1.48	Wed Feb 24 22:37:58 2010
+++ src/sys/dev/ic/pckbc.c	Mon Mar 22 23:08:34 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc.c,v 1.48 2010/02/24 22:37:58 dyoung Exp $ */
+/* $NetBSD: pckbc.c,v 1.49 2010/03/22 23:08:34 dyoung Exp $ */
 
 /*
  * Copyright (c) 2004 Ben Harris.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pckbc.c,v 1.48 2010/02/24 22:37:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pckbc.c,v 1.49 2010/03/22 23:08:34 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -238,7 +238,9 @@
 pckbc_is_console(bus_space_tag_t iot, bus_addr_t addr)
 {
 	if (pckbc_console  !pckbc_console_attached 
+#if 0	/* XXX Comparing bus_space_tag_t is a no-no! */
 	pckbc_consdata.t_iot == iot 
+#endif
 	pckbc_consdata.t_addr == addr)
 		return (1);
 	return (0);

Index: src/sys/dev/ic/tcic2.c
diff -u src/sys/dev/ic/tcic2.c:1.33 src/sys/dev/ic/tcic2.c:1.34
--- src/sys/dev/ic/tcic2.c:1.33	Sat Mar 14 21:04:20 2009
+++ src/sys/dev/ic/tcic2.c	Mon Mar 22 23:08:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcic2.c,v 1.33 2009/03/14 21:04:20 dsl Exp $	*/
+/*	$NetBSD: tcic2.c,v 1.34 2010/03/22 23:08:34 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christoph Badura.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcic2.c,v 1.33 2009/03/14 21:04:20 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcic2.c,v 1.34 2010/03/22 23:08:34 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -883,8 +883,10 @@
 
 	/* XXX this is pretty gross */
 
+#if 0	/* XXX Comparing bus_space_tag_t is a no-no! */
 	if (h-sc-memt != pcmhp-memt)
 		panic(tcic_chip_mem_map memt is bogus);
+#endif
 
 	busaddr = pcmhp-addr;
 
@@ -1102,8 +1104,10 @@
 
 	/* XXX this is pretty gross */
 
+#if 0	/* XXX Comparing bus_space_tag_t is a no-no! */
 	if (h-sc-iot != pcihp-iot)
 		panic(tcic_chip_io_map iot is bogus);
+#endif
 
 	DPRINTF((tcic_chip_io_map window %d %s port %lx+%lx\n,
 		 win, width_names[width], (u_long) ioaddr, (u_long) size));

Index: src/sys/dev/ic/vga.c
diff -u src/sys/dev/ic/vga.c:1.102 src/sys/dev/ic/vga.c:1.103
--- src/sys/dev/ic/vga.c:1.102	Thu Feb 25 11:20:10 2010
+++ src/sys/dev/ic/vga.c	Mon Mar 22 23:08:34 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.102 2010/02/25 11:20:10 drochner Exp $ */
+/* $NetBSD: vga.c,v 1.103 2010/03/22 23:08:34 dyoung Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vga.c,v 1.102 2010/02/25 11:20:10 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: vga.c,v 1.103 2010/03/22 23:08:34 dyoung Exp $);
 
 /* for WSCONS_SUPPORT_PCVTFONTS */
 #include opt_wsdisplay_compat.h
@@ -736,7 +736,9 @@
 {
 	if (vgaconsole 
 	!vga_console_attached 
+#if 0	/* XXX Comparing bus_space_tag_t is a no-no! */
 	iot == vga_console_vc.hdl.vh_iot 
+#endif
 	(vga_console_type == -1 || (type == vga_console_type)))
 		return (1);
 	return (0);



CVS commit: src/sys/arch/x86/x86

2010-03-22 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 22 23:21:30 UTC 2010

Modified Files:
src/sys/arch/x86/x86: ipmi.c

Log Message:
A lot of good it does to printf() a bus_space_tag_t.  Don't do it.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/x86/ipmi.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/x86/x86/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.44 src/sys/arch/x86/x86/ipmi.c:1.45
--- src/sys/arch/x86/x86/ipmi.c:1.44	Sun Mar 14 18:04:29 2010
+++ src/sys/arch/x86/x86/ipmi.c	Mon Mar 22 23:21:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipmi.c,v 1.44 2010/03/14 18:04:29 pgoyette Exp $ */
+/*	$NetBSD: ipmi.c,v 1.45 2010/03/22 23:21:29 dyoung Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipmi.c,v 1.44 2010/03/14 18:04:29 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipmi.c,v 1.45 2010/03/22 23:21:29 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -1724,8 +1724,8 @@
 	if (bus_space_map(sc-sc_iot, ia-iaa_if_iobase,
 	sc-sc_if-nregs * sc-sc_if_iospacing,
 	0, sc-sc_ioh)) {
-		printf(ipmi: bus_space_map(%x %x %x 0 %p) failed\n,
-		sc-sc_iot, ia-iaa_if_iobase,
+		printf(ipmi: bus_space_map(..., %x, %x, 0, %p) failed\n,
+		ia-iaa_if_iobase,
 		sc-sc_if-nregs * sc-sc_if_iospacing, sc-sc_ioh);
 		return (-1);
 	}



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

2010-03-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar 23 21:18:23 UTC 2010

Modified Files:
src/sys/arch/i386/mca: mca_machdep.c

Log Message:
dmaiot is supposed to be a bus_space_tag_t, not a bus_space_handle_t.
Make it so.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/mca/mca_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/i386/mca/mca_machdep.c
diff -u src/sys/arch/i386/mca/mca_machdep.c:1.38 src/sys/arch/i386/mca/mca_machdep.c:1.39
--- src/sys/arch/i386/mca/mca_machdep.c:1.38	Mon May  4 12:19:30 2009
+++ src/sys/arch/i386/mca/mca_machdep.c	Tue Mar 23 21:18:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mca_machdep.c,v 1.38 2009/05/04 12:19:30 cegger Exp $	*/
+/*	$NetBSD: mca_machdep.c,v 1.39 2010/03/23 21:18:23 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mca_machdep.c,v 1.38 2009/05/04 12:19:30 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: mca_machdep.c,v 1.39 2010/03/23 21:18:23 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -129,7 +129,8 @@
 /* Used to kick MCA DMA controller */
 #define DMA_CMD		0x18		/* command the controller */
 #define DMA_EXEC	0x1A		/* tell controller how to do things */
-static bus_space_handle_t dmaiot, dmacmdh, dmaexech;
+static bus_space_handle_t dmacmdh, dmaexech;
+static bus_space_tag_t dmaiot;
 
 /*
  * MCA DMA controller commands. The exact sense of individual bits



CVS commit: src/sys/dev/pci

2010-03-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar 23 21:22:25 UTC 2010

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

Log Message:
Use the PCI BAR type to decide which I/O enables to set.

TBD: Put back the old BAR #definition, s/PCI_BAR(0)/PCI_HME_BASEADDR/.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_hme_pci.c

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

Modified files:

Index: src/sys/dev/pci/if_hme_pci.c
diff -u src/sys/dev/pci/if_hme_pci.c:1.32 src/sys/dev/pci/if_hme_pci.c:1.33
--- src/sys/dev/pci/if_hme_pci.c:1.32	Thu Mar 11 04:00:36 2010
+++ src/sys/dev/pci/if_hme_pci.c	Tue Mar 23 21:22:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hme_pci.c,v 1.32 2010/03/11 04:00:36 mrg Exp $	*/
+/*	$NetBSD: if_hme_pci.c,v 1.33 2010/03/23 21:22:25 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2000 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_hme_pci.c,v 1.32 2010/03/11 04:00:36 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_hme_pci.c,v 1.33 2010/03/23 21:22:25 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -144,23 +144,24 @@
 	PCI_REVISION(pa-pa_class));
 	aprint_naive(: Ethernet controller\n);
 
+	csr = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG);
+	type = pci_mapreg_type(pa-pa_pc, pa-pa_tag, PCI_BAR(0));
+
 	/*
 	 * enable io/memory-space accesses.  this is kinda of gross; but
-	 # the hme comes up with neither IO space enabled, or memory space.
+	 * the hme comes up with neither IO space enabled, or memory space.
 	 */
-	if (pa-pa_memt)
+	switch (type) {
+	case PCI_MAPREG_TYPE_MEM:
 		pa-pa_flags |= PCI_FLAGS_MEM_ENABLED;
-	if (pa-pa_iot)
-		pa-pa_flags |= PCI_FLAGS_IO_ENABLED;
-	csr = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG);
-	if (pa-pa_memt) {
-		type = PCI_MAPREG_TYPE_MEM;
 		csr |= PCI_COMMAND_MEM_ENABLE;
 		sc-sc_bustag = pa-pa_memt;
-	} else {
-		type = PCI_MAPREG_TYPE_IO;
+		break;
+	case PCI_MAPREG_TYPE_IO:
+		pa-pa_flags |= PCI_FLAGS_IO_ENABLED;
 		csr |= PCI_COMMAND_IO_ENABLE;
 		sc-sc_bustag = pa-pa_iot;
+		break;
 	}
 	pci_conf_write(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG,
 	csr | PCI_COMMAND_MEM_ENABLE);
@@ -179,8 +180,7 @@
 	 *
 	 */
 
-#define PCI_HME_BASEADDR	0x10
-	if (pci_mapreg_map(pa, PCI_HME_BASEADDR, type, 0,
+	if (pci_mapreg_map(pa, PCI_BAR(0), type, 0,
 	hsc-hsc_memt, hsc-hsc_memh, NULL, NULL) != 0) {
 		aprint_error_dev(self, unable to map device registers\n);
 		return;



CVS commit: src/sys/dev/pci

2010-03-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar 23 21:51:39 UTC 2010

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

Log Message:
Put back PCI_HME_BASEADDR.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/if_hme_pci.c

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

Modified files:

Index: src/sys/dev/pci/if_hme_pci.c
diff -u src/sys/dev/pci/if_hme_pci.c:1.33 src/sys/dev/pci/if_hme_pci.c:1.34
--- src/sys/dev/pci/if_hme_pci.c:1.33	Tue Mar 23 21:22:25 2010
+++ src/sys/dev/pci/if_hme_pci.c	Tue Mar 23 21:51:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hme_pci.c,v 1.33 2010/03/23 21:22:25 dyoung Exp $	*/
+/*	$NetBSD: if_hme_pci.c,v 1.34 2010/03/23 21:51:39 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2000 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_hme_pci.c,v 1.33 2010/03/23 21:22:25 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_hme_pci.c,v 1.34 2010/03/23 21:51:39 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,6 +56,8 @@
 
 #include dev/ic/hmevar.h
 
+#define PCI_HME_BASEADDR	0x10
+
 struct hme_pci_softc {
 	struct	hme_softc	hsc_hme;	/* HME device */
 	bus_space_tag_t		hsc_memt;
@@ -145,7 +147,7 @@
 	aprint_naive(: Ethernet controller\n);
 
 	csr = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG);
-	type = pci_mapreg_type(pa-pa_pc, pa-pa_tag, PCI_BAR(0));
+	type = pci_mapreg_type(pa-pa_pc, pa-pa_tag, PCI_HME_BASEADDR);
 
 	/*
 	 * enable io/memory-space accesses.  this is kinda of gross; but
@@ -180,7 +182,7 @@
 	 *
 	 */
 
-	if (pci_mapreg_map(pa, PCI_BAR(0), type, 0,
+	if (pci_mapreg_map(pa, PCI_HME_BASEADDR, type, 0,
 	hsc-hsc_memt, hsc-hsc_memh, NULL, NULL) != 0) {
 		aprint_error_dev(self, unable to map device registers\n);
 		return;



CVS commit: src/sys/dev/pci

2010-03-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar 23 21:54:23 UTC 2010

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

Log Message:
In the #definition of PCI_HME_BASEADDR, use PCI_BAR(0) instead of the
anonymous constant 0x10.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/if_hme_pci.c

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

Modified files:

Index: src/sys/dev/pci/if_hme_pci.c
diff -u src/sys/dev/pci/if_hme_pci.c:1.34 src/sys/dev/pci/if_hme_pci.c:1.35
--- src/sys/dev/pci/if_hme_pci.c:1.34	Tue Mar 23 21:51:39 2010
+++ src/sys/dev/pci/if_hme_pci.c	Tue Mar 23 21:54:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hme_pci.c,v 1.34 2010/03/23 21:51:39 dyoung Exp $	*/
+/*	$NetBSD: if_hme_pci.c,v 1.35 2010/03/23 21:54:23 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2000 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_hme_pci.c,v 1.34 2010/03/23 21:51:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_hme_pci.c,v 1.35 2010/03/23 21:54:23 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,7 +56,7 @@
 
 #include dev/ic/hmevar.h
 
-#define PCI_HME_BASEADDR	0x10
+#define PCI_HME_BASEADDR	PCI_BAR(0)
 
 struct hme_pci_softc {
 	struct	hme_softc	hsc_hme;	/* HME device */



CVS commit: src/sys/dev

2010-03-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 24 01:13:30 UTC 2010

Modified Files:
src/sys/dev/acpi: acpi_ec.c
src/sys/dev/isa: pas.c

Log Message:
Do not use unitialized bus_space_tag_t's.  Use the tag(s) from the
attachment arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/acpi/acpi_ec.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/isa/pas.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/acpi_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.62 src/sys/dev/acpi/acpi_ec.c:1.63
--- src/sys/dev/acpi/acpi_ec.c:1.62	Fri Mar  5 14:00:16 2010
+++ src/sys/dev/acpi/acpi_ec.c	Wed Mar 24 01:13:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.62 2010/03/05 14:00:16 jruoho Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.63 2010/03/24 01:13:30 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger jo...@netbsd.org.
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_ec.c,v 1.62 2010/03/05 14:00:16 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_ec.c,v 1.63 2010/03/24 01:13:30 dyoung Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -149,7 +149,8 @@
 static void acpiec_attach(device_t, device_t, void *);
 
 static void acpiec_common_attach(device_t, device_t, ACPI_HANDLE,
-bus_addr_t, bus_addr_t, ACPI_HANDLE, uint8_t);
+bus_space_tag_t, bus_addr_t, bus_space_tag_t, bus_addr_t,
+ACPI_HANDLE, uint8_t);
 
 static bool acpiec_suspend(device_t, const pmf_qual_t *);
 static bool acpiec_resume(device_t, const pmf_qual_t *);
@@ -225,6 +226,7 @@
 static void
 acpiecdt_attach(device_t parent, device_t self, void *aux)
 {
+	struct acpi_attach_args *aa = aux;
 	ACPI_HANDLE ec_handle;
 	bus_addr_t cmd_reg, data_reg;
 	uint8_t gpebit;
@@ -235,8 +237,8 @@
 	aprint_naive(\n);
 	aprint_normal(: ACPI Embedded Controller via ECDT\n);
 
-	acpiec_common_attach(parent, self, ec_handle, cmd_reg, data_reg,
-	NULL, gpebit);
+	acpiec_common_attach(parent, self, ec_handle, aa-aa_iot, cmd_reg,
+	aa-aa_iot, data_reg, NULL, gpebit);
 }
 
 static int
@@ -290,7 +292,8 @@
 	}
 
 	acpiec_common_attach(parent, self, aa-aa_node-ad_handle,
-	io1-ar_base, io0-ar_base, gpe_handle, gpebit);
+	aa-aa_iot, io1-ar_base, aa-aa_iot, io0-ar_base,
+	gpe_handle, gpebit);
 
 free_res:
 	acpi_resource_cleanup(ec_res);
@@ -298,13 +301,17 @@
 
 static void
 acpiec_common_attach(device_t parent, device_t self,
-ACPI_HANDLE ec_handle, bus_addr_t cmd_reg, bus_addr_t data_reg,
+ACPI_HANDLE ec_handle, bus_space_tag_t cmdt, bus_addr_t cmd_reg,
+bus_space_tag_t datat, bus_addr_t data_reg,
 ACPI_HANDLE gpe_handle, uint8_t gpebit)
 {
 	struct acpiec_softc *sc = device_private(self);
 	ACPI_STATUS rv;
 	ACPI_INTEGER val;
 
+	sc-sc_csr_st = cmdt;
+	sc-sc_data_st = datat;
+
 	sc-sc_ech = ec_handle;
 	sc-sc_gpeh = gpe_handle;
 	sc-sc_gpebit = gpebit;

Index: src/sys/dev/isa/pas.c
diff -u src/sys/dev/isa/pas.c:1.67 src/sys/dev/isa/pas.c:1.68
--- src/sys/dev/isa/pas.c:1.67	Sat Mar 15 21:09:02 2008
+++ src/sys/dev/isa/pas.c	Wed Mar 24 01:13:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pas.c,v 1.67 2008/03/15 21:09:02 cube Exp $	*/
+/*	$NetBSD: pas.c,v 1.68 2010/03/24 01:13:30 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -57,7 +57,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pas.c,v 1.67 2008/03/15 21:09:02 cube Exp $);
+__KERNEL_RCSID(0, $NetBSD: pas.c,v 1.68 2010/03/24 01:13:30 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -287,7 +287,7 @@
 		return 0;
 
 	memset(sc, 0, sizeof *sc);
-	return pasfind(match, sc, aux, PASPROBE);
+	return pasfind(match, sc, ia, PASPROBE);
 }
 
 /*
@@ -309,7 +309,7 @@
 		return 0;
 	}
 
-	if (bus_space_map(sc-sc_sbdsp.sc_iot, PAS_DEFAULT_BASE, 1, 0,
+	if (bus_space_map(ia-ia_iot, PAS_DEFAULT_BASE, 1, 0,
 	sc-pas_port_handle)) {
 		printf(pas: can't map base register %x in probe\n,
 		PAS_DEFAULT_BASE);
@@ -395,7 +395,7 @@
 	sc-sc_sbdsp.sc_iot = ia-ia_iot;
 
 	/* Map i/o space [we map 24 ports which is the max of the sb and pro */
-	if (bus_space_map(sc-sc_sbdsp.sc_iot, ia-ia_io[0].ir_addr,
+	if (bus_space_map(ia-ia_iot, ia-ia_io[0].ir_addr,
 	SBP_NPORT, 0, sc-sc_sbdsp.sc_ioh)) {
 		printf(pas: can't map i/o space 0x%x/%d in probe\n,
 		ia-ia_io[0].ir_addr, SBP_NPORT);
@@ -444,11 +444,11 @@
 
  unmap:
 	if (rc == 0 || probing)
-		bus_space_unmap(sc-sc_sbdsp.sc_iot, sc-sc_sbdsp.sc_ioh,
+		bus_space_unmap(ia-ia_iot, sc-sc_sbdsp.sc_ioh,
 		SBP_NPORT);
  unmap1:
 	if (rc == 0 || probing)
-		bus_space_unmap(sc-sc_sbdsp.sc_iot, PAS_DEFAULT_BASE, 1);
+		bus_space_unmap(ia-ia_iot, PAS_DEFAULT_BASE, 1);
 	return rc;
 }
 



CVS commit: src/sys/net80211

2010-03-26 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar 26 17:18:05 UTC 2010

Modified Files:
src/sys/net80211: ieee80211.c

Log Message:
In ieee80211_media_init(), change a pointer that we never write
through to a pointer to const.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/net80211/ieee80211.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/net80211/ieee80211.c
diff -u src/sys/net80211/ieee80211.c:1.50 src/sys/net80211/ieee80211.c:1.51
--- src/sys/net80211/ieee80211.c:1.50	Tue Jan 19 22:08:17 2010
+++ src/sys/net80211/ieee80211.c	Fri Mar 26 17:18:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211.c,v 1.50 2010/01/19 22:08:17 pooka Exp $	*/
+/*	$NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID($FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $);
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.50 2010/01/19 22:08:17 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $);
 #endif
 
 /*
@@ -352,7 +352,7 @@
 	struct ifnet *ifp = ic-ic_ifp;
 	struct ifmediareq imr;
 	int i, j, mode, rate, maxrate, mword, mopt, r;
-	struct ieee80211_rateset *rs;
+	const struct ieee80211_rateset *rs;
 	struct ieee80211_rateset allrates;
 
 	/*



CVS commit: src/sys/dev/acpi

2010-03-29 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 29 16:35:59 UTC 2010

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

Log Message:
Attach acpiecdt with acpibus_attach_args.  Sverre Froyen reports that
this helps his Thinkpad boot again.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/acpi/acpi_ec.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/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.162 src/sys/dev/acpi/acpi.c:1.163
--- src/sys/dev/acpi/acpi.c:1.162	Mon Mar 22 11:13:23 2010
+++ src/sys/dev/acpi/acpi.c	Mon Mar 29 16:35:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.162 2010/03/22 11:13:23 jruoho Exp $	*/
+/*	$NetBSD: acpi.c,v 1.163 2010/03/29 16:35:59 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.162 2010/03/22 11:13:23 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.163 2010/03/29 16:35:59 dyoung Exp $);
 
 #include opt_acpi.h
 #include opt_pcifixup.h
@@ -508,7 +508,7 @@
 	}
 
 	/* Early EC handler initialization if ECDT table is available. */
-	config_found_ia(self, acpiecdtbus, NULL, NULL);
+	config_found_ia(self, acpiecdtbus, aa, NULL);
 
 	rv = AcpiInitializeObjects(ACPI_FULL_INITIALIZATION);
 	if (ACPI_FAILURE(rv)) {
@@ -611,7 +611,7 @@
 	}
 
 	/* Early EC handler initialization if ECDT table is available. */
-	config_found_ia(self, acpiecdtbus, NULL, NULL);
+	config_found_ia(self, acpiecdtbus, aa, NULL);
 
 	rv = AcpiInitializeObjects(ACPI_FULL_INITIALIZATION);
 	if (ACPI_FAILURE(rv)) {

Index: src/sys/dev/acpi/acpi_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.63 src/sys/dev/acpi/acpi_ec.c:1.64
--- src/sys/dev/acpi/acpi_ec.c:1.63	Wed Mar 24 01:13:30 2010
+++ src/sys/dev/acpi/acpi_ec.c	Mon Mar 29 16:35:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.63 2010/03/24 01:13:30 dyoung Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.64 2010/03/29 16:35:59 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger jo...@netbsd.org.
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_ec.c,v 1.63 2010/03/24 01:13:30 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_ec.c,v 1.64 2010/03/29 16:35:59 dyoung Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -226,7 +226,7 @@
 static void
 acpiecdt_attach(device_t parent, device_t self, void *aux)
 {
-	struct acpi_attach_args *aa = aux;
+	struct acpibus_attach_args *aa = aux;
 	ACPI_HANDLE ec_handle;
 	bus_addr_t cmd_reg, data_reg;
 	uint8_t gpebit;



CVS commit: src/sys/arch/xen

2010-03-30 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 31 00:00:33 UTC 2010

Modified Files:
src/sys/arch/xen: Makefile

Log Message:
Include more sources in the tags target.  Don't compute tags on some
non-existent assembly-language files.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/Makefile

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

Modified files:

Index: src/sys/arch/xen/Makefile
diff -u src/sys/arch/xen/Makefile:1.8 src/sys/arch/xen/Makefile:1.9
--- src/sys/arch/xen/Makefile:1.8	Tue Aug 18 17:21:51 2009
+++ src/sys/arch/xen/Makefile	Wed Mar 31 00:00:33 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2009/08/18 17:21:51 dyoung Exp $
+#	$NetBSD: Makefile,v 1.9 2010/03/31 00:00:33 dyoung Exp $
 
 .include bsd.own.mk
 
@@ -17,9 +17,14 @@
 SXEN+=	${SYSDIR}/arch/xen/include/*.h
 SXEN+=	${SYSDIR}/arch/xen/include/*/*.h
 SXEN+=	${SYSDIR}/arch/xen/include/*/*/*.h
+SXEN+=	${SYSDIR}/arch/x86/x86/*.[ch] \
+	${SYSDIR}/arch/x86/acpi/*.[ch] \
+	${SYSDIR}/arch/x86/include/*.h \
+	${SYSDIR}/arch/x86/isa/*.[ch] \
+	${SYSDIR}/arch/x86/pci/*.[ch]
 AXEN!=	${TOOL_AWK} '/^\#/ { next } ($$2 ~ /^arch.*\.[sS]$$/) {print ${SYSDIR}/ $$2}' \
 		${SYSDIR}/arch/xen/conf/files.xen
-AXEN+=	${SYSDIR}/arch/xen/${XEN_BUILD}/*.[sS]
+#AXEN+=	${SYSDIR}/arch/xen/${XEN_BUILD}/*.[sS]
 
 # Directories in which to place tags links
 DXEN=	xen ${XEN_MACHINE_ARCHS} include



CVS commit: src/sys/dev/cardbus

2010-03-31 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Apr  1 05:58:52 UTC 2010

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

Log Message:
Cosmetic: join a couple of lines.  Stop storing the value of a BAR in a
temporary variable with the name 'csr'.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/cardbus/siisata_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/siisata_cardbus.c
diff -u src/sys/dev/cardbus/siisata_cardbus.c:1.12 src/sys/dev/cardbus/siisata_cardbus.c:1.13
--- src/sys/dev/cardbus/siisata_cardbus.c:1.12	Thu Mar 18 20:54:56 2010
+++ src/sys/dev/cardbus/siisata_cardbus.c	Thu Apr  1 05:58:52 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_cardbus.c,v 1.12 2010/03/18 20:54:56 dyoung Exp $ */
+/* $NetBSD: siisata_cardbus.c,v 1.13 2010/04/01 05:58:52 dyoung Exp $ */
 /* Id: siisata_pci.c,v 1.11 2008/05/21 16:20:11 jakllsch Exp  */
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.12 2010/03/18 20:54:56 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.13 2010/04/01 05:58:52 dyoung Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -175,9 +175,7 @@
 	{
 #define SIISATA_BAR0_SIZE	128
 		grsize = SIISATA_BAR0_SIZE;
-		csr =
-		Cardbus_conf_read(ct, ca-ca_tag, SIISATA_CARDBUS_BAR0);
-		base = PCI_MAPREG_MEM_ADDR(csr);
+		base = PCI_MAPREG_MEM_ADDR(Cardbus_conf_read(ct, ca-ca_tag, SIISATA_CARDBUS_BAR0));
 		memt = csc-sc_memt;
 		if ((*cf-cardbus_space_alloc)(cc, csc-sc_rbus_memt, base,
 		grsize, grsize - 1, grsize, 0, base, memh)) {
@@ -186,8 +184,7 @@
 			SIISATANAME(sc));
 			return;
 		}
-		Cardbus_conf_write(ct, ca-ca_tag, SIISATA_CARDBUS_BAR0,
-		base);
+		Cardbus_conf_write(ct, ca-ca_tag, SIISATA_CARDBUS_BAR0, base);
 	}
 	sc-sc_grt = memt;
 	sc-sc_grh = memh;
@@ -211,8 +208,7 @@
 			SIISATANAME(sc));
 			return;
 		}
-		Cardbus_conf_write(ct, ca-ca_tag, SIISATA_CARDBUS_BAR1,
-		base);
+		Cardbus_conf_write(ct, ca-ca_tag, SIISATA_CARDBUS_BAR1, base);
 	}
 	sc-sc_prt = memt;
 	sc-sc_prh = memh;



CVS commit: src/sys/net80211

2010-04-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Apr  2 03:46:50 UTC 2010

Modified Files:
src/sys/net80211: ieee80211.c

Log Message:
Delete ieee80211_setbasicrates().  It's buggy, and we drivers can get
along fine without it.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/net80211/ieee80211.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/net80211/ieee80211.c
diff -u src/sys/net80211/ieee80211.c:1.51 src/sys/net80211/ieee80211.c:1.52
--- src/sys/net80211/ieee80211.c:1.51	Fri Mar 26 17:18:05 2010
+++ src/sys/net80211/ieee80211.c	Fri Apr  2 03:46:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $	*/
+/*	$NetBSD: ieee80211.c,v 1.52 2010/04/02 03:46:50 dyoung Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID($FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $);
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.51 2010/03/26 17:18:05 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ieee80211.c,v 1.52 2010/04/02 03:46:50 dyoung Exp $);
 #endif
 
 /*
@@ -92,8 +92,6 @@
 	SLIST_HEAD_INITIALIZER(ieee80211_list);
 static u_int8_t ieee80211_vapmap[32];		/* enough for 256 */
 
-static void ieee80211_setbasicrates(struct ieee80211com *);
-
 static void
 ieee80211_add_vap(struct ieee80211com *ic)
 {
@@ -216,7 +214,6 @@
 	if (ic-ic_caps  IEEE80211_C_WME)
 		ic-ic_flags |= IEEE80211_F_WME;
 #endif
-	ieee80211_setbasicrates(ic);
 	(void) ieee80211_setmode(ic, ic-ic_curmode);
 
 	if (ic-ic_bintval == 0)
@@ -809,41 +806,6 @@
 	{ 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
 
 /*
- * Mark the basic rates for the 11g rate table based on the
- * operating mode.  For real 11g we mark all the 11b rates
- * and 6, 12, and 24 OFDM.  For 11b compatibility we mark only
- * 11b rates.  There's also a pseudo 11a-mode used to mark only
- * the basic OFDM rates.
- */
-static void
-ieee80211_setbasicrates(struct ieee80211com *ic)
-{
-	static const struct ieee80211_rateset basic[] = {
-	{ 0, { } }, /* IEEE80211_MODE_AUTO */
-	{ 3, { 12, 24, 48 } },  /* IEEE80211_MODE_11A */
-	{ 2, { 2, 4 } },/* IEEE80211_MODE_11B */
-	{ 4, { 2, 4, 11, 22 } },/* IEEE80211_MODE_11G */
-	{ 0, { } }, /* IEEE80211_MODE_TURBO */
-	};
-	enum ieee80211_phymode mode;
-	struct ieee80211_rateset *rs;
-	int i, j;
-
-	for (mode = 0; mode  IEEE80211_MODE_MAX; mode++) {
-		rs = ic-ic_sup_rates[mode];
-		for (i = 0; i  rs-rs_nrates; i++) {
-			rs-rs_rates[i] = IEEE80211_RATE_VAL;
-			for (j = 0; j  basic[mode].rs_nrates; j++) {
-if (basic[mode].rs_rates[j] != rs-rs_rates[i])
-	continue; 
-rs-rs_rates[i] |= IEEE80211_RATE_BASIC;
-break;
-			}
-		}
-	}
-}
-
-/*
  * Set the current phy mode and recalculate the active channel
  * set based on the available channels for this mode.  Also
  * select a new default/current channel if the current one is



CVS commit: src/sys/dev/ic

2010-04-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Apr 16 18:58:39 UTC 2010

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

Log Message:
#include sys/bus.h instead of machine/bus.h.  No functional change
intended.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/pcf8584.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/pcf8584.c
diff -u src/sys/dev/ic/pcf8584.c:1.8 src/sys/dev/ic/pcf8584.c:1.9
--- src/sys/dev/ic/pcf8584.c:1.8	Wed Mar 31 21:01:03 2010
+++ src/sys/dev/ic/pcf8584.c	Fri Apr 16 18:58:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcf8584.c,v 1.8 2010/03/31 21:01:03 macallan Exp $	*/
+/*	$NetBSD: pcf8584.c,v 1.9 2010/04/16 18:58:39 dyoung Exp $	*/
 /*	$OpenBSD: pcf8584.c,v 1.9 2007/10/20 18:46:21 kettenis Exp $ */
 
 /*
@@ -24,8 +24,7 @@
 #include sys/kernel.h
 #include sys/rwlock.h
 #include sys/proc.h
-
-#include machine/bus.h
+#include sys/bus.h
 
 #include dev/i2c/i2cvar.h
 



CVS commit: src/sys/dev/ic

2010-04-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Apr 16 18:59:12 UTC 2010

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

Log Message:
#include sys/bus.h instead of machine/bus.h.  No functional change
intended.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/cs4231.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/cs4231.c
diff -u src/sys/dev/ic/cs4231.c:1.24 src/sys/dev/ic/cs4231.c:1.25
--- src/sys/dev/ic/cs4231.c:1.24	Thu Jan 14 02:21:19 2010
+++ src/sys/dev/ic/cs4231.c	Fri Apr 16 18:59:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4231.c,v 1.24 2010/01/14 02:21:19 macallan Exp $	*/
+/*	$NetBSD: cs4231.c,v 1.25 2010/04/16 18:59:12 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cs4231.c,v 1.24 2010/01/14 02:21:19 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: cs4231.c,v 1.25 2010/04/16 18:59:12 dyoung Exp $);
 
 #include audio.h
 #if NAUDIO  0
@@ -40,9 +40,9 @@
 #include sys/errno.h
 #include sys/device.h
 #include sys/malloc.h
+#include sys/bus.h
 
 #include machine/autoconf.h
-#include machine/bus.h
 #include sys/cpu.h
 
 #include sys/audioio.h



CVS commit: src/share/man/man9

2010-04-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Apr 16 20:05:37 UTC 2010

Modified Files:
src/share/man/man9: bus_space.9

Log Message:
Describe bus_space_is_equal(9).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/share/man/man9/bus_space.9

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

Modified files:

Index: src/share/man/man9/bus_space.9
diff -u src/share/man/man9/bus_space.9:1.39 src/share/man/man9/bus_space.9:1.40
--- src/share/man/man9/bus_space.9:1.39	Mon Apr  5 18:24:24 2010
+++ src/share/man/man9/bus_space.9	Fri Apr 16 20:05:37 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: bus_space.9,v 1.39 2010/04/05 18:24:24 dyoung Exp $
+.\ $NetBSD: bus_space.9,v 1.40 2010/04/16 20:05:37 dyoung Exp $
 .\
 .\ Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 5, 2010
+.Dd April 16, 2010
 .Dt BUS_SPACE 9
 .Os
 .Sh NAME
@@ -38,7 +38,9 @@
 .Nm bus_space_copy_region_4 ,
 .Nm bus_space_copy_region_8 ,
 .Nm bus_space_free ,
+.Nm bus_space_is_equal ,
 .Nm bus_space_map ,
+.Nm bus_space_mmap ,
 .Nm bus_space_peek_1 ,
 .Nm bus_space_peek_2 ,
 .Nm bus_space_peek_4 ,
@@ -78,7 +80,6 @@
 .Nm bus_space_subregion ,
 .Nm bus_space_unmap ,
 .Nm bus_space_vaddr ,
-.Nm bus_space_mmap ,
 .Nm bus_space_write_1 ,
 .Nm bus_space_write_2 ,
 .Nm bus_space_write_4 ,
@@ -106,6 +107,8 @@
 .Nd bus space manipulation functions
 .Sh SYNOPSIS
 .In sys/bus.h
+.Ft bool
+.Fn bus_space_is_equal bus_space_tag_t space1 bus_space_tag_t space2
 .Ft int
 .Fn bus_space_map bus_space_tag_t space bus_addr_t address \
 bus_size_t size int flags bus_space_handle_t *handlep
@@ -540,6 +543,20 @@
 machine-independent code.
 This type is used when performing bus space access operations.
 .El
+.Sh COMPARING BUS SPACE TAGS
+To check whether or not one
+.Fa bus_space_tag_t
+refers to the same space as another in machine-independent code,
+do not use either
+.Xr memcmp 9
+or the C equals
+.Po
+==
+.Pc
+operator.
+Use
+.Fn bus_space_is_equal ,
+instead.
 .Sh MAPPING AND UNMAPPING BUS SPACE
 Bus space must be mapped before it can be used, and should be
 unmapped when it is no longer needed.



CVS commit: src

2010-04-16 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Apr 16 20:08:51 UTC 2010

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile

Log Message:
Add a link, bus_space_is_equal.9 - bus_space.9.


To generate a diff of this commit:
cvs rdiff -u -r1.1432 -r1.1433 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.327 -r1.328 src/share/man/man9/Makefile

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1432 src/distrib/sets/lists/comp/mi:1.1433
--- src/distrib/sets/lists/comp/mi:1.1432	Tue Apr 13 17:34:18 2010
+++ src/distrib/sets/lists/comp/mi	Fri Apr 16 20:08:51 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1432 2010/04/13 17:34:18 jruoho Exp $
+#	$NetBSD: mi,v 1.1433 2010/04/16 20:08:51 dyoung Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -8695,6 +8695,7 @@
 ./usr/share/man/cat9/bus_space_copy_region_4.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/bus_space_copy_region_8.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/bus_space_free.0		comp-sys-catman		.cat
+./usr/share/man/cat9/bus_space_is_equal.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/bus_space_map.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/bus_space_mmap.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/bus_space_read_1.0		comp-sys-catman		.cat
@@ -14398,6 +14399,7 @@
 ./usr/share/man/html9/bus_space_copy_region_4.html	comp-sys-htmlman	html
 ./usr/share/man/html9/bus_space_copy_region_8.html	comp-sys-htmlman	html
 ./usr/share/man/html9/bus_space_free.html	comp-sys-htmlman	html
+./usr/share/man/html9/bus_space_is_equal.html	comp-sys-htmlman	html
 ./usr/share/man/html9/bus_space_map.html	comp-sys-htmlman	html
 ./usr/share/man/html9/bus_space_mmap.html	comp-sys-htmlman	html
 ./usr/share/man/html9/bus_space_read_1.html	comp-sys-htmlman	html
@@ -20212,6 +20214,7 @@
 ./usr/share/man/man9/bus_space_copy_region_4.9	comp-sys-man		.man
 ./usr/share/man/man9/bus_space_copy_region_8.9	comp-sys-man		.man
 ./usr/share/man/man9/bus_space_free.9		comp-sys-man		.man
+./usr/share/man/man9/bus_space_is_equal.9	comp-sys-man		.man
 ./usr/share/man/man9/bus_space_map.9		comp-sys-man		.man
 ./usr/share/man/man9/bus_space_mmap.9		comp-sys-man		.man
 ./usr/share/man/man9/bus_space_read_1.9		comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.327 src/share/man/man9/Makefile:1.328
--- src/share/man/man9/Makefile:1.327	Tue Apr 13 17:34:18 2010
+++ src/share/man/man9/Makefile	Fri Apr 16 20:08:51 2010
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.327 2010/04/13 17:34:18 jruoho Exp $
+#   $NetBSD: Makefile,v 1.328 2010/04/16 20:08:51 dyoung Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -123,7 +123,9 @@
 	bus_space.9 bus_space_copy_region_2.9 \
 	bus_space.9 bus_space_copy_region_4.9 \
 	bus_space.9 bus_space_copy_region_8.9 \
-	bus_space.9 bus_space_free.9 bus_space.9 bus_space_map.9 \
+	bus_space.9 bus_space_free.9 \
+	bus_space.9 bus_space_is_equal.9 \
+	bus_space.9 bus_space_map.9 \
 	bus_space.9 bus_space_mmap.9 \
 	bus_space.9 bus_space_read_1.9 bus_space.9 bus_space_read_2.9 \
 	bus_space.9 bus_space_read_4.9 bus_space.9 bus_space_read_8.9 \



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

2010-04-20 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Apr 20 22:37:25 UTC 2010

Modified Files:
src/sys/arch/i386/isa: isapnp_machdep.c

Log Message:
Re-uppercase x86_bus_space_io.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/isa/isapnp_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/i386/isa/isapnp_machdep.c
diff -u src/sys/arch/i386/isa/isapnp_machdep.c:1.14 src/sys/arch/i386/isa/isapnp_machdep.c:1.15
--- src/sys/arch/i386/isa/isapnp_machdep.c:1.14	Mon Apr 19 18:24:26 2010
+++ src/sys/arch/i386/isa/isapnp_machdep.c	Tue Apr 20 22:37:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: isapnp_machdep.c,v 1.14 2010/04/19 18:24:26 dyoung Exp $	*/
+/*	$NetBSD: isapnp_machdep.c,v 1.15 2010/04/20 22:37:25 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: isapnp_machdep.c,v 1.14 2010/04/19 18:24:26 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: isapnp_machdep.c,v 1.15 2010/04/20 22:37:25 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -67,7 +67,7 @@
 {
 
 #ifdef DIAGNOSTIC
-	if (!bus_space_is_equal(sc-sc_iot, x86_bus_space_io))
+	if (!bus_space_is_equal(sc-sc_iot, X86_BUS_SPACE_IO))
 		panic(isapnp_map: bogus bus space tag);
 #endif
 
@@ -100,7 +100,7 @@
 #endif
 
 #ifdef DIAGNOSTIC
-	if (!bus_space_is_equal(sc-sc_iot, x86_bus_space_io))
+	if (!bus_space_is_equal(sc-sc_iot, X86_BUS_SPACE_IO))
 		panic(isapnp_map_readport: bogus bus space tag);
 #endif
 



CVS commit: src/sys/dev/pci

2010-04-20 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Apr 20 23:39:11 UTC 2010

Modified Files:
src/sys/dev/pci: pccbb.c pccbbvar.h

Log Message:
Change sc_pil_intr_enable from an int to a bool.  No functional change
intended.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/dev/pci/pccbb.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/pccbbvar.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/pci/pccbb.c
diff -u src/sys/dev/pci/pccbb.c:1.198 src/sys/dev/pci/pccbb.c:1.199
--- src/sys/dev/pci/pccbb.c:1.198	Mon Apr 19 18:24:27 2010
+++ src/sys/dev/pci/pccbb.c	Tue Apr 20 23:39:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pccbb.c,v 1.198 2010/04/19 18:24:27 dyoung Exp $	*/
+/*	$NetBSD: pccbb.c,v 1.199 2010/04/20 23:39:10 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pccbb.c,v 1.198 2010/04/19 18:24:27 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pccbb.c,v 1.199 2010/04/20 23:39:10 dyoung Exp $);
 
 /*
 #define CBB_DEBUG
@@ -639,7 +639,7 @@
 	/* bus bridge initialization */
 	pccbb_chipinit(sc);
 
-	sc-sc_pil_intr_enable = 1;
+	sc-sc_pil_intr_enable = true;
 
 	{
 		u_int32_t sockstat;
@@ -3152,7 +3152,7 @@
 
 	if (sc-sc_pil_intr_enable)
 		(void)pccbbintr_function(sc);
-	sc-sc_pil_intr_enable = 0;
+	sc-sc_pil_intr_enable = false;
 
 	reg = bus_space_read_4(base_memt, base_memh, CB_SOCKET_MASK);
 	/* Disable interrupts. */
@@ -3207,7 +3207,7 @@
 	 */
 	(void)pccbbintr(sc);
 
-	sc-sc_pil_intr_enable = 1;
+	sc-sc_pil_intr_enable = true;
 
 	return true;
 }

Index: src/sys/dev/pci/pccbbvar.h
diff -u src/sys/dev/pci/pccbbvar.h:1.40 src/sys/dev/pci/pccbbvar.h:1.41
--- src/sys/dev/pci/pccbbvar.h:1.40	Mon Mar 15 20:02:56 2010
+++ src/sys/dev/pci/pccbbvar.h	Tue Apr 20 23:39:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pccbbvar.h,v 1.40 2010/03/15 20:02:56 dyoung Exp $	*/
+/*	$NetBSD: pccbbvar.h,v 1.41 2010/04/20 23:39:11 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 HAYAKAWA Koichi.  All rights reserved.
@@ -135,7 +135,8 @@
 
 	/* interrupt handler list on the bridge */
 	LIST_HEAD(, pccbb_intrhand_list) sc_pil;
-	int sc_pil_intr_enable;	/* can i call intr handler for child device? */
+	/* can i call intr handler for child device? */
+	bool sc_pil_intr_enable;
 };
 
 /*



CVS commit: src/sys/dev/ic

2010-04-21 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 21 21:49:53 UTC 2010

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

Log Message:
Don't printf bus_space_tag_t's in a MI driver.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/spic.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/spic.c
diff -u src/sys/dev/ic/spic.c:1.17 src/sys/dev/ic/spic.c:1.18
--- src/sys/dev/ic/spic.c:1.17	Wed Feb 24 22:37:58 2010
+++ src/sys/dev/ic/spic.c	Wed Apr 21 21:49:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: spic.c,v 1.17 2010/02/24 22:37:58 dyoung Exp $	*/
+/*	$NetBSD: spic.c,v 1.18 2010/04/21 21:49:53 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spic.c,v 1.17 2010/02/24 22:37:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: spic.c,v 1.18 2010/04/21 21:49:53 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -257,7 +257,7 @@
 
 #ifdef SPIC_DEBUG
 	if (spicdebug)
-		printf(spic_attach %x %x\n, sc-sc_iot, (uint)sc-sc_ioh);
+		printf(spic_attach %x\n, (uint)sc-sc_ioh);
 #endif
 
 	callout_init(sc-sc_poll, 0);



CVS commit: src

2010-04-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Apr 23 19:21:08 UTC 2010

Modified Files:
src/etc/mtree: Makefile
src/usr.sbin/postinstall: postinstall

Log Message:
Do not try in postinstall(8) to replicate the code in etc/mtree/Makefile
that assembles /etc/mtree/NetBSD.dist.  Instead, use the Makefile's
new target, emit_dist_file, to assemble the correct NetBSD.dist.

Previously, 'postinstall -m amd64 -s $SRC_TOP' would install a
NetBSD.dist that was missing /usr/lib/i386/ et cetera.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/etc/mtree/Makefile
cvs rdiff -u -r1.107 -r1.108 src/usr.sbin/postinstall/postinstall

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

Modified files:

Index: src/etc/mtree/Makefile
diff -u src/etc/mtree/Makefile:1.15 src/etc/mtree/Makefile:1.16
--- src/etc/mtree/Makefile:1.15	Mon Jan 18 10:25:29 2010
+++ src/etc/mtree/Makefile	Fri Apr 23 19:21:08 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2010/01/18 10:25:29 plunky Exp $
+#	$NetBSD: Makefile,v 1.16 2010/04/23 19:21:08 dyoung Exp $
 
 .include bsd.own.mk
 
@@ -39,6 +39,9 @@
 TOOL_MTREE.unpriv=	-W
 .endif
 
+emit_dist_file:
+	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
+
 distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
 .if !defined(DISTRIBUTION_DONE)		# {
 # Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.107 src/usr.sbin/postinstall/postinstall:1.108
--- src/usr.sbin/postinstall/postinstall:1.107	Thu Dec 24 21:52:57 2009
+++ src/usr.sbin/postinstall/postinstall	Fri Apr 23 19:21:08 2010
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.107 2009/12/24 21:52:57 christos Exp $
+# $NetBSD: postinstall,v 1.108 2010/04/23 19:21:08 dyoung Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -933,12 +933,7 @@
 	if ! $SOURCEMODE; then
 		MTREE_DIR=${SRC_DIR}/etc/mtree
 	else
-		extrafile=/dev/null
-		if [ ${MKX11} != no ]; then
-			get_makevar X11FLAVOUR
-			extrafile=${SRC_DIR}/etc/mtree/NetBSD.dist.${X11FLAVOUR}
-		fi
-		cat ${SRC_DIR}/etc/mtree/NetBSD.dist.base ${extrafile}  \
+		${MAKE} -C ${SRC_DIR}/etc/mtree emit_dist_file  \
 		${SCRATCHDIR}/NetBSD.dist
 		MTREE_DIR=${SCRATCHDIR}
 	fi



CVS commit: src/etc/mtree

2010-04-26 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Apr 27 03:01:25 UTC 2010

Modified Files:
src/etc/mtree: Makefile

Log Message:
Describe in a comment what the emit_dist_file target is for.

Under some circumstances, ${TOOL_CAT} may refer to an executable
that does not exist.  As a stopgap fix, use cat(1) instead of
${TOOL_CAT} in emit_dist_file.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/etc/mtree/Makefile

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

Modified files:

Index: src/etc/mtree/Makefile
diff -u src/etc/mtree/Makefile:1.16 src/etc/mtree/Makefile:1.17
--- src/etc/mtree/Makefile:1.16	Fri Apr 23 19:21:08 2010
+++ src/etc/mtree/Makefile	Tue Apr 27 03:01:25 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2010/04/23 19:21:08 dyoung Exp $
+#	$NetBSD: Makefile,v 1.17 2010/04/27 03:01:25 dyoung Exp $
 
 .include bsd.own.mk
 
@@ -39,8 +39,12 @@
 TOOL_MTREE.unpriv=	-W
 .endif
 
+# postinstall(8) invokes this target to produce the right
+# /etc/mtree/NetBSD.dist content without duplicating logic from
+# the Makefile.
+#
 emit_dist_file:
-	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
+	cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
 
 distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
 .if !defined(DISTRIBUTION_DONE)		# {



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

2010-04-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Apr 27 18:41:52 UTC 2010

Modified Files:
src/sys/arch/i386/i386: pmc.c

Log Message:
#include machine/cpuvar.h for CPU feature definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/i386/pmc.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/i386/i386/pmc.c
diff -u src/sys/arch/i386/i386/pmc.c:1.18 src/sys/arch/i386/i386/pmc.c:1.19
--- src/sys/arch/i386/i386/pmc.c:1.18	Thu Apr 22 21:02:25 2010
+++ src/sys/arch/i386/i386/pmc.c	Tue Apr 27 18:41:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmc.c,v 1.18 2010/04/22 21:02:25 jym Exp $	*/
+/*	$NetBSD: pmc.c,v 1.19 2010/04/27 18:41:52 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -38,13 +38,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmc.c,v 1.18 2010/04/22 21:02:25 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmc.c,v 1.19 2010/04/27 18:41:52 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/proc.h
 
 #include machine/cpufunc.h
+#include machine/cpuvar.h
 #include machine/specialreg.h
 #include machine/sysarch.h
 #include machine/pmc.h



CVS commit: src/sys/dev/mii

2010-04-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Apr 27 18:52:45 UTC 2010

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

Log Message:
For a couple of flags, use bool/true/false instead of int/1/0.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/mii/brgphy.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/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.53 src/sys/dev/mii/brgphy.c:1.54
--- src/sys/dev/mii/brgphy.c:1.53	Sat Mar 13 12:57:23 2010
+++ src/sys/dev/mii/brgphy.c	Tue Apr 27 18:52:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.53 2010/03/13 12:57:23 kiyohara Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.54 2010/04/27 18:52:45 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: brgphy.c,v 1.53 2010/03/13 12:57:23 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: brgphy.c,v 1.54 2010/04/27 18:52:45 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -90,8 +90,8 @@
 
 struct brgphy_softc {
 	struct mii_softc sc_mii;
-	int sc_isbge;
-	int sc_isbnx;
+	bool sc_isbge;
+	bool sc_isbnx;
 	int sc_bge_flags;
 	int sc_bnx_flags;
 };
@@ -255,13 +255,13 @@
 	aprint_normal(\n);
 
 	if (device_is_a(parent, bge)) {
-		bsc-sc_isbge = 1;
+		bsc-sc_isbge = true;
 		dict = device_properties(parent);
 		if (!prop_dictionary_get_uint32(dict, phyflags,
 			bsc-sc_bge_flags))
 			aprint_error(failed to get phyflags);
 	} else if (device_is_a(parent, bnx)) {
-		bsc-sc_isbnx = 1;
+		bsc-sc_isbnx = true;
 		dict = device_properties(parent);
 		prop_dictionary_get_uint32(dict, phyflags,
 		bsc-sc_bnx_flags);
@@ -540,7 +540,7 @@
 	}
 
 	/* Handle any bge (NetXtreme/NetLink) workarounds. */
-	if (bsc-sc_isbge != 0) {
+	if (bsc-sc_isbge) {
 		if (!(sc-mii_flags  MIIF_HAVEFIBER)) {
 
 			if (bsc-sc_bge_flags  BGE_PHY_ADC_BUG)
@@ -592,7 +592,7 @@
 		}
 #if 0 /* not yet */
 	/* Handle any bnx (NetXtreme II) workarounds. */
-	} else if (sc-sc_isbnx != 0) {
+	} else if (sc-sc_isbnx) {
 		bnx_sc = sc-mii_pdata-mii_ifp-if_softc;
 
 		if (sc-mii_mpd_model == MII_MODEL_xxBROADCOM2_BCM5708S) {



CVS commit: src/sys/dev/scsipi

2010-04-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Apr 27 18:55:12 UTC 2010

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

Log Message:
For clarity of scsidevdetached(), rename some variables:  sc -
self, dev - child, ssc - sc.


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 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/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.255 src/sys/dev/scsipi/scsiconf.c:1.256
--- src/sys/dev/scsipi/scsiconf.c:1.255	Thu Nov 12 19:44:17 2009
+++ src/sys/dev/scsipi/scsiconf.c	Tue Apr 27 18:55:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.255 2009/11/12 19:44:17 dyoung Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.256 2010/04/27 18:55:12 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: scsiconf.c,v 1.255 2009/11/12 19:44:17 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: scsiconf.c,v 1.256 2010/04/27 18:55:12 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -353,18 +353,18 @@
 }
 
 static void
-scsidevdetached(device_t sc, device_t dev)
+scsidevdetached(device_t self, device_t child)
 {
-	struct scsibus_softc *ssc = device_private(sc);
-	struct scsipi_channel *chan = ssc-sc_channel;
+	struct scsibus_softc *sc = device_private(self);
+	struct scsipi_channel *chan = sc-sc_channel;
 	struct scsipi_periph *periph;
 	int target, lun;
 
-	target = device_locator(dev, SCSIBUSCF_TARGET);
-	lun = device_locator(dev, SCSIBUSCF_LUN);
+	target = device_locator(child, SCSIBUSCF_TARGET);
+	lun = device_locator(child, SCSIBUSCF_LUN);
 
 	periph = scsipi_lookup_periph(chan, target, lun);
-	KASSERT(periph-periph_dev == dev);
+	KASSERT(periph-periph_dev == child);
 
 	scsipi_remove_periph(chan, periph);
 	free(periph, M_DEVBUF);



CVS commit: src/sys/arch/x86/pci

2010-04-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Apr 27 23:33:14 UTC 2010

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Make pci_conf_read(9) and pci_conf_write(9) re-entrant so that the
kernel can use them in an NMI trap handler.  Only one CPU can be
in _read() or _write() at once.  However, on any single CPU, more
than one thread of execution (LWP, interrupt handler, trap handler)
may be in _read() or _write() at once, because each thread saves
and restores the PCI configuration-access state.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/pci/pci_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/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.41 src/sys/arch/x86/pci/pci_machdep.c:1.42
--- src/sys/arch/x86/pci/pci_machdep.c:1.41	Sun Mar 14 20:19:06 2010
+++ src/sys/arch/x86/pci/pci_machdep.c	Tue Apr 27 23:33:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.41 2010/03/14 20:19:06 dyoung Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.42 2010/04/27 23:33:14 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.41 2010/03/14 20:19:06 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.42 2010/04/27 23:33:14 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -82,6 +82,7 @@
 #include sys/errno.h
 #include sys/device.h
 #include sys/bus.h
+#include sys/cpu.h
 
 #include uvm/uvm_extern.h
 
@@ -129,26 +130,24 @@
 static int pci_mode = -1;
 #endif
 
+struct pci_conf_lock {
+	uint32_t cl_cpuno;	/* 0: unlocked
+ * 1 + n: locked by CPU n (0 = n)
+ */
+	uint32_t cl_sel;	/* the address that's being read. */
+};
+
+static void pci_conf_unlock(struct pci_conf_lock *);
+static uint32_t pci_conf_selector(pcitag_t, int);
+static unsigned int pci_conf_port(pcitag_t, int);
+static void pci_conf_select(uint32_t);
+static void pci_conf_lock(struct pci_conf_lock *, uint32_t);
 static void pci_bridge_hook(pci_chipset_tag_t, pcitag_t, void *);
 struct pci_bridge_hook_arg {
 	void (*func)(pci_chipset_tag_t, pcitag_t, void *); 
 	void *arg; 
 }; 
 
-__cpu_simple_lock_t pci_conf_lock = __SIMPLELOCK_UNLOCKED;
-
-#define	PCI_CONF_LOCK(s)		\
-do {	\
-	(s) = splhigh();		\
-	__cpu_simple_lock(pci_conf_lock);\
-} while (0)
-
-#define	PCI_CONF_UNLOCK(s)		\
-do {	\
-	__cpu_simple_unlock(pci_conf_lock);\
-	splx((s));			\
-} while (0)
-
 #define	PCI_MODE1_ENABLE	0x8000UL
 #define	PCI_MODE1_ADDRESS_REG	0x0cf8
 #define	PCI_MODE1_DATA_REG	0x0cfc
@@ -243,6 +242,63 @@
 };
 #endif
 
+static struct pci_conf_lock cl0 = {
+	  .cl_cpuno = 0UL
+	, .cl_sel = 0UL
+};
+
+static struct pci_conf_lock * const cl = cl0;
+
+static void
+pci_conf_lock(struct pci_conf_lock *ocl, uint32_t sel)
+{
+	uint32_t cpuno;
+
+	KASSERT(sel != 0);
+
+	kpreempt_disable();
+	cpuno = cpu_number() + 1;
+	/* If the kernel enters pci_conf_lock() through an interrupt
+	 * handler, then the CPU may already hold the lock.
+	 *
+	 * If the CPU does not already hold the lock, spin until
+	 * we can acquire it.
+	 */
+	if (cpuno == cl-cl_cpuno) {
+		ocl-cl_cpuno = cpuno;
+	} else {
+		ocl-cl_cpuno = 0;
+		while (atomic_cas_32(cl-cl_cpuno, 0, cpuno) != 0)
+			;
+	}
+
+	/* Only one CPU can be here, so an interlocked atomic_swap(3)
+	 * is not necessary.
+	 *
+	 * Evaluating atomic_cas_32_ni()'s argument, cl-cl_sel,
+	 * and applying atomic_cas_32_ni() is not an atomic operation,
+	 * however, any interrupt that, in the middle of the
+	 * operation, modifies cl-cl_sel, will also restore
+	 * cl-cl_sel.  So cl-cl_sel will have the same value when
+	 * we apply atomic_cas_32_ni() as when we evaluated it,
+	 * before.
+	 */
+	ocl-cl_sel = atomic_cas_32_ni(cl-cl_sel, cl-cl_sel, sel);
+	pci_conf_select(sel);
+}
+
+static void
+pci_conf_unlock(struct pci_conf_lock *ocl)
+{
+	uint32_t sel;
+
+	sel = atomic_cas_32_ni(cl-cl_sel, cl-cl_sel, ocl-cl_sel);
+	pci_conf_select(ocl-cl_sel);
+	if (ocl-cl_cpuno != cl-cl_cpuno)
+		atomic_cas_32(cl-cl_cpuno, cl-cl_cpuno, ocl-cl_cpuno);
+	kpreempt_enable();
+}
+
 static uint32_t
 pci_conf_selector(pcitag_t tag, int reg)
 {
@@ -277,16 +333,16 @@
 }
 
 static void
-pci_conf_select(uint32_t addr)
+pci_conf_select(uint32_t sel)
 {
 	pcitag_t tag;
 
 	switch (pci_mode) {
 	case 1:
-		outl(PCI_MODE1_ADDRESS_REG, addr);
+		outl(PCI_MODE1_ADDRESS_REG, sel);
 		return;
 	case 2:
-		tag.mode1 = addr;
+		tag.mode1 = sel;
 		outb(PCI_MODE2_ENABLE_REG, tag.mode2.enable);
 		if (tag.mode2.enable != 0)
 			outb(PCI_MODE2_FORWARD_REG, tag.mode2.forward);
@@ -417,7 +473,7 @@
 int reg)
 {
 	pcireg_t data;
-	int s;
+	struct pci_conf_lock ocl;
 
 	KASSERT((reg  0x3) == 0);
 
@@ -437,11 +493,9 @@
 	}
 #endif
 
-	PCI_CONF_LOCK(s);
-	pci_conf_select(pci_conf_selector(tag, reg));
+	

CVS commit: src/sys

2010-04-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 28 19:17:05 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64: busfunc.S genassym.cf mainbus.c
src/sys/arch/i386/i386: apmbios.c busfunc.S genassym.cf ipkdb_glue.c
mainbus.c
src/sys/arch/i386/isa: isapnp_machdep.c
src/sys/arch/i386/pci: pceb.c pcibios.c pcmb.c
src/sys/arch/i386/pnpbios: pnpbios.c
src/sys/arch/i386/xbox: xbox.c xboxfb.c
src/sys/arch/x86/include: bus.h
src/sys/arch/x86/pci: pcib.c
src/sys/arch/x86/x86: acpi_machdep.c bus_space.c consinit.c
genfb_machdep.c
src/sys/arch/xen/x86: consinit.c mainbus.c
src/sys/arch/xen/xen: hypervisor.c xpci_xenbus.c
src/sys/compat/ndis: nbcompat.h
src/sys/dev/if_ndis: if_ndis_pci.c
src/sys/dev/pci: puccn.c

Log Message:
On x86, change the bus_space_tag_t to a pointer to a struct
bus_space_tag.  For now, bus_space_tag's only member is
bst_type, the type of space, which is either X86_BUS_SPACE_IO
or X86_BUS_SPACE_MEM.  In the future, new bus_space_tag members
will refer to override-functions installed by a new function,
bus_space_tag_create(9).

Add pointers to constant struct bus_space_tag, x86_bus_space_io and
x86_bus_space_mem.  Use them to replace most uses of X86_BUS_SPACE_IO
and X86_BUS_SPACE_MEM.

Add an x86-specific bus_space_is_equal(9) implementation that compares
the two tags' bst_type.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/amd64/busfunc.S
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/amd64/mainbus.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/i386/apmbios.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/i386/busfunc.S
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/i386/ipkdb_glue.c
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/i386/i386/mainbus.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/isa/isapnp_machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/pci/pceb.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/i386/pci/pcibios.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/pci/pcmb.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/i386/pnpbios/pnpbios.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/xbox/xbox.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/xbox/xboxfb.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/include/bus.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/pci/pcib.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/x86/x86/acpi_machdep.c \
src/sys/arch/x86/x86/bus_space.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/x86/consinit.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/x86/consinit.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/x86/mainbus.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/xen/xen/xpci_xenbus.c
cvs rdiff -u -r1.12 -r1.13 src/sys/compat/ndis/nbcompat.h
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/if_ndis/if_ndis_pci.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/puccn.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/amd64/amd64/busfunc.S
diff -u src/sys/arch/amd64/amd64/busfunc.S:1.7 src/sys/arch/amd64/amd64/busfunc.S:1.8
--- src/sys/arch/amd64/amd64/busfunc.S:1.7	Sun May 25 15:56:12 2008
+++ src/sys/arch/amd64/amd64/busfunc.S	Wed Apr 28 19:17:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: busfunc.S,v 1.7 2008/05/25 15:56:12 chs Exp $	*/
+/*	$NetBSD: busfunc.S,v 1.8 2010/04/28 19:17:03 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 ENTRY(bus_space_read_1)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, BST_TYPE(%rdi)
 	je	1f
 	movzbl	(%rdx), %eax
 	ret
@@ -67,7 +67,7 @@
  */
 ENTRY(bus_space_read_2)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, BST_TYPE(%rdi)
 	je	1f
 	movzwl	(%rdx), %eax
 	ret
@@ -82,7 +82,7 @@
  */
 ENTRY(bus_space_read_4)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, BST_TYPE(%rdi)
 	je	1f
 	movl	(%rdx), %eax
 	ret
@@ -96,7 +96,7 @@
  */
 ENTRY(bus_space_read_8)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, BST_TYPE(%rdi)
 	je	.Ldopanic
 	movq	(%rdx), %rax
 	ret
@@ -112,7 +112,7 @@
  */
 ENTRY(bus_space_write_1)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, BST_TYPE(%rdi)
 	je	1f
 	movb	%cl, (%rdx)
 	ret
@@ -127,7 +127,7 @@
  */
 ENTRY(bus_space_write_2)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, BST_TYPE(%rdi)
 	je	1f
 	movw	%cx, (%rdx)
 	ret
@@ -142,7 +142,7 @@
  */
 ENTRY(bus_space_write_4)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, BST_TYPE(%rdi)
 	je	1f
 	movl	%ecx, (%rdx)
 	ret
@@ -157,7 +157,7 @@
  */
 ENTRY(bus_space_write_8)
 	addq	%rsi, %rdx
-	testl	%edi, %edi
+	cmpl	$X86_BUS_SPACE_IO, 

CVS commit: src/sys/sys

2010-04-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 28 19:51:16 UTC 2010

Modified Files:
src/sys/sys: bus_proto.h

Log Message:
Cosmetic: delete whitespace at end of line.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/bus_proto.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/sys/bus_proto.h
diff -u src/sys/sys/bus_proto.h:1.3 src/sys/sys/bus_proto.h:1.4
--- src/sys/sys/bus_proto.h:1.3	Sat Sep 19 16:34:07 2009
+++ src/sys/sys/bus_proto.h	Wed Apr 28 19:51:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_proto.h,v 1.3 2009/09/19 16:34:07 pooka Exp $	*/
+/*	$NetBSD: bus_proto.h,v 1.4 2010/04/28 19:51:16 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001, 2007 The NetBSD Foundation, Inc.
@@ -320,5 +320,5 @@
 int	bus_dmatag_subregion(bus_dma_tag_t, bus_addr_t, bus_addr_t,
 			 bus_dma_tag_t *, int);
 void	bus_dmatag_destroy(bus_dma_tag_t);
-   
+
 #endif	/* _SYS_BUS_PROTO_H_ */



CVS commit: src/sys/arch/amd64

2010-04-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 28 20:22:46 UTC 2010

Modified Files:
src/sys/arch/amd64: Makefile

Log Message:
Fix 'tags' target.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/Makefile

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

Modified files:

Index: src/sys/arch/amd64/Makefile
diff -u src/sys/arch/amd64/Makefile:1.5 src/sys/arch/amd64/Makefile:1.6
--- src/sys/arch/amd64/Makefile:1.5	Sun Oct 26 02:14:59 2008
+++ src/sys/arch/amd64/Makefile	Wed Apr 28 20:22:46 2010
@@ -1,13 +1,11 @@
-#	$NetBSD: Makefile,v 1.5 2008/10/26 02:14:59 mrg Exp $
+#	$NetBSD: Makefile,v 1.6 2010/04/28 20:22:46 dyoung Exp $
 
 # Makefile for amd64 tags file and boot blocks
 
 TAMD64=		${SYSDIR}/arch/amd64/tags
 SAMD64=		${SYSDIR}/arch/amd64/amd64/*.[ch] \
-		${SYSDIR}/arch/amd64/include/*.h \
-		${SYSDIR}/arch/amd64/isa/*.[ch] \
-		${SYSDIR}/arch/amd64/pci/*.[ch]
-AAMD64=		${SYSDIR}/arch/amd64/amd64/*.s ${SYSDIR}/arch/amd64/isa/*.s
+		${SYSDIR}/arch/amd64/include/*.h
+AAMD64=		${SYSDIR}/arch/amd64/amd64/*.S
 
 # Directories in which to place tags links
 DAMD64=		amd64 isa include pci
@@ -15,8 +13,11 @@
 .include ../../kern/Make.tags.inc
 
 tags:
-	rm -f ${TAMD64}
-	-echo ${SAMD64} ${COMM} | xargs ctags -wadtf ${TAMD64}
+	-rm -f ${TAMD64}
+	-echo ${SAMD64} | xargs ctags -wadtf ${TAMD64}
+	-find -H ${SYSDIR}/external/intel-public/acpica/dist/ -name '*.[ch]' | \
+	sort -t / -u | xargs ctags -wadtf ${TAMD64}
+	-${FINDCOMM} | xargs ctags -wadtf ${TAMD64}
 	egrep ^ENTRY(.*)|^ALTENTRY(.*) ${AAMD64} | \
 	${TOOL_SED} -e \
 		s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/; \



CVS commit: src/sys/arch/x86/x86

2010-04-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 28 20:27:36 UTC 2010

Modified Files:
src/sys/arch/x86/x86: bus_space.c

Log Message:
#include sys/bus.h instead of machine/bus.h here to get all of the
MI prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/x86/bus_space.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/x86/x86/bus_space.c
diff -u src/sys/arch/x86/x86/bus_space.c:1.27 src/sys/arch/x86/x86/bus_space.c:1.28
--- src/sys/arch/x86/x86/bus_space.c:1.27	Wed Apr 28 19:17:04 2010
+++ src/sys/arch/x86/x86/bus_space.c	Wed Apr 28 20:27:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.27 2010/04/28 19:17:04 dyoung Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.28 2010/04/28 20:27:36 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.27 2010/04/28 19:17:04 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.28 2010/04/28 20:27:36 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -42,7 +42,7 @@
 
 #include dev/isa/isareg.h
 
-#include machine/bus.h
+#include sys/bus.h
 #include machine/pio.h
 #include machine/isa_machdep.h
 



CVS commit: src/sys

2010-04-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 28 20:33:52 UTC 2010

Modified Files:
src/sys/dev/pci: pcivar.h
src/sys/kern: kern_stub.c

Log Message:
Add data types, function prototypes, and stub implementations
for pci_chipset_tag_create() and pci_chipset_tag_destroy().  On
architectures that support it, an MI PCI bus driver can override the
architecture's default pci(9) and pci_intr(9) implementation.

Coming up next: documentation.
After that: x86 implementation.
Last but not least: make cbb(4) use MI PCI overrides.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/pcivar.h
cvs rdiff -u -r1.27 -r1.28 src/sys/kern/kern_stub.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/pcivar.h
diff -u src/sys/dev/pci/pcivar.h:1.85 src/sys/dev/pci/pcivar.h:1.86
--- src/sys/dev/pci/pcivar.h:1.85	Fri Mar 12 21:55:05 2010
+++ src/sys/dev/pci/pcivar.h	Wed Apr 28 20:33:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcivar.h,v 1.85 2010/03/12 21:55:05 matt Exp $	*/
+/*	$NetBSD: pcivar.h,v 1.86 2010/04/28 20:33:52 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -59,6 +59,37 @@
  */
 #include machine/pci_machdep.h
 
+enum pci_override_idx {
+	  PCI_OVERRIDE_CONF_READ		= __BIT(0)
+	, PCI_OVERRIDE_CONF_WRITE		= __BIT(1)
+	, PCI_OVERRIDE_INTR_MAP			= __BIT(2)
+	, PCI_OVERRIDE_INTR_STRING		= __BIT(3)
+	, PCI_OVERRIDE_INTR_EVCNT		= __BIT(4)
+	, PCI_OVERRIDE_INTR_ESTABLISH		= __BIT(5)
+	, PCI_OVERRIDE_INTR_DISESTABLISH	= __BIT(6)
+	, PCI_OVERRIDE_MAKE_TAG			= __BIT(7)
+	, PCI_OVERRIDE_DECOMPOSE_TAG		= __BIT(8)
+};
+
+/* Only add new fields to the end of this structure! */
+struct pci_overrides {
+	pcireg_t (*ov_conf_read)(void *, pci_chipset_tag_t, pcitag_t, int);
+	void (*ov_conf_write)(void *, pci_chipset_tag_t, pcitag_t, int,
+	pcireg_t);
+	int (*ov_intr_map)(void *, struct pci_attach_args *,
+	   pci_intr_handle_t *);
+	const char *(*ov_intr_string)(void *, pci_chipset_tag_t,
+	pci_intr_handle_t);
+	const struct evcnt *(*ov_intr_evcnt)(void *, pci_chipset_tag_t,
+	pci_intr_handle_t);
+	void *(*ov_intr_establish)(void *, pci_chipset_tag_t, pci_intr_handle_t,
+	int, int (*)(void *), void *);
+	void (*ov_intr_disestablish)(void *, pci_chipset_tag_t, void *);
+	pcitag_t (*ov_make_tag)(void *, pci_chipset_tag_t, int, int, int);
+	void (*ov_decompose_tag)(void *, pci_chipset_tag_t, pcitag_t,
+	int *, int *, int *);
+};
+
 /*
  * PCI bus attach arguments.
  */
@@ -260,6 +291,10 @@
 int	pci_activate(pci_chipset_tag_t, pcitag_t, device_t,
 int (*)(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t));
 int	pci_activate_null(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t);
+int	pci_chipset_tag_create(pci_chipset_tag_t, uint64_t,
+	   const struct pci_overrides *,
+	   void *, pci_chipset_tag_t *);
+void	pci_chipset_tag_destroy(pci_chipset_tag_t);
 
 /*
  * Device abstraction for inheritance by elanpci(4), for example.

Index: src/sys/kern/kern_stub.c
diff -u src/sys/kern/kern_stub.c:1.27 src/sys/kern/kern_stub.c:1.28
--- src/sys/kern/kern_stub.c:1.27	Mon Apr 26 22:58:53 2010
+++ src/sys/kern/kern_stub.c	Wed Apr 28 20:33:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $	*/
+/*	$NetBSD: kern_stub.c,v 1.28 2010/04/28 20:33:52 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_stub.c,v 1.28 2010/04/28 20:33:52 dyoung Exp $);
 
 #include opt_ptrace.h
 #include opt_ktrace.h
@@ -125,6 +125,8 @@
 __weak_alias(spldebug_start, voidop);
 __weak_alias(spldebug_stop, voidop);
 __weak_alias(machdep_init,nullop);
+__weak_alias(pci_chipset_tag_create, eopnotsupp);
+__weak_alias(pci_chipset_tag_destroy, voidop);
 __weak_alias(bus_space_tag_create, eopnotsupp);
 __weak_alias(bus_space_tag_destroy, voidop);
 __weak_alias(bus_space_is_equal, default_bus_space_is_equal);



<    1   2   3   4   5   6   7   8   9   >