CVS commit: src/usr.sbin/btdevctl

2010-04-27 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Wed Apr 28 06:18:08 UTC 2010

Modified Files:
src/usr.sbin/btdevctl: print.c sdp.c

Log Message:
additionally query the "PnP Information" service record to discover
any USB Forum vendor-id and product-id values and store them in the
property list if found.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/btdevctl/print.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/btdevctl/sdp.c

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

Modified files:

Index: src/usr.sbin/btdevctl/print.c
diff -u src/usr.sbin/btdevctl/print.c:1.9 src/usr.sbin/btdevctl/print.c:1.10
--- src/usr.sbin/btdevctl/print.c:1.9	Fri Aug 17 17:59:16 2007
+++ src/usr.sbin/btdevctl/print.c	Wed Apr 28 06:18:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.9 2007/08/17 17:59:16 pavel Exp $	*/
+/*	$NetBSD: print.c,v 1.10 2010/04/28 06:18:07 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: print.c,v 1.9 2007/08/17 17:59:16 pavel Exp $");
+__RCSID("$NetBSD: print.c,v 1.10 2010/04/28 06:18:07 plunky Exp $");
 
 #include 
 
@@ -86,6 +86,7 @@
 cfg_print(prop_dictionary_t dict)
 {
 	prop_object_t obj;
+	uint16_t v;
 
 	obj = prop_dictionary_get(dict, BTDEVladdr);
 	if (prop_object_type(obj) != PROP_TYPE_DATA) {
@@ -103,6 +104,12 @@
 	if (prop_object_type(obj) == PROP_TYPE_STRING)
 		printf("link mode: %s\n", prop_string_cstring_nocopy(obj));
 
+	if (prop_dictionary_get_uint16(dict, BTDEVvendor, &v))
+		printf("vendor id: 0x%04x\n", v);
+
+	if (prop_dictionary_get_uint16(dict, BTDEVproduct, &v))
+		printf("product id: 0x%04x\n", v);
+
 	obj = prop_dictionary_get(dict, BTDEVtype);
 	if (prop_object_type(obj) != PROP_TYPE_STRING) {
 		printf("No device type!\n");

Index: src/usr.sbin/btdevctl/sdp.c
diff -u src/usr.sbin/btdevctl/sdp.c:1.7 src/usr.sbin/btdevctl/sdp.c:1.8
--- src/usr.sbin/btdevctl/sdp.c:1.7	Tue May 12 18:39:20 2009
+++ src/usr.sbin/btdevctl/sdp.c	Wed Apr 28 06:18:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdp.c,v 1.7 2009/05/12 18:39:20 plunky Exp $	*/
+/*	$NetBSD: sdp.c,v 1.8 2010/04/28 06:18:07 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: sdp.c,v 1.7 2009/05/12 18:39:20 plunky Exp $");
+__RCSID("$NetBSD: sdp.c,v 1.8 2010/04/28 06:18:07 plunky Exp $");
 
 #include 
 
@@ -84,10 +84,15 @@
 static int32_t parse_pdl(sdp_data_t *, uint16_t);
 static int32_t parse_apdl(sdp_data_t *, uint16_t);
 
+static int config_pnp(prop_dictionary_t, sdp_data_t *);
 static int config_hid(prop_dictionary_t, sdp_data_t *);
 static int config_hset(prop_dictionary_t, sdp_data_t *);
 static int config_hf(prop_dictionary_t, sdp_data_t *);
 
+uint16_t pnp_services[] = {
+	SDP_SERVICE_CLASS_PNP_INFORMATION,
+};
+
 uint16_t hid_services[] = {
 	SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE,
 };
@@ -123,14 +128,58 @@
 
 #define MAX_SSP		(2 + 1 * 3)	/* largest nservices is 1 */
 
+static bool
+cfg_ssa(sdp_session_t ss, uint16_t *services, size_t nservices, sdp_data_t *rsp)
+{
+	uint8_t buf[MAX_SSP];
+	sdp_data_t ssp;
+	size_t i;
+
+	ssp.next = buf;
+	ssp.end = buf + sizeof(buf);
+
+	for (i = 0; i < nservices; i++)
+		sdp_put_uuid16(&ssp, services[i]);
+
+	ssp.end = ssp.next;
+	ssp.next = buf;
+
+	return sdp_service_search_attribute(ss, &ssp, NULL, rsp);
+}
+
+static bool
+cfg_search(sdp_session_t ss, int i, prop_dictionary_t dict)
+{
+	sdp_data_t rsp, rec;
+
+	/* check PnP Information first */
+	if (!cfg_ssa(ss, pnp_services, __arraycount(pnp_services), &rsp))
+		return false;
+
+	while (sdp_get_seq(&rsp, &rec)) {
+		if (config_pnp(dict, &rec) == 0)
+			break;
+	}
+
+	/* then requested service */
+	if (!cfg_ssa(ss, cfgtype[i].services, cfgtype[i].nservices, &rsp))
+		return false;
+
+	while (sdp_get_seq(&rsp, &rec)) {
+		errno = (*cfgtype[i].handler)(dict, &rec);
+		if (errno == 0)
+			return true;
+	}
+
+	return false;
+}
+
 prop_dictionary_t
 cfg_query(bdaddr_t *laddr, bdaddr_t *raddr, const char *service)
 {
 	prop_dictionary_t dict;
 	sdp_session_t ss;
-	uint8_t buf[MAX_SSP];
-	sdp_data_t ssp, rsp, rec;
-	size_t i, n;
+	size_t i;
 	bool rv;
 
 	dict = prop_dictionary_create();
@@ -140,35 +189,15 @@
 	for (i = 0; i < __arraycount(cfgtype); i++) {
 		if (strcasecmp(service, cfgtype[i].name) == 0) {
 			ss = sdp_open(laddr, raddr);
-			if (ss == NULL)
-return NULL;
+			if (ss != NULL) {
+rv = cfg_search(ss, i, dict);
 
-			/* build ServiceSearchPattern */
-			ssp.next = buf;
-			ssp.end = buf + sizeof(buf);
-
-			for (n = 0; n < cfgtype[i].nservices; n++)
-sdp_put_uuid16(&ssp, cfgtype[i].services[n]);
-
-			ssp.end = ssp.next;
-			ssp.next = buf;
-
-			rv = sdp_service_search_attribute(ss, &ssp, NULL, &rsp);
-			if (!rv) {
-prop_object_release(dict);
 sdp_close(ss);
-return NULL;
-			}
 
-			while (sdp_get_seq(&rsp, &rec)) {
-errno = (*cfgtype[i].handler)(dict, &rec);
-i

CVS commit: src/sys/dev/bluetooth

2010-04-27 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Wed Apr 28 06:13:51 UTC 2010

Modified Files:
src/sys/dev/bluetooth: btdev.h bthidev.c bthidev.h

Log Message:
allow for vendor-id and product-id properties, passing them
through to child devices


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/bluetooth/btdev.h
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/bluetooth/bthidev.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/bluetooth/bthidev.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/bluetooth/btdev.h
diff -u src/sys/dev/bluetooth/btdev.h:1.8 src/sys/dev/bluetooth/btdev.h:1.9
--- src/sys/dev/bluetooth/btdev.h:1.8	Fri Mar 28 21:17:37 2008
+++ src/sys/dev/bluetooth/btdev.h	Wed Apr 28 06:13:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: btdev.h,v 1.8 2008/03/28 21:17:37 plunky Exp $	*/
+/*	$NetBSD: btdev.h,v 1.9 2010/04/28 06:13:51 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -39,6 +39,8 @@
 #define BTDEV_DETACH		_IOW('b', 15, struct plistref)
 
 /* btdev properties */
+#define BTDEVvendor		"vendor-id"
+#define BTDEVproduct		"product-id"
 #define BTDEVtype		"device-type"
 #define BTDEVladdr		"local-bdaddr"
 #define BTDEVraddr		"remote-bdaddr"

Index: src/sys/dev/bluetooth/bthidev.c
diff -u src/sys/dev/bluetooth/bthidev.c:1.18 src/sys/dev/bluetooth/bthidev.c:1.19
--- src/sys/dev/bluetooth/bthidev.c:1.18	Fri Aug 21 10:01:25 2009
+++ src/sys/dev/bluetooth/bthidev.c	Wed Apr 28 06:13:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthidev.c,v 1.18 2009/08/21 10:01:25 plunky Exp $	*/
+/*	$NetBSD: bthidev.c,v 1.19 2010/04/28 06:13:51 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.18 2009/08/21 10:01:25 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.19 2010/04/28 06:13:51 plunky Exp $");
 
 #include 
 #include 
@@ -181,6 +181,7 @@
 	const void *desc;
 	int locs[BTHIDBUSCF_NLOCS];
 	int maxid, rep, dlen;
+	int vendor, product;
 
 	/*
 	 * Init softc
@@ -205,6 +206,12 @@
 	obj = prop_dictionary_get(dict, BTDEVraddr);
 	bdaddr_copy(&sc->sc_raddr, prop_data_data_nocopy(obj));
 
+	obj = prop_dictionary_get(dict, BTDEVvendor);
+	vendor = (int)prop_number_integer_value(obj);
+
+	obj = prop_dictionary_get(dict, BTDEVproduct);
+	product = (int)prop_number_integer_value(obj);
+
 	obj = prop_dictionary_get(dict, BTDEVmode);
 	if (prop_object_type(obj) == PROP_TYPE_STRING) {
 		if (prop_string_equals_cstring(obj, BTDEVauth))
@@ -279,6 +286,8 @@
 		&& hid_report_size(desc, dlen, hid_output, rep) == 0)
 			continue;
 
+		bha.ba_vendor = vendor;
+		bha.ba_product = product;
 		bha.ba_desc = desc;
 		bha.ba_dlen = dlen;
 		bha.ba_input = bthidev_null;

Index: src/sys/dev/bluetooth/bthidev.h
diff -u src/sys/dev/bluetooth/bthidev.h:1.4 src/sys/dev/bluetooth/bthidev.h:1.5
--- src/sys/dev/bluetooth/bthidev.h:1.4	Sat Nov  3 17:41:03 2007
+++ src/sys/dev/bluetooth/bthidev.h	Wed Apr 28 06:13:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthidev.h,v 1.4 2007/11/03 17:41:03 plunky Exp $	*/
+/*	$NetBSD: bthidev.h,v 1.5 2010/04/28 06:13:51 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -60,6 +60,8 @@
 
 /* HID device attach arguments */
 struct bthidev_attach_args {
+	int		 ba_vendor;	/* USB Forum Vendor ID */
+	int		 ba_product;	/* USB Forum Product ID */
 	const void	*ba_desc;	/* descriptor */
 	int		 ba_dlen;	/* descriptor length */
 	int		 ba_id;		/* report id */



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

2010-04-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Apr 28 06:06:11 UTC 2010

Modified Files:
src/sys/arch/hp700/dev: mem.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/hp700/dev/mem.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/hp700/dev/mem.c
diff -u src/sys/arch/hp700/dev/mem.c:1.23 src/sys/arch/hp700/dev/mem.c:1.24
--- src/sys/arch/hp700/dev/mem.c:1.23	Wed Apr 28 06:02:20 2010
+++ src/sys/arch/hp700/dev/mem.c	Wed Apr 28 06:06:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.23 2010/04/28 06:02:20 skrll Exp $	*/
+/*	$NetBSD: mem.c,v 1.24 2010/04/28 06:06:11 skrll Exp $	*/
 
 /*	$OpenBSD: mem.c,v 1.30 2007/09/22 16:21:32 krw Exp $	*/
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.23 2010/04/28 06:02:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.24 2010/04/28 06:06:11 skrll Exp $");
 
 #include 
 #include 
@@ -368,13 +368,13 @@
 		case DEV_NULL:/*  /dev/null  */
 			if (uio->uio_rw == UIO_WRITE)
 uio->uio_resid = 0;
-			return (0);
+			return 0;
 
 		case DEV_ZERO:			/*  /dev/zero  */
 			/* Write to /dev/zero is ignored. */
 			if (uio->uio_rw == UIO_WRITE) {
 uio->uio_resid = 0;
-return (0);
+return 0;
 			}
 			/*
 			 * On the first call, allocate and zero a page
@@ -390,10 +390,10 @@
 			break;
 
 		default:
-			return (ENXIO);
+			return ENXIO;
 		}
 	}
-	return (error);
+	return error;
 }
 
 paddr_t
@@ -401,7 +401,7 @@
 {
 
 	if (minor(dev) != DEV_MEM)
-		return (-1);
+		return -1;
 
 	/*
 	 * Allow access only in RAM.
@@ -409,7 +409,7 @@
 #if 0
 	if (off < ptoa(firstusablepage) ||
 	off >= ptoa(lastusablepage + 1))
-		return (-1);
+		return -1;
 #endif
-	return (btop(off));
+	return btop(off);
 }



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

2010-04-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Apr 28 06:02:20 UTC 2010

Modified Files:
src/sys/arch/hp700/dev: mem.c

Log Message:
Use DEV_MEM instead of magic constant.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/hp700/dev/mem.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/hp700/dev/mem.c
diff -u src/sys/arch/hp700/dev/mem.c:1.22 src/sys/arch/hp700/dev/mem.c:1.23
--- src/sys/arch/hp700/dev/mem.c:1.22	Wed Feb 10 20:32:02 2010
+++ src/sys/arch/hp700/dev/mem.c	Wed Apr 28 06:02:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.22 2010/02/10 20:32:02 skrll Exp $	*/
+/*	$NetBSD: mem.c,v 1.23 2010/04/28 06:02:20 skrll Exp $	*/
 
 /*	$OpenBSD: mem.c,v 1.30 2007/09/22 16:21:32 krw Exp $	*/
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.22 2010/02/10 20:32:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.23 2010/04/28 06:02:20 skrll Exp $");
 
 #include 
 #include 
@@ -400,7 +400,7 @@
 ap(dev_t dev, off_t off, int prot)
 {
 
-	if (minor(dev) != 0)
+	if (minor(dev) != DEV_MEM)
 		return (-1);
 
 	/*



CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Wed Apr 28 05:12:30 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.c

Log Message:
Use struct vm_physseg *vm_physmem_ptrs[] in lookup code paths
(vm_physseg_find()).


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.25 -r1.153.2.26 src/sys/uvm/uvm_page.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_page.c
diff -u src/sys/uvm/uvm_page.c:1.153.2.25 src/sys/uvm/uvm_page.c:1.153.2.26
--- src/sys/uvm/uvm_page.c:1.153.2.25	Wed Apr 28 05:05:16 2010
+++ src/sys/uvm/uvm_page.c	Wed Apr 28 05:12:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.153.2.25 2010/04/28 05:05:16 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.153.2.26 2010/04/28 05:12:30 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.25 2010/04/28 05:05:16 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.26 2010/04/28 05:12:30 uebayasi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -923,7 +923,7 @@
 #define	VM_PHYSSEG_FIND	vm_physseg_find_linear
 #endif
 
-static inline int VM_PHYSSEG_FIND(struct vm_physseg *, int, int,
+static inline int VM_PHYSSEG_FIND(struct vm_physseg **, int, int,
 paddr_t, const struct vm_page *, int *);
 static inline bool vm_physseg_within_p(struct vm_physseg *, int, paddr_t,
 const struct vm_page *, int *);
@@ -936,7 +936,7 @@
 vm_physseg_find(paddr_t pframe, int *offp)
 {
 
-	return VM_PHYSSEG_FIND(vm_physmem, vm_nphysmem, VM_PHYSSEG_OP_PF,
+	return VM_PHYSSEG_FIND(vm_physmem_ptrs, vm_nphysmem, VM_PHYSSEG_OP_PF,
 	pframe, NULL, offp);
 }
 
@@ -945,19 +945,19 @@
 vm_physseg_find_device(paddr_t pframe, int *offp)
 {
 
-	return VM_PHYSSEG_FIND(vm_physdev, vm_nphysdev, VM_PHYSSEG_OP_PF,
+	return VM_PHYSSEG_FIND(vm_physdev_ptrs, vm_nphysdev, VM_PHYSSEG_OP_PF,
 	pframe, NULL, offp);
 }
 #endif
 
 #if VM_PHYSSEG_MAX == 1
 static inline int
-vm_physseg_find_contig(struct vm_physseg *segs, int nsegs, int op,
+vm_physseg_find_contig(struct vm_physseg **segs, int nsegs, int op,
 paddr_t pframe, const struct vm_page *pg, int *offp)
 {
 
 	/* 'contig' case */
-	if (vm_physseg_within_p(&segs[0], op, pframe, pg, offp)) {
+	if (vm_physseg_within_p(segs[0], op, pframe, pg, offp)) {
 		return(0);
 	}
 	return(-1);
@@ -966,7 +966,7 @@
 #elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
 
 static inline int
-vm_physseg_find_bsearch(struct vm_physseg *segs, int nsegs, int op,
+vm_physseg_find_bsearch(struct vm_physseg **segs, int nsegs, int op,
 paddr_t pframe, const struct vm_page *pg, int *offp)
 {
 	/* binary search for it */
@@ -989,9 +989,9 @@
 		try = start + (len / 2);	/* try in the middle */
 
 		/* start past our try? */
-		if (vm_physseg_ge_p(&segs[try], op, pframe, pg, offp)) {
+		if (vm_physseg_ge_p(segs[try], op, pframe, pg, offp)) {
 			/* was try correct? */
-			if (vm_physseg_lt_p(&segs[try], op, pframe, pg, offp)) {
+			if (vm_physseg_lt_p(segs[try], op, pframe, pg, offp)) {
 return(try);/* got it */
 			}
 			start = try + 1;	/* next time, start here */
@@ -1009,14 +1009,14 @@
 #else
 
 static inline int
-vm_physseg_find_linear(struct vm_physseg *segs, int nsegs, int op,
+vm_physseg_find_linear(struct vm_physseg **segs, int nsegs, int op,
 paddr_t pframe, const struct vm_page *pg, int *offp)
 {
 	/* linear search for it */
 	int	lcv;
 
 	for (lcv = 0; lcv < nsegs; lcv++) {
-		if (vm_physseg_within_p(&segs[lcv], op, pframe, pg, offp)) {
+		if (vm_physseg_within_p(segs[lcv], op, pframe, pg, offp)) {
 			return(lcv);		   /* got it */
 		}
 	}
@@ -1153,7 +1153,7 @@
 	const struct vm_physseg *seg;
 	int psi;
 
-	psi = VM_PHYSSEG_FIND(vm_physmem, vm_nphysmem, VM_PHYSSEG_OP_PG, 0, pg, NULL);
+	psi = VM_PHYSSEG_FIND(vm_physmem_ptrs, vm_nphysmem, VM_PHYSSEG_OP_PG, 0, pg, NULL);
 	KASSERT(psi != -1);
 	seg = vm_physmem_ptrs[psi];
 	return (seg->start + pg - seg->pgs) * PAGE_SIZE;



CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Wed Apr 28 05:05:16 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.c

Log Message:
Use struct vm_physseg *vm_physmem_ptrs[] in initialization code paths.


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.24 -r1.153.2.25 src/sys/uvm/uvm_page.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_page.c
diff -u src/sys/uvm/uvm_page.c:1.153.2.24 src/sys/uvm/uvm_page.c:1.153.2.25
--- src/sys/uvm/uvm_page.c:1.153.2.24	Tue Apr 27 15:01:11 2010
+++ src/sys/uvm/uvm_page.c	Wed Apr 28 05:05:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.153.2.24 2010/04/27 15:01:11 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.153.2.25 2010/04/28 05:05:16 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.24 2010/04/27 15:01:11 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.25 2010/04/28 05:05:16 uebayasi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -357,6 +357,7 @@
 {
 	vsize_t freepages, pagecount, bucketcount, n;
 	struct pgflbucket *bucketarray, *cpuarray;
+	struct vm_physseg *seg;
 	struct vm_page *pagearray;
 	int lcv;
 	u_int i;
@@ -400,8 +401,10 @@
 	 */
 
 	freepages = 0;
-	for (lcv = 0 ; lcv < vm_nphysmem ; lcv++)
-		freepages += (vm_physmem[lcv].end - vm_physmem[lcv].start);
+	for (lcv = 0 ; lcv < vm_nphysmem ; lcv++) {
+		seg = vm_physmem_ptrs[lcv];
+		freepages += (seg->end - seg->start);
+	}
 
 	/*
 	 * Let MD code initialize the number of colors, or default
@@ -446,28 +449,29 @@
 	 */
 
 	for (lcv = 0 ; lcv < vm_nphysmem ; lcv++) {
-		n = vm_physmem[lcv].end - vm_physmem[lcv].start;
+		seg = vm_physmem_ptrs[lcv];
+		n = seg->end - seg->start;
 
 		/* set up page array pointers */
-		vm_physmem[lcv].pgs = pagearray;
+		seg->pgs = pagearray;
 		pagearray += n;
 		pagecount -= n;
-		vm_physmem[lcv].endpg = vm_physmem[lcv].pgs + n;
+		seg->endpg = seg->pgs + n;
 
 		/* init and free vm_pages (we've already zeroed them) */
-		paddr = ptoa(vm_physmem[lcv].start);
+		paddr = ptoa(seg->start);
 		for (i = 0 ; i < n ; i++, paddr += PAGE_SIZE) {
 #if 1
-			vm_physmem[lcv].pgs[i].phys_addr = paddr;
+			seg->pgs[i].phys_addr = paddr;
 #endif
 #ifdef __HAVE_VM_PAGE_MD
-			VM_MDPAGE_INIT(&vm_physmem[lcv].pgs[i].mdpage, paddr);
+			VM_MDPAGE_INIT(&seg->pgs[i].mdpage, paddr);
 #endif
-			if (atop(paddr) >= vm_physmem[lcv].avail_start &&
-			atop(paddr) <= vm_physmem[lcv].avail_end) {
+			if (atop(paddr) >= seg->avail_start &&
+			atop(paddr) <= seg->avail_end) {
 uvmexp.npages++;
 /* add page to free pool */
-uvm_pagefree(&vm_physmem[lcv].pgs[i]);
+uvm_pagefree(&seg->pgs[i]);
 			}
 		}
 	}
@@ -641,6 +645,7 @@
 static bool
 uvm_page_physget_freelist(paddr_t *paddrp, int freelist)
 {
+	struct vm_physseg *seg;
 	int lcv, x;
 
 	/* pass 1: try allocating from a matching end */
@@ -650,47 +655,44 @@
 	for (lcv = 0 ; lcv < vm_nphysmem ; lcv++)
 #endif
 	{
+		seg = vm_physmem_ptrs[lcv];
 
 		if (uvm.page_init_done == true)
 			panic("uvm_page_physget: called _after_ bootstrap");
 
-		if (vm_physmem[lcv].free_list != freelist)
+		if (seg->free_list != freelist)
 			continue;
 
 		/* try from front */
-		if (vm_physmem[lcv].avail_start == vm_physmem[lcv].start &&
-		vm_physmem[lcv].avail_start < vm_physmem[lcv].avail_end) {
-			*paddrp = ptoa(vm_physmem[lcv].avail_start);
-			vm_physmem[lcv].avail_start++;
-			vm_physmem[lcv].start++;
+		if (seg->avail_start == seg->start &&
+		seg->avail_start < seg->avail_end) {
+			*paddrp = ptoa(seg->avail_start);
+			seg->avail_start++;
+			seg->start++;
 			/* nothing left?   nuke it */
-			if (vm_physmem[lcv].avail_start ==
-			vm_physmem[lcv].end) {
+			if (seg->avail_start == seg->end) {
 if (vm_nphysmem == 1)
 panic("uvm_page_physget: out of memory!");
 vm_nphysmem--;
 for (x = lcv ; x < vm_nphysmem ; x++)
-	/* structure copy */
-	vm_physmem[x] = vm_physmem[x+1];
+	vm_physmem_ptrs[x] = vm_physmem_ptrs[x+1];
 			}
 			return (true);
 		}
 
 		/* try from rear */
-		if (vm_physmem[lcv].avail_end == vm_physmem[lcv].end &&
-		vm_physmem[lcv].avail_start < vm_physmem[lcv].avail_end) {
-			*paddrp = ptoa(vm_physmem[lcv].avail_end - 1);
-			vm_physmem[lcv].avail_end--;
-			vm_physmem[lcv].end--;
+		if (seg->avail_end == seg->end &&
+		seg->avail_start < seg->avail_end) {
+			*paddrp = ptoa(seg->avail_end - 1);
+			seg->avail_end--;
+			seg->end--;
 			/* nothing left?   nuke it */
-			if (vm_physmem[lcv].avail_end ==
-			vm_physmem[lcv].start) {
+			if (seg->avail_end == seg->start) {
 if (vm_nphysmem == 1)
 panic("uvm_page_physget: out of memory!");
 vm_nphysmem--;
 for (x = lcv ; x < vm_nphysmem ; x++)
-	/* structure copy */
-	vm_physmem[x

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

2010-04-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Apr 28 03:14:46 UTC 2010

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

Log Message:
Now that the Atheros HAL is gone, remove the hacks in place for it.
(also fixes a stupid bug).


To generate a diff of this commit:
cvs rdiff -u -r1.26.36.1.2.30 -r1.26.36.1.2.31 \
src/sys/arch/mips/mips/mipsX_subr.S

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

Modified files:

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.30 src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.31
--- src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.30	Mon Mar  1 19:29:41 2010
+++ src/sys/arch/mips/mips/mipsX_subr.S	Wed Apr 28 03:14:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.30 2010/03/01 19:29:41 matt Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.31 2010/04/28 03:14:45 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -617,7 +617,7 @@
 	REG_S	ta2, TF_BASE+TF_REG_TA2(sp)
 	REG_S	ta3, TF_BASE+TF_REG_TA3(sp)
 	_MFC0	a2, MIPS_COP_0_BAD_VADDR	# 3rd arg is fault address
-	REG_S	t8, TF_BASE+TF_REG_T8(sp)
+	REG_S	t8, TF_BASE+TF_REG_T8(sp)	# will be MIPS_CURLWP
 	REG_S	t9, TF_BASE+TF_REG_T9(sp)
 	REG_S	ra, TF_BASE+TF_REG_RA(sp)
 	REG_S	a0, TF_BASE+TF_REG_SR(sp)
@@ -752,7 +752,7 @@
 	REG_L	ta1, TF_BASE+TF_REG_TA1(sp)
 	REG_L	ta2, TF_BASE+TF_REG_TA2(sp)
 	REG_L	ta3, TF_BASE+TF_REG_TA3(sp)
-	REG_L	t8, TF_BASE+TF_REG_T8(sp)
+	REG_L	t8, TF_BASE+TF_REG_T8(sp)	# was MIPS_CURLWP
 	REG_L	t9, TF_BASE+TF_REG_T9(sp)
 	REG_L	ra, TF_BASE+TF_REG_RA(sp)
 #ifdef DDBnotyet
@@ -818,7 +818,7 @@
 	REG_S	s6, CALLFRAME_SIZ+TF_REG_S6(k0)
 	REG_S	s7, CALLFRAME_SIZ+TF_REG_S7(k0)
 	_MFC0	a3, MIPS_COP_0_EXC_PC		# 4th arg is exception PC
-	REG_S	t8, CALLFRAME_SIZ+TF_REG_T8(k0)
+	REG_S	t8, CALLFRAME_SIZ+TF_REG_T8(k0)	# will be MIPS_CURLWP
 	REG_S	t9, CALLFRAME_SIZ+TF_REG_T9(k0)
 	REG_S	gp, CALLFRAME_SIZ+TF_REG_GP(k0)
 	REG_S	sp, CALLFRAME_SIZ+TF_REG_SP(k0)
@@ -920,7 +920,7 @@
 	REG_S	ta2, CALLFRAME_SIZ+TF_REG_TA2(k0)
 	REG_S	ta3, CALLFRAME_SIZ+TF_REG_TA3(k0)
 #endif
-	REG_S	t8, CALLFRAME_SIZ+TF_REG_T8(k0)
+	REG_S	t8, CALLFRAME_SIZ+TF_REG_T8(k0)	# was MIPS_CURLWP
 	REG_S	t9, CALLFRAME_SIZ+TF_REG_T9(k0)
 	REG_S	gp, CALLFRAME_SIZ+TF_REG_GP(k0)
 	REG_S	sp, CALLFRAME_SIZ+TF_REG_SP(k0)
@@ -1081,15 +1081,12 @@
 	REG_S	s1, TF_BASE+TF_REG_S1(sp)	# s1 is used for initial status
 	mfc0	s1, MIPS_COP_0_STATUS
 	REG_S	s2, TF_BASE+TF_REG_S2(sp)	# s2 is used for cpu_info
-	REG_S	t8, TF_BASE+TF_REG_T8(sp)
+	REG_S	t8, TF_BASE+TF_REG_T8(sp)	# MIPS_CURLWP
 	REG_S	t9, TF_BASE+TF_REG_T9(sp)
 	REG_S	ra, TF_BASE+TF_REG_RA(sp)
 	REG_S	a0, TF_BASE+TF_REG_SR(sp)
 	REG_S	v0, TF_BASE+TF_REG_MULLO(sp)
 	REG_S	v1, TF_BASE+TF_REG_MULHI(sp)
-#if TF_MIPS_CURLWP != TF_REG_T8
-REG_S   MIPS_CURLWP, TF_BASE+TF_PAD(sp) # XXX Atheros HAL
-#endif
 /*
  * Call the interrupt handler.
  */
@@ -1099,7 +1096,6 @@
 #if defined(DDB) || defined(DEBUG) || defined(KGDB)
 	REG_S	ra, KERNFRAME_RA(sp)		# for debugging
 #endif
-	move	MIPS_CURLWP, k1			# XXX Atheros HAL
 
 	PTR_L	s2, L_CPU(MIPS_CURLWP)
 #ifdef PARANOIA
@@ -1252,9 +1248,6 @@
 	nop
 	nop
 
-#if TF_MIPS_CURLWP != TF_REG_T8
-	REG_L	MIPS_CURLWP, TF_BASE+TF_PAD(sp)	# XXX Atheros HAL
-#endif
 	REG_L	t0, TF_BASE+TF_REG_MULLO(sp)
 	REG_L	t1, TF_BASE+TF_REG_MULHI(sp)
 	REG_L	v0, TF_BASE+TF_REG_EPC(sp)
@@ -1376,9 +1369,6 @@
 	REG_S	v1, CALLFRAME_SIZ+TF_REG_MULHI(k0)
 	REG_S	ra, CALLFRAME_SIZ+TF_REG_EPC(k0)
 	REG_S	t0, CALLFRAME_SIZ+TF_REG_CAUSE(k0)
-#if TF_MIPS_CURLWP != TF_REG_T8
-	PTR_S	MIPS_CURLWP, CALLFRAME_SIZ+TF_MIPS_CURLWP(k0)# save curlwp reg (t8)
-#endif
 	move	sp, k0
 	move	MIPS_CURLWP, k1			# set curlwp reg (t8)
 #if defined(DDB) || defined(DEBUG) || defined(KGDB)
@@ -2118,7 +2108,7 @@
 	REG_L	ta1, CALLFRAME_SIZ+TF_REG_TA1(k1)	#  $9 / $13
 	REG_L	ta2, CALLFRAME_SIZ+TF_REG_TA2(k1)	# $10 / $14
 	REG_L	ta3, CALLFRAME_SIZ+TF_REG_TA3(k1)	# $11 / $15
-	REG_L	t8, CALLFRAME_SIZ+TF_REG_T8(k1)		# $24
+	REG_L	t8, CALLFRAME_SIZ+TF_REG_T8(k1)		# $24 MIPS_CURLWP
 	REG_L	t9, CALLFRAME_SIZ+TF_REG_T9(k1)		# $25
 	REG_L	k0, CALLFRAME_SIZ+TF_REG_SR(k1)		# status register
 	DYNAMIC_STATUS_MASK(k0, sp)		# machine dependent masking



CVS commit: src/sys/rump/librump/rumpkern

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 28 00:43:16 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: rump.c

Log Message:
Make number of virtual CPUs match number of host CPUs on NetBSD/x86 hosts.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/rump/librump/rumpkern/rump.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/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.165 src/sys/rump/librump/rumpkern/rump.c:1.166
--- src/sys/rump/librump/rumpkern/rump.c:1.165	Tue Apr 27 23:30:30 2010
+++ src/sys/rump/librump/rumpkern/rump.c	Wed Apr 28 00:43:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.165 2010/04/27 23:30:30 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.166 2010/04/28 00:43:16 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.165 2010/04/27 23:30:30 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.166 2010/04/28 00:43:16 pooka Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -203,7 +203,7 @@
 	uint64_t sec, nsec;
 	struct proc *p;
 	struct lwp *l;
-	int i;
+	int i, numcpu;
 	int error;
 
 	/* not reentrant */
@@ -219,8 +219,13 @@
 			boothowto = AB_VERBOSE;
 	}
 
-	/* get our CPUs initialized */
-	rump_cpus_bootstrap(1);
+	/* non-x86 is missing CPU_INFO_FOREACH() support */
+#if defined(__i386__) || defined(__x86_64__)
+	numcpu = rumpuser_getnhostcpu();
+#else
+	numcpu = 1;
+#endif
+	rump_cpus_bootstrap(numcpu);
 
 	rumpuser_gettime(&sec, &nsec, &error);
 	boottime.tv_sec = sec;



CVS commit: src/sys/rump/librump/rumpkern

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 28 00:42:16 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: scheduler.c

Log Message:
Limit virtual CPUs to MAXCPUS for now.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/librump/rumpkern/scheduler.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/rump/librump/rumpkern/scheduler.c
diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.12 src/sys/rump/librump/rumpkern/scheduler.c:1.13
--- src/sys/rump/librump/rumpkern/scheduler.c:1.12	Tue Apr 27 23:30:30 2010
+++ src/sys/rump/librump/rumpkern/scheduler.c	Wed Apr 28 00:42:16 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.12 2010/04/27 23:30:30 pooka Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.13 2010/04/28 00:42:16 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.12 2010/04/27 23:30:30 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.13 2010/04/28 00:42:16 pooka Exp $");
 
 #include 
 #include 
@@ -80,6 +80,12 @@
 	struct cpu_info *ci;
 	int i;
 
+	if (num > MAXCPUS) {
+		aprint_verbose("CPU limit: %d wanted, %d (MAXCPUS) available\n",
+		num, MAXCPUS);
+		num = MAXCPUS;
+	}
+
 	for (i = 0; i < num; i++) {
 		rcpu = &rcpu_storage[i];
 		ci = &rump_cpus[i];



CVS commit: src/sys/rump/librump/rumpkern/arch/i386

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 28 00:34:25 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern/arch/i386: rumpcpu.c

Log Message:
set first attached cpu as primary


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.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/rump/librump/rumpkern/arch/i386/rumpcpu.c
diff -u src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c:1.8 src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c:1.9
--- src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c:1.8	Tue Apr 27 23:30:30 2010
+++ src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c	Wed Apr 28 00:34:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpcpu.c,v 1.8 2010/04/27 23:30:30 pooka Exp $	*/
+/*	$NetBSD: rumpcpu.c,v 1.9 2010/04/28 00:34:25 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpcpu.c,v 1.8 2010/04/27 23:30:30 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpcpu.c,v 1.9 2010/04/28 00:34:25 pooka Exp $");
 
 #include 
 
@@ -43,6 +43,9 @@
 rump_cpu_attach(struct cpu_info *ci)
 {
 
+	if (cpu_info_list == NULL)
+		ci->ci_flags |= CPUF_PRIMARY;
+
 	/* XXX: wrong order, but ... */
 	ci->ci_next = cpu_info_list;
 	cpu_info_list = ci;



CVS commit: src

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 28 00:33:45 UTC 2010

Modified Files:
src/lib/librumpuser: rumpuser.c
src/sys/rump/include/rump: rumpuser.h

Log Message:
Add rumpuser interface to fetch number of host cpus.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/librumpuser/rumpuser.c
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/include/rump/rumpuser.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/librumpuser/rumpuser.c
diff -u src/lib/librumpuser/rumpuser.c:1.3 src/lib/librumpuser/rumpuser.c:1.4
--- src/lib/librumpuser/rumpuser.c:1.3	Wed Apr 21 11:16:41 2010
+++ src/lib/librumpuser/rumpuser.c	Wed Apr 28 00:33:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.c,v 1.3 2010/04/21 11:16:41 pooka Exp $	*/
+/*	$NetBSD: rumpuser.c,v 1.4 2010/04/28 00:33:45 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.3 2010/04/21 11:16:41 pooka Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.4 2010/04/28 00:33:45 pooka Exp $");
 #endif /* !lint */
 
 /* thank the maker for this */
@@ -46,6 +46,7 @@
 
 #ifdef __NetBSD__
 #include 
+#include 
 #endif
 
 #include 
@@ -589,3 +590,18 @@
 	return -1;
 #endif
 }
+
+int
+rumpuser_getnhostcpu(void)
+{
+	int ncpu;
+	size_t sz = sizeof(ncpu);
+
+#ifdef __NetBSD__
+	if (sysctlbyname("hw.ncpu", &ncpu, &sz, NULL, 0) == -1)
+		return 1;
+	return ncpu;
+#else
+	return 1;
+#endif
+}

Index: src/sys/rump/include/rump/rumpuser.h
diff -u src/sys/rump/include/rump/rumpuser.h:1.39 src/sys/rump/include/rump/rumpuser.h:1.40
--- src/sys/rump/include/rump/rumpuser.h:1.39	Wed Apr 21 11:13:29 2010
+++ src/sys/rump/include/rump/rumpuser.h	Wed Apr 28 00:33:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.h,v 1.39 2010/04/21 11:13:29 pooka Exp $	*/
+/*	$NetBSD: rumpuser.h,v 1.40 2010/04/28 00:33:45 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -109,6 +109,8 @@
 
 int rumpuser_dprintf(const char *, ...);
 
+int rumpuser_getnhostcpu(void);
+
 /* rumpuser_pth */
 void rumpuser_thrinit(kernel_lockfn, kernel_unlockfn, int);
 void rumpuser_biothread(void *);



CVS commit: src/sys/rump/librump/rumpkern

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 28 00:32:30 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: intr.c

Log Message:
Fix snafu which caused the clock to travel lightspeed.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/rump/librump/rumpkern/intr.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.25 src/sys/rump/librump/rumpkern/intr.c:1.26
--- src/sys/rump/librump/rumpkern/intr.c:1.25	Tue Apr 27 23:30:29 2010
+++ src/sys/rump/librump/rumpkern/intr.c	Wed Apr 28 00:32:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.25 2010/04/27 23:30:29 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.26 2010/04/28 00:32:30 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.25 2010/04/27 23:30:29 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.26 2010/04/28 00:32:30 pooka Exp $");
 
 #include 
 #include 
@@ -63,11 +63,6 @@
 	LIST_HEAD(, softint) si_pending;
 };
 
-/* rumpuser structures since we call rumpuser interfaces directly */
-static struct rumpuser_cv *clockcv;
-static struct rumpuser_mtx *clockmtx;
-static struct timespec clockbase, clockup;
-
 kcondvar_t lbolt; /* Oh Kath Ra */
 
 static u_int ticks;
@@ -95,11 +90,15 @@
 static void
 doclock(void *noarg)
 {
+	struct timespec clockbase, clockup;
 	struct timespec thetick, curtime;
+	struct rumpuser_cv *clockcv;
+	struct rumpuser_mtx *clockmtx;
 	uint64_t sec, nsec;
 	int error;
 	extern int hz;
 
+	memset(&clockup, 0, sizeof(clockup));
 	rumpuser_gettime(&sec, &nsec, &error);
 	clockbase.tv_sec = sec;
 	clockbase.tv_nsec = nsec;
@@ -107,6 +106,10 @@
 	thetick.tv_sec = 0;
 	thetick.tv_nsec = 10/hz;
 
+	/* XXX: dummies */
+	rumpuser_cv_init(&clockcv);
+	rumpuser_mutex_init(&clockmtx);
+
 	rumpuser_mutex_enter(clockmtx);
 	for (;;) {
 		callout_hardclock();
@@ -115,12 +118,19 @@
 		while (rumpuser_cv_timedwait(clockcv, clockmtx,
 		curtime.tv_sec, curtime.tv_nsec) == 0)
 			continue;
-		timespecadd(&clockup, &thetick, &clockup);
+
+		/* XXX: sync with a) virtual clock b) host clock */
 		timespecadd(&clockup, &clockbase, &curtime);
-		
-		/* if !maincpu: continue */
-		if (curcpu()->ci_index != 0)
+		timespecadd(&clockup, &thetick, &clockup);
+
+#if 0
+		/* CPU_IS_PRIMARY is MD and hence unreliably correct here */
+		if (!CPU_IS_PRIMARY(curcpu()))
+			continue;
+#else
+		if (curcpu()->ci_index == 0)
 			continue;
+#endif
 
 		if ((++ticks % hz) == 0) {
 			cv_broadcast(&lbolt);
@@ -197,8 +207,6 @@
 {
 
 	rumpuser_mutex_init(&si_mtx);
-	rumpuser_cv_init(&clockcv);
-	rumpuser_mutex_init(&clockmtx);
 	cv_init(&lbolt, "oh kath ra");
 }
 



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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

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

CVS commit: src/sys/rump/librump/rumpkern

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Apr 27 23:30:30 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: intr.c rump.c rump_private.h
rumpcpu_generic.c scheduler.c
src/sys/rump/librump/rumpkern/arch/i386: rumpcpu.c

Log Message:
Fix multiple virtual cpu support.

... or at least on x86.  CPU_INFO_FOREACH() still isn't MI, and I
don't want to support 2^n different versions.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/rump/librump/rumpkern/intr.c
cvs rdiff -u -r1.164 -r1.165 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/librump/rumpkern/rump_private.h
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/librump/rumpkern/rumpcpu_generic.c
cvs rdiff -u -r1.11 -r1.12 src/sys/rump/librump/rumpkern/scheduler.c
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.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/rump/librump/rumpkern/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.24 src/sys/rump/librump/rumpkern/intr.c:1.25
--- src/sys/rump/librump/rumpkern/intr.c:1.24	Wed Apr 14 10:27:53 2010
+++ src/sys/rump/librump/rumpkern/intr.c	Tue Apr 27 23:30:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.24 2010/04/14 10:27:53 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.25 2010/04/27 23:30:29 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.24 2010/04/14 10:27:53 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.25 2010/04/27 23:30:29 pooka Exp $");
 
 #include 
 #include 
@@ -108,8 +108,6 @@
 	thetick.tv_nsec = 10/hz;
 
 	rumpuser_mutex_enter(clockmtx);
-	rumpuser_cv_signal(clockcv);
-
 	for (;;) {
 		callout_hardclock();
 
@@ -117,16 +115,17 @@
 		while (rumpuser_cv_timedwait(clockcv, clockmtx,
 		curtime.tv_sec, curtime.tv_nsec) == 0)
 			continue;
+		timespecadd(&clockup, &thetick, &clockup);
+		timespecadd(&clockup, &clockbase, &curtime);
 		
 		/* if !maincpu: continue */
+		if (curcpu()->ci_index != 0)
+			continue;
 
 		if ((++ticks % hz) == 0) {
 			cv_broadcast(&lbolt);
 		}
 		tc_ticktock();
-
-		timespecadd(&clockup, &thetick, &clockup);
-		timespecadd(&clockup, &clockbase, &curtime);
 	}
 }
 
@@ -213,6 +212,12 @@
 	if (!rump_threads)
 		return;
 
+	/* XXX */
+	if (ci->ci_index == 0) {
+		rumptc.tc_frequency = hz;
+		tc_init(&rumptc);
+	}
+
 	slev = kmem_alloc(sizeof(struct softint_lev) * SOFTINT_COUNT, KM_SLEEP);
 	for (i = 0; i < SOFTINT_COUNT; i++) {
 		rumpuser_cv_init(&slev[i].si_cv);
@@ -222,30 +227,15 @@
 
 	for (i = 0; i < SOFTINT_COUNT; i++) {
 		rv = kthread_create(PRI_NONE,
-		KTHREAD_MPSAFE | KTHREAD_INTR, NULL,
+		KTHREAD_MPSAFE | KTHREAD_INTR, ci,
 		sithread, (void *)(uintptr_t)i,
 		NULL, "rumpsi%d", i);
 	}
 
-	rumpuser_mutex_enter(clockmtx);
-	for (i = 0; i < ncpu; i++) {
-		rv = kthread_create(PRI_NONE,
-		KTHREAD_MPSAFE | KTHREAD_INTR,
-		cpu_lookup(i), doclock, NULL, NULL,
-		"rumpclk%d", i);
-		if (rv)
-			panic("clock thread creation failed: %d", rv);
-	}
-
-	rumptc.tc_frequency = hz;
-	tc_init(&rumptc);
-
-	/*
-	 * Make sure we have a clocktime before returning.
-	 * XXX: mp
-	 */
-	rumpuser_cv_wait(clockcv, clockmtx);
-	rumpuser_mutex_exit(clockmtx);
+	rv = kthread_create(PRI_NONE, KTHREAD_MPSAFE | KTHREAD_INTR,
+	ci, doclock, NULL, NULL, "rumpclk%d", i);
+	if (rv)
+		panic("clock thread creation failed: %d", rv);
 }
 
 /*

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.164 src/sys/rump/librump/rumpkern/rump.c:1.165
--- src/sys/rump/librump/rumpkern/rump.c:1.164	Mon Apr 26 20:10:23 2010
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Apr 27 23:30:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.164 2010/04/26 20:10:23 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.165 2010/04/27 23:30:30 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.164 2010/04/26 20:10:23 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.165 2010/04/27 23:30:30 pooka Exp $");
+
+#include 
+#define ELFSIZE ARCH_ELFSIZE
 
 #include 
 #include 
@@ -216,6 +219,9 @@
 			boothowto = AB_VERBOSE;
 	}
 
+	/* get our CPUs initialized */
+	rump_cpus_bootstrap(1);
+
 	rumpuser_gettime(&sec, &nsec, &error);
 	boottime.tv_sec = sec;
 	boottime.tv_nsec = nsec;

Index: src/sys/rump/librump/rumpkern/rump_private.h
diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.43 src/sys/rump/librump/rumpkern/rump_private.h:1.44
--- src/sys/rump/librump/rumpkern/rump_private.h:1.43	Mon Mar  1 13:12:20 2010
+++ src/sys/rump/librump/rumpkern/rump_private.h	Tue Apr 27 23:30:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_private.h,v 1.43 2010/03/01 13:12:20 pooka Exp $	*/
+/*	$NetBSD: rump_private.h,v 1.44 2010/04/27 23:30:30 pooka Exp 

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

2010-04-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 27 23:09:07 UTC 2010

Modified Files:
src/sys/net [matt-nb5-mips64]: rtsock.c

Log Message:
Make sure each rt_msg has an aligned length.


To generate a diff of this commit:
cvs rdiff -u -r1.115.2.4 -r1.115.2.4.4.1 src/sys/net/rtsock.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/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.115.2.4 src/sys/net/rtsock.c:1.115.2.4.4.1
--- src/sys/net/rtsock.c:1.115.2.4	Fri Apr  3 17:59:03 2009
+++ src/sys/net/rtsock.c	Tue Apr 27 23:09:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.115.2.4 2009/04/03 17:59:03 snj Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.115.2.4.4.1 2010/04/27 23:09:07 matt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.115.2.4 2009/04/03 17:59:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.115.2.4.4.1 2010/04/27 23:09:07 matt Exp $");
 
 #include "opt_inet.h"
 
@@ -702,6 +702,7 @@
 			}
 		}
 	}
+	len = ALIGN(len);
 	if (cp) {
 		struct rt_msghdr *rtm = (struct rt_msghdr *)cp0;
 



CVS commit: src/sys/dev/scsipi

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/dev/scsipi/scsiconf.c

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

Modified files:

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



CVS commit: src/sys/dev/mii

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/mii/brgphy.c

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

Modified files:

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



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

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

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

Log Message:
#include  for CPU feature definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/i386/pmc.c

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

Modified files:

Index: src/sys/arch/i386/i386/pmc.c
diff -u src/sys/arch/i386/i386/pmc.c:1.18 src/sys/arch/i386/i386/pmc.c:1.19
--- src/sys/arch/i386/i386/pmc.c:1.18	Thu Apr 22 21:02:25 2010
+++ src/sys/arch/i386/i386/pmc.c	Tue Apr 27 18:41:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmc.c,v 1.18 2010/04/22 21:02:25 jym Exp $	*/
+/*	$NetBSD: pmc.c,v 1.19 2010/04/27 18:41:52 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -38,13 +38,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.18 2010/04/22 21:02:25 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.19 2010/04/27 18:41:52 dyoung Exp $");
 
 #include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/games/factor

2010-04-27 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Tue Apr 27 18:11:19 UTC 2010

Modified Files:
src/games/factor: factor.c

Log Message:
-Fix an old bug in the "pollard" code: it gets its argument passed
 by reference, and changes the value behind the pointer under some
 circumstances (basically if it finds more than 2 different factors).
 It also calls itself if it finds a factor which is not considered prime
 (by openssl's miller-rabin check) and uses the call argument afterwards.
 This doesn't work -- we need to copy the argument into its own storage.
-Modify the code to do the "rho" algorithm as was initially announced.
 It takes somewhat longer in rare cases, but still works in cases where
 the "p-1" algorithm is unusable. This might fix PR misc/43192
 by Luiz Henrique de Figueiredo.
-Add some optional debug support, minor cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/games/factor/factor.c

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

Modified files:

Index: src/games/factor/factor.c
diff -u src/games/factor/factor.c:1.20 src/games/factor/factor.c:1.21
--- src/games/factor/factor.c:1.20	Thu Apr 22 14:28:48 2010
+++ src/games/factor/factor.c	Tue Apr 27 18:11:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: factor.c,v 1.20 2010/04/22 14:28:48 drochner Exp $	*/
+/*	$NetBSD: factor.c,v 1.21 2010/04/27 18:11:19 drochner Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)factor.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: factor.c,v 1.20 2010/04/22 14:28:48 drochner Exp $");
+__RCSID("$NetBSD: factor.c,v 1.21 2010/04/27 18:11:19 drochner Exp $");
 #endif
 #endif /* not lint */
 
@@ -98,6 +98,9 @@
  */
 extern const ubig prime[];
 extern const ubig *pr_limit;		/* largest prime in the prime array */
+#if 0 /* debugging: limit table use to stress the "pollard" code */
+#define pr_limit &prime[0]
+#endif
 
 #define	PRIME_CHECKS	5
 
@@ -226,7 +229,7 @@
 			BIGNUM *bnfact;
 
 			bnfact = BN_new();
-			BN_set_word(bnfact, *(fact - 1));
+			BN_set_word(bnfact, (BN_ULONG)*(fact - 1));
 			BN_sqr(bnfact, bnfact, ctx);
 			if (BN_cmp(bnfact, val) > 0
 			|| BN_is_prime(val, PRIME_CHECKS, NULL, NULL,
@@ -284,39 +287,54 @@
 static void
 pollard_pminus1(BIGNUM *val)
 {
-	BIGNUM *base, *rbase, *num, *i, *x;
+	BIGNUM *x, *y, *tmp, *num;
+	BN_ULONG a;
+	unsigned int steps_taken, steps_limit;
 
-	base = BN_new();
-	rbase = BN_new();
-	num = BN_new();
-	i = BN_new();
 	x = BN_new();
-
-	BN_set_word(rbase, 1);
- newbase:
-	BN_add_word(rbase, 1);
-	BN_set_word(i, 2);
-	BN_copy(base, rbase);
+	y = BN_new();
+	tmp = BN_new();
+	num = BN_new();
+	a = 1;
+restart:
+	steps_taken = 0;
+	steps_limit = 2;
+	BN_set_word(x, 1);
+	BN_copy(y, x);
 
 	for (;;) {
-		BN_mod_exp(base, base, i, val, ctx);
-		if (BN_is_one(base))
-			goto newbase;
-
-		BN_copy(x, base);
-		BN_sub_word(x, 1);
-		BN_gcd(x, x, val, ctx);
+		BN_sqr(tmp, x, ctx);
+		BN_add_word(tmp, a);
+		BN_mod(x, tmp, val, ctx);
+		BN_sub(tmp, x, y);
+		if (BN_is_zero(tmp)) {
+#ifdef DEBUG
+			printf(" (loop)");
+#endif
+			a++;
+			goto restart;
+		}
+		BN_gcd(tmp, tmp, val, ctx);
 
-		if (!BN_is_one(x)) {
-			if (BN_is_prime(x, PRIME_CHECKS, NULL, NULL,
+		if (!BN_is_one(tmp)) {
+			if (BN_is_prime(tmp, PRIME_CHECKS, NULL, NULL,
 			NULL) == 1) {
 putchar(' ');
-BN_print_dec_fp(stdout, x);
-			} else
-pollard_pminus1(x);
+BN_print_dec_fp(stdout, tmp);
+			} else {
+#ifdef DEBUG
+printf(" (recurse for ");
+BN_print_dec_fp(stdout, tmp);
+putchar(')');
+#endif
+pollard_pminus1(BN_dup(tmp));
+#ifdef DEBUG
+printf(" (back)");
+#endif
+			}
 			fflush(stdout);
 
-			BN_div(num, NULL, val, x, ctx);
+			BN_div(num, NULL, val, tmp, ctx);
 			if (BN_is_one(num))
 return;
 			if (BN_is_prime(num, PRIME_CHECKS, NULL, NULL,
@@ -327,8 +345,21 @@
 return;
 			}
 			BN_copy(val, num);
+			goto restart;
+		}
+		steps_taken++;
+		if (steps_taken == steps_limit) {
+			BN_copy(y, x); /* teleport the turtle */
+			steps_taken = 0;
+			steps_limit *= 2;
+			if (steps_limit == 0) {
+#ifdef DEBUG
+printf(" (overflow)");
+#endif
+a++;
+goto restart;
+			}
 		}
-		BN_add_word(i, 1);
 	}
 }
 #else



CVS commit: src/lib/libc/gen

2010-04-27 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Apr 27 15:26:59 UTC 2010

Modified Files:
src/lib/libc/gen: ftok.3

Log Message:
Note POSIX compliance.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/gen/ftok.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/libc/gen/ftok.3
diff -u src/lib/libc/gen/ftok.3:1.15 src/lib/libc/gen/ftok.3:1.16
--- src/lib/libc/gen/ftok.3:1.15	Tue Mar 10 20:59:49 2009
+++ src/lib/libc/gen/ftok.3	Tue Apr 27 15:26:59 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ftok.3,v 1.15 2009/03/10 20:59:49 joerg Exp $
+.\"	$NetBSD: ftok.3,v 1.16 2010/04/27 15:26:59 jruoho Exp $
 .\"
 .\" Copyright (c) 1994 SigmaSoft, Th. Lockert 
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 24, 1994
+.Dd April 27, 2010
 .Dt FTOK 3
 .Os
 .Sh NAME
@@ -69,6 +69,11 @@
 .Xr msgget 2 ,
 .Xr semget 2 ,
 .Xr shmget 2
+.Sh STANDARDS
+The
+.Fn ftok
+function conforms to
+.St -p1003.1 .
 .Sh HISTORY
 The
 .Fn ftok



CVS commit: src/lib/libc/gen

2010-04-27 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Apr 27 15:16:28 UTC 2010

Modified Files:
src/lib/libc/gen: uname.3

Log Message:
Use .In for includes and .Va when listing the structure members.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gen/uname.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/libc/gen/uname.3
diff -u src/lib/libc/gen/uname.3:1.10 src/lib/libc/gen/uname.3:1.11
--- src/lib/libc/gen/uname.3:1.10	Thu Aug  7 16:42:59 2003
+++ src/lib/libc/gen/uname.3	Tue Apr 27 15:16:28 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: uname.3,v 1.10 2003/08/07 16:42:59 agc Exp $
+.\"	$NetBSD: uname.3,v 1.11 2010/04/27 15:16:28 jruoho Exp $
 .\"
 .\" Copyright (c) 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)uname.3	8.1 (Berkeley) 1/4/94
 .\"
-.Dd January 4, 1994
+.Dd April 27, 2010
 .Dt UNAME 3
 .Os
 .Sh NAME
@@ -51,18 +51,18 @@
 The
 .Li utsname
 structure is defined in the
-.Li \*[Lt]sys/utsname.h\*[Gt]
+.In sys/utsname.h
 header file, and contains the following members:
 .Bl -tag -width nodename -offset indent
-.It sysname
+.It Va sysname
 Name of the operating system implementation.
-.It nodename
+.It Va nodename
 Network name of this machine.
-.It release
+.It Va release
 Release level of the operating system.
-.It version
+.It Va version
 Version level of the operating system.
-.It machine
+.It Va machine
 Machine hardware platform.
 .El
 .Sh RETURN VALUES



CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Apr 27 15:01:12 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.23 -r1.153.2.24 src/sys/uvm/uvm_page.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_page.c
diff -u src/sys/uvm/uvm_page.c:1.153.2.23 src/sys/uvm/uvm_page.c:1.153.2.24
--- src/sys/uvm/uvm_page.c:1.153.2.23	Tue Apr 27 08:32:47 2010
+++ src/sys/uvm/uvm_page.c	Tue Apr 27 15:01:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.153.2.23 2010/04/27 08:32:47 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.153.2.24 2010/04/27 15:01:11 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.23 2010/04/27 08:32:47 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.24 2010/04/27 15:01:11 uebayasi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -852,7 +852,7 @@
 uvm_page_physseg_init(void)
 {
 	int lcv;
-	
+
 	for (lcv = 0; lcv < VM_PHYSSEG_MAX; lcv++) {
 		vm_physmem_ptrs[lcv] = &vm_physmem[lcv];
 	}



CVS commit: src/distrib/sets/lists

2010-04-27 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Tue Apr 27 14:33:19 UTC 2010

Modified Files:
src/distrib/sets/lists/comp: md.i386 shl.mi
src/distrib/sets/lists/xcomp: md.i386 shl.mi

Log Message:
Add usr/libdata/debug entries for shared libraries on i386 with Xorg


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/distrib/sets/lists/comp/md.i386
cvs rdiff -u -r1.115 -r1.116 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.26 -r1.27 src/distrib/sets/lists/xcomp/md.i386
cvs rdiff -u -r1.17 -r1.18 src/distrib/sets/lists/xcomp/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/comp/md.i386
diff -u src/distrib/sets/lists/comp/md.i386:1.111 src/distrib/sets/lists/comp/md.i386:1.112
--- src/distrib/sets/lists/comp/md.i386:1.111	Wed Jan  6 19:46:43 2010
+++ src/distrib/sets/lists/comp/md.i386	Tue Apr 27 14:33:19 2010
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.111 2010/01/06 19:46:43 skrll Exp $
+# $NetBSD: md.i386,v 1.112 2010/04/27 14:33:19 lukem Exp $
 ./usr/include/emmintrin.h			comp-c-include		gcccmds
 ./usr/include/i386comp-c-include
 ./usr/include/i386/_G_config.h			comp-obsolete		obsolete
@@ -128,6 +128,9 @@
 ./usr/libdata/debug/usr/bin/fdformat.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/iasl.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/pmc.debug		comp-util-debug		debug
+./usr/libdata/debug/usr/lib/libi386.so.1.0.debug	comp-sys-debug	pic,debug
+./usr/libdata/debug/usr/lib/libm387.so.0.1.debug	comp-sys-debug	pic,debug
+./usr/libdata/debug/usr/lib/libpmc.so.1.0.debug		comp-sys-debug	pic,debug
 ./usr/libdata/debug/usr/sbin/acpidump.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/usr/sbin/amldb.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/usr/sbin/apm.debug		comp-sysutil-debug	debug

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.115 src/distrib/sets/lists/comp/shl.mi:1.116
--- src/distrib/sets/lists/comp/shl.mi:1.115	Mon Apr 12 22:34:17 2010
+++ src/distrib/sets/lists/comp/shl.mi	Tue Apr 27 14:33:19 2010
@@ -1,13 +1,13 @@
-# $NetBSD: shl.mi,v 1.115 2010/04/12 22:34:17 pooka Exp $
+# $NetBSD: shl.mi,v 1.116 2010/04/27 14:33:19 lukem Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
 ./usr/lib/crtbeginT.ocomp-c-lib
 ./usr/lib/libarchive_pic.a			comp-c-piclib
 ./usr/lib/libasn1_pic.acomp-c-piclib		kerberos
-./usr/lib/libatf_pic.acomp-obsolete		obsolete
-./usr/lib/libatf-c_pic.a			comp-atf-piclib		atf
 ./usr/lib/libatf-c++_pic.a			comp-atf-piclib		atf
+./usr/lib/libatf-c_pic.a			comp-atf-piclib		atf
+./usr/lib/libatf_pic.acomp-obsolete		obsolete
 ./usr/lib/libavl_pic.acomp-zfs-piclib		zfs
 ./usr/lib/libbind9_pic.a			comp-bind-piclib
 ./usr/lib/libbluetooth_pic.a			comp-c-piclib
@@ -19,8 +19,8 @@
 ./usr/lib/libcompat_pic.a			comp-c-piclib
 ./usr/lib/libcrypt_pic.a			comp-c-piclib
 ./usr/lib/libcrypto_pic.a			comp-c-piclib		crypto
-./usr/lib/libcurses_pic.a			comp-c-piclib
 ./usr/lib/libctf_pic.acomp-c-piclib		dtrace
+./usr/lib/libcurses_pic.a			comp-c-piclib
 ./usr/lib/libdes_pic.acomp-c-piclib		crypto
 ./usr/lib/libdevmapper_pic.a			comp-lvm-piclib		lvm
 ./usr/lib/libdns_pic.acomp-bind-piclib
@@ -91,13 +91,13 @@
 ./usr/lib/librt_pic.acomp-c-piclib
 ./usr/lib/librump_pic.acomp-c-piclib
 ./usr/lib/librumpcrypto_pic.a			comp-c-piclib
-./usr/lib/librumpdev_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_bpf_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_cgd_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_disk_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_dm_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_fss_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_netsmb_pic.a		comp-c-piclib
+./usr/lib/librumpdev_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_raidframe_pic.a		comp-c-piclib
 ./usr/lib/librumpdev_rnd_pic.a			comp-c-piclib
 ./usr/lib/librumpdev_sysmon_pic.a		comp-c-piclib
@@ -132,18 +132,18 @@
 ./usr/lib/librumpfs_umap_pic.a			comp-c-piclib
 ./usr/lib/librumpfs_umapfs_pic.a		comp-obsolete		obsolete
 ./usr/lib/librumpfs_union_pic.a			comp-c-piclib
-./usr/lib/librumpvfs_fifofs_pic.a		comp-c-piclib
-./usr/lib/librumpvfs_layerfs_pic.a		comp-c-piclib
-./usr/lib/librumpnet_pic.a			comp-c-piclib
 ./usr/lib/librumpnet_local_pic.a		comp-c-piclib
-./usr/lib/librumpnet_net_pic.a			comp-c-piclib
 ./usr/lib/librumpnet_net80211_pic.a		comp-c-piclib
+./usr/lib/librumpnet_net_pic.a			comp-c-piclib
 ./usr/lib/librumpnet_netbt_pic.a		comp-c-piclib
 ./usr/lib/librumpnet_netinet_pic.a		comp-c-piclib
+./usr/lib/librumpnet_pic.a			comp-c-piclib
 ./usr/lib/librumpnet_shmif_pic.a		comp-c-piclib
 ./usr/lib/librumpnet_sockin_pic.a		comp-c-piclib
 ./usr/lib/librumpnet_virtif_pic.a		comp-c-piclib
 ./usr/lib/librumpuser_pic.a			comp-c-piclib
+./usr/lib/librumpvfs_fifofs_pic.a		comp-c-piclib
+./usr/lib/librumpvfs_layerfs_pic.a		comp-c-piclib
 ./usr/

CVS commit: src/share/mk

2010-04-27 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Tue Apr 27 14:32:14 UTC 2010

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

Log Message:
Support MKDEBUG for shared libraries.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/share/mk/bsd.lib.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.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.306 src/share/mk/bsd.lib.mk:1.307
--- src/share/mk/bsd.lib.mk:1.306	Mon Apr 26 03:46:00 2010
+++ src/share/mk/bsd.lib.mk	Tue Apr 27 14:32:14 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.306 2010/04/26 03:46:00 lukem Exp $
+#	$NetBSD: bsd.lib.mk,v 1.307 2010/04/27 14:32:14 lukem Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include 
@@ -445,6 +445,10 @@
 SOBJS+=${OBJS:.o=.pico}
 .endif
 .if defined(SHLIB_FULLVERSION)
+_LIB.so:=lib${LIB}.so.${SHLIB_FULLVERSION}
+.if ${MKDEBUG} != "no" && ${OBJECT_FMT} == "ELF"
+_LIB.debug:=${_LIB.so}.debug
+.endif
 _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
 .endif
 .endif	# }
@@ -471,7 +475,7 @@
 
 .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
 
-realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
+realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.debug}
 
 MKARZERO?=no
 
@@ -588,6 +592,15 @@
 	${OBJCOPY} -R .ident ${.TARGET}
 .endif
 
+.if defined(_LIB.debug)
+${_LIB.debug}: ${_LIB.so}
+	${_MKTARGET_CREATE}
+	${OBJCOPY} --only-keep-debug ${_LIB.so} ${_LIB.debug}
+	${OBJCOPY} --strip-debug \
+	-R .gnu_debuglink --add-gnu-debuglink=${_LIB.debug} ${_LIB.so} \
+	|| rm -f ${_LIB.debug}
+.endif
+
 .if !empty(LOBJS)			# {
 LLIBS?=		-lc
 llib-l${LIB}.ln: ${LOBJS}
@@ -610,7 +623,7 @@
 	rm -f lib${LIB}.a ${STOBJS}
 	rm -f lib${LIB}_p.a ${POBJS}
 	rm -f lib${LIB}_g.a ${GOBJS}
-	rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
+	rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${_LIB.debug} ${SOBJS}
 	rm -f ${STOBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp} ${GOBJS:=.tmp}
 	rm -f llib-l${LIB}.ln ${LOBJS}
 
@@ -749,6 +762,16 @@
 .endif
 .endif
 
+.if defined(_LIB.debug)
+libinstall:: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
+.PRECIOUS: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
+
+${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}: ${_LIB.debug}
+	${_MKTARGET_INSTALL}
+	${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
+		${.ALLSRC} ${.TARGET}
+.endif
+
 .if ${MKLINT} != "no" && !empty(LOBJS)
 libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
 .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln



CVS commit: src/lib/libc/cdb

2010-04-27 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Apr 27 14:26:52 UTC 2010

Modified Files:
src/lib/libc/cdb: cdb.5

Log Message:
.Pp after .Ed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/cdb/cdb.5

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

Modified files:

Index: src/lib/libc/cdb/cdb.5
diff -u src/lib/libc/cdb/cdb.5:1.2 src/lib/libc/cdb/cdb.5:1.3
--- src/lib/libc/cdb/cdb.5:1.2	Sun Apr 25 10:32:44 2010
+++ src/lib/libc/cdb/cdb.5	Tue Apr 27 14:26:52 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: cdb.5,v 1.2 2010/04/25 10:32:44 wiz Exp $
+.\"	$NetBSD: cdb.5,v 1.3 2010/04/27 14:26:52 jruoho Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
-.Dd March 3, 2010
+.Dd April 27, 2010
 .Dt CDB 5
 .Os
 .Sh NAME
@@ -59,6 +59,7 @@
 	uint32_t seed;
 };
 .Ed
+.Pp
 All fields are in Little Endian byte order.
 .Pp
 This is followed by a description of the hash function of



CVS commit: src/sys/rump/librump/rumpvfs

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Apr 27 13:26:13 UTC 2010

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Fix off-by-atleast-1 error.

Note: etfs doesn't work if rumpfs is not mounted as root.  Given
that rumpfs_mount always return EOPNOTSUPP (except for mountroot),
this is not a pressible tragedy currently, but nevertheless
could/should be fixed in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/rump/librump/rumpvfs/rumpfs.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/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.41 src/sys/rump/librump/rumpvfs/rumpfs.c:1.42
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.41	Mon Apr 26 23:40:22 2010
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Apr 27 13:26:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.41 2010/04/26 23:40:22 pooka Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.42 2010/04/27 13:26:12 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009  Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.41 2010/04/26 23:40:22 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.42 2010/04/27 13:26:12 pooka Exp $");
 
 #include 
 #include 
@@ -519,8 +519,14 @@
 		mutex_exit(&etfs_lock);
 
 		if (found) {
+			char *offset;
+
+			offset = strstr(cnp->cn_pnbuf, et->et_key);
+			KASSERT(offset);
+
 			rn = et->et_rn;
-			cnp->cn_consume += et->et_keylen - cnp->cn_namelen;
+			cnp->cn_consume += et->et_keylen
+			- (cnp->cn_nameptr - offset) - cnp->cn_namelen;
 			if (rn->rn_va.va_type != VDIR)
 cnp->cn_flags &= ~REQUIREDIR;
 			goto getvnode;



CVS commit: src/sys/rump

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Apr 27 10:58:55 UTC 2010

Modified Files:
src/sys/rump/include/rump: rump_syscalls.h
src/sys/rump/librump/rumpkern: rump_syscalls.c

Log Message:
regen: rump_enosys -> sys_nomodule for modular system calls


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.42 -r1.43 src/sys/rump/librump/rumpkern/rump_syscalls.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/rump/include/rump/rump_syscalls.h
diff -u src/sys/rump/include/rump/rump_syscalls.h:1.21 src/sys/rump/include/rump/rump_syscalls.h:1.22
--- src/sys/rump/include/rump/rump_syscalls.h:1.21	Wed Apr 21 16:18:35 2010
+++ src/sys/rump/include/rump/rump_syscalls.h	Tue Apr 27 10:58:55 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.h,v 1.21 2010/04/21 16:18:35 pooka Exp $ */
+/* $NetBSD: rump_syscalls.h,v 1.22 2010/04/27 10:58:55 pooka Exp $ */
 
 /*
  * System call protos in rump namespace.

Index: src/sys/rump/librump/rumpkern/rump_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rump_syscalls.c:1.42 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.43
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.42	Wed Apr 21 16:18:35 2010
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c	Tue Apr 27 10:58:55 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.c,v 1.42 2010/04/21 16:18:35 pooka Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.43 2010/04/27 10:58:55 pooka Exp $ */
 
 /*
  * System call vector and marshalling for rump.
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.42 2010/04/21 16:18:35 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.43 2010/04/27 10:58:55 pooka Exp $");
 
 #include 
 #include 
@@ -2526,9 +2526,9 @@
 	{ ns(struct sys_close_args), 0,
 	(sy_call_t *)sys_close },			/* 6 = close */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 7 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 7 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 8 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 8 = unrumped */
 	{ ns(struct sys_link_args), 0,
 	(sy_call_t *)sys_link },			/* 9 = link */
 	{ ns(struct sys_unlink_args), 0,
@@ -2540,7 +2540,7 @@
 	{ ns(struct sys_fchdir_args), 0,
 	(sy_call_t *)sys_fchdir },			/* 13 = fchdir */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 14 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 14 = unrumped */
 	{ ns(struct sys_chmod_args), 0,
 	(sy_call_t *)sys_chmod },			/* 15 = chmod */
 	{ ns(struct sys_chown_args), 0,
@@ -2548,13 +2548,13 @@
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 17 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 18 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 18 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 19 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 19 = unrumped */
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 20 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 21 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 21 = unrumped */
 	{ ns(struct sys_unmount_args), 0,
 	(sy_call_t *)sys_unmount },			/* 22 = unmount */
 	{ 0, 0, 0,
@@ -2588,11 +2588,11 @@
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 37 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 38 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 38 = unrumped */
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 39 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 40 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 40 = unrumped */
 	{ ns(struct sys_dup_args), 0,
 	(sy_call_t *)sys_dup },			/* 41 = dup */
 	{ 0, 0, 0,
@@ -2604,11 +2604,11 @@
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 45 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 46 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 46 = unrumped */
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 47 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 48 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 48 = unrumped */
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 49 = unrumped */
 	{ 0, 0, 0,
@@ -2616,13 +2616,13 @@
 	{ 0, 0, 0,
 	(sy_call_t *)rump_enosys },			/* 51 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 52 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 52 = unrumped */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 53 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 53 = unrumped */
 	{ ns(struct sys_ioctl_args), 0,
 	(sy_call_t *)sys_ioctl },			/* 54 = ioctl */
 	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 55 = unrumped */
+	(sy_call_t *)sys_nomodule },			/* 55 = unrumped */
 	{ ns(struct sys_revoke_args), 0,
 	(sy_call_t *)sys_revoke },			/* 56 = revoke */
 	{ ns(struct sys_symli

CVS commit: src/sys/kern

2010-04-27 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Apr 27 10:57:47 UTC 2010

Modified Files:
src/sys/kern: makesyscalls.sh

Log Message:
Use sys_nomodule for modular rump system calls so that they can be
autoloaded.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/makesyscalls.sh

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

Modified files:

Index: src/sys/kern/makesyscalls.sh
diff -u src/sys/kern/makesyscalls.sh:1.94 src/sys/kern/makesyscalls.sh:1.95
--- src/sys/kern/makesyscalls.sh:1.94	Tue Mar  2 19:33:12 2010
+++ src/sys/kern/makesyscalls.sh	Tue Apr 27 10:57:46 2010
@@ -1,5 +1,5 @@
 #! /bin/sh -
-#	$NetBSD: makesyscalls.sh,v 1.94 2010/03/02 19:33:12 pooka Exp $
+#	$NetBSD: makesyscalls.sh,v 1.95 2010/04/27 10:57:46 pooka Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -561,8 +561,11 @@
 
 function printrumpsysent(insysent, compatwrap) {
 	if (!insysent) {
-		printf("\t{ 0, 0, 0,\n\t%s },\t\t\t/* %d = unrumped */\n", \
-		"(sy_call_t *)rump_enosys", syscall) > rumpsysent
+		eno[0] = "rump_enosys"
+		eno[1] = "sys_nomodule"
+		printf("\t{ 0, 0, 0,\n\t(sy_call_t *)%s },\t\t\t"	\
+		"/* %d = unrumped */\n",\
+		eno[modular], syscall) > rumpsysent
 		return
 	}
 



CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Apr 27 08:40:22 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_extern.h

Log Message:
Forgotten to check this in; now uvm_page_physload() and
uvm_page_physload_device() returns struct vm_physseg * (which is not
used yet).


To generate a diff of this commit:
cvs rdiff -u -r1.161.2.1 -r1.161.2.2 src/sys/uvm/uvm_extern.h

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

Modified files:

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.161.2.1 src/sys/uvm/uvm_extern.h:1.161.2.2
--- src/sys/uvm/uvm_extern.h:1.161.2.1	Tue Feb 23 07:44:25 2010
+++ src/sys/uvm/uvm_extern.h	Tue Apr 27 08:40:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.161.2.1 2010/02/23 07:44:25 uebayasi Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.161.2.2 2010/04/27 08:40:22 uebayasi Exp $	*/
 
 /*
  *
@@ -721,9 +721,9 @@
 void			uvm_pagerealloc(struct vm_page *,
 			struct uvm_object *, voff_t);
 /* Actually, uvm_page_physload takes PF#s which need their own type */
-void			uvm_page_physload(paddr_t, paddr_t,
+void			*uvm_page_physload(paddr_t, paddr_t,
 			paddr_t, paddr_t, int);
-void			uvm_page_physload_device(paddr_t, paddr_t,
+void			*uvm_page_physload_device(paddr_t, paddr_t,
 			paddr_t, paddr_t, int);
 void			uvm_setpagesize(void);
 



CVS commit: src/sys/dev/acpi

2010-04-27 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Apr 27 08:37:07 UTC 2010

Modified Files:
src/sys/dev/acpi: acpi_apm.c acpivar.h

Log Message:
Include the new prototype for acpi_enter_sleep_state().


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/acpi/acpi_apm.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/acpi/acpivar.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/acpi/acpi_apm.c
diff -u src/sys/dev/acpi/acpi_apm.c:1.18 src/sys/dev/acpi/acpi_apm.c:1.19
--- src/sys/dev/acpi/acpi_apm.c:1.18	Mon Apr 12 06:56:19 2010
+++ src/sys/dev/acpi/acpi_apm.c	Tue Apr 27 08:37:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_apm.c,v 1.18 2010/04/12 06:56:19 skrll Exp $	*/
+/*	$NetBSD: acpi_apm.c,v 1.19 2010/04/27 08:37:07 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_apm.c,v 1.18 2010/04/12 06:56:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_apm.c,v 1.19 2010/04/27 08:37:07 jruoho Exp $");
 
 #include 
 #include 
@@ -97,7 +97,7 @@
 static int acpiapm_node = CTL_EOL, standby_node = CTL_EOL;
 
 struct acpi_softc;
-extern ACPI_STATUS acpi_enter_sleep_state(struct acpi_softc *, int);
+extern void acpi_enter_sleep_state(struct acpi_softc *, int);
 static int acpiapm_match(device_t, cfdata_t , void *);
 static void acpiapm_attach(device_t, device_t, void *);
 static int sysctl_state(SYSCTLFN_PROTO);

Index: src/sys/dev/acpi/acpivar.h
diff -u src/sys/dev/acpi/acpivar.h:1.52 src/sys/dev/acpi/acpivar.h:1.53
--- src/sys/dev/acpi/acpivar.h:1.52	Thu Apr 22 18:53:23 2010
+++ src/sys/dev/acpi/acpivar.h	Tue Apr 27 08:37:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpivar.h,v 1.52 2010/04/22 18:53:23 jruoho Exp $	*/
+/*	$NetBSD: acpivar.h,v 1.53 2010/04/27 08:37:07 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -294,7 +294,7 @@
 /*
  * Sleep state transition.
  */
-ACPI_STATUS		acpi_enter_sleep_state(struct acpi_softc *, int);
+void			acpi_enter_sleep_state(struct acpi_softc *, int);
 
 /*
  * Quirk handling.



CVS commit: src/sys/dev/acpi

2010-04-27 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Apr 27 08:36:06 UTC 2010

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

Log Message:
Make acpi_enter_sleep_state() not to return. No one cared what it returned.


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/dev/acpi/acpi.c

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

Modified files:

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.193 src/sys/dev/acpi/acpi.c:1.194
--- src/sys/dev/acpi/acpi.c:1.193	Tue Apr 27 05:34:14 2010
+++ src/sys/dev/acpi/acpi.c	Tue Apr 27 08:36:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.193 2010/04/27 05:34:14 jruoho Exp $	*/
+/*	$NetBSD: acpi.c,v 1.194 2010/04/27 08:36:06 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.193 2010/04/27 05:34:14 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.194 2010/04/27 08:36:06 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -1418,21 +1418,22 @@
 	}
 }
 
-ACPI_STATUS
+void
 acpi_enter_sleep_state(struct acpi_softc *sc, int state)
 {
-	ACPI_STATUS rv = AE_OK;
+	ACPI_STATUS rv;
 	int err;
 
 	if (state == sc->sc_sleepstate)
-		return AE_OK;
+		return;
 
 	aprint_normal_dev(sc->sc_dev, "entering state S%d\n", state);
 
 	switch (state) {
 
 	case ACPI_STATE_S0:
-		break;
+		sc->sc_sleepstate = ACPI_STATE_S0;
+		return;
 
 	case ACPI_STATE_S1:
 	case ACPI_STATE_S2:
@@ -1442,7 +1443,7 @@
 		if ((sc->sc_sleepstates & __BIT(state)) == 0) {
 			aprint_error_dev(sc->sc_dev, "sleep state "
 			"S%d is not available\n", state);
-			return AE_OK;
+			return;
 		}
 
 		/*
@@ -1458,8 +1459,6 @@
 		if (ACPI_SUCCESS(rv))
 			aprint_debug_dev(sc->sc_dev, "evaluated _TTS\n");
 
-		rv = AE_OK;
-
 		acpi_wakedev_commit(sc, state);
 
 		if (state != ACPI_STATE_S1 &&
@@ -1538,8 +1537,6 @@
 	sc->sc_sleepstate = ACPI_STATE_S0;
 
 	(void)acpi_eval_set_integer(NULL, "\\_TTS", ACPI_STATE_S0);
-
-	return rv;
 }
 
 /*



CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Apr 27 08:32:47 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.c uvm_page.h

Log Message:
Maintain not only arrays of struct vm_physseg, but also arrays of pointers
to struct vm_physseg.  This is need:

- to make the array change dynamically (unload), and

- to make the struct vm_physseg * object to be passed to device drivers as
  a cookie of a managed physical segment.


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.22 -r1.153.2.23 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.59.2.16 -r1.59.2.17 src/sys/uvm/uvm_page.h

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

Modified files:

Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.153.2.22 src/sys/uvm/uvm_page.c:1.153.2.23
--- src/sys/uvm/uvm_page.c:1.153.2.22	Tue Apr 27 04:32:44 2010
+++ src/sys/uvm/uvm_page.c	Tue Apr 27 08:32:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.153.2.22 2010/04/27 04:32:44 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.153.2.23 2010/04/27 08:32:47 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.22 2010/04/27 04:32:44 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.23 2010/04/27 08:32:47 uebayasi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -103,9 +103,11 @@
 /* XXXUEBS make these array of pointers */
 /* XXXUEBS merge these two */
 
+struct vm_physseg *vm_physmem_ptrs[VM_PHYSSEG_MAX];
 struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
 int vm_nphysmem = 0;
 #ifdef DEVICE_PAGE
+struct vm_physseg *vm_physdev_ptrs[VM_PHYSSEG_MAX];
 struct vm_physseg vm_physdev[VM_PHYSSEG_MAX];
 int vm_nphysdev = 0;
 #endif
@@ -755,6 +757,8 @@
 static void
 uvm_page_physunload_common(struct vm_physseg * const);
 #endif
+static void
+uvm_page_physseg_init(void);
 static struct vm_physseg *
 uvm_physseg_insert(struct vm_physseg *, int,
 const paddr_t, const paddr_t);
@@ -815,6 +819,7 @@
 const paddr_t avail_start, const paddr_t avail_end, const int free_list)
 {
 	struct vm_physseg *ps;
+	static int uvm_page_physseg_inited;
 
 	if (uvmexp.pagesize == 0)
 		panic("uvm_page_physload: page size not set!");
@@ -829,6 +834,12 @@
 		"\tincrease VM_PHYSSEG_MAX\n",
 		VM_PHYSSEG_MAX, (long long)start, (long long)end);
 
+	/* XXXUEBS too early to use RUN_ONCE(9)? */
+	if (uvm_page_physseg_inited == 0) {
+		uvm_page_physseg_inited = 1;
+		uvm_page_physseg_init();
+	}
+
 	ps = uvm_physseg_insert(segs, nsegs, start, end);
 	KASSERT(ps != NULL);
 	ps->start = start;
@@ -837,6 +848,21 @@
 	return ps;
 }
 
+static void
+uvm_page_physseg_init(void)
+{
+	int lcv;
+	
+	for (lcv = 0; lcv < VM_PHYSSEG_MAX; lcv++) {
+		vm_physmem_ptrs[lcv] = &vm_physmem[lcv];
+	}
+#ifdef DEVICE_PAGE
+	for (lcv = 0; lcv < VM_PHYSSEG_MAX; lcv++) {
+		vm_physdev_ptrs[lcv] = &vm_physdev[lcv];
+	}
+#endif
+}
+
 static struct vm_physseg *
 uvm_physseg_insert(struct vm_physseg *segs, int nsegs,
 const paddr_t start, const paddr_t end)

Index: src/sys/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.59.2.16 src/sys/uvm/uvm_page.h:1.59.2.17
--- src/sys/uvm/uvm_page.h:1.59.2.16	Tue Apr 27 08:23:48 2010
+++ src/sys/uvm/uvm_page.h	Tue Apr 27 08:32:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.59.2.16 2010/04/27 08:23:48 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.59.2.17 2010/04/27 08:32:47 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -257,9 +257,11 @@
  * physical memory config is stored in vm_physmem.
  */
 
+extern struct vm_physseg *vm_physmem_ptrs[VM_PHYSSEG_MAX];
 extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
 extern int vm_nphysmem;
-#ifdef XIP
+#ifdef DEVICE_PAGE
+extern struct vm_physseg *vm_physdev_ptrs[VM_PHYSSEG_MAX];
 extern struct vm_physseg vm_physdev[VM_PHYSSEG_MAX];
 extern int vm_nphysdev;
 #endif



CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Apr 27 08:23:48 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_page.h

Log Message:
Sort.


To generate a diff of this commit:
cvs rdiff -u -r1.59.2.15 -r1.59.2.16 src/sys/uvm/uvm_page.h

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

Modified files:

Index: src/sys/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.59.2.15 src/sys/uvm/uvm_page.h:1.59.2.16
--- src/sys/uvm/uvm_page.h:1.59.2.15	Tue Feb 23 15:38:30 2010
+++ src/sys/uvm/uvm_page.h	Tue Apr 27 08:23:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.59.2.15 2010/02/23 15:38:30 uebayasi Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.59.2.16 2010/04/27 08:23:48 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -308,8 +308,8 @@
 paddr_t uvm_vm_page_to_phys(const struct vm_page *);
 #ifdef XIP
 int vm_physseg_find_device(paddr_t, int *);
-paddr_t uvm_vm_page_to_phys_device(const struct vm_page *);
 struct vm_page *uvm_phys_to_vm_page_device(paddr_t);
+paddr_t uvm_vm_page_to_phys_device(const struct vm_page *);
 #endif
 
 /*



CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Apr 27 08:20:09 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_device.c

Log Message:
Always map device pages via cdev as unmanaged for now.

I need this to read/write a NOR FlashROM from userland.  Otherwise pmaps
believe the physload'ed ROM region as managed, and map it as cache
enabled, which prevents me from reading ROM command status, etc.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.2.1 src/sys/uvm/uvm_device.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_device.c
diff -u src/sys/uvm/uvm_device.c:1.57 src/sys/uvm/uvm_device.c:1.57.2.1
--- src/sys/uvm/uvm_device.c:1.57	Fri Feb  5 03:49:11 2010
+++ src/sys/uvm/uvm_device.c	Tue Apr 27 08:20:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_device.c,v 1.57 2010/02/05 03:49:11 uebayasi Exp $	*/
+/*	$NetBSD: uvm_device.c,v 1.57.2.1 2010/04/27 08:20:09 uebayasi Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.57 2010/02/05 03:49:11 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.57.2.1 2010/04/27 08:20:09 uebayasi Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -426,8 +426,12 @@
 		UVMHIST_LOG(maphist,
 		"  MAPPING: device: pm=0x%x, va=0x%x, pa=0x%lx, at=%d",
 		ufi->orig_map->pmap, curr_va, paddr, mapprot);
+		/*
+		 * XXXUEBS
+		 * always map device pages as unmanaged (uncached) for now.
+		 */
 		if (pmap_enter(ufi->orig_map->pmap, curr_va, paddr,
-		mapprot, PMAP_CANFAIL | mapprot) != 0) {
+		mapprot, PMAP_CANFAIL | PMAP_UNMANAGED | mapprot) != 0) {
 			/*
 			 * pmap_enter() didn't have the resource to
 			 * enter this mapping.  Unlock everything,



CVS commit: src/sys/dev/acpi

2010-04-27 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Apr 27 08:15:07 UTC 2010

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

Log Message:
Be consistent with the returned exception codes. Check for NULL pointers.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_util.c

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

Modified files:

Index: src/sys/dev/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.3 src/sys/dev/acpi/acpi_util.c:1.4
--- src/sys/dev/acpi/acpi_util.c:1.3	Sat Apr 24 06:57:10 2010
+++ src/sys/dev/acpi/acpi_util.c	Tue Apr 27 08:15:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.3 2010/04/24 06:57:10 jruoho Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.4 2010/04/27 08:15:07 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.3 2010/04/24 06:57:10 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.4 2010/04/27 08:15:07 jruoho Exp $");
 
 #include 
 
@@ -228,9 +228,12 @@
 	ACPI_STATUS rv = AE_OK;
 	uint32_t i;
 
-	if (pkg == NULL || pkg->Type != ACPI_TYPE_PACKAGE)
+	if (pkg == NULL)
 		return AE_BAD_PARAMETER;
 
+	if (pkg->Type != ACPI_TYPE_PACKAGE)
+		return AE_TYPE;
+
 	for (i = 0; i < pkg->Package.Count; i++) {
 
 		rv = (*func)(&pkg->Package.Elements[i], arg);
@@ -295,6 +298,9 @@
 	ACPI_BUFFER buf;
 	ACPI_STATUS rv;
 
+	if (handle == NULL)
+		handle = ACPI_ROOT_OBJECT;
+
 	buf.Pointer = name;
 	buf.Length = sizeof(name);
 



CVS commit: [uebayasi-xip] src/sys/arch

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Apr 27 07:19:29 UTC 2010

Modified Files:
src/sys/arch/acorn26/acorn26 [uebayasi-xip]: pmap.c
src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c
src/sys/arch/hppa/hppa [uebayasi-xip]: pmap.c
src/sys/arch/m68k/m68k [uebayasi-xip]: pmap_motorola.c
src/sys/arch/mips/mips [uebayasi-xip]: pmap.c
src/sys/arch/powerpc/ibm4xx [uebayasi-xip]: pmap.c
src/sys/arch/sh3/sh3 [uebayasi-xip]: pmap.c
src/sys/arch/sparc64/sparc64 [uebayasi-xip]: pmap.c
src/sys/arch/x86/x86 [uebayasi-xip]: pmap.c

Log Message:
Support PMAP_UNMANAGED in some pmaps.

(Others should be converted eventually, but no problem while managed
device page is enabled.)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/arch/acorn26/acorn26/pmap.c
cvs rdiff -u -r1.211.2.9 -r1.211.2.10 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/arch/hppa/hppa/pmap.c
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.188.2.1 -r1.188.2.2 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.60 -r1.60.2.1 src/sys/arch/powerpc/ibm4xx/pmap.c
cvs rdiff -u -r1.74.2.1 -r1.74.2.2 src/sys/arch/sh3/sh3/pmap.c
cvs rdiff -u -r1.250.2.1 -r1.250.2.2 src/sys/arch/sparc64/sparc64/pmap.c
cvs rdiff -u -r1.100.2.1 -r1.100.2.2 src/sys/arch/x86/x86/pmap.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/acorn26/acorn26/pmap.c
diff -u src/sys/arch/acorn26/acorn26/pmap.c:1.30 src/sys/arch/acorn26/acorn26/pmap.c:1.30.2.1
--- src/sys/arch/acorn26/acorn26/pmap.c:1.30	Sat Nov  7 07:27:40 2009
+++ src/sys/arch/acorn26/acorn26/pmap.c	Tue Apr 27 07:19:27 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.30 2009/11/07 07:27:40 cegger Exp $ */
+/* $NetBSD: pmap.c,v 1.30.2.1 2010/04/27 07:19:27 uebayasi Exp $ */
 /*-
  * Copyright (c) 1997, 1998, 2000 Ben Harris
  * All rights reserved.
@@ -102,7 +102,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.30 2009/11/07 07:27:40 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.30.2.1 2010/04/27 07:19:27 uebayasi Exp $");
 
 #include  /* for cold */
 #include 
@@ -634,7 +634,8 @@
 	UVMHIST_FUNC("pmap_enter");
 
 	UVMHIST_CALLED(pmaphist);
-	return pmap_enter1(pmap, va, pa, prot, flags, 0);
+	return pmap_enter1(pmap, va, pa, prot, flags,
+	(flags & PMAP_UNMANAGED) != 0);
 }
 
 static int

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.9 src/sys/arch/arm/arm32/pmap.c:1.211.2.10
--- src/sys/arch/arm/arm32/pmap.c:1.211.2.9	Thu Feb 25 03:30:22 2010
+++ src/sys/arch/arm/arm32/pmap.c	Tue Apr 27 07:19:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.211.2.9 2010/02/25 03:30:22 uebayasi Exp $	*/
+/*	$NetBSD: pmap.c,v 1.211.2.10 2010/04/27 07:19:28 uebayasi Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -213,7 +213,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.211.2.9 2010/02/25 03:30:22 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.211.2.10 2010/04/27 07:19:28 uebayasi Exp $");
 
 #ifdef PMAP_DEBUG
 
@@ -2781,7 +2781,8 @@
 	 * Get a pointer to the page.  Later on in this function, we
 	 * test for a managed page by checking pg != NULL.
 	 */
-	pg = pmap_initialized ? PHYS_TO_VM_PAGE(pa) : NULL;
+	pg = (pmap_initialized && ((flags & PMAP_UNMANAGED) == 0)) ?
+	PHYS_TO_VM_PAGE(pa) : NULL;
 
 	nflags = 0;
 	if (prot & VM_PROT_WRITE)

Index: src/sys/arch/hppa/hppa/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.63.2.1 src/sys/arch/hppa/hppa/pmap.c:1.63.2.2
--- src/sys/arch/hppa/hppa/pmap.c:1.63.2.1	Thu Feb 25 04:11:29 2010
+++ src/sys/arch/hppa/hppa/pmap.c	Tue Apr 27 07:19:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.63.2.1 2010/02/25 04:11:29 uebayasi Exp $	*/
+/*	$NetBSD: pmap.c,v 1.63.2.2 2010/04/27 07:19:28 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.63.2.1 2010/02/25 04:11:29 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.63.2.2 2010/04/27 07:19:28 uebayasi Exp $");
 
 #include "opt_device_page.h"
 #include "opt_xip.h"
@@ -1306,7 +1306,8 @@
 			ptp->wire_count++;
 	}
 
-	if (pmap_initialized && (pg = PHYS_TO_VM_PAGE(pa))) {
+	if (pmap_initialized && ((flags & PMAP_UNMANAGED) == 0) &&
+	(pg = PHYS_TO_VM_PAGE(pa))) {
 		struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 		mutex_enter(&md->pvh_lock);
 

Index: src/sys/arch/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.55 src/sys/arch/m68k/m68k/pmap_motorola.c:1.55.2.1
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.55	Fri Dec 11 18:28:35 2009
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Tue Apr 27 07:19:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.55 2009/12/11 18:28:35 tsutsui Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.55.2.1 2010/04/27 07:19:

CVS commit: [uebayasi-xip] src/sys/uvm

2010-04-27 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Apr 27 07:17:25 UTC 2010

Modified Files:
src/sys/uvm [uebayasi-xip]: uvm_pmap.h

Log Message:
On second thought, rename PMAP_UNCACHEABLE as PMAP_UNMANAGED.


To generate a diff of this commit:
cvs rdiff -u -r1.32.2.1 -r1.32.2.2 src/sys/uvm/uvm_pmap.h

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

Modified files:

Index: src/sys/uvm/uvm_pmap.h
diff -u src/sys/uvm/uvm_pmap.h:1.32.2.1 src/sys/uvm/uvm_pmap.h:1.32.2.2
--- src/sys/uvm/uvm_pmap.h:1.32.2.1	Tue Apr 27 06:33:23 2010
+++ src/sys/uvm/uvm_pmap.h	Tue Apr 27 07:17:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pmap.h,v 1.32.2.1 2010/04/27 06:33:23 uebayasi Exp $	*/
+/*	$NetBSD: uvm_pmap.h,v 1.32.2.2 2010/04/27 07:17:25 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -108,7 +108,7 @@
 #else
 #define	PMAP_KMPAGE	0x
 #endif /* PMAP_ENABLE_PMAP_KMPAGE */
-#define	PMAP_UNCACHEABLE 0x0080	/* disable cache for managed pages */
+#define	PMAP_UNMANAGED	0x0080	/* treat managed pages as unmanaged */
 
 #define	PMAP_MD_MASK	0xff00	/* Machine-dependent bits */