CVS commit: src/distrib/sets/lists/tests

2009-09-07 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Mon Sep  7 08:22:51 UTC 2009

Modified Files:
src/distrib/sets/lists/tests: mi module.mi

Log Message:
Move ./usr/tests/modules/Atffile from tests/mi to tests/module.mi.
This should get us building for evbppc again, which doesn't do modules.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/tests/module.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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.46 src/distrib/sets/lists/tests/mi:1.47
--- src/distrib/sets/lists/tests/mi:1.46	Wed Jul 22 21:35:38 2009
+++ src/distrib/sets/lists/tests/mi	Mon Sep  7 08:22:51 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.46 2009/07/22 21:35:38 joerg Exp $
+# $NetBSD: mi,v 1.47 2009/09/07 08:22:51 he Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -853,7 +853,6 @@
 ./usr/tests/lib/libc/string/Atffile		tests-lib-tests
 ./usr/tests/lib/libc/string/t_popcount		tests-lib-tests
 ./usr/tests/modulestests-sys-tests
-./usr/tests/modules/Atffile			tests-sys-tests
 ./usr/tests/net	tests-net-tests
 ./usr/tests/net/Atffiletests-net-tests
 ./usr/tests/net/systests-net-tests

Index: src/distrib/sets/lists/tests/module.mi
diff -u src/distrib/sets/lists/tests/module.mi:1.1 src/distrib/sets/lists/tests/module.mi:1.2
--- src/distrib/sets/lists/tests/module.mi:1.1	Sun Jan 18 12:49:07 2009
+++ src/distrib/sets/lists/tests/module.mi	Mon Sep  7 08:22:51 2009
@@ -1,7 +1,8 @@
-# $NetBSD: module.mi,v 1.1 2009/01/18 12:49:07 he Exp $
+# $NetBSD: module.mi,v 1.2 2009/09/07 08:22:51 he Exp $
 #
 # These are only made for ports doing modules.
 #
+./usr/tests/modules/Atffile			tests-sys-tests
 ./usr/tests/modules/k_helper			tests-sys-tests
 ./usr/tests/modules/k_helper/k_helper.kmod	tests-sys-tests
 ./usr/tests/modules/t_modctl			tests-sys-tests



CVS commit: src/sys/arch

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 10:40:54 UTC 2009

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

Log Message:
Refer to hdaudio as 'High Definition Audio', not
'Intel High Definition Audio' as many vendors implement the HD audio spec.


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.206 -r1.207 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.942 -r1.943 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/conf/XEN3_DOM0

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.250 src/sys/arch/amd64/conf/GENERIC:1.251
--- src/sys/arch/amd64/conf/GENERIC:1.250	Sun Sep  6 17:25:56 2009
+++ src/sys/arch/amd64/conf/GENERIC	Mon Sep  7 10:40:54 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.250 2009/09/06 17:25:56 sborrill Exp $
+# $NetBSD: GENERIC,v 1.251 2009/09/07 10:40:54 jmcneill Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.250 $
+#ident 		GENERIC-$Revision: 1.251 $
 
 maxusers	64		# estimated number of users
 
@@ -954,8 +954,8 @@
 opl*	at fms?
 opl*	at sv?
 
-# Intel High Definition Audio
-#hdaudio*	at pci? dev ? function ?	# Intel High Definition Audio
+# High Definition Audio
+#hdaudio*	at pci? dev ? function ?	# High Definition Audio
 #hdafg*		at hdaudiobus?
 
 # Audio support

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.44 src/sys/arch/amd64/conf/XEN3_DOM0:1.45
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.44	Sun Sep  6 17:25:56 2009
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Mon Sep  7 10:40:54 2009
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.44 2009/09/06 17:25:56 sborrill Exp $
+# $NetBSD: XEN3_DOM0,v 1.45 2009/09/07 10:40:54 jmcneill Exp $
 
 include 	arch/amd64/conf/std.xen
 
@@ -683,8 +683,8 @@
 opl*	at sv?
 opl*	at yds?
 
-# Intel High Definition Audio
-#hdaudio*	at pci? dev ? function ?	# Intel High Definition Audio
+# High Definition Audio
+#hdaudio*	at pci? dev ? function ?	# High Definition Audio
 #hdafg*		at hdaudiobus?
 
 # Audio support

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.206 src/sys/arch/i386/conf/ALL:1.207
--- src/sys/arch/i386/conf/ALL:1.206	Sun Sep  6 17:25:56 2009
+++ src/sys/arch/i386/conf/ALL	Mon Sep  7 10:40:54 2009
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.206 2009/09/06 17:25:56 sborrill Exp $
+# $NetBSD: ALL,v 1.207 2009/09/07 10:40:54 jmcneill Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.206 $
+#ident 		ALL-$Revision: 1.207 $
 
 maxusers	32		# estimated number of users
 
@@ -1318,8 +1318,8 @@
 opl*	at yds?
 opl*	at ym?
 
-# Intel High Definition Audio
-hdaudio*	at pci? dev ? function ?	# Intel High Definition Audio
+# High Definition Audio
+hdaudio*	at pci? dev ? function ?	# High Definition Audio
 hdafg*		at hdaudiobus?
 
 # Audio support

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.942 src/sys/arch/i386/conf/GENERIC:1.943
--- src/sys/arch/i386/conf/GENERIC:1.942	Sun Sep  6 17:25:56 2009
+++ src/sys/arch/i386/conf/GENERIC	Mon Sep  7 10:40:54 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.942 2009/09/06 17:25:56 sborrill Exp $
+# $NetBSD: GENERIC,v 1.943 2009/09/07 10:40:54 jmcneill Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.942 $
+#ident 		GENERIC-$Revision: 1.943 $
 
 maxusers	64		# estimated number of users
 
@@ -1314,8 +1314,8 @@
 opl*	at yds?
 opl*	at ym?
 
-# Intel High Definition Audio
-#hdaudio*	at pci? dev ? function ?	# Intel High Definition Audio
+# High Definition Audio
+#hdaudio*	at pci? dev ? function ?	# High Definition Audio
 #hdafg*		at hdaudiobus?
 
 # Audio support

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.20 src/sys/arch/i386/conf/XEN3_DOM0:1.21
--- src/sys/arch/i386/conf/XEN3_DOM0:1.20	Sun Sep  6 17:25:56 2009
+++ src/sys/arch/i386/conf/XEN3_DOM0	Mon Sep  7 10:40:54 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.20 2009/09/06 17:25:56 sborrill Exp $
+#	$NetBSD: XEN3_DOM0,v 1.21 2009/09/07 10:40:54 jmcneill Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -669,8 +669,8 @@
 opl*	at sv?
 opl*	at yds?
 
-# Intel High Definition Audio
-#hdaudio*	at pci? dev ? function ?	# Intel High Definition Audio
+# High Definition Audio
+#hdaudio*	at pci? dev ? function ?	# High Definition Audio
 #hdafg*		at hdaudiobus?
 
 # 

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

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 11:49:27 UTC 2009

Modified Files:
src/sys/dev/pci/hdaudio: hdaudio_mixer.h

Log Message:
Don't name the beeper inputs.speaker, or MI audio might get confused.
Name it inputs.beep instead so play.gain doesn't get mapped to it.


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

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

Modified files:

Index: src/sys/dev/pci/hdaudio/hdaudio_mixer.h
diff -u src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.2 src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.3
--- src/sys/dev/pci/hdaudio/hdaudio_mixer.h:1.2	Sun Sep  6 17:33:53 2009
+++ src/sys/dev/pci/hdaudio/hdaudio_mixer.h	Mon Sep  7 11:49:27 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_mixer.h,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */
+/* $NetBSD: hdaudio_mixer.h,v 1.3 2009/09/07 11:49:27 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -65,7 +65,7 @@
 
 #define	HDAUDIO_DEVICE_NAMES	{	   \
 	AudioNmaster, AudioNbass, AudioNtreble, AudioNfmsynth, AudioNdac,  \
-	AudioNspeaker, AudioNline, AudioNmicrophone, AudioNcd,		   \
+	beep, AudioNline, AudioNmicrophone, AudioNcd,		   	   \
 	AudioNrecord, AudioNdac2, reclvl, AudioNinput, AudioNoutput,   \
 	AudioNline1, AudioNline2, AudioNline3,			   \
 	dig1, dig2, dig3, phin, phout,			   \



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

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 11:50:02 UTC 2009

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

Log Message:
Remove hdaudio.gpio.* mixer controls, they didn't work anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio/hdaudio_afg.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.3 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.4
--- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.3	Mon Sep  7 02:04:43 2009
+++ src/sys/dev/pci/hdaudio/hdaudio_afg.c	Mon Sep  7 11:50:01 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.3 2009/09/07 02:04:43 jmcneill Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.3 2009/09/07 02:04:43 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -98,8 +98,7 @@
 #define HDAUDIO_MIXER_CLASS_OUTPUTS	0
 #define	HDAUDIO_MIXER_CLASS_INPUTS	1
 #define	HDAUDIO_MIXER_CLASS_RECORD	2
-#define	HDAUDIO_MIXER_CLASS_HDAUDIO	3
-#define	HDAUDIO_MIXER_CLASS_LAST	HDAUDIO_MIXER_CLASS_HDAUDIO
+#define	HDAUDIO_MIXER_CLASS_LAST	HDAUDIO_MIXER_CLASS_RECORD
 
 #define	HDAUDIO_GPIO_MASK	0
 #define	HDAUDIO_GPIO_DIR	1
@@ -285,8 +284,6 @@
 	intsc_nmixers;
 	struct hdaudio_mixer		*sc_mixers;
 
-	intsc_gpioindex[3];
-
 	intsc_pchan, sc_rchan;
 	intsc_curpchan, sc_currchan;
 
@@ -992,8 +989,6 @@
 	uint32_t nodecnt;
 	int nid;
 
-	sc-sc_gpioindex[0] = sc-sc_gpioindex[1] = sc-sc_gpioindex[2] = -1;
-
 	nodecnt = hda_get_param(sc, SUBORDINATE_NODE_COUNT);
 	sc-sc_startnode = COP_NODECNT_STARTNODE(nodecnt);
 	sc-sc_nwidgets = COP_NODECNT_NUMNODES(nodecnt);
@@ -2422,11 +2417,8 @@
 		++nmixers;
 	if (nadc  0)
 		++nmixers;
-	/* Make room for gpio controls */
-	if (numgpio  0)
-		nmixers += 3;
 
-	hda_trace(sc,   need %d mixers (4 classes%s)\n,
+	hda_trace(sc,   need %d mixers (3 classes%s)\n,
 	nmixers, needmasterctl ?  + fake master : );
 
 	/* Allocate memory for the mixers */
@@ -2450,53 +2442,6 @@
 		case HDAUDIO_MIXER_CLASS_RECORD:
 			strcpy(mx[index].mx_di.label.name, AudioCrecord);
 			break;
-		case HDAUDIO_MIXER_CLASS_HDAUDIO:
-			strcpy(mx[index].mx_di.label.name, hdaudio);
-			break;
-		}
-		++index;
-	}
-
-	/* DAC selector */
-	if (ndac  0) {
-		mx[index].mx_ctl = NULL;
-		mx[index].mx_di.index = index;
-		mx[index].mx_di.type = AUDIO_MIXER_SET;
-		mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS;
-		mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST;
-		strcpy(mx[index].mx_di.label.name, AudioNselect);
-		mx[index].mx_di.un.s.num_mem = ndac;
-		for (i = 0, j = 0; i  sc-sc_nassocs; i++) {
-			if (sc-sc_assocs[i].as_enable == false)
-continue;
-			if (sc-sc_assocs[i].as_dir != HDAUDIO_PINDIR_OUT)
-continue;
-			mx[index].mx_di.un.s.member[j].mask = 1  i;
-			sprintf(mx[index].mx_di.un.s.member[j].label.name,
-			DAC%02X, i);
-			++j;
-		}
-		++index;
-	}
-
-	/* ADC selector */
-	if (nadc  0) {
-		mx[index].mx_ctl = NULL;
-		mx[index].mx_di.index = index;
-		mx[index].mx_di.type = AUDIO_MIXER_SET;
-		mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_RECORD;
-		mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST;
-		strcpy(mx[index].mx_di.label.name, AudioNsource);
-		mx[index].mx_di.un.s.num_mem = nadc;
-		for (i = 0, j = 0; i  sc-sc_nassocs; i++) {
-			if (sc-sc_assocs[i].as_enable == false)
-continue;
-			if (sc-sc_assocs[i].as_dir != HDAUDIO_PINDIR_IN)
-continue;
-			mx[index].mx_di.un.s.member[j].mask = 1  i;
-			sprintf(mx[index].mx_di.un.s.member[j].label.name,
-			ADC%02X, i);
-			++j;
 		}
 		++index;
 	}
@@ -2556,47 +2501,50 @@
 		++index;
 	}
 
-	/* GPIO controls */
-	if (numgpio  0) {
-		/* mask */
-		sc-sc_gpioindex[HDAUDIO_GPIO_MASK] = index;
-		mx[index].mx_ctl = NULL;
-		mx[index].mx_di.index = index;
-		mx[index].mx_di.type = AUDIO_MIXER_VALUE;
-		mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_HDAUDIO;
-		mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST;
-		mx[index].mx_di.un.v.num_channels = 1;
-		mx[index].mx_di.un.v.delta = 1;
-		strcpy(mx[index].mx_di.label.name, gpio.mask);
-		strcpy(mx[index].mx_di.un.v.units.name, bitmask);
-		++index;
-		/* direction */
-		sc-sc_gpioindex[HDAUDIO_GPIO_DIR] = index;
+	/* DAC selector */
+	if (ndac  0) {
 		mx[index].mx_ctl = NULL;
 		mx[index].mx_di.index = index;
-		mx[index].mx_di.type = AUDIO_MIXER_VALUE;
-		mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_HDAUDIO;
+		mx[index].mx_di.type = AUDIO_MIXER_SET;
+		mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS;
 		mx[index].mx_di.prev = 

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

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 11:59:53 UTC 2009

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

Log Message:
Until MI audio can handle it better, rename outputs.select - outputs.dacsel.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio/hdaudio_afg.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.4 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.5
--- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.4	Mon Sep  7 11:50:01 2009
+++ src/sys/dev/pci/hdaudio/hdaudio_afg.c	Mon Sep  7 11:59:53 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.4 2009/09/07 11:50:01 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -2508,7 +2508,7 @@
 		mx[index].mx_di.type = AUDIO_MIXER_SET;
 		mx[index].mx_di.mixer_class = HDAUDIO_MIXER_CLASS_OUTPUTS;
 		mx[index].mx_di.prev = mx[index].mx_di.next = AUDIO_MIXER_LAST;
-		strcpy(mx[index].mx_di.label.name, AudioNselect);
+		strcpy(mx[index].mx_di.label.name, dacsel); /* AudioNselect */
 		mx[index].mx_di.un.s.num_mem = ndac;
 		for (i = 0, j = 0; i  sc-sc_nassocs; i++) {
 			if (sc-sc_assocs[i].as_enable == false)



CVS commit: src/sys/dev/pci

2009-09-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Sep  7 12:44:29 UTC 2009

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

Log Message:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested on VT6122.


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

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

Modified files:

Index: src/sys/dev/pci/if_vge.c
diff -u src/sys/dev/pci/if_vge.c:1.48 src/sys/dev/pci/if_vge.c:1.49
--- src/sys/dev/pci/if_vge.c:1.48	Sat May 16 07:34:05 2009
+++ src/sys/dev/pci/if_vge.c	Mon Sep  7 12:44:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.48 2009/05/16 07:34:05 tsutsui Exp $ */
+/* $NetBSD: if_vge.c,v 1.49 2009/09/07 12:44:29 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vge.c,v 1.48 2009/05/16 07:34:05 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vge.c,v 1.49 2009/09/07 12:44:29 tsutsui Exp $);
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -318,7 +318,7 @@
 static int vge_suspend(device_t);
 static int vge_resume(device_t);
 #endif
-static void vge_shutdown(void *);
+static bool vge_shutdown(device_t, int);
 
 static uint16_t vge_read_eeprom(struct vge_softc *, int);
 
@@ -1077,10 +1077,10 @@
 	/*
 	 * Make sure the interface is shutdown during reboot.
 	 */
-	if (shutdownhook_establish(vge_shutdown, sc) == NULL) {
-		aprint_error_dev(self,
-		WARNING: unable to establish shutdown hook\n);
-	}
+	if (pmf_device_register1(self, NULL, NULL, vge_shutdown))
+		pmf_class_network_register(self, ifp);
+	else
+		aprint_error_dev(self, couldn't establish power handler\n);
 }
 
 static int
@@ -2212,11 +2212,13 @@
  * Stop all chip I/O so that the kernel's probe routines don't
  * get confused by errant DMAs when rebooting.
  */
-static void
-vge_shutdown(void *arg)
+static bool
+vge_shutdown(device_t self, int howto)
 {
 	struct vge_softc *sc;
 
-	sc = arg;
+	sc = device_private(self);
 	vge_stop(sc-sc_ethercom.ec_if, 1);
+
+	return true;
 }



CVS commit: src/sys/fs/smbfs

2009-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  7 12:52:54 UTC 2009

Modified Files:
src/sys/fs/smbfs: smbfs_vfsops.c

Log Message:
set mntfromname in a less creative and historic fashion


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/fs/smbfs/smbfs_vfsops.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/fs/smbfs/smbfs_vfsops.c
diff -u src/sys/fs/smbfs/smbfs_vfsops.c:1.88 src/sys/fs/smbfs/smbfs_vfsops.c:1.89
--- src/sys/fs/smbfs/smbfs_vfsops.c:1.88	Thu Jul  2 16:17:52 2009
+++ src/sys/fs/smbfs/smbfs_vfsops.c	Mon Sep  7 12:52:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_vfsops.c,v 1.88 2009/07/02 16:17:52 njoly Exp $	*/
+/*	$NetBSD: smbfs_vfsops.c,v 1.89 2009/09/07 12:52:53 pooka Exp $	*/
 
 /*
  * Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smbfs_vfsops.c,v 1.88 2009/07/02 16:17:52 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: smbfs_vfsops.c,v 1.89 2009/09/07 12:52:53 pooka Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -161,6 +161,7 @@
 	struct smb_share *ssp = NULL;
 	struct smb_cred scred;
 	struct proc *p;
+	char *fromname;
 	int error;
 
 	if (*data_len  sizeof *args)
@@ -185,17 +186,25 @@
 		return EINVAL;
 	}
 
-	error = set_statvfs_info(path, UIO_USERSPACE, NULL, UIO_USERSPACE,
-	mp-mnt_op-vfs_name, mp, l);
-	if (error)
-		return error;
-
 	smb_makescred(scred, l, l-l_cred);
 	error = smb_dev2share(args-dev_fd, SMBM_EXEC, scred, ssp);
 	if (error)
 		return error;
 	smb_share_unlock(ssp);	/* keep ref, but unlock */
 	vcp = SSTOVC(ssp);
+
+	fromname = kmem_zalloc(MNAMELEN, KM_SLEEP);
+	snprintf(fromname, MNAMELEN,
+	//%...@%s/%s, vcp-vc_username, vcp-vc_srvname, ssp-ss_name);
+	error = set_statvfs_info(path, UIO_USERSPACE, fromname, UIO_USERSPACE,
+	mp-mnt_op-vfs_name, mp, l);
+	kmem_free(fromname, MNAMELEN);
+	if (error) {
+		smb_share_lock(ssp);
+		smb_share_put(ssp, scred);
+		return error;
+	}
+
 	mp-mnt_stat.f_iosize = vcp-vc_txmax;
 	mp-mnt_stat.f_namemax =
 	(vcp-vc_hflags2  SMB_FLAGS2_KNOWS_LONG_NAMES) ? 255 : 12;
@@ -216,10 +225,6 @@
 	smp-sm_args.dir_mode  = (smp-sm_args.dir_mode 
 			(S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
 
-	memset(mp-mnt_stat.f_mntfromname, 0, MNAMELEN);
-	snprintf(mp-mnt_stat.f_mntfromname, MNAMELEN,
-	//%...@%s/%s, vcp-vc_username, vcp-vc_srvname, ssp-ss_name);
-
 	vfs_getnewfsid(mp);
 	return (0);
 }



CVS commit: src/sys/rump

2009-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  7 13:02:37 UTC 2009

Modified Files:
src/sys/rump: Makefile.rump

Log Message:
Always define __NetBSD__ (for builds on non-NetBSD)


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

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/Makefile.rump
diff -u src/sys/rump/Makefile.rump:1.38 src/sys/rump/Makefile.rump:1.39
--- src/sys/rump/Makefile.rump:1.38	Sun May  3 16:53:54 2009
+++ src/sys/rump/Makefile.rump	Mon Sep  7 13:02:37 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rump,v 1.38 2009/05/03 16:53:54 pooka Exp $
+#	$NetBSD: Makefile.rump,v 1.39 2009/09/07 13:02:37 pooka Exp $
 #
 
 WARNS?=		3	# XXX: src/sys won't compile with -Wsign-compare yet
@@ -25,6 +25,9 @@
 CPPFLAGS+=	-nostdinc -I${RUMPTOP}/..
 #CPPFLAGS+=	-DDEBUG
 
+# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
+CPPFLAGS+=	-D__NetBSD__
+
 RUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
 
 # workaround: evbppc is not a well-defined arch



CVS commit: src/sys/dev/ic

2009-09-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Sep  7 13:31:44 UTC 2009

Modified Files:
src/sys/dev/ic: ncr53c9x.c ncr53c9xreg.h ncr53c9xvar.h

Log Message:
Whitespace nits.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/ic/ncr53c9x.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/ncr53c9xreg.h
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/ic/ncr53c9xvar.h

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

Modified files:

Index: src/sys/dev/ic/ncr53c9x.c
diff -u src/sys/dev/ic/ncr53c9x.c:1.140 src/sys/dev/ic/ncr53c9x.c:1.141
--- src/sys/dev/ic/ncr53c9x.c:1.140	Wed Sep  2 10:34:04 2009
+++ src/sys/dev/ic/ncr53c9x.c	Mon Sep  7 13:31:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr53c9x.c,v 1.140 2009/09/02 10:34:04 tsutsui Exp $	*/
+/*	$NetBSD: ncr53c9x.c,v 1.141 2009/09/07 13:31:44 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ncr53c9x.c,v 1.140 2009/09/02 10:34:04 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ncr53c9x.c,v 1.141 2009/09/07 13:31:44 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -139,9 +139,9 @@
 
 
 #define NCR_SET_COUNT(sc, size) do { \
-		NCR_WRITE_REG((sc), NCR_TCL, (size)); 			\
+		NCR_WRITE_REG((sc), NCR_TCL, (size));			\
 		NCR_WRITE_REG((sc), NCR_TCM, (size)  8);		\
-		if ((sc-sc_cfg2  NCRCFG2_FE) || 			\
+		if ((sc-sc_cfg2  NCRCFG2_FE) ||			\
 		(sc-sc_rev == NCR_VARIANT_FAS366)) {		\
 			NCR_WRITE_REG((sc), NCR_TCH, (size)  16);	\
 		}			\
@@ -1400,7 +1400,7 @@
 
 #if 0
 #ifdef NCR53C9X_DEBUG
- 	{
+	{
 		int j;
 
 		NCR_TRACE((\n[rdfifo %s (%d):,
@@ -2385,7 +2385,7 @@
 		ecb = sc-sc_nexus;
 		if (sc-sc_phase != MESSAGE_IN_PHASE) {
 			int i = (NCR_READ_REG(sc, NCR_FFLAG)  NCRFIFO_FF);
- 			/*
+			/*
 			 * Things are seriously screwed up.
 			 * Pull the brakes, i.e. reset
 			 */

Index: src/sys/dev/ic/ncr53c9xreg.h
diff -u src/sys/dev/ic/ncr53c9xreg.h:1.15 src/sys/dev/ic/ncr53c9xreg.h:1.16
--- src/sys/dev/ic/ncr53c9xreg.h:1.15	Sun Dec 11 12:21:28 2005
+++ src/sys/dev/ic/ncr53c9xreg.h	Mon Sep  7 13:31:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr53c9xreg.h,v 1.15 2005/12/11 12:21:28 christos Exp $	*/
+/*	$NetBSD: ncr53c9xreg.h,v 1.16 2009/09/07 13:31:44 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1994 Peter Galbavy.  All rights reserved.
@@ -62,12 +62,12 @@
 #define  NCRCMD_TCCS	0x25		/*	Target Command Comp Seq	*/
 #define  NCRCMD_DISC	0x27		/*	Disconnect		*/
 #define  NCRCMD_RECMSG	0x28		/*	Receive Message		*/
-#define  NCRCMD_RECCMD	0x29		/*	Receive Command 	*/
+#define  NCRCMD_RECCMD	0x29		/*	Receive Command		*/
 #define  NCRCMD_RECDATA	0x2a		/*	Receive Data		*/
 #define  NCRCMD_RECCSEQ	0x2b		/*	Receive Command Sequence*/
 #define  NCRCMD_ABORT	0x04		/*	Target Abort DMA	*/
 #define  NCRCMD_TRANS	0x10		/*	Transfer Information	*/
-#define  NCRCMD_ICCS	0x11		/*	Initiator Cmd Comp Seq 	*/
+#define  NCRCMD_ICCS	0x11		/*	Initiator Cmd Comp Seq	*/
 #define  NCRCMD_MSGOK	0x12		/*	Message Accepted	*/
 #define  NCRCMD_TRPAD	0x18		/*	Transfer Pad		*/
 #define  NCRCMD_SETATN	0x1a		/*	Set ATN			*/
@@ -82,7 +82,7 @@
 #define  NCRSTAT_PHASE	0x07		/*	Phase bits		*/
 
 #define	NCR_SELID	0x04		/* WO - Select/Reselect Bus ID	*/
-#define  NCR_BUSID_HME		0x10 	/* XXX HME reselect ID 		*/
+#define  NCR_BUSID_HME		0x10	/* XXX HME reselect ID		*/
 #define  NCR_BUSID_HME32	0x40	/* XXX HME to select more than 16 */
 
 #define	NCR_INTR	0x05		/* RO - Interrupt		*/
@@ -134,12 +134,12 @@
 
 #define	NCR_CFG2	0x0b		/* RW - Configuration #2	*/
 #define	 NCRCFG2_RSVD	0xa0		/*	reserved		*/
-#define  NCRCFG2_FE	0x40		/* 	Features Enable		*/
-#define  NCRCFG2_DREQ	0x10		/* 	DREQ High Impedance	*/
-#define  NCRCFG2_SCSI2	0x08		/* 	SCSI-2 Enable		*/
-#define  NCRCFG2_BPA	0x04		/* 	Target Bad Parity Abort	*/
-#define  NCRCFG2_RPE	0x02		/* 	Register Parity Error	*/
-#define  NCRCFG2_DPE	0x01		/* 	DMA Parity Error	*/
+#define  NCRCFG2_FE	0x40		/*	Features Enable		*/
+#define  NCRCFG2_DREQ	0x10		/*	DREQ High Impedance	*/
+#define  NCRCFG2_SCSI2	0x08		/*	SCSI-2 Enable		*/
+#define  NCRCFG2_BPA	0x04		/*	Target Bad Parity Abort	*/
+#define  NCRCFG2_RPE	0x02		/*	Register Parity Error	*/
+#define  NCRCFG2_DPE	0x01		/*	DMA Parity Error	*/
 
 #define  NCRCFG2_HMEFE	0x10		/*	HME feature enable	*/
 #define	 NCRCFG2_HME32  0x80		/*	HME 32 extended		*/
@@ -183,14 +183,14 @@
 #define  NCRF9XCFG3_T8M		0x01	/*	Threshold 8 Mode	*/
 
 /* Config #3 on FAS366 */
-#define  NCRFASCFG3_OBAUTO	0x80/*	auto push odd-byte to DMA */
-#define  NCRFASCFG3_EWIDE 	0x40/* 	Enable Wide-SCSI */
-#define  NCRFASCFG3_IDBIT3	0x20	/* 	Bit 3 of HME SCSI-ID */
-#define	 NCRFASCFG3_IDRESCHK	0x10	/* 	ID message checking */
-#define	 NCRFASCFG3_QUENB	0x08	/* 	3-byte msg support */
-#define	 NCRFASCFG3_CDB10	0x04	/* 	group 2 scsi-2 support */
-#define	 NCRFASCFG3_FASTSCSI	0x02	/* 	10 MB/S fast scsi mode */
-#define	 

CVS commit: src/sys/dev

2009-09-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Sep  7 13:39:20 UTC 2009

Modified Files:
src/sys/dev/ic: isp_netbsd.c isp_netbsd.h
src/sys/dev/pci: isp_pci.c
src/sys/dev/sbus: isp_sbus.c

Log Message:
Split device_t/softc.
Tested QLogic 1020 Fast Wide SCSI HBA at PCI.
Sbus attachment is untested, but not so much quirks in it.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/isp_netbsd.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/isp_netbsd.h
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/isp_pci.c
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/sbus/isp_sbus.c

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

Modified files:

Index: src/sys/dev/ic/isp_netbsd.c
diff -u src/sys/dev/ic/isp_netbsd.c:1.80 src/sys/dev/ic/isp_netbsd.c:1.81
--- src/sys/dev/ic/isp_netbsd.c:1.80	Thu Jun 25 23:44:02 2009
+++ src/sys/dev/ic/isp_netbsd.c	Mon Sep  7 13:39:19 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.80 2009/06/25 23:44:02 mjacob Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.81 2009/09/07 13:39:19 tsutsui Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  */
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: isp_netbsd.c,v 1.80 2009/06/25 23:44:02 mjacob Exp $);
+__KERNEL_RCSID(0, $NetBSD: isp_netbsd.c,v 1.81 2009/09/07 13:39:19 tsutsui Exp $);
 
 #include dev/ic/isp_netbsd.h
 #include dev/ic/isp_ioctl.h
@@ -92,10 +92,12 @@
 void
 isp_attach(struct ispsoftc *isp)
 {
+	device_t self = isp-isp_osinfo.dev;
 	int i;
+
 	isp-isp_state = ISP_RUNSTATE;
 
-	isp-isp_osinfo.adapter.adapt_dev = isp-isp_osinfo.dev;
+	isp-isp_osinfo.adapter.adapt_dev = self;
 	isp-isp_osinfo.adapter.adapt_openings = isp-isp_maxcmds;
 	isp-isp_osinfo.loop_down_limit = 300;
 
@@ -118,7 +120,8 @@
 	callout_setfunc(isp-isp_osinfo.ldt, isp_ldt, isp);
 	if (IS_FC(isp)) {
 		if (kthread_create(PRI_NONE, 0, NULL, isp_fc_worker, isp,
-		isp-isp_osinfo.thread, %s:fc_thrd, device_xname(isp-isp_osinfo.dev))) {
+		isp-isp_osinfo.thread, %s:fc_thrd,
+		device_xname(self))) {
 			isp_prt(isp, ISP_LOGERR,
 			unable to create FC worker thread);
 			return;
@@ -154,14 +157,14 @@
 	/*
  * Defer enabling mailbox interrupts until later.
  */
-config_interrupts((device_t) isp, isp_config_interrupts);
+config_interrupts(self, isp_config_interrupts);
 }
 
 static void
 isp_config_interrupts(device_t self)
 {
 	int i;
-struct ispsoftc *isp = (struct ispsoftc *) self;
+struct ispsoftc *isp = device_private(self);
 
 isp-isp_osinfo.mbox_sleep_ok = 1;
 
@@ -176,7 +179,7 @@
 	 * And attach children (if any).
 	 */
 	for (i = 0; i  isp-isp_osinfo.adapter.adapt_nchannels; i++) {
-		config_found((void *)isp, isp-isp_osinfo.chan[i], scsiprint);
+		config_found(self, isp-isp_osinfo.chan[i], scsiprint);
 	}
 }
 
@@ -205,7 +208,7 @@
 ispioctl(struct scsipi_channel *chan, u_long cmd, void *addr, int flag,
 	struct proc *p)
 {
-	struct ispsoftc *isp = (void *)chan-chan_adapter-adapt_dev;
+	struct ispsoftc *isp = device_private(chan-chan_adapter-adapt_dev);
 	int nr, bus, retval = ENOTTY;
 
 	switch (cmd) {
@@ -681,7 +684,7 @@
 static void
 isprequest(struct scsipi_channel *chan, scsipi_adapter_req_t req, void *arg)
 {
-	struct ispsoftc *isp = (void *)chan-chan_adapter-adapt_dev;
+	struct ispsoftc *isp = device_private(chan-chan_adapter-adapt_dev);
 
 	switch (req) {
 	case ADAPTER_REQ_RUN_XFER:
@@ -1503,7 +1506,7 @@
 	if (level != ISP_LOGALL  (level  isp-isp_dblev) == 0) {
 		return;
 	}
-	printf(%s: , device_xname(isp-isp_osinfo.dev));
+	printf(%s: , device_xname(isp-isp_osinfo.dev));
 	va_start(ap, fmt);
 	vprintf(fmt, ap);
 	va_end(ap);

Index: src/sys/dev/ic/isp_netbsd.h
diff -u src/sys/dev/ic/isp_netbsd.h:1.67 src/sys/dev/ic/isp_netbsd.h:1.68
--- src/sys/dev/ic/isp_netbsd.h:1.67	Thu Jun 25 23:44:02 2009
+++ src/sys/dev/ic/isp_netbsd.h	Mon Sep  7 13:39:19 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.h,v 1.67 2009/06/25 23:44:02 mjacob Exp $ */
+/* $NetBSD: isp_netbsd.h,v 1.68 2009/09/07 13:39:19 tsutsui Exp $ */
 /*
  * NetBSD Specific definitions for the Qlogic ISP Host Adapter
  */
@@ -73,7 +73,7 @@
 #define	ISP_PLATFORM_VERSION_MINOR	0
 
 struct isposinfo {
-	struct device		dev;
+	device_t		dev;
 	struct scsipi_adapter   adapter;
 	struct scsipi_channel * chan;
 	bus_dma_tag_t		dmatag;
@@ -219,7 +219,7 @@
 #define	XS_CHANNEL(xs)		\
 	((int) (xs)-xs_periph-periph_channel-chan_channel)
 #define	XS_ISP(xs)		\
-	((void *)(xs)-xs_periph-periph_channel-chan_adapter-adapt_dev)
+	device_private((xs)-xs_periph-periph_channel-chan_adapter-adapt_dev)
 #define	XS_LUN(xs)		((int) (xs)-xs_periph-periph_lun)
 #define	XS_TGT(xs)		((int) (xs)-xs_periph-periph_target)
 #define	XS_CDBP(xs)		((uint8_t *) (xs)-cmd)
@@ -343,7 +343,7 @@
 /*
  * isp_osinfo definitions, extensions and shorthand.
  */
-#define	isp_unit	isp_osinfo.dev.dv_unit

CVS commit: src/dist/smbfs/mount_smbfs

2009-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  7 13:52:06 UTC 2009

Modified Files:
src/dist/smbfs/mount_smbfs: mount_smbfs.c

Log Message:
Fill canon_dev so that mntfromname gets properly set for p2k mounts.
Fixes problem pointed out by Nicolas Joly.

XXX: would probably be better to forget canon_dev from the parseargs
interface completely and do rump_sys_statvfs() in p2k after mounting
the fail system in the virtual kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/dist/smbfs/mount_smbfs/mount_smbfs.c

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

Modified files:

Index: src/dist/smbfs/mount_smbfs/mount_smbfs.c
diff -u src/dist/smbfs/mount_smbfs/mount_smbfs.c:1.10 src/dist/smbfs/mount_smbfs/mount_smbfs.c:1.11
--- src/dist/smbfs/mount_smbfs/mount_smbfs.c:1.10	Fri Sep  4 18:22:37 2009
+++ src/dist/smbfs/mount_smbfs/mount_smbfs.c	Mon Sep  7 13:52:05 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mount_smbfs.c,v 1.10 2009/09/04 18:22:37 pooka Exp $ */
+/* $NetBSD: mount_smbfs.c,v 1.11 2009/09/07 13:52:05 pooka Exp $ */
 
 /*
  * Copyright (c) 2000-2002, Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: mount_smbfs.c,v 1.10 2009/09/04 18:22:37 pooka Exp $);
+__RCSID($NetBSD: mount_smbfs.c,v 1.11 2009/09/07 13:52:05 pooka Exp $);
 
 #include sys/param.h
 #include sys/stat.h
@@ -252,6 +252,10 @@
 	mdatap-version = SMBFS_VERSION;
 	mdatap-dev_fd = ctx-ct_fd;
 	mdatap-caseopt = caseopt;
+
+	snprintf(canon_dev, MAXPATHLEN, //%...@%s/%s,
+	ctx-ct_ssn.ioc_user[0] ? ctx-ct_ssn.ioc_user : guest,
+	ctx-ct_ssn.ioc_srvname, ctx-ct_sh.ioc_share);
 }
 
 int



CVS commit: src/sys/dev/dkwedge

2009-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  7 13:59:38 UTC 2009

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

Log Message:
grow some _KERNEL_POT


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/dkwedge/dk.c

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

Modified files:

Index: src/sys/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.49 src/sys/dev/dkwedge/dk.c:1.50
--- src/sys/dev/dkwedge/dk.c:1.49	Sun Sep  6 16:18:55 2009
+++ src/sys/dev/dkwedge/dk.c	Mon Sep  7 13:59:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.49 2009/09/06 16:18:55 pooka Exp $	*/
+/*	$NetBSD: dk.c,v 1.50 2009/09/07 13:59:38 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,9 +30,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.49 2009/09/06 16:18:55 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: dk.c,v 1.50 2009/09/07 13:59:38 pooka Exp $);
 
+#ifdef _KERNEL_OPT
 #include opt_dkwedge.h
+#endif
 
 #include sys/param.h
 #include sys/systm.h



CVS commit: src/sys/rump/dev/lib/libraidframe

2009-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  7 14:28:18 UTC 2009

Modified Files:
src/sys/rump/dev/lib/libraidframe: Makefile component.c

Log Message:
one more ketchup with rump_dev_makenodes - rump_vfs_makedevnodes


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/lib/libraidframe/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libraidframe/component.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/dev/lib/libraidframe/Makefile
diff -u src/sys/rump/dev/lib/libraidframe/Makefile:1.1 src/sys/rump/dev/lib/libraidframe/Makefile:1.2
--- src/sys/rump/dev/lib/libraidframe/Makefile:1.1	Tue Jun  9 16:16:15 2009
+++ src/sys/rump/dev/lib/libraidframe/Makefile	Mon Sep  7 14:28:18 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2009/06/09 16:16:15 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2009/09/07 14:28:18 pooka Exp $
 #
 
 .PATH:	${.CURDIR}/../../../../dev/raidframe
@@ -23,5 +23,7 @@
 
 SRCS+=	component.c
 
+CPPFLAGS+=	-I${RUMPTOP}/librump/rumpvfs
+
 .include bsd.lib.mk
 .include bsd.klinks.mk

Index: src/sys/rump/dev/lib/libraidframe/component.c
diff -u src/sys/rump/dev/lib/libraidframe/component.c:1.2 src/sys/rump/dev/lib/libraidframe/component.c:1.3
--- src/sys/rump/dev/lib/libraidframe/component.c:1.2	Mon Jul 20 18:11:37 2009
+++ src/sys/rump/dev/lib/libraidframe/component.c	Mon Sep  7 14:28:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: component.c,v 1.2 2009/07/20 18:11:37 pooka Exp $	*/
+/*	$NetBSD: component.c,v 1.3 2009/09/07 14:28:18 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: component.c,v 1.2 2009/07/20 18:11:37 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: component.c,v 1.3 2009/09/07 14:28:18 pooka Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -34,6 +34,7 @@
 #include sys/stat.h
 
 #include rump_dev_private.h
+#include rump_vfs_private.h
 
 CFDRIVER_DECL(raid, DV_DISK, NULL);
 
@@ -54,10 +55,10 @@
 	raid_cdevsw, cmaj)) != 0)
 		panic(raid devsw attach failed: %d, error);
 
-	if ((error = rump_dev_makenodes(S_IFBLK, raid0, 'a',
+	if ((error = rump_vfs_makedevnodes(S_IFBLK, raid0, 'a',
 	bmaj, 0, 7)) != 0)
 		panic(cannot create cooked raid dev nodes: %d, error);
-	if ((error = rump_dev_makenodes(S_IFCHR, rraid0, 'a',
+	if ((error = rump_vfs_makedevnodes(S_IFCHR, rraid0, 'a',
 	cmaj, 0, 7)) != 0)
 		panic(cannot create raw raid dev nodes: %d, error);
 



CVS commit: src/sys/fs/smbfs

2009-09-07 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Mon Sep  7 15:12:03 UTC 2009

Modified Files:
src/sys/fs/smbfs: smbfs_vfsops.c

Log Message:
Fix set_statvfs_info() to use UIO_SYSSPACE for fromname kernel
allocated buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/fs/smbfs/smbfs_vfsops.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/fs/smbfs/smbfs_vfsops.c
diff -u src/sys/fs/smbfs/smbfs_vfsops.c:1.89 src/sys/fs/smbfs/smbfs_vfsops.c:1.90
--- src/sys/fs/smbfs/smbfs_vfsops.c:1.89	Mon Sep  7 12:52:53 2009
+++ src/sys/fs/smbfs/smbfs_vfsops.c	Mon Sep  7 15:12:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_vfsops.c,v 1.89 2009/09/07 12:52:53 pooka Exp $	*/
+/*	$NetBSD: smbfs_vfsops.c,v 1.90 2009/09/07 15:12:03 njoly Exp $	*/
 
 /*
  * Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smbfs_vfsops.c,v 1.89 2009/09/07 12:52:53 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: smbfs_vfsops.c,v 1.90 2009/09/07 15:12:03 njoly Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -196,7 +196,7 @@
 	fromname = kmem_zalloc(MNAMELEN, KM_SLEEP);
 	snprintf(fromname, MNAMELEN,
 	//%...@%s/%s, vcp-vc_username, vcp-vc_srvname, ssp-ss_name);
-	error = set_statvfs_info(path, UIO_USERSPACE, fromname, UIO_USERSPACE,
+	error = set_statvfs_info(path, UIO_USERSPACE, fromname, UIO_SYSSPACE,
 	mp-mnt_op-vfs_name, mp, l);
 	kmem_free(fromname, MNAMELEN);
 	if (error) {



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

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 16:21:08 UTC 2009

Modified Files:
src/sys/dev/pci/hdaudio: hdaudio.c hdaudio_afg.c hdaudiovar.h

Log Message:
Add support for formats other than 16bit/48kHz.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdaudio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudio_afg.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudiovar.h

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

Modified files:

Index: src/sys/dev/pci/hdaudio/hdaudio.c
diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.2 src/sys/dev/pci/hdaudio/hdaudio.c:1.3
--- src/sys/dev/pci/hdaudio/hdaudio.c:1.2	Sun Sep  6 17:33:53 2009
+++ src/sys/dev/pci/hdaudio/hdaudio.c	Mon Sep  7 16:21:08 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $ */
+/* $NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.2 2009/09/06 17:33:53 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -948,6 +948,77 @@
 	mutex_exit(sc-sc_stream_mtx);
 }
 
+/*
+ * Convert most of audio_params_t to stream fmt descriptor; noticably missing
+ * is the # channels bits, as this is encoded differently in codec and
+ * stream descriptors.
+ *
+ * TODO: validate that the stream and selected codecs can handle the fmt
+ */
+uint16_t
+hdaudio_stream_param(struct hdaudio_stream *st, const audio_params_t *param)
+{
+	uint16_t fmt = 0;
+
+	switch (param-sample_rate) {
+	case 8000:
+		fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1) |
+		HDAUDIO_FMT_DIV(6);
+		break;
+	case 11025:
+		fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(1) |
+		HDAUDIO_FMT_DIV(4);
+		break;
+	case 16000:
+		fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1) |
+		HDAUDIO_FMT_DIV(3);
+		break;
+	case 22050:
+		fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(1) |
+		HDAUDIO_FMT_DIV(2);
+		break;
+	case 32000:
+		fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(2) |
+		HDAUDIO_FMT_DIV(3);
+		break;
+	case 44100:
+		fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(1);
+		break;
+	case 48000:
+		fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1);
+		break;
+	case 88200:
+		fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(2);
+		break;
+	case 96000:
+		fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(2);
+		break;
+	case 176400:
+		fmt |= HDAUDIO_FMT_BASE_44 | HDAUDIO_FMT_MULT(4);
+		break;
+	case 192000:
+		fmt |= HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(4);
+		break;
+	default:
+		return 0;
+	}
+
+	if (param-precision == 16  param-validbits == 8)
+		fmt |= HDAUDIO_FMT_BITS_8_16;
+	else if (param-precision == 16  param-validbits == 16)
+		fmt |= HDAUDIO_FMT_BITS_16_16;
+	else if (param-precision == 32  param-validbits == 20)
+		fmt |= HDAUDIO_FMT_BITS_20_32;
+	else if (param-precision == 32  param-validbits == 24)
+		fmt |= HDAUDIO_FMT_BITS_24_32;
+	else if (param-precision == 32  param-validbits == 32)
+		fmt |= HDAUDIO_FMT_BITS_32_32;
+	else
+		return 0;
+
+	return fmt;
+}
+
 void
 hdaudio_stream_reset(struct hdaudio_stream *st)
 {
@@ -996,6 +1067,7 @@
 	struct hdaudio_bdl_entry *bdl;
 	uint64_t dmaaddr;
 	uint32_t intctl;
+	uint16_t fmt;
 	uint8_t ctl0, ctl2;
 	int cnt, snum = st-st_shift;
 
@@ -1050,15 +1122,10 @@
 
 	/*
 	 * Program stream format
-	 *
-	 * XXX 48kHz, 16-bit, stereo for now
 	 */
-	hda_write2(sc, HDAUDIO_SD_FMT(snum),
-	HDAUDIO_FMT_BASE_48 | HDAUDIO_FMT_MULT(1) |
-	HDAUDIO_FMT_DIV(1) | HDAUDIO_FMT_BITS_16_16 |
-	HDAUDIO_FMT_CHAN(params-channels));
-
-	/* XXX program codecs for stream number */
+	fmt = hdaudio_stream_param(st, params) |
+	HDAUDIO_FMT_CHAN(params-channels);
+	hda_write2(sc, HDAUDIO_SD_FMT(snum), fmt);
 
 	/*
 	 * Switch on interrupts for this stream

Index: src/sys/dev/pci/hdaudio/hdaudio_afg.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.5 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.6
--- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.5	Mon Sep  7 11:59:53 2009
+++ src/sys/dev/pci/hdaudio/hdaudio_afg.c	Mon Sep  7 16:21:08 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.5 2009/09/07 11:59:53 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -151,7 +151,7 @@
 	Other
 };
 
-#define	HDAUDIO_MAXFORMATS	10
+#define	HDAUDIO_MAXFORMATS	24
 #define	HDAUDIO_MAXCONNECTIONS	32
 #define	HDAUDIO_MAXPINS		16
 #define	

CVS commit: src/share/man/man4

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 16:22:46 UTC 2009

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

Log Message:
- adjust description (Generic is redundant)
- rates != 48kHz are now supported
- bump date


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/hdaudio.4

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

Modified files:

Index: src/share/man/man4/hdaudio.4
diff -u src/share/man/man4/hdaudio.4:1.2 src/share/man/man4/hdaudio.4:1.3
--- src/share/man/man4/hdaudio.4:1.2	Sun Sep  6 17:59:09 2009
+++ src/share/man/man4/hdaudio.4	Mon Sep  7 16:22:46 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: hdaudio.4,v 1.2 2009/09/06 17:59:09 wiz Exp $
+.\	$NetBSD: hdaudio.4,v 1.3 2009/09/07 16:22:46 jmcneill Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,12 +27,12 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 25, 2009
+.Dd September 7, 2009
 .Dt HDAUDIO 4
 .Os
 .Sh NAME
 .Nm hdaudio
-.Nd Generic High Definition Audio device driver
+.Nd High Definition Audio device driver
 .Sh SYNOPSIS
 .Cd hdaudio* at pci? dev ? function ?
 .Cd hdafg* at hdaudiobus?
@@ -113,8 +113,6 @@
 The following items are not yet implemented:
 .Bl -bullet
 .It
-Support sample rates in hardware other than 48kHz
-.It
 Improve power management support when driver is idle
 .It
 Add support for non-PCM output formats



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

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 16:35:02 UTC 2009

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

Log Message:
Avoid setting up bus_dma w/ BUS_DMA_WAITOK while sc_stream_mtx is held.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/hdaudio/hdaudio.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/hdaudio/hdaudio.c
diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.3 src/sys/dev/pci/hdaudio/hdaudio.c:1.4
--- src/sys/dev/pci/hdaudio/hdaudio.c:1.3	Mon Sep  7 16:21:08 2009
+++ src/sys/dev/pci/hdaudio/hdaudio.c	Mon Sep  7 16:35:02 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $ */
+/* $NetBSD: hdaudio.c,v 1.4 2009/09/07 16:35:02 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.3 2009/09/07 16:21:08 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.4 2009/09/07 16:35:02 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -901,8 +901,14 @@
 void *cookie)
 {
 	struct hdaudio_stream *st;
+	struct hdaudio_dma dma;
 	int i, err;
 
+	dma.dma_size = sizeof(struct hdaudio_bdl_entry) * HDAUDIO_BDL_MAX;
+	err = hdaudio_dma_alloc(sc, dma, BUS_DMA_COHERENT | BUS_DMA_NOCACHE);
+	if (err)
+		return NULL;
+
 	mutex_enter(sc-sc_stream_mtx);
 	for (i = 0; i  HDAUDIO_MAX_STREAMS; i++) {
 		st = sc-sc_stream[i];
@@ -914,22 +920,17 @@
 			continue;
 
 		/* Allocate stream */
-		st-st_bdl.dma_size = sizeof(struct hdaudio_bdl_entry) *
-		HDAUDIO_BDL_MAX;
-		err = hdaudio_dma_alloc(sc, st-st_bdl,
-		BUS_DMA_COHERENT | BUS_DMA_NOCACHE);
-		if (!err) {
-			st-st_intr = intr;
-			st-st_cookie = cookie;
-			sc-sc_stream_mask |= (1  i);
-		} else
-			st = NULL;
+		st-st_bdl = dma;
+		st-st_intr = intr;
+		st-st_cookie = cookie;
+		sc-sc_stream_mask |= (1  i);
 		mutex_exit(sc-sc_stream_mtx);
 		return st;
 	}
 	mutex_exit(sc-sc_stream_mtx);
 
 	/* No streams of requested type available */
+	hdaudio_dma_free(sc, dma);
 	return NULL;
 }
 



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

2009-09-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  7 16:41:37 UTC 2009

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

Log Message:
Properly initialize struct audio_format when applying the 0ch workaround.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/hdaudio/hdaudio_afg.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/hdaudio/hdaudio_afg.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.6 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.7
--- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.6	Mon Sep  7 16:21:08 2009
+++ src/sys/dev/pci/hdaudio/hdaudio_afg.c	Mon Sep  7 16:41:37 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.7 2009/09/07 16:41:37 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.6 2009/09/07 16:21:08 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio_afg.c,v 1.7 2009/09/07 16:41:37 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -2908,8 +2908,16 @@
 	 * the direction.
 	 */
 	if (sc-sc_rchan == 0 || sc-sc_pchan == 0) {
+		memset(f, 0, sizeof(f));
+		f.driver_data = NULL;
+		f.mode = 0;
+		f.encoding = AUDIO_ENCODING_SLINEAR_LE;
+		f.validbits = 16;
+		f.precision = 16;
 		f.channels = 2;
 		f.channel_mask = AUFMT_STEREO;
+		f.frequency_type = 0;
+		f.frequency[0] = f.frequency[1] = 48000;
 		f.mode = AUMODE_PLAY|AUMODE_RECORD;
 		hdaudio_afg_append_formats(sc-sc_audiodev, f);
 	}



CVS commit: src/usr.bin/make

2009-09-07 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Mon Sep  7 17:56:24 UTC 2009

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: modmatch test.exp

Log Message:
PR: 41998

:Ufu\:goo

should expand to fu:goo even when it appears in :M${:Ufu\:goo}
When scanning for :M do not compress \: if we know we have
to call Var_Subst.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/modmatch
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/test.exp

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/make/var.c
diff -u src/usr.bin/make/var.c:1.152 src/usr.bin/make/var.c:1.153
--- src/usr.bin/make/var.c:1.152	Tue Jun 16 05:44:06 2009
+++ src/usr.bin/make/var.c	Mon Sep  7 17:56:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.152 2009/06/16 05:44:06 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.153 2009/09/07 17:56:24 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = $NetBSD: var.c,v 1.152 2009/06/16 05:44:06 sjg Exp $;
+static char rcsid[] = $NetBSD: var.c,v 1.153 2009/09/07 17:56:24 sjg Exp $;
 #else
 #include sys/cdefs.h
 #ifndef lint
 #if 0
 static char sccsid[] = @(#)var.c	8.3 (Berkeley) 3/19/94;
 #else
-__RCSID($NetBSD: var.c,v 1.152 2009/06/16 05:44:06 sjg Exp $);
+__RCSID($NetBSD: var.c,v 1.153 2009/09/07 17:56:24 sjg Exp $);
 #endif
 #endif /* not lint */
 #endif
@@ -2763,9 +2763,11 @@
 		const char *endpat; /* points just after end of pattern */
 		char*cp2;
 		Boolean copy;	/* pattern should be, or has been, copied */
+		Boolean needSubst;
 		int nest;
 
 		copy = FALSE;
+		needSubst = FALSE;
 		nest = 1;
 		/*
 		 * In the loop below, ignore ':' unless we are at
@@ -2780,10 +2782,15 @@
 			if (*cp == '\\' 
 			(cp[1] == ':' ||
 			 cp[1] == endc || cp[1] == startc)) {
-			copy = TRUE;
+			if (!needSubst) {
+copy = TRUE;
+			}
 			cp++;
 			continue;
 			}
+			if (*cp == '$') {
+			needSubst = TRUE;
+			}
 			if (*cp == '(' || *cp == '{')
 			++nest;
 			if (*cp == ')' || *cp == '}') {
@@ -2822,7 +2829,7 @@
 		 */
 		pattern = bmake_strndup(tstr+1, endpat - (tstr + 1));
 		}
-		if (strchr(pattern, '$') != NULL) {
+		if (needSubst) {
 		/*
 		 * pattern contains embedded '$', so use Var_Subst to
 		 * expand it.

Index: src/usr.bin/make/unit-tests/modmatch
diff -u src/usr.bin/make/unit-tests/modmatch:1.1 src/usr.bin/make/unit-tests/modmatch:1.2
--- src/usr.bin/make/unit-tests/modmatch:1.1	Fri Feb 20 09:03:26 2004
+++ src/usr.bin/make/unit-tests/modmatch	Mon Sep  7 17:56:23 2009
@@ -9,8 +9,15 @@
 
 LIB?=a
 
+var = head
+res = no
+.if !empty(var:M${:Uhead\:tail:C/:.*//})
+res = OK
+.endif
+
 all:
 	@for x in $X; do ${.MAKE} -f ${MAKEFILE} show LIB=$$x; done
+	@echo Mscanner=${res}
 
 show:
 	@echo 'LIB=${LIB} X_LIBS:M$${LIB$${LIB:tu}} is ${X_LIBS:M${LIB${LIB:tu}}}'

Index: src/usr.bin/make/unit-tests/test.exp
diff -u src/usr.bin/make/unit-tests/test.exp:1.27 src/usr.bin/make/unit-tests/test.exp:1.28
--- src/usr.bin/make/unit-tests/test.exp:1.27	Tue Feb  3 23:11:12 2009
+++ src/usr.bin/make/unit-tests/test.exp	Mon Sep  7 17:56:23 2009
@@ -97,6 +97,7 @@
 LIB=e X_LIBS:M${LIB${LIB:tu}} is /tmp/libe.a
 LIB=e X_LIBS:M*/lib${LIB}.a is /tmp/libe.a
 LIB=e X_LIBS:M*/lib${LIB}.a:tu is /TMP/LIBE.A
+Mscanner=OK
 path=':/bin:/usr/bin::/sbin:/usr/sbin:.:/home/user/bin:.'
 path='/bin:/usr/bin:/sbin:/usr/sbin:/home/user/bin'
 path='/bin:/usr/bin:/sbin:/usr/sbin:/homes/user/bin'



CVS commit: src/usr.bin/ldd

2009-09-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Sep  7 17:56:52 UTC 2009

Modified Files:
src/usr.bin/ldd: ldd.1 ldd.c

Log Message:
Add an -o option that behaves like nm -o. Implementation from a suggestion
by jmcneill (thanks!); ok mrg. Closes PR 41994.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/ldd/ldd.1
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/ldd/ldd.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/ldd/ldd.1
diff -u src/usr.bin/ldd/ldd.1:1.16 src/usr.bin/ldd/ldd.1:1.17
--- src/usr.bin/ldd/ldd.1:1.16	Sun Aug 23 15:37:39 2009
+++ src/usr.bin/ldd/ldd.1	Mon Sep  7 17:56:52 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: ldd.1,v 1.16 2009/08/23 15:37:39 wiz Exp $
+.\	$NetBSD: ldd.1,v 1.17 2009/09/07 17:56:52 dholland Exp $
 .\
 .\ Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 23, 2009
+.Dd September 7, 2009
 .Dt LDD 1
 .Os
 .Sh NAME
@@ -35,6 +35,7 @@
 .Nd list dynamic object dependencies
 .Sh SYNOPSIS
 .Nm
+.Op Fl o
 .Op Fl f Ar format
 .Ar program ...
 .Sh DESCRIPTION
@@ -93,6 +94,16 @@
 and
 .Sy \et
 are recognized and have their usual meaning.
+.Pp
+The
+.Fl o
+option is an alias for
+.Fl f
+.Ar \%a:-l\%o.\%m =\*[Gt] \%p\en ,
+which makes
+.Nm
+behave analogously to
+.Ic nm Fl o .
 .Sh SEE ALSO
 .Xr ld 1 ,
 .Xr ld.elf_so 1 ,

Index: src/usr.bin/ldd/ldd.c
diff -u src/usr.bin/ldd/ldd.c:1.9 src/usr.bin/ldd/ldd.c:1.10
--- src/usr.bin/ldd/ldd.c:1.9	Sat Aug 22 06:52:16 2009
+++ src/usr.bin/ldd/ldd.c	Mon Sep  7 17:56:52 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldd.c,v 1.9 2009/08/22 06:52:16 mrg Exp $	*/
+/*	$NetBSD: ldd.c,v 1.10 2009/09/07 17:56:52 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: ldd.c,v 1.9 2009/08/22 06:52:16 mrg Exp $);
+__RCSID($NetBSD: ldd.c,v 1.10 2009/09/07 17:56:52 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -114,13 +114,13 @@
 int
 main(int argc, char **argv)
 {
-	char *fmt1 = NULL, *fmt2 = NULL;
+	const char *fmt1 = NULL, *fmt2 = NULL;
 	int c;
 
 #ifdef DEBUG
 	debug = 1;
 #endif
-	while ((c = getopt(argc, argv, f:)) != -1) {
+	while ((c = getopt(argc, argv, f:o)) != -1) {
 		switch (c) {
 		case 'f':
 			if (fmt1) {
@@ -130,6 +130,11 @@
 			} else
 fmt1 = optarg;
 			break;
+		case 'o':
+			if (fmt1 || fmt2)
+errx(1, Cannot use -o and -f together);
+			fmt1 = %a:-l%o.%m = %p\n;
+			break;
 		default:
 			usage();
 			/*NOTREACHED*/



CVS commit: src/usr.bin/ldd

2009-09-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Sep  7 20:06:21 UTC 2009

Modified Files:
src/usr.bin/ldd: ldd.1

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/ldd/ldd.1

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/ldd/ldd.1
diff -u src/usr.bin/ldd/ldd.1:1.17 src/usr.bin/ldd/ldd.1:1.18
--- src/usr.bin/ldd/ldd.1:1.17	Mon Sep  7 17:56:52 2009
+++ src/usr.bin/ldd/ldd.1	Mon Sep  7 20:06:21 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: ldd.1,v 1.17 2009/09/07 17:56:52 dholland Exp $
+.\	$NetBSD: ldd.1,v 1.18 2009/09/07 20:06:21 wiz Exp $
 .\
 .\ Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -49,7 +49,8 @@
 depend on yet other shared objects.
 Zero, one or two
 .Fl f
-options may be given. The argument is a format string passed to
+options may be given.
+The argument is a format string passed to
 .Xr rtld 1
 and allows customization of
 .Nm ldd Ns 's



CVS commit: src/sys/rump/dev/lib/libdisk

2009-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  7 20:50:35 UTC 2009

Modified Files:
src/sys/rump/dev/lib/libdisk: Makefile

Log Message:
remember to build opendisk


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/lib/libdisk/Makefile

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

Modified files:

Index: src/sys/rump/dev/lib/libdisk/Makefile
diff -u src/sys/rump/dev/lib/libdisk/Makefile:1.1 src/sys/rump/dev/lib/libdisk/Makefile:1.2
--- src/sys/rump/dev/lib/libdisk/Makefile:1.1	Tue Jun  9 16:16:15 2009
+++ src/sys/rump/dev/lib/libdisk/Makefile	Mon Sep  7 20:50:35 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2009/06/09 16:16:15 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2009/09/07 20:50:35 pooka Exp $
 #
 
 .PATH:	${.CURDIR}/../../../../kern	\
@@ -7,7 +7,7 @@
 LIB=	rumpdev_disk
 
 # sys/kern
-SRCS=	kern_physio.c subr_disk.c subr_disk_mbr.c
+SRCS=	kern_physio.c subr_disk.c subr_disk_mbr.c subr_disk_open.c
 
 # sys/dev
 SRCS+=	dksubr.c dk.c



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

2009-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Sep  7 20:56:04 UTC 2009

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

Log Message:
provide pmf stubs


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/rump/librump/rumpkern/emul.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/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.93 src/sys/rump/librump/rumpkern/emul.c:1.94
--- src/sys/rump/librump/rumpkern/emul.c:1.93	Sun Sep  6 19:14:54 2009
+++ src/sys/rump/librump/rumpkern/emul.c	Mon Sep  7 20:56:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.93 2009/09/06 19:14:54 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.94 2009/09/07 20:56:04 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.93 2009/09/06 19:14:54 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.94 2009/09/07 20:56:04 pooka Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -760,6 +760,23 @@
 	return tstohz(ts);
 }
 
+bool
+pmf_device_register1(struct device *dev,
+	bool (*suspend)(device_t PMF_FN_PROTO),
+	bool (*resume)(device_t PMF_FN_PROTO),
+	bool (*shutdown)(device_t, int))
+{
+
+	return true;
+}
+
+void
+pmf_device_deregister(struct device *dev)
+{
+
+	/* nada */
+}
+
 
 /* XXX: static, but not used except to make spcopy.S link */
 #ifdef __hppa__



CVS commit: src

2009-09-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Sep  7 21:07:04 UTC 2009

Modified Files:
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/xetc: mi
src/etc/mtree: NetBSD.dist.base
src/external/mit/xorg: Makefile
src/external/mit/xorg/lib/fontconfig/etc: Makefile
src/usr.sbin/postinstall: postinstall
Added Files:
src/external/mit/xorg/lib/fontconfig/etc/conf.avail: Makefile
src/external/mit/xorg/lib/fontconfig/etc/conf.d: Makefile

Log Message:
install the fontconfig files into /etc/fonts/conf.avail, and symlink
the default ones into /etc/fonts/conf.d, as per default.

reported by jukka marin on netbsd-users.


To generate a diff of this commit:
cvs rdiff -u -r1.827 -r1.828 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/lists/xetc/mi
cvs rdiff -u -r1.1 -r1.2 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.6 -r1.7 src/external/mit/xorg/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/mit/xorg/lib/fontconfig/etc/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/mit/xorg/lib/fontconfig/etc/conf.avail/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/mit/xorg/lib/fontconfig/etc/conf.d/Makefile
cvs rdiff -u -r1.102 -r1.103 src/usr.sbin/postinstall/postinstall

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.827 src/distrib/sets/lists/base/mi:1.828
--- src/distrib/sets/lists/base/mi:1.827	Mon Sep  7 19:34:29 2009
+++ src/distrib/sets/lists/base/mi	Mon Sep  7 21:07:02 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.827 2009/09/07 19:34:29 mrg Exp $
+# $NetBSD: mi,v 1.828 2009/09/07 21:07:02 mrg Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -89,6 +89,7 @@
 ./etc/disklabelsbase-obsolete		obsolete
 ./etc/fonts	base-x11-root
 ./etc/fonts/conf.dbase-x11-root
+./etc/fonts/conf.availbase-x11-root
 ./etc/iscsi	base-sysutil-root
 ./etc/kerberosIVbase-obsolete		obsolete
 ./etc/kerberosV	base-krb5-root

Index: src/distrib/sets/lists/xetc/mi
diff -u src/distrib/sets/lists/xetc/mi:1.15 src/distrib/sets/lists/xetc/mi:1.16
--- src/distrib/sets/lists/xetc/mi:1.15	Mon Apr 20 21:33:49 2009
+++ src/distrib/sets/lists/xetc/mi	Mon Sep  7 21:07:03 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.15 2009/04/20 21:33:49 mrg Exp $
+# $NetBSD: mi,v 1.16 2009/09/07 21:07:03 mrg Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -55,16 +55,34 @@
 ./etc/X11/xserver/SecurityPolicy			-unknown-	x11
 ./etc/X11/xsm/system.xsm-unknown-	x11
 ./etc/X11/xsm/system.xsm-unknown-	xorg
-./etc/fonts/conf.d/10-autohint.conf			-unknown-	xorg
-./etc/fonts/conf.d/10-no-sub-pixel.conf			-unknown-	xorg
-./etc/fonts/conf.d/10-sub-pixel-bgr.conf		-unknown-	xorg
-./etc/fonts/conf.d/10-sub-pixel-rgb.conf		-unknown-	xorg
-./etc/fonts/conf.d/10-sub-pixel-vbgr.conf		-unknown-	xorg
-./etc/fonts/conf.d/10-sub-pixel-vrgb.conf		-unknown-	xorg
-./etc/fonts/conf.d/10-unhinted.conf			-unknown-	xorg
+./etc/fonts/conf.avail/10-autohint.conf			-unknown-	xorg
+./etc/fonts/conf.avail/10-no-sub-pixel.conf		-unknown-	xorg
+./etc/fonts/conf.avail/10-sub-pixel-bgr.conf		-unknown-	xorg
+./etc/fonts/conf.avail/10-sub-pixel-rgb.conf		-unknown-	xorg
+./etc/fonts/conf.avail/10-sub-pixel-vbgr.conf		-unknown-	xorg
+./etc/fonts/conf.avail/10-sub-pixel-vrgb.conf		-unknown-	xorg
+./etc/fonts/conf.avail/10-unhinted.conf			-unknown-	xorg
+./etc/fonts/conf.avail/20-fix-globaladvance.conf	-unknown-	xorg
+./etc/fonts/conf.avail/20-unhint-small-vera.conf	-unknown-	xorg
+./etc/fonts/conf.avail/25-unhint-nonlatin.conf		-unknown-	xorg
+./etc/fonts/conf.avail/30-metric-aliases.conf		-unknown-	xorg
+./etc/fonts/conf.avail/30-urw-aliases.conf		-unknown-	xorg
+./etc/fonts/conf.avail/40-nonlatin.conf			-unknown-	xorg
+./etc/fonts/conf.avail/45-latin.conf			-unknown-	xorg
+./etc/fonts/conf.avail/49-sansserif.conf		-unknown-	xorg
+./etc/fonts/conf.avail/50-user.conf			-unknown-	xorg
+./etc/fonts/conf.avail/51-local.conf			-unknown-	xorg
+./etc/fonts/conf.avail/60-latin.conf			-unknown-	xorg
+./etc/fonts/conf.avail/65-fonts-persian.conf		-unknown-	xorg
+./etc/fonts/conf.avail/65-khmer.conf			-unknown-	xorg
+./etc/fonts/conf.avail/65-nonlatin.conf			-unknown-	xorg
+./etc/fonts/conf.avail/69-unifont.conf			-unknown-	xorg
+./etc/fonts/conf.avail/70-no-bitmaps.conf		-unknown-	xorg
+./etc/fonts/conf.avail/70-yes-bitmaps.conf		-unknown-	xorg
+./etc/fonts/conf.avail/80-delicious.conf		-unknown-	xorg
+./etc/fonts/conf.avail/90-synthetic.conf		-unknown-	xorg
 ./etc/fonts/conf.d/20-fix-globaladvance.conf		-unknown-	xorg
 ./etc/fonts/conf.d/20-unhint-small-vera.conf		-unknown-	xorg
-./etc/fonts/conf.d/25-unhint-nonlatin.conf		-unknown-	xorg
 ./etc/fonts/conf.d/30-metric-aliases.conf		-unknown-	xorg
 

CVS commit: src/lib/libedit

2009-09-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep  7 21:24:34 UTC 2009

Modified Files:
src/lib/libedit: histedit.h history.c readline.c
src/lib/libedit/readline: readline.h

Log Message:
apply apple patches from:
http://opensource.apple.com/source/libedit/libedit-11/patches/


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libedit/histedit.h
cvs rdiff -u -r1.33 -r1.34 src/lib/libedit/history.c
cvs rdiff -u -r1.84 -r1.85 src/lib/libedit/readline.c
cvs rdiff -u -r1.29 -r1.30 src/lib/libedit/readline/readline.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/libedit/histedit.h
diff -u src/lib/libedit/histedit.h:1.40 src/lib/libedit/histedit.h:1.41
--- src/lib/libedit/histedit.h:1.40	Mon May 11 14:33:30 2009
+++ src/lib/libedit/histedit.h	Mon Sep  7 17:24:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: histedit.h,v 1.40 2009/05/11 18:33:30 christos Exp $	*/
+/*	$NetBSD: histedit.h,v 1.41 2009/09/07 21:24:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -204,6 +204,10 @@
 #define	H_SETUNIQUE	20	/* , int);		*/
 #define	H_GETUNIQUE	21	/* , void);		*/
 #define	H_DEL		22	/* , int);		*/
+#define	H_NEXT_EVDATA	23	/* , const int, histdata_t *);	*/
+#define	H_DELDATA	24	/* , int, histdata_t *);*/
+#define	H_REPLACE	25	/* , const char *, histdata_t);	*/
+
 
 
 /*

Index: src/lib/libedit/history.c
diff -u src/lib/libedit/history.c:1.33 src/lib/libedit/history.c:1.34
--- src/lib/libedit/history.c:1.33	Fri Feb  6 09:40:32 2009
+++ src/lib/libedit/history.c	Mon Sep  7 17:24:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.33 2009/02/06 14:40:32 sketch Exp $	*/
+/*	$NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)history.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: history.c,v 1.33 2009/02/06 14:40:32 sketch Exp $);
+__RCSID($NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $);
 #endif
 #endif /* not lint  not SCCSID */
 
@@ -121,6 +121,7 @@
  */
 typedef struct hentry_t {
 	HistEvent ev;		/* What we return		 */
+	void *data;		/* data */
 	struct hentry_t *next;	/* Next entry			 */
 	struct hentry_t *prev;	/* Previous entry		 */
 } hentry_t;
@@ -150,6 +151,9 @@
 private int history_def_insert(history_t *, HistEvent *, const char *);
 private void history_def_delete(history_t *, HistEvent *, hentry_t *);
 
+private int history_deldata_nth(history_t *, HistEvent *, int, void **);
+private int history_set_nth(ptr_t, HistEvent *, int);
+
 #define	history_def_setsize(p, num)(void) (((history_t *)p)-max = (num))
 #define	history_def_getsize(p)  (((history_t *)p)-cur)
 #define	history_def_getunique(p) (history_t *)p)-flags)  H_UNIQUE) != 0)
@@ -340,6 +344,31 @@
 }
 
 
+/* history_set_nth():
+ *	Default function to set the current event in the history to the
+ *	n-th one.
+ */
+private int
+history_set_nth(ptr_t p, HistEvent *ev, int n)
+{
+	history_t *h = (history_t *) p;
+
+	if (h-cur == 0) {
+		he_seterrev(ev, _HE_EMPTY_LIST);
+		return (-1);
+	}
+	for (h-cursor = h-list.prev; h-cursor != h-list;
+	h-cursor = h-cursor-prev)
+		if (n-- = 0)
+			break;
+	if (h-cursor == h-list) {
+		he_seterrev(ev, _HE_NOT_FOUND);
+		return (-1);
+	}
+	return (0);
+}
+
+
 /* history_def_add():
  *	Append string to element
  */
@@ -368,6 +397,24 @@
 }
 
 
+private int
+history_deldata_nth(history_t *h, HistEvent *ev,
+int num, void **data)
+{
+	if (history_set_nth(h, ev, num) != 0)
+		return (-1);
+	/* magic value to skip delete (just set to n-th history) */
+	if (data == (void **)-1)
+		return (0);
+	ev-str = strdup(h-cursor-ev.str);
+	ev-num = h-cursor-ev.num;
+	if (data)
+		*data = h-cursor-data;
+	history_def_delete(h, ev, h-cursor);
+	return (0);
+}
+
+
 /* history_def_del():
  *	Delete element hp of the h list
  */
@@ -397,8 +444,11 @@
 	HistEventPrivate *evp = (void *)hp-ev;
 	if (hp == h-list)
 		abort();
-	if (h-cursor == hp)
+	if (h-cursor == hp) {
 		h-cursor = hp-prev;
+		if (h-cursor == h-list)
+			h-cursor = hp-next;
+	}
 	hp-prev-next = hp-next;
 	hp-next-prev = hp-prev;
 	h_free((ptr_t) evp-str);
@@ -421,6 +471,7 @@
 		h_free((ptr_t)h-cursor);
 		goto oomem;
 	}
+	h-cursor-data = NULL;
 	h-cursor-ev.num = ++h-eventid;
 	h-cursor-next = h-list.next;
 	h-cursor-prev = h-list;
@@ -792,6 +843,23 @@
 }
 
 
+private int
+history_next_evdata(History *h, HistEvent *ev, int num, void **d)
+{
+	int retval;
+
+	for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev))
+		if (num-- = 0) {
+			if (d)
+*d = ((history_t *)h-h_ref)-cursor-data;
+			return (0);
+		}
+
+	he_seterrev(ev, _HE_NOT_FOUND);
+	return (-1);
+}
+
+
 /* history_next_event():
  *	Find the next event, with number given
  */
@@ -981,11 +1049,42 @@
 		retval = 0;
 		break;
 
+	case H_NEXT_EVDATA:
+	{
+		int num = va_arg(va, int);
+		void **d = va_arg(va, void **);
+		retval = 

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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 21:28:01 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: types.h

Log Message:
Add symbolic constants for what's stored in label_t.


To generate a diff of this commit:
cvs rdiff -u -r1.43.36.7 -r1.43.36.8 src/sys/arch/mips/include/types.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/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.43.36.7 src/sys/arch/mips/include/types.h:1.43.36.8
--- src/sys/arch/mips/include/types.h:1.43.36.7	Sun Sep  6 22:34:53 2009
+++ src/sys/arch/mips/include/types.h	Mon Sep  7 21:28:01 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.43.36.7 2009/09/06 22:34:53 matt Exp $	*/
+/*	$NetBSD: types.h,v 1.43.36.8 2009/09/07 21:28:01 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -110,6 +110,19 @@
 typedef struct label_t {
 	register_t val[14];
 } label_t;
+#define	_L_S0		0
+#define	_L_S1		1
+#define	_L_S2		2
+#define	_L_S3		3
+#define	_L_S4		4
+#define	_L_S5		5
+#define	_L_S6		6
+#define	_L_S7		7
+#define	_L_GP		8
+#define	_L_SP		9
+#define	_L_S8		10
+#define	_L_RA		11
+#define	_L_SR		12
 #endif
 
 typedef	volatile int		__cpu_simple_lock_t;



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 21:28:34 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: pcb.h

Log Message:
pcb_context is a label_t so use label_t as its type.


To generate a diff of this commit:
cvs rdiff -u -r1.20.62.1 -r1.20.62.2 src/sys/arch/mips/include/pcb.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/mips/include/pcb.h
diff -u src/sys/arch/mips/include/pcb.h:1.20.62.1 src/sys/arch/mips/include/pcb.h:1.20.62.2
--- src/sys/arch/mips/include/pcb.h:1.20.62.1	Thu Aug 20 07:50:36 2009
+++ src/sys/arch/mips/include/pcb.h	Mon Sep  7 21:28:33 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.20.62.1 2009/08/20 07:50:36 matt Exp $	*/
+/*	$NetBSD: pcb.h,v 1.20.62.2 2009/09/07 21:28:33 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,6 +79,7 @@
 #ifndef _MIPS_PCB_H_
 #define	_MIPS_PCB_H_
 
+#include mips/types.h
 #include mips/reg.h
 
 /*
@@ -87,7 +88,7 @@
 struct pcb
 {
 	struct fpreg pcb_fpregs;	/* saved floating point registers */
-	mips_reg_t pcb_context[12];	/* kernel context for resume */
+	label_t pcb_context;		/* kernel context for resume */
 	void *	pcb_onfault;		/* for copyin/copyout faults */
 	uint32_t pcb_ppl;		/* previous priority level */
 };



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 21:34:47 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpuregs.h

Log Message:
Use intptr_t in MIPS_KSEGx_P()
Use uintptr_t in MIPS_XKPHYS*


To generate a diff of this commit:
cvs rdiff -u -r1.74.28.6 -r1.74.28.7 src/sys/arch/mips/include/cpuregs.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/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.74.28.6 src/sys/arch/mips/include/cpuregs.h:1.74.28.7
--- src/sys/arch/mips/include/cpuregs.h:1.74.28.6	Sun Sep  6 22:36:16 2009
+++ src/sys/arch/mips/include/cpuregs.h	Mon Sep  7 21:34:47 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuregs.h,v 1.74.28.6 2009/09/06 22:36:16 matt Exp $	*/
+/*	$NetBSD: cpuregs.h,v 1.74.28.7 2009/09/07 21:34:47 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -103,8 +103,8 @@
 #define	MIPS_KSEG1_TO_PHYS(x)	((uintptr_t)(x)  MIPS_PHYS_MASK)
 #define	MIPS_PHYS_TO_KSEG1(x)	((uintptr_t)(x) | (intptr_t)MIPS_KSEG1_START)
 
-#define	MIPS_KSEG0_P(x)		(((uintptr_t)(x)  ~MIPS_PHYS_MASK) == MIPS_KSEG0_START)
-#define	MIPS_KSEG1_P(x)		(((uintptr_t)(x)  ~MIPS_PHYS_MASK) == MIPS_KSEG1_START)
+#define	MIPS_KSEG0_P(x)		(((intptr_t)(x)  ~MIPS_PHYS_MASK) == MIPS_KSEG0_START)
+#define	MIPS_KSEG1_P(x)		(((intptr_t)(x)  ~MIPS_PHYS_MASK) == MIPS_KSEG1_START)
 #define	MIPS_KSEG2_P(x)		((uintptr_t)MIPS_KSEG2_START = (uintptr_t)(x))
 
 /* Map virtual address to index in mips3 r4k virtually-indexed cache */
@@ -118,8 +118,8 @@
 #define	MIPS_XKPHYS_START	(0x2ULL  62)
 #define	MIPS_PHYS_TO_XKPHYS(cca,x) \
 	(MIPS_XKPHYS_START | ((uint64_t)(cca)  59) | (x))
-#define	MIPS_XKPHYS_TO_PHYS(x)	((x)  0x0effLL)
-#define	MIPS_XKPHYS_TO_CCA(x)	(((x)  59)  7)
+#define	MIPS_XKPHYS_TO_PHYS(x)	((uintptr_t)(x)  0x0effLL)
+#define	MIPS_XKPHYS_TO_CCA(x)	(((uintptr_t)(x)  59)  7)
 #define	MIPS_XKPHYS_P(x)	(((uint64_t)(x)  62) == 2)
 
 #define	CCA_UNCACHED		2



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 21:36:43 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: psl.h

Log Message:
Add MIPS_SR_KX to PSL_USERSET if _LP64


To generate a diff of this commit:
cvs rdiff -u -r1.17.96.1 -r1.17.96.2 src/sys/arch/mips/include/psl.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/mips/include/psl.h
diff -u src/sys/arch/mips/include/psl.h:1.17.96.1 src/sys/arch/mips/include/psl.h:1.17.96.2
--- src/sys/arch/mips/include/psl.h:1.17.96.1	Sun Aug 16 03:33:58 2009
+++ src/sys/arch/mips/include/psl.h	Mon Sep  7 21:36:43 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.17.96.1 2009/08/16 03:33:58 matt Exp $	*/
+/*	$NetBSD: psl.h,v 1.17.96.2 2009/09/07 21:36:43 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -48,9 +48,13 @@
 #define	MIPS3_PSL_LOWIPL	(MIPS3_INT_MASK | MIPS_SR_INT_IE)
 
 #if !defined(__mips_o32)
-#define MIPS3_PSL_XFLAGS	(MIPS3_SR_XX | MIPS3_SR_UX)
+# ifdef _LP64
+#  define MIPS3_PSL_XFLAGS	(MIPS3_SR_XX | MIPS_SR_KX)
+# else
+#  define MIPS3_PSL_XFLAGS	(MIPS3_SR_XX)
+# endif
 #else
-#define MIPS3_PSL_XFLAGS	(0)
+# define MIPS3_PSL_XFLAGS	(0)
 #endif
 
 #define	MIPS3_PSL_USERSET 	\



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 21:42:17 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: pmap.h

Log Message:
Cleanup for LP64.  XXX pv_entry needs work.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.26.1 src/sys/arch/mips/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/mips/include/pmap.h
diff -u src/sys/arch/mips/include/pmap.h:1.54 src/sys/arch/mips/include/pmap.h:1.54.26.1
--- src/sys/arch/mips/include/pmap.h:1.54	Wed Dec 26 16:01:34 2007
+++ src/sys/arch/mips/include/pmap.h	Mon Sep  7 21:42:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.54 2007/12/26 16:01:34 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.54.26.1 2009/09/07 21:42:17 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -102,7 +102,7 @@
 #define mips_round_seg(x)	(((vaddr_t)(x) + SEGOFSET)  ~SEGOFSET)
 #define pmap_segmap(m, v)	((m)-pm_segtab-seg_tab[((v)  SEGSHIFT)])
 
-#define PMAP_SEGTABSIZE		512
+#define PMAP_SEGTABSIZE		(1  (31 - SEGSHIFT))
 
 union pt_entry;
 
@@ -114,12 +114,12 @@
  * Machine dependent pmap structure.
  */
 typedef struct pmap {
-	int			pm_count;	/* pmap reference count */
 	kmutex_t		pm_lock;	/* lock on pmap */
-	struct pmap_statistics	pm_stats;	/* pmap statistics */
-	unsigned		pm_asid;	/* TLB address space tag */
-	unsigned		pm_asidgen;	/* its generation number */
 	struct segtab		*pm_segtab;	/* pointers to pages of PTEs */
+	int			pm_count;	/* pmap reference count */
+	unsigned int		pm_asid;	/* TLB address space tag */
+	unsigned int		pm_asidgen;	/* its generation number */
+	struct pmap_statistics	pm_stats;	/* pmap statistics */
 } *pmap_t;
 
 /*
@@ -130,7 +130,7 @@
 typedef struct pv_entry {
 	struct pv_entry	*pv_next;	/* next pv_entry */
 	struct pmap	*pv_pmap;	/* pmap where mapping lies */
-	vaddr_t	pv_va;			/* virtual address for mapping */
+	vaddr_t		pv_va;		/* virtual address for mapping */
 	int		pv_flags;	/* some flags for the mapping */
 } *pv_entry_t;
 
@@ -189,12 +189,18 @@
 /*
  * Other hooks for the pool allocator.
  */
+#ifdef _LP64
+#define	POOL_VTOPHYS(va)	(MIPS_KSEG0_P(va) \
+? MIPS_KSEG0_TO_PHYS(va) \
+: MIPS_XKPHYS_TO_PHYS(va))
+#else
 #define	POOL_VTOPHYS(va)	MIPS_KSEG0_TO_PHYS((vaddr_t)(va))
+#endif
 
 /*
  * Select CCA to use for unmanaged pages.
  */
-#define	PMAP_CCA_FOR_PA(pa)	2		/* uncached */
+#define	PMAP_CCA_FOR_PA(pa)	CCA_UNCACHED		/* uncached */
 
 #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
 #define PMAP_NOCACHE	0x4000ULL



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 21:50:24 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: mips_param.h

Log Message:
Derive NBSEG and SEGSHIFT from NBPG and PGSHIFT.


To generate a diff of this commit:
cvs rdiff -u -r1.23.78.2 -r1.23.78.3 src/sys/arch/mips/include/mips_param.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/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.23.78.2 src/sys/arch/mips/include/mips_param.h:1.23.78.3
--- src/sys/arch/mips/include/mips_param.h:1.23.78.2	Sat Aug 22 06:45:30 2009
+++ src/sys/arch/mips/include/mips_param.h	Mon Sep  7 21:50:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_param.h,v 1.23.78.2 2009/08/22 06:45:30 matt Exp $	*/
+/*	$NetBSD: mips_param.h,v 1.23.78.3 2009/09/07 21:50:24 matt Exp $	*/
 
 #ifdef _KERNEL
 #include machine/cpu.h
@@ -62,9 +62,9 @@
 #define	PGSHIFT		12		/* LOG2(NBPG) */
 #define	NPTEPG		(NBPG/4)
 
-#define NBSEG		0x40	/* bytes/segment */
+#define NBSEG		(NBPG*NPTEPG)	/* bytes/segment */
 #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
-#define	SEGSHIFT	22		/* LOG2(NBSEG) */
+#define	SEGSHIFT	(2*PGSHIFT-2)	/* LOG2(NBSEG) */
 
 /*
  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 21:51:25 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: asm.h

Log Message:
Simplify PTR_ case (32 bit or 64 bit)


To generate a diff of this commit:
cvs rdiff -u -r1.40.38.8 -r1.40.38.9 src/sys/arch/mips/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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.40.38.8 src/sys/arch/mips/include/asm.h:1.40.38.9
--- src/sys/arch/mips/include/asm.h:1.40.38.8	Sat Sep  5 03:13:51 2009
+++ src/sys/arch/mips/include/asm.h	Mon Sep  7 21:51:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.40.38.8 2009/09/05 03:13:51 matt Exp $	*/
+/*	$NetBSD: asm.h,v 1.40.38.9 2009/09/07 21:51:25 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -332,7 +332,7 @@
  * assembler to prevent the assembler from generating 64-bit style
  * ABI calls.
  */
-#if defined(__mips_o32)
+#if _MIPS_SZPTR == 32
 #define	PTR_ADD		add
 #define	PTR_ADDI	addi
 #define	PTR_ADDU	addu
@@ -354,33 +354,7 @@
 #define	PTR_SC		sc
 #define	PTR_WORD	.word
 #define	PTR_SCALESHIFT	2
-#endif /* __mips_o32 */
-
-#if defined(__mips_n32)
-#define	PTR_ADD		add
-#define	PTR_ADDI	addi
-#define	PTR_ADDU	add	/* no u */
-#define	PTR_ADDIU	addi	/* no u */
-#define	PTR_SUB		sub
-#define	PTR_SUBI	subi
-#define	PTR_SUBU	sub	/* no u */
-#define	PTR_SUBIU	sub	/* no u */
-#define	PTR_L		lw
-#define	PTR_LA		la
-#define	PTR_S		sw
-#define	PTR_SLL		sll
-#define	PTR_SLLV	sllv
-#define	PTR_SRL		srl
-#define	PTR_SRLV	srlv
-#define	PTR_SRA		sra
-#define	PTR_SRAV	srav
-#define	PTR_LL		ll
-#define	PTR_SC		sc
-#define	PTR_WORD	.word
-#define	PTR_SCALESHIFT	2
-#endif /* __mips_n32 */
-
-#if defined(__mips_n64) || defined(__mips_o64)
+#else /* _MIPS_SZPTR == 64 */
 #define	PTR_ADD		dadd
 #define	PTR_ADDI	daddi
 #define	PTR_ADDU	daddu
@@ -402,7 +376,7 @@
 #define	PTR_SC		scd
 #define	PTR_WORD	.dword
 #define	PTR_SCALESHIFT	3
-#endif /* __mips_n64 || __mips_o64 */
+#endif /* _MIPS_SZPTR == 64 */
 
 #if _MIPS_SZINT == 32
 #define	INT_ADD		add



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:05:45 UTC 2009

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

Log Message:
On N32/N64 save/restore gp since it's a callee-saved register.
Don't use proc0paddr, use lwp0-l_addr


To generate a diff of this commit:
cvs rdiff -u -r1.167.38.1 -r1.167.38.2 src/sys/arch/mips/mips/locore.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/locore.S
diff -u src/sys/arch/mips/mips/locore.S:1.167.38.1 src/sys/arch/mips/mips/locore.S:1.167.38.2
--- src/sys/arch/mips/mips/locore.S:1.167.38.1	Thu Aug 20 23:27:06 2009
+++ src/sys/arch/mips/mips/locore.S	Mon Sep  7 22:05:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.167.38.1 2009/08/20 23:27:06 matt Exp $	*/
+/*	$NetBSD: locore.S,v 1.167.38.2 2009/09/07 22:05:45 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -101,7 +101,7 @@
 
 #ifdef NOFPU /* No FPU; avoid touching FPU registers */
 #ifdef _LP64
-	li	t0, MIPS_SR_KX
+	li	t0, MIPS_SR_KX			# turn on XKSEG and XKPHYS
 #else
 	li	t0, 0# Disable interrupts and
 #endif
@@ -145,7 +145,7 @@
 	jal	_C_LABEL(mach_init)		# mach_init(a0, a1, a2, a3)
 	nop
 
-	PTR_L	sp, _C_LABEL(proc0paddr)	# switch to proc0 stack
+	PTR_L	sp, L_ADDR(MIPS_CURLWP)		# switch to lwp0 stack
 	nop
 	PTR_ADDU sp, USPACE - FRAME_SIZ - CALLFRAME_SIZ
 	jal	_C_LABEL(main)			# main(void)
@@ -185,6 +185,9 @@
 	REG_S	s8, U_PCB_CONTEXT+SF_REG_S8(a2)
 	REG_S	ra, U_PCB_CONTEXT+SF_REG_RA(a2)
 	REG_S	t0, U_PCB_CONTEXT+SF_REG_SR(a2)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_S	gp, U_PCB_CONTEXT+SF_REG_GP(a2)
+#endif
 #ifdef IPL_ICU_MASK
 	INT_L	t0, _C_LABEL(md_imask)
 	INT_S	t0, U_PCB_PPL(a2)
@@ -244,6 +247,9 @@
 	REG_L	s5, U_PCB_CONTEXT+SF_REG_S5(a0)
 	REG_L	s6, U_PCB_CONTEXT+SF_REG_S6(a0)
 	REG_L	s7, U_PCB_CONTEXT+SF_REG_S7(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_L	gp, U_PCB_CONTEXT+SF_REG_GP(a0)
+#endif
 	REG_L	sp, U_PCB_CONTEXT+SF_REG_SP(a0)
 	REG_L	s8, U_PCB_CONTEXT+SF_REG_S8(a0)
 	REG_EPILOGUE
@@ -267,6 +273,9 @@
 	REG_S	s5, U_PCB_CONTEXT+SF_REG_S5(a0)
 	REG_S	s6, U_PCB_CONTEXT+SF_REG_S6(a0)
 	REG_S	s7, U_PCB_CONTEXT+SF_REG_S7(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_S	gp, U_PCB_CONTEXT+SF_REG_GP(a0)
+#endif
 	REG_S	sp, U_PCB_CONTEXT+SF_REG_SP(a0)
 	REG_S	s8, U_PCB_CONTEXT+SF_REG_S8(a0)
 	REG_S	ra, U_PCB_CONTEXT+SF_REG_RA(a0)
@@ -292,6 +301,9 @@
 	REG_S	s5, SF_REG_S5(a0)
 	REG_S	s6, SF_REG_S6(a0)
 	REG_S	s7, SF_REG_S7(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_S	gp, SF_REG_GP(a0)
+#endif
 	REG_S	sp, SF_REG_SP(a0)
 	REG_S	s8, SF_REG_S8(a0)
 	REG_S	ra, SF_REG_RA(a0)
@@ -314,6 +326,9 @@
 	REG_L	s5, SF_REG_S5(a0)
 	REG_L	s6, SF_REG_S6(a0)
 	REG_L	s7, SF_REG_S7(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+	REG_L	gp, SF_REG_GP(a0)
+#endif
 	REG_L	sp, SF_REG_SP(a0)
 	REG_L	s8, SF_REG_S8(a0)
 	REG_EPILOGUE
@@ -444,9 +459,8 @@
 LEAF(_splnone)
 	mtc0	zero, MIPS_COP_0_CAUSE		# clear SOFT_INT bits
 	COP0_SYNC
-#if 0
-	mfc0	v0, MIPS_COP_0_STATUS		# enable all sources
-	ori	v0, (MIPS_INT_MASK | MIPS_SR_INT_IE)
+#ifdef _LP64
+	li	v0, (MIPS_INT_MASK | MIPS_SR_INT_IE | MIPS_SR_KX)
 #else
 	li	v0, (MIPS_INT_MASK | MIPS_SR_INT_IE)
 #endif



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:06:32 UTC 2009

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

Log Message:
Cleanup fatal trap printfs


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

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

Modified files:

Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.8 src/sys/arch/mips/mips/trap.c:1.217.12.9
--- src/sys/arch/mips/mips/trap.c:1.217.12.8	Thu Sep  3 00:10:18 2009
+++ src/sys/arch/mips/mips/trap.c	Mon Sep  7 22:06:32 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.217.12.8 2009/09/03 00:10:18 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.217.12.9 2009/09/07 22:06:32 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -78,7 +78,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.217.12.8 2009/09/03 00:10:18 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.217.12.9 2009/09/07 22:06:32 matt Exp $);
 
 #include opt_cputype.h	/* which mips CPU levels do we support? */
 #include opt_ddb.h
@@ -227,16 +227,22 @@
 	default:
 	dopanic:
 		(void)splhigh();
+		printf(pid %d(%s): , p-p_pid, p-p_comm);
 		printf(trap: %s in %s mode\n,
 			trap_type[TRAPTYPE(cause)],
 			USERMODE(status) ? user : kernel);
 		printf(status=0x%x, cause=0x%x, epc=%# PRIxVADDR
-			, vaddr=%# PRIxVADDR \n, status, cause, opc, vaddr);
-		fp = l-l_md.md_regs;
-		printf(pid=%d cmd=%s usp=%# PRIxREGISTER
-		 ksp=%p ra=%# PRIxREGISTER \n,
-		p-p_pid, p-p_comm, fp-f_regs[_R_SP],
-		status, fp-f_regs[_R_RA]);
+			, vaddr=%# PRIxVADDR, status, cause, opc, vaddr);
+		if (USERMODE(status)) {
+			fp = l-l_md.md_regs;
+			printf( frame=%p usp=%# PRIxREGISTER
+			 ra=%# PRIxREGISTER \n,
+			   fp, fp-f_regs[_R_SP], fp-f_regs[_R_RA]);
+		} else {
+			printf( tf=%p ksp=%p ra=%# PRIxREGISTER \n,
+			   frame, frame+1, frame-tf_regs[TF_RA]);
+		}
+			
 #if defined(DDB)
 		kdb_trap(type, frame-tf_regs);
 		/* XXX force halt XXX */



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:08:32 UTC 2009

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

Log Message:
Add LP64 support.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.2 -r1.179.16.3 src/sys/arch/mips/mips/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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.2 src/sys/arch/mips/mips/pmap.c:1.179.16.3
--- src/sys/arch/mips/mips/pmap.c:1.179.16.2	Sun Aug 23 06:38:07 2009
+++ src/sys/arch/mips/mips/pmap.c	Mon Sep  7 22:08:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.179.16.2 2009/08/23 06:38:07 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.179.16.3 2009/09/07 22:08:31 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.179.16.2 2009/08/23 06:38:07 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.179.16.3 2009/09/07 22:08:31 matt Exp $);
 
 /*
  *	Manages physical address maps.
@@ -147,7 +147,10 @@
 CTASSERT((uint32_t)MIPS_KSEG2_START == 0xc000);
 CTASSERT((uint32_t)MIPS_MAX_MEM_ADDR == 0xbe00);
 CTASSERT((uint32_t)MIPS_RESERVED_ADDR == 0xbfc8);
+CTASSERT(MIPS_KSEG0_P(MIPS_PHYS_TO_KSEG0(0)));
+CTASSERT(MIPS_KSEG1_P(MIPS_PHYS_TO_KSEG1(0)));
 
+CTASSERT(NBPG = sizeof(struct segtab));
 #ifdef DEBUG
 struct {
 	int kernel;	/* entering kernel mapping */
@@ -374,6 +377,7 @@
 	pmap_kernel()-pm_count = 1;
 	pmap_kernel()-pm_asid = PMAP_ASID_RESERVED;
 	pmap_kernel()-pm_asidgen = 0;
+	pmap_kernel()-pm_segtab = (void *)(MIPS_KSEG2_START + 0x1eadbeef);
 
 	pmap_max_asid = MIPS_TLB_NUM_PIDS;
 	pmap_next_asid = 1;
@@ -590,22 +594,30 @@
 		pmap-pm_segtab-seg_tab[0] = NULL;
 	} else {
 		struct segtab *stp;
-		struct vm_page *mem;
+		struct vm_page *stp_pg;
+		paddr_t stp_pa;
 
-		do {
-			mem = uvm_pagealloc(NULL, 0, NULL,
+		for (;;) {
+			stp_pg = uvm_pagealloc(NULL, 0, NULL,
 			UVM_PGA_USERESERVE|UVM_PGA_ZERO);
-			if (mem == NULL) {
-/*
- * XXX What else can we do?  Could we
- * XXX deadlock here?
- */
-uvm_wait(pmap_create);
-			}
-		} while (mem == NULL);
+			if (stp_pg != NULL)
+break;
+			/*
+			 * XXX What else can we do?  Could we
+			 * XXX deadlock here?
+			 */
+			uvm_wait(pmap_create);
+		}
 
-		pmap-pm_segtab = stp =
-		(struct segtab *)MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem));
+		stp_pa = VM_PAGE_TO_PHYS(stp_pg);
+#ifdef _LP64
+		if (stp_pa  MIPS_PHYS_MASK)
+			stp = (struct segtab *)MIPS_PHYS_TO_XKPHYS(
+			stp_pa, MIPS3_PG_TO_CCA(mips3_pg_cached));
+		else
+#endif
+			stp = (struct segtab *)MIPS_PHYS_TO_KSEG0(stp_pa);
+		pmap-pm_segtab = stp;
 		i = NBPG / sizeof(struct segtab);
 		while (--i != 0) {
 			stp++;
@@ -650,6 +662,7 @@
 #endif
 
 		for (i = 0; i  PMAP_SEGTABSIZE; i++) {
+			paddr_t pa;
 			/* get pointer to segment map */
 			pte = pmap-pm_segtab-seg_tab[i];
 			if (!pte)
@@ -673,7 +686,13 @@
 			if (mips_cache_virtual_alias)
 mips_dcache_inv_range((vaddr_t)pte, PAGE_SIZE);
 #endif	/* MIPS3_PLUS */
-			uvm_pagefree(PHYS_TO_VM_PAGE(MIPS_KSEG0_TO_PHYS(pte)));
+#ifdef _LP64
+			if (MIPS_XKPHYS_P(pte))
+pa = MIPS_XKPHYS_TO_PHYS(pte);
+			else
+#endif
+pa = MIPS_KSEG0_TO_PHYS(pte);
+			uvm_pagefree(PHYS_TO_VM_PAGE(pa));
 
 			pmap-pm_segtab-seg_tab[i] = NULL;
 		}
@@ -1284,6 +1303,7 @@
 	}
 
 	if (!(pte = pmap_segmap(pmap, va))) {
+		paddr_t phys;
 		mem = uvm_pagealloc(NULL, 0, NULL,
 UVM_PGA_USERESERVE|UVM_PGA_ZERO);
 		if (mem == NULL) {
@@ -1292,8 +1312,15 @@
 			panic(pmap_enter: cannot allocate segmap);
 		}
 
-		pmap_segmap(pmap, va) = pte =
-		(pt_entry_t *)MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(mem));
+		phys = VM_PAGE_TO_PHYS(mem);
+#ifdef _LP64
+		if ((vaddr_t)pte  MIPS_PHYS_MASK)
+			pte = (pt_entry_t *)MIPS_PHYS_TO_XKPHYS(phys,
+			MIPS3_PG_TO_CCA(mips3_pg_cached));
+		else
+#endif
+			pte = (pt_entry_t *)MIPS_PHYS_TO_KSEG0(phys);
+		pmap_segmap(pmap, va) = pte;
 #ifdef PARANOIADIAG
 	{
 		int i;
@@ -1326,23 +1353,23 @@
 		pmap-pm_stats.wired_count++;
 		npte |= mips_pg_wired_bit();
 	}
-#ifdef DEBUG
+#if defined(DEBUG)
 	if (pmapdebug  PDB_ENTER) {
-		printf(pmap_enter: new pte %x, npte);
+		printf(pmap_enter: %p: %#PRIxVADDR: new pte %#x (pa %#PRIxPADDR), pmap, va, npte, pa);
 		if (pmap-pm_asidgen == pmap_asid_generation)
-			printf( asid %d, pmap-pm_asid);
+			printf( asid %u (%#x), pmap-pm_asid, pmap-pm_asid);
 		printf(\n);
 	}
 #endif
 
 #ifdef PARANOIADIAG
 	if (PMAP_IS_ACTIVE(pmap)) {
-		unsigned asid;
+		unsigned int asid;
 
 		__asm volatile(mfc0 %0,$10; nop : =r(asid));
 		asid = (MIPS_HAS_R4K_MMU) ? (asid  0xff) : (asid  0xfc0)  6;
 		if (asid != pmap-pm_asid) {
-			panic(inconsistency for active TLB update: %d - %d,
+			panic(inconsistency for active TLB update: %u - %u,
 			asid, pmap-pm_asid);
 		}
 	}
@@ -1526,18 +1553,18 @@
 		

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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:19:53 UTC 2009

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

Log Message:
Fix MIPS_PHYS_TO_XKPHYS calls.


To generate a diff of this commit:
cvs rdiff -u -r1.179.16.3 -r1.179.16.4 src/sys/arch/mips/mips/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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.3 src/sys/arch/mips/mips/pmap.c:1.179.16.4
--- src/sys/arch/mips/mips/pmap.c:1.179.16.3	Mon Sep  7 22:08:31 2009
+++ src/sys/arch/mips/mips/pmap.c	Mon Sep  7 22:19:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.179.16.3 2009/09/07 22:08:31 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.179.16.4 2009/09/07 22:19:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.179.16.3 2009/09/07 22:08:31 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.179.16.4 2009/09/07 22:19:53 matt Exp $);
 
 /*
  *	Manages physical address maps.
@@ -483,7 +483,7 @@
 		else
 #ifdef _LP64
 			va = MIPS_PHYS_TO_XKPHYS(
-			MIPS3_PG_TO_CCA(mips3_pg_cached), pa);
+			MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), pa);
 #else
 			panic(pmap_steal_memory: 
 			  pa can not be mapped into K0);
@@ -613,7 +613,7 @@
 #ifdef _LP64
 		if (stp_pa  MIPS_PHYS_MASK)
 			stp = (struct segtab *)MIPS_PHYS_TO_XKPHYS(
-			stp_pa, MIPS3_PG_TO_CCA(mips3_pg_cached));
+			MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), stp_pa);
 		else
 #endif
 			stp = (struct segtab *)MIPS_PHYS_TO_KSEG0(stp_pa);
@@ -1315,8 +1315,8 @@
 		phys = VM_PAGE_TO_PHYS(mem);
 #ifdef _LP64
 		if ((vaddr_t)pte  MIPS_PHYS_MASK)
-			pte = (pt_entry_t *)MIPS_PHYS_TO_XKPHYS(phys,
-			MIPS3_PG_TO_CCA(mips3_pg_cached));
+			pte = (pt_entry_t *)MIPS_PHYS_TO_XKPHYS(
+			MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), phys);
 		else
 #endif
 			pte = (pt_entry_t *)MIPS_PHYS_TO_KSEG0(phys);
@@ -1660,7 +1660,7 @@
 #endif
 #ifdef _LP64
 	if (phys  MIPS_PHYS_MASK)
-		va = MIPS_PHYS_TO_XKPHYS(phys, MIPS3_PG_TO_CCA(mips3_pg_cached));
+		va = MIPS_PHYS_TO_XKPHYS(MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), phys);
 	else
 #endif
 		va = MIPS_PHYS_TO_KSEG0(phys);
@@ -1705,13 +1705,13 @@
 #endif
 #ifdef _LP64
 	if (src  MIPS_PHYS_MASK)
-		src_va = MIPS_PHYS_TO_XKPHYS(src, MIPS3_PG_TO_CCA(mips3_pg_cached));
+		src_va = MIPS_PHYS_TO_XKPHYS(MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), src);
 	else
 #endif
 		src_va = MIPS_PHYS_TO_KSEG0(src);
 #ifdef _LP64
 	if (dst  MIPS_PHYS_MASK)
-		dst_va = MIPS_PHYS_TO_XKPHYS(dst, MIPS3_PG_TO_CCA(mips3_pg_cached));
+		dst_va = MIPS_PHYS_TO_XKPHYS(MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), dst);
 	else
 #endif
 		dst_va = MIPS_PHYS_TO_KSEG0(dst);
@@ -2189,7 +2189,7 @@
 	phys = VM_PAGE_TO_PHYS(pg);
 #ifdef _LP64
 	if (phys  MIPS_PHYS_MASK)
-		va = MIPS_PHYS_TO_XKPHYS(phys, MIPS3_PG_TO_CCA(mips3_pg_cached));
+		va = MIPS_PHYS_TO_XKPHYS(MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), phys);
 	else
 #endif
 		va = MIPS_PHYS_TO_KSEG0(phys);
@@ -2276,7 +2276,7 @@
 		va = MIPS_PHYS_TO_KSEG0(pa);
 	else
 #ifdef _LP64
-		va = MIPS_PHYS_TO_XKPHYS(MIPS3_PG_TO_CCA(mips3_pg_cached), pa);
+		va = MIPS_PHYS_TO_XKPHYS(MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), pa);
 #else
 		panic(mips_pmap_map_poolpage: 
 		pa #%PRIxPADDR can not be mapped into KSEG0, pa);



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:29:19 UTC 2009

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

Log Message:
Use VM_MIN_KERNEL_ADDRESS instead of MIPS_KSEG2_START


To generate a diff of this commit:
cvs rdiff -u -r1.64.26.1.2.1 -r1.64.26.1.2.2 \
src/sys/arch/mips/mips/locore_mips1.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/locore_mips1.S
diff -u src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.1 src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.2
--- src/sys/arch/mips/mips/locore_mips1.S:1.64.26.1.2.1	Thu Aug 20 22:37:16 2009
+++ src/sys/arch/mips/mips/locore_mips1.S	Mon Sep  7 22:29:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_mips1.S,v 1.64.26.1.2.1 2009/08/20 22:37:16 matt Exp $	*/
+/*	$NetBSD: locore_mips1.S,v 1.64.26.1.2.2 2009/09/07 22:29:19 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1115,7 +1115,7 @@
 	lw	a1, L_MD_UPTE_0(a0)		# a1 = upte[0]
 	lw	a2, L_MD_UPTE_1(a0)		# a2 = upte[1]
 	lw	s0, L_ADDR(a0)			# va = l-l_addr
-	li	s2, MIPS_KSEG2_START
+	li	s2, VM_MIN_KERNEL_ADDRESS
 	blt	s0, s2, resume
 	nop
 



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:27:31 UTC 2009

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

Log Message:
Set segbase to an invalid kernel address by default.


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.4 -r1.205.4.1.2.1.2.5 \
src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.4 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.5
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.4	Sun Aug 23 06:38:07 2009
+++ src/sys/arch/mips/mips/mips_machdep.c	Mon Sep  7 22:27:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.4 2009/08/23 06:38:07 matt Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.5 2009/09/07 22:27:30 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.4 2009/08/23 06:38:07 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.205.4.1.2.1.2.5 2009/09/07 22:27:30 matt Exp $);
 
 #include opt_cputype.h
 
@@ -205,7 +205,7 @@
 u_int mips3_pg_shift;
 
 struct	user *proc0paddr;
-struct	segtab *segbase;
+struct	segtab *segbase = (void *)(MIPS_KSEG2_START + 0x1eadbeef);
 
 void *	msgbufaddr;
 



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:28:24 UTC 2009

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

Log Message:
Use/Compare CCA from MIPS3_PG_{UNCACHED,CACHED}


To generate a diff of this commit:
cvs rdiff -u -r1.22.16.3 -r1.22.16.4 src/sys/arch/mips/mips/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/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.22.16.3 src/sys/arch/mips/mips/bus_dma.c:1.22.16.4
--- src/sys/arch/mips/mips/bus_dma.c:1.22.16.3	Sun Sep  6 22:58:59 2009
+++ src/sys/arch/mips/mips/bus_dma.c	Mon Sep  7 22:28:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.22.16.3 2009/09/06 22:58:59 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.22.16.4 2009/09/07 22:28:24 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.22.16.3 2009/09/06 22:58:59 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.22.16.4 2009/09/07 22:28:24 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -45,6 +45,9 @@
 #include uvm/uvm_extern.h
 
 #include mips/cache.h
+#ifdef _LP64
+#include mips/mips3_pte.h
+#endif
 
 #define _MIPS_BUS_DMA_PRIVATE
 #include machine/bus.h
@@ -267,7 +270,7 @@
 			map-_dm_flags |= MIPS_DMAMAP_COHERENT;
 #ifdef _LP64
 		else if (MIPS_XKPHYS_P((vaddr_t)buf)
-		 MIPS_XKPHYS_TO_CCA((vaddr_t)buf) == CCA_UNCACHED)
+		 MIPS_XKPHYS_TO_CCA((vaddr_t)buf) == MIPS3_PG_TO_CCA(MIPS3_PG_UNCACHED))
 			map-_dm_flags |= MIPS_DMAMAP_COHERENT;
 #endif
 	}
@@ -660,11 +663,11 @@
 		if (segs[0].ds_addr + segs[0].ds_len  MIPS_PHYS_MASK) {
 			unsigned long cca;
 			if (flags  BUS_DMA_COHERENT)
-cca = CCA_UNCACHED;
+cca = MIPS3_PG_TO_CCA(MIPS3_PG_UNCACHED);
 			else
-cca = CCA_CACHEABLE;
-			*kvap = (void *)MIPS_PHYS_TO_XKPHYS(segs[0].ds_addr,
-			cca);
+cca = MIPS3_PG_TO_CCA(MIPS3_PG_CACHED);
+			*kvap = (void *)MIPS_PHYS_TO_XKPHYS(cca,
+			segs[0].ds_addr);
 		} else
 #endif
 		if (flags  BUS_DMA_COHERENT)



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 22:32:52 UTC 2009

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

Log Message:
Make sure KX is set on LP64 kernels.  Use VM_MIN_KERNEL_ADDRESS instead of
MIPS_KSEG2_START.  Deal with VM_MIN_KERNEL_ADDRESS being below KSEG0 in
addition to being above it.


To generate a diff of this commit:
cvs rdiff -u -r1.26.36.1.2.6 -r1.26.36.1.2.7 \
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.6 src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.7
--- src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.6	Sat Sep  5 03:25:07 2009
+++ src/sys/arch/mips/mips/mipsX_subr.S	Mon Sep  7 22:32:52 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.6 2009/09/05 03:25:07 matt Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.7 2009/09/07 22:32:52 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -134,6 +134,18 @@
 
 #include assym.h
 
+#ifdef _LP64
+#define	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(reg) \
+	li reg, MIPS_SR_KX; mtc0 reg, MIPS_COP_0_STATUS
+#define	SET_EXCEPTION_LEVEL(reg) \
+	li reg, MIPS_SR_EXL | MIPS_SR_KX; mtc0 reg, MIPS_COP_0_STATUS
+#else
+#define	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(reg) \
+	mtc0 zero, MIPS_COP_0_STATUS
+#define	SET_EXCEPTION_LEVEL(reg) \
+	li reg, MIPS_SR_EXL; mtc0 reg, MIPS_COP_0_STATUS
+#endif
+
 /*
  * XXX MIPS3_5900 is still special for much of this code.
  */
@@ -592,7 +604,7 @@
 	PTR_ADDU v0, sp, KERNFRAME_SIZ
 	REG_S	v0, KERNFRAME_SP(sp)
 #endif
-	mtc0	zero, MIPS_COP_0_STATUS		# Set kernel no error level
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop
 	nop
@@ -603,7 +615,7 @@
 /*
  * Restore registers and return from the exception.
  */
-	mtc0	zero, MIPS_COP_0_STATUS		# Make sure int disabled
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop	# 3 nop delay
 	nop
@@ -771,13 +783,12 @@
  * Restore user registers and return.
  * First disable interrupts and set exception level.
  */
-	mtc0	zero, MIPS_COP_0_STATUS		# disable interrupt
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop	# 3 clock delay before
 	nop	# exceptions blocked
 	nop	# for R4X
-	li	v0, MIPS_SR_EXL
-	mtc0	v0, MIPS_COP_0_STATUS		# set exception level
+	SET_EXCEPTION_LEVEL(v0)			# set exception level
 	COP0_SYNC
 	nop	# 3 nop delay
 	nop
@@ -946,14 +957,13 @@
  * Restore user registers and return.
  * First disable interrupts and set exception level.
  */
-	mtc0	zero, MIPS_COP_0_STATUS		# disable int
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop	# 3 op delay
 	nop
 	nop
 
-	li	v0, MIPS_SR_EXL
-	mtc0	v0, MIPS_COP_0_STATUS		# set exception level
+	SET_EXCEPTION_LEVEL(v0)			# set exception level
 	COP0_SYNC
 	nop	# 3 op delay
 	nop
@@ -1122,7 +1132,7 @@
 	INT_S	t0, TF_BASE+TF_PPL(sp)
 	.set noat
 #endif
-	mtc0	zero, MIPS_COP_0_STATUS		# Reset exl, trap possible.
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 PTR_L	MIPS_CURLWP, CPUVAR(CURLWP) # XXX Atheros HAL
 	jal	_C_LABEL(cpu_intr)
@@ -1130,7 +1140,7 @@
 /*
  * Restore registers and return from the interrupt.
  */
-	mtc0	zero, MIPS_COP_0_STATUS		# Disable interrupt
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop
 	nop
@@ -1284,13 +1294,12 @@
  * Restore registers and return from the interrupt.
  */
 	nop
-	mtc0	zero, MIPS_COP_0_STATUS
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop	# 3 nop hazard
 	nop
 	nop
-	li	v0, MIPS_SR_EXL
-	mtc0	v0, MIPS_COP_0_STATUS		# set exception level bit.
+	SET_EXCEPTION_LEVEL(v0)			# set exception level bit.
 	COP0_SYNC
 	nop	# 3 nop hazard
 	nop
@@ -1323,7 +1332,11 @@
 	jal	_C_LABEL(spllowersofthigh);
 	nop
 #else
+#ifdef _LP64
+	li	t0, MIPS_HARD_INT_MASK | MIPS_SR_INT_IE | MIPS_SR_KX
+#else
 	li	t0, MIPS_HARD_INT_MASK | MIPS_SR_INT_IE
+#endif
 	DYNAMIC_STATUS_MASK(t0, t1)		# machine dependent masking
 	mtc0	t0, MIPS_COP_0_STATUS		# enable interrupts (spl0)
 	COP0_SYNC
@@ -1333,13 +1346,12 @@
 /*
  * Restore user registers and return. NOTE: interrupts are enabled.
  */
-	mtc0	zero, MIPS_COP_0_STATUS
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop	# 3 nop delay
 	nop
 	nop
-	li	v0, MIPS_SR_EXL
-	mtc0	v0, MIPS_COP_0_STATUS		# set exception level bit.
+	SET_EXCEPTION_LEVEL(v0)			# set exception level bit.
 	COP0_SYNC
 	nop	# 3 nop delay
 	nop
@@ -1665,7 +1677,7 @@
  */
 LEAF(MIPSX(TLBWriteIndexedVPS))
 	mfc0	v1, MIPS_COP_0_STATUS		# Save the status register.
-	mtc0	zero, MIPS_COP_0_STATUS		# Disable interrupts
+	RESET_EXCEPTION_LEVEL_DISABLE_INTERRUPTS(v0)
 	COP0_SYNC
 	nop
 	lw	a2, 8(a1)			# fetch tlb-tlb_lo0
@@ -1979,13 +1991,12 @@
 	#
 	.set	noat
 1:
-	mtc0	zero, MIPS_COP_0_STATUS		# disable int
+	

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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 23:20:29 UTC 2009

Modified Files:
src/sys/arch/evbmips/adm5120 [matt-nb5-mips64]: machdep.c
src/sys/arch/evbmips/alchemy [matt-nb5-mips64]: machdep.c
src/sys/arch/evbmips/atheros [matt-nb5-mips64]: machdep.c
src/sys/arch/evbmips/malta [matt-nb5-mips64]: machdep.c

Log Message:
Update to deal with pcb_context being a label_t (this should be a common
routine).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.10.1 src/sys/arch/evbmips/adm5120/machdep.c
cvs rdiff -u -r1.37 -r1.37.10.1 src/sys/arch/evbmips/alchemy/machdep.c
cvs rdiff -u -r1.13 -r1.13.10.1 src/sys/arch/evbmips/atheros/machdep.c
cvs rdiff -u -r1.28.10.1 -r1.28.10.2 src/sys/arch/evbmips/malta/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/evbmips/adm5120/machdep.c
diff -u src/sys/arch/evbmips/adm5120/machdep.c:1.6 src/sys/arch/evbmips/adm5120/machdep.c:1.6.10.1
--- src/sys/arch/evbmips/adm5120/machdep.c:1.6	Wed Jul  2 17:28:55 2008
+++ src/sys/arch/evbmips/adm5120/machdep.c	Mon Sep  7 23:20:28 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.6 2008/07/02 17:28:55 ad Exp $ */
+/* $NetBSD: machdep.c,v 1.6.10.1 2009/09/07 23:20:28 matt Exp $ */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -107,7 +107,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.6 2008/07/02 17:28:55 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.6.10.1 2009/09/07 23:20:28 matt Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -440,7 +440,13 @@
 	v = uvm_pageboot_alloc(USPACE);
 	lwp0.l_addr = proc0paddr = (struct user *)v;
 	lwp0.l_md.md_regs = (struct frame *)(v + USPACE) - 1;
-	proc0paddr-u_pcb.pcb_context[11] =
+#ifdef _LP64
+	lwp0.l_md.md_regs-f_regs[_R_SR] = MIPS_SR_KX;
+#endif
+	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] =
+#ifdef _LP64
+	MIPS_SR_KX |
+#endif
 	MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
 	/*

Index: src/sys/arch/evbmips/alchemy/machdep.c
diff -u src/sys/arch/evbmips/alchemy/machdep.c:1.37 src/sys/arch/evbmips/alchemy/machdep.c:1.37.10.1
--- src/sys/arch/evbmips/alchemy/machdep.c:1.37	Wed Jul  2 17:28:55 2008
+++ src/sys/arch/evbmips/alchemy/machdep.c	Mon Sep  7 23:20:28 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.37 2008/07/02 17:28:55 ad Exp $ */
+/* $NetBSD: machdep.c,v 1.37.10.1 2009/09/07 23:20:28 matt Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -107,7 +107,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.37 2008/07/02 17:28:55 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.37.10.1 2009/09/07 23:20:28 matt Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -366,7 +366,13 @@
 	v = (void *) uvm_pageboot_alloc(USPACE);
 	lwp0.l_addr = proc0paddr = (struct user *)v;
 	lwp0.l_md.md_regs = (struct frame *)((char *)v + USPACE) - 1;
-	proc0paddr-u_pcb.pcb_context[11] =
+#ifdef _LP64
+	lwp0.l_md.md_regs-f_regs[_R_SR] = MIPS_SR_KX;
+#endif
+	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] =
+#ifdef _LP64
+	MIPS_SR_KX |
+#endif
 	MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
 	/*

Index: src/sys/arch/evbmips/atheros/machdep.c
diff -u src/sys/arch/evbmips/atheros/machdep.c:1.13 src/sys/arch/evbmips/atheros/machdep.c:1.13.10.1
--- src/sys/arch/evbmips/atheros/machdep.c:1.13	Wed Jul  2 17:28:55 2008
+++ src/sys/arch/evbmips/atheros/machdep.c	Mon Sep  7 23:20:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.13 2008/07/02 17:28:55 ad Exp $ */
+/* $NetBSD: machdep.c,v 1.13.10.1 2009/09/07 23:20:29 matt Exp $ */
 
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -147,7 +147,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.13 2008/07/02 17:28:55 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.13.10.1 2009/09/07 23:20:29 matt Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -312,7 +312,13 @@
 	v = (void *) uvm_pageboot_alloc(USPACE);
 	lwp0.l_addr = proc0paddr = (struct user *)v;
 	lwp0.l_md.md_regs = (struct frame *)((char *)v + USPACE) - 1;
-	proc0paddr-u_pcb.pcb_context[11] =
+#ifdef _LP64
+	lwp0.l_md.md_regs-f_regs[_R_SR] = MIPS_SR_KX;
+#endif
+	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] =
+#ifdef _LP64
+	MIPS_SR_KX |
+#endif
 	MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
 	/*

Index: src/sys/arch/evbmips/malta/machdep.c
diff -u src/sys/arch/evbmips/malta/machdep.c:1.28.10.1 src/sys/arch/evbmips/malta/machdep.c:1.28.10.2
--- src/sys/arch/evbmips/malta/machdep.c:1.28.10.1	Fri Aug 21 17:52:16 2009
+++ src/sys/arch/evbmips/malta/machdep.c	Mon Sep  7 23:20:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.28.10.1 2009/08/21 17:52:16 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.28.10.2 2009/09/07 23:20:29 matt Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi 

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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 23:46:46 UTC 2009

Modified Files:
src/sys/arch/arc/arc [matt-nb5-mips64]: machdep.c
src/sys/arch/cobalt/cobalt [matt-nb5-mips64]: machdep.c
src/sys/arch/ews4800mips/ews4800mips [matt-nb5-mips64]: machdep.c
src/sys/arch/hpcmips/hpcmips [matt-nb5-mips64]: machdep.c
src/sys/arch/mipsco/mipsco [matt-nb5-mips64]: machdep.c
src/sys/arch/newsmips/newsmips [matt-nb5-mips64]: machdep.c
src/sys/arch/playstation2/playstation2 [matt-nb5-mips64]: machdep.c
src/sys/arch/pmax/pmax [matt-nb5-mips64]: machdep.c
src/sys/arch/sgimips/sgimips [matt-nb5-mips64]: machdep.c

Log Message:
Deal with pcb_context being a label_t


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.112.10.1 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.98 -r1.98.10.1 src/sys/arch/cobalt/cobalt/machdep.c
cvs rdiff -u -r1.14 -r1.14.10.1 \
src/sys/arch/ews4800mips/ews4800mips/machdep.c
cvs rdiff -u -r1.96.10.1 -r1.96.10.2 src/sys/arch/hpcmips/hpcmips/machdep.c
cvs rdiff -u -r1.58 -r1.58.10.1 src/sys/arch/mipsco/mipsco/machdep.c
cvs rdiff -u -r1.98 -r1.98.10.1 src/sys/arch/newsmips/newsmips/machdep.c
cvs rdiff -u -r1.23 -r1.23.10.1 \
src/sys/arch/playstation2/playstation2/machdep.c
cvs rdiff -u -r1.223.8.1 -r1.223.8.1.2.1 src/sys/arch/pmax/pmax/machdep.c
cvs rdiff -u -r1.121 -r1.121.8.1 src/sys/arch/sgimips/sgimips/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/arc/arc/machdep.c
diff -u src/sys/arch/arc/arc/machdep.c:1.112 src/sys/arch/arc/arc/machdep.c:1.112.10.1
--- src/sys/arch/arc/arc/machdep.c:1.112	Wed Jul  2 17:28:55 2008
+++ src/sys/arch/arc/arc/machdep.c	Mon Sep  7 23:46:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.112 2008/07/02 17:28:55 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.112.10.1 2009/09/07 23:46:45 matt Exp $	*/
 /*	$OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $	*/
 
 /*
@@ -78,7 +78,7 @@
 /* from: Utah Hdr: machdep.c 1.63 91/04/24 */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.112 2008/07/02 17:28:55 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.112.10.1 2009/09/07 23:46:45 matt Exp $);
 
 #include fs_mfs.h
 #include opt_ddb.h
@@ -498,7 +498,7 @@
 	v = uvm_pageboot_alloc(USPACE);
 	lwp0.l_addr = proc0paddr = (struct user *)v;
 	lwp0.l_md.md_regs = (struct frame *)(v + USPACE) - 1;
-	proc0paddr-u_pcb.pcb_context[11] =
+	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] =
 	MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 }
 

Index: src/sys/arch/cobalt/cobalt/machdep.c
diff -u src/sys/arch/cobalt/cobalt/machdep.c:1.98 src/sys/arch/cobalt/cobalt/machdep.c:1.98.10.1
--- src/sys/arch/cobalt/cobalt/machdep.c:1.98	Wed Jul  2 17:28:55 2008
+++ src/sys/arch/cobalt/cobalt/machdep.c	Mon Sep  7 23:46:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.98 2008/07/02 17:28:55 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.98.10.1 2009/09/07 23:46:45 matt Exp $	*/
 
 /*-
  * Copyright (c) 2006 Izumi Tsutsui.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.98 2008/07/02 17:28:55 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.98.10.1 2009/09/07 23:46:45 matt Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -320,7 +320,13 @@
 	v = (char *)uvm_pageboot_alloc(USPACE);
 	lwp0.l_addr = proc0paddr = (struct user *)v;
 	lwp0.l_md.md_regs = (struct frame *)(v + USPACE) - 1;
-	proc0paddr-u_pcb.pcb_context[11] =
+#ifdef _LP64
+	lwp0.l_md.md_regs-f_regs[_R_SR] = MIPS_SR_KX;
+#endif
+	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] =
+#ifdef _LP64
+	MIPS_SR_KX |
+#endif
 	MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 }
 

Index: src/sys/arch/ews4800mips/ews4800mips/machdep.c
diff -u src/sys/arch/ews4800mips/ews4800mips/machdep.c:1.14 src/sys/arch/ews4800mips/ews4800mips/machdep.c:1.14.10.1
--- src/sys/arch/ews4800mips/ews4800mips/machdep.c:1.14	Wed Jul  2 17:28:55 2008
+++ src/sys/arch/ews4800mips/ews4800mips/machdep.c	Mon Sep  7 23:46:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.14 2008/07/02 17:28:55 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.14.10.1 2009/09/07 23:46:46 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2004, 2005 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.14 2008/07/02 17:28:55 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.14.10.1 2009/09/07 23:46:46 matt Exp $);
 
 #include opt_ddb.h
 
@@ -174,7 +174,7 @@
 	v = (void *)uvm_pageboot_alloc(USPACE);	/* proc0 USPACE */
 	lwp0.l_addr = proc0paddr = (struct user *) v;
 	lwp0.l_md.md_regs = (struct frame *)((char *)v + USPACE) - 1;
-	proc0paddr-u_pcb.pcb_context[11] =
+	lwp0.l_addr-u_pcb.pcb_context.val[_L_SR] =
 	MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 }
 

Index: src/sys/arch/hpcmips/hpcmips/machdep.c
diff -u 

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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  7 23:47:27 UTC 2009

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

Log Message:
Need a #include assym.h


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.96.1 src/sys/arch/mips/mips/cache_r3k_subr.S
cvs rdiff -u -r1.1 -r1.1.126.1 src/sys/arch/mips/mips/cache_r5k_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/cache_r3k_subr.S
diff -u src/sys/arch/mips/mips/cache_r3k_subr.S:1.4 src/sys/arch/mips/mips/cache_r3k_subr.S:1.4.96.1
--- src/sys/arch/mips/mips/cache_r3k_subr.S:1.4	Sun Dec 11 12:18:09 2005
+++ src/sys/arch/mips/mips/cache_r3k_subr.S	Mon Sep  7 23:47:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache_r3k_subr.S,v 1.4 2005/12/11 12:18:09 christos Exp $	*/
+/*	$NetBSD: cache_r3k_subr.S,v 1.4.96.1 2009/09/07 23:47:27 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -52,6 +52,8 @@
 #include mips/asm.h
 #include mips/cpuregs.h
 
+#include assym.h
+
 	.set noreorder
 
 /*

Index: src/sys/arch/mips/mips/cache_r5k_subr.S
diff -u src/sys/arch/mips/mips/cache_r5k_subr.S:1.1 src/sys/arch/mips/mips/cache_r5k_subr.S:1.1.126.1
--- src/sys/arch/mips/mips/cache_r5k_subr.S:1.1	Sat Mar  8 04:43:25 2003
+++ src/sys/arch/mips/mips/cache_r5k_subr.S	Mon Sep  7 23:47:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache_r5k_subr.S,v 1.1 2003/03/08 04:43:25 rafal Exp $ 	*/
+/*	$NetBSD: cache_r5k_subr.S,v 1.1.126.1 2009/09/07 23:47:27 matt Exp $ 	*/
 
 /*
  * Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,8 @@
 #include mips/cache_r4k.h
 #include mips/cache_r5k.h
 
+#include assym.h
+
 	.set mips3
 	.set noreorder
 
@@ -74,4 +76,3 @@
 	j	ra
 	nop	
 END(r5k_enable_sdcache)
-



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep  8 00:24:01 UTC 2009

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

Log Message:
Use XKPHYS to read mem on _LP64.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.38.1 src/sys/arch/mips/mips/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/mips/mips/mem.c
diff -u src/sys/arch/mips/mips/mem.c:1.35 src/sys/arch/mips/mips/mem.c:1.35.38.1
--- src/sys/arch/mips/mips/mem.c:1.35	Wed Oct 17 19:55:38 2007
+++ src/sys/arch/mips/mips/mem.c	Tue Sep  8 00:24:01 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.35 2007/10/17 19:55:38 garbled Exp $	*/
+/*	$NetBSD: mem.c,v 1.35.38.1 2009/09/08 00:24:01 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -80,7 +80,7 @@
 #include opt_mips_cache.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.35 2007/10/17 19:55:38 garbled Exp $);
+__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.35.38.1 2009/09/08 00:24:01 matt Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -94,6 +94,9 @@
 #include machine/cpu.h
 
 #include mips/cache.h
+#ifdef _LP64
+#include mips/mips3_pte.h
+#endif
 
 #include uvm/uvm_extern.h
 
@@ -146,7 +149,12 @@
 			 */
 			if (v + c  ctob(physmem))
 return (EFAULT);
-			v += MIPS_KSEG0_START;
+#ifdef _LP64
+			v = MIPS_PHYS_TO_XKPHYS(
+			 MIPS3_PG_TO_CCA(MIPS3_PG_CACHED), v);
+#else
+			v = MIPS_PHYS_TO_KSEG0(v);
+#endif
 			error = uiomove((void *)v, c, uio);
 #if defined(MIPS3_PLUS)
 			if (mips_cache_virtual_alias)
@@ -158,6 +166,7 @@
 			v = uio-uio_offset;
 			c = min(iov-iov_len, MAXPHYS);
 			if (v  MIPS_KSEG0_START)
+			if (v  MIPS_KSEG0_START)
 return (EFAULT);
 			if (v  MIPS_PHYS_TO_KSEG0(avail_end +
 	mips_round_page(MSGBUFSIZE) - c) 



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep  8 00:51:14 UTC 2009

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

Log Message:
Teach cpu_switch_resume to deal with upages in XKSEG/KSEG0/XKSEG.
(don't use s0, use t0)


To generate a diff of this commit:
cvs rdiff -u -r1.26.36.1.2.7 -r1.26.36.1.2.8 \
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.7 src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.8
--- src/sys/arch/mips/mips/mipsX_subr.S:1.26.36.1.2.7	Mon Sep  7 22:32:52 2009
+++ src/sys/arch/mips/mips/mipsX_subr.S	Tue Sep  8 00:51:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.7 2009/09/07 22:32:52 matt Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.26.36.1.2.8 2009/09/08 00:51:14 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -357,7 +357,7 @@
 	eret	#1b: return from exception
 4:	j _C_LABEL(MIPSX(TLBMissException))	#1c: kernel exception
 	nop	#1d: branch delay slot
-5:	j	slowfault			#1e: no page table present
+5:	j	MIPSX(slowfault)		#1e: no page table present
 	nop	#1f: branch delay slot
 	.set	at
 _VECTOR_END(MIPSX(TLBMiss))
@@ -410,7 +410,7 @@
 	eret	#1b: return from exception
 4:	j _C_LABEL(MIPSX(TLBMissException))	#1c: kernel exception
 	nop	#1d: branch delay slot
-5:	j	slowfault			#1e: no page table present
+5:	j	MIPSX(slowfault)		#1e: no page table present
 	nop	#1f: branch delay slot
 	.set	at
 _VECTOR_END(MIPSX(XTLBMiss))
@@ -484,7 +484,7 @@
 
 /*
  *
- * slowfault --
+ * MIPSX(slowfault) --
  *
  * Alternate entry point into the mips3_UserGenException or
  * mips3_KernGenException, when the ULTB miss handler couldn't
@@ -499,7 +499,7 @@
  * We couldn't find a TLB entry.
  * Find out what mode we came from and call the appropriate handler.
  */
-slowfault:
+MIPSX(slowfault):
 	.set	noat
 	mfc0	k0, MIPS_COP_0_STATUS
 	nop
@@ -1456,7 +1456,12 @@
 LEAF_NOPROFILE(MIPSX(TLBInvalidException))
 	.set	noat
 	_MFC0	k0, MIPS_COP_0_BAD_VADDR	# get the fault address
+#if VM_MIN_KERNEL_ADDRESS == MIPS_KSEG2_START
 	li	k1, VM_MIN_KERNEL_ADDRESS	# compute index
+#else
+	li	k1, VM_MIN_KERNEL_ADDRESS32	# compute index
+	dsll32	k1, k1, 0
+#endif
 	bgez	k0, _C_LABEL(MIPSX(KernGenException))	# full trap processing
 	PTR_SUBU k0, k0, k1
 	INT_L	k1, _C_LABEL(Sysmapsize)	# index within range?
@@ -1558,7 +1563,12 @@
 LEAF_NOPROFILE(MIPSX(TLBMissException))
 	.set	noat
 	_MFC0	k0, MIPS_COP_0_BAD_VADDR	# get the fault address
+#if VM_MIN_KERNEL_ADDRESS == MIPS_KSEG2_START
 	li	k1, VM_MIN_KERNEL_ADDRESS	# compute index
+#else
+	li	k1, VM_MIN_KERNEL_ADDRESS32	# compute index
+	dsll32	k1, k1, 0
+#endif
 	PTR_SUBU k0, k0, k1
 	INT_L	k1, _C_LABEL(Sysmapsize)	# index within range?
 	PTR_SRL	k0, k0, PGSHIFT
@@ -1607,7 +1617,12 @@
 	PTR_SLL	k0, k0, PGSHIFT
 	_MTC0	a0, MIPS_COP_0_EXC_PC		# return to panic
 	COP0_SYNC
-	li	k1, VM_MIN_KERNEL_ADDRESS
+#if VM_MIN_KERNEL_ADDRESS == MIPS_KSEG2_START
+	li	k1, VM_MIN_KERNEL_ADDRESS	# compute index
+#else
+	li	k1, VM_MIN_KERNEL_ADDRESS32	# compute index
+	dsll32	k1, k1, 0
+#endif
 	PTR_ADDU a3, k0, k1
 #if defined(DDB)
 	bltz	sp, 1f# for ddb try to keep frame
@@ -2086,18 +2101,23 @@
 	INT_L	a1, L_MD_UPTE_0(a0)		# a1 = upte[0]
 	INT_L	a2, L_MD_UPTE_1(a0)		# a2 = upte[1]
 	PTR_L	v0, L_ADDR(a0)			# va = l-l_addr
-	li	s0, VM_MIN_KERNEL_ADDRESS
-#if VM_MIN_KERNEL_ADDRESS  MIPS_KSEG0_START
-	blt	v0, s0, resume
-	nop
+#if VM_MIN_KERNEL_ADDRESS == MIPS_KSEG2_START
+	li	t0, VM_MIN_KERNEL_ADDRESS	# compute index
+	blt	v0, t0, resume
+	 nop
 #else
-	blt	s0, v0, resume
-	nop
+	li	t0, MIPS_KSEG0_START		# above XKSEG?
+	blt	t0, v0, resume
+	 nop
+	li	t0, VM_MIN_KERNEL_ADDRESS32	# below XKSEG?
+	dsll32	t0, t0, 0
+	blt	v0, t0, resume
+	 nop
 #endif
 
-	and	s0, v0, MIPS3_PG_ODDPG
-	beq	s0, zero, entry0
-	nop
+	and	t0, v0, MIPS3_PG_ODDPG
+	beq	t0, zero, entry0
+	 nop
 
 	PANIC(USPACE sat on odd page boundary)
 
@@ -2110,12 +2130,12 @@
 	COP0_SYNC
 	nop
 	nop
-	mfc0	s0, MIPS_COP_0_TLB_INDEX
+	mfc0	t0, MIPS_COP_0_TLB_INDEX
 	nop
-	bltz	s0, entry0set
-	sll	s0, s0, PGSHIFT + 1		# PAGE_SHIFT + 1
-	PTR_LA	s0, MIPS_KSEG0_START(s0)
-	_MTC0	s0, MIPS_COP_0_TLB_HI
+	bltz	t0, entry0set
+	sll	t0, t0, PGSHIFT + 1		# PAGE_SHIFT + 1
+	PTR_LA	t0, MIPS_KSEG0_START(s0)
+	_MTC0	t0, MIPS_COP_0_TLB_HI
 	COP0_SYNC
 	_MTC0	zero, MIPS_COP_0_TLB_LO0
 	COP0_SYNC



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

2009-09-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep  8 00:52:14 UTC 2009

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: vmparam.h

Log Message:
On LP64 kernels, move kernel mapped to XKSEG.


To generate a diff of this commit:
cvs rdiff -u -r1.41.28.2 -r1.41.28.3 src/sys/arch/mips/include/vmparam.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/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.41.28.2 src/sys/arch/mips/include/vmparam.h:1.41.28.3
--- src/sys/arch/mips/include/vmparam.h:1.41.28.2	Thu Sep  3 07:27:21 2009
+++ src/sys/arch/mips/include/vmparam.h	Tue Sep  8 00:52:14 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.41.28.2 2009/09/03 07:27:21 matt Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.41.28.3 2009/09/08 00:52:14 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -147,6 +147,16 @@
  * These are negative addresses since MIPS addresses are signed.
  */
 #define VM_MIN_ADDRESS		((vaddr_t)0x)
+#ifdef _LP64
+#if 1
+#define VM_MAXUSER_ADDRESS	((vaddr_t) 1L  31)	/* 0x8000 */
+#else
+#define VM_MAXUSER_ADDRESS	((vaddr_t) 1L  62)	/* 0x4000 */
+#endif
+#define VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
+#define VM_MIN_KERNEL_ADDRESS	((vaddr_t) 3L  62)	/* 0xC000 */
+#define VM_MAX_KERNEL_ADDRESS	((vaddr_t) -1L  31)	/* 0x8000 */
+#else
 #define VM_MAXUSER_ADDRESS	((vaddr_t)-0x7fff-1)/* 0x8000 */
 #define VM_MAX_ADDRESS		((vaddr_t)-0x7fff-1)/* 0x8000 */
 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)-0x4000)	/* 0xC000 */
@@ -155,6 +165,7 @@
 #else
 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t)-0x4000)	/* 0xC000 */
 #endif
+#endif
 
 /*
  * The address to which unspecified mapping requests default