CVS commit: src/sys/net

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  1 06:14:43 UTC 2015

Modified Files:
src/sys/net: if_bridge.c if_bridgevar.h

Log Message:
Modify the BRDGGIFS and BRDGRTS cmds to be more COMPAT_NETBSD32 friendly.
(XXX whitespace)


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/net/if_bridge.c
cvs rdiff -u -r1.23 -r1.24 src/sys/net/if_bridgevar.h

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

Modified files:

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.98 src/sys/net/if_bridge.c:1.99
--- src/sys/net/if_bridge.c:1.98	Thu Apr 16 08:54:15 2015
+++ src/sys/net/if_bridge.c	Mon Jun  1 06:14:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.98 2015/04/16 08:54:15 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.99 2015/06/01 06:14:43 matt Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bridge.c,v 1.98 2015/04/16 08:54:15 ozaki-r Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bridge.c,v 1.99 2015/06/01 06:14:43 matt Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_bridge_ipf.h
@@ -143,6 +143,10 @@ __KERNEL_RCSID(0, $NetBSD: if_bridge.c,
 #include netinet/ip_carp.h
 #endif
 
+__CTASSERT(sizeof(struct ifbifconf) == sizeof(struct ifbaconf));
+__CTASSERT(offsetof(struct ifbifconf, ifbic_len) == offsetof(struct ifbaconf, ifbac_len));
+__CTASSERT(offsetof(struct ifbifconf, ifbic_buf) == offsetof(struct ifbaconf, ifbac_buf));
+
 /*
  * Maximum number of addresses to cache.
  */
@@ -306,6 +310,8 @@ struct bridge_control {
 #define	BC_F_COPYIN		0x01	/* copy arguments in */
 #define	BC_F_COPYOUT		0x02	/* copy arguments out */
 #define	BC_F_SUSER		0x04	/* do super-user check */
+#define BC_F_XLATEIN		0x08	/* xlate arguments in */
+#define BC_F_XLATEOUT		0x10	/* xlate arguments out */
 
 static const struct bridge_control bridge_control_table[] = {
 [BRDGADD] = {bridge_ioctl_add, sizeof(struct ifbreq), BC_F_COPYIN|BC_F_SUSER},
@@ -317,8 +323,8 @@ static const struct bridge_control bridg
 [BRDGSCACHE] = {bridge_ioctl_scache, sizeof(struct ifbrparam), BC_F_COPYIN|BC_F_SUSER}, 
 [BRDGGCACHE] = {bridge_ioctl_gcache, sizeof(struct ifbrparam), BC_F_COPYOUT}, 
 
-[BRDGGIFS] = {bridge_ioctl_gifs, sizeof(struct ifbifconf), BC_F_COPYIN|BC_F_COPYOUT}, 
-[BRDGRTS] = {bridge_ioctl_rts, sizeof(struct ifbaconf), BC_F_COPYIN|BC_F_COPYOUT}, 
+[OBRDGGIFS] = {bridge_ioctl_gifs, sizeof(struct ifbifconf), BC_F_COPYIN|BC_F_COPYOUT}, 
+[OBRDGRTS] = {bridge_ioctl_rts, sizeof(struct ifbaconf), BC_F_COPYIN|BC_F_COPYOUT}, 
 
 [BRDGSADDR] = {bridge_ioctl_saddr, sizeof(struct ifbareq), BC_F_COPYIN|BC_F_SUSER}, 
 
@@ -348,7 +354,10 @@ static const struct bridge_control bridg
 [BRDGGFILT] = {bridge_ioctl_gfilt, sizeof(struct ifbrparam), BC_F_COPYOUT},
 [BRDGSFILT] = {bridge_ioctl_sfilt, sizeof(struct ifbrparam), BC_F_COPYIN|BC_F_SUSER},
 #endif /* BRIDGE_IPF */
+[BRDGGIFS] = {bridge_ioctl_gifs, sizeof(struct ifbifconf), BC_F_XLATEIN|BC_F_XLATEOUT},
+[BRDGRTS] = {bridge_ioctl_rts, sizeof(struct ifbaconf), BC_F_XLATEIN|BC_F_XLATEOUT},
 };
+
 static const int bridge_control_table_size = __arraycount(bridge_control_table);
 
 static LIST_HEAD(, bridge_softc) bridge_list;
@@ -621,13 +630,12 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 	switch (cmd) {
 	case SIOCGDRVSPEC:
 	case SIOCSDRVSPEC:
-		if (ifd-ifd_cmd = bridge_control_table_size) {
+		if (ifd-ifd_cmd = bridge_control_table_size
+		|| (bc = bridge_control_table[ifd-ifd_cmd]) == NULL) {
 			error = EINVAL;
 			return error;
 		}
 
-		bc = bridge_control_table[ifd-ifd_cmd];
-
 		/* We only care about BC_F_SUSER at this point. */
 		if ((bc-bc_flags  BC_F_SUSER) == 0)
 			break;
@@ -651,20 +659,21 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 	case SIOCSDRVSPEC:
 		KASSERT(bc != NULL);
 		if (cmd == SIOCGDRVSPEC 
-		(bc-bc_flags  BC_F_COPYOUT) == 0) {
+		(bc-bc_flags  (BC_F_COPYOUT|BC_F_XLATEOUT)) == 0) {
 			error = EINVAL;
 			break;
 		}
 		else if (cmd == SIOCSDRVSPEC 
-		(bc-bc_flags  BC_F_COPYOUT) != 0) {
+		(bc-bc_flags  (BC_F_COPYOUT|BC_F_XLATEOUT)) != 0) {
 			error = EINVAL;
 			break;
 		}
 
 		/* BC_F_SUSER is checked above, before splnet(). */
 
-		if (ifd-ifd_len != bc-bc_argsize ||
-		ifd-ifd_len  sizeof(args)) {
+		if ((bc-bc_flags  (BC_F_XLATEIN|BC_F_XLATEOUT)) == 0
+		 (ifd-ifd_len != bc-bc_argsize
+			|| ifd-ifd_len  sizeof(args))) {
 			error = EINVAL;
 			break;
 		}
@@ -674,15 +683,21 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 			error = copyin(ifd-ifd_data, args, ifd-ifd_len);
 			if (error)
 break;
+		} else if (bc-bc_flags  BC_F_XLATEIN) {
+			args.ifbifconf.ifbic_len = ifd-ifd_len;
+			args.ifbifconf.ifbic_buf = ifd-ifd_data;
 		}
 
 		error = (*bc-bc_func)(sc, args);
 		if (error)
 			break;
 
-		if (bc-bc_flags  BC_F_COPYOUT)
+		if (bc-bc_flags  BC_F_COPYOUT) {
 			error = copyout(args, ifd-ifd_data, ifd-ifd_len);
-
+		} else if (bc-bc_flags 

CVS commit: src/sbin/brconfig

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  1 06:15:18 UTC 2015

Modified Files:
src/sbin/brconfig: brconfig.c

Log Message:
Use the new BRDGGIFS and BRDGRTS cmds which just use ifdrv directly.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/brconfig/brconfig.c

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

Modified files:

Index: src/sbin/brconfig/brconfig.c
diff -u src/sbin/brconfig/brconfig.c:1.16 src/sbin/brconfig/brconfig.c:1.17
--- src/sbin/brconfig/brconfig.c:1.16	Thu May 28 20:14:00 2015
+++ src/sbin/brconfig/brconfig.c	Mon Jun  1 06:15:18 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: brconfig.c,v 1.16 2015/05/28 20:14:00 joerg Exp $	*/
+/*	$NetBSD: brconfig.c,v 1.17 2015/06/01 06:15:18 matt Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -43,7 +43,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: brconfig.c,v 1.16 2015/05/28 20:14:00 joerg Exp $);
+__RCSID($NetBSD: brconfig.c,v 1.17 2015/06/01 06:15:18 matt Exp $);
 #endif
 
 
@@ -141,7 +141,8 @@ static void	show_config(int, const char 
 static void	show_interfaces(int, const char *, const char *);
 static void	show_addresses(int, const char *, const char *);
 static int	get_val(const char *, u_long *);
-static int	do_cmd(int, const char *, u_long, void *, size_t, int);
+#define	do_cmd(a,b,c,d,e,f)	do_cmd2((a),(b),(c),(d),(e),NULL,(f))
+static int	do_cmd2(int, const char *, u_long, void *, size_t, size_t *, int);
 static void	do_ifflag(int, const char *, int, int);
 static void	do_bridgeflag(int, const char *, const char *, int, int);
 
@@ -418,26 +419,22 @@ show_interfaces(int sock, const char *br
 		forwarding,
 		blocking,
 	};
-	struct ifbifconf bifc;
 	struct ifbreq *req;
 	char *inbuf = NULL, *ninbuf;
-	uint32_t i, len = 8192;
+	size_t len = 8192, nlen;
 
-	for (;;) {
-		ninbuf = realloc(inbuf, len);
+	do {
+		nlen = len;
+		ninbuf = realloc(inbuf, nlen);
 		if (ninbuf == NULL)
 			err(1, unable to allocate interface buffer);
-		bifc.ifbic_len = len;
-		bifc.ifbic_buf = inbuf = ninbuf;
-		if (do_cmd(sock, bridge, BRDGGIFS, bifc, sizeof(bifc), 0)  0)
+		inbuf = ninbuf;
+		if (do_cmd2(sock, bridge, BRDGGIFS, inbuf, nlen, len, 0)  0)
 			err(1, unable to get interface list);
-		if ((bifc.ifbic_len + sizeof(*req))  len)
-			break;
-		len *= 2;
-	}
+	} while (len  nlen);
 
-	for (i = 0; i  bifc.ifbic_len / sizeof(*req); i++) {
-		req = bifc.ifbic_req + i;
+	for (size_t i = 0; i  len / sizeof(*req); i++) {
+		req = (struct ifbreq *)inbuf + i;
 		printf(%s%s , prefix, req-ifbr_ifsname);
 		printb(flags, req-ifbr_ifsflags, IFBIFBITS);
 		printf(\n);
@@ -462,31 +459,27 @@ show_interfaces(int sock, const char *br
 static void
 show_addresses(int sock, const char *bridge, const char *prefix)
 {
-	struct ifbaconf ifbac;
 	struct ifbareq *ifba;
 	char *inbuf = NULL, *ninbuf;
-	uint32_t i, len = 8192;
 	struct ether_addr ea;
+	size_t len = 8192, nlen;
 
-	for (;;) {
-		ninbuf = realloc(inbuf, len);
+	do {
+		nlen = len;
+		ninbuf = realloc(inbuf, nlen);
 		if (ninbuf == NULL)
 			err(1, unable to allocate address buffer);
-		ifbac.ifbac_len = len;
-		ifbac.ifbac_buf = inbuf = ninbuf;
-		if (do_cmd(sock, bridge, BRDGRTS, ifbac, sizeof(ifbac), 0)  0)
+		inbuf = ninbuf;
+		if (do_cmd2(sock, bridge, BRDGRTS, inbuf, nlen, len, 0)  0)
 			err(1, unable to get address cache);
-		if ((ifbac.ifbac_len + sizeof(*ifba))  len)
-			break;
-		len *= 2;
-	}
+	} while (len  nlen);
 
-	for (i = 0; i  ifbac.ifbac_len / sizeof(*ifba); i++) {
-		ifba = ifbac.ifbac_req + i;
+	for (size_t i = 0; i  len / sizeof(*ifba); i++) {
+		ifba = (struct ifbareq *)inbuf + i;
 		memcpy(ea.ether_addr_octet, ifba-ifba_dst,
 		sizeof(ea.ether_addr_octet));
-		printf(%s%s %s %ld , prefix, ether_ntoa(ea),
-		ifba-ifba_ifsname, ifba-ifba_expire);
+		printf(%s%s %s %jd , prefix, ether_ntoa(ea),
+		ifba-ifba_ifsname, (uintmax_t)ifba-ifba_expire);
 		printb(flags, ifba-ifba_flags, IFBAFBITS);
 		printf(\n);
 	}
@@ -510,10 +503,11 @@ get_val(const char *cp, u_long *valp)
 }
 
 static int
-do_cmd(int sock, const char *bridge, u_long op, void *arg, size_t argsize,
-int set)
+do_cmd2(int sock, const char *bridge, u_long op, void *arg, size_t argsize,
+size_t *outsizep, int set)
 {
 	struct ifdrv ifd;
+	int error;
 
 	memset(ifd, 0, sizeof(ifd));
 
@@ -522,7 +516,12 @@ do_cmd(int sock, const char *bridge, u_l
 	ifd.ifd_len = argsize;
 	ifd.ifd_data = arg;
 
-	return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, ifd));
+	error = ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, ifd);
+
+	if (outsizep)
+		*outsizep = ifd.ifd_len;
+
+	return error;
 }
 
 static void



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

2015-06-01 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jun  1 09:49:37 UTC 2015

Modified Files:
src/sys/arch/arm/imx: imx6_intr.h

Log Message:
add #define __HAVE_PIC_PENDING_INTRS because imxgpio use pic_mark_pending()


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx6_intr.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/imx/imx6_intr.h
diff -u src/sys/arch/arm/imx/imx6_intr.h:1.2 src/sys/arch/arm/imx/imx6_intr.h:1.3
--- src/sys/arch/arm/imx/imx6_intr.h:1.2	Thu Sep 25 05:05:28 2014
+++ src/sys/arch/arm/imx/imx6_intr.h	Mon Jun  1 09:49:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_intr.h,v 1.2 2014/09/25 05:05:28 ryo Exp $	*/
+/*	$NetBSD: imx6_intr.h,v 1.3 2015/06/01 09:49:36 ryo Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,6 +33,7 @@
 
 #define	PIC_MAXSOURCES			256
 #define	PIC_MAXMAXSOURCES		(256 + 6 * 32)
+#define	__HAVE_PIC_PENDING_INTRS	/* for imxgpio */
 
 /*
  * The BCM53xx uses a generic interrupt controller so pull that stuff.



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

2015-06-01 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jun  1 10:10:56 UTC 2015

Modified Files:
src/sys/arch/arm/imx: imx6_board.c

Log Message:
Limit the maximum size of memory to 3840Mbyte for 4G memory board (NITROGEN6MAX)
constrained by memory layout of i.MX6 SoC.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx6_board.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/arm/imx/imx6_board.c
diff -u src/sys/arch/arm/imx/imx6_board.c:1.3 src/sys/arch/arm/imx/imx6_board.c:1.4
--- src/sys/arch/arm/imx/imx6_board.c:1.3	Fri Jan  9 09:50:46 2015
+++ src/sys/arch/arm/imx/imx6_board.c	Mon Jun  1 10:10:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_board.c,v 1.3 2015/01/09 09:50:46 ryo Exp $	*/
+/*	$NetBSD: imx6_board.c,v 1.4 2015/06/01 10:10:56 ryo Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: imx6_board.c,v 1.3 2015/01/09 09:50:46 ryo Exp $);
+__KERNEL_RCSID(1, $NetBSD: imx6_board.c,v 1.4 2015/06/01 10:10:56 ryo Exp $);
 
 #include opt_imx.h
 #include arml2cc.h
@@ -144,6 +144,16 @@ imx6_memprobe(void)
 	bitwidth += __SHIFTOUT(ctrl, MMDC1_MDCTL_SDE_1);
 	bitwidth += (misc  MMDC1_MDMISC_DDR_4_BANK) ? 2 : 3;
 
+	/* over 4GB ? limit 3840MB (SoC design limitation) */
+	if (bitwidth = 32) {
+		/*
+		 * XXX: bus_dma and uvm cannot treat 0x as high address
+		 *  correctly because of 0x + 1 = 0x.
+		 *  therefore use 0xefff.
+		 */
+		return (psize_t)IMX6_MEM_SIZE - PAGE_SIZE;
+	}
+
 	return (psize_t)1  bitwidth;
 }
 



CVS commit: [netbsd-5] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:48:07 UTC 2015

Modified Files:
src/doc [netbsd-5]: CHANGES-5.3

Log Message:
Ticket #1968


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.117 -r1.1.2.118 src/doc/CHANGES-5.3

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

Modified files:

Index: src/doc/CHANGES-5.3
diff -u src/doc/CHANGES-5.3:1.1.2.117 src/doc/CHANGES-5.3:1.1.2.118
--- src/doc/CHANGES-5.3:1.1.2.117	Mon Jun  1 14:44:31 2015
+++ src/doc/CHANGES-5.3	Mon Jun  1 15:48:07 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.3,v 1.1.2.117 2015/06/01 14:44:31 sborrill Exp $
+# $NetBSD: CHANGES-5.3,v 1.1.2.118 2015/06/01 15:48:07 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.2 release to the NetBSD 5.3
 release:
@@ -3909,3 +3909,9 @@ sys/arch/i386/i386/cpufunc.S			1.16-1.17
 	Backport rdmsr_safe() to access MSR safely.
 	[msaitoh, ticket #1969]
 
+sys/arch/x86/include/specialreg.h		1.72 via patch
+
+	Add CPUID_TO_*() macros to avoid bug. Old macros are kept for
+	compatibility.
+	[msaitoh, ticket #1968]
+



CVS commit: [netbsd-5-1] src/sys/arch/x86/include

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:49:47 UTC 2015

Modified Files:
src/sys/arch/x86/include [netbsd-5-1]: specialreg.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1968):
sys/arch/x86/include/specialreg.h: revision 1.72 via patch

Backup CPUID_TO_*() macros. Old macros are kept for compatibility.


To generate a diff of this commit:
cvs rdiff -u -r1.31.4.1 -r1.31.4.1.2.1 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.31.4.1 src/sys/arch/x86/include/specialreg.h:1.31.4.1.2.1
--- src/sys/arch/x86/include/specialreg.h:1.31.4.1	Tue Jun 16 02:23:31 2009
+++ src/sys/arch/x86/include/specialreg.h	Mon Jun  1 15:49:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.31.4.1 2009/06/16 02:23:31 snj Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.31.4.1.2.1 2015/06/01 15:49:47 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -240,13 +240,39 @@
 			\11TM2\12SSSE3\13CID\16CX16\17xTPR\20PDCM\23DCA \
 			\24SSE41\25SSE42\26X2APIC\30POPCNT
 
-#define CPUID2FAMILY(cpuid)	(((cpuid)  8)  0xf)
-#define CPUID2MODEL(cpuid)	(((cpuid)  4)  0xf)
-#define CPUID2STEPPING(cpuid)	((cpuid)  0xf)
-
-/* Extended family and model are defined on amd64 processors */
-#define CPUID2EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
-#define CPUID2EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+/* CPUID Fn0001 %eax */
+
+#define CPUID_TO_BASEFAMILY(cpuid)	(((cpuid)  8)  0xf)
+#define CPUID_TO_BASEMODEL(cpuid)	(((cpuid)  4)  0xf)
+#define CPUID_TO_STEPPING(cpuid)	((cpuid)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2FAMILY(cpuid)	CPUID_TO_BASEFAMILY(cpuid)
+#define CPUID2MODEL(cpuid)	CPUID_TO_BASEMODEL(cpuid)
+#define CPUID2STEPPING(cpuid)	CPUID_TO_STEPPING(cpuid)
+
+/*
+ * The Extended family bits should only be inspected when CPUID_TO_BASEFAMILY()
+ * returns 15. They are use to encode family value 16 to 270 (add 15).
+ * The Extended model bits are the high 4 bits of the model.
+ * They are only valid for family = 15 or family 6 (intel, but all amd
+ * family 6 are documented to return zero bits for them).
+ */
+#define CPUID_TO_EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
+#define CPUID_TO_EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2EXTFAMILY(cpuid)	CPUID_TO_EXTFAMILY(cpuid)
+#define CPUID2EXTMODEL(cpuid)	CPUID_TO_EXTMODEL(cpuid)
+
+/* The macros for the Display Family and the Display Model */
+#define CPUID_TO_FAMILY(cpuid)	(CPUID_TO_BASEFAMILY(cpuid)	\
+	+ ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		? 0 : CPUID_TO_EXTFAMILY(cpuid)))
+#define CPUID_TO_MODEL(cpuid)	(CPUID_TO_BASEMODEL(cpuid)	\
+	| ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		 (CPUID_TO_BASEFAMILY(cpuid) != 0x06)		\
+		? 0 : (CPUID_TO_EXTMODEL(cpuid)  4)))
 
 /*
  * Model-specific registers for the i386 family



CVS commit: [netbsd-5-2] src/sys/arch/x86/include

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:49:16 UTC 2015

Modified Files:
src/sys/arch/x86/include [netbsd-5-2]: specialreg.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1968):
sys/arch/x86/include/specialreg.h: revision 1.72 via patch

Backup CPUID_TO_*() macros. Old macros are kept for compatibility.


To generate a diff of this commit:
cvs rdiff -u -r1.31.4.2 -r1.31.4.2.2.1 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.31.4.2 src/sys/arch/x86/include/specialreg.h:1.31.4.2.2.1
--- src/sys/arch/x86/include/specialreg.h:1.31.4.2	Wed Nov 28 04:39:03 2012
+++ src/sys/arch/x86/include/specialreg.h	Mon Jun  1 15:49:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.31.4.2 2012/11/28 04:39:03 riz Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.31.4.2.2.1 2015/06/01 15:49:16 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -240,13 +240,39 @@
 			\11TM2\12SSSE3\13CID\16CX16\17xTPR\20PDCM\23DCA \
 			\24SSE41\25SSE42\26X2APIC\30POPCNT
 
-#define CPUID2FAMILY(cpuid)	(((cpuid)  8)  0xf)
-#define CPUID2MODEL(cpuid)	(((cpuid)  4)  0xf)
-#define CPUID2STEPPING(cpuid)	((cpuid)  0xf)
-
-/* Extended family and model are defined on amd64 processors */
-#define CPUID2EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
-#define CPUID2EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+/* CPUID Fn0001 %eax */
+
+#define CPUID_TO_BASEFAMILY(cpuid)	(((cpuid)  8)  0xf)
+#define CPUID_TO_BASEMODEL(cpuid)	(((cpuid)  4)  0xf)
+#define CPUID_TO_STEPPING(cpuid)	((cpuid)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2FAMILY(cpuid)	CPUID_TO_BASEFAMILY(cpuid)
+#define CPUID2MODEL(cpuid)	CPUID_TO_BASEMODEL(cpuid)
+#define CPUID2STEPPING(cpuid)	CPUID_TO_STEPPING(cpuid)
+
+/*
+ * The Extended family bits should only be inspected when CPUID_TO_BASEFAMILY()
+ * returns 15. They are use to encode family value 16 to 270 (add 15).
+ * The Extended model bits are the high 4 bits of the model.
+ * They are only valid for family = 15 or family 6 (intel, but all amd
+ * family 6 are documented to return zero bits for them).
+ */
+#define CPUID_TO_EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
+#define CPUID_TO_EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2EXTFAMILY(cpuid)	CPUID_TO_EXTFAMILY(cpuid)
+#define CPUID2EXTMODEL(cpuid)	CPUID_TO_EXTMODEL(cpuid)
+
+/* The macros for the Display Family and the Display Model */
+#define CPUID_TO_FAMILY(cpuid)	(CPUID_TO_BASEFAMILY(cpuid)	\
+	+ ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		? 0 : CPUID_TO_EXTFAMILY(cpuid)))
+#define CPUID_TO_MODEL(cpuid)	(CPUID_TO_BASEMODEL(cpuid)	\
+	| ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		 (CPUID_TO_BASEFAMILY(cpuid) != 0x06)		\
+		? 0 : (CPUID_TO_EXTMODEL(cpuid)  4)))
 
 /*
  * Model-specific registers for the i386 family



CVS commit: [netbsd-5-1] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:52:03 UTC 2015

Modified Files:
src/doc [netbsd-5-1]: CHANGES-5.1.6

Log Message:
Ticket #1968


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.28 -r1.1.2.29 src/doc/CHANGES-5.1.6

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

Modified files:

Index: src/doc/CHANGES-5.1.6
diff -u src/doc/CHANGES-5.1.6:1.1.2.28 src/doc/CHANGES-5.1.6:1.1.2.29
--- src/doc/CHANGES-5.1.6:1.1.2.28	Mon Jun  1 14:45:27 2015
+++ src/doc/CHANGES-5.1.6	Mon Jun  1 15:52:03 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1.6,v 1.1.2.28 2015/06/01 14:45:27 sborrill Exp $
+# $NetBSD: CHANGES-5.1.6,v 1.1.2.29 2015/06/01 15:52:03 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.1.5 release to the NetBSD 5.1.6
 release:
@@ -2619,3 +2619,9 @@ sys/arch/i386/i386/cpufunc.S			1.16-1.17
 	Backport rdmsr_safe() to access MSR safely.
 	[msaitoh, ticket #1969]
 
+sys/arch/x86/include/specialreg.h		1.72 via patch
+
+	Add CPUID_TO_*() macros to avoid bug. Old macros are kept for
+	compatibility.
+	[msaitoh, ticket #1968]
+



CVS commit: [netbsd-5-2] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:52:41 UTC 2015

Modified Files:
src/doc [netbsd-5-2]: CHANGES-5.2.4

Log Message:
Ticket #1968


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.29 -r1.1.2.30 src/doc/CHANGES-5.2.4

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

Modified files:

Index: src/doc/CHANGES-5.2.4
diff -u src/doc/CHANGES-5.2.4:1.1.2.29 src/doc/CHANGES-5.2.4:1.1.2.30
--- src/doc/CHANGES-5.2.4:1.1.2.29	Mon Jun  1 14:46:33 2015
+++ src/doc/CHANGES-5.2.4	Mon Jun  1 15:52:41 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.2.4,v 1.1.2.29 2015/06/01 14:46:33 sborrill Exp $
+# $NetBSD: CHANGES-5.2.4,v 1.1.2.30 2015/06/01 15:52:41 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.2.3 release to the NetBSD 5.2.4
 release:
@@ -2619,3 +2619,9 @@ sys/arch/i386/i386/cpufunc.S			1.16-1.17
 	Backport rdmsr_safe() to access MSR safely.
 	[msaitoh, ticket #1969]
 
+sys/arch/x86/include/specialreg.h		1.72 via patch
+
+	Add CPUID_TO_*() macros to avoid bug. Old macros are kept for
+	compatibility.
+	[msaitoh, ticket #1968]
+



CVS commit: [netbsd-5-2] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:53:39 UTC 2015

Modified Files:
src/doc [netbsd-5-2]: CHANGES-5.2.4

Log Message:
Reword ticket #1968


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.30 -r1.1.2.31 src/doc/CHANGES-5.2.4

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

Modified files:

Index: src/doc/CHANGES-5.2.4
diff -u src/doc/CHANGES-5.2.4:1.1.2.30 src/doc/CHANGES-5.2.4:1.1.2.31
--- src/doc/CHANGES-5.2.4:1.1.2.30	Mon Jun  1 15:52:41 2015
+++ src/doc/CHANGES-5.2.4	Mon Jun  1 15:53:39 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.2.4,v 1.1.2.30 2015/06/01 15:52:41 sborrill Exp $
+# $NetBSD: CHANGES-5.2.4,v 1.1.2.31 2015/06/01 15:53:39 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.2.3 release to the NetBSD 5.2.4
 release:
@@ -2621,7 +2621,7 @@ sys/arch/i386/i386/cpufunc.S			1.16-1.17
 
 sys/arch/x86/include/specialreg.h		1.72 via patch
 
-	Add CPUID_TO_*() macros to avoid bug. Old macros are kept for
+	Backport CPUID_TO_*() macros. Old macros are kept for
 	compatibility.
 	[msaitoh, ticket #1968]
 



CVS commit: [netbsd-5-1] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:54:15 UTC 2015

Modified Files:
src/doc [netbsd-5-1]: CHANGES-5.1.6

Log Message:
Reword ticket #1968


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.29 -r1.1.2.30 src/doc/CHANGES-5.1.6

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

Modified files:

Index: src/doc/CHANGES-5.1.6
diff -u src/doc/CHANGES-5.1.6:1.1.2.29 src/doc/CHANGES-5.1.6:1.1.2.30
--- src/doc/CHANGES-5.1.6:1.1.2.29	Mon Jun  1 15:52:03 2015
+++ src/doc/CHANGES-5.1.6	Mon Jun  1 15:54:15 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1.6,v 1.1.2.29 2015/06/01 15:52:03 sborrill Exp $
+# $NetBSD: CHANGES-5.1.6,v 1.1.2.30 2015/06/01 15:54:15 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.1.5 release to the NetBSD 5.1.6
 release:
@@ -2621,7 +2621,7 @@ sys/arch/i386/i386/cpufunc.S			1.16-1.17
 
 sys/arch/x86/include/specialreg.h		1.72 via patch
 
-	Add CPUID_TO_*() macros to avoid bug. Old macros are kept for
+	Backport CPUID_TO_*() macros. Old macros are kept for
 	compatibility.
 	[msaitoh, ticket #1968]
 



CVS commit: src/sys/compat/netbsd32

2015-06-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jun  1 16:07:27 UTC 2015

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Add support for NPF ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.51 -r1.52 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.80 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.81
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.80	Mon Jun  1 00:15:08 2015
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Mon Jun  1 16:07:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.80 2015/06/01 00:15:08 roy Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 roy Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_ioctl.c,v 1.80 2015/06/01 00:15:08 roy Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 roy Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -68,6 +68,8 @@ __KERNEL_RCSID(0, $NetBSD: netbsd32_ioc
 #include net/if_pppoe.h
 #include net/if_sppp.h
 
+#include net/npf/npf.h
+
 #include net/bpf.h
 #include netinet/in.h
 #include netinet/in_var.h
@@ -290,6 +292,13 @@ netbsd32_to_u_long(netbsd32_u_long *s32p
 }
 
 static inline void
+netbsd32_to_voidp(netbsd32_voidp *s32p, voidp *p, u_long cmd)
+{
+
+	*p = (void *)NETBSD32PTR64(*s32p);
+}
+
+static inline void
 netbsd32_to_wdog_conf(struct netbsd32_wdog_conf *s32p, struct wdog_conf *p, u_long cmd)
 {
 
@@ -450,6 +459,30 @@ netbsd32_to_ksyms_gvalue(
 	p-kv_name = NETBSD32PTR64(s32p-kv_name);
 }
 
+static inline void
+netbsd32_to_npf_ioctl_table(
+const struct netbsd32_npf_ioctl_table *s32p,
+struct npf_ioctl_table *p,
+u_long cmd)
+{
+
+	p-nct_cmd = s32p-nct_cmd;
+	p-nct_name = NETBSD32PTR64(s32p-nct_name);
+	switch (s32p-nct_cmd) {
+	case NPF_CMD_TABLE_LOOKUP:
+	case NPF_CMD_TABLE_ADD:
+	case NPF_CMD_TABLE_REMOVE:
+		p-nct_data.ent.alen = s32p-nct_data.ent.alen;
+		p-nct_data.ent.addr = s32p-nct_data.ent.addr;
+		p-nct_data.ent.mask = s32p-nct_data.ent.mask;
+		break;
+	case NPF_CMD_TABLE_LIST:
+		p-nct_data.buf.buf = NETBSD32PTR64(s32p-nct_data.buf.buf);
+		p-nct_data.buf.len = s32p-nct_data.buf.len;
+		break;
+	}
+}
+
 /*
  * handle ioctl conversions from 64-bit kernel - netbsd32
  */
@@ -760,6 +793,14 @@ netbsd32_from_u_long(u_long *p, netbsd32
 }
 
 static inline void
+netbsd32_from_voidp(voidp *p, netbsd32_voidp *s32p, u_long cmd)
+{
+
+	NETBSD32PTR32(*s32p, *p);
+}
+
+
+static inline void
 netbsd32_from_clockctl_settimeofday(
 const struct clockctl_settimeofday *p,
 struct netbsd32_clockctl_settimeofday *s32p,
@@ -825,6 +866,30 @@ netbsd32_from_ksyms_gvalue(
 	s32p-kv_value = p-kv_value;
 }
 
+static inline void
+netbsd32_from_npf_ioctl_table(
+const struct npf_ioctl_table *p,
+struct netbsd32_npf_ioctl_table *s32p,
+u_long cmd)
+{
+
+	s32p-nct_cmd = p-nct_cmd;
+	NETBSD32PTR32(s32p-nct_name, p-nct_name);
+	switch (p-nct_cmd) {
+	case NPF_CMD_TABLE_LOOKUP:
+	case NPF_CMD_TABLE_ADD:
+	case NPF_CMD_TABLE_REMOVE:
+		s32p-nct_data.ent.alen = p-nct_data.ent.alen;
+		s32p-nct_data.ent.addr = p-nct_data.ent.addr;
+		s32p-nct_data.ent.mask = p-nct_data.ent.mask;
+		break;
+	case NPF_CMD_TABLE_LIST:
+		NETBSD32PTR32(s32p-nct_data.buf.buf, p-nct_data.buf.buf);
+		s32p-nct_data.buf.len = p-nct_data.buf.len;
+		break;
+	}
+}
+
 /*
  * main ioctl syscall.
  *
@@ -1205,6 +1270,17 @@ netbsd32_ioctl(struct lwp *l, const stru
 	case KIOCGVALUE32:
 		IOCTL_STRUCT_CONV_TO(KIOCGVALUE, ksyms_gvalue);
 
+	case IOC_NPF_LOAD32:
+		IOCTL_STRUCT_CONV_TO(IOC_NPF_LOAD, plistref);
+	case IOC_NPF_TABLE32:
+		IOCTL_STRUCT_CONV_TO(IOC_NPF_TABLE, npf_ioctl_table);
+	case IOC_NPF_STATS32:
+		IOCTL_CONV_TO(IOC_NPF_STATS, voidp);
+	case IOC_NPF_SAVE32:
+		IOCTL_STRUCT_CONV_TO(IOC_NPF_SAVE, plistref);
+	case IOC_NPF_RULE32:
+		IOCTL_STRUCT_CONV_TO(IOC_NPF_RULE, plistref);
+
 	default:
 #ifdef NETBSD32_MD_IOCTL
 		error = netbsd32_md_ioctl(fp, com, data32, l);

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.51 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.52
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.51	Sun May 31 22:19:41 2015
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Mon Jun  1 16:07:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.51 2015/05/31 22:19:41 roy Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.52 2015/06/01 16:07:27 roy Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -581,3 +581,33 @@ struct netbsd32_ksyms_gvalue {
 #define	KIOCGVALUE32	_IOWR('l', 4, struct netbsd32_ksyms_gvalue)
 #define	KIOCGSYMBOL32	_IOWR('l', 5, struct netbsd32_ksyms_gsymbol)
 #endif /* 

CVS commit: [netbsd-5] src/sys/arch/x86/include

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:45:46 UTC 2015

Modified Files:
src/sys/arch/x86/include [netbsd-5]: specialreg.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1968):
sys/arch/x86/include/specialreg.h: revision 1.72 via patch

Backport CPUID_TO_*() macros. Old macros are kept for compatibility.


To generate a diff of this commit:
cvs rdiff -u -r1.31.4.3 -r1.31.4.4 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.31.4.3 src/sys/arch/x86/include/specialreg.h:1.31.4.4
--- src/sys/arch/x86/include/specialreg.h:1.31.4.3	Wed Jun 19 07:44:42 2013
+++ src/sys/arch/x86/include/specialreg.h	Mon Jun  1 15:45:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.31.4.3 2013/06/19 07:44:42 bouyer Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.31.4.4 2015/06/01 15:45:46 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -240,13 +240,39 @@
 			\11TM2\12SSSE3\13CID\16CX16\17xTPR\20PDCM\23DCA \
 			\24SSE41\25SSE42\26X2APIC\30POPCNT
 
-#define CPUID2FAMILY(cpuid)	(((cpuid)  8)  0xf)
-#define CPUID2MODEL(cpuid)	(((cpuid)  4)  0xf)
-#define CPUID2STEPPING(cpuid)	((cpuid)  0xf)
-
-/* Extended family and model are defined on amd64 processors */
-#define CPUID2EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
-#define CPUID2EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+/* CPUID Fn0001 %eax */
+
+#define CPUID_TO_BASEFAMILY(cpuid)	(((cpuid)  8)  0xf)
+#define CPUID_TO_BASEMODEL(cpuid)	(((cpuid)  4)  0xf)
+#define CPUID_TO_STEPPING(cpuid)	((cpuid)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2FAMILY(cpuid)	CPUID_TO_BASEFAMILY(cpuid)
+#define CPUID2MODEL(cpuid)	CPUID_TO_BASEMODEL(cpuid)
+#define CPUID2STEPPING(cpuid)	CPUID_TO_STEPPING(cpuid)
+
+/*
+ * The Extended family bits should only be inspected when CPUID_TO_BASEFAMILY()
+ * returns 15. They are use to encode family value 16 to 270 (add 15).
+ * The Extended model bits are the high 4 bits of the model.
+ * They are only valid for family = 15 or family 6 (intel, but all amd
+ * family 6 are documented to return zero bits for them).
+ */
+#define CPUID_TO_EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
+#define CPUID_TO_EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2EXTFAMILY(cpuid)	CPUID_TO_EXTFAMILY(cpuid)
+#define CPUID2EXTMODEL(cpuid)	CPUID_TO_EXTMODEL(cpuid)
+
+/* The macros for the Display Family and the Display Model */
+#define CPUID_TO_FAMILY(cpuid)	(CPUID_TO_BASEFAMILY(cpuid)	\
+	+ ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		? 0 : CPUID_TO_EXTFAMILY(cpuid)))
+#define CPUID_TO_MODEL(cpuid)	(CPUID_TO_BASEMODEL(cpuid)	\
+	| ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		 (CPUID_TO_BASEFAMILY(cpuid) != 0x06)		\
+		? 0 : (CPUID_TO_EXTMODEL(cpuid)  4)))
 
 /*
  * Model-specific registers for the i386 family



CVS commit: [netbsd-5] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 14:44:31 UTC 2015

Modified Files:
src/doc [netbsd-5]: CHANGES-5.3

Log Message:
Ticket #1969


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.116 -r1.1.2.117 src/doc/CHANGES-5.3

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

Modified files:

Index: src/doc/CHANGES-5.3
diff -u src/doc/CHANGES-5.3:1.1.2.116 src/doc/CHANGES-5.3:1.1.2.117
--- src/doc/CHANGES-5.3:1.1.2.116	Wed May 27 06:19:25 2015
+++ src/doc/CHANGES-5.3	Mon Jun  1 14:44:31 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.3,v 1.1.2.116 2015/05/27 06:19:25 msaitoh Exp $
+# $NetBSD: CHANGES-5.3,v 1.1.2.117 2015/06/01 14:44:31 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.2 release to the NetBSD 5.3
 release:
@@ -3901,3 +3901,11 @@ sys/dev/usb/uftdi.c1.53
 
 	Use as large a packet size as the ftdi endpoint specifies.
 	[riastradh, ticket #1964]
+
+sys/arch/x86/include/cpufunc.h			1.13
+sys/arch/amd64/amd64/cpufunc.S			1.20-1.21 via patch
+sys/arch/i386/i386/cpufunc.S			1.16-1.17, 1.21 via patch
+
+	Backport rdmsr_safe() to access MSR safely.
+	[msaitoh, ticket #1969]
+



CVS commit: [netbsd-5-2] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 14:46:33 UTC 2015

Modified Files:
src/doc [netbsd-5-2]: CHANGES-5.2.4

Log Message:
Ticket #1969


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.28 -r1.1.2.29 src/doc/CHANGES-5.2.4

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

Modified files:

Index: src/doc/CHANGES-5.2.4
diff -u src/doc/CHANGES-5.2.4:1.1.2.28 src/doc/CHANGES-5.2.4:1.1.2.29
--- src/doc/CHANGES-5.2.4:1.1.2.28	Fri May 22 11:45:01 2015
+++ src/doc/CHANGES-5.2.4	Mon Jun  1 14:46:33 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.2.4,v 1.1.2.28 2015/05/22 11:45:01 sborrill Exp $
+# $NetBSD: CHANGES-5.2.4,v 1.1.2.29 2015/06/01 14:46:33 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.2.3 release to the NetBSD 5.2.4
 release:
@@ -2612,3 +2612,10 @@ sys/arch/xen/xen/xenevt.c			1.42
 	Fix off by one error, addresses port-xen/49919.
 	[bouyer, ticket #1965]
 
+sys/arch/x86/include/cpufunc.h			1.13
+sys/arch/amd64/amd64/cpufunc.S			1.20-1.21 via patch
+sys/arch/i386/i386/cpufunc.S			1.16-1.17, 1.21 via patch
+
+	Backport rdmsr_safe() to access MSR safely.
+	[msaitoh, ticket #1969]
+



CVS commit: [netbsd-5-2] src/sys/arch

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 14:42:40 UTC 2015

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5-2]: cpufunc.S
src/sys/arch/i386/i386 [netbsd-5-2]: cpufunc.S
src/sys/arch/x86/include [netbsd-5-2]: cpufunc.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1969):
sys/arch/x86/include/cpufunc.h: revision 1.13
sys/arch/amd64/amd64/cpufunc.S: revision 1.20-1.21 via patch
sys/arch/i386/i386/cpufunc.S:   revision 1.16-1.17, 1.21 via patch

Backport rdmsr_safe() to access MSR safely.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.20.1 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.13 -r1.13.14.1 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.8.10.3 -r1.8.10.3.10.1 src/sys/arch/x86/include/cpufunc.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/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.15 src/sys/arch/amd64/amd64/cpufunc.S:1.15.20.1
--- src/sys/arch/amd64/amd64/cpufunc.S:1.15	Tue Jun 24 16:32:53 2008
+++ src/sys/arch/amd64/amd64/cpufunc.S	Mon Jun  1 14:42:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.15 2008/06/24 16:32:53 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.15.20.1 2015/06/01 14:42:40 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -33,6 +33,8 @@
  * Functions to provide access to i386-specific instructions.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
 #include machine/specialreg.h
 #include machine/segments.h
@@ -215,6 +217,37 @@ ENTRY(wrmsr_locked)
 	wrmsr
 	ret
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$_C_LABEL(msr_onfault), PCB_ONFAULT(%r8)
+
+	movl	%edi, %ecx /* u_int msr */
+	rdmsr			/* Read MSR pointed by %ecx. Returns
+   hi byte in edx, lo in %eax */
+	salq	$32, %rdx	/* sign-shift %rdx left */
+	movl	%eax, %eax	/* zero-extend %eax - %rax */
+	orq	%rdx, %rax
+	movq	%rax, (%rsi)  /* *data */
+	xorq	%rax, %rax/* no error */
+
+	movq	%rax, PCB_ONFAULT(%r8)
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$0, PCB_ONFAULT(%r8)
+	movl	$EFAULT, %eax
+	ret
+
 #ifndef XEN
 ENTRY(wbinvd)
 	wbinvd

Index: src/sys/arch/i386/i386/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.13 src/sys/arch/i386/i386/cpufunc.S:1.13.14.1
--- src/sys/arch/i386/i386/cpufunc.S:1.13	Tue Sep 23 08:50:11 2008
+++ src/sys/arch/i386/i386/cpufunc.S	Mon Jun  1 14:42:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.13.14.1 2015/06/01 14:42:40 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -35,8 +35,10 @@
  * These are shared with NetBSD/xen.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13.14.1 2015/06/01 14:42:40 sborrill Exp $);
 
 #include opt_xen.h
 
@@ -141,6 +143,39 @@ ENTRY(wrmsr_locked)
 	ret
 END(wrmsr_locked)
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$_C_LABEL(msr_onfault), PCB_ONFAULT(%ecx)
+
+	movl	4(%esp), %ecx /* u_int msr */
+	rdmsr
+	movl	8(%esp), %ecx /* *data */
+	movl	%eax, (%ecx)  /* low-order bits */
+	movl	%edx, 4(%ecx) /* high-order bits */
+	xorl	%eax, %eax/* no error */
+
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	%eax, PCB_ONFAULT(%ecx)
+
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$0, PCB_ONFAULT(%ecx)
+	movl	$EFAULT, %eax
+	ret
+END(msr_onfault)
+
 ENTRY(cpu_counter)
 	rdtsc
 	addl	CPUVAR(CC_SKEW), %eax

Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.8.10.3 src/sys/arch/x86/include/cpufunc.h:1.8.10.3.10.1
--- src/sys/arch/x86/include/cpufunc.h:1.8.10.3	Mon Feb  2 21:38:50 2009
+++ src/sys/arch/x86/include/cpufunc.h	Mon Jun  1 14:42:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.8.10.3 2009/02/02 21:38:50 snj Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.8.10.3.10.1 2015/06/01 14:42:40 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -118,6 +118,7 @@ void	x86_reset(void);
 
 uint64_t	rdmsr(u_int);
 uint64_t	rdmsr_locked(u_int, u_int);
+int		rdmsr_safe(u_int, uint64_t *);
 uint64_t	rdtsc(void);
 uint64_t	rdpmc(u_int);
 void		wrmsr(u_int, uint64_t);



CVS commit: [netbsd-5-1] src/sys/arch

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 14:43:48 UTC 2015

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5-1]: cpufunc.S
src/sys/arch/i386/i386 [netbsd-5-1]: cpufunc.S
src/sys/arch/x86/include [netbsd-5-1]: cpufunc.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1969):
sys/arch/x86/include/cpufunc.h: revision 1.13
sys/arch/amd64/amd64/cpufunc.S: revision 1.20-1.21 via patch
sys/arch/i386/i386/cpufunc.S:   revision 1.16-1.17, 1.21 via patch

Backport rdmsr_safe() to access MSR safely.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.16.1 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.13 -r1.13.10.1 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.8.10.3 -r1.8.10.3.6.1 src/sys/arch/x86/include/cpufunc.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/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.15 src/sys/arch/amd64/amd64/cpufunc.S:1.15.16.1
--- src/sys/arch/amd64/amd64/cpufunc.S:1.15	Tue Jun 24 16:32:53 2008
+++ src/sys/arch/amd64/amd64/cpufunc.S	Mon Jun  1 14:43:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.15 2008/06/24 16:32:53 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.15.16.1 2015/06/01 14:43:47 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -33,6 +33,8 @@
  * Functions to provide access to i386-specific instructions.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
 #include machine/specialreg.h
 #include machine/segments.h
@@ -215,6 +217,37 @@ ENTRY(wrmsr_locked)
 	wrmsr
 	ret
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$_C_LABEL(msr_onfault), PCB_ONFAULT(%r8)
+
+	movl	%edi, %ecx /* u_int msr */
+	rdmsr			/* Read MSR pointed by %ecx. Returns
+   hi byte in edx, lo in %eax */
+	salq	$32, %rdx	/* sign-shift %rdx left */
+	movl	%eax, %eax	/* zero-extend %eax - %rax */
+	orq	%rdx, %rax
+	movq	%rax, (%rsi)  /* *data */
+	xorq	%rax, %rax/* no error */
+
+	movq	%rax, PCB_ONFAULT(%r8)
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$0, PCB_ONFAULT(%r8)
+	movl	$EFAULT, %eax
+	ret
+
 #ifndef XEN
 ENTRY(wbinvd)
 	wbinvd

Index: src/sys/arch/i386/i386/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.13 src/sys/arch/i386/i386/cpufunc.S:1.13.10.1
--- src/sys/arch/i386/i386/cpufunc.S:1.13	Tue Sep 23 08:50:11 2008
+++ src/sys/arch/i386/i386/cpufunc.S	Mon Jun  1 14:43:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.13.10.1 2015/06/01 14:43:48 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -35,8 +35,10 @@
  * These are shared with NetBSD/xen.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13.10.1 2015/06/01 14:43:48 sborrill Exp $);
 
 #include opt_xen.h
 
@@ -141,6 +143,39 @@ ENTRY(wrmsr_locked)
 	ret
 END(wrmsr_locked)
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$_C_LABEL(msr_onfault), PCB_ONFAULT(%ecx)
+
+	movl	4(%esp), %ecx /* u_int msr */
+	rdmsr
+	movl	8(%esp), %ecx /* *data */
+	movl	%eax, (%ecx)  /* low-order bits */
+	movl	%edx, 4(%ecx) /* high-order bits */
+	xorl	%eax, %eax/* no error */
+
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	%eax, PCB_ONFAULT(%ecx)
+
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$0, PCB_ONFAULT(%ecx)
+	movl	$EFAULT, %eax
+	ret
+END(msr_onfault)
+
 ENTRY(cpu_counter)
 	rdtsc
 	addl	CPUVAR(CC_SKEW), %eax

Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.8.10.3 src/sys/arch/x86/include/cpufunc.h:1.8.10.3.6.1
--- src/sys/arch/x86/include/cpufunc.h:1.8.10.3	Mon Feb  2 21:38:50 2009
+++ src/sys/arch/x86/include/cpufunc.h	Mon Jun  1 14:43:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.8.10.3 2009/02/02 21:38:50 snj Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.8.10.3.6.1 2015/06/01 14:43:48 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -118,6 +118,7 @@ void	x86_reset(void);
 
 uint64_t	rdmsr(u_int);
 uint64_t	rdmsr_locked(u_int, u_int);
+int		rdmsr_safe(u_int, uint64_t *);
 uint64_t	rdtsc(void);
 uint64_t	rdpmc(u_int);
 void		wrmsr(u_int, uint64_t);



CVS commit: [netbsd-5] src/sys/arch

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 14:38:32 UTC 2015

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: cpufunc.S
src/sys/arch/i386/i386 [netbsd-5]: cpufunc.S
src/sys/arch/x86/include [netbsd-5]: cpufunc.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1969):
sys/arch/x86/include/cpufunc.h: revision 1.13
sys/arch/amd64/amd64/cpufunc.S: revision 1.20-1.21 via patch
sys/arch/i386/i386/cpufunc.S:   revision 1.16-1.17, 1.21 via 
patch

Backport rdmsr_safe() to access MSR safely.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.6.1 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.8.10.3 -r1.8.10.4 src/sys/arch/x86/include/cpufunc.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/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.15 src/sys/arch/amd64/amd64/cpufunc.S:1.15.6.1
--- src/sys/arch/amd64/amd64/cpufunc.S:1.15	Tue Jun 24 16:32:53 2008
+++ src/sys/arch/amd64/amd64/cpufunc.S	Mon Jun  1 14:38:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.15 2008/06/24 16:32:53 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.15.6.1 2015/06/01 14:38:31 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -33,6 +33,8 @@
  * Functions to provide access to i386-specific instructions.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
 #include machine/specialreg.h
 #include machine/segments.h
@@ -215,6 +217,37 @@ ENTRY(wrmsr_locked)
 	wrmsr
 	ret
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$_C_LABEL(msr_onfault), PCB_ONFAULT(%r8)
+
+	movl	%edi, %ecx /* u_int msr */
+	rdmsr			/* Read MSR pointed by %ecx. Returns
+   hi byte in edx, lo in %eax */
+	salq	$32, %rdx	/* sign-shift %rdx left */
+	movl	%eax, %eax	/* zero-extend %eax - %rax */
+	orq	%rdx, %rax
+	movq	%rax, (%rsi)  /* *data */
+	xorq	%rax, %rax/* no error */
+
+	movq	%rax, PCB_ONFAULT(%r8)
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$0, PCB_ONFAULT(%r8)
+	movl	$EFAULT, %eax
+	ret
+
 #ifndef XEN
 ENTRY(wbinvd)
 	wbinvd

Index: src/sys/arch/i386/i386/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.13 src/sys/arch/i386/i386/cpufunc.S:1.13.4.1
--- src/sys/arch/i386/i386/cpufunc.S:1.13	Tue Sep 23 08:50:11 2008
+++ src/sys/arch/i386/i386/cpufunc.S	Mon Jun  1 14:38:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.13.4.1 2015/06/01 14:38:31 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -35,8 +35,10 @@
  * These are shared with NetBSD/xen.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13.4.1 2015/06/01 14:38:31 sborrill Exp $);
 
 #include opt_xen.h
 
@@ -141,6 +143,39 @@ ENTRY(wrmsr_locked)
 	ret
 END(wrmsr_locked)
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$_C_LABEL(msr_onfault), PCB_ONFAULT(%ecx)
+
+	movl	4(%esp), %ecx /* u_int msr */
+	rdmsr
+	movl	8(%esp), %ecx /* *data */
+	movl	%eax, (%ecx)  /* low-order bits */
+	movl	%edx, 4(%ecx) /* high-order bits */
+	xorl	%eax, %eax/* no error */
+
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	%eax, PCB_ONFAULT(%ecx)
+
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$0, PCB_ONFAULT(%ecx)
+	movl	$EFAULT, %eax
+	ret
+END(msr_onfault)
+
 ENTRY(cpu_counter)
 	rdtsc
 	addl	CPUVAR(CC_SKEW), %eax

Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.8.10.3 src/sys/arch/x86/include/cpufunc.h:1.8.10.4
--- src/sys/arch/x86/include/cpufunc.h:1.8.10.3	Mon Feb  2 21:38:50 2009
+++ src/sys/arch/x86/include/cpufunc.h	Mon Jun  1 14:38:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.8.10.3 2009/02/02 21:38:50 snj Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.8.10.4 2015/06/01 14:38:31 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -118,6 +118,7 @@ void	x86_reset(void);
 
 uint64_t	rdmsr(u_int);
 uint64_t	rdmsr_locked(u_int, u_int);
+int		rdmsr_safe(u_int, uint64_t *);
 uint64_t	rdtsc(void);
 uint64_t	rdpmc(u_int);
 void		wrmsr(u_int, uint64_t);



CVS commit: [netbsd-5-1] src/doc

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 14:45:27 UTC 2015

Modified Files:
src/doc [netbsd-5-1]: CHANGES-5.1.6

Log Message:
Ticket #1969


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.27 -r1.1.2.28 src/doc/CHANGES-5.1.6

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

Modified files:

Index: src/doc/CHANGES-5.1.6
diff -u src/doc/CHANGES-5.1.6:1.1.2.27 src/doc/CHANGES-5.1.6:1.1.2.28
--- src/doc/CHANGES-5.1.6:1.1.2.27	Fri May 22 11:22:34 2015
+++ src/doc/CHANGES-5.1.6	Mon Jun  1 14:45:27 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1.6,v 1.1.2.27 2015/05/22 11:22:34 sborrill Exp $
+# $NetBSD: CHANGES-5.1.6,v 1.1.2.28 2015/06/01 14:45:27 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.1.5 release to the NetBSD 5.1.6
 release:
@@ -2612,3 +2612,10 @@ sys/arch/xen/xen/xenevt.c			1.42
 	Fix off by one error, addresses port-xen/49919.
 	[bouyer, ticket #1965]
 
+sys/arch/x86/include/cpufunc.h			1.13
+sys/arch/amd64/amd64/cpufunc.S			1.20-1.21 via patch
+sys/arch/i386/i386/cpufunc.S			1.16-1.17, 1.21 via patch
+
+	Backport rdmsr_safe() to access MSR safely.
+	[msaitoh, ticket #1969]
+



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

2015-06-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Mon Jun  1 17:16:57 UTC 2015

Modified Files:
src/sys/arch/amiga/include: vmparam.h

Log Message:
Remove unused KUSER_AREA, SYSPTSIZE, USRPTSIZE.
Bump MAXTSIZ and MAXDSIZ to the same values atari is using.
This makes gcc 4.8 (/usr/libexec/cc1) load and execute.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/amiga/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/amiga/include/vmparam.h
diff -u src/sys/arch/amiga/include/vmparam.h:1.42 src/sys/arch/amiga/include/vmparam.h:1.43
--- src/sys/arch/amiga/include/vmparam.h:1.42	Tue Feb  8 20:20:08 2011
+++ src/sys/arch/amiga/include/vmparam.h	Mon Jun  1 17:16:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.42 2011/02/08 20:20:08 rmind Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.43 2015/06/01 17:16:56 phx Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -64,19 +64,19 @@
 #ifndef USRSTACK
 #define	USRSTACK	0x1E00
 #endif
-#define KUSER_AREA	(-UPAGES*PAGE_SIZE)
+
 /*
  * Virtual memory related constants, all in bytes
  */
 
 #ifndef MAXTSIZ
-#define	MAXTSIZ		(6*1024*1024)		/* max text size */
+#define	MAXTSIZ		(16*1024*1024)		/* max text size */
 #endif
 #ifndef DFLDSIZ
 #define	DFLDSIZ		(32*1024*1024)		/* initial data size limit */
 #endif
 #ifndef MAXDSIZ
-#define	MAXDSIZ		(128*1024*1024)		/* max data size */
+#define	MAXDSIZ		(256*1024*1024)		/* max data size */
 #endif
 #ifndef	DFLSSIZ
 #define	DFLSSIZ		(2*1024*1024)		/* initial stack size limit */
@@ -86,13 +86,6 @@
 #endif
 
 /*
- * Sizes of the system and user portions of the system page table.
- */
-/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
-#define	SYSPTSIZE	(2 * NPTEPG)	/* 16mb */
-#define	USRPTSIZE 	(1 * NPTEPG)	/* 16mb */
-
-/*
  * PTEs for mapping user space into the kernel for phyio operations.
  * One page is enough to handle 16Mb of simultaneous raw IO operations.
  */



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

2015-06-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Mon Jun  1 17:09:46 UTC 2015

Modified Files:
src/sys/arch/amiga/dev: z3rambd.c

Log Message:
Removed unused variable to make it compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amiga/dev/z3rambd.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/amiga/dev/z3rambd.c
diff -u src/sys/arch/amiga/dev/z3rambd.c:1.2 src/sys/arch/amiga/dev/z3rambd.c:1.3
--- src/sys/arch/amiga/dev/z3rambd.c:1.2	Mon Nov 26 22:58:24 2012
+++ src/sys/arch/amiga/dev/z3rambd.c	Mon Jun  1 17:09:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: z3rambd.c,v 1.2 2012/11/26 22:58:24 rkujawa Exp $ */
+/*	$NetBSD: z3rambd.c,v 1.3 2015/06/01 17:09:46 phx Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: z3rambd.c,v 1.2 2012/11/26 22:58:24 rkujawa Exp $);
+__KERNEL_RCSID(0, $NetBSD: z3rambd.c,v 1.3 2015/06/01 17:09:46 phx Exp $);
 
 /*
  * Z3 RAM virtual block device. Supports ZorRAM, BigRamPlus and FastLane Z3 so 
@@ -132,11 +132,9 @@ z3rambd_altmem_strategy(void *aux, struc
 {
 	struct z3rambd_softc *sc = aux;
 	void *addr;
-	size_t off, bpos;
+	size_t off;
 	int s;
 
-	bpos = 0;
-
 	bp-b_resid = bp-b_bcount;
 	off = bp-b_blkno  DEV_BSHIFT;
 
@@ -162,4 +160,3 @@ z3rambd_altmem_getsize(void *aux)
 	struct z3rambd_softc *sc = aux;
 	return sc-sc_size;
 }
-



CVS commit: src/sys/arch/arm

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  1 19:16:44 UTC 2015

Modified Files:
src/sys/arch/arm/arm32: arm32_kvminit.c pmap.c
src/sys/arch/arm/include/arm32: pmap.h

Log Message:
pmap_directbase is a failed experiment, nuke it.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/arm32/arm32_kvminit.c
cvs rdiff -u -r1.323 -r1.324 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/arm/include/arm32/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/arm/arm32/arm32_kvminit.c
diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.34 src/sys/arch/arm/arm32/arm32_kvminit.c:1.35
--- src/sys/arch/arm/arm32/arm32_kvminit.c:1.34	Sat May 30 23:59:33 2015
+++ src/sys/arch/arm/arm32/arm32_kvminit.c	Mon Jun  1 19:16:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_kvminit.c,v 1.34 2015/05/30 23:59:33 matt Exp $	*/
+/*	$NetBSD: arm32_kvminit.c,v 1.35 2015/06/01 19:16:44 matt Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -124,7 +124,7 @@
 #include opt_multiprocessor.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.34 2015/05/30 23:59:33 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.35 2015/06/01 19:16:44 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -166,11 +166,6 @@ extern char _end[];
 	((paddr_t)((vaddr_t)(va) - KERNEL_BASE_VOFFSET))
 #define KERN_PHYSTOV(bmi, pa) \
 	((vaddr_t)((paddr_t)(pa) + KERNEL_BASE_VOFFSET))
-#elif defined(ARM_MMU_EXTENDED)  defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
-#define KERN_VTOPHYS(bmi, va) \
-	((paddr_t)((vaddr_t)(va) - pmap_directbase + (bmi)-bmi_start))
-#define KERN_PHYSTOV(bmi, pa) \
-	((vaddr_t)((paddr_t)(pa) - (bmi)-bmi_start + pmap_directbase))
 #else
 #define KERN_VTOPHYS(bmi, va) \
 	((paddr_t)((vaddr_t)(va) - KERNEL_BASE + (bmi)-bmi_start))
@@ -233,26 +228,7 @@ arm32_bootmem_init(paddr_t memstart, psi
 	 */
 	if (bmi-bmi_start  bmi-bmi_kernelstart) {
 		pv-pv_pa = bmi-bmi_start;
-#if defined(ARM_MMU_EXTENDED)  defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
-		pv-pv_va = pmap_directbase;
-#else
-		/*
-		 * If there's lots of memory the kernel could be placed far
-		 * from the start of RAM.  If that's the case, don't map the
-		 * RAM that would have virtual addresses below KERNEL_BASE.
-		 */
-		if (pv-pv_pa  KERN_VTOPHYS(bmi, KERNEL_BASE)) {
-			psize_t size = KERN_VTOPHYS(bmi, KERNEL_BASE) - pv-pv_pa;
-			bmi-bmi_freepages += size / PAGE_SIZE;
-#ifdef VERBOSE_INIT_ARM
-			printf(%s: adding %lu free pages: [%#lx..%#lx]\n,
-			__func__, size / PAGE_SIZE, pv-pv_va,
-			pv-pv_pa + size - 1);
-#endif
-			pv-pv_pa = KERN_VTOPHYS(bmi, KERNEL_BASE);
-		}
-		pv-pv_va = KERNEL_BASE;
-#endif
+		pv-pv_va = KERN_PHYSTOV(bmi, pv-pv_pa);
 		pv-pv_size = bmi-bmi_kernelstart - pv-pv_pa;
 		bmi-bmi_freepages += pv-pv_size / PAGE_SIZE;
 #ifdef VERBOSE_INIT_ARM
@@ -431,24 +407,9 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	KASSERT(mapallmem_p);
 #ifdef ARM_MMU_EXTENDED
 	/*
-	 * We can only use address beneath kernel_vm_base to map physical
-	 * memory.
-	 */
-	const psize_t physical_size =
-	roundup(physical_end - physical_start, L1_SS_SIZE);
-	KASSERT(kernel_vm_base = physical_size);
-	/*
-	 * If we don't have enough memory via TTBR1, we have use addresses
-	 * from TTBR0 to map some of the physical memory.  But try to use as
-	 * much high memory space as possible.
+	 * The direct map VA space ends at the start of the kernel VM space.
 	 */
 	pmap_directlimit = kernel_vm_base;
-	if (kernel_vm_base - KERNEL_BASE  physical_size
-	 kernel_vm_base - physical_size = physical_start) {
-		pmap_directbase -= KERNEL_BASE_VOFFSET;
-		printf(%s: changing pmap_directbase to %#lx\n, __func__,
-		pmap_directbase);
-	}
 #else
 	KASSERT(kernel_vm_base - KERNEL_BASE = physical_end - physical_start);
 #endif /* ARM_MMU_EXTENDED */
@@ -763,15 +724,12 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	pv_addr_t *pv = SLIST_FIRST(bmi-bmi_chunks);
 	if (!mapallmem_p || pv-pv_pa == bmi-bmi_start) {
 		cur_pv = *pv;
+		KASSERTMSG(cur_pv.pv_va = KERNEL_BASE, %#lx, cur_pv.pv_va);
 		pv = SLIST_NEXT(pv, pv_list);
 	} else {
-#if defined(ARM_MMU_EXTENDED)  defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
-		cur_pv.pv_va = pmap_directbase;
-#else
 		cur_pv.pv_va = KERNEL_BASE;
-#endif
-		cur_pv.pv_pa = bmi-bmi_start;
-		cur_pv.pv_size = pv-pv_pa - bmi-bmi_start;
+		cur_pv.pv_pa = KERN_VTOPHYS(bmi, cur_pv.pv_va);
+		cur_pv.pv_size = pv-pv_pa - cur_pv.pv_pa;
 		cur_pv.pv_prot = VM_PROT_READ | VM_PROT_WRITE;
 		cur_pv.pv_cache = PTE_CACHE;
 	}
@@ -881,7 +839,6 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	/*
 	 * Now we map the stuff that isn't directly after the kernel
 	 */
-
 	if (map_vectors_p) {
 		/* Map the vector page. */
 		pmap_map_entry(l1pt_va, systempage.pv_va, systempage.pv_pa,

Index: src/sys/arch/arm/arm32/pmap.c
diff 

CVS commit: [netbsd-7] src

2015-06-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jun  1 19:19:44 UTC 2015

Modified Files:
src/share/man/man9 [netbsd-7]: disk.9
src/sys/dev [netbsd-7]: dksubr.c
src/sys/kern [netbsd-7]: subr_disk.c
src/sys/sys [netbsd-7]: dkio.h

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #775):
share/man/man9/disk.9: revision 1.37
sys/kern/subr_disk.c: revisions 1.104, 1.105
sys/dev/dksubr.c: revision 1.56
sys/sys/dkio.h: revision 1.21
Implement DIOCGMEDIASIZE and DIOCGSECTORSIZE from FreeBSD.
--
clear error for new ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.24.1 src/share/man/man9/disk.9
cvs rdiff -u -r1.51.2.2 -r1.51.2.3 src/sys/dev/dksubr.c
cvs rdiff -u -r1.103.4.1 -r1.103.4.2 src/sys/kern/subr_disk.c
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/sys/dkio.h

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

Modified files:

Index: src/share/man/man9/disk.9
diff -u src/share/man/man9/disk.9:1.36 src/share/man/man9/disk.9:1.36.24.1
--- src/share/man/man9/disk.9:1.36	Thu Dec  2 12:54:13 2010
+++ src/share/man/man9/disk.9	Mon Jun  1 19:19:44 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: disk.9,v 1.36 2010/12/02 12:54:13 wiz Exp $
+.\	$NetBSD: disk.9,v 1.36.24.1 2015/06/01 19:19:44 snj Exp $
 .\
 .\ Copyright (c) 1995, 1996 Jason R. Thorpe.
 .\ All rights reserved.
@@ -299,6 +299,10 @@ Get disk buffer queue strategy.
 Set disk buffer queue strategy.
 .It Dv DIOCGDISKINFO struct plistref
 Get disk-info dictionary.
+.It Dv DIOCGMEDIASIZE off_t
+Get disk size in bytes.
+.It Dv DIOCGSECTORSIZE u_int
+Get sector size in bytes.
 .El
 .Sh USING THE FRAMEWORK
 This section includes a description on basic use of the framework

Index: src/sys/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.51.2.2 src/sys/dev/dksubr.c:1.51.2.3
--- src/sys/dev/dksubr.c:1.51.2.2	Tue Nov 11 10:42:22 2014
+++ src/sys/dev/dksubr.c	Mon Jun  1 19:19:44 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.51.2.2 2014/11/11 10:42:22 martin Exp $ */
+/* $NetBSD: dksubr.c,v 1.51.2.3 2015/06/01 19:19:44 snj Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dksubr.c,v 1.51.2.2 2014/11/11 10:42:22 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: dksubr.c,v 1.51.2.3 2015/06/01 19:19:44 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -291,10 +291,6 @@ dk_ioctl(struct dk_intf *di, struct dk_s
 
 	/* ensure that the pseudo-disk is initialized for these */
 	switch (cmd) {
-#ifdef DIOCGSECTORSIZE
-	case DIOCGSECTORSIZE:
-	case DIOCGMEDIASIZE:
-#endif
 	case DIOCGDINFO:
 	case DIOCSDINFO:
 	case DIOCWDINFO:
@@ -317,17 +313,6 @@ dk_ioctl(struct dk_intf *di, struct dk_s
 	}
 
 	switch (cmd) {
-#ifdef DIOCGSECTORSIZE
-	case DIOCGSECTORSIZE:
-		*(u_int *)data = dksc-sc_dkdev.dk_geom.dg_secsize;
-		return 0;
-	case DIOCGMEDIASIZE:
-		*(off_t *)data =
-		(off_t)dksc-sc_dkdev.dk_geom.dg_secsize *
-		dksc-sc_dkdev.dk_geom.dg_nsectors;
-		return 0;
-#endif
-
 	case DIOCGDINFO:
 		*(struct disklabel *)data = *(dksc-sc_dkdev.dk_label);
 		break;

Index: src/sys/kern/subr_disk.c
diff -u src/sys/kern/subr_disk.c:1.103.4.1 src/sys/kern/subr_disk.c:1.103.4.2
--- src/sys/kern/subr_disk.c:1.103.4.1	Tue May 19 04:53:02 2015
+++ src/sys/kern/subr_disk.c	Mon Jun  1 19:19:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk.c,v 1.103.4.1 2015/05/19 04:53:02 snj Exp $	*/
+/*	$NetBSD: subr_disk.c,v 1.103.4.2 2015/06/01 19:19:44 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_disk.c,v 1.103.4.1 2015/05/19 04:53:02 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_disk.c,v 1.103.4.2 2015/06/01 19:19:44 snj Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -510,7 +510,7 @@ int
 disk_ioctl(struct disk *diskp, u_long cmd, void *data, int flag,
 	   struct lwp *l)
 {
-	int error;
+	int error = 0;
 
 	switch (cmd) {
 	case DIOCGDISKINFO:
@@ -525,6 +525,15 @@ disk_ioctl(struct disk *diskp, u_long cm
 		break;
 	}
 
+	case DIOCGSECTORSIZE:
+		*(u_int *)data = diskp-dk_geom.dg_secsize;
+		break;
+
+	case DIOCGMEDIASIZE:
+		*(off_t *)data = (off_t)diskp-dk_geom.dg_secsize *
+		diskp-dk_geom.dg_secperunit;
+		break;
+
 	default:
 		error = EPASSTHROUGH;
 	}

Index: src/sys/sys/dkio.h
diff -u src/sys/sys/dkio.h:1.19.2.1 src/sys/sys/dkio.h:1.19.2.2
--- src/sys/sys/dkio.h:1.19.2.1	Tue Nov 11 10:36:41 2014
+++ src/sys/sys/dkio.h	Mon Jun  1 19:19:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dkio.h,v 1.19.2.1 2014/11/11 10:36:41 martin Exp $	*/
+/*	$NetBSD: dkio.h,v 1.19.2.2 2015/06/01 19:19:44 snj Exp $	*/
 
 /*
  * Copyright (c) 1987, 1988, 1993
@@ -115,4 +115,8 @@
 		/* trigger wedge auto discover */
 #define	DIOCMWEDGES	_IOR('d', 131, int)	/* make wedges */
 
+		/* query disk 

CVS commit: [netbsd-7] src/usr.bin/make

2015-06-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jun  1 19:24:47 UTC 2015

Modified Files:
src/usr.bin/make [netbsd-7]: targ.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #810):
usr.bin/make/targ.c: revision 1.60
Fix warning about uninitialized variable
This warning gets fatal when including make(1) as a crunchgen(1) binary.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.10.1 src/usr.bin/make/targ.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/make/targ.c
diff -u src/usr.bin/make/targ.c:1.57 src/usr.bin/make/targ.c:1.57.10.1
--- src/usr.bin/make/targ.c:1.57	Tue Jun 12 19:21:51 2012
+++ src/usr.bin/make/targ.c	Mon Jun  1 19:24:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.57 2012/06/12 19:21:51 joerg Exp $	*/
+/*	$NetBSD: targ.c,v 1.57.10.1 2015/06/01 19:24:47 snj Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = $NetBSD: targ.c,v 1.57 2012/06/12 19:21:51 joerg Exp $;
+static char rcsid[] = $NetBSD: targ.c,v 1.57.10.1 2015/06/01 19:24:47 snj Exp $;
 #else
 #include sys/cdefs.h
 #ifndef lint
 #if 0
 static char sccsid[] = @(#)targ.c	8.2 (Berkeley) 3/19/94;
 #else
-__RCSID($NetBSD: targ.c,v 1.57 2012/06/12 19:21:51 joerg Exp $);
+__RCSID($NetBSD: targ.c,v 1.57.10.1 2015/06/01 19:24:47 snj Exp $);
 #endif
 #endif /* not lint */
 #endif
@@ -334,7 +334,7 @@ GNode *
 Targ_FindNode(const char *name, int flags)
 {
 GNode *gn;	  /* node in that element */
-Hash_Entry	  *he;	  /* New or used hash entry for node */
+Hash_Entry	  *he = NULL; /* New or used hash entry for node */
 Boolean	  isNew;  /* Set TRUE if Hash_CreateEntry had to create */
 			  /* an entry for the node */
 



CVS commit: [netbsd-7] src

2015-06-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jun  1 19:38:35 UTC 2015

Modified Files:
src/compat [netbsd-7]: archdirs.mk
src/compat/arm/eabihf [netbsd-7]: bsd.eabihf.mk
src/external/gpl3/gcc/dist/gcc [netbsd-7]: config.gcc
src/external/gpl3/gcc/dist/gcc/config/arm [netbsd-7]: netbsd-eabi.h
Added Files:
src/external/gpl3/gcc/dist/gcc/config/arm [netbsd-7]: t-netbsdeabi

Log Message:
Pull up following revision(s) (requested by martin in ticket #816):
compat/archdirs.mk: revisions 1.7, 1.9, 1.10
compat/arm/eabihf/bsd.eabihf.mk: revision 1.2
external/gpl3/gcc/dist/gcc/config.gcc: revision 1.33
external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h: revision 1.14
external/gpl3/gcc/dist/gcc/config/arm/t-netbsdeabi: revision 1.1
Enable building eabihf compat libraries after fixing bsd.eabihf.mk to use
--
use the proper variant of arm*--netbsdelf-eabihf
--
Fix broken subdir selection after arm architecture explosion
--
Only support oabi for earm*
--
Make MULTILIBS work for oabi


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/compat/archdirs.mk
cvs rdiff -u -r1.1 -r1.1.2.1 src/compat/arm/eabihf/bsd.eabihf.mk
cvs rdiff -u -r1.26.2.2 -r1.26.2.3 src/external/gpl3/gcc/dist/gcc/config.gcc
cvs rdiff -u -r1.13 -r1.13.2.1 \
src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h
cvs rdiff -u -r0 -r1.1.2.2 \
src/external/gpl3/gcc/dist/gcc/config/arm/t-netbsdeabi

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

Modified files:

Index: src/compat/archdirs.mk
diff -u src/compat/archdirs.mk:1.6 src/compat/archdirs.mk:1.6.2.1
--- src/compat/archdirs.mk:1.6	Mon Aug 11 04:33:30 2014
+++ src/compat/archdirs.mk	Mon Jun  1 19:38:35 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: archdirs.mk,v 1.6 2014/08/11 04:33:30 matt Exp $
+#	$NetBSD: archdirs.mk,v 1.6.2.1 2015/06/01 19:38:35 snj Exp $
 
 # list of subdirs used per-platform
 
@@ -10,18 +10,10 @@ ARCHDIR_SUBDIR=	sparc64/sparc
 ARCHDIR_SUBDIR=	amd64/i386
 .endif
 
-.if (${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == armeb)
-ARCHDIR_SUBDIR=	arm/eabi
-.endif
-
-.if (${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb)
+.if !empty(MACHINE_ARCH:Mearm*)
 ARCHDIR_SUBDIR=	arm/oabi
 .endif
 
-.if (${MACHINE_ARCH} == earmhf || ${MACHINE_ARCH} == earmhfeb)
-ARCHDIR_SUBDIR=	arm/oabi arm/eabi
-.endif
-
 .if (${MACHINE_ARCH} == mips64eb || ${MACHINE_ARCH} == mips64el)
 ARCHDIR_SUBDIR=	mips64/64 mips64/o32
 .endif
@@ -32,7 +24,7 @@ ARCHDIR_SUBDIR= powerpc64/powerpc
 
 .if (${MACHINE_ARCH} == aarch64)
 ARCHDIR_SUBDIR+= arm/eabi
-#ARCHDIR_SUBDIR+= arm/eabihf
+ARCHDIR_SUBDIR+= arm/eabihf
 ARCHDIR_SUBDIR+= arm/oabi
 .elif (${MACHINE_ARCH} == aarch64eb)
 ARCHDIR_SUBDIR= arm/eabi

Index: src/compat/arm/eabihf/bsd.eabihf.mk
diff -u src/compat/arm/eabihf/bsd.eabihf.mk:1.1 src/compat/arm/eabihf/bsd.eabihf.mk:1.1.2.1
--- src/compat/arm/eabihf/bsd.eabihf.mk:1.1	Sun Aug 10 23:26:25 2014
+++ src/compat/arm/eabihf/bsd.eabihf.mk	Mon Jun  1 19:38:35 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.eabihf.mk,v 1.1 2014/08/10 23:26:25 matt Exp $
+#	$NetBSD: bsd.eabihf.mk,v 1.1.2.1 2015/06/01 19:38:35 snj Exp $
 
 .if !defined(MLIBDIR)
 
@@ -9,22 +9,22 @@ EARM_COMPAT_FLAGS+=	-mabi=aapcs-linux
 MKSOFTFLOAT=no
 
 .if ${MACHINE_ARCH} == aarch64eb
-EARM_COMPAT_FLAGS+=	-target armeb--netbsdelf-gnueabi
+EARM_COMPAT_FLAGS+=	-target armeb--netbsdelf-eabihf
 EARM_COMPAT_FLAGS+=	-mcpu=cortex-a53
 ARM_MACHINE_ARCH=	earmv7hfeb
 LDFLAGS+=		-Wl,--be8
 ARM_LD=			-m armelfb_nbsd_eabihf --be8
 .elif ${MACHINE_ARCH} == aarch64
-EARM_COMPAT_FLAGS+=	-target arm--netbsdelf-gnueabi
+EARM_COMPAT_FLAGS+=	-target arm--netbsdelf-eabihf
 EARM_COMPAT_FLAGS+=	-mcpu=cortex-a53
 ARM_MACHINE_ARCH=	earmv7hf
 ARM_LD=			-m armelf_nbsd_eabihf
 .elif !empty(MACHINE_ARCH:M*eb)
-EARM_COMPAT_FLAGS+=	-target armeb--netbsdelf-gnueabi
+EARM_COMPAT_FLAGS+=	-target armeb--netbsdelf-eabihf
 ARM_MACHINE_ARCH=	earmhfeb
 ARM_LD=			-m armelfb_nbsd_eabihf
 .else
-EARM_COMPAT_FLAGS+=	-target arm--netbsdelf-gnueabi
+EARM_COMPAT_FLAGS+=	-target arm--netbsdelf-eabihf
 ARM_MACHINE_ARCH=	earmhf
 ARM_LD=			-m armelf_nbsd_eabihf
 .endif

Index: src/external/gpl3/gcc/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc/dist/gcc/config.gcc:1.26.2.2 src/external/gpl3/gcc/dist/gcc/config.gcc:1.26.2.3
--- src/external/gpl3/gcc/dist/gcc/config.gcc:1.26.2.2	Sun Jan 25 00:19:27 2015
+++ src/external/gpl3/gcc/dist/gcc/config.gcc	Mon Jun  1 19:38:35 2015
@@ -897,7 +897,7 @@ arm*-*-netbsdelf*)
 	case ${target} in
 	arm*-*-netbsdelf-*eabi*)
 	tm_file=$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h
-	tmake_file=$tmake_file arm/t-bpabi
+	tmake_file=$tmake_file arm/t-bpabi arm/t-netbsdeabi
 	# The BPABI long long divmod functions return a 128-bit value in
 	# registers r0-r3.  Correctly modeling that requires the use of
 	# TImode.

Index: src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h
diff 

CVS commit: [netbsd-7] src/usr.bin/netstat

2015-06-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jun  1 19:22:31 UTC 2015

Modified Files:
src/usr.bin/netstat [netbsd-7]: route.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #809):
usr.bin/netstat/route.c: revision 1.84
Make sure netstat builds with -DSMALL
src/usr.bin/netstat relies on code from src/sbin/route. WHen building
with -DSMALL, some functions such as mpls_ntoa() or p_rtrmx() are not
built in src/sbin/route. We therefore have to make sure they are not
used in src/usr.bin/netstat.


To generate a diff of this commit:
cvs rdiff -u -r1.82.2.1 -r1.82.2.2 src/usr.bin/netstat/route.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/netstat/route.c
diff -u src/usr.bin/netstat/route.c:1.82.2.1 src/usr.bin/netstat/route.c:1.82.2.2
--- src/usr.bin/netstat/route.c:1.82.2.1	Thu Jan  8 11:01:01 2015
+++ src/usr.bin/netstat/route.c	Mon Jun  1 19:22:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.82.2.1 2015/01/08 11:01:01 martin Exp $	*/
+/*	$NetBSD: route.c,v 1.82.2.2 2015/06/01 19:22:31 snj Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = from: @(#)route.c	8.3 (Berkeley) 3/9/94;
 #else
-__RCSID($NetBSD: route.c,v 1.82.2.1 2015/01/08 11:01:01 martin Exp $);
+__RCSID($NetBSD: route.c,v 1.82.2.2 2015/06/01 19:22:31 snj Exp $);
 #endif
 #endif /* not lint */
 
@@ -262,6 +262,7 @@ p_krtentry(struct rtentry *rt)
 		printf(%6s, -);
 	putchar((rt-rt_rmx.rmx_locks  RTV_MTU) ? 'L' : ' ');
 	if (tagflag == 1) {
+#ifndef SMALL
 		if (rt-rt_tag != NULL) {
 			const struct sockaddr *tagsa = kgetsa(rt-rt_tag);
 			char *tagstr;
@@ -276,6 +277,7 @@ p_krtentry(struct rtentry *rt)
 			else
 printf(%7s, -);
 		} else
+#endif
 			printf(%7s, -);
 	}
 	if (rt-rt_ifp) {
@@ -287,8 +289,10 @@ p_krtentry(struct rtentry *rt)
 			rt-rt_nodes[0].rn_dupedkey ?  = : );
 	}
 	putchar('\n');
+#ifndef SMALL
 	if (vflag)
 		p_rtrmx(rt-rt_rmx);
+#endif
 }
 
 /*



CVS commit: [netbsd-7] src/doc

2015-06-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jun  1 19:40:05 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
775, 810, 811, 816


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.313 -r1.1.2.314 src/doc/CHANGES-7.0

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

Modified files:

Index: src/doc/CHANGES-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.313 src/doc/CHANGES-7.0:1.1.2.314
--- src/doc/CHANGES-7.0:1.1.2.313	Thu May 28 10:03:27 2015
+++ src/doc/CHANGES-7.0	Mon Jun  1 19:40:04 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.313 2015/05/28 10:03:27 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.314 2015/06/01 19:40:04 snj Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -23581,3 +23581,36 @@ lib/libm/arch/m68k/s_copysign.S			1.10
 	Deal with the potential pressence of long double support.
 	[joerg, ticket #812]
 
+share/man/man9/disk.91.37
+sys/dev/dksubr.c1.56
+sys/kern/subr_disk.c1.104, 1.105
+sys/sys/dkio.h	1.21
+
+	Implement DIOCGMEDIASIZE and DIOCGSECTORSIZE.
+	[jnemeth, ticket #775]
+
+usr.bin/netstat/route.c1.84
+
+	Make sure netstat builds with -DSMALL.
+	[manu, ticket #809]
+
+usr.bin/make/targ.c1.60
+
+	Fix uninitialized variable warning.
+	[manu, ticket #810]
+
+lib/libcurses/unctrl.h1.5
+
+	Fix quoting in macro.
+	[wiz, ticket #811]
+
+compat/archdirs.mk1.7, 1.9, 1.10
+compat/arm/eabihf/bsd.eabihf.mk			1.2
+external/gpl3/gcc/dist/gcc/config.gcc		1.33
+external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h 1.14
+external/gpl3/gcc/dist/gcc/config/arm/t-netbsdeabi 1.1
+
+	Fix build infrastructure and gcc for providing OABI compat
+	libraries on earm* machines.
+	[martin, ticket #816]
+



CVS commit: src/sys/dev/wsfb

2015-06-01 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon Jun  1 20:47:59 UTC 2015

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
Fix splashscreen on resolutions where text is centered.

This commit was approved by macallan@


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.57 src/sys/dev/wsfb/genfb.c:1.58
--- src/sys/dev/wsfb/genfb.c:1.57	Fri Mar 20 21:55:46 2015
+++ src/sys/dev/wsfb/genfb.c	Mon Jun  1 20:47:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.57 2015/03/20 21:55:46 jmcneill Exp $ */
+/*	$NetBSD: genfb.c,v 1.58 2015/06/01 20:47:59 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.57 2015/03/20 21:55:46 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.58 2015/06/01 20:47:59 nat Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -305,7 +305,7 @@ genfb_attach(struct genfb_softc *sc, str
 	genfb_restore_palette(sc);
 
 	sc-sc_splash.si_depth = sc-sc_depth;
-	sc-sc_splash.si_bits = sc-sc_console_screen.scr_ri.ri_bits;
+	sc-sc_splash.si_bits = sc-sc_console_screen.scr_ri.ri_origbits;
 	sc-sc_splash.si_hwbits = sc-sc_fbaddr;
 	sc-sc_splash.si_width = sc-sc_width;
 	sc-sc_splash.si_height = sc-sc_height;



CVS commit: src/common/lib/libc/arch/mips/atomic

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  1 23:16:54 UTC 2015

Modified Files:
src/common/lib/libc/arch/mips/atomic: atomic_add.S atomic_cas.S
atomic_dec.S atomic_inc.S atomic_op_asm.h atomic_swap.S
membar_ops.S

Log Message:
Include OCTEON support for syncw and saa/saad (Store Atomic Add).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/mips/atomic/atomic_add.S \
src/common/lib/libc/arch/mips/atomic/atomic_dec.S \
src/common/lib/libc/arch/mips/atomic/atomic_inc.S \
src/common/lib/libc/arch/mips/atomic/atomic_swap.S
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/mips/atomic/atomic_cas.S
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/mips/atomic/atomic_op_asm.h
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/mips/atomic/membar_ops.S

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

Modified files:

Index: src/common/lib/libc/arch/mips/atomic/atomic_add.S
diff -u src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.4 src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.5
--- src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.4	Wed Mar 14 16:50:34 2012
+++ src/common/lib/libc/arch/mips/atomic/atomic_add.S	Mon Jun  1 23:16:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add.S,v 1.4 2012/03/14 16:50:34 christos Exp $	*/
+/*	$NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include machine/asm.h
 #include atomic_op_asm.h
 
-RCSID($NetBSD: atomic_add.S,v 1.4 2012/03/14 16:50:34 christos Exp $)
+RCSID($NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt Exp $)
 
 	.text
 	.set	noreorder
@@ -46,12 +46,16 @@ RCSID($NetBSD: atomic_add.S,v 1.4 2012/
 
 
 LEAF(_atomic_add_32)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+	saa		a1, (a0)
+#else
 1:	INT_LL		t0, 0(a0)
 	 nop
 	INT_ADDU	t0, a1
 	INT_SC		t0, 0(a0)
 	beq		t0, zero, 1b
  	 nop
+#endif
 	j		ra
 	 nop
 END(_atomic_add_32)
@@ -72,12 +76,16 @@ ATOMIC_OP_ALIAS(atomic_add_32_nv, _atomi
 
 #if !defined(__mips_o32)
 LEAF(_atomic_add_64)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+	saad		a1, (a0)
+#else
 1:	REG_LL		t0, 0(a0)
 	 nop
 	REG_ADDU	t0, a1
 	REG_SC		t0, 0(a0)
 	beq		t0, zero, 1b
  	 nop
+#endif
 	j		ra
 	 nop
 END(_atomic_add_64)
Index: src/common/lib/libc/arch/mips/atomic/atomic_dec.S
diff -u src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.4 src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.5
--- src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.4	Wed Mar 14 16:50:34 2012
+++ src/common/lib/libc/arch/mips/atomic/atomic_dec.S	Mon Jun  1 23:16:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_dec.S,v 1.4 2012/03/14 16:50:34 christos Exp $	*/
+/*	$NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include machine/asm.h
 #include atomic_op_asm.h
 
-RCSID($NetBSD: atomic_dec.S,v 1.4 2012/03/14 16:50:34 christos Exp $)
+RCSID($NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt Exp $)
 
 	.text
 	.set	noreorder
@@ -45,12 +45,17 @@ RCSID($NetBSD: atomic_dec.S,v 1.4 2012/
 #endif /* _KERNEL_OPT */
 
 LEAF(_atomic_dec_32)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+	li		t0, -1
+	saa		t0, (a0)
+#else
 1:	INT_LL		t0, 0(a0)
 	 nop
 	INT_ADDU	t0, -1
 	INT_SC		t0, 0(a0)
 	beq		t0, zero, 1b
  	 nop
+#endif
 	j		ra
 	 nop
 END(_atomic_dec_32)
@@ -71,12 +76,17 @@ ATOMIC_OP_ALIAS(atomic_dec_32_nv, _atomi
 
 #if !defined(__mips_o32)
 LEAF(_atomic_dec_64)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+	li		t0, -1
+	saad		t0, (a0)
+#else
 1:	REG_LL		t0, 0(a0)
 	 nop
 	REG_ADDU	t0, -1
 	REG_SC		t0, 0(a0)
 	beq		t0, zero, 1b
  	 nop
+#endif
 	j		ra
 	 nop
 END(_atomic_dec_64)
Index: src/common/lib/libc/arch/mips/atomic/atomic_inc.S
diff -u src/common/lib/libc/arch/mips/atomic/atomic_inc.S:1.4 src/common/lib/libc/arch/mips/atomic/atomic_inc.S:1.5
--- src/common/lib/libc/arch/mips/atomic/atomic_inc.S:1.4	Wed Mar 14 16:50:34 2012
+++ src/common/lib/libc/arch/mips/atomic/atomic_inc.S	Mon Jun  1 23:16:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_inc.S,v 1.4 2012/03/14 16:50:34 christos Exp $	*/
+/*	$NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include machine/asm.h
 #include atomic_op_asm.h
 
-RCSID($NetBSD: atomic_inc.S,v 1.4 2012/03/14 16:50:34 christos Exp $)
+RCSID($NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt Exp $)
 
 	.text
 	.set	noreorder
@@ -46,12 +46,17 @@ RCSID($NetBSD: atomic_inc.S,v 1.4 2012/
 
 
 LEAF(_atomic_inc_32)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+	li		t0, 1
+	saa		t0, (a0)
+#else
 1:	INT_LL		t0, 0(a0)
 	 nop
 	INT_ADDU	t0, 1
 	INT_SC		t0, 0(a0)
 	beq		t0, zero, 1b
  	 nop
+#endif
 	j		ra
 	 nop
 

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

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  1 23:17:47 UTC 2015

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

Log Message:
cinclude CUBIEBOARD.local


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/CUBIETRUCK

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/CUBIETRUCK
diff -u src/sys/arch/evbarm/conf/CUBIETRUCK:1.7 src/sys/arch/evbarm/conf/CUBIETRUCK:1.8
--- src/sys/arch/evbarm/conf/CUBIETRUCK:1.7	Sun Apr 19 21:28:37 2015
+++ src/sys/arch/evbarm/conf/CUBIETRUCK	Mon Jun  1 23:17:47 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: CUBIETRUCK,v 1.7 2015/04/19 21:28:37 matt Exp $
+#	$NetBSD: CUBIETRUCK,v 1.8 2015/06/01 23:17:47 matt Exp $
 #
 #	CUBIETRUCK - Cubieboard3 (mostly cubieboard2 with 2GB)
 #
@@ -27,4 +27,6 @@ makeoptions	CPUFLAGS=-mcpu=cortex-a7 -m
 #
 options 	PMAP_NEED_ALLOC_POOLPAGE
 
+cinclude	arch/evbarm/conf/CUBIETRUCK.local
+
 #options 	VERBOSE_INIT_ARM # verbose bootstraping messages



CVS commit: src/sys/arch

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun  1 22:55:13 UTC 2015

Modified Files:
src/sys/arch/evbmips/cavium: mach_intr.c machdep.c
src/sys/arch/evbmips/conf: ERLITE files.octeon
src/sys/arch/evbmips/malta: machdep.c
src/sys/arch/evbmips/rmixl: machdep.c
src/sys/arch/mips/cavium: mainbus_octeon1p.c octeon_intr.c
octeon_iobus.c octeonvar.h
src/sys/arch/mips/cavium/dev: octeon_ciureg.h octeon_corereg.h
octeon_dwctwo.c octeon_gmx.c octeon_ipd.c octeon_mpi.c octeon_pci.c
octeon_pow.c octeon_uart.c
src/sys/arch/mips/conf: files.octeon std.octeon
src/sys/arch/mips/include: cpu.h cpuregs.h intr.h lock.h locore.h
mips_opcode.h
src/sys/arch/mips/mips: cpu_subr.c locore.S locore_mips3.S
locore_octeon.S mips_fixup.c mips_machdep.c
src/sys/arch/mips/rmi: rmixl_cpu.c
Added Files:
src/sys/arch/mips/cavium: octeon_cpunode.c

Log Message:
Rework cavium support in preparation for MULTIPROCESSOR support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbmips/cavium/mach_intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/conf/ERLITE
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbmips/conf/files.octeon
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/evbmips/malta/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbmips/rmixl/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/mainbus_octeon1p.c \
src/sys/arch/mips/cavium/octeon_iobus.c \
src/sys/arch/mips/cavium/octeonvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/cavium/octeon_cpunode.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/octeon_intr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_ciureg.h \
src/sys/arch/mips/cavium/dev/octeon_corereg.h \
src/sys/arch/mips/cavium/dev/octeon_dwctwo.c \
src/sys/arch/mips/cavium/dev/octeon_gmx.c \
src/sys/arch/mips/cavium/dev/octeon_ipd.c \
src/sys/arch/mips/cavium/dev/octeon_mpi.c \
src/sys/arch/mips/cavium/dev/octeon_pci.c \
src/sys/arch/mips/cavium/dev/octeon_pow.c \
src/sys/arch/mips/cavium/dev/octeon_uart.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/conf/files.octeon
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/conf/std.octeon
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/include/intr.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/lock.h \
src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/mips/mips/locore_mips3.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/mips/locore_octeon.S
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/mips/mips_fixup.c
cvs rdiff -u -r1.264 -r1.265 src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/rmi/rmixl_cpu.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/cavium/mach_intr.c
diff -u src/sys/arch/evbmips/cavium/mach_intr.c:1.1 src/sys/arch/evbmips/cavium/mach_intr.c:1.2
--- src/sys/arch/evbmips/cavium/mach_intr.c:1.1	Wed Apr 29 08:32:01 2015
+++ src/sys/arch/evbmips/cavium/mach_intr.c	Mon Jun  1 22:55:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mach_intr.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $	*/
+/*	$NetBSD: mach_intr.c,v 1.2 2015/06/01 22:55:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,12 +38,13 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mach_intr.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $);
+__KERNEL_RCSID(0, $NetBSD: mach_intr.c,v 1.2 2015/06/01 22:55:12 matt Exp $);
 
 #include opt_ddb.h
 
 #include sys/param.h
 #include sys/bus.h
+#include sys/lwp.h
 #include sys/device.h
 #include sys/intr.h
 #include sys/kernel.h
@@ -56,7 +57,7 @@ __KERNEL_RCSID(0, $NetBSD: mach_intr.c,
 void
 evbmips_intr_init(void)
 {
-	octeon_intr_init();
+	octeon_intr_init(curcpu());
 }
 
 void

Index: src/sys/arch/evbmips/cavium/machdep.c
diff -u src/sys/arch/evbmips/cavium/machdep.c:1.2 src/sys/arch/evbmips/cavium/machdep.c:1.3
--- src/sys/arch/evbmips/cavium/machdep.c:1.2	Mon May 18 01:32:18 2015
+++ src/sys/arch/evbmips/cavium/machdep.c	Mon Jun  1 22:55:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.2 2015/05/18 01:32:18 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.3 2015/06/01 22:55:12 matt Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.2 2015/05/18 01:32:18 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.3 2015/06/01 22:55:12 matt Exp $);
 
 #include sys/param.h
 #include 

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

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:05:28 UTC 2015

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

Log Message:
Fix CPU_INFO_FOREACH which had the MULTIPROCESSOR/!MULTIPROCESSOR definitions
reversed.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/mips/include/cpu.h

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

Modified files:

Index: src/sys/arch/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.112 src/sys/arch/mips/include/cpu.h:1.113
--- src/sys/arch/mips/include/cpu.h:1.112	Mon Jun  1 22:55:12 2015
+++ src/sys/arch/mips/include/cpu.h	Tue Jun  2 05:05:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.112 2015/06/01 22:55:12 matt Exp $	*/
+/*	$NetBSD: cpu.h,v 1.113 2015/06/02 05:05:28 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -149,13 +149,13 @@ struct cpu_info {
 };
 
 #ifdef MULTIPROCESSOR
-#define	CPU_INFO_ITERATOR		int __unused
+#define	CPU_INFO_ITERATOR		int
 #define	CPU_INFO_FOREACH(cii, ci)	\
-ci = cpu_info_store; ci != NULL; ci = NULL
+cii = 0, ci = cpu_infos[0]; cii  ncpu  (ci = cpu_infos[cii]) != NULL; cii++
 #else
-#define	CPU_INFO_ITERATOR		int
+#define	CPU_INFO_ITERATOR		int __unused
 #define	CPU_INFO_FOREACH(cii, ci)	\
-cii = 0; cii  MAXCPUS  (ci = cpu_infos[cii]) != NULL; cii++
+ci = cpu_info_store; ci != NULL; ci = NULL
 #endif
 
 #endif /* !_LOCORE */



CVS commit: src/sys/arch/mips/mips

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:06:23 UTC 2015

Modified Files:
src/sys/arch/mips/mips: locore.S

Log Message:
Indent branch delay slot instructions.


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 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.192 src/sys/arch/mips/mips/locore.S:1.193
--- src/sys/arch/mips/mips/locore.S:1.192	Mon Jun  1 22:55:13 2015
+++ src/sys/arch/mips/mips/locore.S	Tue Jun  2 05:06:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.192 2015/06/01 22:55:13 matt Exp $	*/
+/*	$NetBSD: locore.S,v 1.193 2015/06/02 05:06:23 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -100,16 +100,16 @@ _C_LABEL(kernel_text):
 	//
 	mfc0	a0, MIPS_COP_0_PRID, 1		# EBASE
 	COP0_SYNC
-	and	a1, a0, 0x1ff			# get CPU number
+	ext	a1, a0, 0, 10			# get CPU number
 	beqz	a1, 2f# normal startup if 0
-	nop
+	 nop
 #ifdef MULTIPROCESSOR
 	j	_C_LABEL(octeon_cpu_spinup)
-	nop
+	 nop
 #else
 1:	wait
 	b	1b
-	nop
+	 nop
 #endif /* MIPS64_OCTEON */
 2:
 #endif



CVS commit: src/sys/dev/pci

2015-06-01 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Jun  2 02:07:54 UTC 2015

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
fix typo. s/Wirelsss/Wireless/


To generate a diff of this commit:
cvs rdiff -u -r1.1226 -r1.1227 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1226 src/sys/dev/pci/pcidevs:1.1227
--- src/sys/dev/pci/pcidevs:1.1226	Sat May 16 09:39:22 2015
+++ src/sys/dev/pci/pcidevs	Tue Jun  2 02:07:54 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1226 2015/05/16 09:39:22 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1227 2015/06/02 02:07:54 nonaka Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2632,7 +2632,7 @@ product INTEL WIFI_LINK_100_2	0x08af	Cen
 product INTEL WIFI_LINK_7260_1	0x08b1	Dual Band Wireless AC 7260
 product INTEL WIFI_LINK_7260_2	0x08b2	Dual Band Wireless AC 7260
 product INTEL WIFI_LINK_3160_1	0x08b3	Dual Band Wireless AC 3160
-product INTEL WIFI_LINK_3160_2	0x08b4	Dual Band Wirelsss AC 3160
+product INTEL WIFI_LINK_3160_2	0x08b4	Dual Band Wireless AC 3160
 product INTEL X1000_I2C_GPIO	0x0934	Quark X1000 I2C and GPIO
 product INTEL X1000_SPI		0x0935	Quark X1000 SPI
 product INTEL X1000_HS_UART	0x0936	Quark X1000 HS-UART



CVS commit: src/sys/dev/pci

2015-06-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun  2 03:49:10 UTC 2015

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

Log Message:
 Fix a bug that flags related to semaphore were incorrectly checked in
wm_kmrn_{readreg,writereg}. i80003, ICH* and PCH* had this problem.


To generate a diff of this commit:
cvs rdiff -u -r1.322 -r1.323 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.322 src/sys/dev/pci/if_wm.c:1.323
--- src/sys/dev/pci/if_wm.c:1.322	Fri May 22 03:15:43 2015
+++ src/sys/dev/pci/if_wm.c	Tue Jun  2 03:49:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.322 2015/05/22 03:15:43 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.323 2015/06/02 03:49:10 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.322 2015/05/22 03:15:43 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.323 2015/06/02 03:49:10 msaitoh Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_net_mpsafe.h
@@ -7297,13 +7297,13 @@ wm_kmrn_readreg(struct wm_softc *sc, int
 {
 	int rv;
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW) {
+	if (sc-sc_flags  WM_F_LOCK_SWFW) {
 		if (wm_get_swfw_semaphore(sc, SWFW_MAC_CSR_SM)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
 			return 0;
 		}
-	} else if (sc-sc_flags == WM_F_LOCK_EXTCNF) {
+	} else if (sc-sc_flags  WM_F_LOCK_EXTCNF) {
 		if (wm_get_swfwhw_semaphore(sc)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
@@ -7319,9 +7319,9 @@ wm_kmrn_readreg(struct wm_softc *sc, int
 
 	rv = CSR_READ(sc, WMREG_KUMCTRLSTA)  KUMCTRLSTA_MASK;
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW)
+	if (sc-sc_flags  WM_F_LOCK_SWFW)
 		wm_put_swfw_semaphore(sc, SWFW_MAC_CSR_SM);
-	else if (sc-sc_flags == WM_F_LOCK_EXTCNF)
+	else if (sc-sc_flags  WM_F_LOCK_EXTCNF)
 		wm_put_swfwhw_semaphore(sc);
 
 	return rv;
@@ -7336,13 +7336,13 @@ static void
 wm_kmrn_writereg(struct wm_softc *sc, int reg, int val)
 {
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW) {
+	if (sc-sc_flags  WM_F_LOCK_SWFW) {
 		if (wm_get_swfw_semaphore(sc, SWFW_MAC_CSR_SM)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
 			return;
 		}
-	} else if (sc-sc_flags == WM_F_LOCK_EXTCNF) {
+	} else if (sc-sc_flags  WM_F_LOCK_EXTCNF) {
 		if (wm_get_swfwhw_semaphore(sc)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
@@ -7354,9 +7354,9 @@ wm_kmrn_writereg(struct wm_softc *sc, in
 	((reg  KUMCTRLSTA_OFFSET_SHIFT)  KUMCTRLSTA_OFFSET) |
 	(val  KUMCTRLSTA_MASK));
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW)
+	if (sc-sc_flags  WM_F_LOCK_SWFW)
 		wm_put_swfw_semaphore(sc, SWFW_MAC_CSR_SM);
-	else if (sc-sc_flags == WM_F_LOCK_EXTCNF)
+	else if (sc-sc_flags  WM_F_LOCK_EXTCNF)
 		wm_put_swfwhw_semaphore(sc);
 }
 



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

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:54:23 UTC 2015

Modified Files:
src/sys/arch/arm/include/arm32: vmparam.h

Log Message:
Back off MAXDSIZ to 1.5GB to avoid some virtual memory exhausted messages.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/include/arm32/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/arm/include/arm32/vmparam.h
diff -u src/sys/arch/arm/include/arm32/vmparam.h:1.37 src/sys/arch/arm/include/arm32/vmparam.h:1.38
--- src/sys/arch/arm/include/arm32/vmparam.h:1.37	Thu May 28 02:24:23 2015
+++ src/sys/arch/arm/include/arm32/vmparam.h	Tue Jun  2 05:54:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.37 2015/05/28 02:24:23 matt Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.38 2015/06/02 05:54:23 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 #define	DFLDSIZ		(384*1024*1024)		/* initial data size limit */
 #endif
 #ifndef	MAXDSIZ
-#define	MAXDSIZ		(1856*1024*1024)	/* max data size */
+#define	MAXDSIZ		(1536*1024*1024)	/* max data size */
 #endif
 #ifndef	DFLSSIZ
 #define	DFLSSIZ		(4*1024*1024)		/* initial stack size limit */



CVS commit: src/sys/arch/mips/mips

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:09:15 UTC 2015

Modified Files:
src/sys/arch/mips/mips: locore_mips3.S

Log Message:
In cpu_trampoline, load the ksp from the idlelwp after we enable KX.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/mips/mips/locore_mips3.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_mips3.S
diff -u src/sys/arch/mips/mips/locore_mips3.S:1.103 src/sys/arch/mips/mips/locore_mips3.S:1.104
--- src/sys/arch/mips/mips/locore_mips3.S:1.103	Mon Jun  1 22:55:13 2015
+++ src/sys/arch/mips/mips/locore_mips3.S	Tue Jun  2 05:09:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_mips3.S,v 1.103 2015/06/01 22:55:13 matt Exp $	*/
+/*	$NetBSD: locore_mips3.S,v 1.104 2015/06/02 05:09:15 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -729,8 +729,6 @@ NESTED_NOPROFILE(cpu_trampoline, 0, ra)
 	 nop
 	PTR_S	MIPS_CURLWP, CPU_INFO_CURLWP(a0)
 
-	PTR_L	sp, L_MD_UTF(MIPS_CURLWP)	# fetch KSP
-
 #ifdef _LP64
 	li	v0, MIPS_SR_KX | MIPS_SR_UX	# allow 64bit addressing
 #else
@@ -739,6 +737,8 @@ NESTED_NOPROFILE(cpu_trampoline, 0, ra)
 	mtc0	v0, MIPS_COP_0_STATUS		# reset to known state
 	COP0_SYNC
 
+	PTR_L	sp, L_MD_UTF(MIPS_CURLWP)	# fetch KSP
+
 	/*
 	 * Indicate that no one has called us.
 	 */
@@ -752,6 +752,13 @@ NESTED_NOPROFILE(cpu_trampoline, 0, ra)
 	PTR_LA	gp, _C_LABEL(_gp)
 #endif
 
+#if 0
+	LONG_L	t0, CPU_INFO_FLAGS(a0)
+	or	t0, t0, CPUF_PRESENT
+	LONG_S	t0, CPU_INFO_FLAGS(a0)
+	sync
+#endif
+
 	/*
 	 * and off we go.
 	 */



CVS commit: src/sys/arch/mips/mips

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:08:21 UTC 2015

Modified Files:
src/sys/arch/mips/mips: mips_fixup.c

Log Message:
Deal with cpu_info_store that spans a 32KB boundary.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/mips/mips_fixup.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_fixup.c
diff -u src/sys/arch/mips/mips/mips_fixup.c:1.11 src/sys/arch/mips/mips/mips_fixup.c:1.12
--- src/sys/arch/mips/mips/mips_fixup.c:1.11	Mon Jun  1 22:55:13 2015
+++ src/sys/arch/mips/mips/mips_fixup.c	Tue Jun  2 05:08:21 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_fixup.c,v 1.11 2015/06/01 22:55:13 matt Exp $	*/
+/*	$NetBSD: mips_fixup.c,v 1.12 2015/06/02 05:08:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mips_fixup.c,v 1.11 2015/06/01 22:55:13 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mips_fixup.c,v 1.12 2015/06/02 05:08:21 matt Exp $);
 
 #include opt_mips3_wired.h
 #include opt_multiprocessor.h
@@ -58,6 +58,7 @@ mips_fixup_exceptions(mips_fixup_callbac
 	const size_t size = sizeof(cpu_info_store);
 	uint32_t new_insns[2];
 	uint32_t *lui_insnp = NULL;
+	int32_t lui_offset = 0;
 	bool fixed = false;
 	size_t lui_reg = 0;
 	/*
@@ -66,9 +67,12 @@ mips_fixup_exceptions(mips_fixup_callbac
 	 * to compensate for using a negative offset for the lower half of
 	 * the value.
 	 */
-	const int32_t upper_addr = (addr + 32768)  ~0x;
+	const int32_t upper_start = (addr + 32768)  ~0x;
+	const int32_t upper_end = (addr + size - 1 + 32768)  ~0x;
 
+#ifndef MIPS64_OCTEON
 	KASSERT((addr  ~0xfff) == ((addr + size - 1)  ~0xfff));
+#endif
 
 	uint32_t lui_insn = 0;
 	for (uint32_t *insnp = start; insnp  end; insnp++) {
@@ -82,15 +86,17 @@ mips_fixup_exceptions(mips_fixup_callbac
 			insn, lui_reg, offset);
 #endif
 			KASSERT(lui_reg == _R_K0 || lui_reg == _R_K1);
-			if (upper_addr == offset) {
+			if (upper_start == offset || upper_end == offset) {
 lui_insnp = insnp;
 lui_insn = insn;
+lui_offset = offset;
 #ifdef DEBUG_VERBOSE
 printf( (maybe));
 #endif
 			} else {
 lui_insnp = NULL;
 lui_insn = 0;
+lui_offset = 0;
 			}
 #ifdef DEBUG_VERBOSE
 			printf(\n);
@@ -101,7 +107,7 @@ mips_fixup_exceptions(mips_fixup_callbac
 #if defined(DIAGNOSTIC) || defined(DEBUG_VERBOSE)
 			size_t rt = (insn  16)  31;
 #endif
-			int32_t load_addr = upper_addr + (int16_t)insn;
+			int32_t load_addr = lui_offset + (int16_t)insn;
 			if (addr = load_addr
 			 load_addr  addr + size
 			 base == lui_reg) {



CVS commit: src/sys/modules

2015-06-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jun  2 00:38:38 UTC 2015

Modified Files:
src/sys/modules/hdaudio: Makefile.inc
src/sys/modules/hdaudio_pci: Makefile.inc

Log Message:
Use SRCS+= instead of SRCS= in Makefile.incs to avoid assumptions of
what is being included when.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/hdaudio/Makefile.inc
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/hdaudio_pci/Makefile.inc

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

Modified files:

Index: src/sys/modules/hdaudio/Makefile.inc
diff -u src/sys/modules/hdaudio/Makefile.inc:1.2 src/sys/modules/hdaudio/Makefile.inc:1.3
--- src/sys/modules/hdaudio/Makefile.inc:1.2	Sat Mar 28 14:09:59 2015
+++ src/sys/modules/hdaudio/Makefile.inc	Tue Jun  2 00:38:37 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.2 2015/03/28 14:09:59 jmcneill Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2015/06/02 00:38:37 pooka Exp $
 
-.PATH:	${S}/dev/hdaudio
-SRCS=	hdaudio.c
+.PATH:	${NETBSDSRCDIR}/sys/dev/hdaudio
+SRCS+=	hdaudio.c

Index: src/sys/modules/hdaudio_pci/Makefile.inc
diff -u src/sys/modules/hdaudio_pci/Makefile.inc:1.1 src/sys/modules/hdaudio_pci/Makefile.inc:1.2
--- src/sys/modules/hdaudio_pci/Makefile.inc:1.1	Sat Mar 28 14:09:59 2015
+++ src/sys/modules/hdaudio_pci/Makefile.inc	Tue Jun  2 00:38:38 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.1 2015/03/28 14:09:59 jmcneill Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2015/06/02 00:38:38 pooka Exp $
 
 # This file is used by modules and rump kernels
 
@@ -7,4 +7,4 @@ IOCONFDIR:=	${.PARSEDIR}
 .PATH:	${NETBSDSRCDIR}/sys/dev/pci ${IOCONFDIR}
 
 IOCONF=	hdaudio_pci.ioconf
-SRCS=	hdaudio_pci.c
+SRCS+=	hdaudio_pci.c



CVS commit: src/sys/arch/mips/mips

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:10:57 UTC 2015

Modified Files:
src/sys/arch/mips/mips: genassym.cf

Log Message:
Add CPU_INFO_FLAGS / CPUF_PRESENT


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/mips/mips/genassym.cf

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/genassym.cf
diff -u src/sys/arch/mips/mips/genassym.cf:1.54 src/sys/arch/mips/mips/genassym.cf:1.55
--- src/sys/arch/mips/mips/genassym.cf:1.54	Wed Apr  6 05:38:19 2011
+++ src/sys/arch/mips/mips/genassym.cf	Tue Jun  2 05:10:57 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.54 2011/04/06 05:38:19 matt Exp $
+#	$NetBSD: genassym.cf,v 1.55 2015/06/02 05:10:57 matt Exp $
 #
 # Copyright (c) 1992, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -292,7 +292,10 @@ define	CPU_INFO_DIVISOR_DELAY	offsetof(s
 define	CPU_INFO_MTX_COUNT	offsetof(struct cpu_info, ci_mtx_count)
 define	CPU_INFO_MTX_OLDSPL	offsetof(struct cpu_info, ci_mtx_oldspl)
 ifdef MULTIPROCESSOR
+define	CPU_INFO_FLAGS		offsetof(struct cpu_info, ci_flags)
 define	CPU_INFO_KSP_TLB_SLOT	offsetof(struct cpu_info, ci_ksp_tlb_slot)
+
+define	CPUF_PRESENT		CPUF_PRESENT
 endif
 
 define	IPL_NONE		IPL_NONE



CVS commit: src/sys/arch/mips/cavium/dev

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:11:34 UTC 2015

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_uart.c

Log Message:
Use structure copy instead of memcpy.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_uart.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/cavium/dev/octeon_uart.c
diff -u src/sys/arch/mips/cavium/dev/octeon_uart.c:1.2 src/sys/arch/mips/cavium/dev/octeon_uart.c:1.3
--- src/sys/arch/mips/cavium/dev/octeon_uart.c:1.2	Mon Jun  1 22:55:12 2015
+++ src/sys/arch/mips/cavium/dev/octeon_uart.c	Tue Jun  2 05:11:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_uart.c,v 1.2 2015/06/01 22:55:12 matt Exp $	*/
+/*	$NetBSD: octeon_uart.c,v 1.3 2015/06/02 05:11:34 matt Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: octeon_uart.c,v 1.2 2015/06/01 22:55:12 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: octeon_uart.c,v 1.3 2015/06/02 05:11:34 matt Exp $);
 
 #include opt_octeon.h
 
@@ -121,7 +121,7 @@ octeon_uart_iobus_attach(device_t parent
 	int status;
 
 	sc_com-sc_dev = self;
-	(void)memcpy(sc_com-sc_regs, octeon_uart_com_regs, sizeof(sc_com-sc_regs));
+	sc_com-sc_regs = octeon_uart_com_regs;
 	sc_com-sc_regs.cr_iot = aa-aa_bust;
 	sc_com-sc_regs.cr_iobase = aa-aa_unit-addr;
 



CVS commit: src/sys/arch/mips/mips

2015-06-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun  2 05:10:18 UTC 2015

Modified Files:
src/sys/arch/mips/mips: locore_octeon.S

Log Message:
Fix octeon spinup code to branch to right instruction and to jump to the
right routine.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/mips/locore_octeon.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_octeon.S
diff -u src/sys/arch/mips/mips/locore_octeon.S:1.2 src/sys/arch/mips/mips/locore_octeon.S:1.3
--- src/sys/arch/mips/mips/locore_octeon.S:1.2	Mon Jun  1 22:55:13 2015
+++ src/sys/arch/mips/mips/locore_octeon.S	Tue Jun  2 05:10:18 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_octeon.S,v 1.2 2015/06/01 22:55:13 matt Exp $	*/
+/*	$NetBSD: locore_octeon.S,v 1.3 2015/06/02 05:10:18 matt Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include mips/asm.h
-RCSID($NetBSD: locore_octeon.S,v 1.2 2015/06/01 22:55:13 matt Exp $)
+RCSID($NetBSD: locore_octeon.S,v 1.3 2015/06/02 05:10:18 matt Exp $)
 
 #include opt_cputype.h
 #include opt_multiprocessor.h
@@ -116,16 +116,17 @@ NESTED_NOPROFILE(octeon_cpu_spinup, 0, r
 	// must has its own exception vector page.  The exceptions will be
 	// modified to refer to that CPU's cpu_info structure.
 	//
-	mfc0	a0, MIPS_COP_0_PRID, 1	# get EBASE
-	ext	s0, a0, 0, 10		# fetch cpunum (MIPSNNR2)
-	ins	a0, zero, 0, 10		# clear it (MIPSNNR2)
-	ins	a0, v0, 12, 10		# insert cpunum as exception address
-	mtc0	a0, MIPS_COP_0_PRID, 1	# set EBASE
+	mfc0	s1, MIPS_COP_0_PRID, 1	# get EBASE
+	ext	s0, s1, 0, 10		# fetch cpunum (MIPSNNR2)
+	ins	s1, zero, 0, 10		# clear it (MIPSNNR2)
+	ins	s1, s0, 12, 10		# insert cpunum as exception address
+	ehb
+	mtc0	s1, MIPS_COP_0_PRID, 1	# set EBASE
 	COP0_SYNC
 
 	// we only can deal with 2 cores
 	li	v0, 1
-	bne	s0, v0, 2f
+	beq	s0, v0, 2f
 	 nop
 	// spin if this isn't cpu 1
 1:	wait
@@ -133,18 +134,21 @@ NESTED_NOPROFILE(octeon_cpu_spinup, 0, r
 	 nop
 
 	// Indicate we've gotten this far
-	PTR_LA	a0, _C_LABEL(cpus_booted)
+2:	PTR_LA	a0, _C_LABEL(cpus_booted)
+	li	a1, 1
 	jal	_C_LABEL(atomic_or_64)
-	 sll	a1, v0, s0
+	 sllv	a1, a1, s0
 
 	// Wait until cpuid_infos[cpunum] is not NULL.
-2:	PTR_LA	a1, _C_LABEL(cpuid_infos)
-	dsll	s0, s0, PTR_SCALESHIFT	# cpunum - array index
-	PTR_ADD	t0, a1, s0		# add to array start
-3:	PTR_L	a1, (t0)		# get cpu_info pointer
+	PTR_LA	a1, _C_LABEL(cpuid_infos)
+	dsll	v0, s0, PTR_SCALESHIFT	# cpunum - array index
+	PTR_ADD	t0, a1, v0		# add to array start
+3:	sync
+	PTR_L	a1, (t0)		# get cpu_info pointer
 	beqz	a1, 3b			# loop until non-NULL
 	 nop
-	j	_C_LABEL(cpu_hatch)
+
+	j	_C_LABEL(cpu_trampoline)
 	 nop
 END(octeon_cpu_spinup)
 #endif /* MULTIPROCESSOR */