CVS commit: src/sbin/gpt

2013-11-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Wed Nov 20 08:08:47 UTC 2013

Modified Files:
src/sbin/gpt: Makefile gpt.8 gpt.c gpt.h map.c map.h
Added Files:
src/sbin/gpt: resize.c

Log Message:
Add a resize command.  This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/gpt/Makefile src/sbin/gpt/map.c
cvs rdiff -u -r1.16 -r1.17 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.21 -r1.22 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.6 -r1.7 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.2 -r1.3 src/sbin/gpt/map.h
cvs rdiff -u -r0 -r1.1 src/sbin/gpt/resize.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/gpt/Makefile
diff -u src/sbin/gpt/Makefile:1.4 src/sbin/gpt/Makefile:1.5
--- src/sbin/gpt/Makefile:1.4	Thu Jan  6 01:08:48 2011
+++ src/sbin/gpt/Makefile	Wed Nov 20 08:08:47 2013
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.4 2011/01/06 01:08:48 jakllsch Exp $
+# $NetBSD: Makefile,v 1.5 2013/11/20 08:08:47 jnemeth Exp $
 # $FreeBSD: src/sbin/gpt/Makefile,v 1.7 2005/09/01 02:49:20 marcel Exp $
 
 PROG=	gpt
 SRCS=	add.c biosboot.c create.c destroy.c gpt.c label.c map.c migrate.c \
-	recover.c remove.c show.c
+	recover.c remove.c resize.c show.c
 MAN=	gpt.8
 
 LDADD+=	-lprop -lutil
Index: src/sbin/gpt/map.c
diff -u src/sbin/gpt/map.c:1.4 src/sbin/gpt/map.c:1.5
--- src/sbin/gpt/map.c:1.4	Tue Nov 19 05:03:41 2013
+++ src/sbin/gpt/map.c	Wed Nov 20 08:08:47 2013
@@ -29,7 +29,7 @@
 __FBSDID($FreeBSD: src/sbin/gpt/map.c,v 1.6 2005/08/31 01:47:19 marcel Exp $);
 #endif
 #ifdef __RCSID
-__RCSID($NetBSD: map.c,v 1.4 2013/11/19 05:03:41 jnemeth Exp $);
+__RCSID($NetBSD: map.c,v 1.5 2013/11/20 08:08:47 jnemeth Exp $);
 #endif
 
 #include sys/types.h
@@ -186,6 +186,96 @@ map_alloc(off_t start, off_t size, off_t
 	return NULL;
 }
 
+off_t
+map_resize(map_t *m, off_t size, off_t alignment)
+{
+	map_t *n, *o;
+	off_t alignsize, prevsize;
+
+	n = m-map_next;
+
+	if (size == 0  alignment == 0) {
+		if (n == NULL || n-map_type != MAP_TYPE_UNUSED)
+			return 0;
+		else {
+			size = m-map_size + n-map_size;
+			m-map_size = size;
+			m-map_next = n-map_next;
+			if (n-map_next != NULL)
+n-map_next-map_prev = m;
+			if (n-map_data != NULL)
+free(n-map_data);
+			free(n);
+			return size;
+		}
+	}
+
+	if (size == 0  alignment  0) {
+		if (n == NULL || n-map_type != MAP_TYPE_UNUSED)
+			return 0;
+		else {
+			prevsize = m-map_size;
+			size = (m-map_size + n-map_size) /
+			   alignment * alignment;
+			if (size = prevsize)
+return 0;
+			m-map_size = size;
+			n-map_start += size - prevsize;
+			n-map_size -= size - prevsize;
+			if (n-map_size == 0) {
+m-map_next = n-map_next;
+if (n-map_next != NULL)
+	n-map_next-map_prev = m;
+if (n-map_data != NULL)
+	free(n-map_data);
+free(n);
+			}
+			return size;
+		}
+	}
+			
+	alignsize = size;
+	if (alignment % size != 0)
+		alignsize = (size + alignment) / alignment * alignment;
+
+	if (alignsize  m-map_size) {		/* shrinking */
+		prevsize = m-map_size;
+		m-map_size = alignsize;
+		if (n == NULL || n-map_type != MAP_TYPE_UNUSED) {
+			o = mkmap(m-map_start + alignsize,
+  prevsize - alignsize, MAP_TYPE_UNUSED);
+			m-map_next = o;
+			o-map_prev = m;
+			o-map_next = n;
+			if (n != NULL)
+n-map_prev = o;
+			return alignsize;
+		} else {
+			n-map_start -= alignsize;
+			n-map_size += alignsize;
+			return alignsize;
+		}
+	} else if (alignsize  m-map_size) {		/* expanding */
+		if (n == NULL || n-map_type != MAP_TYPE_UNUSED ||
+		n-map_size  alignsize - m-map_size) {
+			return 0;
+		}
+		n-map_size -= alignsize - m-map_size;
+		n-map_start += alignsize - m-map_size;
+		if (n-map_size == 0) {
+			m-map_next = n-map_next;
+			if (n-map_next != NULL)
+n-map_next-map_prev = m;
+			if (n-map_data != NULL)
+free(n-map_data);
+			free(n);
+		}
+		m-map_size = alignsize;
+		return alignsize;
+	} else		/* correct size */
+		return alignsize;
+}
+
 map_t *
 map_find(int type)
 {

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.16 src/sbin/gpt/gpt.8:1.17
--- src/sbin/gpt/gpt.8:1.16	Tue Nov 19 05:07:40 2013
+++ src/sbin/gpt/gpt.8	Wed Nov 20 08:08:47 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: gpt.8,v 1.16 2013/11/19 05:07:40 jnemeth Exp $
+.\ $NetBSD: gpt.8,v 1.17 2013/11/20 08:08:47 jnemeth Exp $
 .\
 .\ Copyright (c) 2002 Marcel Moolenaar
 .\ All rights reserved.
@@ -26,7 +26,7 @@
 .\
 .\ $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\
-.Dd November 18, 2013
+.Dd November 20, 2013
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -316,6 +316,22 @@ command.
 See above for a description of these options.
 Partitions are removed by clearing the partition type.
 No other information is changed.
+.\  resize 
+.It Nm Ic resize Fl i Ar index Oo Fl a Ar alignment Oc \
+Oo Fl s Ar count Oc Ar device ...
+The
+.Ic resize
+command allows 

CVS commit: src/sbin/gpt

2013-11-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov 20 08:11:36 UTC 2013

Modified Files:
src/sbin/gpt: gpt.8

Log Message:
shrunk.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sbin/gpt/gpt.8

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

Modified files:

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.17 src/sbin/gpt/gpt.8:1.18
--- src/sbin/gpt/gpt.8:1.17	Wed Nov 20 08:08:47 2013
+++ src/sbin/gpt/gpt.8	Wed Nov 20 08:11:36 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: gpt.8,v 1.17 2013/11/20 08:08:47 jnemeth Exp $
+.\ $NetBSD: gpt.8,v 1.18 2013/11/20 08:11:36 wiz Exp $
 .\
 .\ Copyright (c) 2002 Marcel Moolenaar
 .\ All rights reserved.
@@ -322,7 +322,7 @@ Oo Fl s Ar count Oc Ar device ...
 The
 .Ic resize
 command allows the user to resize a partition.
-The partition may be shrunked and if there is sufficient free space
+The partition may be shrunk and if there is sufficient free space
 immediately after it then it may be expanded.
 The
 .Fl s



CVS commit: src/lib/libm/src

2013-11-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Nov 20 11:39:00 UTC 2013

Modified Files:
src/lib/libm/src: w_sqrtl.c

Log Message:
Long double conditional.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/w_sqrtl.c

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

Modified files:

Index: src/lib/libm/src/w_sqrtl.c
diff -u src/lib/libm/src/w_sqrtl.c:1.1 src/lib/libm/src/w_sqrtl.c:1.2
--- src/lib/libm/src/w_sqrtl.c:1.1	Tue Nov 19 19:24:34 2013
+++ src/lib/libm/src/w_sqrtl.c	Wed Nov 20 11:39:00 2013
@@ -11,7 +11,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: w_sqrtl.c,v 1.1 2013/11/19 19:24:34 joerg Exp $);
+__RCSID($NetBSD: w_sqrtl.c,v 1.2 2013/11/20 11:39:00 joerg Exp $);
 
 /*
  * wrapper sqrtl(x)
@@ -21,6 +21,8 @@ __RCSID($NetBSD: w_sqrtl.c,v 1.1 2013/1
 #include math.h
 #include math_private.h
 
+#ifdef __HAVE_LONG_DOUBLE
+
 __weak_alias(sqrtl, _sqrtl)
 
 long double
@@ -38,3 +40,5 @@ sqrtl(long double x)		/* wrapper sqrtl *
 	return z;
 #endif
 }
+
+#endif /* __HAVE_LONG_DOUBLE */



CVS commit: src/sys/arch/arm

2013-11-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Nov 20 12:16:47 UTC 2013

Modified Files:
src/sys/arch/arm/marvell: armadaxp.c mvsoc_intr.c mvsoc_intr.h
src/sys/arch/arm/pic: files.pic
Removed Files:
src/sys/arch/arm/pic: armadaxp_splfuncs.c

Log Message:
Support __HAVE_PIC_SET_PRIORITY for Armada XP.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/marvell/armadaxp.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/marvell/mvsoc_intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/marvell/mvsoc_intr.h
cvs rdiff -u -r1.3 -r0 src/sys/arch/arm/pic/armadaxp_splfuncs.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/pic/files.pic

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/marvell/armadaxp.c
diff -u src/sys/arch/arm/marvell/armadaxp.c:1.3 src/sys/arch/arm/marvell/armadaxp.c:1.4
--- src/sys/arch/arm/marvell/armadaxp.c:1.3	Mon Sep 30 13:03:25 2013
+++ src/sys/arch/arm/marvell/armadaxp.c	Wed Nov 20 12:16:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: armadaxp.c,v 1.3 2013/09/30 13:03:25 kiyohara Exp $	*/
+/*	$NetBSD: armadaxp.c,v 1.4 2013/11/20 12:16:47 kiyohara Exp $	*/
 /***
 Copyright (C) Marvell International Ltd. and its affiliates
 
@@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: armadaxp.c,v 1.3 2013/09/30 13:03:25 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: armadaxp.c,v 1.4 2013/11/20 12:16:47 kiyohara Exp $);
 
 #define _INTR_PRIVATE
 
@@ -91,8 +91,10 @@ static void armadaxp_intr_init(void);
 static void armadaxp_pic_unblock_irqs(struct pic_softc *, size_t, uint32_t);
 static void armadaxp_pic_block_irqs(struct pic_softc *, size_t, uint32_t);
 static void armadaxp_pic_establish_irq(struct pic_softc *, struct intrsource *);
+static void armadaxp_pic_set_priority(struct pic_softc *, int);
 
-void armadaxp_handle_irq(void *);
+static int armadaxp_find_pending_irqs(void);
+static void armadaxp_pic_block_irq(struct pic_softc *, size_t);
 void armadaxp_io_coherency_init(void);
 int armadaxp_l2_init(bus_addr_t);
 
@@ -137,6 +139,7 @@ static struct pic_ops armadaxp_picops = 
 	.pic_unblock_irqs = armadaxp_pic_unblock_irqs,
 	.pic_block_irqs = armadaxp_pic_block_irqs,
 	.pic_establish_irq = armadaxp_pic_establish_irq,
+	.pic_set_priority = armadaxp_pic_set_priority,
 };
 
 static struct pic_softc armadaxp_pic = {
@@ -188,7 +191,8 @@ armadaxp_intr_init(void)
 	/* Enable IRQ prioritization */
 	ctrl |= (1  0);
 	MPIC_WRITE(ARMADAXP_MLMB_MPIC_CTRL, ctrl);
-	MPIC_CPU_WRITE(ARMADAXP_MLMB_MPIC_CTP, curcpl()  MPIC_CTP_SHIFT);
+
+	find_pending_irqs = armadaxp_find_pending_irqs;
 }
 
 static void
@@ -236,30 +240,47 @@ armadaxp_pic_establish_irq(struct pic_so
 	tmp | (is-is_ipl  MPIC_ISCR_SHIFT));
 }
 
-void
-armadaxp_handle_irq(void *frame)
+static void
+armadaxp_pic_set_priority(struct pic_softc *pic, int ipl)
+{
+	int ctp;
+
+	ctp = MPIC_CPU_READ(ARMADAXP_MLMB_MPIC_CTP);
+	ctp = ~(0xf  MPIC_CTP_SHIFT);
+	ctp |= (ipl  MPIC_CTP_SHIFT);
+	MPIC_CPU_WRITE(ARMADAXP_MLMB_MPIC_CTP, ctp);
+}
+
+static int
+armadaxp_find_pending_irqs(void)
 {
 	struct intrsource *is;
 	int irq;
-	u_int irqstate;
 
 	irq = MPIC_CPU_READ(ARMADAXP_MLMB_MPIC_IIACK)  0x3ff;
 
 	/* Is it a spurious interrupt ?*/
 	if (irq == 0x3ff)
-		return;
-
+		return 0;
 	is = armadaxp_pic.pic_sources[irq];
-	if (is != NULL)  {
-		KASSERT(is-is_ipl  curcpu()-ci_cpl);
-		/* Dispatch irq */
-		irqstate = disable_interrupts(I32_bit);
-		pic_dispatch(is, frame);
-		restore_interrupts(irqstate);
+	if (is == NULL) {
+		printf(stray interrupt: %d\n, irq);
+		return 0;
 	}
-#ifdef __HAVE_FAST_SOFTINTS
-	cpu_dosoftints();
-#endif
+
+	armadaxp_pic_block_irq(armadaxp_pic, irq);
+	pic_mark_pending(armadaxp_pic, irq);
+
+	return is-is_ipl;
+}
+
+static void
+armadaxp_pic_block_irq(struct pic_softc *pic, size_t irq)
+{
+
+	KASSERT(pic-pic_maxsources = irq);
+	MPIC_WRITE(ARMADAXP_MLMB_MPIC_ICE, irq);
+	MPIC_CPU_WRITE(ARMADAXP_MLMB_MPIC_ISM, irq);
 }
 
 /*

Index: src/sys/arch/arm/marvell/mvsoc_intr.c
diff -u src/sys/arch/arm/marvell/mvsoc_intr.c:1.7 src/sys/arch/arm/marvell/mvsoc_intr.c:1.8
--- src/sys/arch/arm/marvell/mvsoc_intr.c:1.7	Mon Sep 30 13:22:22 2013
+++ src/sys/arch/arm/marvell/mvsoc_intr.c	Wed Nov 20 12:16:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsoc_intr.c,v 1.7 2013/09/30 13:22:22 kiyohara Exp $	*/
+/*	$NetBSD: mvsoc_intr.c,v 1.8 2013/11/20 12:16:47 kiyohara Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mvsoc_intr.c,v 1.7 2013/09/30 13:22:22 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: mvsoc_intr.c,v 1.8 2013/11/20 12:16:47 kiyohara Exp $);
 
 #include opt_mvsoc.h
 
@@ -42,9 +42,6 @@ 

CVS commit: src/lib/libm/src

2013-11-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Nov 20 12:29:13 UTC 2013

Modified Files:
src/lib/libm/src: s_cbrt.c

Log Message:
Fix operand order.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/s_cbrt.c

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

Modified files:

Index: src/lib/libm/src/s_cbrt.c
diff -u src/lib/libm/src/s_cbrt.c:1.12 src/lib/libm/src/s_cbrt.c:1.13
--- src/lib/libm/src/s_cbrt.c:1.12	Tue Nov 19 19:24:34 2013
+++ src/lib/libm/src/s_cbrt.c	Wed Nov 20 12:29:13 2013
@@ -12,7 +12,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBM_SCCS)  !defined(lint)
-__RCSID($NetBSD: s_cbrt.c,v 1.12 2013/11/19 19:24:34 joerg Exp $);
+__RCSID($NetBSD: s_cbrt.c,v 1.13 2013/11/20 12:29:13 joerg Exp $);
 #endif
 
 #include namespace.h
@@ -20,7 +20,7 @@ __RCSID($NetBSD: s_cbrt.c,v 1.12 2013/1
 #include math_private.h
 
 #ifndef __HAVE_LONG_DOUBLE
-__strong_alias(cbrt, _cbrtl)
+__strong_alias(_cbrtl, cbrt)
 __weak_alias(cbrtl, _cbrtl)
 #endif
 



CVS commit: src/sys/arch

2013-11-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Nov 20 12:36:16 UTC 2013

Modified Files:
src/sys/arch/arm/marvell: mvsocreg.h
src/sys/arch/evbarm/armadaxp: armadaxp_machdep.c

Log Message:
Add defines for MISC registers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/marvell/mvsocreg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c

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

Modified files:

Index: src/sys/arch/arm/marvell/mvsocreg.h
diff -u src/sys/arch/arm/marvell/mvsocreg.h:1.5 src/sys/arch/arm/marvell/mvsocreg.h:1.6
--- src/sys/arch/arm/marvell/mvsocreg.h:1.5	Mon Sep 30 13:15:46 2013
+++ src/sys/arch/arm/marvell/mvsocreg.h	Wed Nov 20 12:36:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsocreg.h,v 1.5 2013/09/30 13:15:46 kiyohara Exp $	*/
+/*	$NetBSD: mvsocreg.h,v 1.6 2013/11/20 12:36:16 kiyohara Exp $	*/
 /*
  * Copyright (c) 2007, 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -56,12 +56,6 @@
 #define MVSOC_DSC_CSSR_SIZE_MASK	0xff00
 
 /*
- * SoC MISC Register
- */
-
-#define MVSOC_MISC_BASE		(MVSOC_DEVBUS_BASE + 0x8200) /* For Armada XP */
-
-/*
  * Device Bus
  */
 #define MVSOC_DEVBUS_BASE	(UNITID2PHYS(DEVBUS))	/* 0x1 */
@@ -69,19 +63,29 @@
 /*
  * General Purpose Port Registers
  */
-#define MVSOC_GPP_BASE			(MVSOC_DEVBUS_BASE + 0x0100)
+#define MVSOC_GPP_BASE		(MVSOC_DEVBUS_BASE + 0x0100)
 
 /*
  * Two-Wire Serial Interface Registers
  */
-#define MVSOC_TWSI_BASE			(MVSOC_DEVBUS_BASE + 0x1000)
+#define MVSOC_TWSI_BASE		(MVSOC_DEVBUS_BASE + 0x1000)
 
 /*
  * UART Interface Registers
  */
-	/* NS16550 compatible */
-#define MVSOC_COM0_BASE			(MVSOC_DEVBUS_BASE + 0x2000)
-#define MVSOC_COM1_BASE			(MVSOC_DEVBUS_BASE + 0x2100)
+/* NS16550 compatible */
+#define MVSOC_COM0_BASE		(MVSOC_DEVBUS_BASE + 0x2000)
+#define MVSOC_COM1_BASE		(MVSOC_DEVBUS_BASE + 0x2100)
+
+/*
+ * Miscellanseous Register
+ */
+#define MVSOC_MISC_BASE		(MVSOC_DEVBUS_BASE + 0x8200) /* For Armada XP */
+
+#define MVSOC_MISC_RSTOUTNMASKR		  0x60 /* RSTOUTn Mask Register */
+#define MVSOC_MISC_RSTOUTNMASKR_GLOBALSOFTRSTOUTEN (1  0)
+#define MVSOC_MISC_SSRR			  0x64	/* System Soft Reset Register */
+#define MVSOC_MISC_SSRR_GLOBALSOFTRST   (1  0)
 
 /*
  * Mbus-L to Mbus Bridge Registers
@@ -108,17 +112,11 @@
 /* CPU Control and Status Registers */
 #define MVSOC_MLMB_CPUCR		  0x100	/* CPU Configuration Register */
 #define MVSOC_MLMB_CPUCSR		  0x104	/* CPU Control/Status Register*/
-#if defined(ARMADAXP)
-#define MVSOC_MLMB_RSTOUTNMASKR		  0x60 /* RSTOUTn Mask Register */
-#define MVSOC_MLMB_SSRR			  0x64	/* System Soft Reset Register */
-#define MVSOC_MLMB_RSTOUTNMASKR_SOFTRSTOUTEN(1  0)
-#else
 #define MVSOC_MLMB_RSTOUTNMASKR		  0x108 /* RSTOUTn Mask Register */
-#define MVSOC_MLMB_SSRR			  0x10c	/* System Soft Reset Register */
 #define MVSOC_MLMB_RSTOUTNMASKR_SOFTRSTOUTEN(1  2)
-#endif
-#define MVSOC_MLMB_RSTOUTNMASKR_PEXRSTOUTEN (1  0)
 #define MVSOC_MLMB_RSTOUTNMASKR_WDRSTOUTEN  (1  1)
+#define MVSOC_MLMB_RSTOUTNMASKR_PEXRSTOUTEN (1  0)
+#define MVSOC_MLMB_SSRR			  0x10c	/* System Soft Reset Register */
 #define MVSOC_MLMB_SSRR_SYSTEMSOFTRST   (1  0)
 #define MVSOC_MLMB_MLMBICR		  0x110	/*Mb-L to Mb Bridge Intr Cause*/
 #define MVSOC_MLMB_MLMBIMR		  0x114	/*Mb-L to Mb Bridge Intr Mask */
@@ -135,7 +133,7 @@
 /* CIB registers offsets */
 #define MVSOC_MLMB_CIB_CTRL_CFG		  0x280
 
-#define MVSOC_TMR_BASE			(MVSOC_MLMB_BASE + 0x0300)
+#define MVSOC_TMR_BASE		(MVSOC_MLMB_BASE + 0x0300)
 
 /* CPU Doorbell Registers */
 #define MVSOC_MLMB_H2CDR		  0x400	/* Host-to-CPU Doorbell */

Index: src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c
diff -u src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c:1.3 src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c:1.4
--- src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c:1.3	Mon Sep 30 13:29:07 2013
+++ src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c	Wed Nov 20 12:36:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: armadaxp_machdep.c,v 1.3 2013/09/30 13:29:07 kiyohara Exp $	*/
+/*	$NetBSD: armadaxp_machdep.c,v 1.4 2013/11/20 12:36:16 kiyohara Exp $	*/
 /***
 Copyright (C) Marvell International Ltd. and its affiliates
 
@@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: armadaxp_machdep.c,v 1.3 2013/09/30 13:29:07 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: armadaxp_machdep.c,v 1.4 2013/11/20 12:36:16 kiyohara Exp $);
 
 #include opt_machdep.h
 #include opt_mvsoc.h
@@ -166,10 +166,10 @@ axp_system_reset(void)
 	cpu_reset_address = 0;
 
 	/* Unmask soft reset */
-	write_miscreg(MVSOC_MLMB_RSTOUTNMASKR,
-	MVSOC_MLMB_RSTOUTNMASKR_SOFTRSTOUTEN);
+	write_miscreg(MVSOC_MISC_RSTOUTNMASKR,
+	

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

2013-11-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Nov 20 12:52:25 UTC 2013

Modified Files:
src/sys/arch/evbarm/marvell: marvell_machdep.c

Log Message:
Initialize mvTclk in SOC_getclks() before call consinit().
And more fast call set_cpufuncs().


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/marvell/marvell_machdep.c

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

Modified files:

Index: src/sys/arch/evbarm/marvell/marvell_machdep.c
diff -u src/sys/arch/evbarm/marvell/marvell_machdep.c:1.22 src/sys/arch/evbarm/marvell/marvell_machdep.c:1.23
--- src/sys/arch/evbarm/marvell/marvell_machdep.c:1.22	Mon Sep 30 12:57:53 2013
+++ src/sys/arch/evbarm/marvell/marvell_machdep.c	Wed Nov 20 12:52:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: marvell_machdep.c,v 1.22 2013/09/30 12:57:53 kiyohara Exp $ */
+/*	$NetBSD: marvell_machdep.c,v 1.23 2013/11/20 12:52:24 kiyohara Exp $ */
 /*
  * Copyright (c) 2007, 2008, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: marvell_machdep.c,v 1.22 2013/09/30 12:57:53 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: marvell_machdep.c,v 1.23 2013/11/20 12:52:24 kiyohara Exp $);
 
 #include opt_evbarm_boardtype.h
 #include opt_ddb.h
@@ -218,6 +218,12 @@ initarm(void *arg)
 
 	mvsoc_bootstrap(MARVELL_INTERREGS_VBASE);
 
+	/*
+	 * Heads up ... Setup the CPU / MMU / TLB functions
+	 */
+	if (set_cpufuncs())
+		panic(cpu not recognized!);
+
 #if (defined(ORION) || defined(KIRKWOOD) || defined(MV78XX0))  \
 defined(ARMADAXP)
 	int i;
@@ -233,12 +239,6 @@ initarm(void *arg)
 	pmap_devmap_bootstrap((vaddr_t)read_ttb(), marvell_devmap);
 
 	/*
-	 * Heads up ... Setup the CPU / MMU / TLB functions
-	 */
-	if (set_cpufuncs())
-		panic(cpu not recognized!);
-
-	/*
 	 * U-Boot doesn't use the virtual memory.
 	 *
 	 * Physical Address Range Description
@@ -252,16 +252,6 @@ initarm(void *arg)
 
 	cpu_domains((DOMAIN_CLIENT  (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
 
-	consinit();
-
-	/* Talk to the user */
-#ifndef EVBARM_BOARDTYPE
-#define EVBARM_BOARDTYPE	Marvell
-#endif
-#define BDSTR(s)	_BDSTR(s)
-#define _BDSTR(s)	#s
-	printf(\nNetBSD/evbarm ( BDSTR(EVBARM_BOARDTYPE) ) booting ...\n);
-
 	/* Get ready for splfoo() */
 	switch (mvsoc_model()) {
 #ifdef ORION
@@ -354,6 +344,16 @@ initarm(void *arg)
 		/* NOTREACHED */
 	}
 
+	consinit();
+
+	/* Talk to the user */
+#ifndef EVBARM_BOARDTYPE
+#define EVBARM_BOARDTYPE	Marvell
+#endif
+#define BDSTR(s)	_BDSTR(s)
+#define _BDSTR(s)	#s
+	printf(\nNetBSD/evbarm ( BDSTR(EVBARM_BOARDTYPE) ) booting ...\n);
+
 	/* Reset PCI-Express space to window register. */
 	window = mvsoc_target(memtag, target, attr, NULL, NULL);
 	write_mlmbreg(MVSOC_MLMB_WCR(window),



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

2013-11-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Nov 20 12:59:22 UTC 2013

Modified Files:
src/sys/arch/evbarm/marvell: marvell_machdep.c

Log Message:
Rename marvell_system_reset_old from marvell_system_reset.
And add reset function for ArmadaXP.  It named marvell_system_reset.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbarm/marvell/marvell_machdep.c

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

Modified files:

Index: src/sys/arch/evbarm/marvell/marvell_machdep.c
diff -u src/sys/arch/evbarm/marvell/marvell_machdep.c:1.23 src/sys/arch/evbarm/marvell/marvell_machdep.c:1.24
--- src/sys/arch/evbarm/marvell/marvell_machdep.c:1.23	Wed Nov 20 12:52:24 2013
+++ src/sys/arch/evbarm/marvell/marvell_machdep.c	Wed Nov 20 12:59:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: marvell_machdep.c,v 1.23 2013/11/20 12:52:24 kiyohara Exp $ */
+/*	$NetBSD: marvell_machdep.c,v 1.24 2013/11/20 12:59:21 kiyohara Exp $ */
 /*
  * Copyright (c) 2007, 2008, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: marvell_machdep.c,v 1.23 2013/11/20 12:52:24 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: marvell_machdep.c,v 1.24 2013/11/20 12:59:21 kiyohara Exp $);
 
 #include opt_evbarm_boardtype.h
 #include opt_ddb.h
@@ -132,20 +132,41 @@ static void marvell_device_register(devi
 static void marvell_startend_by_tag(int, uint64_t *, uint64_t *);
 #endif
 
+#if defined(ORION) || defined(KIRKWOOD) || defined(MV78XX0)
 static void
-marvell_system_reset(void)
+marvell_system_reset_old(void)
 {
 	/* unmask soft reset */
 	write_mlmbreg(MVSOC_MLMB_RSTOUTNMASKR,
 	MVSOC_MLMB_RSTOUTNMASKR_SOFTRSTOUTEN);
 	/* assert soft reset */
 	write_mlmbreg(MVSOC_MLMB_SSRR, MVSOC_MLMB_SSRR_SYSTEMSOFTRST);
+
 	/* if we're still running, jump to the reset address */
 	cpu_reset_address = 0;
 	cpu_reset_address_paddr = 0x;
 	cpu_reset();
 	/*NOTREACHED*/
 }
+#endif
+
+#if defined(ARMADAXP)
+static void
+marvell_system_reset(void)
+{
+
+	/* Unmask soft reset */
+	write_miscreg(MVSOC_MISC_RSTOUTNMASKR,
+	MVSOC_MISC_RSTOUTNMASKR_GLOBALSOFTRSTOUTEN);
+	/* Assert soft reset */
+	write_miscreg(MVSOC_MISC_SSRR, MVSOC_MISC_SSRR_GLOBALSOFTRST);
+
+	while (1);
+
+	/*NOTREACHED*/
+}
+#endif
+
 
 static inline
 pd_entry_t *
@@ -213,9 +234,6 @@ initarm(void *arg)
 	uint32_t target, attr, base, size;
 	int cs, memtag = 0, iotag = 0, window;
 
-	/* Use the mapped reset routine! */
-	cpu_reset_address = marvell_system_reset;
-
 	mvsoc_bootstrap(MARVELL_INTERREGS_VBASE);
 
 	/*
@@ -265,6 +283,8 @@ initarm(void *arg)
 	case MARVELL_ORION_1_88W8660:
 	case MARVELL_ORION_2_88F1281:
 	case MARVELL_ORION_2_88F5281:
+		cpu_reset_address = marvell_system_reset_old;
+
 		orion_intr_bootstrap();
 
 		memtag = ORION_TAG_PEX0_MEM;
@@ -281,6 +301,8 @@ initarm(void *arg)
 	case MARVELL_KIRKWOOD_88F6192:
 	case MARVELL_KIRKWOOD_88F6281:
 	case MARVELL_KIRKWOOD_88F6282:
+		cpu_reset_address = marvell_system_reset_old;
+
 		kirkwood_intr_bootstrap();
 
 		memtag = KIRKWOOD_TAG_PEX_MEM;
@@ -295,6 +317,8 @@ initarm(void *arg)
 #ifdef MV78XX0
 	case MARVELL_MV78XX0_MV78100:
 	case MARVELL_MV78XX0_MV78200:
+		cpu_reset_address = marvell_system_reset_old;
+
 		mv78xx0_intr_bootstrap();
 
 		memtag = MV78XX0_TAG_PEX0_MEM;
@@ -312,6 +336,8 @@ initarm(void *arg)
 	case MARVELL_ARMADAXP_MV78230:
 	case MARVELL_ARMADAXP_MV78260:
 	case MARVELL_ARMADAXP_MV78460:
+		cpu_reset_address = marvell_system_reset;
+
 		armadaxp_intr_bootstrap(MARVELL_INTERREGS_PBASE);
 
 		memtag = ARMADAXP_TAG_PEX00_MEM;



CVS commit: src/sys/dev/acpi

2013-11-20 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Nov 20 13:39:59 UTC 2013

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

Log Message:
As discussed with bouyer@, fix a too eager T-state validation check to
accomodate new Intel CPUs.


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

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

Modified files:

Index: src/sys/dev/acpi/acpi_cpu_tstate.c
diff -u src/sys/dev/acpi/acpi_cpu_tstate.c:1.31 src/sys/dev/acpi/acpi_cpu_tstate.c:1.32
--- src/sys/dev/acpi/acpi_cpu_tstate.c:1.31	Fri Apr 27 04:38:24 2012
+++ src/sys/dev/acpi/acpi_cpu_tstate.c	Wed Nov 20 13:39:59 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_tstate.c,v 1.31 2012/04/27 04:38:24 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_tstate.c,v 1.32 2013/11/20 13:39:59 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_cpu_tstate.c,v 1.31 2012/04/27 04:38:24 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_cpu_tstate.c,v 1.32 2013/11/20 13:39:59 jruoho Exp $);
 
 #include sys/param.h
 #include sys/kmem.h
@@ -329,9 +329,14 @@ acpicpu_tstate_tss_add(struct acpicpu_ts
 		*p = val[i];
 
 	/*
-	 * The minimum should be around 100 / 8 = 12.5 %.
+	 * The minimum should be either 12.5 % or 6.5 %,
+	 * the latter 4-bit dynamic range being available
+	 * in some newer models; see Section 14.5.3.1 in
+	 *
+	 *	Intel 64 and IA-32 Architectures Software
+	 *	Developer's Manual. Volume 3B, Part 2. 2013.
 	 */
-if (ts-ts_percent  10 || ts-ts_percent  100)
+if (ts-ts_percent  6 || ts-ts_percent  100)
 		return AE_BAD_DECIMAL_CONSTANT;
 
 	if (ts-ts_latency == 0 || ts-ts_latency  1000)



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

2013-11-20 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Nov 20 13:52:30 UTC 2013

Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c

Log Message:
Allow 4-bit range for MSR_THERM_CONTROL.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/x86/acpi/acpi_cpu_md.c

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

Modified files:

Index: src/sys/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.73 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.74
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.73	Fri Nov 15 08:47:55 2013
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Wed Nov 20 13:52:30 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.73 2013/11/15 08:47:55 msaitoh Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.74 2013/11/20 13:52:30 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.73 2013/11/15 08:47:55 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_cpu_md.c,v 1.74 2013/11/20 13:52:30 jruoho Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -986,7 +986,7 @@ acpicpu_md_tstate_set(struct acpicpu_tst
 	uint8_t i;
 
 	val = ts-ts_control;
-	val = val  __BITS(1, 4);
+	val = val  __BITS(0, 4);
 
 	wrmsr(MSR_THERM_CONTROL, val);
 



CVS commit: src/usr.bin/cmp

2013-11-20 Thread Klaus Klein
Module Name:src
Committed By:   kleink
Date:   Wed Nov 20 17:19:14 UTC 2013

Modified Files:
src/usr.bin/cmp: regular.c

Log Message:
Explicitly include stdint.h for uintmax_t; from Eitan Adler.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/cmp/regular.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/cmp/regular.c
diff -u src/usr.bin/cmp/regular.c:1.23 src/usr.bin/cmp/regular.c:1.24
--- src/usr.bin/cmp/regular.c:1.23	Mon Nov 28 10:10:10 2011
+++ src/usr.bin/cmp/regular.c	Wed Nov 20 17:19:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: regular.c,v 1.23 2011/11/28 10:10:10 wiz Exp $	*/
+/*	$NetBSD: regular.c,v 1.24 2013/11/20 17:19:14 kleink Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)regular.c	8.3 (Berkeley) 4/2/94;
 #else
-__RCSID($NetBSD: regular.c,v 1.23 2011/11/28 10:10:10 wiz Exp $);
+__RCSID($NetBSD: regular.c,v 1.24 2013/11/20 17:19:14 kleink Exp $);
 #endif
 #endif /* not lint */
 
@@ -45,6 +45,7 @@ __RCSID($NetBSD: regular.c,v 1.23 2011/
 #include err.h
 #include limits.h
 #include stdlib.h
+#include stdint.h
 #include stdio.h
 
 #include extern.h



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

2013-11-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 20 17:50:39 UTC 2013

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
-  Add some AMD Fn8001 extended features %ecx bits definitions from
  the document (AMD64 Architecture ProgrammerVolume 3: General-Purpose and
  System Instructions. Document revision 3.20)

-  s/MXX/MMXX/ because this bit is MMX eXtention.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 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.72 src/sys/arch/x86/include/specialreg.h:1.73
--- src/sys/arch/x86/include/specialreg.h:1.72	Fri Nov 15 08:47:55 2013
+++ src/sys/arch/x86/include/specialreg.h	Wed Nov 20 17:50:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.72 2013/11/15 08:47:55 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.73 2013/11/20 17:50:39 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -375,7 +375,7 @@
 
 #define CPUID_EXT_FLAGS	\20 \
 	\14 SYSCALL/SYSRET		\24 MPC	\25 NOX \
-	\27 MXX	\32 FFXSR	\33 P1GB	\34 RDTSCP \
+	\27 MMXX	\32 FFXSR	\33 P1GB	\34 RDTSCP \
 	\36 LONG	\37 3DNOW2	\40 3DNOW
 
 /* AMD Fn8001 extended features - %ecx */
@@ -398,6 +398,11 @@
 #define CPUID_NODEID	0x0008	/* NodeID MSR available*/
 #define CPUID_TBM	0x0020	/* TBM instructions */
 #define CPUID_TOPOEXT	0x0040	/* cpuid Topology Extension */
+#define CPUID_PCEC	0x0080	/* Perf Ctr Ext Core */
+#define CPUID_PCENB	0x0100	/* Perf Ctr Ext NB */
+#define CPUID_SPM	0x0200	/* Stream Perf Mon */
+#define CPUID_DBE	0x0400	/* Data Breakpoint Extension */
+#define CPUID_PTSC	0x0800	/* PerfTsc */
 
 #define CPUID_AMD_FLAGS4	\20 \
 	\1 LAHF	\2 CMPLEGACY \3 SVM	\4 EAPIC \
@@ -406,8 +411,8 @@
 			\12 OSVW	\13 IBS	\14 XOP \
 	\15 SKINIT	\16 WDT	\17 B14	\20 LWP \
 	\21 FMA4	\22 B17	\23 B18	\24 NodeID \
-	\25 B20	\26 TBM	\27 TopoExt	\30 B23 \
-	\31 B24	\32 B25	\33 B26	\34 B27 \
+	\25 B20	\26 TBM	\27 TopoExt	\30 PCExtC \
+	\31 PCExtNB	\32 StrmPM	\33 DBExt	\34 PerfTsc \
 	\35 B28	\36 B29	\37 B30	\40 B31
 
 /*



CVS commit: src/share/man/man9/man9.x86

2013-11-20 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Nov 20 18:13:16 UTC 2013

Modified Files:
src/share/man/man9/man9.x86: tsc.9

Log Message:
Don't be so pessimistic.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/man9.x86/tsc.9

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/man9.x86/tsc.9
diff -u src/share/man/man9/man9.x86/tsc.9:1.4 src/share/man/man9/man9.x86/tsc.9:1.5
--- src/share/man/man9/man9.x86/tsc.9:1.4	Tue Oct 25 05:41:35 2011
+++ src/share/man/man9/man9.x86/tsc.9	Wed Nov 20 18:13:16 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: tsc.9,v 1.4 2011/10/25 05:41:35 jruoho Exp $
+.\ $NetBSD: tsc.9,v 1.5 2013/11/20 18:13:16 jruoho Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd October 25, 2011
+.Dd November 20, 2013
 .Dt TSC 9 x86
 .Os
 .Sh NAME
@@ -59,32 +59,25 @@ register has been present since the orig
 .Pp
 Already because of the access method,
 .Tn TSC
-has traditionally provided a low-overhead and high-resolution
+provides a low-overhead and high-resolution
 way to obtain
 .Tn CPU
 timing information.
-Recently, however, this reliability has been undermined by
-such factors as system sleep states,
+This traditional premise was violated when such factors as
+system sleep states,
 .Tn CPU
 .Dq hotplugging ,
 .Dq hibernation ,
 and
 .Tn CPU
-frequency scaling.
-.Pp
-These potential new sources of unreliability are easily understandable
-when one recalls that the counter measures cycles and not
-.Dq time .
-Comparing the cycle counts only makes sense when the clock frequency
-is stable; to convert the cycle counts to time units, a general equation
-would be:
-.Dq seconds = cycles / frequency in Hz .
-The use of
-.Tn TSC
-as a source of high-resolution timing can be thus discouraged.
-But the basic premise is still guaranteed:
-.Tn TSC
-is a monotonically increasing counter.
+frequency scaling
+were introduced to the x86 lineage.
+This was however mainly a short abruption:
+in many new x86
+.Tn CPUs
+the time stamp counter is again invariant with
+respect to the stability of the clock frequency.
+Care should be however taken in implementations that rely on this assumption.
 .Sh FUNCTIONS
 .Bl -tag -width abcd
 .It Fn rdtsc 



CVS commit: src/lib/libm/src

2013-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 20 21:12:30 UTC 2013

Modified Files:
src/lib/libm/src: e_sqrtl.c

Log Message:
Make it compile on archs with implicit NBIT


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/e_sqrtl.c

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

Modified files:

Index: src/lib/libm/src/e_sqrtl.c
diff -u src/lib/libm/src/e_sqrtl.c:1.1 src/lib/libm/src/e_sqrtl.c:1.2
--- src/lib/libm/src/e_sqrtl.c:1.1	Tue Nov 19 19:24:34 2013
+++ src/lib/libm/src/e_sqrtl.c	Wed Nov 20 21:12:30 2013
@@ -28,7 +28,7 @@
 #if 0
 __FBSDID($FreeBSD: head/lib/msun/src/e_sqrtl.c 176720 2008-03-02 01:47:58Z das $);
 #endif
-__RCSID($NetBSD: e_sqrtl.c,v 1.1 2013/11/19 19:24:34 joerg Exp $);
+__RCSID($NetBSD: e_sqrtl.c,v 1.2 2013/11/20 21:12:30 martin Exp $);
 
 #include machine/ieee.h
 #include fenv.h
@@ -39,6 +39,10 @@ __RCSID($NetBSD: e_sqrtl.c,v 1.1 2013/1
 
 #ifdef __HAVE_LONG_DOUBLE
 
+#ifdef LDBL_IMPLICIT_NBIT
+#define	LDBL_NBIT	0
+#endif
+
 /* Return (x + ulp) for normal positive x. Assumes no overflow. */
 static inline long double
 inc(long double x)



CVS commit: src

2013-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 20 22:22:20 UTC 2013

Modified Files:
src/lib/libc/arch/sparc64/gen: fpclassifyl.c isinfl.c isnanl.c
src/sys/arch/sparc/include: ieee.h

Log Message:
PR 48384: reorganize struct ieee_ext for sparc64 to only use a high/low
part for the mantissa.
Adjust arch specific code accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/sparc64/gen/fpclassifyl.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/sparc64/gen/isinfl.c \
src/lib/libc/arch/sparc64/gen/isnanl.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/include/ieee.h

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

Modified files:

Index: src/lib/libc/arch/sparc64/gen/fpclassifyl.c
diff -u src/lib/libc/arch/sparc64/gen/fpclassifyl.c:1.2 src/lib/libc/arch/sparc64/gen/fpclassifyl.c:1.3
--- src/lib/libc/arch/sparc64/gen/fpclassifyl.c:1.2	Mon Apr 28 20:22:57 2008
+++ src/lib/libc/arch/sparc64/gen/fpclassifyl.c	Wed Nov 20 22:22:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpclassifyl.c,v 1.2 2008/04/28 20:22:57 martin Exp $	*/
+/*	$NetBSD: fpclassifyl.c,v 1.3 2013/11/20 22:22:20 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: fpclassifyl.c,v 1.2 2008/04/28 20:22:57 martin Exp $);
+__RCSID($NetBSD: fpclassifyl.c,v 1.3 2013/11/20 22:22:20 martin Exp $);
 #endif
 
 #include machine/ieee.h
@@ -49,14 +49,12 @@ __fpclassifyl(long double x)
 	u.extu_ld = x;
 
 	if (u.extu_ext.ext_exp == 0) {
-		if (u.extu_ext.ext_frach  == 0  u.extu_ext.ext_frachm == 0 
-		u.extu_ext.ext_fraclm == 0  u.extu_ext.ext_fracl  == 0)
+		if (u.extu_ext.ext_frach  == 0  u.extu_ext.ext_fracl  == 0)
 			return FP_ZERO;
 		else
 			return FP_SUBNORMAL;
 	} else if (u.extu_ext.ext_exp == EXT_EXP_INFNAN) {
-		if (u.extu_ext.ext_frach  == 0  u.extu_ext.ext_frachm == 0 
-		u.extu_ext.ext_fraclm == 0  u.extu_ext.ext_fracl  == 0)
+		if (u.extu_ext.ext_frach  == 0  u.extu_ext.ext_fracl  == 0)
 			return FP_INFINITE;
 		else
 			return FP_NAN;

Index: src/lib/libc/arch/sparc64/gen/isinfl.c
diff -u src/lib/libc/arch/sparc64/gen/isinfl.c:1.4 src/lib/libc/arch/sparc64/gen/isinfl.c:1.5
--- src/lib/libc/arch/sparc64/gen/isinfl.c:1.4	Thu Mar  4 23:42:39 2004
+++ src/lib/libc/arch/sparc64/gen/isinfl.c	Wed Nov 20 22:22:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: isinfl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $	*/
+/*	$NetBSD: isinfl.c,v 1.5 2013/11/20 22:22:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = @(#)isinf.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: isinfl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $);
+__RCSID($NetBSD: isinfl.c,v 1.5 2013/11/20 22:22:20 martin Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -59,6 +59,5 @@ __isinfl(long double x)
 	u.extu_ld = x;
 
 	return (u.extu_ext.ext_exp == EXT_EXP_INFNAN 
-	(u.extu_ext.ext_frach  == 0  u.extu_ext.ext_frachm == 0 
-	 u.extu_ext.ext_fraclm == 0  u.extu_ext.ext_fracl  == 0));
+	(u.extu_ext.ext_frach  == 0  u.extu_ext.ext_fracl  == 0));
 }
Index: src/lib/libc/arch/sparc64/gen/isnanl.c
diff -u src/lib/libc/arch/sparc64/gen/isnanl.c:1.4 src/lib/libc/arch/sparc64/gen/isnanl.c:1.5
--- src/lib/libc/arch/sparc64/gen/isnanl.c:1.4	Thu Mar  4 23:42:39 2004
+++ src/lib/libc/arch/sparc64/gen/isnanl.c	Wed Nov 20 22:22:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: isnanl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $	*/
+/*	$NetBSD: isnanl.c,v 1.5 2013/11/20 22:22:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = @(#)isinf.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: isnanl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $);
+__RCSID($NetBSD: isnanl.c,v 1.5 2013/11/20 22:22:20 martin Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -59,6 +59,5 @@ __isnanl(long double x)
 	u.extu_ld = x;
 
 	return (u.extu_ext.ext_exp == EXT_EXP_INFNAN 
-	(u.extu_ext.ext_frach  != 0 || u.extu_ext.ext_frachm != 0 ||
-	 u.extu_ext.ext_fraclm != 0 || u.extu_ext.ext_fracl  != 0));
+	(u.extu_ext.ext_frach  != 0 || u.extu_ext.ext_fracl  != 0));
 }

Index: src/sys/arch/sparc/include/ieee.h
diff -u src/sys/arch/sparc/include/ieee.h:1.15 src/sys/arch/sparc/include/ieee.h:1.16
--- src/sys/arch/sparc/include/ieee.h:1.15	Thu Feb 14 09:34:46 2013
+++ src/sys/arch/sparc/include/ieee.h	Wed Nov 20 22:22:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee.h,v 1.15 2013/02/14 09:34:46 martin Exp $	*/
+/*	$NetBSD: ieee.h,v 1.16 2013/11/20 22:22:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -57,27 +57,28 @@
 #if defined(__arch64__) || defined(_KERNEL)
 
 #define	EXT_EXPBITS	15
-#define EXT_FRACHBITS	16
-#define	EXT_FRACHMBITS	32
-#define	EXT_FRACLMBITS	32
-#define	EXT_FRACLBITS	32
-#define	EXT_FRACBITS	(EXT_FRACLBITS + EXT_FRACLMBITS + EXT_FRACHMBITS + EXT_FRACHBITS)
-

CVS commit: src/sys/fs/v7fs

2013-11-20 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Nov 20 23:44:23 UTC 2013

Modified Files:
src/sys/fs/v7fs: v7fs_io_kern.c v7fs_vfsops.c v7fs_vnops.c

Log Message:
v7fs: replace malloc(9) with kmem(9), fix a memory leak and few missing
mutex destruction cases in the error path.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_io_kern.c
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/v7fs/v7fs_vfsops.c
cvs rdiff -u -r1.12 -r1.13 src/sys/fs/v7fs/v7fs_vnops.c

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

Modified files:

Index: src/sys/fs/v7fs/v7fs_io_kern.c
diff -u src/sys/fs/v7fs/v7fs_io_kern.c:1.1 src/sys/fs/v7fs/v7fs_io_kern.c:1.2
--- src/sys/fs/v7fs/v7fs_io_kern.c:1.1	Mon Jun 27 11:52:25 2011
+++ src/sys/fs/v7fs/v7fs_io_kern.c	Wed Nov 20 23:44:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_io_kern.c,v 1.1 2011/06/27 11:52:25 uch Exp $	*/
+/*	$NetBSD: v7fs_io_kern.c,v 1.2 2013/11/20 23:44:23 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,19 +30,19 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.1 2011/06/27 11:52:25 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.2 2013/11/20 23:44:23 rmind Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.1 2011/06/27 11:52:25 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.2 2013/11/20 23:44:23 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
 #include sys/systm.h
 #include sys/buf.h
-#include sys/malloc.h
+#include sys/kmem.h
 #include sys/kauth.h
 #include sys/mutex.h
 
@@ -69,8 +69,6 @@ static void v7fs_os_lock(void *);
 static void v7fs_os_unlock(void *);
 static bool lock_init(struct lock_ops *);
 
-MALLOC_JUSTDEFINE(M_V7FS, v7fs core, v7fs internal structures);
-
 int
 v7fs_io_init(struct v7fs_self **fs,
 const struct v7fs_mount_device *mount_device, size_t block_size)
@@ -80,11 +78,8 @@ v7fs_io_init(struct v7fs_self **fs,
 	struct local_io *local;
 	int error = 0;
 
-	/* Allocate myself */
-	if (!(p = (struct v7fs_self *)malloc(sizeof(*p), M_TEMP, M_WAITOK |
-	M_ZERO)))
+	if ((p = kmem_zalloc(sizeof(*p), KM_SLEEP)) == NULL)
 		return ENOMEM;
-	memset(p, 0, sizeof(*p));
 
 	p-scratch_free = -1;
 	p-scratch_remain = V7FS_SELF_NSCRATCH;
@@ -95,8 +90,7 @@ v7fs_io_init(struct v7fs_self **fs,
 	v7fs_endian_init(p);
 #endif
 	/* IO */
-	if (!(local = (struct local_io *)malloc(sizeof(*local), M_TEMP,
-	M_WAITOK | M_ZERO))) {
+	if ((local = kmem_zalloc(sizeof(*local), KM_SLEEP)) == NULL) {
 		error = ENOMEM;
 		goto errexit;
 	}
@@ -124,44 +118,41 @@ v7fs_io_init(struct v7fs_self **fs,
 	return 0;
 
 errexit:
-	if (p-io.cookie)
-		free(p-io.cookie, M_TEMP);
-	if (p-sb_lock.cookie)
-		free(p-sb_lock.cookie, M_TEMP);
-	if (p-ilist_lock.cookie)
-		free(p-ilist_lock.cookie, M_TEMP);
-	if (p-mem_lock.cookie)
-		free(p-mem_lock.cookie, M_TEMP);
-	free(p, M_TEMP);
-
+	v7fs_io_fini(p);
 	return error;
 }
 
 static bool
 lock_init(struct lock_ops *ops)
 {
-	if (!(ops-cookie = (kmutex_t *)malloc(sizeof(kmutex_t), M_TEMP,
-	M_WAITOK | M_ZERO))) {
+	if ((ops-cookie = kmem_zalloc(sizeof(kmutex_t), KM_SLEEP)) == NULL) {
 		return false;
 	}
 	mutex_init(ops-cookie, MUTEX_DEFAULT, IPL_NONE);
 	ops-lock = v7fs_os_lock;
 	ops-unlock = v7fs_os_unlock;
-
 	return true;
 }
 
 void
 v7fs_io_fini(struct v7fs_self *fs)
 {
-	mutex_destroy(fs-sb_lock.cookie);
-	mutex_destroy(fs-ilist_lock.cookie);
-	mutex_destroy(fs-mem_lock.cookie);
-
-	free(fs-io.cookie, M_TEMP);
-	free(fs-sb_lock.cookie, M_TEMP);
-	free(fs-ilist_lock.cookie, M_TEMP);
-	free(fs, M_TEMP);
+	if (fs-io.cookie) {
+		kmem_free(fs-io.cookie, sizeof(struct local_io));
+	}
+	if (fs-sb_lock.cookie) {
+		mutex_destroy(fs-sb_lock.cookie);
+		kmem_free(fs-sb_lock.cookie, sizeof(kmutex_t));
+	}
+	if (fs-ilist_lock.cookie) {
+		mutex_destroy(fs-ilist_lock.cookie);
+		kmem_free(fs-ilist_lock.cookie, sizeof(kmutex_t));
+	}
+	if (fs-mem_lock.cookie) {
+		mutex_destroy(fs-mem_lock.cookie);
+		kmem_free(fs-mem_lock.cookie, sizeof(kmutex_t));
+	}
+	kmem_free(fs, sizeof(*fs));
 }
 
 static bool

Index: src/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.7 src/sys/fs/v7fs/v7fs_vfsops.c:1.8
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.7	Wed Jun 13 22:56:51 2012
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Wed Nov 20 23:44:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.7 2012/06/13 22:56:51 joerg Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.8 2013/11/20 23:44:23 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.7 2012/06/13 22:56:51 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.8 2013/11/20 23:44:23 rmind Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, $NetBSD: