CVS commit: src/sys/uvm

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep  4 13:37:44 UTC 2012

Modified Files:
src/sys/uvm: uvm_km.c uvm_map.c

Log Message:
Remove locking since it isn't needed.  As soon as the 2nd uvm_map_entry in 
kernel_map
is created, uvm_map_prepare will call pmap_growkernel and the pmap_growkernel 
call in
uvm_km_mem_alloc will never be called again.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.321 -r1.322 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.133 src/sys/uvm/uvm_km.c:1.134
--- src/sys/uvm/uvm_km.c:1.133	Mon Sep  3 19:53:42 2012
+++ src/sys/uvm/uvm_km.c	Tue Sep  4 13:37:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.133 2012/09/03 19:53:42 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.134 2012/09/04 13:37:41 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -152,7 +152,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.133 2012/09/03 19:53:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.134 2012/09/04 13:37:41 matt Exp $);
 
 #include opt_uvmhist.h
 
@@ -784,15 +784,16 @@ again:
 	/*
 	 * These VA allocations happen independently of uvm_map so if this allocation
 	 * extends beyond the current limit, then allocate more resources for it.
+	 * This can only happen while the kmem_map is the only map entry in the
+	 * kernel_map because as soon as another map entry is created, uvm_map_prepare
+	 * will set uvm_maxkaddr to an address beyond the kmem_map.
 	 */
-	mutex_enter(uvm_kentry_lock);
 	if (uvm_maxkaddr  va + size) {
 		uvm_maxkaddr = pmap_growkernel(va + size);
 		KASSERTMSG(uvm_maxkaddr = va + size,
 		%#PRIxVADDR %#PRIxPTR %#zx,
 		uvm_maxkaddr, va, size);
 	}
-	mutex_exit(uvm_kentry_lock);
 #endif
 
 	loopva = va;

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.321 src/sys/uvm/uvm_map.c:1.322
--- src/sys/uvm/uvm_map.c:1.321	Mon Sep  3 19:53:42 2012
+++ src/sys/uvm/uvm_map.c	Tue Sep  4 13:37:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.321 2012/09/03 19:53:42 matt Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.322 2012/09/04 13:37:42 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.321 2012/09/03 19:53:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.322 2012/09/04 13:37:42 matt Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -1182,10 +1182,8 @@ retry:
 	 * If the kernel pmap can't map the requested space,
 	 * then allocate more resources for it.
 	 */
-	mutex_enter(uvm_kentry_lock);
 	if (map == kernel_map  uvm_maxkaddr  (start + size))
 		uvm_maxkaddr = pmap_growkernel(start + size);
-	mutex_exit(uvm_kentry_lock);
 #endif
 
 	UVMMAP_EVCNT_INCR(map_call);



CVS commit: src/tests/net/icmp

2012-09-04 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Sep  4 22:31:59 UTC 2012

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Replace usleep(50) with a synchronization over a pipe.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/icmp/t_ping.c

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

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.14 src/tests/net/icmp/t_ping.c:1.15
--- src/tests/net/icmp/t_ping.c:1.14	Sun Jun 26 13:15:22 2011
+++ src/tests/net/icmp/t_ping.c	Tue Sep  4 22:31:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.14 2011/06/26 13:15:22 christos Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.15 2012/09/04 22:31:58 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.14 2011/06/26 13:15:22 christos Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.15 2012/09/04 22:31:58 alnsn Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -68,6 +68,10 @@ ATF_TC_BODY(simpleping, tc)
 	char ifname[IFNAMSIZ];
 	pid_t cpid;
 	bool win, win2;
+	char token;
+	int channel[2];
+
+	RL(pipe(channel));
 
 	cpid = fork();
 	rump_init();
@@ -78,13 +82,18 @@ ATF_TC_BODY(simpleping, tc)
 		atf_tc_fail_errno(fork failed);
 	case 0:
 		netcfg_rump_if(ifname, 1.1.1.10, 255.255.255.0);
+		close(channel[0]);
+		ATF_CHECK(write(channel[1], U, 1) == 1);
+		close(channel[1]);
 		pause();
 		break;
 	default:
 		break;
 	}
 
-	usleep(50);
+	close(channel[1]);
+	ATF_CHECK(read(channel[0], token, 1) == 1  token == 'U');
+	close(channel[0]);
 
 	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
 



CVS commit: src/sys/arch/evbarm/gumstix

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep  4 22:58:35 UTC 2012

Modified Files:
src/sys/arch/evbarm/gumstix: if_smsh_gpmc.c

Log Message:
Add support for getting the mac-address from the device properties.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/gumstix/if_smsh_gpmc.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/evbarm/gumstix/if_smsh_gpmc.c
diff -u src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c:1.2 src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c:1.3
--- src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c:1.2	Tue Sep  4 00:19:48 2012
+++ src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c	Tue Sep  4 22:58:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsh_gpmc.c,v 1.2 2012/09/04 00:19:48 matt Exp $	*/
+/*	$NetBSD: if_smsh_gpmc.c,v 1.3 2012/09/04 22:58:35 matt Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_smsh_gpmc.c,v 1.2 2012/09/04 00:19:48 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_smsh_gpmc.c,v 1.3 2012/09/04 22:58:35 matt Exp $);
+
+#include locators.h
 
 #include sys/param.h
 #include sys/device.h
@@ -34,8 +36,6 @@ __KERNEL_RCSID(0, $NetBSD: if_smsh_gpmc
 #include sys/bus.h
 #include sys/systm.h
 
-#include arm/omap/omap2_gpmcvar.h
-
 #include net/if.h
 #include net/if_ether.h
 #include net/if_media.h
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, $NetBSD: if_smsh_gpmc
 #include dev/ic/lan9118var.h
 #include dev/ic/lan9118reg.h
 
-#include locators.h
+#include arm/omap/omap2_gpmcvar.h
 
 
 static int smsh_gpmc_match(device_t, struct cfdata *, void *);
@@ -90,10 +90,23 @@ smsh_gpmc_attach(device_t parent, device
 {
 	struct lan9118_softc *sc = device_private(self);
 	struct gpmc_attach_args *gpmc = aux;
+	prop_dictionary_t dict = device_properties(self);
 	void *ih;
 
 	sc-sc_dev = self;
 
+	/*
+	 * Prefer the Ethernet address in device properties.
+	 */
+	prop_data_t ea = prop_dictionary_get(dict, mac-address);
+	if (ea != NULL) {
+		KASSERT(prop_object_type(ea) == PROP_TYPE_DATA);
+		KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN);
+		memcpy(sc-sc_enaddr, prop_data_data_nocopy(ea),
+		ETHER_ADDR_LEN);
+		sc-sc_flags |= LAN9118_FLAGS_NO_EEPROM;
+	}
+
 	/* Map i/o space. */
 	if (bus_space_map(gpmc-gpmc_iot, gpmc-gpmc_addr, LAN9118_IOSIZE, 0,
 	sc-sc_ioh))



CVS commit: src/sys/arch/evbarm

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 00:06:21 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c beagle_start.S
src/sys/arch/evbarm/conf: PANDABOARD

Log Message:
Get the PANDABOARD to boot (hangs in USB).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/beagle/beagle_start.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/PANDABOARD

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/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.21 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.22
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.21	Tue Sep  4 00:19:20 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Sep  5 00:06:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.21 2012/09/04 00:19:20 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.22 2012/09/05 00:06:21 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: beagle_machdep.c,v 1.21 2012/09/04 00:19:20 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: beagle_machdep.c,v 1.22 2012/09/05 00:06:21 matt Exp $);
 
 #include opt_machdep.h
 #include opt_ddb.h
@@ -167,12 +167,14 @@ __KERNEL_RCSID(0, $NetBSD: beagle_machd
 #include arm/undefined.h
 
 #include arm/arm32/machdep.h
+#include arm/mainbus/mainbus.h
 
 #include arm/omap/omap_com.h
 #include arm/omap/omap_var.h
 #include arm/omap/omap_wdtvar.h
 #include arm/omap/omap2_prcm.h
 
+#include evbarm/include/autoconf.h
 #include evbarm/beagle/beagle.h
 
 #include prcm.h
@@ -182,6 +184,8 @@ BootConfig bootconfig;		/* Boot config s
 char *boot_args = NULL;
 char *boot_file = NULL;
 
+u_int uboot_args[4] = { 0 };	/* filled in by beagle_start.S (not in bss) */
+
 /* Same things, but for the free (unused by the kernel) memory. */
 
 extern char KERNEL_BASE_phys[];
@@ -201,6 +205,7 @@ static void kgdb_port_init(void);
 #endif
 
 static void init_clocks(void);
+static void beagle_device_register(device_t, void *);
 static void beagle_reset(void);
 #if defined(OMAP_3530) || defined(TI_DM37XX)
 static void omap3_cpu_clk(void);
@@ -368,7 +373,6 @@ initarm(void *arg)
 	omap3_cpu_clk();		// find our CPU speed.
 #endif
 #if defined(OMAP_4430)
-	if (0)
 	omap4_cpu_clk();		// find our CPU speed.
 #endif
 	/* Heads up ... Setup the CPU / MMU / TLB functions. */
@@ -383,6 +387,8 @@ initarm(void *arg)
 #if 1
 	beagle_putchar('h');
 #endif
+	printf(uboot arg = %#x, %#x, %#x, %#x\n,
+	uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);
 #ifdef KGDB
 	kgdb_port_init();
 #endif
@@ -419,7 +425,7 @@ initarm(void *arg)
 	arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, false);
 
 	/* we've a specific device_register routine */
-	//evbarm_device_register = beagle_device_register;
+	evbarm_device_register = beagle_device_register;
 
 	db_trap_callback = beagle_db_trap;
 
@@ -487,12 +493,16 @@ consinit(void)
 void
 beagle_reset(void)
 {
+#if defined(OMAP_4430)
+	*(volatile uint32_t *)(OMAP_L4_CORE_VBASE + (OMAP_L4_WAKEUP_BASE - OMAP_L4_CORE_BASE) + OMAP4_PRM_RSTCTRL) = OMAP4_PRM_RSTCTRL_WARM;
+#else
 #if NPRCM  0
 	prcm_cold_reset();
 #endif
 #if NOMAPWDT32K  0
 	omapwdt32k_reboot();
 #endif
+#endif
 }
 
 #ifdef KGDB
@@ -572,6 +582,42 @@ omap4_cpu_clk(void)
 	/*
 	 * MPU_CLK supplies ARM_FCLK which is twice the CPU frequency.
 	 */
-	curcpu()-ci_data.cpu_cc_freq = ((sys_clk * 2 * m) / ((n + 1) * m2)) * OMAP4_CM_CLKSEL_MULT;
+	curcpu()-ci_data.cpu_cc_freq = ((sys_clk * 2 * m) / ((n + 1) * m2)) * OMAP4_CM_CLKSEL_MULT / 2;
+	printf(%s: %PRIu64: sys_clk=%u m=%u n=%u (%u) m2=%u mult=%u\n,
+	__func__, curcpu()-ci_data.cpu_cc_freq,
+	sys_clk, m, n, n+1, m2, OMAP4_CM_CLKSEL_MULT);
 }
 #endif /* OMAP_4400 */
+
+void
+beagle_device_register(device_t self, void *aux)
+{
+	prop_dictionary_t dict = device_properties(self);
+
+	if (device_is_a(self, armperiph)
+	 device_is_a(device_parent(self), mainbus)) {
+		/*
+		 * XXX KLUDGE ALERT XXX
+		 * The iot mainbus supplies is completely wrong since it scales
+		 * addresses by 2.  The simpliest remedy is to replace with our
+		 * bus space used for the armcore regisers (which armperiph uses). 
+		 */
+		struct mainbus_attach_args * const mb = aux;
+		mb-mb_iot = omap_bs_tag;
+		return;
+	}
+ 
+	/*
+	 * We need to tell the A9 Global/Watchdog Timer
+	 * what frequency it runs at.
+	 */
+	if (device_is_a(self, a9tmr) || device_is_a(self, a9wdt)) {
+		/*
+		 * This clock always runs at (arm_clk div 2) and only goes
+		 * to timers that are part of the A9 MP core subsystem.
+		 */
+prop_dictionary_set_uint32(dict, frequency,
+		curcpu()-ci_data.cpu_cc_freq / 2);
+		return;
+	}	
+}

Index: 

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

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 00:07:33 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: IGEPV2

Log Message:
modify USB entries (still commented out).


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/conf/IGEPV2

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/evbarm/conf/IGEPV2
diff -u src/sys/arch/evbarm/conf/IGEPV2:1.11 src/sys/arch/evbarm/conf/IGEPV2:1.12
--- src/sys/arch/evbarm/conf/IGEPV2:1.11	Tue Sep  4 00:19:20 2012
+++ src/sys/arch/evbarm/conf/IGEPV2	Wed Sep  5 00:07:33 2012
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: IGEPV2,v 1.11 2012/09/04 00:19:20 matt Exp $
+#	$NetBSD: IGEPV2,v 1.12 2012/09/05 00:07:33 matt Exp $
 #
 #	IGEPv2 -- TI OMAP 3530 Eval Board Kernel
 #
@@ -139,7 +139,7 @@ options		DDB_ONPANIC=1
 options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	KGDB
 makeoptions	DEBUG=-g	# compile full symbol table
-options 	SYMTAB_SPACE=50
+options 	SYMTAB_SPACE=52
 
 ## USB Debugging options
 options USB_DEBUG
@@ -250,13 +250,14 @@ omapwdt32k*	at obio2 addr 0x4903 siz
 prcm*		at obio1 addr 0x48306000 size 0x2000	# PRM Module
 
 # On-board USB
-#ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
 #ohci*		at obio0 addr 0x48064400 size 0x0400 intr 76
+#ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
 #usb*		at ohci?
 #uhub*		at usb?
-##umass*		at uhub? port ? configuration ? interface ?
-##wd*		at umass?
-#axe*		at uhub? port ? configuration ? interface ?
+#umass*		at uhub? port ? configuration ? interface ?
+#scsibus*	at scsi?
+#sd*		at scsibus ? target ? lun ?
+#wd*		at umass?
 
 # Hardware clocking and power management
 



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

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 00:08:21 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: BEAGLEBOARDXM

Log Message:
Modify USB entries (still commented out)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/BEAGLEBOARDXM

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/evbarm/conf/BEAGLEBOARDXM
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.4 src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.5
--- src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.4	Thu Aug 23 01:27:24 2012
+++ src/sys/arch/evbarm/conf/BEAGLEBOARDXM	Wed Sep  5 00:08:21 2012
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARDXM,v 1.4 2012/08/23 01:27:24 matt Exp $
+#	$NetBSD: BEAGLEBOARDXM,v 1.5 2012/09/05 00:08:21 matt Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -252,13 +252,15 @@ pseudo-device	wsfont
 prcm*		at obio1 addr 0x48306000 size 0x2000	# PRM Module
 
 # On-board USB
-#ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
 #ohci*		at obio0 addr 0x48064400 size 0x0400 intr 76
+#ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
 #usb*		at ohci?
 #usb*		at ehci?
 #uhub*		at usb?
 #uhub*		at uhub? port ?
 #umass*		at uhub? port ? configuration ? interface ?
+#scsibus*	at scsi?
+#sd*		at scsibus? target ? lun ?
 #wd*		at umass?
 #uhidev*		at uhub?
 #ukbd*		at uhidev?



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

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 00:09:35 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: files.beagle

Log Message:
cortex include moved arm/omap/files.omap2


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/files.beagle

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/evbarm/conf/files.beagle
diff -u src/sys/arch/evbarm/conf/files.beagle:1.3 src/sys/arch/evbarm/conf/files.beagle:1.4
--- src/sys/arch/evbarm/conf/files.beagle:1.3	Tue Sep  4 00:19:20 2012
+++ src/sys/arch/evbarm/conf/files.beagle	Wed Sep  5 00:09:35 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.beagle,v 1.3 2012/09/04 00:19:20 matt Exp $
+#	$NetBSD: files.beagle,v 1.4 2012/09/05 00:09:35 matt Exp $
 #
 # TI OMAP2 evaluation board configuration info
 #
@@ -14,7 +14,6 @@ defparam opt_machdep.hBOOT_ARGS
 
 # CPU support and integrated peripherals
 include arch/arm/omap/files.omap2
-include arch/arm/cortex/files.cortex
 
 # NS16550 compatible serial ports
 attach com at obio with obiouart



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

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 00:10:11 UTC 2012

Modified Files:
src/sys/arch/evbarm/include: autoconf.h

Log Message:
Allow arm/mainbus/mainbus.h to supply mainbus_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/include/autoconf.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/evbarm/include/autoconf.h
diff -u src/sys/arch/evbarm/include/autoconf.h:1.5 src/sys/arch/evbarm/include/autoconf.h:1.6
--- src/sys/arch/evbarm/include/autoconf.h:1.5	Mon Apr 28 20:23:16 2008
+++ src/sys/arch/evbarm/include/autoconf.h	Wed Sep  5 00:10:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.h,v 1.5 2008/04/28 20:23:16 martin Exp $	*/
+/*	$NetBSD: autoconf.h,v 1.6 2012/09/05 00:10:11 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -32,9 +32,11 @@
 #ifndef _EVBARM_AUTOCONF_H_
 #define	_EVBARM_AUTOCONF_H_
 
+#ifndef _ARM_MAINBUS_MAINBUS_H_
 struct mainbus_attach_args {
 	const char *ma_name;
 };
+#endif
 
 struct device;
 extern void (*evbarm_device_register)(struct device *, void *);



CVS commit: src/sys/arch/arm/arm32

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 00:11:21 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
After calling lwp_startup, set fp to 0 to terminate call stack.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.71 src/sys/arch/arm/arm32/cpuswitch.S:1.72
--- src/sys/arch/arm/arm32/cpuswitch.S:1.71	Sat Sep  1 22:20:52 2012
+++ src/sys/arch/arm/arm32/cpuswitch.S	Wed Sep  5 00:11:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.71 2012/09/01 22:20:52 matt Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.72 2012/09/05 00:11:20 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -89,7 +89,7 @@
 #include machine/asm.h
 #include machine/cpu.h
 
-	RCSID($NetBSD: cpuswitch.S,v 1.71 2012/09/01 22:20:52 matt Exp $)
+	RCSID($NetBSD: cpuswitch.S,v 1.72 2012/09/05 00:11:20 matt Exp $)
 
 /* LINTSTUB: include sys/param.h */
 	
@@ -335,6 +335,7 @@ ENTRY(lwp_trampoline)
 	 */
 	bl	_C_LABEL(lwp_startup)
 
+	mov	fp, #0			/* top stack frame */
 	mov	r0, r5
 	mov	r1, sp
 #ifdef _ARM_ARCH_5



CVS commit: src/sys/arch/arm/cortex

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 00:21:30 UTC 2012

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S

Log Message:
Force TTBCR to 0


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/cortex/a9_mpsubr.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/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.2 src/sys/arch/arm/cortex/a9_mpsubr.S:1.3
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.2	Sun Sep  2 05:01:54 2012
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Wed Sep  5 00:21:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.2 2012/09/02 05:01:54 matt Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.3 2012/09/05 00:21:30 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -135,10 +135,14 @@ a9_cpuinit:
 	mcr	p15, 0, r1, c8, c7, 0	/* Invalidate TLBs */
 
 	/* Set the Domain Access register.  Very important! */
-	XPUTC(#74)
+	XPUTC(#73)
 	mov r1, #((DOMAIN_CLIENT  (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
 	mcr	p15, 0, r1, c3, c0, 0
 
+	XPUTC(#74)
+	mov	r0, #0			/* make sure TTBCR is 0 */
+	mcr	p15, 0, r0, c1, c0, 2
+	
 	/*
 	 * Enable the MMU, etc.
 	 */



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

2012-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  5 01:03:54 UTC 2012

Modified Files:
src/sys/arch/arm/include: byte_swap.h

Log Message:
Disable arm32 __asm for _byte_swap_u16_variable since gcc4.5 produces
decent code for it.  Fixes PR/46898.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/byte_swap.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/arm/include/byte_swap.h
diff -u src/sys/arch/arm/include/byte_swap.h:1.11 src/sys/arch/arm/include/byte_swap.h:1.12
--- src/sys/arch/arm/include/byte_swap.h:1.11	Fri Jul 20 18:53:34 2012
+++ src/sys/arch/arm/include/byte_swap.h	Wed Sep  5 01:03:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: byte_swap.h,v 1.11 2012/07/20 18:53:34 matt Exp $	*/
+/*	$NetBSD: byte_swap.h,v 1.12 2012/09/05 01:03:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2002 The NetBSD Foundation, Inc.
@@ -94,15 +94,16 @@ __byte_swap_u16_variable(uint16_t v)
 		__asm(rev16\t%0, %1 : =r (v) : 0 (v));
 		return v;
 	}
-#elif !defined(__thumb__)
+#elif !defined(__thumb__)  0	/* gcc produces decent code for this */
 	if (!__builtin_constant_p(v)) {
+		uint32_t v0 = v;
 		__asm volatile(
 			mov	%0, %1, ror #8\n
 			orr	%0, %0, %0, lsr #16\n
 			bic	%0, %0, %0, lsl #16
-		: =r (v)
-		: 0 (v));
-		return (v);
+		: =r (v0)
+		: 0 (v0));
+		return v0;
 	}
 #endif
 	v = 0x;



CVS commit: src/sys/dev/pci

2012-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  5 01:32:01 UTC 2012

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

Log Message:
add a few more registers


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/pm2reg.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/pm2reg.h
diff -u src/sys/dev/pci/pm2reg.h:1.6 src/sys/dev/pci/pm2reg.h:1.7
--- src/sys/dev/pci/pm2reg.h:1.6	Thu Feb  2 07:09:53 2012
+++ src/sys/dev/pci/pm2reg.h	Wed Sep  5 01:32:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm2reg.h,v 1.6 2012/02/02 07:09:53 macallan Exp $	*/
+/*	$NetBSD: pm2reg.h,v 1.7 2012/09/05 01:32:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -236,6 +236,11 @@
 #define PM2_RE_WRITE_MODE	0x8ab8
 #define		PM2WM_WRITE_EN		0x0001
 #define		PM2WM_TO_HOST		0x0008
+#define PM2_RE_PIXEL_SIZE	0x8ad0
+#define		PM2PS_8BIT		0x
+#define		PM2PS_16BIT		0x0001
+#define		PM2PS_32BIT		0x0002
+#define		PM2PS_24BIT		0x0004
 
 #define PM2_RE_MODE		0x80a0
 #define		PM2RM_MASK_MIRROR	0x0001 /* mask is right-to-left */
@@ -316,5 +321,7 @@
 #define PM2_RE_DEPTH		0x89a8
 #define PM2_RE_STENCIL_MODE	0x8988
 #define PM2_RE_ROP_MODE		0x8828
+#define PM2_RE_PACKEDDATA_LIMIT	0x8150
+
 
 #endif /* PM2_REG_H */



CVS commit: src/sys/dev/pci

2012-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  5 01:48:39 UTC 2012

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

Log Message:
some preparations for mode setting support and such:
- DDC2 support, so far only used for WSDISPLAYIO_GET_EDID
- fix 8 bit support, use packed mode for some extra speed
- pm2 and pm2v have different DACs, deal with it where appropriate


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/pm2fb.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/pm2fb.c
diff -u src/sys/dev/pci/pm2fb.c:1.14 src/sys/dev/pci/pm2fb.c:1.15
--- src/sys/dev/pci/pm2fb.c:1.14	Wed May 23 18:39:30 2012
+++ src/sys/dev/pci/pm2fb.c	Wed Sep  5 01:48:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm2fb.c,v 1.14 2012/05/23 18:39:30 macallan Exp $	*/
+/*	$NetBSD: pm2fb.c,v 1.15 2012/09/05 01:48:39 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pm2fb.c,v 1.14 2012/05/23 18:39:30 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pm2fb.c,v 1.15 2012/09/05 01:48:39 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, $NetBSD: pm2fb.c,v 1.
 #include sys/malloc.h
 #include sys/lwp.h
 #include sys/kauth.h
+#include sys/atomic.h
 
 #include dev/videomode/videomode.h
 
@@ -97,9 +98,12 @@ struct pm2fb_softc {
 	u_char sc_cmap_blue[256];
 	/* engine stuff */
 	uint32_t sc_pprod;
+	int sc_is_pm2;
 	/* i2c stuff */
 	struct i2c_controller sc_i2c;
 	uint8_t sc_edid_data[128];
+	struct edid_info sc_ei;
+	struct videomode *sc_videomode;
 };
 
 static int	pm2fb_match(device_t, cfdata_t, void *);
@@ -174,6 +178,13 @@ static const struct i2c_bitbang_ops pm2f
 	}
 };
 
+#if 0
+/* mode setting stuff */
+static int pm2fb_set_pll(struct pm2fb_softc *, int);
+static uint8_t pm2fb_read_dac(struct pm2fb_softc *, int);
+static void pm2fb_write_dac(struct pm2fb_softc *, int, uint8_t);
+#endif
+
 static inline void
 pm2fb_wait(struct pm2fb_softc *sc, int slots)
 {
@@ -236,7 +247,7 @@ pm2fb_attach(device_t parent, device_t s
 	sc-sc_memt = pa-pa_memt;
 	sc-sc_iot = pa-pa_iot;
 	sc-sc_dev = self;
-
+	sc-sc_is_pm2 = (PCI_PRODUCT(pa-pa_id) == PCI_PRODUCT_3DLABS_PERMEDIA2);
 	pci_aprint_devinfo(pa, NULL);
 
 	/* fill in parameters from properties */
@@ -257,6 +268,10 @@ pm2fb_attach(device_t parent, device_t s
 	 * don't look at the linebytes property - The Raptor firmware lies
 	 * about it. Get it from width * depth  3 instead.
 	 */
+
+#if 0
+	sc-sc_depth = 8;
+#endif
 	sc-sc_stride = sc-sc_width * (sc-sc_depth  3);
 
 	prop_dictionary_get_bool(dict, is_console, is_console);
@@ -296,6 +311,11 @@ pm2fb_attach(device_t parent, device_t s
 	pm2fb_accessops);
 	sc-vd.init_screen = pm2fb_init_screen;
 
+#if 0
+	pm2fb_write_dac(sc, PM2V_DAC_PIXEL_SIZE, PM2V_PS_8BIT);
+	pm2fb_write_dac(sc, PM2V_DAC_COLOR_FORMAT, PM2V_DAC_PALETTE);
+#endif
+
 	/* init engine here */
 	pm2fb_init(sc);
 
@@ -328,8 +348,7 @@ pm2fb_attach(device_t parent, device_t s
 	} else {
 		if (sc-sc_console_screen.scr_ri.ri_rows == 0) {
 			/* do some minimal setup to avoid weirdnesses later */
-			vcons_init_screen(sc-vd, sc-sc_console_screen, 1,
-			defattr);
+			vcons_init_screen(sc-vd, sc-sc_console_screen, 1, defattr);
 		}
 	}
 
@@ -575,6 +594,44 @@ pm2fb_putpalreg(struct pm2fb_softc *sc, 
 	return 0;
 }
 
+#if 0
+static uint8_t
+pm2fb_read_dac(struct pm2fb_softc *sc, int reg)
+{
+	if (sc-sc_is_pm2) {
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2_DAC_PAL_WRITE_IDX, reg);
+		return bus_space_read_1(sc-sc_memt, sc-sc_regh,
+		PM2_DAC_INDEX_DATA);
+	} else {
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2V_DAC_INDEX_LOW, reg  0xff);
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2V_DAC_INDEX_HIGH, (reg  8)  0xff);
+		return bus_space_read_1(sc-sc_memt, sc-sc_regh,
+		PM2V_DAC_INDEX_DATA);
+	}	
+}
+
+static void
+pm2fb_write_dac(struct pm2fb_softc *sc, int reg, uint8_t data)
+{
+	if (sc-sc_is_pm2) {
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2_DAC_PAL_WRITE_IDX, reg);
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2_DAC_INDEX_DATA, data);
+	} else {
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2V_DAC_INDEX_LOW, reg  0xff);
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2V_DAC_INDEX_HIGH, (reg  8)  0xff);
+		bus_space_write_1(sc-sc_memt, sc-sc_regh,
+		PM2V_DAC_INDEX_DATA, data);
+	}	
+}
+#endif
+
 static void
 pm2fb_init(struct pm2fb_softc *sc)
 {
@@ -621,7 +678,7 @@ pm2fb_init(struct pm2fb_softc *sc)
 	sc-sc_pprod);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, PM2_RE_TEXMAP_FORMAT, 
 	sc-sc_pprod);
-	pm2fb_wait(sc, 8);
+	pm2fb_wait(sc, 9);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, PM2_RE_DY, 1  16);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, PM2_RE_DXDOM, 0);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, PM2_RE_STARTXDOM, 

CVS commit: src/usr.bin/comm

2012-09-04 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Sep  5 04:01:23 UTC 2012

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

Log Message:
Use getc instead of fgetc.

This is approximately five times faster for comm -23 a b where a and b
are identical 100MB files.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/comm/comm.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/comm/comm.c
diff -u src/usr.bin/comm/comm.c:1.19 src/usr.bin/comm/comm.c:1.20
--- src/usr.bin/comm/comm.c:1.19	Tue Aug 30 21:36:38 2011
+++ src/usr.bin/comm/comm.c	Wed Sep  5 04:01:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: comm.c,v 1.19 2011/08/30 21:36:38 joerg Exp $	*/
+/*	$NetBSD: comm.c,v 1.20 2012/09/05 04:01:23 simonb Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = @(#)comm.c	8.4 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: comm.c,v 1.19 2011/08/30 21:36:38 joerg Exp $);
+__RCSID($NetBSD: comm.c,v 1.20 2012/09/05 04:01:23 simonb Exp $);
 #endif /* not lint */
 
 #include err.h
@@ -197,7 +197,7 @@ getnextln(char *buf, FILE *fp)
 	size_t i = 0;
 	int c;
 
-	while ((c = fgetc(fp)) != '\n'  c != EOF) {
+	while ((c = getc(fp)) != '\n'  c != EOF) {
 		buf[i++] = c;
 
 		if (i = MAXLINELEN)