CVS commit: src/distrib/bebox/floppies/kernel

2011-01-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Jan 25 08:19:40 UTC 2011

Modified Files:
src/distrib/bebox/floppies/kernel: Makefile

Log Message:
use ${PRINTOBJDIR} to find the ../kernel-ramdisk/netbsd-INSTALL.gz, don't
depend upon a particular obj setup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/bebox/floppies/kernel/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/bebox/floppies/kernel/Makefile
diff -u src/distrib/bebox/floppies/kernel/Makefile:1.1 src/distrib/bebox/floppies/kernel/Makefile:1.2
--- src/distrib/bebox/floppies/kernel/Makefile:1.1	Wed Oct 20 02:59:58 2010
+++ src/distrib/bebox/floppies/kernel/Makefile	Tue Jan 25 08:19:39 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2010/10/20 02:59:58 kiyohara Exp $
+#	$NetBSD: Makefile,v 1.2 2011/01/25 08:19:39 mrg Exp $
 #
 # Makefile snippet to create a set of USTAR floppies
 #
@@ -10,7 +10,8 @@
 FLOPPYSIZE=		2880
 FLOPPYFILES=		netbsd
 
-FLOPPY_NETBSD=		../kernel-ramdisk/netbsd-INSTALL.gz
+FLOPPYDIR!=  		cd ${.CURDIR}/../kernel-ramdisk  ${PRINTOBJDIR}
+FLOPPY_NETBSD=		${FLOPPYDIR}/netbsd-INSTALL.gz
 FLOPPYPAD=		1
 FLOPPYSUFFIX=		.fs
 



CVS commit: src/share/mk

2011-01-25 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Tue Jan 25 10:28:56 UTC 2011

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

Log Message:
Default MKREPRO to no, so that the tests in stand/ etc. don't need
to add :Uno to the variable expansion inside the test to avoid errors
from nbmake.


To generate a diff of this commit:
cvs rdiff -u -r1.647 -r1.648 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.647 src/share/mk/bsd.own.mk:1.648
--- src/share/mk/bsd.own.mk:1.647	Tue Jan 18 08:31:18 2011
+++ src/share/mk/bsd.own.mk	Tue Jan 25 10:28:56 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.647 2011/01/18 08:31:18 matt Exp $
+#	$NetBSD: bsd.own.mk,v 1.648 2011/01/25 10:28:56 he Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -751,6 +751,7 @@
 	MKMANDOC MKMANZ MKOBJDIRS \
 	MKPCC MKPCCCMDS \
 	MKPIGZGZIP \
+	MKREPRO \
 	MKSOFTFLOAT MKSTRIPIDENT \
 	MKUNPRIVED MKUPDATE MKX11 MKZFS
 .for var in ${_MKVARS.no}



CVS commit: src/sys/dev/pci

2011-01-25 Thread Grégoire Sutre
Module Name:src
Committed By:   gsutre
Date:   Tue Jan 25 10:52:11 UTC 2011

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

Log Message:
Typos, fix memory binding for memory type 2, and add consistency checks.
From OpenBSD.

ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/agp_i810.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.69 src/sys/dev/pci/agp_i810.c:1.70
--- src/sys/dev/pci/agp_i810.c:1.69	Sat Nov 13 13:52:04 2010
+++ src/sys/dev/pci/agp_i810.c	Tue Jan 25 10:52:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.69 2010/11/13 13:52:04 uebayasi Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.70 2011/01/25 10:52:11 gsutre Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.69 2010/11/13 13:52:04 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.70 2011/01/25 10:52:11 gsutre Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -819,10 +819,10 @@
 		return EINVAL;
 	}
 
-	if (isc-chiptype != CHIP_I830) {
+	if (isc-chiptype != CHIP_I810) {
 		if ((offset  AGP_PAGE_SHIFT)  isc-stolen) {
 #ifdef AGP_DEBUG
-			printf(%s: trying to bind into stolen memory,
+			printf(%s: trying to bind into stolen memory\n,
 			device_xname(sc-as_dev));
 #endif
 			return EINVAL;
@@ -844,7 +844,7 @@
 	if (isc-chiptype != CHIP_I810 ) {
 		if ((offset  AGP_PAGE_SHIFT)  isc-stolen) {
 #ifdef AGP_DEBUG
-			printf(%s: trying to unbind from stolen memory,
+			printf(%s: trying to unbind from stolen memory\n,
 			device_xname(sc-as_dev));
 #endif
 			return EINVAL;
@@ -968,6 +968,9 @@
 	struct agp_i810_softc *isc = sc-as_chipc;
 	u_int32_t regval, i;
 
+	if (mem-am_is_bound != 0)
+		return EINVAL;
+
 	/*
 	 * XXX evil hack: the PGTBL_CTL appearently gets overwritten by the
 	 * X server for mysterious reasons which leads to crashes if we write
@@ -983,7 +986,9 @@
 	}
 
 	if (mem-am_type == 2) {
-		agp_i810_write_gtt_entry(isc, offset, mem-am_physical | 1);
+		for (i = 0; i  mem-am_size; i += AGP_PAGE_SIZE)
+			agp_i810_bind_page(sc, offset + i,
+			mem-am_physical + i);
 		mem-am_offset = offset;
 		mem-am_is_bound = 1;
 		return 0;
@@ -996,7 +1001,7 @@
 		return EINVAL;
 
 	for (i = 0; i  mem-am_size; i += AGP_PAGE_SIZE)
-		agp_i810_write_gtt_entry(isc, offset, i | 3);
+		agp_i810_write_gtt_entry(isc, i, i | 3);
 	mem-am_is_bound = 1;
 	return 0;
 }
@@ -1007,8 +1012,12 @@
 	struct agp_i810_softc *isc = sc-as_chipc;
 	u_int32_t i;
 
+	if (mem-am_is_bound == 0)
+		return EINVAL;
+
 	if (mem-am_type == 2) {
-		agp_i810_write_gtt_entry(isc, mem-am_offset, 0);
+		for (i = 0; i  mem-am_size; i += AGP_PAGE_SIZE)
+			agp_i810_unbind_page(sc, mem-am_offset + i);
 		mem-am_offset = 0;
 		mem-am_is_bound = 0;
 		return 0;



CVS commit: src/sys/arch/sgimips/hpc

2011-01-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 25 12:11:27 UTC 2011

Modified Files:
src/sys/arch/sgimips/hpc: hpcdma.c hpcdma.h

Log Message:
Small bus_dma(9) tweaks:
- call bus_dmamap_create(9) after bus_dmamem_alloc(9) and bus_dmamem_map(9)
  return successfully
- no need to use PAGE_SIZE for size of descriptor dmamap
- use bus_addr_t to store DMA address
- BUS_DMASYNC_PREWRITE is enough for host-to-device only descriptors

Tested on R5000 Indy.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sgimips/hpc/hpcdma.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sgimips/hpc/hpcdma.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/sgimips/hpc/hpcdma.c
diff -u src/sys/arch/sgimips/hpc/hpcdma.c:1.17 src/sys/arch/sgimips/hpc/hpcdma.c:1.18
--- src/sys/arch/sgimips/hpc/hpcdma.c:1.17	Mon Dec 14 00:46:13 2009
+++ src/sys/arch/sgimips/hpc/hpcdma.c	Tue Jan 25 12:11:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcdma.c,v 1.17 2009/12/14 00:46:13 matt Exp $	*/
+/*	$NetBSD: hpcdma.c,v 1.18 2011/01/25 12:11:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Wayne Knowles
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hpcdma.c,v 1.17 2009/12/14 00:46:13 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: hpcdma.c,v 1.18 2011/01/25 12:11:27 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -81,14 +81,6 @@
 
 	/* Alloc 1 additional descriptor - needed for DMA bug fix */
 	allocsz = sizeof(struct hpc_dma_desc) * (ndesc + 1);
-	KASSERT(allocsz = PAGE_SIZE);
-
-	if (bus_dmamap_create(sc-sc_dmat, PAGE_SIZE, 1 /*seg*/,
-			  PAGE_SIZE, 0, BUS_DMA_WAITOK,
-			  sc-sc_dmamap) != 0) {
-		printf(: failed to create dmamap\n);
-		return;
-	}
 
 	/*
 	 * Allocate a block of memory for dma chaining pointers
@@ -106,20 +98,28 @@
 		return;
 	}
 
+	if (bus_dmamap_create(sc-sc_dmat, allocsz, 1 /*seg*/,
+			  allocsz, 0, BUS_DMA_WAITOK,
+			  sc-sc_dmamap) != 0) {
+		printf(: failed to create dmamap\n);
+		return;
+	}
+
 	if (bus_dmamap_load(sc-sc_dmat, sc-sc_dmamap, sc-sc_desc_kva,
 			allocsz, NULL, BUS_DMA_NOWAIT)) {
 		printf(: can't load sglist\n);
 		return;
 	}
 
-	sc-sc_desc_pa = (void *) (vaddr_t)sc-sc_dmamap-dm_segs[0].ds_addr;
+	sc-sc_desc_pa = sc-sc_dmamap-dm_segs[0].ds_addr;
 }
 
 
 void
 hpcdma_sglist_create(struct hpc_dma_softc *sc, bus_dmamap_t dmamap)
 {
-	struct hpc_dma_desc *hva, *hpa;
+	struct hpc_dma_desc *hva;
+	bus_addr_t hpa;
 	bus_dma_segment_t *segp;
 	int i;
 
@@ -136,16 +136,17 @@
 #ifdef DMA_DEBUG
 		printf(%p:%ld, , (void *)segp-ds_addr, segp-ds_len);
 #endif
+		hpa += sizeof(struct hpc_dma_desc);	/* next chain desc */
 		if (sc-hpc-revision == 3) {
 			hva-hpc3_hdd_bufptr = segp-ds_addr;
 			hva-hpc3_hdd_ctl= segp-ds_len;
-			hva-hdd_descptr = (uintptr_t) ++hpa;
+			hva-hdd_descptr = hpa;
 		} else /* HPC 1/1.5 */ {
 			/* there doesn't seem to be any good way of doing this
 		   	   via an abstraction layer */
 			hva-hpc1_hdd_bufptr = segp-ds_addr;
 			hva-hpc1_hdd_ctl= segp-ds_len;
-			hva-hdd_descptr = (uintptr_t) ++hpa;
+			hva-hdd_descptr = hpa;
 		}
 		++hva; ++segp;
 	}
@@ -156,7 +157,6 @@
 		hva-hpc3_hdd_bufptr  = 0;
 		hva-hpc3_hdd_ctl = HPC3_HDD_CTL_EOCHAIN;
 		hva-hdd_descptr = 0;
-		hva++;
 	} else {
 		hva--;
 		hva-hpc1_hdd_bufptr |= HPC1_HDD_CTL_EOCHAIN;
@@ -167,12 +167,12 @@
 	printf(\n);
 #endif
 	bus_dmamap_sync(sc-sc_dmat, sc-sc_dmamap,
-	0, sc-sc_dmamap-dm_mapsize,
-	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+	0, sizeof(struct hpc_dma_desc) * (dmamap-dm_nsegs + 1),
+	BUS_DMASYNC_PREWRITE);
 
 	/* Load DMA Descriptor list */
 	bus_space_write_4(sc-sc_bst, sc-sc_bsh, sc-hpc-scsi0_ndbp,
-			(uintptr_t)sc-sc_desc_pa);
+	sc-sc_desc_pa);
 }
 
 void

Index: src/sys/arch/sgimips/hpc/hpcdma.h
diff -u src/sys/arch/sgimips/hpc/hpcdma.h:1.8 src/sys/arch/sgimips/hpc/hpcdma.h:1.9
--- src/sys/arch/sgimips/hpc/hpcdma.h:1.8	Sat May 10 15:31:05 2008
+++ src/sys/arch/sgimips/hpc/hpcdma.h	Tue Jan 25 12:11:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcdma.h,v 1.8 2008/05/10 15:31:05 martin Exp $	*/
+/*	$NetBSD: hpcdma.h,v 1.9 2011/01/25 12:11:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Wayne Knowles
@@ -54,7 +54,7 @@
 	int			sc_ndesc;
 	bus_dmamap_t		sc_dmamap;
 	struct hpc_dma_desc*sc_desc_kva;	/* Virtual address */
-	struct hpc_dma_desc*sc_desc_pa;	/* Physical address */
+	bus_addr_t		sc_desc_pa;	/* DMA address */
 	ssize_t			sc_dlen;	/* number of bytes transfered */
 	struct hpc_values   *hpc;		/* constants for HPC1/3 */
 };



CVS commit: src/sys/arch/sgimips/hpc

2011-01-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 25 12:14:03 UTC 2011

Modified Files:
src/sys/arch/sgimips/hpc: wdsc.c

Log Message:
- MAXPHYS is enough for DMA xfer size (hpc-scsi_max_xfer seems too large)
- switch BUS_DMASYNC_*READ and BUS_DMASYNC_*WRITE properly in
  bus_dmamap_sync(9) ops per each xfer dir

Tested on R5000 Indy.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sgimips/hpc/wdsc.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/sgimips/hpc/wdsc.c
diff -u src/sys/arch/sgimips/hpc/wdsc.c:1.29 src/sys/arch/sgimips/hpc/wdsc.c:1.30
--- src/sys/arch/sgimips/hpc/wdsc.c:1.29	Mon Dec 14 00:46:13 2009
+++ src/sys/arch/sgimips/hpc/wdsc.c	Tue Jan 25 12:14:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdsc.c,v 1.29 2009/12/14 00:46:13 matt Exp $	*/
+/*	$NetBSD: wdsc.c,v 1.30 2011/01/25 12:14:02 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Wayne Knowles
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wdsc.c,v 1.29 2009/12/14 00:46:13 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: wdsc.c,v 1.30 2011/01/25 12:14:02 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -162,7 +162,7 @@
 	}
 
 	if (bus_dmamap_create(wsc-sc_dmat,
-			  wsc-sc_hpcdma.hpc-scsi_max_xfer,
+			  MAXPHYS,
 			  wsc-sc_hpcdma.hpc-scsi_dma_segs,
 			  wsc-sc_hpcdma.hpc-scsi_dma_segs_size,
 			  wsc-sc_hpcdma.hpc-scsi_dma_segs_size,
@@ -261,7 +261,8 @@
 
 	bus_dmamap_sync(wsc-sc_dmat, wsc-sc_dmamap, 0,
 			wsc-sc_dmamap-dm_mapsize,
-			BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+			(dsc-sc_flags  HPCDMA_READ) ?
+			BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 
 	hpcdma_cntl(dsc, dsc-sc_dmacmd);	/* Thunderbirds are go! */
 
@@ -283,7 +284,8 @@
 		hpcdma_cntl(dsc, 0);	/* Stop DMA */
 		bus_dmamap_sync(wsc-sc_dmat, wsc-sc_dmamap, 0,
 		wsc-sc_dmamap-dm_mapsize,
-		BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+		(dsc-sc_flags  HPCDMA_READ) ?
+		BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
 	}
 	if (wsc-sc_flags  WDSC_DMA_MAPLOADED)
 		bus_dmamap_unload(wsc-sc_dmat, wsc-sc_dmamap);



CVS commit: src/lib/librumphijack

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 25 12:18:33 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
Rewrite to declare most dual-kernel calls with macros.  This helps
with adding new calls and makes all existing fd-accepting hijacked
calls dual-kernel.  It would be better to autogenerate the code
from syscalls.master, but this is easier for now.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/librumphijack/hijack.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/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.16 src/lib/librumphijack/hijack.c:1.17
--- src/lib/librumphijack/hijack.c:1.16	Wed Jan 19 11:27:01 2011
+++ src/lib/librumphijack/hijack.c	Tue Jan 25 12:18:33 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.16 2011/01/19 11:27:01 pooka Exp $	*/
+/*  $NetBSD: hijack.c,v 1.17 2011/01/25 12:18:33 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hijack.c,v 1.16 2011/01/19 11:27:01 pooka Exp $);
+__RCSID($NetBSD: hijack.c,v 1.17 2011/01/25 12:18:33 pooka Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -53,94 +53,120 @@
 #include time.h
 #include unistd.h
 
-enum {	RUMPCALL_SOCKET, RUMPCALL_ACCEPT, RUMPCALL_BIND, RUMPCALL_CONNECT,
-	RUMPCALL_GETPEERNAME, RUMPCALL_GETSOCKNAME, RUMPCALL_LISTEN,
-	RUMPCALL_RECVFROM, RUMPCALL_RECVMSG,
-	RUMPCALL_SENDTO, RUMPCALL_SENDMSG,
-	RUMPCALL_GETSOCKOPT, RUMPCALL_SETSOCKOPT,
-	RUMPCALL_SHUTDOWN,
-	RUMPCALL_READ, RUMPCALL_READV,
-	RUMPCALL_WRITE, RUMPCALL_WRITEV,
-	RUMPCALL_IOCTL, RUMPCALL_FCNTL,
-	RUMPCALL_CLOSE,
-	RUMPCALL_POLLTS,
-	RUMPCALL__NUM
+enum dualcall {
+	DUALCALL_WRITE, DUALCALL_WRITEV,
+	DUALCALL_IOCTL, DUALCALL_FCNTL,
+	DUALCALL_SOCKET, DUALCALL_ACCEPT, DUALCALL_BIND, DUALCALL_CONNECT,
+	DUALCALL_GETPEERNAME, DUALCALL_GETSOCKNAME, DUALCALL_LISTEN,
+	DUALCALL_RECVFROM, DUALCALL_RECVMSG,
+	DUALCALL_SENDTO, DUALCALL_SENDMSG,
+	DUALCALL_GETSOCKOPT, DUALCALL_SETSOCKOPT,
+	DUALCALL_SHUTDOWN,
+	DUALCALL_READ, DUALCALL_READV,
+	DUALCALL_DUP2, DUALCALL_CLOSE,
+	DUALCALL_POLLTS,
+	DUALCALL__NUM
 };
 
 #define RSYS_STRING(a) __STRING(a)
 #define RSYS_NAME(a) RSYS_STRING(__CONCAT(RUMP_SYS_RENAME_,a))
 
-const char *sysnames[] = {
-	RSYS_NAME(SOCKET),
-	RSYS_NAME(ACCEPT),
-	RSYS_NAME(BIND),
-	RSYS_NAME(CONNECT),
-	RSYS_NAME(GETPEERNAME),
-	RSYS_NAME(GETSOCKNAME),
-	RSYS_NAME(LISTEN),
-	RSYS_NAME(RECVFROM),
-	RSYS_NAME(RECVMSG),
-	RSYS_NAME(SENDTO),
-	RSYS_NAME(SENDMSG),
-	RSYS_NAME(GETSOCKOPT),
-	RSYS_NAME(SETSOCKOPT),
-	RSYS_NAME(SHUTDOWN),
-	RSYS_NAME(READ),
-	RSYS_NAME(READV),
-	RSYS_NAME(WRITE),
-	RSYS_NAME(WRITEV),
-	RSYS_NAME(IOCTL),
-	RSYS_NAME(FCNTL),
-	RSYS_NAME(CLOSE),
-	RSYS_NAME(POLLTS),
-};
-
-static int	(*host_socket)(int, int, int);
-static int	(*host_connect)(int, const struct sockaddr *, socklen_t);
-static int	(*host_bind)(int, const struct sockaddr *, socklen_t);
-static int	(*host_listen)(int, int);
-static int	(*host_accept)(int, struct sockaddr *, socklen_t *);
-static int	(*host_getpeername)(int, struct sockaddr *, socklen_t *);
-static int	(*host_getsockname)(int, struct sockaddr *, socklen_t *);
-static int	(*host_setsockopt)(int, int, int, const void *, socklen_t);
-
-static ssize_t	(*host_read)(int, void *, size_t);
-static ssize_t	(*host_readv)(int, const struct iovec *, int);
-static ssize_t	(*host_write)(int, const void *, size_t);
-static ssize_t	(*host_writev)(int, const struct iovec *, int);
-static int	(*host_ioctl)(int, unsigned long, ...);
-static int	(*host_fcntl)(int, int, ...);
-static int	(*host_close)(int);
-static int	(*host_pollts)(struct pollfd *, nfds_t,
-			   const struct timespec *, const sigset_t *);
-static pid_t	(*host_fork)(void);
-static int	(*host_dup2)(int, int);
-static int	(*host_shutdown)(int, int);
-/* XXX */
-static void	*host_sendto;
-static void	*host_recvfrom;
-
-static void *rumpcalls[RUMPCALL__NUM];
-
 /*
  * Would be nice to get this automatically in sync with libc.
  * Also, this does not work for compat-using binaries!
  */
-
 #if !__NetBSD_Prereq__(5,99,7)
-#define SELECT select
-#define POLLTS pollts
-#define POLL poll
+#define LIBCSELECT select
+#define LIBCPOLLTS pollts
+#define LIBCPOLL poll
 #else
-#define SELECT __select50
-#define POLLTS __pollts50
-#define POLL __poll50
+#define LIBCSELECT __select50
+#define LIBCPOLLTS __pollts50
+#define LIBCPOLL __poll50
+#endif
 
 int SELECT(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 int POLLTS(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
 int POLL(struct pollfd *, nfds_t, int);
+
+#define S(a) __STRING(a)
+struct sysnames {
+	enum dualcall scm_callnum;
+	const char *scm_hostname;
+	const char *scm_rumpname;
+} syscnames[] = {
+	{ DUALCALL_SOCKET,	__socket30,	RSYS_NAME(SOCKET)	},
+	{ DUALCALL_ACCEPT,	accept,	

CVS commit: src/sys/arch/sgimips/hpc

2011-01-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 25 12:21:05 UTC 2011

Modified Files:
src/sys/arch/sgimips/hpc: haltwo.c hpc.c hpcdma.c hpcdma.h hpcreg.h
hpcvar.h if_sq.c pi1ppc.c pi1ppcvar.h sqvar.h

Log Message:
u_intNN_t - uintNN_t


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sgimips/hpc/haltwo.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sgimips/hpc/hpc.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sgimips/hpc/hpcdma.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sgimips/hpc/hpcdma.h \
src/sys/arch/sgimips/hpc/sqvar.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sgimips/hpc/hpcreg.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sgimips/hpc/hpcvar.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sgimips/hpc/if_sq.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/hpc/pi1ppc.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sgimips/hpc/pi1ppcvar.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/sgimips/hpc/haltwo.c
diff -u src/sys/arch/sgimips/hpc/haltwo.c:1.17 src/sys/arch/sgimips/hpc/haltwo.c:1.18
--- src/sys/arch/sgimips/hpc/haltwo.c:1.17	Thu Sep 24 14:09:18 2009
+++ src/sys/arch/sgimips/hpc/haltwo.c	Tue Jan 25 12:21:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: haltwo.c,v 1.17 2009/09/24 14:09:18 tsutsui Exp $ */
+/* $NetBSD: haltwo.c,v 1.18 2011/01/25 12:21:04 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: haltwo.c,v 1.17 2009/09/24 14:09:18 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: haltwo.c,v 1.18 2011/01/25 12:21:04 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -269,12 +269,12 @@
 		return 0;
 
 	if ( platform.badaddr((void *)(vaddr_t)(haa-ha_sh + haa-ha_devoff),
-	sizeof(u_int32_t)) )
+	sizeof(uint32_t)) )
 		return 0;
 
 	if ( platform.badaddr(
 	(void *)(vaddr_t)(haa-ha_sh + haa-ha_devoff + HAL2_REG_CTL_REV),
-	sizeof(u_int32_t)) )
+	sizeof(uint32_t)) )
 		return 0;
 
 	rev = *(uint32_t *)MIPS_PHYS_TO_KSEG1(haa-ha_sh + haa-ha_devoff +

Index: src/sys/arch/sgimips/hpc/hpc.c
diff -u src/sys/arch/sgimips/hpc/hpc.c:1.63 src/sys/arch/sgimips/hpc/hpc.c:1.64
--- src/sys/arch/sgimips/hpc/hpc.c:1.63	Mon Dec 14 00:46:13 2009
+++ src/sys/arch/sgimips/hpc/hpc.c	Tue Jan 25 12:21:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpc.c,v 1.63 2009/12/14 00:46:13 matt Exp $	*/
+/*	$NetBSD: hpc.c,v 1.64 2011/01/25 12:21:04 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hpc.c,v 1.63 2009/12/14 00:46:13 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: hpc.c,v 1.64 2011/01/25 12:21:04 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -382,7 +382,7 @@
 	mach_type == MACH_SGI_IP22) {
 		/* Make sure it's actually there and readable */
 		if (!platform.badaddr((void*)MIPS_PHYS_TO_KSEG1(ga-ga_addr),
-		sizeof(u_int32_t)))
+		sizeof(uint32_t)))
 			return 1;
 	}
 
@@ -590,7 +590,7 @@
 		return (0);
 
 	if (mach_type == MACH_SGI_IP12 || mach_type == MACH_SGI_IP20) {
-		u_int32_t reg;
+		uint32_t reg;
 
 		if (!platform.badaddr((void *)MIPS_PHYS_TO_KSEG1(ga-ga_addr +
 		HPC1_BIGENDIAN), 4)) {
@@ -665,10 +665,10 @@
 static int
 hpc_power_intr(void *arg)
 {
-	u_int32_t pwr_reg;
+	uint32_t pwr_reg;
 
-	pwr_reg = *((volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x1fbd9850));
-	*((volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x1fbd9850)) = pwr_reg;
+	pwr_reg = *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1(0x1fbd9850));
+	*((volatile uint32_t *)MIPS_PHYS_TO_KSEG1(0x1fbd9850)) = pwr_reg;
 
 	printf(hpc_power_intr: panel reg = %08x\n, pwr_reg);
 
@@ -692,7 +692,7 @@
 	value = *(volatile uint8_t *)MIPS_PHYS_TO_KSEG1(HPC_BASE_ADDRESS_0 +
 	HPC1_AUX_REGS);
 	value ^= HPC1_AUX_CONSLED;
-	*(volatile u_int8_t *)MIPS_PHYS_TO_KSEG1(HPC_BASE_ADDRESS_0 +
+	*(volatile uint8_t *)MIPS_PHYS_TO_KSEG1(HPC_BASE_ADDRESS_0 +
 	HPC1_AUX_REGS) = value;
 	splx(s);
 

Index: src/sys/arch/sgimips/hpc/hpcdma.c
diff -u src/sys/arch/sgimips/hpc/hpcdma.c:1.18 src/sys/arch/sgimips/hpc/hpcdma.c:1.19
--- src/sys/arch/sgimips/hpc/hpcdma.c:1.18	Tue Jan 25 12:11:27 2011
+++ src/sys/arch/sgimips/hpc/hpcdma.c	Tue Jan 25 12:21:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcdma.c,v 1.18 2011/01/25 12:11:27 tsutsui Exp $	*/
+/*	$NetBSD: hpcdma.c,v 1.19 2011/01/25 12:21:04 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Wayne Knowles
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hpcdma.c,v 1.18 2011/01/25 12:11:27 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: hpcdma.c,v 1.19 2011/01/25 12:21:04 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -196,7 +196,7 @@
 void
 hpcdma_flush(struct hpc_dma_softc *sc)
 {
-	u_int32_t	mode;
+	uint32_t mode;
 
 	mode = bus_space_read_4(sc-sc_bst, sc-sc_bsh, sc-hpc-scsi0_ctl);
 	bus_space_write_4(sc-sc_bst, sc-sc_bsh, sc-hpc-scsi0_ctl,

Index: 

CVS commit: src/lib/librumphijack

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 25 12:21:36 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
dramatic whitespace fix


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/librumphijack/hijack.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/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.17 src/lib/librumphijack/hijack.c:1.18
--- src/lib/librumphijack/hijack.c:1.17	Tue Jan 25 12:18:33 2011
+++ src/lib/librumphijack/hijack.c	Tue Jan 25 12:21:36 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.17 2011/01/25 12:18:33 pooka Exp $	*/
+/*  $NetBSD: hijack.c,v 1.18 2011/01/25 12:21:36 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hijack.c,v 1.17 2011/01/25 12:18:33 pooka Exp $);
+__RCSID($NetBSD: hijack.c,v 1.18 2011/01/25 12:21:36 pooka Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -856,7 +856,7 @@
 	(int, void *, size_t),		\
 	(fd, buf, buflen))
 
-FDCALL(ssize_t, readv, DUALCALL_READV, \
+FDCALL(ssize_t, readv, DUALCALL_READV, 	\
 	(int fd, const struct iovec *iov, int iovcnt),			\
 	(int, const struct iovec *, int),\
 	(fd, iov, iovcnt))



CVS commit: src/libexec/ld.elf_so

2011-01-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 25 12:25:44 UTC 2011

Modified Files:
src/libexec/ld.elf_so: rtld.h

Log Message:
Unbreak gdb by ensuring _rtld_debug_state is in the dynamic symbol table.

mmm 1 line diffs

mmm not breaking backwards compatibility for anything known/unknown or
public/private.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/libexec/ld.elf_so/rtld.h

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.h
diff -u src/libexec/ld.elf_so/rtld.h:1.99 src/libexec/ld.elf_so/rtld.h:1.100
--- src/libexec/ld.elf_so/rtld.h:1.99	Sun Jan 16 15:56:37 2011
+++ src/libexec/ld.elf_so/rtld.h	Tue Jan 25 12:25:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.h,v 1.99 2011/01/16 15:56:37 matt Exp $	 */
+/*	$NetBSD: rtld.h,v 1.100 2011/01/25 12:25:43 skrll Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -285,7 +285,7 @@
  __attribute__((__format__(__printf__,1,2)));
 void _rtld_die(void) __attribute__((__noreturn__));
 void *_rtld_objmain_sym(const char *);
-void _rtld_debug_state(void);
+__dso_public void _rtld_debug_state(void);
 void _rtld_linkmap_add(Obj_Entry *);
 void _rtld_linkmap_delete(Obj_Entry *);
 void _rtld_objlist_push_head(Objlist *, Obj_Entry *);



CVS commit: src/sys/arch/sgimips/hpc

2011-01-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 25 12:30:32 UTC 2011

Modified Files:
src/sys/arch/sgimips/hpc: hpcdma.c wdsc.c

Log Message:
Some KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sgimips/hpc/hpcdma.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sgimips/hpc/wdsc.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/sgimips/hpc/hpcdma.c
diff -u src/sys/arch/sgimips/hpc/hpcdma.c:1.19 src/sys/arch/sgimips/hpc/hpcdma.c:1.20
--- src/sys/arch/sgimips/hpc/hpcdma.c:1.19	Tue Jan 25 12:21:04 2011
+++ src/sys/arch/sgimips/hpc/hpcdma.c	Tue Jan 25 12:30:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcdma.c,v 1.19 2011/01/25 12:21:04 tsutsui Exp $	*/
+/*	$NetBSD: hpcdma.c,v 1.20 2011/01/25 12:30:32 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Wayne Knowles
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hpcdma.c,v 1.19 2011/01/25 12:21:04 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: hpcdma.c,v 1.20 2011/01/25 12:30:32 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -85,28 +85,27 @@
 	/*
 	 * Allocate a block of memory for dma chaining pointers
 	 */
-	if (bus_dmamem_alloc(sc-sc_dmat, allocsz, 0, 0,
-			 seg, 1, rseg, BUS_DMA_NOWAIT)) {
+	if (bus_dmamem_alloc(sc-sc_dmat, allocsz, 0, 0, seg, 1, rseg,
+	BUS_DMA_NOWAIT)) {
 		printf(: can't allocate sglist\n);
 		return;
 	}
 	/* Map pages into kernel memory */
 	if (bus_dmamem_map(sc-sc_dmat, seg, rseg, allocsz,
-			   (void **)sc-sc_desc_kva, BUS_DMA_NOWAIT)) {
+	(void **)sc-sc_desc_kva, BUS_DMA_NOWAIT)) {
 		printf(: can't map sglist\n);
 		bus_dmamem_free(sc-sc_dmat, seg, rseg);
 		return;
 	}
 
-	if (bus_dmamap_create(sc-sc_dmat, allocsz, 1 /*seg*/,
-			  allocsz, 0, BUS_DMA_WAITOK,
-			  sc-sc_dmamap) != 0) {
+	if (bus_dmamap_create(sc-sc_dmat, allocsz, 1 /*seg*/, allocsz, 0,
+	BUS_DMA_WAITOK, sc-sc_dmamap) != 0) {
 		printf(: failed to create dmamap\n);
 		return;
 	}
 
-	if (bus_dmamap_load(sc-sc_dmat, sc-sc_dmamap, sc-sc_desc_kva,
-			allocsz, NULL, BUS_DMA_NOWAIT)) {
+	if (bus_dmamap_load(sc-sc_dmat, sc-sc_dmamap,
+	sc-sc_desc_kva, allocsz, NULL, BUS_DMA_NOWAIT)) {
 		printf(: can't load sglist\n);
 		return;
 	}
@@ -142,18 +141,20 @@
 			hva-hpc3_hdd_ctl= segp-ds_len;
 			hva-hdd_descptr = hpa;
 		} else /* HPC 1/1.5 */ {
-			/* there doesn't seem to be any good way of doing this
-		   	   via an abstraction layer */
+			/*
+			 * there doesn't seem to be any good way of doing this
+		   	 * via an abstraction layer
+			 */
 			hva-hpc1_hdd_bufptr = segp-ds_addr;
 			hva-hpc1_hdd_ctl= segp-ds_len;
 			hva-hdd_descptr = hpa;
 		}
-		++hva; ++segp;
+		++hva;
+		++segp;
 	}
 
 	/* Work around HPC3 DMA bug */
-	if (sc-hpc-revision == 3)
-	{
+	if (sc-hpc-revision == 3) {
 		hva-hpc3_hdd_bufptr  = 0;
 		hva-hpc3_hdd_ctl = HPC3_HDD_CTL_EOCHAIN;
 		hva-hdd_descptr = 0;
@@ -199,8 +200,8 @@
 	uint32_t mode;
 
 	mode = bus_space_read_4(sc-sc_bst, sc-sc_bsh, sc-hpc-scsi0_ctl);
-	bus_space_write_4(sc-sc_bst, sc-sc_bsh, sc-hpc-scsi0_ctl,
-				mode | sc-hpc-scsi_dmactl_flush);
+	bus_space_write_4(sc-sc_bst, sc-sc_bsh,
+	sc-hpc-scsi0_ctl, mode | sc-hpc-scsi_dmactl_flush);
 
 	/* Wait for Active bit to drop */
 	while (bus_space_read_4(sc-sc_bst, sc-sc_bsh, sc-hpc-scsi0_ctl) 

Index: src/sys/arch/sgimips/hpc/wdsc.c
diff -u src/sys/arch/sgimips/hpc/wdsc.c:1.30 src/sys/arch/sgimips/hpc/wdsc.c:1.31
--- src/sys/arch/sgimips/hpc/wdsc.c:1.30	Tue Jan 25 12:14:02 2011
+++ src/sys/arch/sgimips/hpc/wdsc.c	Tue Jan 25 12:30:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdsc.c,v 1.30 2011/01/25 12:14:02 tsutsui Exp $	*/
+/*	$NetBSD: wdsc.c,v 1.31 2011/01/25 12:30:32 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Wayne Knowles
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wdsc.c,v 1.30 2011/01/25 12:14:02 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: wdsc.c,v 1.31 2011/01/25 12:30:32 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -77,19 +77,18 @@
 };
 
 
-void	wdsc_attach	(device_t, device_t, void *);
-int	wdsc_match	(device_t, cfdata_t, void *);
+int	wdsc_match(device_t, cfdata_t, void *);
+void	wdsc_attach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(wdsc, sizeof(struct wdsc_softc),
 wdsc_match, wdsc_attach, NULL, NULL);
 
-int	wdsc_dmasetup	(struct wd33c93_softc *, void ** ,size_t *,
-int, size_t *);
-int	wdsc_dmago	(struct wd33c93_softc *);
-void	wdsc_dmastop	(struct wd33c93_softc *);
-void	wdsc_reset	(struct wd33c93_softc *);
-int	wdsc_dmaintr	(void *);
-int	wdsc_scsiintr	(void *);
+int	wdsc_dmasetup(struct wd33c93_softc *, void ** ,size_t *, int, size_t *);
+int	wdsc_dmago(struct wd33c93_softc *);
+void	wdsc_dmastop(struct wd33c93_softc *);
+void	wdsc_reset(struct wd33c93_softc *);
+int	wdsc_dmaintr(void *);
+int	wdsc_scsiintr(void *);
 
 /*
  * Match for SCSI 

CVS commit: src/sys/arch/sgimips/hpc

2011-01-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 25 12:43:30 UTC 2011

Modified Files:
src/sys/arch/sgimips/hpc: if_sq.c sqvar.h

Log Message:
Split device_t/softc. Tested on Indy.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sgimips/hpc/if_sq.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sgimips/hpc/sqvar.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/sgimips/hpc/if_sq.c
diff -u src/sys/arch/sgimips/hpc/if_sq.c:1.38 src/sys/arch/sgimips/hpc/if_sq.c:1.39
--- src/sys/arch/sgimips/hpc/if_sq.c:1.38	Tue Jan 25 12:21:04 2011
+++ src/sys/arch/sgimips/hpc/if_sq.c	Tue Jan 25 12:43:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sq.c,v 1.38 2011/01/25 12:21:04 tsutsui Exp $	*/
+/*	$NetBSD: if_sq.c,v 1.39 2011/01/25 12:43:30 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Rafal K. Boni
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_sq.c,v 1.38 2011/01/25 12:21:04 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_sq.c,v 1.39 2011/01/25 12:43:30 tsutsui Exp $);
 
 
 #include sys/param.h
@@ -99,8 +99,8 @@
  #define SQ_DPRINTF(x)
 #endif
 
-static int	sq_match(struct device *, struct cfdata *, void *);
-static void	sq_attach(struct device *, struct device *, void *);
+static int	sq_match(device_t, cfdata_t, void *);
+static void	sq_attach(device_t, device_t, void *);
 static int	sq_init(struct ifnet *);
 static void	sq_start(struct ifnet *);
 static void	sq_stop(struct ifnet *, int);
@@ -118,7 +118,7 @@
 static void 	sq_dump_buffer(paddr_t addr, psize_t len);
 static void	sq_trace_dump(struct sq_softc *);
 
-CFATTACH_DECL(sq, sizeof(struct sq_softc),
+CFATTACH_DECL_NEW(sq, sizeof(struct sq_softc),
 sq_match, sq_attach, NULL, NULL);
 
 #defineETHER_PAD_LEN (ETHER_MIN_LEN - ETHER_CRC_LEN)
@@ -141,7 +141,7 @@
 #define SGI_OUI_2		0x69
 
 static int
-sq_match(struct device *parent, struct cfdata *cf, void *aux)
+sq_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct hpc_attach_args *ha = aux;
 
@@ -171,14 +171,15 @@
 }
 
 static void
-sq_attach(struct device *parent, struct device *self, void *aux)
+sq_attach(device_t parent, device_t self, void *aux)
 {
 	int i, err;
 	const char* macaddr;
-	struct sq_softc *sc = (void *)self;
+	struct sq_softc *sc = device_private(self);
 	struct hpc_attach_args *haa = aux;
 	struct ifnet *ifp = sc-sc_ethercom.ec_if;
 
+	sc-sc_dev = self;
 	sc-sc_hpct = haa-ha_st;
 	sc-hpc_regs = haa-hpc_regs;  /* HPC register definitions */
 
@@ -284,7 +285,7 @@
 	}
 
 	evcnt_attach_dynamic(sc-sq_intrcnt, EVCNT_TYPE_INTR, NULL,
-	  self-dv_xname, intr);
+	device_xname(self), intr);
 
 	if ((cpu_intr_establish(haa-ha_irq, IPL_NET, sq_intr, sc)) == NULL) {
 		printf(: unable to establish interrupt!\n);
@@ -310,10 +311,10 @@
 	printf(: SGI Seeq %s\n,
 	sc-sc_type == SQ_TYPE_80C03 ? 80c03 : 8003);
 
-	printf(%s: Ethernet address %s\n, sc-sc_dev.dv_xname,
-	   ether_sprintf(sc-sc_enaddr));
+	printf(%s: Ethernet address %s\n,
+	device_xname(self), ether_sprintf(sc-sc_enaddr));
 
-	strcpy(ifp-if_xname, sc-sc_dev.dv_xname);
+	strcpy(ifp-if_xname, device_xname(self));
 	ifp-if_softc = sc;
 	ifp-if_mtu = ETHERMTU;
 	ifp-if_init = sq_init;
@@ -575,14 +576,15 @@
 			MGETHDR(m, M_DONTWAIT, MT_DATA);
 			if (m == NULL) {
 printf(%s: unable to allocate Tx mbuf\n,
-sc-sc_dev.dv_xname);
+device_xname(sc-sc_dev));
 break;
 			}
 			if (m0-m_pkthdr.len  MHLEN) {
 MCLGET(m, M_DONTWAIT);
 if ((m-m_flags  M_EXT) == 0) {
 	printf(%s: unable to allocate Tx 
-	cluster\n, sc-sc_dev.dv_xname);
+	cluster\n,
+	device_xname(sc-sc_dev));
 	m_freem(m);
 	break;
 }
@@ -599,7 +601,8 @@
 			if ((err = bus_dmamap_load_mbuf(sc-sc_dmat, dmamap,
 		m, BUS_DMA_NOWAIT)) != 0) {
 printf(%s: unable to load Tx buffer, 
-error = %d\n, sc-sc_dev.dv_xname, err);
+error = %d\n,
+device_xname(sc-sc_dev), err);
 break;
 			}
 		}
@@ -678,7 +681,8 @@
 			sc-sc_txdesc[lasttx].hpc1_hdd_ctl |=
 			HPC1_HDD_CTL_EOPACKET;
 
-		SQ_DPRINTF((%s: transmit %d-%d, len %d\n, sc-sc_dev.dv_xname,
+		SQ_DPRINTF((%s: transmit %d-%d, len %d\n,
+		   device_xname(sc-sc_dev),
 		   sc-sc_nexttx, lasttx,
 		   totlen));
 
@@ -720,7 +724,7 @@
 
 	if (sc-sc_nfreetx != ofree) {
 		SQ_DPRINTF((%s: %d packets enqueued, first %d, INTR on %d\n,
-			sc-sc_dev.dv_xname, lasttx - firsttx + 1,
+			device_xname(sc-sc_dev), lasttx - firsttx + 1,
 			firsttx, lasttx));
 
 		/*
@@ -847,7 +851,7 @@
 
 	status = sq_hpc_read(sc, sc-hpc_regs-enetx_ctl);
 	log(LOG_ERR, %s: device timeout (prev %d, next %d, free %d, 
-		 status %08x)\n, sc-sc_dev.dv_xname, sc-sc_prevtx,
+		 status %08x)\n, device_xname(sc-sc_dev), sc-sc_prevtx,
    sc-sc_nexttx, sc-sc_nfreetx, status);
 
 	sq_trace_dump(sc);
@@ -882,7 +886,7 @@
 	

CVS commit: src/lib/librumphijack

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 25 12:53:45 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
the usual fun for WARNS=4

signed,
  unsigned


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/librumphijack/hijack.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/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.18 src/lib/librumphijack/hijack.c:1.19
--- src/lib/librumphijack/hijack.c:1.18	Tue Jan 25 12:21:36 2011
+++ src/lib/librumphijack/hijack.c	Tue Jan 25 12:53:45 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.18 2011/01/25 12:21:36 pooka Exp $	*/
+/*  $NetBSD: hijack.c,v 1.19 2011/01/25 12:53:45 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hijack.c,v 1.18 2011/01/25 12:21:36 pooka Exp $);
+__RCSID($NetBSD: hijack.c,v 1.19 2011/01/25 12:53:45 pooka Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -187,7 +187,7 @@
 	int (*rumpcinit)(void);
 	void **rumpcdlsym;
 	void *hand;
-	int i, j;
+	unsigned i, j;
 
 	hand = dlopen(librumpclient.so, RTLD_LAZY|RTLD_GLOBAL);
 	if (!hand)
@@ -448,7 +448,8 @@
 {
 	struct pollfd *pfds;
 	struct timespec ts, *tsp = NULL;
-	nfds_t i, j, realnfds;
+	nfds_t realnfds;
+	int i, j;
 	int rv, incr;
 
 	DPRINTF((select\n));
@@ -528,7 +529,7 @@
 	}
 
 	/* and then plug in the results */
-	for (i = 0; i  realnfds; i++) {
+	for (i = 0; i  (int)realnfds; i++) {
 		if (readfds) {
 			if (pfds[i].revents  POLLIN) {
 FD_SET(pfds[i].fd, readfds);



CVS commit: src

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 25 12:56:26 UTC 2011

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/librumphijack: Makefile
Added Files:
src/lib/librumphijack: rumphijack.3

Log Message:
manual page for rumphijack


To generate a diff of this commit:
cvs rdiff -u -r1.1575 -r1.1576 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.3 -r1.4 src/lib/librumphijack/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/librumphijack/rumphijack.3

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.1575 src/distrib/sets/lists/comp/mi:1.1576
--- src/distrib/sets/lists/comp/mi:1.1575	Thu Jan 20 18:47:21 2011
+++ src/distrib/sets/lists/comp/mi	Tue Jan 25 12:56:25 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1575 2011/01/20 18:47:21 pooka Exp $
+#	$NetBSD: mi,v 1.1576 2011/01/25 12:56:25 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -8056,6 +8056,7 @@
 ./usr/share/man/cat3/rresvport_af.0		comp-c-catman		.cat
 ./usr/share/man/cat3/rsa.0			comp-obsolete		obsolete
 ./usr/share/man/cat3/rump.0			comp-c-catman		.cat
+./usr/share/man/cat3/rumphijack.0			comp-c-catman		.cat
 ./usr/share/man/cat3/rump_etfs.0			comp-c-catman		.cat
 ./usr/share/man/cat3/rump_lwproc.0			comp-c-catman		.cat
 ./usr/share/man/cat3/rumpuser.0			comp-c-catman		.cat
@@ -14057,6 +14058,7 @@
 ./usr/share/man/html3/rresvport.html		comp-c-htmlman		html
 ./usr/share/man/html3/rresvport_af.html		comp-c-htmlman		html
 ./usr/share/man/html3/rump.html			comp-c-htmlman		html
+./usr/share/man/html3/rumphijack.html			comp-c-htmlman		html
 ./usr/share/man/html3/rump_etfs.html			comp-c-htmlman		html
 ./usr/share/man/html3/rump_lwproc.html			comp-c-htmlman		html
 ./usr/share/man/html3/rumpuser.html		comp-c-htmlman		html
@@ -20064,6 +20066,7 @@
 ./usr/share/man/man3/rresvport_af.3		comp-c-man		.man
 ./usr/share/man/man3/rsa.3			comp-obsolete		obsolete
 ./usr/share/man/man3/rump.3			comp-c-man		.man
+./usr/share/man/man3/rumphijack.3			comp-c-man		.man
 ./usr/share/man/man3/rump_etfs.3			comp-c-man		.man
 ./usr/share/man/man3/rump_lwproc.3			comp-c-man		.man
 ./usr/share/man/man3/rumpuser.3			comp-c-man		.man

Index: src/lib/librumphijack/Makefile
diff -u src/lib/librumphijack/Makefile:1.3 src/lib/librumphijack/Makefile:1.4
--- src/lib/librumphijack/Makefile:1.3	Tue Jan 18 19:53:23 2011
+++ src/lib/librumphijack/Makefile	Tue Jan 25 12:56:25 2011
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile,v 1.3 2011/01/18 19:53:23 pooka Exp $
+#	$NetBSD: Makefile,v 1.4 2011/01/25 12:56:25 pooka Exp $
 #
 
 LIB=		rumphijack
 NOSTATICLIB=	dlfun
 NOPROFILE=	dlfun
 LIBDPLIBS+=	pthread ${.CURDIR}/../libpthread
+MAN=		rumphijack.3
 
 SRCS=		hijack.c
 

Added files:

Index: src/lib/librumphijack/rumphijack.3
diff -u /dev/null src/lib/librumphijack/rumphijack.3:1.1
--- /dev/null	Tue Jan 25 12:56:26 2011
+++ src/lib/librumphijack/rumphijack.3	Tue Jan 25 12:56:25 2011
@@ -0,0 +1,62 @@
+.\ $NetBSD: rumphijack.3,v 1.1 2011/01/25 12:56:25 pooka Exp $
+.\
+.\ Copyright (c) 2011 Antti Kantee.  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 materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 January 25, 2011
+.Dt RUMPHIJACK 3
+.Os
+.Sh NAME
+.Nm rumphijack
+.Nd System call hijack library
+.Sh LIBRARY
+used by
+.Xr ld.so 1
+.Sh DESCRIPTION
+The
+.Xr ld.so 1
+runtime linker can be instructed to load
+.Nm
+between the main object and other libraries.
+This enables
+.Nm
+to capture and redirect system call requests to a rump kernel instead
+of the host kernel.
+.Pp
+Currently
+.Nm
+supports only TCP/IP related system calls.
+The set of 

CVS commit: src/lib/librumphijack

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 25 12:56:58 UTC 2011

Modified Files:
src/lib/librumphijack: Makefile

Log Message:
enable WARNS=4


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/librumphijack/Makefile

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

Modified files:

Index: src/lib/librumphijack/Makefile
diff -u src/lib/librumphijack/Makefile:1.4 src/lib/librumphijack/Makefile:1.5
--- src/lib/librumphijack/Makefile:1.4	Tue Jan 25 12:56:25 2011
+++ src/lib/librumphijack/Makefile	Tue Jan 25 12:56:57 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2011/01/25 12:56:25 pooka Exp $
+#	$NetBSD: Makefile,v 1.5 2011/01/25 12:56:57 pooka Exp $
 #
 
 LIB=		rumphijack
@@ -11,6 +11,8 @@
 
 CPPFLAGS+=	-D_DIAGNOSTIC -D_REENTRANT
 
+WARNS=		4
+
 #DBG=-g
 #NOGCCERROR=1
 



CVS commit: src/sys/arch/sgimips/hpc

2011-01-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 25 13:12:40 UTC 2011

Modified Files:
src/sys/arch/sgimips/hpc: if_sq.c sqvar.h

Log Message:
KNF and misc cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/sgimips/hpc/if_sq.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sgimips/hpc/sqvar.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/sgimips/hpc/if_sq.c
diff -u src/sys/arch/sgimips/hpc/if_sq.c:1.39 src/sys/arch/sgimips/hpc/if_sq.c:1.40
--- src/sys/arch/sgimips/hpc/if_sq.c:1.39	Tue Jan 25 12:43:30 2011
+++ src/sys/arch/sgimips/hpc/if_sq.c	Tue Jan 25 13:12:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sq.c,v 1.39 2011/01/25 12:43:30 tsutsui Exp $	*/
+/*	$NetBSD: if_sq.c,v 1.40 2011/01/25 13:12:39 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Rafal K. Boni
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_sq.c,v 1.39 2011/01/25 12:43:30 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_sq.c,v 1.40 2011/01/25 13:12:39 tsutsui Exp $);
 
 
 #include sys/param.h
@@ -114,14 +114,14 @@
 static void	sq_txring_hpc1(struct sq_softc *);
 static void	sq_txring_hpc3(struct sq_softc *);
 static void	sq_reset(struct sq_softc *);
-static int 	sq_add_rxbuf(struct sq_softc *, int);
-static void 	sq_dump_buffer(paddr_t addr, psize_t len);
+static int	sq_add_rxbuf(struct sq_softc *, int);
+static void	sq_dump_buffer(paddr_t addr, psize_t len);
 static void	sq_trace_dump(struct sq_softc *);
 
 CFATTACH_DECL_NEW(sq, sizeof(struct sq_softc),
 sq_match, sq_attach, NULL, NULL);
 
-#defineETHER_PAD_LEN (ETHER_MIN_LEN - ETHER_CRC_LEN)
+#define ETHER_PAD_LEN (ETHER_MIN_LEN - ETHER_CRC_LEN)
 
 #define sq_seeq_read(sc, off) \
 	bus_space_read_1(sc-sc_regt, sc-sc_regh, off)
@@ -129,9 +129,9 @@
 	bus_space_write_1(sc-sc_regt, sc-sc_regh, off, val)
 
 #define sq_hpc_read(sc, off) \
-	bus_space_read_4(sc-sc_hpct, sc-sc_hpch, off)	
+	bus_space_read_4(sc-sc_hpct, sc-sc_hpch, off)
 #define sq_hpc_write(sc, off, val) \
-	bus_space_write_4(sc-sc_hpct, sc-sc_hpch, off, val)	
+	bus_space_write_4(sc-sc_hpct, sc-sc_hpch, off, val)
 
 /* MAC address offset for non-onboard implementations */
 #define SQ_HPC_EEPROM_ENADDR	250
@@ -154,20 +154,20 @@
 		ha-ha_devoff + (SEEQ_TXSTAT  2));
 
 		if (platform.badaddr((void *)reset, sizeof(reset)))
-			return (0);
+			return 0;
 
 		*(volatile uint32_t *)reset = 0x1;
 		delay(20);
 		*(volatile uint32_t *)reset = 0x0;
 
 		if (platform.badaddr((void *)txstat, sizeof(txstat)))
-			return (0);
+			return 0;
 
 		if ((*(volatile uint32_t *)txstat  0xff) == TXSTAT_OLDNEW)
-			return (1);
+			return 1;
 	}
 
-	return (0);
+	return 0;
 }
 
 static void
@@ -184,18 +184,16 @@
 	sc-hpc_regs = haa-hpc_regs;  /* HPC register definitions */
 
 	if ((err = bus_space_subregion(haa-ha_st, haa-ha_sh,
-   haa-ha_dmaoff,
-   sc-hpc_regs-enet_regs_size,
-   sc-sc_hpch)) != 0) {
+	haa-ha_dmaoff, sc-hpc_regs-enet_regs_size,
+	sc-sc_hpch)) != 0) {
 		printf(: unable to map HPC DMA registers, error = %d\n, err);
 		goto fail_0;
 	}
 
 	sc-sc_regt = haa-ha_st;
 	if ((err = bus_space_subregion(haa-ha_st, haa-ha_sh,
-   haa-ha_devoff,
-   sc-hpc_regs-enet_devregs_size,
-   sc-sc_regh)) != 0) {
+	haa-ha_devoff, sc-hpc_regs-enet_devregs_size,
+	sc-sc_regh)) != 0) {
 		printf(: unable to map Seeq registers, error = %d\n, err);
 		goto fail_0;
 	}
@@ -203,33 +201,32 @@
 	sc-sc_dmat = haa-ha_dmat;
 
 	if ((err = bus_dmamem_alloc(sc-sc_dmat, sizeof(struct sq_control),
-PAGE_SIZE, PAGE_SIZE, sc-sc_cdseg,
-1, sc-sc_ncdseg, BUS_DMA_NOWAIT)) != 0) {
+	PAGE_SIZE, PAGE_SIZE, sc-sc_cdseg, 1, sc-sc_ncdseg,
+	BUS_DMA_NOWAIT)) != 0) {
 		printf(: unable to allocate control data, error = %d\n, err);
 		goto fail_0;
 	}
 
 	if ((err = bus_dmamem_map(sc-sc_dmat, sc-sc_cdseg, sc-sc_ncdseg,
-  sizeof(struct sq_control),
-  (void **)sc-sc_control,
-  BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) {
+	sizeof(struct sq_control), (void **)sc-sc_control,
+	BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) {
 		printf(: unable to map control data, error = %d\n, err);
 		goto fail_1;
 	}
 
-	if ((err = bus_dmamap_create(sc-sc_dmat, sizeof(struct sq_control),
- 1, sizeof(struct sq_control), PAGE_SIZE,
- BUS_DMA_NOWAIT, sc-sc_cdmap)) != 0) {
+	if ((err = bus_dmamap_create(sc-sc_dmat,
+	sizeof(struct sq_control), 1, sizeof(struct sq_control), PAGE_SIZE,
+	BUS_DMA_NOWAIT, sc-sc_cdmap)) != 0) {
 		printf(: unable to create DMA map for control data, error 
-			= %d\n, err);
+		= %d\n, err);
 		goto fail_2;
 	}
 
-	if ((err = bus_dmamap_load(sc-sc_dmat, sc-sc_cdmap, sc-sc_control,
-   sizeof(struct sq_control),
-   NULL, BUS_DMA_NOWAIT)) != 0) {
+	if ((err = bus_dmamap_load(sc-sc_dmat, sc-sc_cdmap,
+	sc-sc_control, sizeof(struct 

CVS commit: src/sys/arch/sgimips/hpc

2011-01-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 25 13:22:06 UTC 2011

Modified Files:
src/sys/arch/sgimips/hpc: hpc.c

Log Message:
Split device_t/softc. Tested on Indy.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sgimips/hpc/hpc.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/sgimips/hpc/hpc.c
diff -u src/sys/arch/sgimips/hpc/hpc.c:1.64 src/sys/arch/sgimips/hpc/hpc.c:1.65
--- src/sys/arch/sgimips/hpc/hpc.c:1.64	Tue Jan 25 12:21:04 2011
+++ src/sys/arch/sgimips/hpc/hpc.c	Tue Jan 25 13:22:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpc.c,v 1.64 2011/01/25 12:21:04 tsutsui Exp $	*/
+/*	$NetBSD: hpc.c,v 1.65 2011/01/25 13:22:05 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hpc.c,v 1.64 2011/01/25 12:21:04 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: hpc.c,v 1.65 2011/01/25 13:22:05 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -217,7 +217,7 @@
 };
 
 struct hpc_softc {
-	struct device 		sc_dev;
+	device_t		sc_dev;
 
 	bus_addr_t		sc_base;
 
@@ -351,14 +351,13 @@
 
 static int powerintr_established;
 
-static int	hpc_match(struct device *, struct cfdata *, void *);
-static void	hpc_attach(struct device *, struct device *, void *);
+static int	hpc_match(device_t, cfdata_t, void *);
+static void	hpc_attach(device_t, device_t, void *);
 static int	hpc_print(void *, const char *);
 
 static int	hpc_revision(struct hpc_softc *, struct gio_attach_args *);
 
-static int	hpc_submatch(struct device *, struct cfdata *,
-		 const int *, void *);
+static int	hpc_submatch(device_t, cfdata_t, const int *, void *);
 
 //static int	hpc_power_intr(void *);
 
@@ -370,11 +369,11 @@
 static int	hpc_read_eeprom(int, bus_space_tag_t, bus_space_handle_t,
 		uint8_t *, size_t);
 
-CFATTACH_DECL(hpc, sizeof(struct hpc_softc),
+CFATTACH_DECL_NEW(hpc, sizeof(struct hpc_softc),
 hpc_match, hpc_attach, NULL, NULL);
 
 static int
-hpc_match(struct device *parent, struct cfdata *cf, void *aux)
+hpc_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct gio_attach_args* ga = aux;
 
@@ -390,9 +389,9 @@
 }
 
 static void
-hpc_attach(struct device *parent, struct device *self, void *aux)
+hpc_attach(device_t parent, device_t self, void *aux)
 {
-	struct hpc_softc *sc = (struct hpc_softc *)self;
+	struct hpc_softc *sc = device_private(self);
 	struct gio_attach_args* ga = aux;
 	struct hpc_attach_args ha;
 	const struct hpc_device *hd;
@@ -401,6 +400,8 @@
 	int isioplus;
 	int sysmask;
 
+	sc-sc_dev = self;
+
 #ifdef BLINK
 	callout_init(hpc_blink_ch, 0);
 #endif
@@ -467,11 +468,12 @@
 		if (gio_arb_config(arb_slot, GIO_ARB_LB | GIO_ARB_MST |
 		GIO_ARB_64BIT | GIO_ARB_HPC2_64BIT)) {
 			printf(%s: failed to configure GIO bus arbiter\n,
-			sc-sc_dev.dv_xname);
+			device_xname(sc-sc_dev));
 			return;
 		}
 
-		printf(%s: using EXP%d's DMA channel\n, sc-sc_dev.dv_xname,
+		printf(%s: using EXP%d's DMA channel\n,
+		device_xname(sc-sc_dev),
 		(arb_slot == GIO_SLOT_EXP0) ? 0 : 1);
 
 		bus_space_write_4(ga-ga_iot, ga-ga_ioh,
@@ -491,7 +493,7 @@
 
 		if (gio_arb_config(arb_slot, GIO_ARB_RT | GIO_ARB_MST)) {
 			printf(%s: failed to configure GIO bus arbiter\n,
-			sc-sc_dev.dv_xname);
+			device_xname(sc-sc_dev));
 			return;
 		}
 	}
@@ -681,9 +683,9 @@
 
 #if defined(BLINK)
 static void
-hpc_blink(void *self)
+hpc_blink(void *arg)
 {
-	struct hpc_softc *sc = (struct hpc_softc *) self;
+	struct hpc_softc *sc = arg;
 	register int	s;
 	int	value;
 



CVS commit: src/lib

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 25 14:05:43 UTC 2011

Modified Files:
src/lib/librump: rump_sp.7
src/lib/librumphijack: rumphijack.3

Log Message:
Use rump_sp consistently in chapter 7

nothing gets past the wizd, nothing.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/librump/rump_sp.7
cvs rdiff -u -r1.1 -r1.2 src/lib/librumphijack/rumphijack.3

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

Modified files:

Index: src/lib/librump/rump_sp.7
diff -u src/lib/librump/rump_sp.7:1.2 src/lib/librump/rump_sp.7:1.3
--- src/lib/librump/rump_sp.7:1.2	Thu Dec 16 17:17:07 2010
+++ src/lib/librump/rump_sp.7	Tue Jan 25 14:05:43 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: rump_sp.7,v 1.2 2010/12/16 17:17:07 wiz Exp $
+.\ $NetBSD: rump_sp.7,v 1.3 2011/01/25 14:05:43 pooka Exp $
 .\
 .\ Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\
@@ -24,7 +24,7 @@
 .\ SUCH DAMAGE.
 .\
 .Dd December 16, 2010
-.Dt RUMP_SP 3
+.Dt RUMP_SP 7
 .Os
 .Sh NAME
 .Nm rump_sp

Index: src/lib/librumphijack/rumphijack.3
diff -u src/lib/librumphijack/rumphijack.3:1.1 src/lib/librumphijack/rumphijack.3:1.2
--- src/lib/librumphijack/rumphijack.3:1.1	Tue Jan 25 12:56:25 2011
+++ src/lib/librumphijack/rumphijack.3	Tue Jan 25 14:05:42 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: rumphijack.3,v 1.1 2011/01/25 12:56:25 pooka Exp $
+.\ $NetBSD: rumphijack.3,v 1.2 2011/01/25 14:05:42 pooka Exp $
 .\
 .\ Copyright (c) 2011 Antti Kantee.  All rights reserved.
 .\
@@ -59,4 +59,4 @@
 .Xr ld.so 1 ,
 .Xr rump_server 1 ,
 .Xr rump 3 ,
-.Xr rump_sp 3
+.Xr rump_sp 7



CVS commit: src/sys/uvm

2011-01-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 25 17:22:44 UTC 2011

Modified Files:
src/sys/uvm: uvm_pglist.c

Log Message:
When starting the second pass, don't continue the for loop but instead
just test try exceeding limit.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.58 src/sys/uvm/uvm_pglist.c:1.59
--- src/sys/uvm/uvm_pglist.c:1.58	Mon Jan 24 22:54:01 2011
+++ src/sys/uvm/uvm_pglist.c	Tue Jan 25 17:22:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.58 2011/01/24 22:54:01 matt Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.59 2011/01/25 17:22:43 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.58 2011/01/24 22:54:01 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_pglist.c,v 1.59 2011/01/25 17:22:43 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -391,7 +391,7 @@
 		return 0;
 
 	for (;; try++, pg++) {
-		if (try = limit) {
+		while (try = limit) {
 			if (ps-start_hint == 0 || second_pass) {
 try = limit - 1;
 break;
@@ -400,7 +400,6 @@
 			try = max(low, ps-avail_start);
 			limit = min(limit, ps-avail_start + ps-start_hint);
 			pg = ps-pgs[try - ps-start];
-			continue;
 		}
 #if defined(DEBUG)
 		{



CVS commit: src/lib/librumphijack

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 25 17:37:01 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
fix compilation on -current


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/librumphijack/hijack.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/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.19 src/lib/librumphijack/hijack.c:1.20
--- src/lib/librumphijack/hijack.c:1.19	Tue Jan 25 12:53:45 2011
+++ src/lib/librumphijack/hijack.c	Tue Jan 25 17:37:00 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.19 2011/01/25 12:53:45 pooka Exp $	*/
+/*  $NetBSD: hijack.c,v 1.20 2011/01/25 17:37:00 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hijack.c,v 1.19 2011/01/25 12:53:45 pooka Exp $);
+__RCSID($NetBSD: hijack.c,v 1.20 2011/01/25 17:37:00 pooka Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -85,9 +85,10 @@
 #define LIBCPOLL __poll50
 #endif
 
-int SELECT(int, fd_set *, fd_set *, fd_set *, struct timeval *);
-int POLLTS(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
-int POLL(struct pollfd *, nfds_t, int);
+int LIBCSELECT(int, fd_set *, fd_set *, fd_set *, struct timeval *);
+int LIBCPOLLTS(struct pollfd *, nfds_t,
+	   const struct timespec *, const sigset_t *);
+int LIBCPOLL(struct pollfd *, nfds_t, int);
 
 #define S(a) __STRING(a)
 struct sysnames {



CVS commit: src/lib/libpthread/arch

2011-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 25 19:12:07 UTC 2011

Modified Files:
src/lib/libpthread/arch/alpha: pthread_md.h
src/lib/libpthread/arch/arm: pthread_md.h
src/lib/libpthread/arch/hppa: pthread_md.h
src/lib/libpthread/arch/i386: pthread_md.h
src/lib/libpthread/arch/m68k: pthread_md.h
src/lib/libpthread/arch/mips: pthread_md.h
src/lib/libpthread/arch/powerpc: pthread_md.h
src/lib/libpthread/arch/powerpc64: pthread_md.h
src/lib/libpthread/arch/sh3: pthread_md.h
src/lib/libpthread/arch/sparc: pthread_md.h
src/lib/libpthread/arch/sparc64: pthread_md.h
src/lib/libpthread/arch/vax: pthread_md.h
src/lib/libpthread/arch/x86_64: pthread_md.h

Log Message:
make pthread__sp unsigned long.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libpthread/arch/alpha/pthread_md.h
cvs rdiff -u -r1.5 -r1.6 src/lib/libpthread/arch/arm/pthread_md.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/arch/hppa/pthread_md.h
cvs rdiff -u -r1.17 -r1.18 src/lib/libpthread/arch/i386/pthread_md.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/arch/m68k/pthread_md.h
cvs rdiff -u -r1.8 -r1.9 src/lib/libpthread/arch/mips/pthread_md.h
cvs rdiff -u -r1.6 -r1.7 src/lib/libpthread/arch/powerpc/pthread_md.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libpthread/arch/powerpc64/pthread_md.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/arch/sh3/pthread_md.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/arch/sparc/pthread_md.h
cvs rdiff -u -r1.6 -r1.7 src/lib/libpthread/arch/sparc64/pthread_md.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/arch/vax/pthread_md.h
cvs rdiff -u -r1.11 -r1.12 src/lib/libpthread/arch/x86_64/pthread_md.h

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

Modified files:

Index: src/lib/libpthread/arch/alpha/pthread_md.h
diff -u src/lib/libpthread/arch/alpha/pthread_md.h:1.6 src/lib/libpthread/arch/alpha/pthread_md.h:1.7
--- src/lib/libpthread/arch/alpha/pthread_md.h:1.6	Sat May 16 18:20:40 2009
+++ src/lib/libpthread/arch/alpha/pthread_md.h	Tue Jan 25 14:12:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_md.h,v 1.6 2009/05/16 22:20:40 ad Exp $	*/
+/*	$NetBSD: pthread_md.h,v 1.7 2011/01/25 19:12:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,10 +34,10 @@
 
 #define	PTHREAD__ASM_RASOPS
 
-static inline long
+static inline unsigned long
 pthread__sp(void)
 {
-	long ret;
+	unsigned long ret;
 
 	__asm(mov $30, %0 : =r (ret));
 

Index: src/lib/libpthread/arch/arm/pthread_md.h
diff -u src/lib/libpthread/arch/arm/pthread_md.h:1.5 src/lib/libpthread/arch/arm/pthread_md.h:1.6
--- src/lib/libpthread/arch/arm/pthread_md.h:1.5	Sat May 16 18:20:40 2009
+++ src/lib/libpthread/arch/arm/pthread_md.h	Tue Jan 25 14:12:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_md.h,v 1.5 2009/05/16 22:20:40 ad Exp $	*/
+/*	$NetBSD: pthread_md.h,v 1.6 2011/01/25 19:12:04 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -38,10 +38,10 @@
 #ifndef _LIB_PTHREAD_ARM_MD_H
 #define	_LIB_PTHREAD_ARM_MD_H
 
-static inline long
+static inline unsigned long
 pthread__sp(void)
 {
-	long ret;
+	unsigned long ret;
 
 	__asm volatile(mov %0, sp
 		: =r (ret));

Index: src/lib/libpthread/arch/hppa/pthread_md.h
diff -u src/lib/libpthread/arch/hppa/pthread_md.h:1.7 src/lib/libpthread/arch/hppa/pthread_md.h:1.8
--- src/lib/libpthread/arch/hppa/pthread_md.h:1.7	Sat May 16 18:20:40 2009
+++ src/lib/libpthread/arch/hppa/pthread_md.h	Tue Jan 25 14:12:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_md.h,v 1.7 2009/05/16 22:20:40 ad Exp $	*/
+/*	$NetBSD: pthread_md.h,v 1.8 2011/01/25 19:12:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -36,10 +36,10 @@
 
 #define	PTHREAD__ASM_RASOPS
 
-static inline long
+static inline unsigned long
 pthread__sp(void)
 {
-	register long sp __asm(r30);
+	register unsigned long sp __asm(r30);
 
 	return sp;
 }

Index: src/lib/libpthread/arch/i386/pthread_md.h
diff -u src/lib/libpthread/arch/i386/pthread_md.h:1.17 src/lib/libpthread/arch/i386/pthread_md.h:1.18
--- src/lib/libpthread/arch/i386/pthread_md.h:1.17	Sat May 16 18:20:40 2009
+++ src/lib/libpthread/arch/i386/pthread_md.h	Tue Jan 25 14:12:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_md.h,v 1.17 2009/05/16 22:20:40 ad Exp $	*/
+/*	$NetBSD: pthread_md.h,v 1.18 2011/01/25 19:12:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007, 2008 The NetBSD Foundation, Inc.
@@ -35,10 +35,10 @@
 #include sys/ucontext.h
 #include ucontext.h
 
-static inline long
+static inline unsigned long
 pthread__sp(void)
 {
-	long ret;
+	unsigned long ret;
 	__asm(movl %%esp, %0 : =g (ret));
 
 	return ret;

Index: src/lib/libpthread/arch/m68k/pthread_md.h
diff -u src/lib/libpthread/arch/m68k/pthread_md.h:1.7 src/lib/libpthread/arch/m68k/pthread_md.h:1.8
--- src/lib/libpthread/arch/m68k/pthread_md.h:1.7	Sat May 16 18:20:41 2009

CVS commit: src/lib/libpthread

2011-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 25 19:13:26 UTC 2011

Modified Files:
src/lib/libpthread: pthread_cancelstub.c

Log Message:
Fix SSP build.
XXX: This is gross.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libpthread/pthread_cancelstub.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/libpthread/pthread_cancelstub.c
diff -u src/lib/libpthread/pthread_cancelstub.c:1.28 src/lib/libpthread/pthread_cancelstub.c:1.29
--- src/lib/libpthread/pthread_cancelstub.c:1.28	Fri Aug  6 01:25:46 2010
+++ src/lib/libpthread/pthread_cancelstub.c	Tue Jan 25 14:13:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cancelstub.c,v 1.28 2010/08/06 05:25:46 christos Exp $	*/
+/*	$NetBSD: pthread_cancelstub.c,v 1.29 2011/01/25 19:13:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_cancelstub.c,v 1.28 2010/08/06 05:25:46 christos Exp $);
+__RCSID($NetBSD: pthread_cancelstub.c,v 1.29 2011/01/25 19:13:26 christos Exp $);
 
 #ifndef lint
 
@@ -59,7 +59,12 @@
 #include mqueue.h
 #include poll.h
 #include stdarg.h
+
+#define read _read
 #include unistd.h
+#undef read
+ssize_t  read(int, void *, size_t);
+
 
 #include signal.h
 #include sys/mman.h
@@ -468,16 +473,16 @@
 	return retval;
 }
 
-#ifdef _FORTIFY_SOURCE
-#undef read
-#endif
-
 ssize_t
 read(int d, void *buf, size_t nbytes)
 {
 	ssize_t retval;
 	pthread_t self;
 
+#ifdef __ssp_check
+	__ssp_check(buf, nbytes, __ssp_bos0);
+#endif
+
 	self = pthread__self();
 	TESTCANCEL(self);
 	retval = _sys_read(d, buf, nbytes);



CVS commit: src/include/ssp

2011-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 25 19:13:45 UTC 2011

Modified Files:
src/include/ssp: ssp.h

Log Message:
proved an __ssp_check macro.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/include/ssp/ssp.h

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

Modified files:

Index: src/include/ssp/ssp.h
diff -u src/include/ssp/ssp.h:1.6 src/include/ssp/ssp.h:1.7
--- src/include/ssp/ssp.h:1.6	Wed Jan 19 21:58:17 2011
+++ src/include/ssp/ssp.h	Tue Jan 25 14:13:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssp.h,v 1.6 2011/01/20 02:58:17 christos Exp $	*/
+/*	$NetBSD: ssp.h,v 1.7 2011/01/25 19:13:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -54,12 +54,14 @@
 #define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL  1)
 #define __ssp_bos0(ptr) __builtin_object_size(ptr, 0)
 
+#define __ssp_check(buf, len, bos) \
+	if (bos(buf) != (size_t)-1  len  bos(buf)) \
+		__chk_fail()
 #define __ssp_redirect_raw(rtype, fun, args, call, bos) \
 rtype __ssp_weak_name(fun) args; \
 __ssp_inline rtype fun args; \
 __ssp_inline rtype fun args { \
-	if (bos(__buf) != (size_t)-1  __len  bos(__buf)) \
-		__chk_fail(); \
+	__ssp_check(__buf, __len, bos); \
 	return __ssp_weak_name(fun) call; \
 }
 



CVS commit: src/sys/dev/wscons

2011-01-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jan 25 20:28:21 UTC 2011

Modified Files:
src/sys/dev/wscons: files.wscons wsdisplay_vcons.c wsdisplay_vconsvar.h

Log Message:
Add support for asynchronous drawing in vcons.
This is not finished but good enough for others to play with, enable with
options VCONS_DRAW_ASYNC
With this all drawing operations will be posted to a ring buffer instead
of being run directly, and run by a kernel thread. This avoids having to wait
for drawing operations to finish with the kernel lock held ( to a degree at
least ) and scrolling a (slow) framebuffer console should not disrupt other
operations anymore.
Problems:
- we need to switch back to synchronous operations when panicing or entering
  ddb, also re-enable async drawing when leaving ddb
- there are still occasional glitches
tested on an SS20 with cg14 and cg6 for dumb and accelerated cases


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/wscons/files.wscons
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wscons/wsdisplay_vconsvar.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/wscons/files.wscons
diff -u src/sys/dev/wscons/files.wscons:1.41 src/sys/dev/wscons/files.wscons:1.42
--- src/sys/dev/wscons/files.wscons:1.41	Thu Aug 20 02:01:08 2009
+++ src/sys/dev/wscons/files.wscons	Tue Jan 25 20:28:21 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.41 2009/08/20 02:01:08 macallan Exp $
+# $NetBSD: files.wscons,v 1.42 2011/01/25 20:28:21 macallan Exp $
 
 #
 # Workstation Console glue; attaches frame buffer to emulator  keyboard,
@@ -75,4 +75,4 @@
 # generic virtual console support on bitmapped framebuffers
 file	dev/wscons/wsdisplay_vcons.c		vcons
 file	dev/wscons/wsdisplay_vcons_util.c	vcons
-defflag	opt_vcons.h		VCONS_SWITCH_ASYNC
+defflag	opt_vcons.h		VCONS_DRAW_ASYNC VCONS_ASYNC_DEBUG

Index: src/sys/dev/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.18 src/sys/dev/wscons/wsdisplay_vcons.c:1.19
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.18	Tue Sep 21 03:33:14 2010
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Tue Jan 25 20:28:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.18 2010/09/21 03:33:14 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.19 2011/01/25 20:28:21 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.18 2010/09/21 03:33:14 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.19 2011/01/25 20:28:21 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -42,6 +42,7 @@
 #include sys/proc.h
 #include sys/kthread.h
 #include sys/tprintf.h
+#include sys/atomic.h
 
 #include dev/wscons/wsdisplayvar.h
 #include dev/wscons/wsconsio.h
@@ -78,6 +79,16 @@
 static void vcons_eraserows_buffer(void *, int, int, long);
 static void vcons_putchar_buffer(void *, int, int, u_int, long);
 
+#ifdef VCONS_DRAW_ASYNC
+/* methods that work asynchronously */
+static void vcons_copycols_async(void *, int, int, int, int);
+static void vcons_erasecols_async(void *, int, int, int, long);
+static void vcons_copyrows_async(void *, int, int, int);
+static void vcons_eraserows_async(void *, int, int, long);
+static void vcons_putchar_async(void *, int, int, u_int, long);
+static void vcons_cursor_async(void *, int, int, int);
+#endif
+
 /*
  * actual wrapper methods which call both the _buffer ones above and the
  * driver supplied ones to do the drawing
@@ -103,7 +114,7 @@
 static void vcons_lock(struct vcons_screen *);
 static void vcons_unlock(struct vcons_screen *);
 
-#ifdef VCONS_SWITCH_ASYNC
+#ifdef VCONS_DRAW_ASYNC
 static void vcons_kthread(void *);
 #endif
 
@@ -148,9 +159,9 @@
 #ifdef DIAGNOSTIC
 	vd-switch_poll_count = 0;
 #endif
-#ifdef VCONS_SWITCH_ASYNC
+#ifdef VCONS_DRAW_ASYNC
 	kthread_create(PRI_NONE, 0, NULL, vcons_kthread, vd,
-	vd-redraw_thread, vcons_draw);
+	vd-drawing_thread, vcons_draw);
 #endif
 	return 0;
 }
@@ -181,9 +192,6 @@
 #ifdef VCONS_PARANOIA
 	splx(s);
 #endif
-#ifdef VCONS_SWITCH_ASYNC
-	wakeup(scr-scr_vd-done_drawing);
-#endif
 }
 
 static void
@@ -223,29 +231,30 @@
 	 * our wrappers
 	 */
 	vd-eraserows = ri-ri_ops.eraserows;
-	vd-copyrows  = ri-ri_ops.copyrows;
 	vd-erasecols = ri-ri_ops.erasecols;
-	vd-copycols  = ri-ri_ops.copycols;
 	vd-putchar   = ri-ri_ops.putchar;
 	vd-cursor= ri-ri_ops.cursor;
 
-	ri-ri_ops.eraserows = vcons_eraserows;	
-	ri-ri_ops.erasecols = vcons_erasecols;	
-	ri-ri_ops.putchar   = vcons_putchar;
-	ri-ri_ops.cursor= vcons_cursor;
-
 	if (scr-scr_flags  VCONS_NO_COPYCOLS) {
-		ri-ri_ops.copycols  = vcons_copycols_noread;
+		vd-copycols  = vcons_copycols_noread;
 	} else {
-		ri-ri_ops.copycols  = vcons_copycols;
+		vd-copycols = ri-ri_ops.copycols;
 	}
 
 	if (scr-scr_flags  

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

2011-01-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 25 21:27:12 UTC 2011

Modified Files:
src/sys/arch/hp700/include: cpu.h

Log Message:
definetab


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/hp700/include/cpu.h

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

Modified files:

Index: src/sys/arch/hp700/include/cpu.h
diff -u src/sys/arch/hp700/include/cpu.h:1.61 src/sys/arch/hp700/include/cpu.h:1.62
--- src/sys/arch/hp700/include/cpu.h:1.61	Mon Jan 24 07:44:16 2011
+++ src/sys/arch/hp700/include/cpu.h	Tue Jan 25 21:27:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.61 2011/01/24 07:44:16 skrll Exp $	*/
+/*	$NetBSD: cpu.h,v 1.62 2011/01/25 21:27:11 skrll Exp $	*/
 
 /*	$OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $	*/
 
@@ -402,7 +402,7 @@
  */
 #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
 #define	CPU_BOOTED_KERNEL	2	/* string: booted kernel name */
-#define CPU_LCD_BLINK   3	/* int: twiddle heartbeat LED/LCD */ 
+#define	CPU_LCD_BLINK   3	/* int: twiddle heartbeat LED/LCD */ 
 #define	CPU_MAXID		4	/* number of valid machdep ids */
 
 #ifdef _KERNEL



CVS commit: src/share/man/man9

2011-01-25 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Tue Jan 25 23:46:48 UTC 2011

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

Log Message:
- add some random notes

 Basically, KASSERT() should be used for light-weight checks and
 KDASSERT() should be used for heavier ones.

 Callers should not rely on the side effects of expression because,
 depending on the kernel compile options mentioned above, expression might
 not be evaluated at all.

- Xr options(4)
- bump date


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man9/KASSERT.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/KASSERT.9
diff -u src/share/man/man9/KASSERT.9:1.9 src/share/man/man9/KASSERT.9:1.10
--- src/share/man/man9/KASSERT.9:1.9	Fri Oct 29 09:34:03 2010
+++ src/share/man/man9/KASSERT.9	Tue Jan 25 23:46:48 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: KASSERT.9,v 1.9 2010/10/29 09:34:03 wiz Exp $
+.\ $NetBSD: KASSERT.9,v 1.10 2011/01/25 23:46:48 yamt Exp $
 .\
 .\ Copyright (c) 2006 Igor Sobrado
 .\ All rights reserved.
@@ -24,7 +24,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd October 28, 2010
+.Dd Janurary 26, 2011
 .Dt KASSERT 9
 .Os
 .Sh NAME
@@ -63,11 +63,24 @@
 vs
 .Dv DIAGNOSTIC ) .
 .Pp
+Basically,
+.Fn KASSERT
+should be used for light-weight checks and
+.Fn KDASSERT
+should be used for heavier ones.
+.Pp
+Callers should not rely on the side effects of
+.Ar expression
+because, depending on the kernel compile options mentioned above,
+.Ar expression
+might not be evaluated at all.
+.Pp
 The panic message will display the style of assertion (debugging
 vs. diagnostic), the expression that failed and the filename, and line
 number the failure happened on.
 .Sh SEE ALSO
 .Xr config 1 ,
+.Xr options 4 ,
 .Xr CTASSERT 9 ,
 .Xr panic 9 ,
 .Xr printf 9



CVS commit: src/sys/dev/pci

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:08:30 UTC 2011

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

Log Message:
Improve error reporting during attachment to PCI ath(4).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/if_ath_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_ath_pci.c
diff -u src/sys/dev/pci/if_ath_pci.c:1.38 src/sys/dev/pci/if_ath_pci.c:1.39
--- src/sys/dev/pci/if_ath_pci.c:1.38	Wed Apr 28 22:00:39 2010
+++ src/sys/dev/pci/if_ath_pci.c	Wed Jan 26 00:08:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ath_pci.c,v 1.38 2010/04/28 22:00:39 dyoung Exp $	*/
+/*	$NetBSD: if_ath_pci.c,v 1.39 2011/01/26 00:08:30 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ath_pci.c,v 1.38 2010/04/28 22:00:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ath_pci.c,v 1.39 2011/01/26 00:08:30 dyoung Exp $);
 
 /*
  * PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.
@@ -145,12 +145,13 @@
 	mem_type = pci_mapreg_type(pc, pa-pa_tag, ATH_PCI_MMBA);
 	if (mem_type != PCI_MAPREG_TYPE_MEM 
 	mem_type != PCI_MAPREG_MEM_TYPE_64BIT) {
-		aprint_error(bad pci register type %d\n, (int)mem_type);
+		aprint_error_dev(self, bad pci register type %d\n,
+		(int)mem_type);
 		goto bad;
 	}
 	if (pci_mapreg_map(pa, ATH_PCI_MMBA, mem_type, 0, psc-sc_iot,
 		psc-sc_ioh, NULL, psc-sc_mapsz) != 0) {
-		aprint_error(cannot map register space\n);
+		aprint_error_dev(self, cannot map register space\n);
 		goto bad;
 	}
 



CVS commit: src/sys/dev/pci

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:09:27 UTC 2011

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

Log Message:
Get out of the interrupt handler early if !IFF_RUNNING.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/if_bnx.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.41 src/sys/dev/pci/if_bnx.c:1.42
--- src/sys/dev/pci/if_bnx.c:1.41	Thu Jan  6 03:37:55 2011
+++ src/sys/dev/pci/if_bnx.c	Wed Jan 26 00:09:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.41 2011/01/06 03:37:55 jym Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.42 2011/01/26 00:09:27 dyoung Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID($FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $);
 #endif
-__KERNEL_RCSID(0, $NetBSD: if_bnx.c,v 1.41 2011/01/06 03:37:55 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bnx.c,v 1.42 2011/01/26 00:09:27 dyoung Exp $);
 
 /*
  * The following controllers are supported by this driver:
@@ -5161,11 +5161,13 @@
 	const struct status_block *sblk;
 
 	sc = xsc;
-	if (!device_is_active(sc-bnx_dev))
-		return 0;
 
 	ifp = sc-bnx_ec.ec_if;
 
+	if (!device_is_active(sc-bnx_dev) ||
+	(ifp-if_flags  IFF_RUNNING) == 0)
+		return 0;
+
 	DBRUNIF(1, sc-interrupts_generated++);
 
 	bus_dmamap_sync(sc-bnx_dmatag, sc-status_map, 0,



CVS commit: src/sys/dev/pci

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:16:52 UTC 2011

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

Log Message:
Make oodles of mainly cosmetic changes that make rtw(4)'s PCI attachment
resemble its CardBus attachment very, very closely: slightly more than
24 lines are different.  Alas, I cannot commit the CardBus part of this
change, yet, because I have to finish my overhaul of CardBus resource
handling, first.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/if_rtw_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_rtw_pci.c
diff -u src/sys/dev/pci/if_rtw_pci.c:1.18 src/sys/dev/pci/if_rtw_pci.c:1.19
--- src/sys/dev/pci/if_rtw_pci.c:1.18	Thu Mar  4 22:57:37 2010
+++ src/sys/dev/pci/if_rtw_pci.c	Wed Jan 26 00:16:52 2011
@@ -1,6 +1,33 @@
-/*	$NetBSD: if_rtw_pci.c,v 1.18 2010/03/04 22:57:37 dyoung Exp $	*/
+/* $NetBSD: if_rtw_pci.c,v 1.19 2011/01/26 00:16:52 dyoung Exp $ */
 
 /*-
+ * Copyright (c) 2004, 2005, 2010 David Young.  All rights reserved.
+ *
+ * Adapted for the RTL8180 by 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 David Young ``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 David
+ * Young 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.
+ */
+/*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -39,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_rtw_pci.c,v 1.18 2010/03/04 22:57:37 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_rtw_pci.c,v 1.19 2011/01/26 00:16:52 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -79,51 +106,57 @@
 #define	RTW_PCI_MMBA		0x14	/* memory mapped base */
 
 struct rtw_pci_softc {
-	struct rtw_softc	psc_rtw;	/* real RTL8180 softc */
-
-	pci_intr_handle_t	psc_ih;		/* interrupt handle */
-	void			*psc_intrcookie;
+	struct rtw_softc	psc_rtw;
 
-	pci_chipset_tag_t	psc_pc;		/* our PCI chipset */
-	pcitag_t		psc_pcitag;	/* our PCI tag */
+	pcireg_t		psc_csr;
+	void			*psc_ih;
+	pci_chipset_tag_t	psc_pc;
+	pci_intr_handle_t	psc_pih;
+	pcitag_t		psc_tag;
 };
 
-static int	rtw_pci_match(device_t, cfdata_t, void *);
 static void	rtw_pci_attach(device_t, device_t, void *);
 static int	rtw_pci_detach(device_t, int);
-
-CFATTACH_DECL_NEW(rtw_pci, sizeof(struct rtw_pci_softc),
-rtw_pci_match, rtw_pci_attach, rtw_pci_detach, NULL);
-
-static bool rtw_pci_resume(device_t, const pmf_qual_t *);
-static bool rtw_pci_suspend(device_t, const pmf_qual_t *);
+#if 0
+static void	rtw_pci_funcregen(struct rtw_regs *, int);
+#endif
+static const struct rtw_pci_product *
+		rtw_pci_lookup(const struct pci_attach_args *);
+static int	rtw_pci_match(device_t, cfdata_t, void *);
+static bool	rtw_pci_resume(device_t, const pmf_qual_t *);
+static int	rtw_pci_setup(struct rtw_pci_softc *);
+static bool	rtw_pci_suspend(device_t, const pmf_qual_t *);
+
+CFATTACH_DECL3_NEW(rtw_pci, sizeof(struct rtw_pci_softc),
+rtw_pci_match, rtw_pci_attach, rtw_pci_detach, NULL, NULL, NULL,
+DVF_DETACH_SHUTDOWN);
 
 static const struct rtw_pci_product {
-	u_int32_t	app_vendor;	/* PCI vendor ID */
-	u_int32_t	app_product;	/* PCI product ID */
-	const char	*app_product_name;
+	u_int32_t	rpp_vendor;	/* PCI vendor ID */
+	u_int32_t	rpp_product;	/* PCI product ID */
+	const char	*rpp_product_name;
 } rtw_pci_products[] = {
-	{ PCI_VENDOR_REALTEK,		PCI_PRODUCT_REALTEK_RT8180,
-	  Realtek RTL8180 802.11 MAC/BBP },
-	{ PCI_VENDOR_BELKIN,		PCI_PRODUCT_BELKIN_F5D6001,
-	  Belkin F5D6001 },
-
-	{ 0,0,NULL },
+	  {PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180,
+	   Realtek RTL8180 802.11 MAC/BBP}
+	, {PCI_VENDOR_BELKIN, PCI_PRODUCT_BELKIN_F5D6001, Belkin F5D6001}
+	, {PCI_VENDOR_BELKIN, PCI_PRODUCT_BELKIN_F5D6020V3,
+	   Belkin F5D6020v3 

CVS commit: src/sys/dev/pci

2011-01-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 26 00:25:34 UTC 2011

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

Log Message:
Fix MAC address check on 8257[156] and 80003 case. Some cards have non 0x
pointer but those don't use alternative MAC address in reality. So we check
whether the broadcast bit is set or not like Intel's e1000 driver.
Fixes PR kern/44072 reported by Jean-Yves Moulin.

Remove extra Warning for newer cards.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 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.217 src/sys/dev/pci/if_wm.c:1.218
--- src/sys/dev/pci/if_wm.c:1.217	Tue Dec 14 02:51:46 2010
+++ src/sys/dev/pci/if_wm.c	Wed Jan 26 00:25:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.217 2010/12/14 02:51:46 dyoung Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.218 2011/01/26 00:25:34 msaitoh 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.217 2010/12/14 02:51:46 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.218 2011/01/26 00:25:34 msaitoh Exp $);
 
 #include rnd.h
 
@@ -510,6 +510,7 @@
 static int	wm_read_eeprom(struct wm_softc *, int, int, u_int16_t *);
 static int	wm_read_eeprom_eerd(struct wm_softc *, int, int, u_int16_t *);
 static int	wm_validate_eeprom_checksum(struct wm_softc *);
+static int	wm_check_alt_mac_addr(struct wm_softc *);
 static int	wm_read_mac_addr(struct wm_softc *, uint8_t *);
 static void	wm_tick(void *);
 
@@ -1186,11 +1187,13 @@
 			PCI_MAPREG_TYPE_IO)
 break;
 		}
-		if (i == PCI_MAPREG_END)
-			aprint_error_dev(sc-sc_dev,
-			WARNING: unable to find I/O BAR\n);
-		else {
+		if (i != PCI_MAPREG_END) {
 			/*
+			 * We found PCI_MAPREG_TYPE_IO. Note that 82580
+			 * (and newer?) chip has no PCI_MAPREG_TYPE_IO.
+			 * It's no problem because newer chips has no this
+			 * bug.
+			 *
 			 * The i8254x doesn't apparently respond when the
 			 * I/O BAR is 0, which looks somewhat like it's not
 			 * been configured.
@@ -4722,69 +4725,101 @@
 }
 
 static int
+wm_check_alt_mac_addr(struct wm_softc *sc)
+{
+	uint16_t myea[ETHER_ADDR_LEN / 2];
+	uint16_t offset = EEPROM_OFF_MACADDR;
+
+	/* Try to read alternative MAC address pointer */
+	if (wm_read_eeprom(sc, EEPROM_ALT_MAC_ADDR_PTR, 1, offset) != 0)
+		return -1;
+
+	/* Check pointer */
+	if (offset == 0x)
+		return -1;
+
+	/*
+	 * Check whether alternative MAC address is valid or not.
+	 * Some cards have non 0x pointer but those don't use
+	 * alternative MAC address in reality.
+	 *
+	 * Check whether the broadcast bit is set or not.
+	 */
+	if (wm_read_eeprom(sc, offset, 1, myea) == 0)
+		if (((myea[0]  0xff)  0x01) == 0)
+			return 0; /* found! */
+
+	/* not found */
+	return -1;
+}
+
+static int
 wm_read_mac_addr(struct wm_softc *sc, uint8_t *enaddr)
 {
 	uint16_t myea[ETHER_ADDR_LEN / 2];
 	uint16_t offset = EEPROM_OFF_MACADDR;
 	int do_invert = 0;
 
-	if (sc-sc_funcid != 0)
-		switch (sc-sc_type) {
-		case WM_T_82580:
-		case WM_T_82580ER:
-			switch (sc-sc_funcid) {
-			case 1:
-offset = EEPROM_OFF_LAN1;
-break;
-			case 2:
-offset = EEPROM_OFF_LAN2;
-break;
-			case 3:
-offset = EEPROM_OFF_LAN3;
-break;
-			default:
-goto bad;
-/* NOTREACHED */
-break;
-			}
+	switch (sc-sc_type) {
+	case WM_T_82580:
+	case WM_T_82580ER:
+		switch (sc-sc_funcid) {
+		case 0:
+			/* default value (== EEPROM_OFF_MACADDR) */
 			break;
-		case WM_T_82571:
-		case WM_T_82575:
-		case WM_T_82576:
-		case WM_T_80003:
-			if (wm_read_eeprom(sc, EEPROM_ALT_MAC_ADDR_PTR, 1,
-offset) != 0) {
-goto bad;
-			}
-
-			/* no pointer */
-			if (offset == 0x) {
-/* reset the offset to LAN0 */
-offset = EEPROM_OFF_MACADDR;
+		case 1:
+			offset = EEPROM_OFF_LAN1;
+			break;
+		case 2:
+			offset = EEPROM_OFF_LAN2;
+			break;
+		case 3:
+			offset = EEPROM_OFF_LAN3;
+			break;
+		default:
+			goto bad;
+			/* NOTREACHED */
+			break;
+		}
+		break;
+	case WM_T_82571:
+	case WM_T_82575:
+	case WM_T_82576:
+	case WM_T_80003:
+		if (wm_check_alt_mac_addr(sc) != 0) {
+			/* reset the offset to LAN0 */
+			offset = EEPROM_OFF_MACADDR;
+			if ((sc-sc_funcid  0x01) == 1)
 do_invert = 1;
-goto do_read;
-			}
-
-			switch (sc-sc_funcid) {
-			case 1:
-offset += EEPROM_OFF_MACADDR_LAN1;
-break;
-			case 2:
-offset += EEPROM_OFF_MACADDR_LAN2;
-break;
-			case 3:
-offset += EEPROM_OFF_MACADDR_LAN3;
-break;
-			default:
-goto bad;
-/* NOTREACHED */
-break;
-			}
+			goto do_read;
+		}
+		switch (sc-sc_funcid) {
+		case 0:
+			/*
+			 * The offset is the value in EEPROM_ALT_MAC_ADDR_PTR
+			 * itself.
+			 */
+			break;
+		case 1:
+			offset += EEPROM_OFF_MACADDR_LAN1;
+			break;
+		case 2:
+			offset += 

CVS commit: src/sys/arch

2011-01-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jan 26 00:25:55 UTC 2011

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
Add bwi from PR kern/40279.  There is no know case of testing the
driver on amd64/i386, but if it doesn't work at least we're more
likely to get a PR instead of people wondering about lacking driver
support.


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1007 -r1.1008 src/sys/arch/i386/conf/GENERIC

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/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.299 src/sys/arch/amd64/conf/GENERIC:1.300
--- src/sys/arch/amd64/conf/GENERIC:1.299	Mon Jan 17 15:56:03 2011
+++ src/sys/arch/amd64/conf/GENERIC	Wed Jan 26 00:25:55 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.299 2011/01/17 15:56:03 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.300 2011/01/26 00:25:55 pooka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.299 $
+#ident 		GENERIC-$Revision: 1.300 $
 
 maxusers	64		# estimated number of users
 
@@ -652,6 +652,7 @@
 bce* 	at pci? dev ? function ?	# Broadcom 440x 10/100 Ethernet
 bge* 	at pci? dev ? function ?	# Broadcom 570x gigabit Ethernet
 bnx* 	at pci? dev ? function ?	# Broadcom NetXtremeII gigabit Ethernet
+bwi*	at pci? dev ? function ?	# Broadcom BCM43xx wireless
 dge*	at pci? dev ? function ?	# Intel 82597 10GbE LR
 en*	at pci? dev ? function ?	# ENI/Adaptec ATM
 ep*	at pci? dev ? function ?	# 3Com 3c59x

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1007 src/sys/arch/i386/conf/GENERIC:1.1008
--- src/sys/arch/i386/conf/GENERIC:1.1007	Mon Jan 17 15:56:03 2011
+++ src/sys/arch/i386/conf/GENERIC	Wed Jan 26 00:25:55 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1007 2011/01/17 15:56:03 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.1008 2011/01/26 00:25:55 pooka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.1007 $
+#ident 		GENERIC-$Revision: 1.1008 $
 
 maxusers	64		# estimated number of users
 
@@ -948,6 +948,7 @@
 bce* 	at pci? dev ? function ?	# Broadcom 4401 10/100 Ethernet
 bge*	at pci? dev ? function ?	# Broadcom 570x gigabit Ethernet
 bnx* 	at pci? dev ? function ?	# Broadcom NetXtremeII gigabit Ethernet
+bwi*	at pci? dev ? function ?	# Broadcom BCM43xx wireless
 dge*	at pci? dev ? function ?	# Intel 82597 10GbE LR
 en*	at pci? dev ? function ?	# ENI/Adaptec ATM
 ep*	at pci? dev ? function ?	# 3Com 3c59x



CVS commit: src/sys/dev/pci

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:49:56 UTC 2011

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

Log Message:
Define masks for subsystem vendor and subsystem ID fields, plus a couple
of macros for extracting them.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 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.69 src/sys/dev/pci/pcireg.h:1.70
--- src/sys/dev/pci/pcireg.h:1.69	Mon Jan 10 12:23:21 2011
+++ src/sys/dev/pci/pcireg.h	Wed Jan 26 00:49:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.69 2011/01/10 12:23:21 jmcneill Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.70 2011/01/26 00:49:56 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -429,6 +429,15 @@
  */
 #define PCI_SUBSYS_ID_REG 0x2c
 
+#define	PCI_SUBSYS_VENDOR_MASK	__BITS(15, 0)
+#define	PCI_SUBSYS_ID_MASK		__BITS(31, 16)
+
+#define	PCI_SUBSYS_VENDOR(__subsys_id)	\
+__SHIFTOUT(__subsys_id, PCI_SUBSYS_VENDOR_MASK)
+
+#define	PCI_SUBSYS_ID(__subsys_id)	\
+__SHIFTOUT(__subsys_id, PCI_SUBSYS_ID_MASK)
+
 /*
  * Capabilities link list (PCI rev. 2.2)
  */



CVS commit: src/sys/dev/pci/bktr

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:54:36 UTC 2011

Modified Files:
src/sys/dev/pci/bktr: bktr_reg.h

Log Message:
unifdef -U__bsdi__ -U__FreeBSD__ -D__NetBSD__.  No functional change
intended.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/bktr/bktr_reg.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/bktr/bktr_reg.h
diff -u src/sys/dev/pci/bktr/bktr_reg.h:1.20 src/sys/dev/pci/bktr/bktr_reg.h:1.21
--- src/sys/dev/pci/bktr/bktr_reg.h:1.20	Wed May  6 10:34:33 2009
+++ src/sys/dev/pci/bktr/bktr_reg.h	Wed Jan 26 00:54:35 2011
@@ -1,6 +1,6 @@
 /* $SourceForge: bktr_reg.h,v 1.3 2003/03/11 23:11:27 thomasklausner Exp $ */
 
-/*	$NetBSD: bktr_reg.h,v 1.20 2009/05/06 10:34:33 cegger Exp $	*/
+/*	$NetBSD: bktr_reg.h,v 1.21 2011/01/26 00:54:35 dyoung Exp $	*/
 /*
  * $FreeBSD: src/sys/dev/bktr/bktr_reg.h,v 1.42 2000/10/31 13:09:56 roger Exp$
  *
@@ -37,55 +37,17 @@
  *
  */
 
-#ifdef __FreeBSD__
-#  if (__FreeBSD_version = 31)
-#include smbus.h
-#  else
-#define NSMBUS 0		/* FreeBSD before 3.1 does not have SMBUS */
-#  endif
-#  if (NSMBUS  0)
-#define BKTR_USE_FREEBSD_SMBUS
-#  endif
-#endif
 
-#ifdef __NetBSD__
 #include sys/bus.h
 #include sys/device.h			/* device_t */
 #include sys/select.h			/* struct selinfo */
 #include sys/reboot.h			/* AB_* for bootverbose */
-#endif
 
 /*
  * The kernel options for the driver now all begin with BKTR.
  * Support the older kernel options on FreeBSD and OpenBSD.
  *
  */
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
-#if defined(BROOKTREE_ALLOC_PAGES)
-#define BKTR_ALLOC_PAGES BROOKTREE_ALLOC_PAGES
-#endif
-
-#if defined(BROOKTREE_SYSTEM_DEFAULT)
-#define BKTR_SYSTEM_DEFAULT BROOKTREE_SYSTEM_DEFAULT
-#endif
-
-#if defined(OVERRIDE_CARD)
-#define BKTR_OVERRIDE_CARD OVERRIDE_CARD
-#endif
-
-#if defined(OVERRIDE_TUNER)
-#define BKTR_OVERRIDE_TUNER OVERRIDE_TUNER
-#endif
-
-#if defined(OVERRIDE_DBX)
-#define BKTR_OVERRIDE_DBX OVERRIDE_DBX
-#endif
-
-#if defined(OVERRIDE_MSP)
-#define BKTR_OVERRIDE_MSP OVERRIDE_MSP
-#endif
-
-#endif
 
 
 #ifndef PCI_LATENCY_TIMER
@@ -95,25 +57,6 @@
 /*
  * Definitions for the Brooktree 848/878 video capture to pci interface.
  */
-#ifndef __NetBSD__
-#define PCI_VENDOR_SHIFT0
-#define PCI_VENDOR_MASK 0x
-#define PCI_VENDOR(id) \
-(((id)  PCI_VENDOR_SHIFT)  PCI_VENDOR_MASK)
-
-#define PCI_PRODUCT_SHIFT   16
-#define PCI_PRODUCT_MASK0x
-#define PCI_PRODUCT(id) \
-(((id)  PCI_PRODUCT_SHIFT)  PCI_PRODUCT_MASK)
-
-/* PCI vendor ID */
-#define PCI_VENDOR_BROOKTREE0x109e/* Brooktree */
-/* Brooktree products */
-#define PCI_PRODUCT_BROOKTREE_BT848 0x0350/* Bt848 Video Capture */
-#define PCI_PRODUCT_BROOKTREE_BT849 0x0351/* Bt849 Video Capture */
-#define PCI_PRODUCT_BROOKTREE_BT878 0x036e/* Bt878 Video Capture */
-#define PCI_PRODUCT_BROOKTREE_BT879 0x036f/* Bt879 Video Capture */
-#endif
 
 #define BROOKTREE_848   1
 #define BROOKTREE_848A  2
@@ -469,10 +412,6 @@
  * memory mapped structure method only works on 32 bit processors
  * with the right type of endianness.
  */
-#if defined(__NetBSD__) || (defined(__FreeBSD__)  (__FreeBSD_version =30))
-
-#if defined(__NetBSD__)
-
 struct bktr_softc;
 
 u_int8_t bktr_INB(struct bktr_softc *, int);
@@ -489,27 +428,6 @@
 #define OUTW(bktr,offset,value)	bktr_OUTW(bktr,offset,value)
 #define OUTL(bktr,offset,value)	bktr_OUTL(bktr,offset,value)
 
-#else
-
-#define INB(bktr,offset)	bus_space_read_1((bktr)-memt,(bktr)-memh,(offset))
-#define INW(bktr,offset)	bus_space_read_2((bktr)-memt,(bktr)-memh,(offset))
-#define INL(bktr,offset)	bus_space_read_4((bktr)-memt,(bktr)-memh,(offset))
-#define OUTB(bktr,offset,value) bus_space_write_1((bktr)-memt,(bktr)-memh,(offset),(value))
-#define OUTW(bktr,offset,value) bus_space_write_2((bktr)-memt,(bktr)-memh,(offset),(value))
-#define OUTL(bktr,offset,value) bus_space_write_4((bktr)-memt,(bktr)-memh,(offset),(value))
-
-#endif /* __NetBSD__ */
-
-#else
-#define INB(bktr,offset)	*(volatile unsigned char*) ((int)((bktr)-memh)+(offset))
-#define INW(bktr,offset)	*(volatile unsigned short*)((int)((bktr)-memh)+(offset))
-#define INL(bktr,offset)	*(volatile unsigned int*)  ((int)((bktr)-memh)+(offset))
-#define OUTB(bktr,offset,value)	*(volatile unsigned char*) ((int)((bktr)-memh)+(offset)) = (value)
-#define OUTW(bktr,offset,value)	*(volatile unsigned short*)((int)((bktr)-memh)+(offset)) = (value)
-#define OUTL(bktr,offset,value)	*(volatile unsigned int*)  ((int)((bktr)-memh)+(offset)) = (value)
-#endif
-
-
 typedef struct bktr_clip bktr_clip_t;
 
 /*
@@ -517,14 +435,7 @@
  */
 struct bktr_softc {
 
-#if defined (__bsdi__)
-struct device bktr_dev;	

CVS commit: src/sys/external/isc/atheros_hal/dist

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:55:42 UTC 2011

Modified Files:
src/sys/external/isc/atheros_hal/dist: ah_internal.h

Log Message:
Protect against a NULL pointer dereference that I've seen in the wild.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/isc/atheros_hal/dist/ah_internal.h

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

Modified files:

Index: src/sys/external/isc/atheros_hal/dist/ah_internal.h
diff -u src/sys/external/isc/atheros_hal/dist/ah_internal.h:1.3 src/sys/external/isc/atheros_hal/dist/ah_internal.h:1.4
--- src/sys/external/isc/atheros_hal/dist/ah_internal.h:1.3	Thu May 14 09:07:49 2009
+++ src/sys/external/isc/atheros_hal/dist/ah_internal.h	Wed Jan 26 00:55:42 2011
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ah_internal.h,v 1.3 2009/05/14 09:07:49 reinoud Exp $
+ * $Id: ah_internal.h,v 1.4 2011/01/26 00:55:42 dyoung Exp $
  */
 #ifndef _ATH_AH_INTERAL_H_
 #define _ATH_AH_INTERAL_H_
@@ -324,8 +324,11 @@
 #define	ath_hal_getNoiseFloor(_ah, _nfArray) \
 	AH_PRIVATE(_ah)-ah_getNoiseFloor(_ah, _nfArray)
 
-#define	ath_hal_eepromDetach(_ah) \
-	AH_PRIVATE(_ah)-ah_eepromDetach(_ah)
+#define	ath_hal_eepromDetach(_ah)			\
+do {			\
+	if (AH_PRIVATE(_ah)-ah_eepromDetach != NULL)	\
+		AH_PRIVATE(_ah)-ah_eepromDetach(_ah);	\
+} while (/*CONSTCOND*/0)
 #define	ath_hal_eepromGet(_ah, _param, _val) \
 	AH_PRIVATE(_ah)-ah_eepromGet(_ah, _param, _val)
 #define	ath_hal_eepromSet(_ah, _param, _val) \



CVS commit: src/sys/net

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:57:47 UTC 2011

Modified Files:
src/sys/net: if_media.h

Log Message:
Add some 10-gigabit media words used by Intel 82599.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/net/if_media.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/net/if_media.h
diff -u src/sys/net/if_media.h:1.53 src/sys/net/if_media.h:1.54
--- src/sys/net/if_media.h:1.53	Mon Oct  5 21:27:36 2009
+++ src/sys/net/if_media.h	Wed Jan 26 00:57:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.h,v 1.53 2009/10/05 21:27:36 dyoung Exp $	*/
+/*	$NetBSD: if_media.h,v 1.54 2011/01/26 00:57:47 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -180,6 +180,10 @@
 #define	IFM_10G_CX4	20		/* 10GBase CX4 copper */
 #define	IFM_2500_SX	21		/* 2500baseSX - multi-mode fiber */
 #define	IFM_1000_BX10	22		/* 1000base-BX10 */
+#define	IFM_10G_TWINAX	23		/* 10GBase Twinax copper */
+#define	IFM_10G_TWINAX_LONG	24	/* 10GBase Twinax Long copper */
+#define	IFM_10G_LRM	25		/* 10GBase-LRM 850nm Multi-mode */
+#define	IFM_10G_T	26		/* 10GBase-T - RJ45 */
 
 #define	IFM_ETH_MASTER	0x0100	/* master mode (1000baseT) */
 #define	IFM_ETH_RXPAUSE	0x0200	/* receive PAUSE frames */
@@ -423,6 +427,10 @@
 	{ IFM_ETHER | IFM_10G_SR,	10GbaseSR },			\
 	{ IFM_ETHER | IFM_10G_SR,	10GSR },			\
 	{ IFM_ETHER | IFM_10G_SR,	10GBASE-SR },			\
+	{ IFM_ETHER | IFM_10G_LRM,	10Gbase-LRM },		\
+	{ IFM_ETHER | IFM_10G_TWINAX,	10Gbase-Twinax },		\
+	{ IFM_ETHER | IFM_10G_TWINAX_LONG,	10Gbase-Twinax-Long },\
+	{ IFM_ETHER | IFM_10G_T,	10Gbase-T },			\
 	{ IFM_ETHER | IFM_10G_CX4,	10GbaseCX4 },			\
 	{ IFM_ETHER | IFM_10G_CX4,	10GCX4 },			\
 	{ IFM_ETHER | IFM_10G_CX4,	10GBASE-CX4 },		\



CVS commit: src/sys/net

2011-01-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Jan 26 00:58:36 UTC 2011

Modified Files:
src/sys/net: route.h

Log Message:
Update comment on RTM_CHGADDR to describe better what it's for.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/net/route.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/net/route.h
diff -u src/sys/net/route.h:1.76 src/sys/net/route.h:1.77
--- src/sys/net/route.h:1.76	Fri Nov 12 16:30:26 2010
+++ src/sys/net/route.h	Wed Jan 26 00:58:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.h,v 1.76 2010/11/12 16:30:26 roy Exp $	*/
+/*	$NetBSD: route.h,v 1.77 2011/01/26 00:58:36 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -223,7 +223,7 @@
  * address has changed
  */
 #define RTM_IFINFO	0x14	/* iface/link going up/down etc. */
-#define RTM_CHGADDR	0x15	/* address has changed on iface */
+#define RTM_CHGADDR	0x15	/* address properties changed */
 
 #define RTV_MTU		0x1	/* init or lock _mtu */
 #define RTV_HOPCOUNT	0x2	/* init or lock _hopcount */



CVS commit: src/sys/lib/libkern

2011-01-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 26 01:02:46 UTC 2011

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
Fix KDASSERTMSG defintions for !DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/lib/libkern/libkern.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/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.95 src/sys/lib/libkern/libkern.h:1.96
--- src/sys/lib/libkern/libkern.h:1.95	Mon Jan 24 22:53:07 2011
+++ src/sys/lib/libkern/libkern.h	Wed Jan 26 01:02:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.95 2011/01/24 22:53:07 matt Exp $	*/
+/*	$NetBSD: libkern.h,v 1.96 2011/01/26 01:02:46 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -222,11 +222,11 @@
 
 #ifndef DEBUG
 #ifdef lint
-#define	KDASSERT(e)	/* NOTHING */
-#define	KDASSERTMSG(e)	/* NOTHING */
+#define	KDASSERTMSG(e,msg)	/* NOTHING */
+#define	KDASSERT(e)		/* NOTHING */
 #else /* lint */
-#define	KDASSERT(e)	((void)0)
-#define	KDASSERTMSG(e)	((void)0)
+#define	KDASSERTMSG(e,msg)	((void)0)
+#define	KDASSERT(e)		((void)0)
 #endif /* lint */
 #else
 #define	KDASSERTMSG(e, msg) do {	\



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

2011-01-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 26 03:32:32 UTC 2011

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

Log Message:
Fix a preemption bug.


To generate a diff of this commit:
cvs rdiff -u -r1.217.12.32 -r1.217.12.33 src/sys/arch/mips/mips/trap.c

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

Modified files:

Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.32 src/sys/arch/mips/mips/trap.c:1.217.12.33
--- src/sys/arch/mips/mips/trap.c:1.217.12.32	Wed Dec 29 00:47:50 2010
+++ src/sys/arch/mips/mips/trap.c	Wed Jan 26 03:32:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.217.12.32 2010/12/29 00:47:50 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.217.12.33 2011/01/26 03:32:31 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -78,7 +78,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.217.12.32 2010/12/29 00:47:50 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.217.12.33 2011/01/26 03:32:31 matt Exp $);
 
 #include opt_cputype.h	/* which mips CPU levels do we support? */
 #include opt_ddb.h
@@ -198,7 +198,7 @@
 	struct lwp * const l = curlwp;
 	struct proc * const p = curproc;
 	struct trapframe * const utf = l-l_md.md_utf;
-	struct cpu_info * const ci = curcpu();
+	struct cpu_info * ci = curcpu();
 	vm_prot_t ftype;
 	ksiginfo_t ksi;
 	extern void fswintrberr(void);
@@ -379,6 +379,7 @@
 #endif
 		int rv = 0;
 
+		kpreempt_disable();
 #ifdef _LP64
 		/*
 		 * If the pmap has been activated and we allocated the segtab
@@ -387,10 +388,12 @@
 		 * cpu's cpu_info but not other cpu's) so we need to detect
 		 * and fix this here.
 		 */
+		ci = curcpu();
 		if ((va  XSEGSHIFT) == 0 
 		__predict_false(ci-ci_pmap_seg0tab == NULL
  ci-ci_pmap_segtab-seg_seg[0] != NULL)) {
 			ci-ci_pmap_seg0tab = ci-ci_pmap_segtab-seg_seg[0];
+			kpreempt_enable();
 			if (type  T_USER) {
 userret(l);
 			}
@@ -399,6 +402,7 @@
 #endif
 		KASSERT(va  0 || ci-ci_pmap_asid_cur != 0);
 		pmap_tlb_asid_check();
+		kpreempt_enable();
 
 #ifdef PMAP_FAULTINFO
 		if (p-p_pid == pfi-pfi_lastpid  va == pfi-pfi_faultaddr) {