CVS commit: src/usr.sbin/btattach

2010-03-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar  9 10:54:01 UTC 2010

Modified Files:
src/usr.sbin/btattach: btattach.8

Log Message:
Sort sections. Try to improve description of -t.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/btattach/btattach.8

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/btattach/btattach.8
diff -u src/usr.sbin/btattach/btattach.8:1.4 src/usr.sbin/btattach/btattach.8:1.5
--- src/usr.sbin/btattach/btattach.8:1.4	Mon Mar  8 18:35:51 2010
+++ src/usr.sbin/btattach/btattach.8	Tue Mar  9 10:54:01 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: btattach.8,v 1.4 2010/03/08 18:35:51 kiyohara Exp $
+.\ $NetBSD: btattach.8,v 1.5 2010/03/09 10:54:01 wiz Exp $
 .\
 .\ Copyright (c) 2007 KIYOHARA Takashi
 .\ All rights reserved.
@@ -113,10 +113,10 @@
 .Pp
 Only the super-user may attach a Bluetooth HCI interface.
 .Pp
-Test mode guess speed by received link-establish packet from HCI.
-Or
-.Xr btuart 4
-, if not respond.
+Test mode tries to guess the speed using the received link-establish
+packet from HCI, or
+.Xr btuart 4 ,
+if there is no response.
 .Sh FILES
 .Bl -tag -compact
 .It Pa /var/run/btattach- Ns Bro tty Brc Ns .pid
@@ -126,10 +126,6 @@
 .Xr bluetooth 4 ,
 .Xr btuart 4 ,
 .Xr btconfig 8
-.Sh BUGS
-Not all
-.Ar type
-initializations have been tested.
 .Sh HISTORY
 The
 .Nm
@@ -140,3 +136,7 @@
 .Sh AUTHORS
 .An KIYOHARA Takashi Aq kiyoh...@kk.iij4u.or.jp
 .An Iain Hibbert
+.Sh BUGS
+Not all
+.Ar type
+initializations have been tested.



CVS commit: src/usr.sbin/btattach

2010-03-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar  9 10:54:01 UTC 2010

Modified Files:
src/usr.sbin/btattach: btattach.8

Log Message:
Sort sections. Try to improve description of -t.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/btattach/btattach.8

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



CVS commit: src/usr.bin/passwd

2010-03-09 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Mar  9 16:14:08 UTC 2010

Modified Files:
src/usr.bin/passwd: pam_passwd.c

Log Message:
Do not call pam_end with an invalid handle if pam_start failed.
From Richard Hansen.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/passwd/pam_passwd.c

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

Modified files:

Index: src/usr.bin/passwd/pam_passwd.c
diff -u src/usr.bin/passwd/pam_passwd.c:1.5 src/usr.bin/passwd/pam_passwd.c:1.6
--- src/usr.bin/passwd/pam_passwd.c:1.5	Tue Mar  2 16:19:13 2010
+++ src/usr.bin/passwd/pam_passwd.c	Tue Mar  9 16:14:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_passwd.c,v 1.5 2010/03/02 16:19:13 gdt Exp $	*/
+/*	$NetBSD: pam_passwd.c,v 1.6 2010/03/09 16:14:08 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2002 Networks Associates Technologies, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/usr.bin/passwd/passwd.c,v 1.23 2003/04/18 21:27:09 nectar Exp $);
 #else
-__RCSID($NetBSD: pam_passwd.c,v 1.5 2010/03/02 16:19:13 gdt Exp $);
+__RCSID($NetBSD: pam_passwd.c,v 1.6 2010/03/09 16:14:08 joerg Exp $);
 #endif
 
 #include sys/param.h
@@ -108,7 +108,9 @@
 
 	/* initialize PAM -- always use the program name passwd */
 	pam_err = pam_start(passwd, username, pamc, pamh);
-	pam_check(unable to start PAM session);
+	if (pam_err != PAM_SUCCESS)
+		errx(1, unable to start PAM session: %s,
+		pam_strerror(NULL, pam_err));
 
 	pam_err = pam_set_item(pamh, PAM_TTY, ttyname(STDERR_FILENO));
 	pam_check(unable to set TTY);



CVS commit: src/sys/dev/acpi

2010-03-09 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar  9 18:15:22 UTC 2010

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

Log Message:
Remove the namespace scopes.

These are neither used nor useful beyond the parser and interpreter.

ok jmcneill@, joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_pci.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpi_wakedev.c
cvs rdiff -u -r1.41 -r1.42 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.c
diff -u src/sys/dev/acpi/acpi.c:1.156 src/sys/dev/acpi/acpi.c:1.157
--- src/sys/dev/acpi/acpi.c:1.156	Fri Mar  5 21:01:44 2010
+++ src/sys/dev/acpi/acpi.c	Tue Mar  9 18:15:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.156 2010/03/05 21:01:44 jruoho Exp $	*/
+/*	$NetBSD: acpi.c,v 1.157 2010/03/09 18:15:21 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.156 2010/03/05 21:01:44 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.157 2010/03/09 18:15:21 jruoho Exp $);
 
 #include opt_acpi.h
 #include opt_pcifixup.h
@@ -402,17 +402,15 @@
 acpi_childdet(device_t self, device_t child)
 {
 	struct acpi_softc *sc = device_private(self);
-	struct acpi_scope *as;
 	struct acpi_devnode *ad;
 
 	if (sc-sc_apmbus == child)
 		sc-sc_apmbus = NULL;
 
-	TAILQ_FOREACH(as, sc-sc_scopes, as_list) {
-		TAILQ_FOREACH(ad, as-as_devnodes, ad_list) {
-			if (ad-ad_device == child)
-ad-ad_device = NULL;
-		}
+	SIMPLEQ_FOREACH(ad, sc-sc_devnodes, ad_list) {
+
+		if (ad-ad_device == child)
+			ad-ad_device = NULL;
 	}
 }
 
@@ -450,6 +448,7 @@
 		rsdt-AslCompilerId, rsdt-AslCompilerRevision);
 	} else
 		aprint_error_dev(self, X/RSDT: Not found\n);
+
 	acpi_unmap_rsdt(rsdt);
 
 	sc-sc_dev = self;
@@ -461,6 +460,8 @@
 	sc-sc_pciflags = aa-aa_pciflags;
 	sc-sc_ic = aa-aa_ic;
 
+	SIMPLEQ_INIT(sc-sc_devnodes);
+
 	acpi_softc = sc;
 
 	/*
@@ -661,11 +662,6 @@
 }
 #endif
 
-struct acpi_make_devnode_state {
-	struct acpi_softc *softc;
-	struct acpi_scope *scope;
-};
-
 /*
  * acpi_build_tree:
  *
@@ -676,46 +672,27 @@
 acpi_build_tree(struct acpi_softc *sc)
 {
 	static const char *scopes[] = {
-		\\_PR_,	/* ACPI 1.0 processor namespace */
-		\\_SB_,	/* system bus namespace */
-		\\_SI_,	/* system indicator namespace */
-		\\_TZ_,	/* ACPI 1.0 thermal zone namespace */
-		NULL,
+		\\_PR_, \\_SB_, \\_SI_, \\_TZ_, NULL
 	};
-	struct acpi_make_devnode_state state;
-	struct acpi_scope *as;
+
 	ACPI_HANDLE parent;
 	ACPI_STATUS rv;
 	int i;
 
-	TAILQ_INIT(sc-sc_scopes);
-
-	state.softc = sc;
-
 	/*
-	 * Scan the namespace and build our tree.
+	 * Scan the namespace and build our device tree.
 	 */
 	for (i = 0; scopes[i] != NULL; i++) {
-		as = malloc(sizeof(*as), M_ACPI, M_WAITOK);
-		as-as_name = scopes[i];
-		TAILQ_INIT(as-as_devnodes);
-
-		TAILQ_INSERT_TAIL(sc-sc_scopes, as, as_list);
-
-		state.scope = as;
-
-		rv = AcpiGetHandle(ACPI_ROOT_OBJECT, scopes[i],
-		parent);
-		if (ACPI_SUCCESS(rv)) {
-			AcpiWalkNamespace(ACPI_TYPE_ANY, parent, 100,
-			acpi_make_devnode, state, NULL);
-		}
+
+		rv = AcpiGetHandle(ACPI_ROOT_OBJECT, scopes[i], parent);
+
+		if (ACPI_SUCCESS(rv))
+			(void)AcpiWalkNamespace(ACPI_TYPE_ANY, parent, 100,
+			acpi_make_devnode, sc, NULL);
 	}
 
 	acpi_rescan1(sc, NULL, NULL);
-
 	acpi_wakedev_scan(sc);
-
 	acpi_pcidev_scan(sc);
 }
 
@@ -743,73 +720,68 @@
 static void
 acpi_rescan_nodes(struct acpi_softc *sc)
 {
-	struct acpi_scope *as;
-
-	TAILQ_FOREACH(as, sc-sc_scopes, as_list) {
-		struct acpi_devnode *ad;
+	struct acpi_attach_args aa;
+	struct acpi_devnode *ad;
 
-		/* Now, for this namespace, try to attach the devices. */
-		TAILQ_FOREACH(ad, as-as_devnodes, ad_list) {
-			struct acpi_attach_args aa;
+	SIMPLEQ_FOREACH(ad, sc-sc_devnodes, ad_list) {
 
-			if (ad-ad_device != NULL)
-continue;
+		if (ad-ad_device != NULL)
+			continue;
 
-			aa.aa_node = ad;
-			aa.aa_iot = sc-sc_iot;
-			aa.aa_memt = sc-sc_memt;
-			aa.aa_pc = sc-sc_pc;
-			aa.aa_pciflags = sc-sc_pciflags;
-			aa.aa_ic = sc-sc_ic;
-
-			if (ad-ad_devinfo-Type == ACPI_TYPE_DEVICE) {
-/*
- * XXX We only attach devices which are:
- *
- *	- present
- *	- enabled
- *	- functioning properly
- *
- * However, if enabled, it's decoding resources,
- * so we should claim them, if possible.
- * Requires changes to bus_space(9).
- */
-if ((ad-ad_devinfo-Valid  ACPI_VALID_STA) ==
-ACPI_VALID_STA 
-(ad-ad_devinfo-CurrentStatus 
- (ACPI_STA_DEV_PRESENT|ACPI_STA_DEV_ENABLED|
-  ACPI_STA_DEV_OK)) !=
-(ACPI_STA_DEV_PRESENT|ACPI_STA_DEV_ENABLED|
- ACPI_STA_DEV_OK))
-	continue;
-			}
+		aa.aa_node = ad;
+		aa.aa_iot = 

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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:35:12 UTC 2010

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

Log Message:
Add PPC_BOOKE cputype and booke files.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/powerpc/conf/files.powerpc

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



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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:35:50 UTC 2010

Added Files:
src/sys/arch/powerpc/conf: files.booke

Log Message:
Add PPC BookE files.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/conf/files.booke

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



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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:35:50 UTC 2010

Added Files:
src/sys/arch/powerpc/conf: files.booke

Log Message:
Add PPC BookE files.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/conf/files.booke

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

Added files:

Index: src/sys/arch/powerpc/conf/files.booke
diff -u /dev/null src/sys/arch/powerpc/conf/files.booke:1.1
--- /dev/null	Tue Mar  9 22:35:50 2010
+++ src/sys/arch/powerpc/conf/files.booke	Tue Mar  9 22:35:50 2010
@@ -0,0 +1,42 @@
+#	$NetBSD: files.booke,v 1.1 2010/03/09 22:35:50 matt Exp $
+#
+# PPC BookE specific configuration info
+
+#include arch/powerpc/fpu/files.fpu
+
+# Board Properties
+file	arch/powerpc/booke/board_prop.c
+
+# Processor Local Bus
+#device	cpuchip {[device = -1], [core = -1]}: gpiobus
+device	cpuchip {}: gpiobus
+attach	cpuchip at root
+file	arch/powerpc/booke/dev/cpuchip.c	cpuchip
+file	arch/powerpc/booke/dev/gpio.c		gpio
+
+# On-chip Peripheral Bus
+device	obio {[addr = -1], [irq = -1]}
+attach	obio at cpuchip
+file	arch/powerpc/booke/dev/obio.c		obio
+
+device	cpu {}
+attach	cpu at cpuchip
+file	arch/powerpc/booke/cpu.c
+
+device	ecc
+attach	ecc at cpuchip with ecc_cpuchip
+file	arch/powerpc/booke/dev/ecc_cpuchip.c	ecc_cpuchip
+
+# On-chip com device(s)
+attach	com at cpuchip with com_cpuchip
+file	arch/powerpc/booke/dev/com_cpuchip.c	com_cpuchip
+
+# On-chip ethernet device(s)
+device	estec: ether, ifnet, arp, mii
+attach	estec at cpuchip
+file	arch/powerpc/booke/dev/if_etsec.c	etsec
+
+# Watchdog timer
+device	wdog: sysmon_wdog
+attach	wdog at cpuchip
+file	arch/powerpc/booke/dev/wdog.c		wdog



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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:36:41 UTC 2010

Modified Files:
src/sys/arch/powerpc/include: asm.h

Log Message:
Put ASM RCSIDs into .ident


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/powerpc/include/asm.h

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

Modified files:

Index: src/sys/arch/powerpc/include/asm.h
diff -u src/sys/arch/powerpc/include/asm.h:1.28 src/sys/arch/powerpc/include/asm.h:1.29
--- src/sys/arch/powerpc/include/asm.h:1.28	Thu Dec 10 05:10:03 2009
+++ src/sys/arch/powerpc/include/asm.h	Tue Mar  9 22:36:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.28 2009/12/10 05:10:03 rmind Exp $	*/
+/*	$NetBSD: asm.h,v 1.29 2010/03/09 22:36:41 matt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -123,7 +123,7 @@
 
 #define	ASMSTR		.asciz
 
-#define RCSID(x)	.text; .asciz x
+#define RCSID(x)	.pushsection .ident; .asciz x; .popsection
 
 #ifdef __ELF__
 #define	WEAK_ALIAS(alias,sym)		\



CVS commit: src/sys/arch/powerpc/include/booke

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:39:32 UTC 2010

Added Files:
src/sys/arch/powerpc/include/booke: Makefile booke_intr.h pte.h spr.h
trap.h vmparam.h

Log Message:
Add initial versions of these for BookE.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/include/booke/Makefile \
src/sys/arch/powerpc/include/booke/booke_intr.h \
src/sys/arch/powerpc/include/booke/pte.h \
src/sys/arch/powerpc/include/booke/spr.h \
src/sys/arch/powerpc/include/booke/trap.h \
src/sys/arch/powerpc/include/booke/vmparam.h

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

Added files:

Index: src/sys/arch/powerpc/include/booke/Makefile
diff -u /dev/null src/sys/arch/powerpc/include/booke/Makefile:1.1
--- /dev/null	Tue Mar  9 22:39:32 2010
+++ src/sys/arch/powerpc/include/booke/Makefile	Tue Mar  9 22:39:32 2010
@@ -0,0 +1,11 @@
+#	$NetBSD: Makefile,v 1.1 2010/03/09 22:39:32 matt Exp $
+
+INCSDIR= /usr/include/powerpc/booke
+
+INCS=	booke_intr.h \
+	pmap.h pte.h \
+	spr.h \
+	trap.h \
+	vmparam.h
+
+.include bsd.kinc.mk
Index: src/sys/arch/powerpc/include/booke/booke_intr.h
diff -u /dev/null src/sys/arch/powerpc/include/booke/booke_intr.h:1.1
--- /dev/null	Tue Mar  9 22:39:32 2010
+++ src/sys/arch/powerpc/include/booke/booke_intr.h	Tue Mar  9 22:39:32 2010
@@ -0,0 +1,95 @@
+/*	$NetBSD: booke_intr.h,v 1.1 2010/03/09 22:39:32 matt Exp $	*/
+
+/*-
+ * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _BOOKE_INTR_H_
+#define _BOOKE_INTR_H_
+
+/* Interrupt priority `levels'. */
+#define	IPL_NONE	0	/* nothing */
+#define	IPL_SOFTCLOCK	1	/* software clock interrupt */
+#define	IPL_SOFTBIO	2	/* software block i/o interrupt */
+#define	IPL_SOFTNET	3	/* software network interrupt */
+#define	IPL_SOFTSERIAL	4	/* software serial interrupt */
+#define	IPL_VM		5	/* memory allocation */
+#define	IPL_SCHED	6	/* clock */
+#define	IPL_HIGH	7	/* everything */
+#define	NIPL		8
+
+/* Interrupt sharing types. */
+#define	IST_NONE	0	/* none */
+#define	IST_PULSE	1	/* pulsed */
+#define	IST_EDGE	2	/* edge-triggered */
+#define	IST_LEVEL	3	/* level-triggered */
+
+#ifndef _LOCORE
+
+#define	CLKF_BASEPRI(frame)	((frame)-cf_ipl == IPL_NONE)
+
+void 	*intr_establish(int, int, int, int (*)(void *), void *);
+void 	intr_disestablish(void *);
+void 	intr_init(void);
+void 	ext_intr(void); 			/* for machdep */
+int 	splraise(int);
+int 	spllower(int);
+void 	splx(int);
+void 	softintr(int);
+
+extern volatile u_int 		imask[NIPL];
+extern const int 		mask_clock; 		/* for clock.c */
+extern const int 		mask_statclock; 	/* for clock.c */
+
+#define	spllowersoftclock() 	spllower(imask[IPL_SOFTCLOCK])
+
+typedef int ipl_t;
+typedef struct {
+	ipl_t _ipl;
+} ipl_cookie_t;
+
+static inline ipl_cookie_t
+makeiplcookie(ipl_t ipl)
+{
+
+	return (ipl_cookie_t){._ipl = ipl};
+}
+
+static inline int
+splraiseipl(ipl_cookie_t icookie)
+{
+
+	return splraise(imask[icookie._ipl]);
+}
+
+#include sys/spl.h
+
+#define	spl0()			spllower(0)
+
+#endif /* !_LOCORE */
+#endif /* !_BOOKE_INTR_H_ */
Index: src/sys/arch/powerpc/include/booke/pte.h
diff -u /dev/null src/sys/arch/powerpc/include/booke/pte.h:1.1
--- /dev/null	Tue Mar  9 22:39:32 2010
+++ src/sys/arch/powerpc/include/booke/pte.h	Tue Mar  9 22:39:32 2010
@@ -0,0 +1,60 @@
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to 

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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:40:06 UTC 2010

Modified Files:
src/sys/arch/powerpc/include: pmap.h

Log Message:
Include BookE version of pmap.h


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/include/pmap.h

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



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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:40:06 UTC 2010

Modified Files:
src/sys/arch/powerpc/include: pmap.h

Log Message:
Include BookE version of pmap.h


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/include/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/arch/powerpc/include/pmap.h
diff -u src/sys/arch/powerpc/include/pmap.h:1.34 src/sys/arch/powerpc/include/pmap.h:1.35
--- src/sys/arch/powerpc/include/pmap.h:1.34	Tue Dec  9 20:45:45 2008
+++ src/sys/arch/powerpc/include/pmap.h	Tue Mar  9 22:40:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.34 2008/12/09 20:45:45 pooka Exp $	*/
+/*	$NetBSD: pmap.h,v 1.35 2010/03/09 22:40:06 matt Exp $	*/
 
 #ifdef _KERNEL_OPT
 #include opt_ppcarch.h
@@ -6,6 +6,8 @@
 
 #ifdef PPC_IBM4XX
 #include powerpc/ibm4xx/pmap.h
+#elif defined(PPC_BOOKE)
+#include powerpc/booke/pmap.h
 #elif defined(PPC_OEA) || defined (PPC_OEA64) || defined (PPC_OEA64_BRIDGE)
 #include powerpc/oea/pmap.h
 #else



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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:41:03 UTC 2010

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

Log Message:
Add BookE modifications to cpu_info


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/powerpc/include/cpu.h

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

Modified files:

Index: src/sys/arch/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.67 src/sys/arch/powerpc/include/cpu.h:1.68
--- src/sys/arch/powerpc/include/cpu.h:1.67	Sat Oct 24 20:03:56 2009
+++ src/sys/arch/powerpc/include/cpu.h	Tue Mar  9 22:41:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.67 2009/10/24 20:03:56 rmind Exp $	*/
+/*	$NetBSD: cpu.h,v 1.68 2010/03/09 22:41:03 matt Exp $	*/
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -78,11 +78,14 @@
 	int ci_intrdepth;
 	int ci_mtx_oldspl;
 	int ci_mtx_count;
+#ifndef PPC_BOOKE
 	char *ci_intstk;
+#endif
 #define	CPUSAVE_LEN	8
 	register_t ci_tempsave[CPUSAVE_LEN];
 	register_t ci_ddbsave[CPUSAVE_LEN];
 	register_t ci_ipkdbsave[CPUSAVE_LEN];
+#ifndef PPC_BOOKE
 #define	CPUSAVE_R28	0		/* where r28 gets saved */
 #define	CPUSAVE_R29	1		/* where r29 gets saved */
 #define	CPUSAVE_R30	2		/* where r30 gets saved */
@@ -93,6 +96,18 @@
 #define	CPUSAVE_SRR1	7		/* where SRR1 gets saved */
 #define	DISISAVE_LEN	4
 	register_t ci_disisave[DISISAVE_LEN];
+#else
+#define	CPUSAVE_R26	0		/* where r26 gets saved */
+#define	CPUSAVE_R27	1		/* where r27 gets saved */
+#define	CPUSAVE_R28	2		/* where r28 gets saved */
+#define	CPUSAVE_R29	3		/* where r29 gets saved */
+#define	CPUSAVE_R30	4		/* where r30 gets saved */
+#define	CPUSAVE_R31	5		/* where r31 gets saved */
+	register_t ci_critsave[CPUSAVE_LEN];
+	register_t ci_mchksave[CPUSAVE_LEN];
+	struct pmap_segtab *ci_pmap_kern_segtab;
+	struct pmap_segtab *ci_pmap_user_segtab;
+#endif
 	struct cache_info ci_ci;		
 	void *ci_sysmon_cookie;
 	void (*ci_idlespin)(void);



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

2010-03-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar  9 22:41:03 UTC 2010

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

Log Message:
Add BookE modifications to cpu_info


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/powerpc/include/cpu.h

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



CVS commit: src/sys/dev/pci

2010-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  9 22:45:50 UTC 2010

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

Log Message:
Use a shadow framebuffer instead of doing every operation twice ( once for
each framebuffer ) - this gives quite a dramatic speedup and hides the funky
effects previously seen.
Almost there, now we need to actually draw a cursor.


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

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

Modified files:

Index: src/sys/dev/pci/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.2 src/sys/dev/pci/wcfb.c:1.3
--- src/sys/dev/pci/wcfb.c:1.2	Thu Feb 25 20:56:20 2010
+++ src/sys/dev/pci/wcfb.c	Tue Mar  9 22:45:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.2 2010/02/25 20:56:20 macallan Exp $ */
+/*	$NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $ */
 
 /*-
  * Copyright (c) 2010 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.2 2010/02/25 20:56:20 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -39,6 +39,7 @@
 #include sys/kernel.h
 #include sys/systm.h
 #include sys/kauth.h
+#include sys/kmem.h
 
 #include dev/pci/pcidevs.h
 #include dev/pci/pcireg.h
@@ -83,7 +84,7 @@
 
 	int sc_width, sc_height, sc_stride;
 	int sc_locked;
-	uint8_t *sc_fbaddr;
+	uint8_t *sc_fbaddr, *sc_fb0, *sc_fb1, *sc_shadow;
 	struct vcons_screen sc_console_screen;
 	struct wsscreen_descr sc_defaultscreen_descr;
 	const struct wsscreen_descr *sc_screens[1];
@@ -204,10 +205,21 @@
 
 	sc-sc_fb0off = bus_space_read_4(sc-sc_regt, sc-sc_regh, 0x8080) -
 	sc-sc_fb;
+	sc-sc_fb0 = sc-sc_fbaddr + sc-sc_fb0off;
+	sc-sc_fb1 = sc-sc_fb0 + 0x20;
+
 	sc-sc_stride = 1  
 	((bus_space_read_4(sc-sc_regt, sc-sc_regh, 0x8074)  0x00ff)  16);
 	printf(%s: %d x %d, %d\n, device_xname(sc-sc_dev), 
 	sc-sc_width, sc-sc_height, sc-sc_stride);
+
+	sc-sc_shadow = kmem_alloc(sc-sc_stride * sc-sc_height, KM_SLEEP);
+	if (sc-sc_shadow == NULL) {
+		printf(%s: failed to allocate shadow buffer\n,
+		device_xname(self));
+		return;
+	}
+
 	for (i = 0x40; i  0x100; i += 16) {
 		printf(%04x:, i);
 		for (j = 0; j  16; j += 4) {
@@ -375,7 +387,7 @@
 	ri-ri_stride = sc-sc_stride;
 	ri-ri_flg = RI_CENTER /*| RI_FULLCLEAR*/;
 
-	ri-ri_bits = (char *)sc-sc_fbaddr + sc-sc_fb0off;
+	ri-ri_bits = sc-sc_shadow;
 
 	if (existing) {
 		ri-ri_flg |= RI_CLEAR;
@@ -408,11 +420,22 @@
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
+	int offset = (ri-ri_yorigin + row * ri-ri_font-fontheight) *
+	sc-sc_stride + ri-ri_xorigin + col * ri-ri_font-fontwidth;
+	uint8_t *from, *to0, *to1;
+	int i;
 
 	sc-putchar(ri, row, col, c, attr);
-	ri-ri_bits += 0x20;
-	sc-putchar(ri, row, col, c, attr);
-	ri-ri_bits -= 0x20;
+	from = sc-sc_shadow + offset;
+	to0 = sc-sc_fb0 + offset;
+	to1 = sc-sc_fb1 + offset;
+	for (i = 0; i  ri-ri_font-fontheight; i++) {
+		memcpy(to0, from, ri-ri_font-fontwidth);
+		memcpy(to1, from, ri-ri_font-fontwidth);
+		to0 += sc-sc_stride;
+		to1 += sc-sc_stride;
+		from += sc-sc_stride;
+	}
 }	
 
 static void
@@ -441,37 +464,72 @@
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
+	int offset = (ri-ri_yorigin + row * ri-ri_font-fontheight) *
+	sc-sc_stride + ri-ri_xorigin + dstcol * ri-ri_font-fontwidth;
+	uint8_t *from, *to0, *to1;
+	int i;
 
 	sc-copycols(ri, row, srccol, dstcol, ncols);
-	ri-ri_bits += 0x20;
-	sc-copycols(ri, row, srccol, dstcol, ncols);
-	ri-ri_bits -= 0x20;
+	from = sc-sc_shadow + offset;
+	to0 = sc-sc_fb0 + offset;
+	to1 = sc-sc_fb1 + offset;
+	for (i = 0; i  ri-ri_font-fontheight; i++) {
+		memcpy(to0, from, ri-ri_font-fontwidth * ncols);
+		memcpy(to1, from, ri-ri_font-fontwidth * ncols);
+		to0 += sc-sc_stride;
+		to1 += sc-sc_stride;
+		from += sc-sc_stride;
+	}
 }
 
 static void
-wcfb_erasecols(void *cookie, int row, int startcol, int ncol, long fillattr)
+wcfb_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr)
 {
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
-
-	sc-erasecols(ri, row, startcol, ncol, fillattr);
-	ri-ri_bits += 0x20;
-	sc-erasecols(ri, row, startcol, ncol, fillattr);
-	ri-ri_bits -= 0x20;
+	int offset = (ri-ri_yorigin + row * ri-ri_font-fontheight) *
+	sc-sc_stride + ri-ri_xorigin + startcol * ri-ri_font-fontwidth;
+	uint8_t *to0, *to1;
+	int i;
+
+	sc-erasecols(ri, row, startcol, ncols, fillattr);
+
+	to0 = sc-sc_fb0 + offset;
+	to1 = sc-sc_fb1 + offset;
+	for (i = 0; i  ri-ri_font-fontheight; i++) {
+		memset(to0, ri-ri_devcmap[(fillattr  16)  0xff],
+		ri-ri_font-fontwidth * ncols);
+		memset(to1, 

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

2010-03-09 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Tue Mar  9 23:12:06 UTC 2010

Modified Files:
src/sys/arch/xen/x86: xen_bus_dma.c

Log Message:
Although Xen's documentation states that the address_bits field is not used
by XENMEM_decrease_reservation, it is checked by the hypervisor. In certain
circumstances (stack leak), the field could have an improper value, leading
to a fail of the hypercall.

Set it to 0 (no addressing restriction) to avoid that.

Patch tested by Sam Fourman and h...@.

This should fix the rare failed allocating DMA memory encountered
under NetBSD dom0. Will ask for a pull-up.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/x86/xen_bus_dma.c

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



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

2010-03-09 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Tue Mar  9 23:12:06 UTC 2010

Modified Files:
src/sys/arch/xen/x86: xen_bus_dma.c

Log Message:
Although Xen's documentation states that the address_bits field is not used
by XENMEM_decrease_reservation, it is checked by the hypervisor. In certain
circumstances (stack leak), the field could have an improper value, leading
to a fail of the hypercall.

Set it to 0 (no addressing restriction) to avoid that.

Patch tested by Sam Fourman and h...@.

This should fix the rare failed allocating DMA memory encountered
under NetBSD dom0. Will ask for a pull-up.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/x86/xen_bus_dma.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/xen/x86/xen_bus_dma.c
diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.19 src/sys/arch/xen/x86/xen_bus_dma.c:1.20
--- src/sys/arch/xen/x86/xen_bus_dma.c:1.19	Tue Mar  2 00:13:50 2010
+++ src/sys/arch/xen/x86/xen_bus_dma.c	Tue Mar  9 23:12:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_bus_dma.c,v 1.19 2010/03/02 00:13:50 jym Exp $	*/
+/*	$NetBSD: xen_bus_dma.c,v 1.20 2010/03/09 23:12:06 jym Exp $	*/
 /*	NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */
 
 /*-
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xen_bus_dma.c,v 1.19 2010/03/02 00:13:50 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_bus_dma.c,v 1.20 2010/03/09 23:12:06 jym Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -95,6 +95,7 @@
 		xenguest_handle(res.extent_start) = mfn;
 		res.nr_extents = 1;
 		res.extent_order = 0;
+		res.address_bits = 0;
 		res.domid = DOMID_SELF;
 		error = HYPERVISOR_memory_op(XENMEM_decrease_reservation, res);
 		if (error != 1) {



CVS commit: src/sys/dev/pci

2010-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  9 23:17:12 UTC 2010

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

Log Message:
now we also draw a cursor


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

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



CVS commit: src/sys/dev/pci

2010-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  9 23:17:12 UTC 2010

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

Log Message:
now we also draw a cursor


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

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

Modified files:

Index: src/sys/dev/pci/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.3 src/sys/dev/pci/wcfb.c:1.4
--- src/sys/dev/pci/wcfb.c:1.3	Tue Mar  9 22:45:50 2010
+++ src/sys/dev/pci/wcfb.c	Tue Mar  9 23:17:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $ */
+/*	$NetBSD: wcfb.c,v 1.4 2010/03/09 23:17:12 macallan Exp $ */
 
 /*-
  * Copyright (c) 2010 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.3 2010/03/09 22:45:50 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.4 2010/03/09 23:17:12 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -451,11 +451,44 @@
 static void
 wcfb_cursor(void *cookie, int on, int row, int col)
 {
-#if 0
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wcfb_softc *sc = scr-scr_cookie;
+	int coffset;
+	
+	if (sc-sc_mode == WSDISPLAYIO_MODE_EMUL) {
+
+		if (ri-ri_flg  RI_CURSOR) {
+			/* remove cursor */
+			coffset = ri-ri_ccol + (ri-ri_crow * ri-ri_cols);
+#ifdef WSDISPLAY_SCROLLSUPPORT
+			coffset += scr-scr_offset_to_zero;
+#endif
+			wcfb_putchar(cookie, ri-ri_crow, 
+			ri-ri_ccol, scr-scr_chars[coffset], 
+			scr-scr_attrs[coffset]);
+			ri-ri_flg = ~RI_CURSOR;
+		}
+		ri-ri_crow = row;
+		ri-ri_ccol = col;
+		if (on) {
+			long attr, revattr;
+			coffset = col + (row * ri-ri_cols);
+#ifdef WSDISPLAY_SCROLLSUPPORT
+			coffset += scr-scr_offset_to_zero;
 #endif
+			attr = scr-scr_attrs[coffset];
+			revattr = attr ^ 0x;
+
+			wcfb_putchar(cookie, ri-ri_crow, ri-ri_ccol,
+			scr-scr_chars[coffset], revattr);
+			ri-ri_flg |= RI_CURSOR;
+		}
+	} else {
+		ri-ri_crow = row;
+		ri-ri_ccol = col;
+		ri-ri_flg = ~RI_CURSOR;
+	}
 }
 
 static void



CVS commit: src/sys/dev/cardbus

2010-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 00:21:10 UTC 2010

Modified Files:
src/sys/dev/cardbus: ehci_cardbus.c if_tlp_cardbus.c ohci_cardbus.c

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

Simplify interrupt (dis)establishment by two source transformations:

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

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

Tested by Klaus Heinz.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/ohci_cardbus.c

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



CVS commit: src/sys/dev/cardbus

2010-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 00:21:10 UTC 2010

Modified Files:
src/sys/dev/cardbus: ehci_cardbus.c if_tlp_cardbus.c ohci_cardbus.c

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

Simplify interrupt (dis)establishment by two source transformations:

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

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

Tested by Klaus Heinz.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/ohci_cardbus.c

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

Modified files:

Index: src/sys/dev/cardbus/ehci_cardbus.c
diff -u src/sys/dev/cardbus/ehci_cardbus.c:1.27 src/sys/dev/cardbus/ehci_cardbus.c:1.28
--- src/sys/dev/cardbus/ehci_cardbus.c:1.27	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/ehci_cardbus.c	Wed Mar 10 00:21:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -153,11 +153,6 @@
 	sc-sc_ct = ct;
 	sc-sc.sc_bus.dmatag = ca-ca_dmat;
 
-#if rbus
-#else
-XXX	(ct-ct_cf-cardbus_mem_open)(cc, 0, iob, iob + 0x40);
-#endif
-
 	/* Enable the device. */
 	csr = Cardbus_conf_read(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG);
 	Cardbus_conf_write(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG,
@@ -169,7 +164,7 @@
 	DPRINTF((%s: offs=%d\n, devname, sc-sc.sc_offs));
 	EOWRITE2(sc-sc, EHCI_USBINTR, 0);
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, ca-ca_intrline,
+	sc-sc_ih = Cardbus_intr_establish(ct, ca-ca_intrline,
 	   IPL_USB, ehci_intr, sc);
 	if (sc-sc_ih == NULL) {
 		printf(%s: couldn't establish interrupt\n, devname);
@@ -206,7 +201,7 @@
 		printf(%s: init failed, error=%d\n, devname, r);
 
 		/* Avoid spurious interrupts. */
-		cardbus_intr_disestablish(sc-sc_cc, sc-sc_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 
 		return;
@@ -231,7 +226,7 @@
 	if (rv)
 		return (rv);
 	if (sc-sc_ih != NULL) {
-		cardbus_intr_disestablish(sc-sc_cc, sc-sc_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 	}
 	if (sc-sc.sc_size) {

Index: src/sys/dev/cardbus/if_tlp_cardbus.c
diff -u src/sys/dev/cardbus/if_tlp_cardbus.c:1.66 src/sys/dev/cardbus/if_tlp_cardbus.c:1.67
--- src/sys/dev/cardbus/if_tlp_cardbus.c:1.66	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/if_tlp_cardbus.c	Wed Mar 10 00:21:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $	*/
+/*	$NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -307,20 +307,12 @@
 	if (Cardbus_mapreg_map(ct, TULIP_PCI_MMBA,
 	PCI_MAPREG_TYPE_MEM, 0, sc-sc_st, sc-sc_sh, adr,
 	csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_mem_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_MEM_ENABLE;
 		csc-sc_bar_reg = TULIP_PCI_MMBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
 	} else if (Cardbus_mapreg_map(ct, TULIP_PCI_IOBA,
 	PCI_MAPREG_TYPE_IO, 0, sc-sc_st, sc-sc_sh, adr,
 	csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_io_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_IO_ENABLE;
 		csc-sc_bar_reg = TULIP_PCI_IOBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
@@ -472,7 +464,7 @@
 	 * Unhook the interrupt handler.
 	 */
 	if (csc-sc_ih != NULL)
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, csc-sc_ih);
+		Cardbus_intr_disestablish(ct, csc-sc_ih);
 
 	/*
 	 * Release bus space and close window.
@@ -489,8 +481,6 @@
 {
 	struct tulip_cardbus_softc *csc = (void *) sc;
 	cardbus_devfunc_t ct = csc-sc_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 
 	/*
 	 * Power on the socket.
@@ -505,7 +495,7 @@
 	/*
 	 * Map and establish the interrupt.
 	 */
-	csc-sc_ih = cardbus_intr_establish(cc, cf, csc-sc_intrline, IPL_NET,
+	csc-sc_ih = Cardbus_intr_establish(ct, csc-sc_intrline, IPL_NET,
 	tlp_intr, sc);
 	if (csc-sc_ih == NULL) {
 		aprint_error_dev(sc-sc_dev,
@@ 

CVS commit: src/sys/arch/sparc64/sparc64

2010-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 10 06:57:23 UTC 2010

Modified Files:
src/sys/arch/sparc64/sparc64: db_interface.c locore.s pmap.c

Log Message:
XXX: workaround we'd like to remove when pmap / uvm locking is cleaned up:

- rename pseg_get() and pseg_set() to pseg_get_real() and pseg_set_real().
- if USE_LOCKSAFE_PSEG_GETSET is defined, which it current is by default,
  define pseg_[gs]et() in terms of functions that take a new pseg_lock
  mutex at IPL_VM while calling into the real functions.

this seems to avoid the pseg_set() crashes we've seen:
  1 - spare needed, when pseg_get() just worked for this pmap
  2 - the 2rd ldxa via ASI_PHYS_CACHED in pseg_set() loads garbage
  into %o4, and causes the 3rd ldxa to fault


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/sparc64/sparc64/db_interface.c
cvs rdiff -u -r1.326 -r1.327 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.258 -r1.259 src/sys/arch/sparc64/sparc64/pmap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2010-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 10 06:57:23 UTC 2010

Modified Files:
src/sys/arch/sparc64/sparc64: db_interface.c locore.s pmap.c

Log Message:
XXX: workaround we'd like to remove when pmap / uvm locking is cleaned up:

- rename pseg_get() and pseg_set() to pseg_get_real() and pseg_set_real().
- if USE_LOCKSAFE_PSEG_GETSET is defined, which it current is by default,
  define pseg_[gs]et() in terms of functions that take a new pseg_lock
  mutex at IPL_VM while calling into the real functions.

this seems to avoid the pseg_set() crashes we've seen:
  1 - spare needed, when pseg_get() just worked for this pmap
  2 - the 2rd ldxa via ASI_PHYS_CACHED in pseg_set() loads garbage
  into %o4, and causes the 3rd ldxa to fault


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/sparc64/sparc64/db_interface.c
cvs rdiff -u -r1.326 -r1.327 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.258 -r1.259 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_interface.c
diff -u src/sys/arch/sparc64/sparc64/db_interface.c:1.123 src/sys/arch/sparc64/sparc64/db_interface.c:1.124
--- src/sys/arch/sparc64/sparc64/db_interface.c:1.123	Sat Mar  6 08:08:29 2010
+++ src/sys/arch/sparc64/sparc64/db_interface.c	Wed Mar 10 06:57:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.123 2010/03/06 08:08:29 mrg Exp $ */
+/*	$NetBSD: db_interface.c,v 1.124 2010/03/10 06:57:22 mrg Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.123 2010/03/06 08:08:29 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.124 2010/03/10 06:57:22 mrg Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -650,7 +650,8 @@
 	}
 }
 
-int64_t pseg_get(struct pmap *, vaddr_t);
+/* XXX no locking; shouldn't matter */
+int64_t pseg_get_real(struct pmap *, vaddr_t);
 
 void
 db_dump_pmap(struct pmap *pm)
@@ -706,7 +707,7 @@
 	if (have_addr) {
 		/* lookup an entry for this VA */
 		
-		if ((data = pseg_get(pmap_kernel(), (vaddr_t)addr))) {
+		if ((data = pseg_get_real(pmap_kernel(), (vaddr_t)addr))) {
 			db_printf(pmap_kernel(%p)-pm_segs[%lx][%lx][%lx]=%qx\n,
   (void *)(uintptr_t)addr, (u_long)va_to_seg(addr),
   (u_long)va_to_dir(addr), (u_long)va_to_pte(addr),

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.326 src/sys/arch/sparc64/sparc64/locore.s:1.327
--- src/sys/arch/sparc64/sparc64/locore.s:1.326	Mon Mar  8 08:59:06 2010
+++ src/sys/arch/sparc64/sparc64/locore.s	Wed Mar 10 06:57:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.326 2010/03/08 08:59:06 mrg Exp $	*/
+/*	$NetBSD: locore.s,v 1.327 2010/03/10 06:57:22 mrg Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -6568,14 +6568,15 @@
 	retl
 	 mov	%o4, %g1		! Restore g1
 #endif
+
 /*
- * extern int64_t pseg_get(struct pmap *pm, vaddr_t addr);
+ * extern int64_t pseg_get_real(struct pmap *pm, vaddr_t addr);
  *
  * Return TTE at addr in pmap.  Uses physical addressing only.
  * pmap-pm_physaddr must by the physical address of pm_segs
  *
  */
-ENTRY(pseg_get)
+ENTRY(pseg_get_real)
 !	flushw			! Make sure we don't have stack probs  lose hibits of %o
 	ldx	[%o0 + PM_PHYS], %o2			! pmap-pm_segs
 
@@ -6637,13 +6638,13 @@
 /*
  * In 32-bit mode:
  *
- * extern int pseg_set(struct pmap* %o0, vaddr_t addr %o1, int64_t tte %o2:%o3,
- *			 paddr_t spare %o4:%o5);
+ * extern int pseg_set_real(struct pmap* %o0, vaddr_t addr %o1,
+ *			int64_t tte %o2:%o3, paddr_t spare %o4:%o5);
  *
  * In 64-bit mode:
  *
- * extern int pseg_set(struct pmap* %o0, vaddr_t addr %o1, int64_t tte %o2,
- *			paddr_t spare %o3);
+ * extern int pseg_set_real(struct pmap* %o0, vaddr_t addr %o1,
+ *			int64_t tte %o2, paddr_t spare %o3);
  *
  * Set a pseg entry to a particular TTE value.  Return values are:
  *
@@ -6673,7 +6674,7 @@
  * The counters are 32 bit or 64 bit wide, depending on the kernel type we are
  * running!
  */
-ENTRY(pseg_set)
+ENTRY(pseg_set_real)
 #ifndef _LP64
 	sllx	%o4, 32, %o4! Put args into 64-bit format
 	sllx	%o2, 32, %o2! Shift to high 32-bits

Index: src/sys/arch/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.258 src/sys/arch/sparc64/sparc64/pmap.c:1.259
--- src/sys/arch/sparc64/sparc64/pmap.c:1.258	Mon Mar  8 08:59:06 2010
+++ src/sys/arch/sparc64/sparc64/pmap.c	Wed Mar 10 06:57:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.258 2010/03/08 08:59:06 mrg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.259 2010/03/10 06:57:22 mrg Exp $	*/
 /*
  *
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.258 2010/03/08 08:59:06 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.259