CVS commit: src/sys/uvm

2009-04-23 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Thu Apr 23 06:22:01 UTC 2009

Modified Files:
src/sys/uvm: uvm_pmap.h

Log Message:
use top-most bits for PMAP_MD_MASK instead something in the middle.
per request from christos@


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/uvm/uvm_pmap.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/uvm/uvm_pmap.h
diff -u src/sys/uvm/uvm_pmap.h:1.27 src/sys/uvm/uvm_pmap.h:1.28
--- src/sys/uvm/uvm_pmap.h:1.27	Tue Apr 21 21:30:01 2009
+++ src/sys/uvm/uvm_pmap.h	Thu Apr 23 06:22:00 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pmap.h,v 1.27 2009/04/21 21:30:01 cegger Exp $	*/
+/*	$NetBSD: uvm_pmap.h,v 1.28 2009/04/23 06:22:00 cegger Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -100,7 +100,7 @@
 #define	PMAP_WIRED	0x0010	/* wired mapping */
 #define	PMAP_CANFAIL	0x0020	/* can fail if resource shortage */
 
-#define	PMAP_MD_MASK	0xff00	/* Machine-dependent bits */
+#define	PMAP_MD_MASK	0xff00	/* Machine-dependent bits */
 
 /*
  * Flags passed to pmap_kenter_pa().  Note the bottom 3 bits are VM_PROT_*



CVS commit: src/distrib/sets

2009-04-23 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Apr 23 09:30:56 UTC 2009

Modified Files:
src/distrib/sets: checkflist

Log Message:
Simplify the way EXCLUDE_REGEXP is built.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/distrib/sets/checkflist

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/checkflist
diff -u src/distrib/sets/checkflist:1.33 src/distrib/sets/checkflist:1.34
--- src/distrib/sets/checkflist:1.33	Mon Sep 11 22:16:10 2006
+++ src/distrib/sets/checkflist	Thu Apr 23 09:30:56 2009
@@ -1,6 +1,6 @@
 #! /bin/sh --
 #
-#	$NetBSD: checkflist,v 1.33 2006/09/11 22:16:10 dbj Exp $
+#	$NetBSD: checkflist,v 1.34 2009/04/23 09:30:56 apb Exp $
 #
 # Verify output of makeflist against contents of ${DESTDIR} and ${metalog}.
 
@@ -71,17 +71,12 @@
 # Exceptions to flist checking (all begin with ./):
 #
 # * ignore var/db/syspkg and its contents
-# * ignore ${metalog}
-# * ignore METALOG
+# * ignore METALOG and METALOG.*
 # * ignore etc/mtree/set.*
 #
 IGNORE_REGEXP=^\./var/db/syspkg(\$|/)
-if [ -n ${metalog} ]; then
-	ml=${metalog#${DESTDIR}/}
-	ml2=METALOG
-	IGNORE_REGEXP=${IGNORE_REGEXP}|^\./${ml}\$|^\./${ml2}\$
-	IGNORE_REGEXP=${IGNORE_REGEXP}|^\./etc/mtree/set\.[a-z]*\$
-fi
+IGNORE_REGEXP=${IGNORE_REGEXP}|^\./METALOG(\..*)?\$
+IGNORE_REGEXP=${IGNORE_REGEXP}|^\./etc/mtree/set\.[a-z]*\$
 
 #
 # Here would be a good place to add custom exceptions to flist checking.
@@ -93,6 +88,8 @@
 # * ${SDIR}/flist: files mentioned in flist;
 # * ${SDIR}/mlist: files mentioned in metalog;
 #
+# All three lists are filtered against ${IGNORE_REGEXP}.
+#
 ( cd ${DESTDIR}  ${FIND} ${origin} \
 	\( -type d -o -type f -o -type l \) -print ) \
 	| ${SORT} -u | ${EGREP} -v -e ${IGNORE_REGEXP} ${SDIR}/files



CVS commit: src/distrib/sets

2009-04-23 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Apr 23 09:37:03 UTC 2009

Modified Files:
src/distrib/sets: Makefile

Log Message:
Clean up the handling of METALOG.sanitised:

* Don't change METALOG in place while creating METALOG.sanitised in the
  sanitise_METALOG target.  This makes it easier to manually inspect
  METALOG to find the order in which lines were added during a build.

* Add a clean_METALOG target, to be invoked from src/Makefile early in
  the build, to prevent unbounded growth of METALOG during multiple
  MKUPDATE builds.

* Remove the old hack of incorporating etc/mtree/NetBSD.dist into
  METALOG.sanitised.  It was needed only during a short transition
  period when people might have done MKUPDATE builds starting from
  existing DESTDIR and OBJDIR trees that had been created before
  revision 1.317 of src/etc/Makefile.

* Since etc/mtree/NetBSD.dist is no longer added, there's will not
  be any optional lines, so there's no need to filter them from
  METALOG.sanitised.

* There's no need for two different METALOG.unpriv and
  METALOG.sanitised.unpriv variables; combine them into a single
  METALOG.unpriv variable whose value is -M ${METALOG}.sanitised.

* Reorder some lines in the Makefile, to bring related targets,
  variables and comments together.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/distrib/sets/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/Makefile
diff -u src/distrib/sets/Makefile:1.66 src/distrib/sets/Makefile:1.67
--- src/distrib/sets/Makefile:1.66	Sat Apr 11 15:09:32 2009
+++ src/distrib/sets/Makefile	Thu Apr 23 09:37:03 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.66 2009/04/11 15:09:32 apb Exp $
+#	$NetBSD: Makefile,v 1.67 2009/04/23 09:37:03 apb Exp $
 
 # The `all' target must appear before bsd.own.mk is pulled in.
 all:
@@ -60,54 +60,80 @@
 print_toolchain_missing: .PHONY
 	@echo ${TOOLCHAIN_MISSING}
 
-# This target has debugging value only, really.
-makeflist: .PHONY .PRECIOUS check_DESTDIR
-	${SETSCMD} ./makeflist ${MAKEFLIST_FLAGS}
-
 #
-# SET BUILDING TARGETS
+# METALOG MANIPULATION TARGETS
+#
+# METALOG is the name of a metadata log file, and is set in bsd.own.mk
+# if MKUNPRIVED is not no.
+#
+# METALOG.unpriv is a command line option passed to various scripts;
+# it is either blank or -M ${METALOG}.sanitised, depending on the
+# MKUNPRIVED flag.
+#
+# The sanitise_METALOG target creates METALOG.sanitised from METALOG,
+# without modifying METALOG itself.  METALOG.sanitised is sorted, and
+# has duplicates merged.  This is used near the end of a build, after
+# build products have been installed in DESTDIR and corresponding lines
+# have been added to METALOG, but before METALOG.sanitised is used in
+# the creation of sets in RELEASEDIR.
+#
+# The clean_METALOG either deletes METALOG or replaces METALOG with
+# a sanitised version of itself, depending on the MKUPDATE flag, and
+# deletes old METALOG.* files.  This is intended to be used at the start
+# of a build, to ensure that repeated MKUPDATE builds do not cause
+# unbounded growth of METALOG.
 #
-
-TARDIR=		${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
-SOURCETARDIR=	${RELEASEDIR}/source/sets
 
 .if ${MKUNPRIVED} == no
 METALOG.unpriv=
-METALOG.sanitised.unpriv=
-.else
-METALOG.unpriv=	-M ${METALOG}
-METALOG.sanitised= ${METALOG}.sanitised
-METALOG.sanitised.unpriv= -M ${METALOG.sanitised}
-.endif
-
-.if ${MKUNPRIVED} == no
 sanitise_METALOG: .PHONY
 	@true
-.else
-sanitise_METALOG: .PHONY ${METALOG.sanitised}
-${METALOG.sanitised}: ${METALOG}
-	( cat ${NETBSDSRCDIR}/etc/mtree/NetBSD.dist ; \
-		echo '/unset all' ; \
-		cat ${METALOG} ) \
-	| ${TOOL_MTREE} -CS -k all -N ${NETBSDSRCDIR}/etc  ${METALOG}.new  \
-		( rm -f ${METALOG} ; \
-		mv ${METALOG}.new ${METALOG} )
-	cat ${METALOG} | ${GREP} -v  optional  ${.TARGET}
-.endif
+clean_METALOG: .PHONY
+	@true
+.else	# MKUNPRIVED
+METALOG.unpriv= -M ${METALOG}.sanitised
+sanitise_METALOG: .PHONY ${METALOG}.sanitised
+${METALOG}.sanitised: ${METALOG}
+	${TOOL_MTREE} -CS -k all -N ${NETBSDSRCDIR}/etc ${METALOG} \
+	${METALOG}.new
+	mv ${METALOG}.new ${METALOG}.sanitised
+.if ${MKUPDATE} == no || !exists(${METALOG})
+clean_METALOG: .PHONY
+	rm -f ${METALOG} ${METALOG}.*
+.else	# MKUPDATE
+clean_METALOG: .PHONY ${METALOG}.sanitised
+	mv ${METALOG}.sanitised ${METALOG}
+	rm -f ${METALOG}.*
+.endif	# MKUPDATE
+.endif	# MKUNPRIVED
 
-.if defined(DESTDIR)  ${DESTDIR} != 
-checkflist_if_DESTDIR: checkflist
-.else
-checkflist_if_DESTDIR:
-.endif
+#
+# FILE LIST TARGETS
+#
+
+# This target has debugging value only, really.
+makeflist: .PHONY .PRECIOUS check_DESTDIR
+	${SETSCMD} ./makeflist ${MAKEFLIST_FLAGS}
 
 checkflist: .PRECIOUS .PHONY check_DESTDIR sanitise_METALOG
 	${SETSCMD} ${.CURDIR}/checkflist \
-	${MAKEFLIST_FLAGS} ${CHECKFLIST_FLAGS} ${METALOG.sanitised.unpriv}
+	${MAKEFLIST_FLAGS} 

CVS commit: src

2009-04-23 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Apr 23 09:43:49 UTC 2009

Modified Files:
src: Makefile

Log Message:
Make clean_METALOG in distrib/sets early in the build, to ensure that
the METALOG does not grow without bounds on multiple MKUPDATE builds.
(Previously, sanitise_METALOG in distrib/sets/Makefile used to do
something like this near the end of a build.)


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/Makefile

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.269 src/Makefile:1.270
--- src/Makefile:1.269	Wed Apr 15 10:18:34 2009
+++ src/Makefile	Thu Apr 23 09:43:49 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.269 2009/04/15 10:18:34 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.270 2009/04/23 09:43:49 apb Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -219,6 +219,7 @@
 .if ${MKOBJDIRS} != no
 BUILDTARGETS+=	obj
 .endif
+BUILDTARGETS+=	clean_METALOG
 .if !defined(NODISTRIBDIRS)
 BUILDTARGETS+=	do-distrib-dirs
 .endif
@@ -381,6 +382,12 @@
 	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
 .endif
 
+# Delete or sanitise a leftover METALOG from a previous build.
+clean_METALOG: .PHONY .MAKE
+.if ${MKUPDATE} != no
+	${MAKEDIRTARGET} distrib/sets clean_METALOG
+.endif
+
 do-distrib-dirs: .PHONY .MAKE
 .if !defined(DESTDIR) || ${DESTDIR} == 
 	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/



CVS commit: src/sys/dev/pci

2009-04-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 23 10:43:31 UTC 2009

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

Log Message:
remove obsolete code.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/pci/if_bge.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.162 src/sys/dev/pci/if_bge.c:1.163
--- src/sys/dev/pci/if_bge.c:1.162	Sun Apr 19 11:10:36 2009
+++ src/sys/dev/pci/if_bge.c	Thu Apr 23 10:43:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.162 2009/04/19 11:10:36 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.163 2009/04/23 10:43:31 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.162 2009/04/19 11:10:36 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.163 2009/04/23 10:43:31 msaitoh Exp $);
 
 #include bpfilter.h
 #include vlan.h
@@ -1520,7 +1520,6 @@
 static int
 bge_chipinit(struct bge_softc *sc)
 {
-	u_int32_t		cachesize;
 	int			i;
 	u_int32_t		dma_rw_ctl;
 
@@ -1654,57 +1653,6 @@
 		BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS |
 		BGE_MODECTL_TX_NO_PHDR_CSUM | BGE_MODECTL_RX_NO_PHDR_CSUM);
 
-	/* Get cache line size. */
-	cachesize = pci_conf_read(sc-sc_pc, sc-sc_pcitag, BGE_PCI_CACHESZ);
-
-	/*
-	 * Avoid violating PCI spec on certain chip revs.
-	 */
-	if (pci_conf_read(sc-sc_pc, sc-sc_pcitag, BGE_PCI_CMD) 
-	PCIM_CMD_MWIEN) {
-		switch(cachesize) {
-		case 1:
-			PCI_SETBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_DMA_RW_CTL,
-   BGE_PCI_WRITE_BNDRY_16BYTES);
-			break;
-		case 2:
-			PCI_SETBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_DMA_RW_CTL,
-   BGE_PCI_WRITE_BNDRY_32BYTES);
-			break;
-		case 4:
-			PCI_SETBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_DMA_RW_CTL,
-   BGE_PCI_WRITE_BNDRY_64BYTES);
-			break;
-		case 8:
-			PCI_SETBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_DMA_RW_CTL,
-   BGE_PCI_WRITE_BNDRY_128BYTES);
-			break;
-		case 16:
-			PCI_SETBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_DMA_RW_CTL,
-   BGE_PCI_WRITE_BNDRY_256BYTES);
-			break;
-		case 32:
-			PCI_SETBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_DMA_RW_CTL,
-   BGE_PCI_WRITE_BNDRY_512BYTES);
-			break;
-		case 64:
-			PCI_SETBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_DMA_RW_CTL,
-   BGE_PCI_WRITE_BNDRY_1024BYTES);
-			break;
-		default:
-		/* Disable PCI memory write and invalidate. */
-#if 0
-			if (bootverbose)
-aprint_error_dev(sc-bge_dev,
-cache line size %d not supported 
-disabling PCI MWI\n,
-#endif
-			PCI_CLRBIT(sc-sc_pc, sc-sc_pcitag, BGE_PCI_CMD,
-			PCIM_CMD_MWIEN);
-			break;
-		}
-	}
-
 	/*
 	 * Disable memory write invalidate.  Apparently it is not supported
 	 * properly by these devices.



CVS commit: src/sys/dev

2009-04-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 23 10:47:44 UTC 2009

Modified Files:
src/sys/dev/mii: brgphy.c
src/sys/dev/pci: if_bge.c if_bgereg.h
Added Files:
src/sys/dev/pci: if_bgevar.h

Log Message:
use proplib


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/pci/if_bgereg.h
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/if_bgevar.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/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.43 src/sys/dev/mii/brgphy.c:1.44
--- src/sys/dev/mii/brgphy.c:1.43	Sun Apr 19 11:10:36 2009
+++ src/sys/dev/mii/brgphy.c	Thu Apr 23 10:47:43 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.43 2009/04/19 11:10:36 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.44 2009/04/23 10:47:43 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: brgphy.c,v 1.43 2009/04/19 11:10:36 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: brgphy.c,v 1.44 2009/04/23 10:47:43 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -75,6 +75,7 @@
 #include sys/device.h
 #include sys/socket.h
 #include sys/errno.h
+#include prop/proplib.h
 
 #include net/if.h
 #include net/if_media.h
@@ -82,7 +83,6 @@
 #include dev/mii/mii.h
 #include dev/mii/miivar.h
 #include dev/mii/miidevs.h
-
 #include dev/mii/brgphyreg.h
 
 #include dev/pci/if_bgereg.h
@@ -93,7 +93,15 @@
 static int	brgphymatch(device_t, cfdata_t, void *);
 static void	brgphyattach(device_t, device_t, void *);
 
-CFATTACH_DECL3_NEW(brgphy, sizeof(struct mii_softc),
+struct brgphy_softc {
+	struct mii_softc sc_mii;
+	int sc_isbge;
+	int sc_isbnx;
+	int sc_bge_flags;
+	int sc_bnx_flags;
+};
+
+CFATTACH_DECL3_NEW(brgphy, sizeof(struct brgphy_softc),
 brgphymatch, brgphyattach, mii_phy_detach, mii_phy_activate, NULL, NULL,
 DVF_DETACH_SHUTDOWN);
 
@@ -193,10 +201,13 @@
 static void
 brgphyattach(struct device *parent, struct device *self, void *aux)
 {
-	struct mii_softc *sc = device_private(self);
+	struct brgphy_softc *bsc = device_private(self);
+	struct mii_softc *sc = bsc-sc_mii;
 	struct mii_attach_args *ma = aux;
 	struct mii_data *mii = ma-mii_data;
 	const struct mii_phydesc *mpd;
+	prop_dictionary_t dict;
+	const char *devname;
 
 	mpd = mii_phy_match(ma, brgphys);
 	aprint_naive(: Media interface\n);
@@ -226,6 +237,20 @@
 	else
 		mii_phy_add_media(sc);
 	aprint_normal(\n);
+
+	parent = device_parent(sc-mii_dev);
+	devname = parent-dv_cfdriver-cd_name;
+	if (strcmp(devname, bge) == 0) {
+		bsc-sc_isbge = 1;
+		dict = device_properties(parent);
+		prop_dictionary_get_uint32(dict, phyflags,
+		bsc-sc_bge_flags);
+	} else if (strcmp(devname, bnx) == 0) {
+		bsc-sc_isbnx = 1;
+		dict = device_properties(parent);
+		prop_dictionary_get_uint32(dict, phyflags,
+		bsc-sc_bnx_flags);
+	}
 }
 
 static int
@@ -476,13 +501,7 @@
 static void
 brgphy_reset(struct mii_softc *sc)
 {
-	struct bge_softc *bge_sc = NULL;
-#if 0
-	struct bnx_softc *bnx_sc = NULL;
-#endif
-	const char *devname;
-
-	devname = device_parent(sc-mii_dev)-dv_cfdriver-cd_name;
+	struct brgphy_softc *bsc = (void *)sc;
 
 	mii_phy_reset(sc);
 
@@ -506,22 +525,21 @@
 	}
 
 	/* Handle any bge (NetXtreme/NetLink) workarounds. */
-	if (strcmp(devname, bge) == 0) {
+	if (bsc-sc_isbge != 0) {
 		if (!(sc-mii_flags  MIIF_HAVEFIBER)) {
-			bge_sc = sc-mii_pdata-mii_ifp-if_softc;
 
-			if (bge_sc-bge_flags  BGE_PHY_ADC_BUG)
+			if (bsc-sc_bge_flags  BGE_PHY_ADC_BUG)
 brgphy_adc_bug(sc);
-			if (bge_sc-bge_flags  BGE_PHY_5704_A0_BUG)
+			if (bsc-sc_bge_flags  BGE_PHY_5704_A0_BUG)
 brgphy_5704_a0_bug(sc);
-			if (bge_sc-bge_flags  BGE_PHY_BER_BUG)
+			if (bsc-sc_bge_flags  BGE_PHY_BER_BUG)
 brgphy_ber_bug(sc);
-			else if (bge_sc-bge_flags  BGE_PHY_JITTER_BUG) {
+			else if (bsc-sc_bge_flags  BGE_PHY_JITTER_BUG) {
 PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x0c00);
 PHY_WRITE(sc, BRGPHY_MII_DSP_ADDR_REG,
 0x000a);
 
-if (bge_sc-bge_flags  BGE_PHY_ADJUST_TRIM) {
+if (bsc-sc_bge_flags  BGE_PHY_ADJUST_TRIM) {
 	PHY_WRITE(sc, BRGPHY_MII_DSP_RW_PORT,
 	0x110b);
 	PHY_WRITE(sc, BRGPHY_TEST1,
@@ -533,12 +551,12 @@
 
 PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x0400);
 			}
-			if (bge_sc-bge_flags  BGE_PHY_CRC_BUG)
+			if (bsc-sc_bge_flags  BGE_PHY_CRC_BUG)
 brgphy_crc_bug(sc);
 
 #if 0
 			/* Set Jumbo frame settings in the PHY. */
-			if (bge_sc-bge_flags  BGE_JUMBO_CAP)
+			if (bsc-sc_bge_flags  BGE_JUMBO_CAP)
 brgphy_jumbo_settings(sc);
 #endif
 
@@ -548,11 +566,11 @@
 
 #if 0
 			/* Enable ether...@wirespeed */
-			if (!(bge_sc-bge_flags  BGE_NO_ETH_WIRE_SPEED))
+			if (!(bsc-sc_bge_flags  BGE_NO_ETH_WIRE_SPEED))
 brgphy_eth_wirespeed(sc);
 
 			/* Enable 

CVS commit: src/distrib/landisk

2009-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 23 14:16:09 UTC 2009

Modified Files:
src/distrib/landisk: Makefile

Log Message:
Build ramdisk based INSTALL kernel and bootstrap bootable install image file
and install them into releasedir.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/landisk/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/landisk/Makefile
diff -u src/distrib/landisk/Makefile:1.1 src/distrib/landisk/Makefile:1.2
--- src/distrib/landisk/Makefile:1.1	Mon Apr 14 17:24:56 2008
+++ src/distrib/landisk/Makefile	Thu Apr 23 14:16:09 2009
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.1 2008/04/14 17:24:56 skrll Exp $
+#	$NetBSD: Makefile,v 1.2 2009/04/23 14:16:09 tsutsui Exp $
 
-#SUBDIR= 	ramdisk .WAIT instkernel .WAIT bootfs
+SUBDIR= 	ramdisk .WAIT instkernel .WAIT bootfs
 
 TARGETS+=	release
 



CVS commit: src/etc/etc.landisk

2009-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 23 14:38:58 UTC 2009

Modified Files:
src/etc/etc.landisk: Makefile.inc

Log Message:
Create cksums for files in ${MD_INSTALLATION_DIRS}.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/etc.landisk/Makefile.inc

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

Modified files:

Index: src/etc/etc.landisk/Makefile.inc
diff -u src/etc/etc.landisk/Makefile.inc:1.2 src/etc/etc.landisk/Makefile.inc:1.3
--- src/etc/etc.landisk/Makefile.inc:1.2	Wed May  2 08:02:00 2007
+++ src/etc/etc.landisk/Makefile.inc	Thu Apr 23 14:38:58 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.2 2007/05/02 08:02:00 skrll Exp $
+# $NetBSD: Makefile.inc,v 1.3 2009/04/23 14:38:58 tsutsui Exp $
 #
 # etc.landisk/Makefile.inc -- landisk-specific etc Makefile targets
 #
@@ -9,3 +9,9 @@
 
 MD_INSTALLATION_DIRS=	installation/misc
 INSTALLATION_DIRS+=	${MD_INSTALLATION_DIRS}
+
+snap_md_post:
+	# compute checksums
+.for dir in ${MD_INSTALLATION_DIRS}
+	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} '*'
+.endfor



CVS commit: src/usr.bin/elf2ecoff

2009-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 23 14:49:32 UTC 2009

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

Log Message:
Fix -Wcast-qual and -Wsign-compare issues.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/elf2ecoff/elf2ecoff.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/elf2ecoff/elf2ecoff.c
diff -u src/usr.bin/elf2ecoff/elf2ecoff.c:1.22 src/usr.bin/elf2ecoff/elf2ecoff.c:1.23
--- src/usr.bin/elf2ecoff/elf2ecoff.c:1.22	Wed May 31 08:09:55 2006
+++ src/usr.bin/elf2ecoff/elf2ecoff.c	Thu Apr 23 14:49:32 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2ecoff.c,v 1.22 2006/05/31 08:09:55 simonb Exp $	*/
+/*	$NetBSD: elf2ecoff.c,v 1.23 2009/04/23 14:49:32 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -79,8 +79,8 @@
 int phcmp(Elf32_Phdr * h1, Elf32_Phdr * h2);
 
 
-char   *saveRead(int file, off_t offset, off_t len, char *name);
-voidsafewrite(int outfile, void *buf, off_t len, const char *msg);
+char   *saveRead(int file, off_t offset, off_t len, const char *name);
+voidsafewrite(int outfile, const void *buf, off_t len, const char *msg);
 voidcopy(int, int, off_t, off_t);
 voidcombine(struct sect * base, struct sect * new, int paddable);
 voidtranslate_syms(struct elf_syms *, struct ecoff_syms *);
@@ -123,7 +123,8 @@
 	Elf32_Shdr *sh;
 	char   *shstrtab;
 	int strtabix, symtabix;
-	int i, pad;
+	size_t	i;
+	int pad;
 	struct sect text, data, bss;	/* a.out-compatible sections */
 	struct sect rdata, sdata, sbss;	/* ECOFF-only sections */
 
@@ -490,7 +491,7 @@
 	off_t   offset, size;
 {
 	charibuf[4096];
-	int remaining, cur, count;
+	size_t  remaining, cur, count;
 
 	/* Go to the start of the ELF symbol table... */
 	if (lseek(in, offset, SEEK_SET)  0) {
@@ -550,7 +551,7 @@
 
 char
*
-saveRead(int file, off_t offset, off_t len, char *name)
+saveRead(int file, off_t offset, off_t len, const char *name)
 {
 	char   *tmp;
 	int count;
@@ -573,10 +574,10 @@
 }
 
 void
-safewrite(int outfile, void *buf, off_t len, const char *msg)
+safewrite(int outfile, const void *buf, off_t len, const char *msg)
 {
 	int written;
-	written = write(outfile, (char *) buf, len);
+	written = write(outfile, buf, len);
 	if (written != len) {
 		fprintf(stderr, msg, strerror(errno));
 		exit(1);
@@ -859,7 +860,7 @@
 void
 bswap32_region(int32_t* p, int len)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i  len / sizeof(int32_t); i++, p++)
 		*p = bswap32(*p);



CVS commit: src/sys/arch/pmax/stand

2009-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 23 16:35:20 UTC 2009

Modified Files:
src/sys/arch/pmax/stand: Makefile.booters

Log Message:
Use bsd.klinks.mk to create machine and ${MACHINE_ARCH} symlinks.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/pmax/stand/Makefile.booters

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/pmax/stand/Makefile.booters
diff -u src/sys/arch/pmax/stand/Makefile.booters:1.49 src/sys/arch/pmax/stand/Makefile.booters:1.50
--- src/sys/arch/pmax/stand/Makefile.booters:1.49	Fri Apr  3 10:38:14 2009
+++ src/sys/arch/pmax/stand/Makefile.booters	Thu Apr 23 16:35:20 2009
@@ -1,19 +1,10 @@
-# $NetBSD: Makefile.booters,v 1.49 2009/04/03 10:38:14 tsutsui Exp $
+# $NetBSD: Makefile.booters,v 1.50 2009/04/23 16:35:20 tsutsui Exp $
 
 .include bsd.sys.mk		# for HOST_SH
 
 # $S must correspond to the top of the 'sys' tree
 S=	${.CURDIR}/../../../..
 
-.if !make(obj)  !make(clean)  !make(cleandir)
-.BEGIN:
-	@[ -h machine ] || ln -s $S/arch/${MACHINE}/include machine
-	@[ -h pmax ] || ln -s $S/arch/${MACHINE}/include pmax
-	@[ -h mips ] || ln -s $S/arch/mips/include mips
-.NOPATH: machine pmax mips
-.endif
-CLEANFILES+= machine pmax mips
-
 BINMODE?=	444
 
 # XXX SHOULD NOT NEED TO DEFINE THESE!
@@ -111,7 +102,7 @@
 vers.c: ${.CURDIR}/version
 	${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version pmax
 
-${PROG}: machine mips pmax ${OBJS} ${LIBS}
+${PROG}: ${OBJS} ${LIBS}
 	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
 	${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS}
 	@${SIZE} ${PROG}
@@ -126,6 +117,7 @@
 	@echo done.
 .endif
 
+.include bsd.klinks.mk
 .include bsd.prog.mk
 
 CLEANFILES+=	${PROG}.map



CVS commit: src/sys/arch/pmax/stand

2009-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 23 16:37:44 UTC 2009

Modified Files:
src/sys/arch/pmax/stand: Makefile.booters

Log Message:
Make sure to remove all generated files on cleandir.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/pmax/stand/Makefile.booters

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/pmax/stand/Makefile.booters
diff -u src/sys/arch/pmax/stand/Makefile.booters:1.50 src/sys/arch/pmax/stand/Makefile.booters:1.51
--- src/sys/arch/pmax/stand/Makefile.booters:1.50	Thu Apr 23 16:35:20 2009
+++ src/sys/arch/pmax/stand/Makefile.booters	Thu Apr 23 16:37:44 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.booters,v 1.50 2009/04/23 16:35:20 tsutsui Exp $
+# $NetBSD: Makefile.booters,v 1.51 2009/04/23 16:37:44 tsutsui Exp $
 
 .include bsd.sys.mk		# for HOST_SH
 
@@ -120,7 +120,7 @@
 .include bsd.klinks.mk
 .include bsd.prog.mk
 
-CLEANFILES+=	${PROG}.map
+CLEANFILES+=	${PROG}.map ${PROG}.elf
 
 cleandir distclean: cleanlibdir
 



CVS commit: src/sys/netinet

2009-04-23 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Thu Apr 23 16:42:56 UTC 2009

Modified Files:
src/sys/netinet: in_pcb.c

Log Message:
Some changes to in_pcbbind():

  - Extract guts to in_pcbbind_{addr,port}()

  - Put the port auto-assignment logic in in_pcbsetport(), which looks very
similar to in6_pcbsetport()

  - Fix a bug where sin was passed to kauth(9) without being set to
anything

No objections on tech-...@.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/netinet/in_pcb.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/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.131 src/sys/netinet/in_pcb.c:1.132
--- src/sys/netinet/in_pcb.c:1.131	Tue Apr 14 21:25:20 2009
+++ src/sys/netinet/in_pcb.c	Thu Apr 23 16:42:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.131 2009/04/14 21:25:20 elad Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.132 2009/04/23 16:42:56 elad Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in_pcb.c,v 1.131 2009/04/14 21:25:20 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: in_pcb.c,v 1.132 2009/04/23 16:42:56 elad Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -111,6 +111,7 @@
 #include sys/proc.h
 #include sys/kauth.h
 #include sys/uidinfo.h
+#include sys/domain.h
 
 #include net/if.h
 #include net/route.h
@@ -222,35 +223,92 @@
 	return (0);
 }
 
-int
-in_pcbbind(void *v, struct mbuf *nam, struct lwp *l)
+static int
+in_pcbsetport(struct in_addr *laddr, struct inpcb *inp,
+struct sockaddr_in *sin, kauth_cred_t cred)
 {
-	struct in_ifaddr *ia = NULL;
-	struct inpcb *inp = v;
-	struct socket *so = inp-inp_socket;
 	struct inpcbtable *table = inp-inp_table;
-	struct sockaddr_in *sin = NULL; /* XXXGCC */
+	struct socket *so = inp-inp_socket;
+	int	   cnt;
+	u_int16_t  mymin, mymax;
+	u_int16_t *lastport;
 	u_int16_t lport = 0;
-	int wild = 0, reuseport = (so-so_options  SO_REUSEPORT);
-	kauth_cred_t cred = l-l_cred;
 
-	if (inp-inp_af != AF_INET)
-		return (EINVAL);
+	if (inp-inp_flags  INP_LOWPORT) {
+#ifndef IPNOPRIVPORTS
+		if (kauth_authorize_network(cred,
+		KAUTH_NETWORK_BIND,
+		KAUTH_REQ_NETWORK_BIND_PRIVPORT, so,
+		sin, NULL))
+			return (EACCES);
+#endif
+		mymin = lowportmin;
+		mymax = lowportmax;
+		lastport = table-inpt_lastlow;
+	} else {
+		mymin = anonportmin;
+		mymax = anonportmax;
+		lastport = table-inpt_lastport;
+	}
+	if (mymin  mymax) {	/* sanity check */
+		u_int16_t swp;
+
+		swp = mymin;
+		mymin = mymax;
+		mymax = swp;
+	}
+
+	lport = *lastport - 1;
+	for (cnt = mymax - mymin + 1; cnt; cnt--, lport--) {
+		if (lport  mymin || lport  mymax)
+			lport = mymax;
+		if (!in_pcblookup_port(table, inp-inp_laddr,
+		htons(lport), 1))
+			goto found;
+	}
+
+	return (EAGAIN);
+
+ found:
+	inp-inp_flags |= INP_ANONPORT;
+	*lastport = lport;
+	lport = htons(lport);
+	inp-inp_lport = lport;
+	in_pcbstate(inp, INP_BOUND);
 
-	if (TAILQ_FIRST(in_ifaddrhead) == 0)
-		return (EADDRNOTAVAIL);
-	if (inp-inp_lport || !in_nullhost(inp-inp_laddr))
-		return (EINVAL);
-	if ((so-so_options  (SO_REUSEADDR|SO_REUSEPORT)) == 0)
-		wild = 1;
-	if (nam == 0)
-		goto noname;
-	sin = mtod(nam, struct sockaddr_in *);
-	if (nam-m_len != sizeof (*sin))
-		return (EINVAL);
+	return (0);
+}
+
+static int
+in_pcbbind_addr(struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred)
+{
 	if (sin-sin_family != AF_INET)
 		return (EAFNOSUPPORT);
-	lport = sin-sin_port;
+
+	if (!in_nullhost(sin-sin_addr)) {
+		struct in_ifaddr *ia = NULL;
+
+		INADDR_TO_IA(sin-sin_addr, ia);
+		/* check for broadcast addresses */
+		if (ia == NULL)
+			ia = ifatoia(ifa_ifwithaddr(sintosa(sin)));
+		if (ia == NULL)
+			return (EADDRNOTAVAIL);
+	}
+
+	inp-inp_laddr = sin-sin_addr;
+
+	return (0);
+}
+
+static int
+in_pcbbind_port(struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred)
+{
+	struct inpcbtable *table = inp-inp_table;
+	struct socket *so = inp-inp_socket;
+	int reuseport = (so-so_options  SO_REUSEPORT);
+	int wild = 0;
+
 	if (IN_MULTICAST(sin-sin_addr.s_addr)) {
 		/*
 		 * Treat SO_REUSEADDR as SO_REUSEPORT for multicast;
@@ -261,23 +319,27 @@
 		 */
 		if (so-so_options  SO_REUSEADDR)
 			reuseport = SO_REUSEADDR|SO_REUSEPORT;
-	} else if (!in_nullhost(sin-sin_addr)) {
-		INADDR_TO_IA(sin-sin_addr, ia);
-		/* check for broadcast addresses */
-		if (ia == NULL)
-			ia = ifatoia(ifa_ifwithaddr(sintosa(sin)));
-		if (ia == NULL)
-			return (EADDRNOTAVAIL);
-	}
-	if (lport) {
+	} 
+
+	if (sin-sin_port == 0) {
+		int error;
+
+		error = in_pcbsetport(inp-inp_laddr, inp, sin, cred);
+		if (error)
+			return (error);
+	} else {
 		struct inpcb *t;
 #ifdef INET6
 		struct in6pcb *t6;
 		struct in6_addr mapped;
 #endif
+
+		if ((so-so_options  (SO_REUSEADDR|SO_REUSEPORT)) == 0)
+			wild = 1;
+
 #ifndef IPNOPRIVPORTS
 		/* GROSS */
-		if 

CVS commit: src/sys/netinet

2009-04-23 Thread Elad Efrat
Module Name:src
Committed By:   elad
Date:   Thu Apr 23 17:02:26 UTC 2009

Modified Files:
src/sys/netinet: in_pcb.c

Log Message:
- Make kauth(9) call logic match the one in netinet6/in6_pcb.c

- Indent a comment


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/netinet/in_pcb.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/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.132 src/sys/netinet/in_pcb.c:1.133
--- src/sys/netinet/in_pcb.c:1.132	Thu Apr 23 16:42:56 2009
+++ src/sys/netinet/in_pcb.c	Thu Apr 23 17:02:26 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.132 2009/04/23 16:42:56 elad Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.133 2009/04/23 17:02:26 elad Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in_pcb.c,v 1.132 2009/04/23 16:42:56 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: in_pcb.c,v 1.133 2009/04/23 17:02:26 elad Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -307,7 +307,7 @@
 	struct inpcbtable *table = inp-inp_table;
 	struct socket *so = inp-inp_socket;
 	int reuseport = (so-so_options  SO_REUSEPORT);
-	int wild = 0;
+	int wild = 0, error;
 
 	if (IN_MULTICAST(sin-sin_addr.s_addr)) {
 		/*
@@ -322,8 +322,6 @@
 	} 
 
 	if (sin-sin_port == 0) {
-		int error;
-
 		error = in_pcbsetport(inp-inp_laddr, inp, sin, cred);
 		if (error)
 			return (error);
@@ -333,19 +331,23 @@
 		struct in6pcb *t6;
 		struct in6_addr mapped;
 #endif
+		enum kauth_network_req req;
 
 		if ((so-so_options  (SO_REUSEADDR|SO_REUSEPORT)) == 0)
 			wild = 1;
 
 #ifndef IPNOPRIVPORTS
-		/* GROSS */
-		if (ntohs(sin-sin_port)  IPPORT_RESERVED 
-		kauth_authorize_network(cred,
-		KAUTH_NETWORK_BIND,
-		KAUTH_REQ_NETWORK_BIND_PRIVPORT, so, sin,
-		NULL))
-			return (EACCES);
-#endif
+		if (ntohs(sin-sin_port)  IPPORT_RESERVED)
+			req = KAUTH_REQ_NETWORK_BIND_PRIVPORT;
+		else
+#endif /* !IPNOPRIVPORTS */
+			req = KAUTH_REQ_NETWORK_BIND_PORT;
+
+		error = kauth_authorize_network(cred, KAUTH_NETWORK_BIND, req,
+		so, sin, NULL);
+		if (error)
+			return (error);
+
 #ifdef INET6
 		memset(mapped, 0, sizeof(mapped));
 		mapped.s6_addr16[5] = 0x;
@@ -355,13 +357,15 @@
 		if (t6  (reuseport  t6-in6p_socket-so_options) == 0)
 			return (EADDRINUSE);
 #endif
+
+		/* XXX-kauth */
 		if (so-so_uidinfo-ui_uid  !IN_MULTICAST(sin-sin_addr.s_addr)) {
 			t = in_pcblookup_port(table, sin-sin_addr, sin-sin_port, 1);
-		/*
-		 * XXX:	investigate ramifications of loosening this
-		 *	restriction so that as long as both ports have
-		 *	SO_REUSEPORT allow the bind
-		 */
+			/*
+			 * XXX:	investigate ramifications of loosening this
+			 *	restriction so that as long as both ports have
+			 *	SO_REUSEPORT allow the bind
+			 */
 			if (t 
 			(!in_nullhost(sin-sin_addr) ||
 			 !in_nullhost(t-inp_laddr) ||



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

2009-04-23 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Apr 23 17:37:51 UTC 2009

Modified Files:
src/sys/compat/linux/arch/i386: linux_machdep.c

Log Message:
Convert si_code value from native to linux.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/compat/linux/arch/i386/linux_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/compat/linux/arch/i386/linux_machdep.c
diff -u src/sys/compat/linux/arch/i386/linux_machdep.c:1.143 src/sys/compat/linux/arch/i386/linux_machdep.c:1.144
--- src/sys/compat/linux/arch/i386/linux_machdep.c:1.143	Sat Mar 21 14:41:30 2009
+++ src/sys/compat/linux/arch/i386/linux_machdep.c	Thu Apr 23 17:37:51 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.143 2009/03/21 14:41:30 ad Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.144 2009/04/23 17:37:51 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_machdep.c,v 1.143 2009/03/21 14:41:30 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_machdep.c,v 1.144 2009/04/23 17:37:51 njoly Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_vm86.h
@@ -284,7 +284,7 @@
 	 */
 	(void)memset(lsi = frame.sf_si, 0, sizeof(frame.sf_si));
 	lsi-lsi_errno = native_to_linux_errno[ksi-ksi_errno];
-	lsi-lsi_code = ksi-ksi_code;
+	lsi-lsi_code = native_to_linux_si_code(ksi-ksi_code);
 	switch (lsi-lsi_signo = frame.sf_sig) {
 	case LINUX_SIGILL:
 	case LINUX_SIGFPE:



CVS commit: src/sys/compat/linux/common

2009-04-23 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Apr 23 17:40:58 UTC 2009

Modified Files:
src/sys/compat/linux/common: linux_ipc.c

Log Message:
Add IPC_64 support for all semctl(2)/msgctl(2). Needed, at least on
i386 for Linux 2.6 emulation.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/linux/common/linux_ipc.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/compat/linux/common/linux_ipc.c
diff -u src/sys/compat/linux/common/linux_ipc.c:1.52 src/sys/compat/linux/common/linux_ipc.c:1.53
--- src/sys/compat/linux/common/linux_ipc.c:1.52	Wed Feb 18 14:30:43 2009
+++ src/sys/compat/linux/common/linux_ipc.c	Thu Apr 23 17:40:57 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ipc.c,v 1.52 2009/02/18 14:30:43 njoly Exp $	*/
+/*	$NetBSD: linux_ipc.c,v 1.53 2009/04/23 17:40:57 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_ipc.c,v 1.52 2009/02/18 14:30:43 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_ipc.c,v 1.53 2009/04/23 17:40:57 njoly Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_sysv.h
@@ -209,33 +209,27 @@
 
 	lcmd = SCARG(uap, cmd);
 #ifdef LINUX_IPC_FORCE64
-	if (lcmd == LINUX_IPC_STAT || lcmd == LINUX_IPC_SET)
-		lcmd |= LINUX_IPC_64;
+	lcmd |= LINUX_IPC_64;
 #endif
 
-	switch (lcmd) {
+	switch (lcmd  ~LINUX_IPC_64) {
 	case LINUX_IPC_SET:
-		error = copyin(SCARG(uap, arg).l_buf, lsembuf,
-		sizeof(lsembuf));
-		if (error)
-			return (error);
-		linux_to_bsd_semid_ds(lsembuf, sembuf);
-		pass_arg = sembuf;
-		cmd = IPC_SET;
-		break;
-
-	case LINUX_IPC_SET | LINUX_IPC_64:
-		error = copyin(SCARG(uap, arg).l_buf, lsembuf64,
-		sizeof(lsembuf64));
+		if (lcmd  LINUX_IPC_64) {
+			error = copyin(SCARG(uap, arg).l_buf, lsembuf64,
+			sizeof(lsembuf64));
+			linux_to_bsd_semid64_ds(lsembuf64, sembuf);
+		} else {
+			error = copyin(SCARG(uap, arg).l_buf, lsembuf,
+			   sizeof(lsembuf));
+			linux_to_bsd_semid_ds(lsembuf, sembuf);
+		}
 		if (error)
 			return (error);
-		linux_to_bsd_semid64_ds(lsembuf64, sembuf);
 		pass_arg = sembuf;
 		cmd = IPC_SET;
 		break;
 
 	case LINUX_IPC_STAT:
-	case LINUX_IPC_STAT | LINUX_IPC_64:
 		pass_arg = sembuf;
 		cmd = IPC_STAT;
 		break;
@@ -385,27 +379,24 @@
 
 	lcmd = SCARG(uap, cmd);
 #ifdef LINUX_IPC_FORCE64
-	if (lcmd == LINUX_IPC_STAT || lcmd == LINUX_IPC_SET)
-		lcmd |= LINUX_IPC_64;
+	lcmd |= LINUX_IPC_64;
 #endif
 
-	switch (lcmd) {
+	switch (lcmd  ~LINUX_IPC_64) {
 	case LINUX_IPC_STAT:
-	case LINUX_IPC_STAT|LINUX_IPC_64:
 		cmd = IPC_STAT;
 		bmp = bm;
 		break;
 	case LINUX_IPC_SET:
-		if ((error = copyin(SCARG(uap, buf), lm, sizeof lm)))
-			return error;
-		linux_to_bsd_msqid_ds(lm, bm);
-		cmd = IPC_SET;
-		bmp = bm;
-		break;
-	case LINUX_IPC_SET|LINUX_IPC_64:
-		if ((error = copyin(SCARG(uap, buf), lm64, sizeof lm64)))
+		if (lcmd  LINUX_IPC_64) {
+			error = copyin(SCARG(uap, buf), lm64, sizeof lm64);
+			linux_to_bsd_msqid64_ds(lm64, bm);
+		} else {
+			error = copyin(SCARG(uap, buf), lm, sizeof lm);
+			linux_to_bsd_msqid_ds(lm, bm);
+		}
+		if (error)
 			return error;
-		linux_to_bsd_msqid64_ds(lm64, bm);
 		cmd = IPC_SET;
 		bmp = bm;
 		break;



CVS commit: [netbsd-5] src/sys/kern

2009-04-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 23 17:47:13 UTC 2009

Modified Files:
src/sys/kern [netbsd-5]: kern_synch.c

Log Message:
Pull up following revision(s) (requested by yamt in ticket #720):
sys/kern/kern_synch.c: revision 1.262
kpreempt: report a failure of cpu_kpreempt_enter.  otherwise x86 trap()
loops infinitely.  PR/41202.


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.5 -r1.254.2.6 src/sys/kern/kern_synch.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_synch.c
diff -u src/sys/kern/kern_synch.c:1.254.2.5 src/sys/kern/kern_synch.c:1.254.2.6
--- src/sys/kern/kern_synch.c:1.254.2.5	Fri Feb  6 01:56:19 2009
+++ src/sys/kern/kern_synch.c	Thu Apr 23 17:47:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.254.2.5 2009/02/06 01:56:19 snj Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.254.2.6 2009/04/23 17:47:13 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.254.2.5 2009/02/06 01:56:19 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.254.2.6 2009/04/23 17:47:13 snj Exp $);
 
 #include opt_kstack.h
 #include opt_perfctrs.h
@@ -376,6 +376,7 @@
 static char	in_critical_section;
 static char	kernel_lock_held;
 static char	is_softint;
+static char	cpu_kpreempt_enter_fail;
 
 bool
 kpreempt(uintptr_t where)
@@ -434,6 +435,7 @@
 			 * interrupt to retry later.
 			 */
 			splx(s);
+			failed = (uintptr_t)cpu_kpreempt_enter_fail;
 			break;
 		}
 		/* Do it! */



CVS commit: [netbsd-5] src/doc

2009-04-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 23 17:50:16 UTC 2009

Modified Files:
src/doc [netbsd-5]: CHANGES-5.0

Log Message:
Ticket 720.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.140 -r1.1.2.141 src/doc/CHANGES-5.0

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-5.0
diff -u src/doc/CHANGES-5.0:1.1.2.140 src/doc/CHANGES-5.0:1.1.2.141
--- src/doc/CHANGES-5.0:1.1.2.140	Thu Apr 23 02:36:10 2009
+++ src/doc/CHANGES-5.0	Thu Apr 23 17:50:16 2009
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0,v 1.1.2.140 2009/04/23 02:36:10 snj Exp $
+# $NetBSD: CHANGES-5.0,v 1.1.2.141 2009/04/23 17:50:16 snj Exp $
 
 A complete list of changes from the initial NetBSD 5.0 branch on October 2008
 until the 5.0 release:
@@ -6207,3 +6207,9 @@
 	Avoid information leaks by zeroing memory.
 	[christos, ticket #719]
 
+sys/kern/kern_synch.c1.262
+
+	kpreempt: report a failure of cpu_kpreempt_enter.  Otherwise x86
+	trap() loops infinitely.  Fixes PR 41202.
+	[yamt, ticket #720]
+



CVS commit: src/sys/dev

2009-04-23 Thread Mihai Chelaru
Module Name:src
Committed By:   kefren
Date:   Thu Apr 23 20:24:23 UTC 2009

Modified Files:
src/sys/dev/ic: bwi.c bwivar.h
src/sys/dev/pci: if_bwi_pci.c

Log Message:
Add power hooks. Proposed a couple of days ago on tech-kern@, no
objections received. Tested on Dell Inspiron 2200 with BCM4318


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/bwi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/bwivar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_bwi_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/bwi.c
diff -u src/sys/dev/ic/bwi.c:1.8 src/sys/dev/ic/bwi.c:1.9
--- src/sys/dev/ic/bwi.c:1.8	Sat Apr 18 14:58:02 2009
+++ src/sys/dev/ic/bwi.c	Thu Apr 23 20:24:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.8 2009/04/18 14:58:02 tsutsui Exp $	*/
+/*	$NetBSD: bwi.c,v 1.9 2009/04/23 20:24:23 kefren Exp $	*/
 /*	$OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $	*/
 
 /*
@@ -49,7 +49,7 @@
 #include bpfilter.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bwi.c,v 1.8 2009/04/18 14:58:02 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: bwi.c,v 1.9 2009/04/23 20:24:23 kefren Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -9739,3 +9739,23 @@
 
 	return (bwi_rf_calc_rssi(mac, hdr));
 }
+
+bool
+bwi_suspend(device_t dv PMF_FN_ARGS)
+{
+	struct bwi_softc *sc = device_private(dv);
+
+	bwi_power_off(sc, 0);
+
+	return true;
+}
+
+bool
+bwi_resume(device_t dv PMF_FN_ARGS)
+{
+	struct bwi_softc *sc = device_private(dv);
+
+	bwi_power_on(sc, 1);
+
+	return true;
+}

Index: src/sys/dev/ic/bwivar.h
diff -u src/sys/dev/ic/bwivar.h:1.2 src/sys/dev/ic/bwivar.h:1.3
--- src/sys/dev/ic/bwivar.h:1.2	Fri Jan  9 20:49:42 2009
+++ src/sys/dev/ic/bwivar.h	Thu Apr 23 20:24:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwivar.h,v 1.2 2009/01/09 20:49:42 macallan Exp $	*/
+/*	$NetBSD: bwivar.h,v 1.3 2009/04/23 20:24:23 kefren Exp $	*/
 /*	$OpenBSD: bwivar.h,v 1.23 2008/02/25 20:36:54 mglocker Exp $	*/
 
 /*
@@ -791,4 +791,8 @@
 int		bwi_attach(struct bwi_softc *);
 void		bwi_detach(struct bwi_softc *);
 
+/* Power Management Framework */
+bool		bwi_suspend(device_t db PMF_FN_ARGS);
+bool		bwi_resume(device_t db PMF_FN_ARGS);
+
 #endif	/* !_DEV_IC_BWIVAR_H */

Index: src/sys/dev/pci/if_bwi_pci.c
diff -u src/sys/dev/pci/if_bwi_pci.c:1.3 src/sys/dev/pci/if_bwi_pci.c:1.4
--- src/sys/dev/pci/if_bwi_pci.c:1.3	Sat Jan 10 12:55:45 2009
+++ src/sys/dev/pci/if_bwi_pci.c	Thu Apr 23 20:24:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwi_pci.c,v 1.3 2009/01/10 12:55:45 cegger Exp $	*/
+/*	$NetBSD: if_bwi_pci.c,v 1.4 2009/04/23 20:24:23 kefren Exp $	*/
 /*	$OpenBSD: if_bwi_pci.c,v 1.6 2008/02/14 22:10:02 brad Exp $ */
 
 /*
@@ -25,7 +25,7 @@
 #include bpfilter.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bwi_pci.c,v 1.3 2009/01/10 12:55:45 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bwi_pci.c,v 1.4 2009/04/23 20:24:23 kefren Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -161,6 +161,9 @@
 	sc-sc_pci_subvid = PCI_VENDOR(reg);
 	sc-sc_pci_subdid = PCI_PRODUCT(reg);
 
+	if (!pmf_device_register(self, bwi_suspend, bwi_resume))
+		aprint_error_dev(self, couldn't establish power handler\n);
+
 	bwi_attach(sc);
 }
 
@@ -170,6 +173,8 @@
 	struct bwi_pci_softc *psc = (struct bwi_pci_softc *)self;
 	struct bwi_softc *sc = psc-psc_bwi;
 
+	pmf_device_deregister(self);
+
 	bwi_detach(sc);
 
 	if (sc-sc_ih != NULL) {



CVS commit: src/doc

2009-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 23 20:48:09 UTC 2009

Modified Files:
src/doc: CHANGES

Log Message:
mention wscons support in zx(4)


To generate a diff of this commit:
cvs rdiff -u -r1.1215 -r1.1216 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.1215 src/doc/CHANGES:1.1216
--- src/doc/CHANGES:1.1215	Tue Apr 21 13:07:44 2009
+++ src/doc/CHANGES	Thu Apr 23 20:48:09 2009
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1215 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1216 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -184,3 +184,4 @@
 		From OpenBSD and improvements from Kevin Lahey.
 		[cegger 20090420]
 	sdmmc(4): Add a driver for SD/MMC from OpenBSD. [nonaka 20090421]
+	zx(4): Add wscons support [macallan 20090423]



CVS commit: [netbsd-5] src/doc

2009-04-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 23 21:30:39 UTC 2009

Modified Files:
src/doc [netbsd-5]: README.files

Log Message:
Adjust for 5.0.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 src/doc/README.files

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

Modified files:

Index: src/doc/README.files
diff -u src/doc/README.files:1.4 src/doc/README.files:1.4.10.1
--- src/doc/README.files:1.4	Fri Dec 14 21:15:52 2007
+++ src/doc/README.files	Thu Apr 23 21:30:39 2009
@@ -1,8 +1,10 @@
-#	$NetBSD: README.files,v 1.4 2007/12/14 21:15:52 pavel Exp $
+#	$NetBSD: README.files,v 1.4.10.1 2009/04/23 21:30:39 snj Exp $
 
 What's in this directory:
 
-CHANGES		Changes between the XXX.XXX-1 and XXX.XXX releases.
+CHANGES		Changes between the 4.0 and 5.0 releases.
+
+CHANGES-5.0	Changes between the initial 5.0 branch and final release of 5.0.
 
 CHANGES.prev	Changes in previous NetBSD releases.
 
@@ -24,7 +26,7 @@
 
 In addition to the files and directories listed above, there is one
 directory per architecture, for each of the architectures for which
-NetBSD XXX.XXX has a binary distribution.  The contents of each
+NetBSD 5.0 has a binary distribution.  The contents of each
 architecture's directory are described in an INSTALL file found in
 that directory.
 



CVS commit: src/lib/libc/db/hash

2009-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 23 22:09:23 UTC 2009

Modified Files:
src/lib/libc/db/hash: hash_buf.c

Log Message:
correct cast to size_t.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/db/hash/hash_buf.c

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

Modified files:

Index: src/lib/libc/db/hash/hash_buf.c
diff -u src/lib/libc/db/hash/hash_buf.c:1.17 src/lib/libc/db/hash/hash_buf.c:1.18
--- src/lib/libc/db/hash/hash_buf.c:1.17	Wed Apr 22 23:49:39 2009
+++ src/lib/libc/db/hash/hash_buf.c	Thu Apr 23 18:09:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash_buf.c,v 1.17 2009/04/23 03:49:39 agc Exp $	*/
+/*	$NetBSD: hash_buf.c,v 1.18 2009/04/23 22:09:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hash_buf.c,v 1.17 2009/04/23 03:49:39 agc Exp $);
+__RCSID($NetBSD: hash_buf.c,v 1.18 2009/04/23 22:09:23 christos Exp $);
 
 /*
  * PACKAGE: hash
@@ -315,7 +315,7 @@
 		/* Check if we are freeing stuff */
 		if (do_free) {
 			if (bp-page) {
-(void)memset(bp-page, 0, (unsigned)hashp-BSIZE);
+(void)memset(bp-page, 0, (size_t)hashp-BSIZE);
 free(bp-page);
 			}
 			BUF_REMOVE(bp);



CVS commit: [netbsd-5] src/lib/libc/db/hash

2009-04-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 23 23:31:16 UTC 2009

Modified Files:
src/lib/libc/db/hash [netbsd-5]: hash_buf.c

Log Message:
Pull up following revision(s) (requested by agc in ticket #723):
lib/libc/db/hash/hash_buf.c: revision 1.18
correct cast to size_t.


To generate a diff of this commit:
cvs rdiff -u -r1.14.4.3 -r1.14.4.4 src/lib/libc/db/hash/hash_buf.c

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

Modified files:

Index: src/lib/libc/db/hash/hash_buf.c
diff -u src/lib/libc/db/hash/hash_buf.c:1.14.4.3 src/lib/libc/db/hash/hash_buf.c:1.14.4.4
--- src/lib/libc/db/hash/hash_buf.c:1.14.4.3	Thu Apr 23 23:30:30 2009
+++ src/lib/libc/db/hash/hash_buf.c	Thu Apr 23 23:31:16 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash_buf.c,v 1.14.4.3 2009/04/23 23:30:30 snj Exp $	*/
+/*	$NetBSD: hash_buf.c,v 1.14.4.4 2009/04/23 23:31:16 snj Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hash_buf.c,v 1.14.4.3 2009/04/23 23:30:30 snj Exp $);
+__RCSID($NetBSD: hash_buf.c,v 1.14.4.4 2009/04/23 23:31:16 snj Exp $);
 
 /*
  * PACKAGE: hash
@@ -315,7 +315,7 @@
 		/* Check if we are freeing stuff */
 		if (do_free) {
 			if (bp-page) {
-(void)memset(bp-page, 0, (unsigned)hashp-BSIZE);
+(void)memset(bp-page, 0, (size_t)hashp-BSIZE);
 free(bp-page);
 			}
 			BUF_REMOVE(bp);



CVS commit: src/distrib/notes/sparc

2009-04-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 23 23:54:10 UTC 2009

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

Log Message:
Note that SMP is broken on sparc.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/distrib/notes/sparc/hardware

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

Modified files:

Index: src/distrib/notes/sparc/hardware
diff -u src/distrib/notes/sparc/hardware:1.35 src/distrib/notes/sparc/hardware:1.36
--- src/distrib/notes/sparc/hardware:1.35	Thu Apr 23 01:56:50 2009
+++ src/distrib/notes/sparc/hardware	Thu Apr 23 23:54:10 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: hardware,v 1.35 2009/04/23 01:56:50 snj Exp $
+.\	$NetBSD: hardware,v 1.36 2009/04/23 23:54:10 snj Exp $
 .
 .Pp
 The minimum configuration requires 4 MB of RAM and 100 MB of disk space.
@@ -10,6 +10,12 @@
 with 4 MB of RAM \(em slow.
 Note that until you have around 16 MB of RAM, getting more RAM is more
 important than getting a faster CPU.
+.(Note
+The sparc port does not have functional SMP support in this release.
+We expect this to be fixed in the next release, but in the meantime,
+.Nx
+4.0.1 has working SMP support.
+.Note)
 .
 .Ss2 Supported machines
 .(bullet -offset indent