CVS commit: src/lib/libc/arch/x86_64/sys

2014-05-14 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Wed May 14 06:38:10 UTC 2014

Modified Files:
src/lib/libc/arch/x86_64/sys: __sigaction14_sigtramp.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.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/libc/arch/x86_64/sys/__sigaction14_sigtramp.c
diff -u src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.10 src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.11
--- src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c:1.10	Mon Apr 28 20:22:58 2008
+++ src/lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c	Wed May 14 06:38:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigaction14_sigtramp.c,v 1.10 2008/04/28 20:22:58 martin Exp $	*/
+/*	$NetBSD: __sigaction14_sigtramp.c,v 1.11 2014/05/14 06:38:09 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: __sigaction14_sigtramp.c,v 1.10 2008/04/28 20:22:58 martin Exp $);
+__RCSID($NetBSD: __sigaction14_sigtramp.c,v 1.11 2014/05/14 06:38:09 uebayasi Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include sys/types.h
@@ -41,7 +41,7 @@ __RCSID($NetBSD: __sigaction14_sigtramp
 
 #include extern.h
 
- __weak_alias(__sigaction14, __libc_sigaction14)
+__weak_alias(__sigaction14, __libc_sigaction14)
 
 int
 __libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)



CVS commit: src/sys/dev/onewire

2014-05-14 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Wed May 14 08:14:56 UTC 2014

Modified Files:
src/sys/dev/onewire: owtemp.c

Log Message:
calculate extended precision as per DS1920/DS1820 data sheets


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/onewire/owtemp.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/onewire/owtemp.c
diff -u src/sys/dev/onewire/owtemp.c:1.16 src/sys/dev/onewire/owtemp.c:1.17
--- src/sys/dev/onewire/owtemp.c:1.16	Mon Jun 20 17:24:16 2011
+++ src/sys/dev/onewire/owtemp.c	Wed May 14 08:14:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: owtemp.c,v 1.16 2011/06/20 17:24:16 pgoyette Exp $ */
+/*	$NetBSD: owtemp.c,v 1.17 2014/05/14 08:14:56 kardel Exp $ */
 /*	$OpenBSD: owtemp.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: owtemp.c,v 1.16 2011/06/20 17:24:16 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: owtemp.c,v 1.17 2014/05/14 08:14:56 kardel Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -64,7 +64,7 @@ CFATTACH_DECL_NEW(owtemp, sizeof(struct 
 extern struct cfdriver owtemp_cd;
 
 static const struct onewire_matchfam owtemp_fams[] = {
-	{ ONEWIRE_FAMILY_DS1920 },
+	{ ONEWIRE_FAMILY_DS1920 }, /* also DS1820 */
 	{ ONEWIRE_FAMILY_DS18B20 },
 	{ ONEWIRE_FAMILY_DS1822 },
 };
@@ -235,6 +235,21 @@ owtemp_decode_ds1920(const uint8_t *buf)
 	temp = (int8_t)buf[1];
 	temp = (temp  8) | buf[0];
 
-	/* Convert to uK */
-	return (temp * 50 + 27315);
+	if (buf[7] != 0) {
+		/*
+	 	 * interpolate for higher precision using the count registers
+	 	 *
+	 	 * buf[7]: COUNT_PER_C(elsius)
+	 	 * buf[6]: COUNT_REMAIN
+	 	 *
+	 	 * T = TEMP - 0.25 + (COUNT_PER_C - COUNT_REMAIN) / COUNT_PER_C
+	 	 */
+		temp = ~1;
+	temp += 50 * temp + (50 * (buf[7] - buf[6])) / buf[7] - 25;
+	} else {
+		temp *= 50;
+	}
+
+	/* convert to uK */
+	return (temp + 27315);
 }



CVS commit: src/sys/arch

2014-05-14 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed May 14 09:03:10 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos4_reg.h exynos5_reg.h exynos_gpio.c
exynos_io.c exynos_soc.c
src/sys/arch/evbarm/odroid: odroid_machdep.c

Log Message:
Revisit gpio and revisit register file mapping. The additional register files
are now mapped behind the origional register file.

The gpio channel GPZ is mapped over I2S0 in the separate audio register file
and were both abusively mapped over I2C0 in the main register file!

While here, delay the gpio bootstrap till on attachment. We could hasten it in
the odroid_machdep.c if needed. Also make the gpio code more resilliant and
allow booting correctly without any GPIO bits defined/available.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos4_reg.h \
src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos5_reg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_io.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_soc.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/odroid/odroid_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/samsung/exynos4_reg.h
diff -u src/sys/arch/arm/samsung/exynos4_reg.h:1.3 src/sys/arch/arm/samsung/exynos4_reg.h:1.4
--- src/sys/arch/arm/samsung/exynos4_reg.h:1.3	Fri May  9 19:44:06 2014
+++ src/sys/arch/arm/samsung/exynos4_reg.h	Wed May 14 09:03:09 2014
@@ -109,157 +109,163 @@
  * elaborate comments to clarify the register offsets use
  */
 
-#define EXYNOS4_CORE_SIZE		0x0400
-#define EXYNOS4_SDRAM_PBASE		0x4000
+/* CORE */
+#define EXYNOS4_CORE_SIZE			0x0400
+#define EXYNOS4_SDRAM_PBASE			0x4000
 
-#define EXYNOS4_SYSREG_OFFSET		0x0001
-#define EXYNOS4_PMU_OFFSET		0x0002	/* Power Management Unit */
-#define EXYNOS4_CMU_TOP_PART_OFFSET	0x0003	/* XXX unknown XXX */
+#define EXYNOS4_SYSREG_OFFSET			0x0001
+#define EXYNOS4_PMU_OFFSET			0x0002	/* Power Management Unit */
+#define EXYNOS4_CMU_TOP_PART_OFFSET		0x0003	/* XXX unknown XXX */
 #define EXYNOS4_CMU_CORE_ISP_PART_OFFSET	0x0004	/* XXX unknown XXX */
-#define EXYNOS4_MCT_OFFSET		0x0005	/* Multi Core Timer */
-#define EXYNOS4_WDT_OFFSET		0x0006	/* Watch Dog Timer */
-#define EXYNOS4_RTC_OFFSET		0x0007	/* Real Time Clock */
-#define EXYNOS4_KEYIF_OFFSET		0x000A	/* Keypad interface */
-#define EXYNOS4_HDMI_CEC_OFFSET		0x000B	/* HDMI Consumer Electronic Control */
-#define EXYNOS4_TMU_OFFSET		0x000C	/* Thermal Managment */
-#define EXYNOS4_SECKEY_OFFSET		0x0010	/* XXX unknown XXX */
-#define EXYNOS4_TZPC0_OFFSET		0x0011	/* ARM Trusted Zone Protection Controller */
-#define EXYNOS4_TZPC1_OFFSET		0x0012
-#define EXYNOS4_TZPC2_OFFSET		0x0013
-#define EXYNOS4_TZPC3_OFFSET		0x0014
-#define EXYNOS4_TZPC4_OFFSET		0x0015
-#define EXYNOS4_TZPC5_OFFSET		0x0016
-#define EXYNOS4_INTCOMBINER_OFFSET	0x0044	/* combines first 32 interrupt sources */
-#define EXYNOS4_GIC_CNTR_OFFSET		0x0048	/* generic interrupt controller offset */
-#define EXYNOS4_GIC_DISTRIBUTOR_OFFSET	0x0049
-#define EXYNOS4_AP_C2C_OFFSET		0x0054	/* Chip 2 Chip XXX doc? XXX */
-#define EXYNOS4_CP_C2C_MODEM_OFFSET	0x0058
-#define EXYNOS4_DMC0_OFFSET		0x0060	/* Dynamic Memory Controller */
-#define EXYNOS4_DMC1_OFFSET		0x0061
-#define EXYNOS4_PPMU_DMC_L_OFFSET	0x006A	/* event counters XXX ? */
-#define EXYNOS4_PPMU_DMC_R_OFFSET	0x006B
-#define EXYNOS4_PPMU_CPU_OFFSET		0x006C
-#define EXYNOS4_GPIO_C2C_OFFSET		0x006E
-#define EXYNOS4_TZASC_LR_OFFSET		0x0070	/* trust zone access control */
-#define EXYNOS4_TZASC_LW_OFFSET		0x0071
-#define EXYNOS4_TZASC_RR_OFFSET		0x0072
-#define EXYNOS4_TZASC_RW_OFFSET		0x0073
-#define EXYNOS4_G2D_ACP_OFFSET		0x0080	/* 2D graphics engine */
-#define EXYNOS4_SSS_OFFSET		0x0083	/* Security Sub System */
-#define EXYNOS4_CORESIGHT_1_OFFSET	0x0088	/* 1st region */
-#define EXYNOS4_CORESIGHT_2_OFFSET	0x0089	/* 2nd region */
-#define EXYNOS4_CORESIGHT_3_OFFSET	0x008B	/* 3rd region */
-#define EXYNOS4_SMMUG2D_ACP_OFFSET	0x00A4	/* system mmu for 2D graphics engine */
-#define EXYNOS4_SMMUSSS_OFFSET		0x00A5	/* system mmu for SSS */
-#define EXYNOS4_GPIO_RIGHT_OFFSET	0x0100
-#define EXYNOS4_GPIO_LEFT_OFFSET	0x0140
-#define EXYNOS4_FIMC0_OFFSET		0x0180	/* image for display */
-#define EXYNOS4_FIMC1_OFFSET		0x0181
-#define EXYNOS4_FIMC2_OFFSET		0x0182
-#define EXYNOS4_FIMC3_OFFSET		0x0183
-#define EXYNOS4_JPEG_OFFSET		0x0184	/* JPEG Codec */
-#define EXYNOS4_MIPI_CSI0_OFFSET	0x0188	/* MIPI-Slim bus Interface */
-#define EXYNOS4_MIPI_CSI1_OFFSET	0x0189
-#define EXYNOS4_SMMUFIMC0_OFFSET	0x01A2	/* system mmus */
-#define EXYNOS4_SMMUFIMC1_OFFSET	

CVS commit: src/sys/ufs/ufs

2014-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 14 13:46:19 UTC 2014

Modified Files:
src/sys/ufs/ufs: inode.h

Log Message:
Make filehandles on UFS based filesystems use proper 64bit inodes.
32bit restriction noticed by Taylor R Campbell.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/ufs/ufs/inode.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/ufs/ufs/inode.h
diff -u src/sys/ufs/ufs/inode.h:1.66 src/sys/ufs/ufs/inode.h:1.67
--- src/sys/ufs/ufs/inode.h:1.66	Thu May  8 08:21:53 2014
+++ src/sys/ufs/ufs/inode.h	Wed May 14 13:46:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: inode.h,v 1.66 2014/05/08 08:21:53 hannken Exp $	*/
+/*	$NetBSD: inode.h,v 1.67 2014/05/14 13:46:19 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1989, 1993
@@ -295,7 +295,7 @@ struct indir {
 struct ufid {
 	u_int16_t ufid_len;	/* Length of structure. */
 	u_int16_t ufid_pad;	/* Force 32-bit alignment. */
-	u_int32_t ufid_ino;	/* File number (ino). */
+	ino_t ufid_ino;	/* File number (ino). */
 	int32_t	  ufid_gen;	/* Generation number. */
 };
 #endif /* _KERNEL */



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2014-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 14 13:53:41 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_gem.c

Log Message:
Fix 40-bit paddr error branch in i915_gem_object_get_pages_gtt.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.4 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.4	Thu May  1 15:19:16 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Wed May 14 13:53:41 2014
@@ -2215,6 +2215,7 @@ i915_gem_object_get_pages_gtt(struct drm
 			DRM_ERROR(GEM physical address exceeds 40 bits
 			: %PRIxMAX\n,
 			(uintmax_t)VM_PAGE_TO_PHYS(page));
+			error = -EIO;
 			goto fail2;
 		}
 	}
@@ -2236,7 +2237,8 @@ fail2:	bus_dmamem_unwire_uvm_object(dev-
 	obj-base.size, obj-pages, (obj-base.size / PAGE_SIZE));
 fail1:	kfree(obj-pages);
 	obj-pages = NULL;
-fail0:	return error;
+fail0:	KASSERT(error);
+	return error;
 }
 #else
 static int



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2014-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 14 13:59:19 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_gem.c

Log Message:
Reject 32-bit paddrs on 965.

XXX Doing the check here is wrong; it serves only to report an
earlier problem, which is that there's on way to express constraints
on paddrs to uvm_obj_wirepages.  bus_dmamem_alloc can do this, but it
gives us pages out of thin air, not pages backing a uvm object.  I
was hoping this wouldn't manifest as a real problem, but evidently it
does.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.5	Wed May 14 13:53:41 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Wed May 14 13:59:19 2014
@@ -2205,15 +2205,19 @@ i915_gem_object_get_pages_gtt(struct drm
 	KASSERT(obj-igo_nsegs = (obj-base.size / PAGE_SIZE));
 
 	/*
-	 * Check that the paddrs will fit in 40 bits.
+	 * Check that the paddrs will fit in 40 bits, or 32 bits on i965.
 	 *
 	 * XXX This is wrong; we ought to pass this constraint to
 	 * bus_dmamem_wire_uvm_object instead.
 	 */
 	TAILQ_FOREACH(page, obj-igo_pageq, pageq.queue) {
-		if (VM_PAGE_TO_PHYS(page)  ~0xffULL) {
-			DRM_ERROR(GEM physical address exceeds 40 bits
+		const uint64_t mask =
+		(IS_BROADWATER(dev) || IS_CRESTLINE(dev)?
+			0xULL : 0xffULL);
+		if (VM_PAGE_TO_PHYS(page)  mask) {
+			DRM_ERROR(GEM physical address exceeds %u bits
 			: %PRIxMAX\n,
+			popcount64(mask),
 			(uintmax_t)VM_PAGE_TO_PHYS(page));
 			error = -EIO;
 			goto fail2;



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

2014-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed May 14 14:38:54 UTC 2014

Modified Files:
src/sys/arch/evbarm/rpi: rpi_start.S

Log Message:
Enabling alignment faults and unaligned access at the same time makes
the former win. LLVM is more aggressive than GCC about using unaligned
access, so it would crash during pmap_init.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/rpi/rpi_start.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/evbarm/rpi/rpi_start.S
diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.10 src/sys/arch/evbarm/rpi/rpi_start.S:1.11
--- src/sys/arch/evbarm/rpi/rpi_start.S:1.10	Mon Apr  7 14:40:17 2014
+++ src/sys/arch/evbarm/rpi/rpi_start.S	Wed May 14 14:38:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_start.S,v 1.10 2014/04/07 14:40:17 skrll Exp $	*/
+/*	$NetBSD: rpi_start.S,v 1.11 2014/05/14 14:38:54 joerg Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003  Genetec Corporation.  All rights reserved.
@@ -87,7 +87,7 @@
 #include arm/armreg.h
 #include assym.h
 
-RCSID($NetBSD: rpi_start.S,v 1.10 2014/04/07 14:40:17 skrll Exp $)
+RCSID($NetBSD: rpi_start.S,v 1.11 2014/05/14 14:38:54 joerg Exp $)
 
 /*
  * Workaround Erratum 411920
@@ -268,7 +268,6 @@ Lstart:
 	/* bits to set in the Control Register */
 Lcontrol_set:
 	.word CPU_CONTROL_MMU_ENABLE  | \
-	  CPU_CONTROL_AFLT_ENABLE | \
 	  CPU_CONTROL_DC_ENABLE   | \
 	  CPU_CONTROL_WBUF_ENABLE |/* not defined in 1176 */   \
 	  CPU_CONTROL_32BP_ENABLE | \



CVS commit: src/lib/csu/common

2014-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed May 14 14:59:14 UTC 2014

Modified Files:
src/lib/csu/common: compident.S sysident.S

Log Message:
Ensure notes are properly padded to 32bit length.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/common/compident.S \
src/lib/csu/common/sysident.S

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

Modified files:

Index: src/lib/csu/common/compident.S
diff -u src/lib/csu/common/compident.S:1.2 src/lib/csu/common/compident.S:1.3
--- src/lib/csu/common/compident.S:1.2	Wed Feb 26 14:54:50 2014
+++ src/lib/csu/common/compident.S	Wed May 14 14:59:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: compident.S,v 1.2 2014/02/26 14:54:50 martin Exp $ */
+/* $NetBSD: compident.S,v 1.3 2014/05/14 14:59:14 joerg Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -63,3 +63,4 @@
 	.long	ELF_NOTE_TYPE_MCMODEL_TAG
 	.ascii	NetBSD\0\0
 	.ascii	CONTENT
+	.p2align 2
Index: src/lib/csu/common/sysident.S
diff -u src/lib/csu/common/sysident.S:1.2 src/lib/csu/common/sysident.S:1.3
--- src/lib/csu/common/sysident.S:1.2	Tue Sep 10 16:45:33 2013
+++ src/lib/csu/common/sysident.S	Wed May 14 14:59:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: sysident.S,v 1.2 2013/09/10 16:45:33 matt Exp $ */
+/* $NetBSD: sysident.S,v 1.3 2014/05/14 14:59:14 joerg Exp $ */
 
 /*
  * Copyright (c) 1997 Christopher G. Demetriou
@@ -85,4 +85,5 @@
 	.long	ELF_NOTE_TYPE_MARCH_TAG
 	.ascii	NetBSD\0\0
 	.asciz	ELF_NOTE_MARCH_DESC
+	.p2align 2
 #endif



CVS commit: src/sys/external/bsd/drm2/i915drm

2014-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 14 15:58:24 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/i915drm: i915_gem_gtt.c

Log Message:
Tweak i915 gen6_gtt_init calculations for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.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/external/bsd/drm2/i915drm/i915_gem_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.5 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.6
--- src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.5	Fri May  2 14:36:10 2014
+++ src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c	Wed May 14 15:58:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.5 2014/05/02 14:36:10 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.6 2014/05/14 15:58:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.5 2014/05/02 14:36:10 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.6 2014/05/14 15:58:24 riastradh Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -565,13 +565,13 @@ gen6_gtt_init(struct drm_device *dev)
 	struct drm_i915_private *const dev_priv = dev-dev_private;
 	struct pci_attach_args *const pa = dev-pdev-pd_pa;
 	struct intel_gtt *gtt = dev_priv-mm.gtt;
+	bus_addr_t gtt_addr;
+	bus_size_t gtt_size;
 	uint16_t snb_gmch_ctl, ggms, gms;
 	int ret;
 
 	gtt-do_idle_maps = false;
 
-	gtt-gma_bus_addr = dev-bus_maps[2].bm_base;
-
 	snb_gmch_ctl = pci_conf_read(pa-pa_pc, pa-pa_tag, SNB_GMCH_CTRL);
 
 	/* GMS: Graphics Mode Select.  */
@@ -586,38 +586,47 @@ gen6_gtt_init(struct drm_device *dev)
 		gtt-stolen_size = sizes[gms]  20;
 	}
 
-	/* GGMS: GTT Graphics Memory Size.  */
+	/* GGMS: GTT Graphics Memory Size, in megabytes.  */
 	ggms = __SHIFTOUT(snb_gmch_ctl, SNB_GMCH_GGMS);
+	CTASSERT(SNB_GMCH_GGMS_MASK = (INT_MAX  20));
 	gtt-gtt_total_entries = (ggms  20) / sizeof(gtt_pte_t);
 
-	gtt-gtt_mappable_entries = (dev-bus_maps[2].bm_size  PAGE_SHIFT);
-	if (((gtt-gtt_mappable_entries  8)  64) ||
-	(gtt-gtt_total_entries  gtt-gtt_mappable_entries)) {
-		DRM_ERROR(unknown GMADR entries: %d\n,
-		gtt-gtt_mappable_entries);
-		ret = -ENXIO;
-		goto fail0;
-	}
-
 	/* Linux sez:  For GEN6+ the PTEs for the ggtt live at 2MB + BAR0 */
-	if (dev-bus_maps[0].bm_size  (gtt-gtt_total_entries *
-		sizeof(gtt_pte_t))) {
-		DRM_ERROR(BAR0 too small for GTT: 0x%PRIxMAX  0x%PRIxMAX
-		\n,
+	gtt_addr = (220);
+	gtt_size = (gtt-gtt_total_entries * sizeof(gtt_pte_t));
+	if ((gtt_addr  (__type_max(bus_addr_t) - dev-bus_maps[0].bm_base)) ||
+	(gtt_size  (__type_max(bus_addr_t) -
+		(dev-bus_maps[0].bm_base + gtt_addr {
+		DRM_ERROR(GTT doesn't fit in BAR0:
+		 base 0x%PRIxMAX
+		 size 0x%PRIxMAX,
+		 gtt_addr 0x%PRIxMAX
+		 gtt_total_entries 0x%PRIxMAX\n,
+		(uintmax_t)dev-bus_maps[0].bm_base,
 		(uintmax_t)dev-bus_maps[0].bm_size,
-		(uintmax_t)(gtt-gtt_total_entries * sizeof(gtt_pte_t)));
+		(uintmax_t)gtt_addr,
+		(uintmax_t)gtt-gtt_total_entries);
 		ret = -ENODEV;
 		goto fail0;
 	}
-	if (bus_space_map(dev-bst, (dev-bus_maps[0].bm_base + (220)),
-		(gtt-gtt_total_entries * sizeof(gtt_pte_t)),
-		0,
-		gtt-gtt_bsh)) {
+
+	if (bus_space_map(dev-bst, (dev-bus_maps[0].bm_base + gtt_addr),
+		gtt_size, 0, gtt-gtt_bsh)) {
 		DRM_ERROR(unable to map GTT\n);
 		ret = -ENODEV;
 		goto fail0;
 	}
 
+	gtt-gma_bus_addr = dev-bus_maps[2].bm_base;
+	gtt-gtt_mappable_entries = (dev-bus_maps[2].bm_size  PAGE_SHIFT);
+	if (((gtt-gtt_mappable_entries  8)  64) ||
+	(gtt-gtt_total_entries  gtt-gtt_mappable_entries)) {
+		DRM_ERROR(unknown GMADR entries: %d\n,
+		gtt-gtt_mappable_entries);
+		ret = -ENXIO;
+		goto fail1;
+	}
+
 	ret = i915_gem_gtt_init_scratch_page(gtt, dev-dmat);
 	if (ret)
 		goto fail1;
@@ -627,8 +636,7 @@ gen6_gtt_init(struct drm_device *dev)
 
 fail2: __unused
 	i915_gem_gtt_fini_scratch_page(gtt, dev-dmat);
-fail1:	bus_space_unmap(dev-bst, gtt-gtt_bsh,
-	(gtt-gtt_total_entries * sizeof(gtt_pte_t)));
+fail1:	bus_space_unmap(dev-bst, gtt-gtt_bsh, gtt_size);
 fail0:	return ret;
 }
 



CVS commit: src/share/man/man9

2014-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 14 16:16:55 UTC 2014

Modified Files:
src/share/man/man9: uvm_km.9

Log Message:
Fix typo in uvm_km(9): there is no struct vm_map_kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man9/uvm_km.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/uvm_km.9
diff -u src/share/man/man9/uvm_km.9:1.2 src/share/man/man9/uvm_km.9:1.3
--- src/share/man/man9/uvm_km.9:1.2	Fri Jun  3 18:43:38 2011
+++ src/share/man/man9/uvm_km.9	Wed May 14 16:16:55 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: uvm_km.9,v 1.2 2011/06/03 18:43:38 rmind Exp $
+.\	$NetBSD: uvm_km.9,v 1.3 2014/05/14 16:16:55 riastradh Exp $
 .\
 .\ Copyright (c) 1998 Matthew R. Green
 .\ All rights reserved.
@@ -39,7 +39,7 @@
 .Fn uvm_km_free struct vm_map *map vaddr_t addr vsize_t size uvm_flag_t flags
 .Ft struct vm_map *
 .Fn uvm_km_suballoc struct vm_map *map vaddr_t *min vaddr_t *max \
-vsize_t size int flags bool fixed struct vm_map_kernel *submap
+vsize_t size int flags bool fixed struct vm_map *submap
 .Sh DESCRIPTION
 The UVM facility for allocation of kernel memory or address space in pages.
 Both wired and pageable memory can be allocated by this facility, as well



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2014-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 14 16:25:19 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_gem.c

Log Message:
Fix sense of test in last commit, noted by Robert Swindells.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.6	Wed May 14 13:59:19 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Wed May 14 16:25:19 2014
@@ -2214,7 +2214,7 @@ i915_gem_object_get_pages_gtt(struct drm
 		const uint64_t mask =
 		(IS_BROADWATER(dev) || IS_CRESTLINE(dev)?
 			0xULL : 0xffULL);
-		if (VM_PAGE_TO_PHYS(page)  mask) {
+		if (VM_PAGE_TO_PHYS(page)  ~mask) {
 			DRM_ERROR(GEM physical address exceeds %u bits
 			: %PRIxMAX\n,
 			popcount64(mask),



CVS commit: src/sys/net/npf

2014-05-14 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed May 14 20:35:27 UTC 2014

Modified Files:
src/sys/net/npf: npf_session.c

Log Message:
npf_session_inspect: do not silently drop the packet on state check failure.
Let the rules deal with it (e.g. we may want to log it).


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/net/npf/npf_session.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/net/npf/npf_session.c
diff -u src/sys/net/npf/npf_session.c:1.31 src/sys/net/npf/npf_session.c:1.32
--- src/sys/net/npf/npf_session.c:1.31	Fri Mar 14 11:29:44 2014
+++ src/sys/net/npf/npf_session.c	Wed May 14 20:35:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_session.c,v 1.31 2014/03/14 11:29:44 rmind Exp $	*/
+/*	$NetBSD: npf_session.c,v 1.32 2014/05/14 20:35:27 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010-2013 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_session.c,v 1.31 2014/03/14 11:29:44 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_session.c,v 1.32 2014/05/14 20:35:27 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -590,10 +590,9 @@ npf_session_inspect(npf_cache_t *npc, nb
 
 	/* Inspect the protocol data and handle state changes. */
 	if (!npf_state_inspect(npc, nbuf, se-s_state, forw)) {
-		/* Silently block invalid packets. */
+		/* Invalid: let the rules deal with it. */
 		npf_session_release(se);
 		npf_stats_inc(NPF_STAT_INVALID_STATE);
-		*error = ENETUNREACH;
 		se = NULL;
 	}
 	return se;



CVS commit: src/usr.sbin/npf/npftest

2014-05-14 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed May 14 21:46:50 UTC 2014

Modified Files:
src/usr.sbin/npf/npftest: README

Log Message:
npftest: fix the example in the README file.


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

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

Modified files:

Index: src/usr.sbin/npf/npftest/README
diff -u src/usr.sbin/npf/npftest/README:1.4 src/usr.sbin/npf/npftest/README:1.5
--- src/usr.sbin/npf/npftest/README:1.4	Sat Feb  9 03:35:33 2013
+++ src/usr.sbin/npf/npftest/README	Wed May 14 21:46:50 2014
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.4 2013/02/09 03:35:33 rmind Exp $
+$NetBSD: README,v 1.5 2014/05/14 21:46:50 rmind Exp $
 
 npftest - a tool for regression testing and debugging NPF.
 It uses RUMP framework to run NPF kernel module in the userspace.
@@ -13,8 +13,8 @@ npftest -c /tmp/npf.plist -t
 Stream:
 
 tcpdump -w stream.pcap -i $INTERFACE host $HOST and tcp
-npfctl debug
-npftest -c /tmp/npf.plist -s stream.pcap -o stream_npf_data.txt
+npfctl debug npftest.conf /tmp/npf.plist
+npftest -c /tmp/npf.plist -s stream.pcap  stream_npf_data.txt
 
 Preferably, use MALLOC_OPTIONS=AJ and/or other facilities.
 



CVS commit: src/sys/lib/libunwind

2014-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed May 14 22:13:36 UTC 2014

Modified Files:
src/sys/lib/libunwind: unwind_registers.S

Log Message:
Lazy VFP processing works a lot better if the functions contain a return
instruction.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/lib/libunwind/unwind_registers.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/lib/libunwind/unwind_registers.S
diff -u src/sys/lib/libunwind/unwind_registers.S:1.13 src/sys/lib/libunwind/unwind_registers.S:1.14
--- src/sys/lib/libunwind/unwind_registers.S:1.13	Sun May 11 02:07:35 2014
+++ src/sys/lib/libunwind/unwind_registers.S	Wed May 14 22:13:36 2014
@@ -286,12 +286,14 @@ END(_ZN7_Unwind15Registers_arm32C1Ev)
 ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
 	add	r0, #72
 	vstmia	r0, {d0-d15}
+	RET
 END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
 
 	.hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev
 ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
 	add	r0, #200
 	vstmia	r0, {d16-d31}
+	RET
 END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
 
 	.hidden _ZNK7_Unwind15Registers_arm326jumptoEv



CVS commit: src/usr.sbin/npf/npfctl

2014-05-14 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Thu May 15 02:34:29 UTC 2014

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5 npf_bpf_comp.c npf_build.c npfctl.h

Log Message:
NPF: imply SYN-only check for the stateful rules by default (when inspecting
TCP packets).  Many users trip here.  This behaviour can be overriden with the
explicit flags keyword, but other configuration does not really make sense.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npfctl/npf_bpf_comp.c
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/npf/npfctl/npf_build.c \
src/usr.sbin/npf/npfctl/npfctl.h

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.39 src/usr.sbin/npf/npfctl/npf.conf.5:1.40
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.39	Fri Feb 14 01:52:58 2014
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Thu May 15 02:34:29 2014
@@ -1,4 +1,4 @@
-.\$NetBSD: npf.conf.5,v 1.39 2014/02/14 01:52:58 rmind Exp $
+.\$NetBSD: npf.conf.5,v 1.40 2014/05/15 02:34:29 rmind Exp $
 .\
 .\ Copyright (c) 2009-2014 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 February 14, 2014
+.Dd May 15, 2014
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -155,6 +155,25 @@ block out final pcap-filter tcp and dst
 .Pp
 Fragments are not selectable since NPF always reassembles packets
 before further processing.
+.Ss Stateful
+Stateful packet inspection is enabled using
+.Cd stateful
+or
+.Cd stateful-ends
+keywords.
+The former creates a state which is uniquely identified by a 5-tuple (source
+and destination IP addresses, port numbers and an interface identifier).
+The latter excludes the interface identifier and must be used with
+precaution.
+In both cases, a full TCP state tracking is performed for TCP connections
+and a limited tracking for message-based protocols (UDP and ICMP).
+.Pp
+By default, stateful rule implies SYN-only flag check (flags S/SAFR)
+for the TCP packets.
+It is not advisable to change this behavior, however,
+it can be overriden with
+.Cd flags
+keyword.
 .Ss Map
 Network Address Translation (NAT) is expressed in a form of segment mapping.
 The translation may be dynamic (stateful) or static (stateless).
@@ -252,7 +271,8 @@ rule-list	= [ rule new-line ] rule-list
 
 npf-filter	= [ family family-opt ] [ proto protocol [ proto-opts ] ]
 		  ( all | filt-opts )
-static-rule	= ( block [ block-opts ] | pass ) [ stateful ]
+static-rule	= ( block [ block-opts ] | pass )
+		  [ stateful | stateful-ends ]
 		  [ in | out ] [ final ] [ on interface ]
 		  ( npf-filter | pcap-filter pcap-filter-expr )
 		  [ apply proc-name ]

Index: src/usr.sbin/npf/npfctl/npf_bpf_comp.c
diff -u src/usr.sbin/npf/npfctl/npf_bpf_comp.c:1.4 src/usr.sbin/npf/npfctl/npf_bpf_comp.c:1.5
--- src/usr.sbin/npf/npfctl/npf_bpf_comp.c:1.4	Sat Mar 15 08:46:01 2014
+++ src/usr.sbin/npf/npfctl/npf_bpf_comp.c	Thu May 15 02:34:29 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: npf_bpf_comp.c,v 1.4 2014/03/15 08:46:01 rmind Exp $	*/
+/*	$NetBSD: npf_bpf_comp.c,v 1.5 2014/05/15 02:34:29 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2010-2013 The NetBSD Foundation, Inc.
+ * Copyright (c) 2010-2014 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This material is based upon work partially supported by The
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: npf_bpf_comp.c,v 1.4 2014/03/15 08:46:01 rmind Exp $);
+__RCSID($NetBSD: npf_bpf_comp.c,v 1.5 2014/05/15 02:34:29 rmind Exp $);
 
 #include stdlib.h
 #include stdbool.h
@@ -513,12 +513,23 @@ npfctl_bpf_ports(npf_bpf_t *ctx, u_int o
  * npfctl_bpf_tcpfl: code block to match TCP flags.
  */
 void
-npfctl_bpf_tcpfl(npf_bpf_t *ctx, uint8_t tf, uint8_t tf_mask)
+npfctl_bpf_tcpfl(npf_bpf_t *ctx, uint8_t tf, uint8_t tf_mask, bool checktcp)
 {
 	const u_int tcpfl_off = offsetof(struct tcphdr, th_flags);
 
 	/* X - IP header length */
 	fetch_l3(ctx, AF_UNSPEC, X_EQ_L4OFF);
+	if (checktcp) {
+		const u_int jf = (tf_mask != tf) ? 3 : 2;
+		assert(ctx-ingroup == false);
+
+		/* A - L4 protocol; A == TCP?  If not, jump out. */
+		struct bpf_insn insns_tcp[] = {
+			BPF_STMT(BPF_LD+BPF_W+BPF_MEM, BPF_MW_L4PROTO),
+			BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, IPPROTO_TCP, 0, jf),
+		};
+		add_insns(ctx, insns_tcp, __arraycount(insns_tcp));
+	}
 
 	struct bpf_insn insns_tf[] = {
 		/* A - TCP flags */
@@ -540,8 +551,10 @@ npfctl_bpf_tcpfl(npf_bpf_t *ctx, uint8_t
 	};
 	add_insns(ctx, insns_cmp, __arraycount(insns_cmp));
 
-	uint32_t mwords[] = { BM_TCPFL, 2, tf, tf_mask};
-	done_block(ctx, mwords, sizeof(mwords));
+	if (!checktcp) {
+		uint32_t mwords[] = { BM_TCPFL, 2, tf, tf_mask};
+		done_block(ctx, mwords, sizeof(mwords));
+	}
 }
 
 /*

Index: