CVS commit: src/sys/dev/pci

2014-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 23 06:18:54 UTC 2014

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

Log Message:
No functional change:
- sort in PCI capability ID order.
- add comments.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.86 src/sys/dev/pci/pcireg.h:1.87
--- src/sys/dev/pci/pcireg.h:1.86	Fri May  9 14:51:26 2014
+++ src/sys/dev/pci/pcireg.h	Fri May 23 06:18:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.86 2014/05/09 14:51:26 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.87 2014/05/23 06:18:54 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -472,6 +472,32 @@ typedef u_int8_t pci_revision_t;
 #define	PCI_CAP_PCIAF		0x13
 
 /*
+ * Capability ID: 0x01
+ * Power Management Capability; access via capability pointer.
+ */
+
+/* Power Management Capability Register */
+#define PCI_PMCR_SHIFT		16
+#define PCI_PMCR		0x02
+#define PCI_PMCR_D1SUPP		0x0200
+#define PCI_PMCR_D2SUPP		0x0400
+/* Power Management Control Status Register */
+#define PCI_PMCSR		0x04
+#define	PCI_PMCSR_PME_EN	0x100
+#define PCI_PMCSR_STATE_MASK	0x03
+#define PCI_PMCSR_STATE_D0  0x00
+#define PCI_PMCSR_STATE_D1  0x01
+#define PCI_PMCSR_STATE_D2  0x02
+#define PCI_PMCSR_STATE_D3  0x03
+#define PCI_PMCSR_PME_STS   0x8000
+
+/*
+ * Capability ID: 0x02
+ * AGP
+ */
+
+/*
+ * Capability ID: 0x03
  * Vital Product Data; access via capability pointer (PCI rev 2.2).
  */
 #define	PCI_VPD_ADDRESS_MASK	0x7fff
@@ -481,6 +507,16 @@ typedef u_int8_t pci_revision_t;
 #define	PCI_VPD_DATAREG(ofs)	((ofs) + 4)
 #define	PCI_VPD_OPFLAG		0x8000
 
+/*
+ * Capability ID: 0x04
+ * Slot ID
+ */
+
+/*
+ * Capability ID: 0x05
+ * MSI
+ */
+
 #define	PCI_MSI_CTL		0x0	/* Message Control Register offset */
 #define	PCI_MSI_MADDR		0x4	/* Message Address Register (least
 	 * significant bits) offset
@@ -512,51 +548,8 @@ typedef u_int8_t pci_revision_t;
  * MSI Pending Bits (32 bit field)
  */
 
-#define	PCI_MSIX_CTL_ENABLE	0x8000
-#define	PCI_MSIX_CTL_FUNCMASK	0x4000
-#define	PCI_MSIX_CTL_TBLSIZE_MASK 0x07ff
-#define	PCI_MSIX_CTL_TBLSIZE_SHIFT 16
-#define	PCI_MSIX_CTL_TBLSIZE(ofs)	(((ofs)  PCI_MSIX_CTL_TBLSIZE_SHIFT)  PCI_MSIX_CTL_TBLSIZE_MASK)
-/*
- * 2nd DWORD is the Table Offset
- */
-#define	PCI_MSIX_TBLOFFSET_MASK	0xfff8
-#define	PCI_MSIX_TBLBIR_MASK	0x0007
-/*
- * 3rd DWORD is the Pending Bitmap Array Offset
- */
-#define	PCI_MSIX_PBAOFFSET_MASK	0xfff8
-#define	PCI_MSIX_PBABIR_MASK	0x0007
-
-struct pci_msix_table_entry {
-	uint32_t pci_msix_addr_lo;
-	uint32_t pci_msix_addr_hi;
-	uint32_t pci_msix_value;
-	uint32_t pci_msix_vendor_control;
-};
-#define	PCI_MSIX_VENDCTL_MASK	0x0001
-
-
-/*
- * Power Management Capability; access via capability pointer.
- */
-
-/* Power Management Capability Register */
-#define PCI_PMCR_SHIFT		16
-#define PCI_PMCR		0x02
-#define PCI_PMCR_D1SUPP		0x0200
-#define PCI_PMCR_D2SUPP		0x0400
-/* Power Management Control Status Register */
-#define PCI_PMCSR		0x04
-#define	PCI_PMCSR_PME_EN	0x100
-#define PCI_PMCSR_STATE_MASK	0x03
-#define PCI_PMCSR_STATE_D0  0x00
-#define PCI_PMCSR_STATE_D1  0x01
-#define PCI_PMCSR_STATE_D2  0x02
-#define PCI_PMCSR_STATE_D3  0x03
-#define PCI_PMCSR_PME_STS   0x8000
-
 /*
+ * Capability ID: 0x07
  * PCI-X capability.
  */
 
@@ -627,6 +620,47 @@ struct pci_msix_table_entry {
 #define PCIX_STATUS_SCERR			0x2000
 
 /*
+ * Capability ID: 0x08
+ * HyperTransport
+ */
+
+/*
+ * Capability ID: 0x09
+ * Vendor Specific
+ */
+
+/*
+ * Capability ID: 0x0a
+ * Debug Port
+ */
+
+/*
+ * Capability ID: 0x0b
+ * Compact PCI
+ */
+
+/*
+ * Capability ID: 0x0c
+ * Hotplug
+ */
+
+/*
+ * Capability ID: 0x0d
+ * Subvendor
+ */
+
+/*
+ * Capability ID: 0x0e
+ * AGP8
+ */
+
+/*
+ * Capability ID: 0x0f
+ * Secure
+ */
+
+/*
+ * Capability ID: 0x10
  * PCI Express; access via capability pointer.
  */
 #define PCIE_XCAP	0x00	/* Capability List  Capabilities Register */
@@ -805,6 +839,47 @@ struct pci_msix_table_entry {
 #define PCIE_SLCSR2	0x38	/* Slot Control  Status 2 Register */
 
 /*
+ * Capability ID: 0x11
+ * MSIX
+ */
+
+#define	PCI_MSIX_CTL_ENABLE	0x8000
+#define	PCI_MSIX_CTL_FUNCMASK	0x4000
+#define	PCI_MSIX_CTL_TBLSIZE_MASK 0x07ff
+#define	PCI_MSIX_CTL_TBLSIZE_SHIFT 16
+#define	PCI_MSIX_CTL_TBLSIZE(ofs)	(((ofs)  PCI_MSIX_CTL_TBLSIZE_SHIFT)  PCI_MSIX_CTL_TBLSIZE_MASK)
+/*
+ * 2nd DWORD is the Table Offset
+ */
+#define	PCI_MSIX_TBLOFFSET_MASK	0xfff8
+#define	PCI_MSIX_TBLBIR_MASK	0x0007
+/*
+ * 3rd DWORD is the Pending Bitmap Array Offset
+ */
+#define	PCI_MSIX_PBAOFFSET_MASK	0xfff8
+#define	PCI_MSIX_PBABIR_MASK	0x0007
+
+struct pci_msix_table_entry {
+	uint32_t pci_msix_addr_lo;
+	uint32_t pci_msix_addr_hi;
+	

CVS commit: src/sys/arch/hppa/hppa

2014-05-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 23 08:17:08 UTC 2014

Modified Files:
src/sys/arch/hppa/hppa: ipifuncs.c

Log Message:
Make this compile. Hi rmind!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/hppa/ipifuncs.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/hppa/hppa/ipifuncs.c
diff -u src/sys/arch/hppa/hppa/ipifuncs.c:1.3 src/sys/arch/hppa/hppa/ipifuncs.c:1.4
--- src/sys/arch/hppa/hppa/ipifuncs.c:1.3	Mon May 19 22:47:53 2014
+++ src/sys/arch/hppa/hppa/ipifuncs.c	Fri May 23 08:17:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipifuncs.c,v 1.3 2014/05/19 22:47:53 rmind Exp $	*/
+/*	$NetBSD: ipifuncs.c,v 1.4 2014/05/23 08:17:08 skrll Exp $	*/
 /*	$OpenBSD: ipi.c,v 1.4 2011/01/14 13:20:06 jsing Exp $	*/
 
 /*
@@ -166,7 +166,7 @@ xc_send_ipi(struct cpu_info *ci)
 }
 
 void
-cpu_ipi(struct cpu_info *)
+cpu_ipi(struct cpu_info *ci)
 {
 	KASSERT(kpreempt_disabled());
 	KASSERT(curcpu() != ci);



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

2014-05-23 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri May 23 10:56:37 UTC 2014

Modified Files:
src/sys/rump/librump/rumpvfs: rump_vfs.c

Log Message:
Permissions work better if you specify them in octal ...

Also, do an explicit chmod of /tmp to account for cmask getting in the way.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/rump/librump/rumpvfs/rump_vfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rump_vfs.c
diff -u src/sys/rump/librump/rumpvfs/rump_vfs.c:1.79 src/sys/rump/librump/rumpvfs/rump_vfs.c:1.80
--- src/sys/rump/librump/rumpvfs/rump_vfs.c:1.79	Thu May 22 12:31:28 2014
+++ src/sys/rump/librump/rumpvfs/rump_vfs.c	Fri May 23 10:56:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_vfs.c,v 1.79 2014/05/22 12:31:28 pooka Exp $	*/
+/*	$NetBSD: rump_vfs.c,v 1.80 2014/05/23 10:56:36 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,12 +29,13 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump_vfs.c,v 1.79 2014/05/22 12:31:28 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump_vfs.c,v 1.80 2014/05/23 10:56:36 pooka Exp $);
 
 #include sys/param.h
 #include sys/buf.h
 #include sys/conf.h
 #include sys/evcnt.h
+#include sys/fcntl.h
 #include sys/filedesc.h
 #include sys/fstrans.h
 #include sys/lockf.h
@@ -137,7 +138,8 @@ RUMP_COMPONENT(RUMP__FACTION_VFS)
 
 	/* mtree: create /dev and /tmp */
 	do_sys_mkdir(/dev, 0755, UIO_SYSSPACE);
-	do_sys_mkdir(/tmp, 1777, UIO_SYSSPACE);
+	do_sys_mkdir(/tmp, 01777, UIO_SYSSPACE);
+	do_sys_chmodat(curlwp, AT_FDCWD, /tmp, 01777, 0);
 
 	rump_proc_vfs_init = pvfs_init;
 	rump_proc_vfs_release = pvfs_rele;



CVS commit: src/lib/librumpuser

2014-05-23 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri May 23 11:04:03 UTC 2014

Modified Files:
src/lib/librumpuser: rumpuser_sp.c

Log Message:
Create remote clients with standard file descriptors open.  Fixes at
least editing a new file with ed in rumpremote (because ed calls
isatty(0) in case a file does not exist).


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/lib/librumpuser/rumpuser_sp.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/librumpuser/rumpuser_sp.c
diff -u src/lib/librumpuser/rumpuser_sp.c:1.63 src/lib/librumpuser/rumpuser_sp.c:1.64
--- src/lib/librumpuser/rumpuser_sp.c:1.63	Fri Feb 28 13:55:36 2014
+++ src/lib/librumpuser/rumpuser_sp.c	Fri May 23 11:04:03 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpuser_sp.c,v 1.63 2014/02/28 13:55:36 pooka Exp $	*/
+/*  $NetBSD: rumpuser_sp.c,v 1.64 2014/05/23 11:04:03 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -37,7 +37,7 @@
 #include rumpuser_port.h
 
 #if !defined(lint)
-__RCSID($NetBSD: rumpuser_sp.c,v 1.63 2014/02/28 13:55:36 pooka Exp $);
+__RCSID($NetBSD: rumpuser_sp.c,v 1.64 2014/05/23 11:04:03 pooka Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -957,6 +957,7 @@ schedulework(struct spclient *spc, enum 
 struct spservarg {
 	int sps_sock;
 	connecthook_fn sps_connhook;
+	struct lwp *sps_l;
 };
 
 static void
@@ -983,7 +984,7 @@ handlereq(struct spclient *spc)
 			comm[commlen] = '\0';
 
 			if ((error = lwproc_rfork(spc,
-			RUMP_RFCFDG, comm)) != 0) {
+			RUMP_RFFDG, comm)) != 0) {
 shutdown(spc-spc_fd, SHUT_RDWR);
 			}
 
@@ -1193,6 +1194,8 @@ spserver(void *arg)
 	int rv;
 	unsigned int nfds, maxidx;
 
+	rump_pub_lwproc_switch(sarg-sps_l);
+
 	for (idx = 0; idx  MAXCLI; idx++) {
 		pfdlist[idx].fd = -1;
 		pfdlist[idx].events = POLLIN;
@@ -1317,6 +1320,7 @@ rumpuser_sp_init(const char *url,
 	pthread_t pt;
 	struct spservarg *sarg;
 	struct sockaddr *sap;
+	struct lwp *calllwp;
 	char *p;
 	unsigned idx = 0; /* XXXgcc */
 	int error, s;
@@ -1361,13 +1365,28 @@ rumpuser_sp_init(const char *url,
 		fprintf(stderr, rump_sp: server bind failed\n);
 		goto out;
 	}
-
 	if (listen(s, MAXCLI) == -1) {
 		error = errno;
 		fprintf(stderr, rump_sp: server listen failed\n);
 		goto out;
 	}
 
+	/*
+	 * Create a context that the client threads run off of.
+	 * We fork a dedicated context so as to ensure that all
+	 * client threads get the same set of fd's.  We fork off
+	 * of whatever context the caller is running in (most likely
+	 * an implicit thread, i.e. proc 1) and do not
+	 * close fd's.  The assumption is that people who
+	 * write servers (i.e. kernels) know what they're doing.
+	 */
+	calllwp = rump_pub_lwproc_curlwp();
+	if ((error = rump_pub_lwproc_rfork(RUMP_RFFDG)) != 0) {
+		fprintf(stderr, rump_sp: rfork failed);
+		goto out;
+	}
+	sarg-sps_l = rump_pub_lwproc_curlwp();
+	rump_pub_lwproc_switch(calllwp);
 	if ((error = pthread_create(pt, NULL, spserver, sarg)) != 0) {
 		fprintf(stderr, rump_sp: cannot create wrkr thread\n);
 		goto out;
@@ -1389,8 +1408,8 @@ rumpuser_sp_fini(void *arg)
 	}
 
 	/*
-	 * stuff response into the socket, since this process is just
-	 * about to exit
+	 * stuff response into the socket, since the rump kernel container
+	 * is just about to exit
 	 */
 	if (spc  spc-spc_syscallreq)
 		send_syscall_resp(spc, spc-spc_syscallreq, 0, retval);
@@ -1399,4 +1418,9 @@ rumpuser_sp_fini(void *arg)
 		shutdown(spclist[0].spc_fd, SHUT_RDWR);
 		spfini = 1;
 	}
+
+	/*
+	 * could release thread, but don't bother, since the container
+	 * will be stone dead in a moment.
+	 */
 }



CVS commit: src/tests/lib/libbpfjit

2014-05-23 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri May 23 11:47:59 UTC 2014

Modified Files:
src/tests/lib/libbpfjit: t_bpfjit.c

Log Message:
Test Array Bounds Check Elimination (ABC) and test bpf programs from bpf(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libbpfjit/t_bpfjit.c

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

Modified files:

Index: src/tests/lib/libbpfjit/t_bpfjit.c
diff -u src/tests/lib/libbpfjit/t_bpfjit.c:1.2 src/tests/lib/libbpfjit/t_bpfjit.c:1.3
--- src/tests/lib/libbpfjit/t_bpfjit.c:1.2	Fri Nov 15 00:12:45 2013
+++ src/tests/lib/libbpfjit/t_bpfjit.c	Fri May 23 11:47:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_bpfjit.c,v 1.2 2013/11/15 00:12:45 rmind Exp $ */
+/*	$NetBSD: t_bpfjit.c,v 1.3 2014/05/23 11:47:59 alnsn Exp $ */
 
 /*-
  * Copyright (c) 2011-2012 Alexander Nasonov.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: t_bpfjit.c,v 1.2 2013/11/15 00:12:45 rmind Exp $);
+__RCSID($NetBSD: t_bpfjit.c,v 1.3 2014/05/23 11:47:59 alnsn Exp $);
 
 #include atf-c.h
 #include stdint.h
@@ -3290,6 +3290,540 @@ ATF_TC_BODY(bpfjit_opt_ld_ind_4, tc)
 	bpfjit_free_code(code);
 }
 
+ATF_TC(bpfjit_abc_ja);
+ATF_TC_HEAD(bpfjit_abc_ja, tc)
+{
+	atf_tc_set_md_var(tc, descr,
+	Test ABC optimization with a single BPF_JMP+BPF_JA);
+}
+
+ATF_TC_BODY(bpfjit_abc_ja, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 3), /* min. length 4 */
+		BPF_STMT(BPF_JMP+BPF_JA, 2),
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, UINT32_MAX - 1),
+		BPF_STMT(BPF_RET+BPF_K, 0),
+		BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 2), /* min. length 6 */
+		BPF_STMT(BPF_RET+BPF_A, 0),
+		BPF_STMT(BPF_RET+BPF_K, 1),
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 6),
+		BPF_STMT(BPF_RET+BPF_K, 2),
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 7),
+		BPF_STMT(BPF_RET+BPF_K, 3),
+	};
+
+	bpfjit_func_t code;
+	uint8_t pkt[6] = {0, 0, /* UINT32_MAX: */ 255, 255, 255, 255};
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	ATF_CHECK(bpf_validate(insns, insn_count));
+
+	code = bpfjit_generate_code(bc, insns, insn_count);
+	ATF_REQUIRE(code != NULL);
+
+	ATF_CHECK(code(pkt, 0, 0) == 0);
+	ATF_CHECK(code(pkt, 1, 1) == 0);
+	ATF_CHECK(code(pkt, 2, 2) == 0);
+	ATF_CHECK(code(pkt, 3, 3) == 0);
+	ATF_CHECK(code(pkt, 4, 4) == 0);
+	ATF_CHECK(code(pkt, 5, 5) == 0);
+	ATF_CHECK(code(pkt, 6, 6) == UINT32_MAX);
+
+	bpfjit_free_code(code);
+}
+
+ATF_TC(bpfjit_abc_ja_over);
+ATF_TC_HEAD(bpfjit_abc_ja_over, tc)
+{
+	atf_tc_set_md_var(tc, descr,
+	Test ABC optimization when BPF_JMP+BPF_JA jumps over all loads);
+}
+
+ATF_TC_BODY(bpfjit_abc_ja_over, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_JMP+BPF_JA, 2),
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 3),
+		BPF_STMT(BPF_RET+BPF_K, 0),
+		BPF_STMT(BPF_RET+BPF_K, UINT32_MAX),
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 4),
+		BPF_STMT(BPF_RET+BPF_K, 1),
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 5),
+		BPF_STMT(BPF_RET+BPF_K, 2),
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 6),
+		BPF_STMT(BPF_RET+BPF_K, 3),
+	};
+
+	bpfjit_func_t code;
+	uint8_t pkt[1]; /* the program doesn't read any data */
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	ATF_CHECK(bpf_validate(insns, insn_count));
+
+	code = bpfjit_generate_code(bc, insns, insn_count);
+	ATF_REQUIRE(code != NULL);
+
+	ATF_CHECK(code(pkt, 1, 1) == UINT32_MAX);
+
+	bpfjit_free_code(code);
+}
+
+ATF_TC(bpfjit_abc_ld_chain);
+ATF_TC_HEAD(bpfjit_abc_ld_chain, tc)
+{
+	atf_tc_set_md_var(tc, descr,
+	Test ABC optimization of a chain of BPF_LD instructions 
+	with exits leading to a single BPF_RET);
+}
+
+ATF_TC_BODY(bpfjit_abc_ld_chain, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 3), /* min. length 4 */
+		BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 8, 0, 4),
+		BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 4), /* min. length 6 */
+		BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 7, 0, 2),
+		BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 6), /* min. length 10 */
+		BPF_JUMP(BPF_JMP+BPF_JGT+BPF_K, 6, 0, 1),
+		BPF_STMT(BPF_RET+BPF_K, 123456789),
+		BPF_STMT(BPF_RET+BPF_K, 987654321),
+	};
+
+	bpfjit_func_t code;
+	uint8_t pkt[10] = {};
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	ATF_CHECK(bpf_validate(insns, insn_count));
+
+	code = bpfjit_generate_code(bc, insns, insn_count);
+	ATF_REQUIRE(code != NULL);
+
+	/* Packet is too short. */
+	ATF_CHECK(code(pkt, 1, 1) == 0);
+	ATF_CHECK(code(pkt, 2, 2) == 0);
+	ATF_CHECK(code(pkt, 3, 3) == 0);
+
+	/* !(pkt[3] == 8) = return 123456789 */
+	ATF_CHECK(code(pkt, 4, 4) == 123456789);
+	ATF_CHECK(code(pkt, 5, 5) == 123456789);
+	ATF_CHECK(code(pkt, 6, 6) == 123456789);
+	ATF_CHECK(code(pkt, 7, 7) == 123456789);
+	ATF_CHECK(code(pkt, 8, 8) == 123456789);
+	ATF_CHECK(code(pkt, 9, 9) == 123456789);
+
+	/* !(pkt[4:2] = 7) = too short or return 123456789 */
+	pkt[3] = 8;
+	ATF_CHECK(code(pkt, 1, 1) == 0);
+	ATF_CHECK(code(pkt, 2, 2) == 0);
+	ATF_CHECK(code(pkt, 3, 3) == 0);
+	ATF_CHECK(code(pkt, 4, 

CVS commit: src/tests/lib/libbpfjit

2014-05-23 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri May 23 11:48:26 UTC 2014

Modified Files:
src/tests/lib/libbpfjit: t_bpfjit.c

Log Message:
Update copyright year.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libbpfjit/t_bpfjit.c

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

Modified files:

Index: src/tests/lib/libbpfjit/t_bpfjit.c
diff -u src/tests/lib/libbpfjit/t_bpfjit.c:1.3 src/tests/lib/libbpfjit/t_bpfjit.c:1.4
--- src/tests/lib/libbpfjit/t_bpfjit.c:1.3	Fri May 23 11:47:59 2014
+++ src/tests/lib/libbpfjit/t_bpfjit.c	Fri May 23 11:48:26 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: t_bpfjit.c,v 1.3 2014/05/23 11:47:59 alnsn Exp $ */
+/*	$NetBSD: t_bpfjit.c,v 1.4 2014/05/23 11:48:26 alnsn Exp $ */
 
 /*-
- * Copyright (c) 2011-2012 Alexander Nasonov.
+ * Copyright (c) 2011-2012, 2014 Alexander Nasonov.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: t_bpfjit.c,v 1.3 2014/05/23 11:47:59 alnsn Exp $);
+__RCSID($NetBSD: t_bpfjit.c,v 1.4 2014/05/23 11:48:26 alnsn Exp $);
 
 #include atf-c.h
 #include stdint.h



CVS commit: src/distrib/vax/cdroms/installcd

2014-05-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 23 12:25:46 UTC 2014

Modified Files:
src/distrib/vax/cdroms/installcd: etc.rc

Log Message:
If mounting the various tmpfs instances fails, we do not have enough
RAM installed. Tell the user about it and exec a single user shell
(instead of randomly failing later and hanging the machine.)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/vax/cdroms/installcd/etc.rc

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

Modified files:

Index: src/distrib/vax/cdroms/installcd/etc.rc
diff -u src/distrib/vax/cdroms/installcd/etc.rc:1.1 src/distrib/vax/cdroms/installcd/etc.rc:1.2
--- src/distrib/vax/cdroms/installcd/etc.rc:1.1	Wed May 21 14:21:35 2014
+++ src/distrib/vax/cdroms/installcd/etc.rc	Fri May 23 12:25:46 2014
@@ -1,4 +1,4 @@
-# $NetBSD: etc.rc,v 1.1 2014/05/21 14:21:35 martin Exp $
+# $NetBSD: etc.rc,v 1.2 2014/05/23 12:25:46 martin Exp $
 #
 # Copyright (c) 1997 Perry E. Metzger
 # Copyright (c) 1994 Christopher G. Demetriou
@@ -39,10 +39,22 @@ export PATH
 # hack to get around bugs in kernfs's rootdev/rrootdev lookup.
 ls -l /dev/*  /dev/null 21
 
+lowmemfail()
+{
+	cat  EOM
+This machine seems to not have enough memory for this install method.
+Please refer to the installation documentation on how to create and
+boot a custom kernel and how to install with that.
+
+Please use the 'halt' command to stop the machine.
+EOM
+	exec sh
+}
+
 # mount a few tempfs to allow modifications over the CD contents
-mount -t tmpfs tmpfs /tmp
-mount -t tmpfs tmpfs /var
-mount -t tmpfs -o union tmpfs /etc
+mount -t tmpfs tmpfs /tmp || lowmemfail
+mount -t tmpfs tmpfs /var || lowmemfail
+mount -t tmpfs -o union tmpfs /etc || lowmemfail
 
 # prepare important directories in the tmpfses, so dhcpcd and vi will work
 mkdir -p /var/run /var/db /var/tmp



CVS commit: src/sys/compat/linux/common

2014-05-23 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Fri May 23 12:28:51 UTC 2014

Modified Files:
src/sys/compat/linux/common: linux_socket.c

Log Message:
Add a funtion that translate socket type value from Linux to NetBSD.
Use it for socket and socketpair syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/compat/linux/common/linux_socket.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/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.118 src/sys/compat/linux/common/linux_socket.c:1.119
--- src/sys/compat/linux/common/linux_socket.c:1.118	Sat May 17 21:26:20 2014
+++ src/sys/compat/linux/common/linux_socket.c	Fri May 23 12:28:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.118 2014/05/17 21:26:20 rmind Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.119 2014/05/23 12:28:51 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_socket.c,v 1.118 2014/05/17 21:26:20 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_socket.c,v 1.119 2014/05/23 12:28:51 njoly Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_inet.h
@@ -70,7 +70,6 @@ __KERNEL_RCSID(0, $NetBSD: linux_socket
 #include sys/kauth.h
 #include sys/syscallargs.h
 #include sys/ktrace.h
-#include sys/fcntl.h
 
 #include lib/libkern/libkern.h
 
@@ -111,6 +110,7 @@ __KERNEL_RCSID(0, $NetBSD: linux_socket
 
 static int linux_to_bsd_domain(int);
 static int bsd_to_linux_domain(int);
+static int linux_to_bsd_type(int);
 int linux_to_bsd_sopt_level(int);
 int linux_to_bsd_so_sockopt(int);
 int linux_to_bsd_ip_sockopt(int);
@@ -238,6 +238,27 @@ bsd_to_linux_domain(int bdom)
 }
 
 static int
+linux_to_bsd_type(int ltype)
+{
+	int type, flags;
+
+	/* Real types are identical between Linux and NetBSD */
+	type = ltype  LINUX_SOCK_TYPE_MASK;
+
+	/* But flags are not .. */
+	flags = ltype  ~LINUX_SOCK_TYPE_MASK;
+	if (flags  ~(LINUX_SOCK_CLOEXEC|LINUX_SOCK_NONBLOCK))
+		return -1;
+
+	if (flags  LINUX_SOCK_CLOEXEC)
+		type |= SOCK_CLOEXEC;
+	if (flags  LINUX_SOCK_NONBLOCK)
+		type |= SOCK_NONBLOCK;
+
+	return type;
+}
+
+static int
 linux_to_bsd_msg_flags(int lflag)
 {
 	int i, lfl, bfl;
@@ -300,16 +321,16 @@ linux_sys_socket(struct lwp *l, const st
 		syscallarg(int) protocol;
 	} */
 	struct sys___socket30_args bsa;
-	struct sys_fcntl_args fsa;
-	register_t fretval[2];
-	int error, flags;
+	int error;
 
 
 	SCARG(bsa, protocol) = SCARG(uap, protocol);
-	SCARG(bsa, type) = SCARG(uap, type)  LINUX_SOCK_TYPE_MASK;
 	SCARG(bsa, domain) = linux_to_bsd_domain(SCARG(uap, domain));
 	if (SCARG(bsa, domain) == -1)
 		return EINVAL;
+	SCARG(bsa, type) = linux_to_bsd_type(SCARG(uap, type));
+	if (SCARG(bsa, type) == -1)
+		return EINVAL;
 	/*
 	 * Apparently linux uses this to talk to ISDN sockets. If we fail
 	 * now programs seems to handle it, but if we don't we are going
@@ -317,36 +338,8 @@ linux_sys_socket(struct lwp *l, const st
 	 */
 	if (SCARG(bsa, domain) == AF_ROUTE  SCARG(bsa, type) == SOCK_RAW)
 		return ENOTSUP;
-	flags = SCARG(uap, type)  ~LINUX_SOCK_TYPE_MASK;
-	if (flags  ~(LINUX_SOCK_CLOEXEC | LINUX_SOCK_NONBLOCK))
-		return EINVAL;
 	error = sys___socket30(l, bsa, retval);
 
-	/*
-	 * Linux overloads the type parameter to include some
-	 * fcntl flags to be set on the file descriptor.
-	 * Process those if creating the socket succeeded.
-	 */
-
-	if (!error  flags  LINUX_SOCK_CLOEXEC) {
-		SCARG(fsa, fd) = *retval;
-		SCARG(fsa, cmd) = F_SETFD;
-		SCARG(fsa, arg) = (void *)(uintptr_t)FD_CLOEXEC;
-		(void) sys_fcntl(l, fsa, fretval);
-	}
-	if (!error  flags  LINUX_SOCK_NONBLOCK) {
-		SCARG(fsa, fd) = *retval;
-		SCARG(fsa, cmd) = F_SETFL;
-		SCARG(fsa, arg) = (void *)(uintptr_t)O_NONBLOCK;
-		error = sys_fcntl(l, fsa, fretval);
-		if (error) {
-			struct sys_close_args csa;
-
-			SCARG(csa, fd) = *retval;
-			(void) sys_close(l, csa, fretval);
-		}
-	}
-
 #ifdef INET6
 	/*
 	 * Linux AF_INET6 socket has IPV6_V6ONLY setsockopt set to 0 by
@@ -385,7 +378,9 @@ linux_sys_socketpair(struct lwp *l, cons
 	SCARG(bsa, domain) = linux_to_bsd_domain(SCARG(uap, domain));
 	if (SCARG(bsa, domain) == -1)
 		return EINVAL;
-	SCARG(bsa, type) = SCARG(uap, type);
+	SCARG(bsa, type) = linux_to_bsd_type(SCARG(uap, type));
+	if (SCARG(bsa, type) == -1)
+		return EINVAL;
 	SCARG(bsa, protocol) = SCARG(uap, protocol);
 	SCARG(bsa, rsv) = SCARG(uap, rsv);
 



CVS commit: src/sys/compat/linux/arch/alpha

2014-05-23 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Fri May 23 12:30:12 UTC 2014

Modified Files:
src/sys/compat/linux/arch/alpha: linux_socket.h

Log Message:
Add missing specific LINUX_SOCK_NONBLOCK value for alpha.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/linux/arch/alpha/linux_socket.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/linux/arch/alpha/linux_socket.h
diff -u src/sys/compat/linux/arch/alpha/linux_socket.h:1.5 src/sys/compat/linux/arch/alpha/linux_socket.h:1.6
--- src/sys/compat/linux/arch/alpha/linux_socket.h:1.5	Sat Jan 25 13:49:27 2014
+++ src/sys/compat/linux/arch/alpha/linux_socket.h	Fri May 23 12:30:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.h,v 1.5 2014/01/25 13:49:27 njoly Exp $	*/
+/*	$NetBSD: linux_socket.h,v 1.6 2014/05/23 12:30:12 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -89,4 +89,10 @@
 #define LINUX_SO_PEEK_OFF	42
 #define LINUX_SO_NOFCS		43
 
+/*
+ * Flags for socket().
+ * These are provided in the type parameter.
+ */
+#define LINUX_SOCK_NONBLOCK	0x4000
+
 #endif /* !_ALPHA_LINUX_SOCKET_H */



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

2014-05-23 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Fri May 23 13:24:15 UTC 2014

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

Log Message:
Fix build failed with GUMSTIX(pxa2x0).  build test only now.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/arm32/arm32_kvminit.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/arm32/arm32_kvminit.c
diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.29 src/sys/arch/arm/arm32/arm32_kvminit.c:1.30
--- src/sys/arch/arm/arm32/arm32_kvminit.c:1.29	Sun Apr 13 02:24:16 2014
+++ src/sys/arch/arm/arm32/arm32_kvminit.c	Fri May 23 13:24:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_kvminit.c,v 1.29 2014/04/13 02:24:16 matt Exp $	*/
+/*	$NetBSD: arm32_kvminit.c,v 1.30 2014/05/23 13:24:15 kiyohara Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -122,7 +122,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.29 2014/04/13 02:24:16 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: arm32_kvminit.c,v 1.30 2014/05/23 13:24:15 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -608,7 +608,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 #if (ARM_NMMUS  1)
 	if (xscale_use_minidata)
 #endif  
-		valloc_pages(bmi, extrapv, nextrapages,
+		valloc_pages(bmi, minidataclean, 1,
 		VM_PROT_READ|VM_PROT_WRITE, 0, true);
 #endif
 
@@ -855,7 +855,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 #if (ARM_NMMUS  1)
 	if (xscale_use_minidata)
 #endif  
-		xscale_setup_minidata(l1_va, minidataclean.pv_va,
+		xscale_setup_minidata(l1pt_va, minidataclean.pv_va,
 		minidataclean.pv_pa);  
 #endif
 



CVS commit: src/external/gpl3/gcc/dist/gcc/config/vax

2014-05-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 23 13:35:26 UTC 2014

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/vax: vax-protos.h vax.c vax.h

Log Message:
Add LEGITIMATE_PIC_OPERAND_P(X) to prevent global symbol + offset from
being a legitimate pic operand (because it's not).


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc/dist/gcc/config/vax/vax.c
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gcc/dist/gcc/config/vax/vax.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h:1.1.1.2 src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h:1.2
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h:1.1.1.2	Sat Mar  1 08:43:34 2014
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax-protos.h	Fri May 23 13:35:26 2014
@@ -18,6 +18,7 @@ along with GCC; see the file COPYING3.  
 http://www.gnu.org/licenses/.  */
 
 extern bool legitimate_constant_address_p (rtx);
+extern bool legitimate_pic_operand_p (rtx);
 extern void vax_expand_prologue (void);
 
 #ifdef RTX_CODE

Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.c
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.5 src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.6
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.c:1.5	Thu Mar 20 16:53:55 2014
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.c	Fri May 23 13:35:26 2014
@@ -572,6 +572,11 @@ print_operand (FILE *file, rtx x, int co
 		   sizeof (dstr), 0, 1);
   fprintf (file, $0%c%s, ASM_DOUBLE_CHAR, dstr);
 }
+  else if (GET_CODE (x) == SUBREG)
+{
+  debug_rtx (x);
+  output_operand_lossage (SUBREG operand);
+}
   else
 {
   if (flag_pic  1  symbolic_operand (x, SImode))
@@ -1777,6 +1782,19 @@ legitimate_constant_address_p (rtx x)
return true;
 }
 
+bool
+legitimate_pic_operand_p (rtx x)
+{
+#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
+  if (GET_CODE (x) != CONST)
+return true;
+  if (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
+   !SYMBOL_REF_LOCAL_P (XEXP (XEXP (x, 0), 0)))
+return false;
+#endif
+  return true;
+}
+
 /* The other macros defined here are used only in legitimate_address_p ().  */
 
 /* Nonzero if X is a hard reg that can be used as an index

Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.h
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.h:1.2 src/external/gpl3/gcc/dist/gcc/config/vax/vax.h:1.3
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.h:1.2	Thu Mar 20 16:53:55 2014
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.h	Fri May 23 13:35:26 2014
@@ -373,6 +373,10 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_
 	RETURN_ADDRESS_OFFSET))		\
: (rtx) 0)
 
+/* A C expression that is nonzero if X is a legitimate immediate operand
+   on the target machine when generating position independent code.  */
+
+#define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X)
 
 /* Addressing modes, and classification of registers for them.  */
 



CVS commit: src/sys/arch/evbarm

2014-05-23 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Fri May 23 13:56:18 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: OVERO files.gumstix files.overo
src/sys/arch/evbarm/gumstix: gumstix_machdep.c gumstix_start.S

Log Message:
Call arm32_*_init() and initarm_common().
OVERO work fine.  GUMSTIX build only now.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/conf/OVERO
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/conf/files.gumstix
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/files.overo
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/gumstix/gumstix_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/conf/OVERO
diff -u src/sys/arch/evbarm/conf/OVERO:1.34 src/sys/arch/evbarm/conf/OVERO:1.35
--- src/sys/arch/evbarm/conf/OVERO:1.34	Sat Apr  5 23:45:11 2014
+++ src/sys/arch/evbarm/conf/OVERO	Fri May 23 13:56:18 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: OVERO,v 1.34 2014/04/05 23:45:11 khorben Exp $
+#	$NetBSD: OVERO,v 1.35 2014/05/23 13:56:18 kiyohara Exp $
 #
 #	OVERO -- Gumstix. Inc. Overo COMS platforms kernel
 #
@@ -16,7 +16,10 @@ maxusers	32
 
 options 	CPU_CORTEXA8
 options 	OMAP_3530
+options 	FPU_VFP
 options 	PMAPCOUNTERS
+options 	ARM_HAS_VBAR
+options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 makeoptions	CPUFLAGS=-mcpu=cortex-a8 -mfpu=neon
 
 # Architecture options

Index: src/sys/arch/evbarm/conf/files.gumstix
diff -u src/sys/arch/evbarm/conf/files.gumstix:1.17 src/sys/arch/evbarm/conf/files.gumstix:1.18
--- src/sys/arch/evbarm/conf/files.gumstix:1.17	Thu Sep 23 07:08:57 2010
+++ src/sys/arch/evbarm/conf/files.gumstix	Fri May 23 13:56:18 2014
@@ -1,8 +1,12 @@
-#	$NetBSD: files.gumstix,v 1.17 2010/09/23 07:08:57 kiyohara Exp $
+#	$NetBSD: files.gumstix,v 1.18 2014/05/23 13:56:18 kiyohara Exp $
 #
 # Gumstix. Inc. Gumstix boards configuration info
 #
 
+file	arch/arm/arm32/arm32_boot.c
+file	arch/arm/arm32/arm32_kvminit.c
+file	arch/arm/arm32/arm32_reboot.c
+
 file	arch/evbarm/gumstix/gumstix_machdep.c
 defflag opt_gumstix.hGUMSTIX
 		GUMSTIX_NETBSD_ARGS_BUSHEADER

Index: src/sys/arch/evbarm/conf/files.overo
diff -u src/sys/arch/evbarm/conf/files.overo:1.4 src/sys/arch/evbarm/conf/files.overo:1.5
--- src/sys/arch/evbarm/conf/files.overo:1.4	Sun Mar  6 02:22:27 2011
+++ src/sys/arch/evbarm/conf/files.overo	Fri May 23 13:56:18 2014
@@ -1,8 +1,12 @@
-#	$NetBSD: files.overo,v 1.4 2011/03/06 02:22:27 jakllsch Exp $
+#	$NetBSD: files.overo,v 1.5 2014/05/23 13:56:18 kiyohara Exp $
 #
 # Gumstix. Inc. Overo boards configuration info
 #
 
+file	arch/arm/arm32/arm32_boot.c
+file	arch/arm/arm32/arm32_kvminit.c
+file	arch/arm/arm32/arm32_reboot.c
+
 file	arch/evbarm/gumstix/gumstix_machdep.c
 defflag opt_gumstix.hOVERO
 		GUMSTIX_NETBSD_ARGS_EXPANSION

Index: src/sys/arch/evbarm/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.48 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.49
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.48	Thu Sep 26 16:14:34 2013
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Fri May 23 13:56:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.48 2013/09/26 16:14:34 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.49 2014/05/23 13:56:18 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -144,11 +144,8 @@
 #include opt_omap.h
 #include prcm.h
 #endif
-#include opt_ddb.h
 #include opt_kgdb.h
 #include opt_pmap_debug.h
-#include opt_md.h
-#include opt_modular.h
 #include opt_com.h
 
 #include sys/param.h
@@ -156,8 +153,6 @@
 #include sys/device.h
 #include sys/exec.h
 #include sys/kernel.h
-#include sys/ksyms.h
-#include sys/msgbuf.h
 #include sys/proc.h
 #include sys/reboot.h
 #include sys/systm.h
@@ -165,11 +160,11 @@
 #include sys/bus.h
 #include sys/cpu.h
 
+#include uvm/uvm_extern.h
+
 #include machine/autoconf.h
 #include machine/bootconfig.h
-#include machine/db_machdep.h
 #include arm/locore.h
-#include arm/undefined.h
 
 #include arm/arm32/machdep.h
 #ifdef OVERO
@@ -185,28 +180,20 @@
 #include evbarm/gumstix/gumstixreg.h
 #include evbarm/gumstix/gumstixvar.h
 
-#include uvm/uvm_extern.h
-
 #include dev/cons.h
-#include dev/md.h
 
-#include ddb/db_sym.h
-#include ddb/db_extern.h
 #ifdef KGDB
 #include sys/kgdb.h
 #endif
 
-/* Kernel text starts 2MB in from the bottom of the kernel address space. */
-#define	KERNEL_TEXT_BASE	(KERNEL_BASE + 0x0020)
-#ifndef KERNEL_VM_BASE
-#define	KERNEL_VM_BASE		(KERNEL_BASE + 0x0100)
-#endif
-
 /*
- * The range 0xc100 - 0xccff is available for kernel VM space
+ * The range 0xc100 - 0xcfff is available for kernel VM space
  * Core-logic registers and I/O mappings occupy 0xfd00 - 0x
  */
-#define KERNEL_VM_SIZE		0x0C00
+#ifndef 

CVS commit: src/sys/dev

2014-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 23 13:57:04 UTC 2014

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

Log Message:
Add aprint_naive(\n) for boot -q


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/gpio/gpio.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/hdaudio/hdafg.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/gpio/gpio.c
diff -u src/sys/dev/gpio/gpio.c:1.54 src/sys/dev/gpio/gpio.c:1.55
--- src/sys/dev/gpio/gpio.c:1.54	Fri Apr  4 14:47:26 2014
+++ src/sys/dev/gpio/gpio.c	Fri May 23 13:57:04 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.54 2014/04/04 14:47:26 christos Exp $ */
+/* $NetBSD: gpio.c,v 1.55 2014/05/23 13:57:04 msaitoh Exp $ */
 /*	$OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.54 2014/04/04 14:47:26 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.55 2014/05/23 13:57:04 msaitoh Exp $);
 
 /*
  * General Purpose Input/Output framework.
@@ -208,6 +208,7 @@ gpio_attach(device_t parent, device_t se
 	sc-sc_npins = gba-gba_npins;
 
 	aprint_normal(: %d pins\n, sc-sc_npins);
+	aprint_naive(\n);
 
 	if (!pmf_device_register(self, NULL, gpio_resume))
 		aprint_error_dev(self, couldn't establish power handler\n);

Index: src/sys/dev/pci/hdaudio/hdafg.c
diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.20 src/sys/dev/pci/hdaudio/hdafg.c:1.21
--- src/sys/dev/pci/hdaudio/hdafg.c:1.20	Fri May  9 20:10:49 2014
+++ src/sys/dev/pci/hdaudio/hdafg.c	Fri May 23 13:57:04 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.20 2014/05/09 20:10:49 jakllsch Exp $ */
+/* $NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.20 2014/05/09 20:10:49 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -3593,6 +3593,7 @@ hdafg_attach(device_t parent, device_t s
 	int err, i;
 	bool rv;
 
+	aprint_naive(\n);
 	sc-sc_dev = self;
 
 	mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE);



CVS commit: src/sys/dev/pci

2014-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 23 14:16:39 UTC 2014

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

Log Message:
 Print the type of serial port from the interface field in the PCI class
register.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/com_puc.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/com_puc.c
diff -u src/sys/dev/pci/com_puc.c:1.22 src/sys/dev/pci/com_puc.c:1.23
--- src/sys/dev/pci/com_puc.c:1.22	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/com_puc.c	Fri May 23 14:16:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_puc.c,v 1.22 2014/03/29 19:28:24 christos Exp $	*/
+/*	$NetBSD: com_puc.c,v 1.23 2014/05/23 14:16:39 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: com_puc.c,v 1.22 2014/03/29 19:28:24 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: com_puc.c,v 1.23 2014/05/23 14:16:39 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -60,6 +60,17 @@ struct com_puc_softc {
 	void	*sc_ih;			/* interrupt handler */
 };
 
+/* Interface field in PCI Class register */
+static const char *serialtype[] = {
+	Generic XT,
+	16450,
+	16550,
+	16650,
+	16750,
+	16850,
+	16950,
+};
+
 static int
 com_puc_probe(device_t parent, cfdata_t match, void *aux)
 {
@@ -82,10 +93,14 @@ com_puc_attach(device_t parent, device_t
 	struct puc_attach_args *aa = aux;
 	const char *intrstr;
 	char intrbuf[PCI_INTRSTR_LEN];
+	unsigned int iface;
 
 	sc-sc_dev = self;
 
+	iface = PCI_INTERFACE(pci_conf_read(aa-pc, aa-tag, PCI_CLASS_REG));
 	aprint_naive(: Serial port);
+	if (iface  __arraycount(serialtype))
+		aprint_normal( (%s-compatible), serialtype[iface]);
 	aprint_normal(: );
 
 	COM_INIT_REGS(sc-sc_regs, aa-t, aa-h, aa-a);



CVS commit: src/include

2014-05-23 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 23 16:48:52 UTC 2014

Modified Files:
src/include: stdio.h

Log Message:
Fix use of getline and friends in C++ code.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/include/stdio.h

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

Modified files:

Index: src/include/stdio.h
diff -u src/include/stdio.h:1.89 src/include/stdio.h:1.90
--- src/include/stdio.h:1.89	Mon May 19 16:04:10 2014
+++ src/include/stdio.h	Fri May 23 16:48:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdio.h,v 1.89 2014/05/19 16:04:10 kleink Exp $	*/
+/*	$NetBSD: stdio.h,v 1.90 2014/05/23 16:48:52 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -505,10 +505,12 @@ static __inline int __sputc(int _c, FILE
 #endif /* !_ANSI_SOURCE  !__cplusplus*/
 
 #if (_POSIX_C_SOURCE - 0) = 200809L || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
 int	 vdprintf(int, const char * __restrict, __va_list)
 		__printflike(2, 0);
 int	 dprintf(int, const char * __restrict, ...)
 		__printflike(2, 3);
+__END_DECLS
 #endif /* (_POSIX_C_SOURCE - 0) = 200809L || defined(_NETBSD_SOURCE) */
 
 #if (_POSIX_C_SOURCE - 0) = 199506L || (_XOPEN_SOURCE - 0) = 500 || \
@@ -522,10 +524,12 @@ int	 dprintf(int, const char * __restric
 
 #if (_POSIX_C_SOURCE - 0) = 200809L || (_XOPEN_SOURCE - 0) = 700 || \
 defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
 FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
 ssize_t	 getdelim(char ** __restrict, size_t * __restrict, int,
 	FILE * __restrict);
 ssize_t	 getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
+__END_DECLS
 #endif
 
 #if (_POSIX_C_SOURCE - 0) = 200809L || defined(_NETBSD_SOURCE)



CVS commit: src/lib/librumpuser

2014-05-23 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri May 23 16:57:42 UTC 2014

Modified Files:
src/lib/librumpuser: rumpuser_sp.c

Log Message:
do previous the right way to avoid rumpuser linkage dependency on librump


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/lib/librumpuser/rumpuser_sp.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/librumpuser/rumpuser_sp.c
diff -u src/lib/librumpuser/rumpuser_sp.c:1.64 src/lib/librumpuser/rumpuser_sp.c:1.65
--- src/lib/librumpuser/rumpuser_sp.c:1.64	Fri May 23 11:04:03 2014
+++ src/lib/librumpuser/rumpuser_sp.c	Fri May 23 16:57:42 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpuser_sp.c,v 1.64 2014/05/23 11:04:03 pooka Exp $	*/
+/*  $NetBSD: rumpuser_sp.c,v 1.65 2014/05/23 16:57:42 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -37,7 +37,7 @@
 #include rumpuser_port.h
 
 #if !defined(lint)
-__RCSID($NetBSD: rumpuser_sp.c,v 1.64 2014/05/23 11:04:03 pooka Exp $);
+__RCSID($NetBSD: rumpuser_sp.c,v 1.65 2014/05/23 16:57:42 pooka Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -1380,13 +1380,13 @@ rumpuser_sp_init(const char *url,
 	 * close fd's.  The assumption is that people who
 	 * write servers (i.e. kernels) know what they're doing.
 	 */
-	calllwp = rump_pub_lwproc_curlwp();
-	if ((error = rump_pub_lwproc_rfork(RUMP_RFFDG)) != 0) {
+	calllwp = lwproc_curlwp();
+	if ((error = lwproc_rfork(NULL, RUMP_RFFDG, spserver)) != 0) {
 		fprintf(stderr, rump_sp: rfork failed);
 		goto out;
 	}
-	sarg-sps_l = rump_pub_lwproc_curlwp();
-	rump_pub_lwproc_switch(calllwp);
+	sarg-sps_l = lwproc_curlwp();
+	lwproc_switch(calllwp);
 	if ((error = pthread_create(pt, NULL, spserver, sarg)) != 0) {
 		fprintf(stderr, rump_sp: cannot create wrkr thread\n);
 		goto out;



CVS commit: src/sys/dev/pci

2014-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 23 17:54:08 UTC 2014

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
PME# clock is not bit 2 but bit 3. Use the macro!


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.112 src/sys/dev/pci/pci_subr.c:1.113
--- src/sys/dev/pci/pci_subr.c:1.112	Thu May 15 06:58:19 2014
+++ src/sys/dev/pci/pci_subr.c	Fri May 23 17:54:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.112 2014/05/15 06:58:19 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.113 2014/05/23 17:54:08 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.112 2014/05/15 06:58:19 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.113 2014/05/23 17:54:08 msaitoh Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pci.h
@@ -1411,7 +1411,7 @@ pci_conf_print_pcipm_cap(const pcireg_t 
 	printf(Capabilities register: 0x%04x\n, caps);
 	printf(  Version: %s\n,
 	pci_conf_print_pcipm_cap_pmrev(caps  0x3));
-	onoff(PME# clock, caps, 0x4);
+	onoff(PME# clock, caps, PCI_PMCR_PME_CLOCK);
 	onoff(Device specific initialization, caps, 0x20);
 	printf(  3.3V auxiliary current: %s\n,
 	pci_conf_print_pcipm_cap_aux(caps));

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.87 src/sys/dev/pci/pcireg.h:1.88
--- src/sys/dev/pci/pcireg.h:1.87	Fri May 23 06:18:54 2014
+++ src/sys/dev/pci/pcireg.h	Fri May 23 17:54:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.87 2014/05/23 06:18:54 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.88 2014/05/23 17:54:08 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -479,6 +479,7 @@ typedef u_int8_t pci_revision_t;
 /* Power Management Capability Register */
 #define PCI_PMCR_SHIFT		16
 #define PCI_PMCR		0x02
+#define PCI_PMCR_PME_CLOCK	0x0008
 #define PCI_PMCR_D1SUPP		0x0200
 #define PCI_PMCR_D2SUPP		0x0400
 /* Power Management Control Status Register */



CVS commit: src/sys/dev/pci

2014-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 23 18:32:13 UTC 2014

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
- Add some register definitions (subclass, power management, etc.)
- Print some information (subclass, power management)
- Use macro.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.113 src/sys/dev/pci/pci_subr.c:1.114
--- src/sys/dev/pci/pci_subr.c:1.113	Fri May 23 17:54:08 2014
+++ src/sys/dev/pci/pci_subr.c	Fri May 23 18:32:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.113 2014/05/23 17:54:08 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.114 2014/05/23 18:32:13 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.113 2014/05/23 17:54:08 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.114 2014/05/23 18:32:13 msaitoh Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pci.h
@@ -208,6 +208,7 @@ static const struct pci_class pci_subcla
 	{ IPMI,		PCI_SUBCLASS_SERIALBUS_IPMI,	NULL,	},
 	{ SERCOS,		PCI_SUBCLASS_SERIALBUS_SERCOS,	NULL,	},
 	{ CANbus,		PCI_SUBCLASS_SERIALBUS_CANBUS,	NULL,	},
+	{ miscellaneous,	PCI_SUBCLASS_SERIALBUS_MISC,	NULL,	},
 	{ NULL,			0,NULL,	},
 };
 
@@ -225,6 +226,7 @@ static const struct pci_class pci_subcla
 
 static const struct pci_class pci_subclass_i2o[] = {
 	{ standard,		PCI_SUBCLASS_I2O_STANDARD,	NULL,	},
+	{ miscellaneous,	PCI_SUBCLASS_I2O_MISC,		NULL,	},
 	{ NULL,			0,NULL,	},
 };
 
@@ -233,6 +235,7 @@ static const struct pci_class pci_subcla
 	{ audio,		PCI_SUBCLASS_SATCOM_AUDIO, 	NULL,	},
 	{ voice,		PCI_SUBCLASS_SATCOM_VOICE, 	NULL,	},
 	{ data,		PCI_SUBCLASS_SATCOM_DATA,	NULL,	},
+	{ miscellaneous,	PCI_SUBCLASS_SATCOM_MISC,	NULL,	},
 	{ NULL,			0,NULL,	},
 };
 
@@ -1402,30 +1405,38 @@ static void
 pci_conf_print_pcipm_cap(const pcireg_t *regs, int capoff)
 {
 	uint16_t caps, pmcsr;
+	pcireg_t reg;
 
-	caps = regs[o2i(capoff)]  16;
-	pmcsr = regs[o2i(capoff + 0x04)]  0x;
+	caps = regs[o2i(capoff)]  PCI_PMCR_SHIFT;
+	reg = regs[o2i(capoff + PCI_PMCSR)];
+	pmcsr = reg  0x;
 
 	printf(\n  PCI Power Management Capabilities Register\n);
 
 	printf(Capabilities register: 0x%04x\n, caps);
 	printf(  Version: %s\n,
-	pci_conf_print_pcipm_cap_pmrev(caps  0x3));
+	pci_conf_print_pcipm_cap_pmrev(caps  PCI_PMCR_VERSION_MASK));
 	onoff(PME# clock, caps, PCI_PMCR_PME_CLOCK);
-	onoff(Device specific initialization, caps, 0x20);
+	onoff(Device specific initialization, caps, PCI_PMCR_DSI);
 	printf(  3.3V auxiliary current: %s\n,
 	pci_conf_print_pcipm_cap_aux(caps));
-	onoff(D1 power management state support, (caps  9), 1);
-	onoff(D2 power management state support, (caps  10), 1);
+	onoff(D1 power management state support, caps, PCI_PMCR_D1SUPP);
+	onoff(D2 power management state support, caps, PCI_PMCR_D2SUPP);
 	printf(  PME# support: 0x%02x\n, caps  11);
 
 	printf(Control/status register: 0x%04x\n, pmcsr);
-	printf(  Power state: D%d\n, pmcsr  3);
+	printf(  Power state: D%d\n, pmcsr  PCI_PMCSR_STATE_MASK);
 	onoff(PCI Express reserved, (pmcsr  2), 1);
 	onoff(No soft reset, (pmcsr  3), 1);
-	printf(  PME# assertion %sabled\n,
-	(pmcsr  8)  1 ? en : dis);
-	printf(  PME# status: %s\n, (pmcsr  15) ? on : off);
+	printf(  PME# assertion: %sabled\n,
+	(pmcsr  PCI_PMCSR_PME_EN) ? en : dis);
+	onoff(PME# status, pmcsr, PCI_PMCSR_PME_STS);
+	printf(Bridge Support Extensions register: 0x%02x\n,
+	(reg  16)  0xff);
+	onoff(B2/B3 support, reg, PCI_PMCSR_B2B3_SUPPORT);
+	onoff(Bus Power/Clock Control Enable, reg, PCI_PMCSR_BPCC_EN);
+	printf(Data register: 0x%02x\n, (reg  24)  0xff);
+	
 }
 
 static void
@@ -1632,13 +1643,13 @@ pci_conf_print_type1(
 
 	rval = regs[o2i(PCI_BRIDGE_BUS_REG)];
 	printf(Primary bus number: 0x%02x\n,
-	(rval  0)  0xff);
+	PCI_BRIDGE_BUS_PRIMARY(rval));
 	printf(Secondary bus number: 0x%02x\n,
-	(rval  8)  0xff);
+	PCI_BRIDGE_BUS_SECONDARY(rval));
 	printf(Subordinate bus number: 0x%02x\n,
-	(rval  16)  0xff);
+	PCI_BRIDGE_BUS_SUBORDINATE(rval));
 	printf(Secondary bus latency timer: 0x%02x\n,
-	(rval  24)  0xff);
+	PCI_BRIDGE_BUS_SEC_LATTIMER(rval));
 
 	rval = regs[o2i(PCI_BRIDGE_STATIO_REG)];
 	pci_conf_print_ssr(__SHIFTOUT(rval, __BITS(31, 16)));

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.88 src/sys/dev/pci/pcireg.h:1.89
--- src/sys/dev/pci/pcireg.h:1.88	Fri May 23 17:54:08 2014
+++ src/sys/dev/pci/pcireg.h	Fri May 23 18:32:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.88 2014/05/23 17:54:08 msaitoh Exp $	*/
+/*	

CVS commit: src/share/mk

2014-05-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 23 18:35:36 UTC 2014

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Under switch it instructions from matt@ make mips use gcc 4.8


To generate a diff of this commit:
cvs rdiff -u -r1.807 -r1.808 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.807 src/share/mk/bsd.own.mk:1.808
--- src/share/mk/bsd.own.mk:1.807	Tue May 20 09:59:20 2014
+++ src/share/mk/bsd.own.mk	Fri May 23 18:35:36 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.807 2014/05/20 09:59:20 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.808 2014/05/23 18:35:36 skrll Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -62,6 +62,7 @@ HAVE_GCC?=4
   ${MACHINE_CPU} == alpha || \
   ${MACHINE_CPU} == arm || \
   ${MACHINE_CPU} == hppa || \
+  ${MACHINE_CPU} == mips || \
   ${MACHINE_CPU} == sparc || \
   ${MACHINE_CPU} == sparc64 || \
   ${MACHINE_CPU} == x86_64 || \



CVS commit: src/share/mk

2014-05-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 23 18:51:31 UTC 2014

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Since the majority of architectures uses GCC 4.8, make it the default.
Only ia64, m68k, 32-bit powerpc, and sh3 still use GCC 4.5


To generate a diff of this commit:
cvs rdiff -u -r1.808 -r1.809 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.808 src/share/mk/bsd.own.mk:1.809
--- src/share/mk/bsd.own.mk:1.808	Fri May 23 18:35:36 2014
+++ src/share/mk/bsd.own.mk	Fri May 23 18:51:31 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.808 2014/05/23 18:35:36 skrll Exp $
+#	$NetBSD: bsd.own.mk,v 1.809 2014/05/23 18:51:31 matt Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -57,22 +57,17 @@ TOOLCHAIN_MISSING?=	no
 .if ${MACHINE_CPU}  == vax
 HAVE_GCC?=4
 
-# Platforms switched to GCC 4.8
+# Platforms still using GCC 4.5
 .elif \
-  ${MACHINE_CPU} == alpha || \
-  ${MACHINE_CPU} == arm || \
-  ${MACHINE_CPU} == hppa || \
-  ${MACHINE_CPU} == mips || \
-  ${MACHINE_CPU} == sparc || \
-  ${MACHINE_CPU} == sparc64 || \
-  ${MACHINE_CPU} == x86_64 || \
-  ${MACHINE_CPU} == i386 || \
-  ${MACHINE_ARCH} == powerpc64
-HAVE_GCC?=48
+  ${MACHINE_CPU} == ia64 || \
+  ${MACHINE_CPU} == m68k || \
+  ${MACHINE_CPU} == sh3 || \
+  ${MACHINE_ARCH} == powerpc
+HAVE_GCC?=45
 
 .else
-# Otherwise, default to GCC4.5
-HAVE_GCC?=45
+# Otherwise, default to GCC4.8
+HAVE_GCC?=48
 .endif
 
 #



CVS commit: src/sys/arch/vax/vax

2014-05-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 23 19:05:35 UTC 2014

Modified Files:
src/sys/arch/vax/vax: locore.c

Log Message:
#ifdef a variable like its only use


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/vax/vax/locore.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/vax/vax/locore.c
diff -u src/sys/arch/vax/vax/locore.c:1.81 src/sys/arch/vax/vax/locore.c:1.82
--- src/sys/arch/vax/vax/locore.c:1.81	Mon Mar 24 20:06:33 2014
+++ src/sys/arch/vax/vax/locore.c	Fri May 23 19:05:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.c,v 1.81 2014/03/24 20:06:33 christos Exp $	*/
+/*	$NetBSD: locore.c,v 1.82 2014/05/23 19:05:35 martin Exp $	*/
 /*
  * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -32,7 +32,7 @@
  /* All bugs are subject to removal without further notice */
 		
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: locore.c,v 1.81 2014/03/24 20:06:33 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: locore.c,v 1.82 2014/05/23 19:05:35 martin Exp $);
 
 #include opt_compat_netbsd.h
 
@@ -94,7 +94,10 @@ _start(struct rpb *prpb)
 	extern uintptr_t scratch;
 	struct pte *pt;
 	vaddr_t uv;
-	const char *mv, *md;
+	const char *mv;
+#if VAX410 || VAXANY
+	const char *md;
+#endif
 
 	mtpr(AST_NO, PR_ASTLVL); /* Turn off ASTs */
 



CVS commit: src/sys/net

2014-05-23 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri May 23 19:11:22 UTC 2014

Modified Files:
src/sys/net: bpfjit.c

Log Message:
Implement unconditional jump to return 0 for loads at UINT32_MAX+1 or greater.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/net/bpfjit.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/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.8 src/sys/net/bpfjit.c:1.9
--- src/sys/net/bpfjit.c:1.8	Thu May 22 13:35:45 2014
+++ src/sys/net/bpfjit.c	Fri May 23 19:11:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.8 2014/05/22 13:35:45 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.9 2014/05/23 19:11:22 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include sys/cdefs.h
 #ifdef _KERNEL
-__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.8 2014/05/22 13:35:45 alnsn Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.9 2014/05/23 19:11:22 alnsn Exp $);
 #else
-__RCSID($NetBSD: bpfjit.c,v 1.8 2014/05/22 13:35:45 alnsn Exp $);
+__RCSID($NetBSD: bpfjit.c,v 1.9 2014/05/23 19:11:22 alnsn Exp $);
 #endif
 
 #include sys/types.h
@@ -94,8 +94,11 @@ typedef unsigned int bpfjit_init_mask_t;
 #define BJ_INIT_ABITBJ_INIT_MBIT(BPF_MEMWORDS)
 #define BJ_INIT_XBITBJ_INIT_MBIT(BPF_MEMWORDS + 1)
 
-typedef uint32_t bpfjit_abc_length_t;
-#define MAX_ABC_LENGTH UINT32_MAX
+/*
+ * Datatype for Array Bounds Check Elimination (ABC) pass.
+ */
+typedef uint64_t bpfjit_abc_length_t;
+#define MAX_ABC_LENGTH (UINT32_MAX + UINT64_C(4)) /* max. width is 4 */
 
 struct bpfjit_stack
 {
@@ -152,8 +155,7 @@ struct bpfjit_read_pkt_data {
 	/*
 	 * If positive, emit if (buflen  check_length) return 0
 	 * out-of-bounds check.
-	 * We assume that buflen is never equal to UINT32_MAX (otherwise,
-	 * we'd need a special bool variable to emit unconditional return 0).
+	 * Values greater than UINT32_MAX generate unconditional return 0.
 	 */
 	bpfjit_abc_length_t check_length;
 };
@@ -903,8 +905,11 @@ read_pkt_insn(const struct bpf_insn *pc,
 	}
 
 	if (rv  length != NULL) {
-		*length = (pc-k  UINT32_MAX - width) ?
-		UINT32_MAX : pc-k + width;
+		/*
+		 * Values greater than UINT32_MAX will generate
+		 * unconditional return 0.
+		 */
+		*length = (uint32_t)pc-k + width;
 	}
 
 	return rv;
@@ -1324,6 +1329,7 @@ bpfjit_generate_code(bpf_ctx_t *bc, stru
 	struct bpfjit_jump *bjump, *jtf;
 
 	struct sljit_jump *to_mchain_jump;
+	bool unconditional_ret;
 
 	uint32_t jt, jf;
 
@@ -1405,8 +1411,6 @@ bpfjit_generate_code(bpf_ctx_t *bc, stru
 		if (insn_dat[i].unreachable)
 			continue;
 
-		to_mchain_jump = NULL;
-
 		/*
 		 * Resolve jumps to the current insn.
 		 */
@@ -1421,23 +1425,36 @@ bpfjit_generate_code(bpf_ctx_t *bc, stru
 			}
 		}
 
-		if (read_pkt_insn(insns[i], NULL) 
-		insn_dat[i].u.rdata.check_length  0) {
-			/* if (buflen  check_length) return 0; */
-			jump = sljit_emit_cmp(compiler,
-			SLJIT_C_LESS,
-			BJ_BUFLEN, 0,
-			SLJIT_IMM,
-			insn_dat[i].u.rdata.check_length);
-			if (jump == NULL)
-goto fail;
+		to_mchain_jump = NULL;
+		unconditional_ret = false;
+
+		if (read_pkt_insn(insns[i], NULL)) {
+			if (insn_dat[i].u.rdata.check_length  UINT32_MAX) {
+/* Jump to return 0 unconditionally. */
+unconditional_ret = true;
+jump = sljit_emit_jump(compiler, SLJIT_JUMP);
+if (jump == NULL)
+	goto fail;
+if (!append_jump(jump, ret0,
+ret0_size, ret0_maxsize))
+	goto fail;
+			} else if (insn_dat[i].u.rdata.check_length  0) {
+/* if (buflen  check_length) return 0; */
+jump = sljit_emit_cmp(compiler,
+SLJIT_C_LESS,
+BJ_BUFLEN, 0,
+SLJIT_IMM,
+insn_dat[i].u.rdata.check_length);
+if (jump == NULL)
+	goto fail;
 #ifdef _KERNEL
-			to_mchain_jump = jump;
+to_mchain_jump = jump;
 #else
-			if (!append_jump(jump, ret0,
-			ret0_size, ret0_maxsize))
-goto fail;
+if (!append_jump(jump, ret0,
+ret0_size, ret0_maxsize))
+	goto fail;
 #endif
+			}
 		}
 
 		pc = insns[i];
@@ -1491,6 +1508,9 @@ bpfjit_generate_code(bpf_ctx_t *bc, stru
 			if (mode != BPF_ABS  mode != BPF_IND)
 goto fail;
 
+			if (unconditional_ret)
+continue;
+
 			status = emit_pkt_read(compiler, pc,
 			to_mchain_jump, ret0, ret0_size, ret0_maxsize);
 			if (status != SLJIT_SUCCESS)
@@ -1551,6 +1571,9 @@ bpfjit_generate_code(bpf_ctx_t *bc, stru
 			if (mode != BPF_MSH || BPF_SIZE(pc-code) != BPF_B)
 goto fail;
 
+			if (unconditional_ret)
+continue;
+
 			status = emit_msh(compiler, pc,
 			to_mchain_jump, ret0, ret0_size, ret0_maxsize);
 			if (status != SLJIT_SUCCESS)



CVS commit: src/sys/netinet

2014-05-23 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri May 23 19:27:48 UTC 2014

Modified Files:
src/sys/netinet: in_var.h ip_input.c

Log Message:
Make ip_input() static, there is no need to expose it.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/netinet/in_var.h
cvs rdiff -u -r1.311 -r1.312 src/sys/netinet/ip_input.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/netinet/in_var.h
diff -u src/sys/netinet/in_var.h:1.66 src/sys/netinet/in_var.h:1.67
--- src/sys/netinet/in_var.h:1.66	Thu May 22 22:01:12 2014
+++ src/sys/netinet/in_var.h	Fri May 23 19:27:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_var.h,v 1.66 2014/05/22 22:01:12 rmind Exp $	*/
+/*	$NetBSD: in_var.h,v 1.67 2014/05/23 19:27:48 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -296,10 +296,8 @@ int	in_control(struct socket *, u_long, 
 	struct lwp *);
 void	in_purgeaddr(struct ifaddr *);
 void	in_purgeif(struct ifnet *);
-void	ip_input(struct mbuf *);
 int	ipflow_fastforward(struct mbuf *);
 
-
 struct ipid_state;
 typedef struct ipid_state ipid_state_t;
 

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.311 src/sys/netinet/ip_input.c:1.312
--- src/sys/netinet/ip_input.c:1.311	Thu May 22 22:01:12 2014
+++ src/sys/netinet/ip_input.c	Fri May 23 19:27:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.311 2014/05/22 22:01:12 rmind Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.312 2014/05/23 19:27:48 rmind Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.311 2014/05/22 22:01:12 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.312 2014/05/23 19:27:48 rmind Exp $);
 
 #include opt_inet.h
 #include opt_compat_netbsd.h
@@ -271,6 +271,7 @@ struct mowner ip_rx_mowner = MOWNER_INIT
 struct mowner ip_tx_mowner = MOWNER_INIT(internet, tx);
 #endif
 
+static void		ip_input(struct mbuf *);
 static bool		ip_dooptions(struct mbuf *);
 static struct in_ifaddr *ip_rtaddr(struct in_addr);
 static void		sysctl_net_inet_ip_setup(struct sysctllog **);
@@ -373,7 +374,7 @@ ipintr(void)
  * Ip input routine.  Checksum and byte swap header.  If fragmented
  * try to reassemble.  Process options.  Pass to next level.
  */
-void
+static void
 ip_input(struct mbuf *m)
 {
 	struct ip *ip = NULL;



CVS commit: src/sys/dev/pci

2014-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 23 19:31:23 UTC 2014

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

Log Message:
No functional change:
- KNF
- Sort in PCI capability ID order.
- Add comments.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/pci/pci_subr.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.114 src/sys/dev/pci/pci_subr.c:1.115
--- src/sys/dev/pci/pci_subr.c:1.114	Fri May 23 18:32:13 2014
+++ src/sys/dev/pci/pci_subr.c	Fri May 23 19:31:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.114 2014/05/23 18:32:13 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.115 2014/05/23 19:31:23 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.114 2014/05/23 18:32:13 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.115 2014/05/23 19:31:23 msaitoh Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pci.h
@@ -148,14 +148,14 @@ static const struct pci_class pci_subcla
 };
 
 static const struct pci_class pci_subclass_communications[] = {
-	{ serial,		PCI_SUBCLASS_COMMUNICATIONS_SERIAL,	NULL, },
-	{ parallel,		PCI_SUBCLASS_COMMUNICATIONS_PARALLEL,	NULL, },
-	{ multi-port serial,	PCI_SUBCLASS_COMMUNICATIONS_MPSERIAL,	NULL, },
-	{ modem,		PCI_SUBCLASS_COMMUNICATIONS_MODEM,	NULL, },
-	{ GPIB,		PCI_SUBCLASS_COMMUNICATIONS_GPIB,	NULL, },
-	{ smartcard,		PCI_SUBCLASS_COMMUNICATIONS_SMARTCARD,	NULL, },
-	{ miscellaneous,	PCI_SUBCLASS_COMMUNICATIONS_MISC,	NULL, },
-	{ NULL,			0,	NULL, },
+	{ serial,		PCI_SUBCLASS_COMMUNICATIONS_SERIAL,	NULL,},
+	{ parallel,		PCI_SUBCLASS_COMMUNICATIONS_PARALLEL,	NULL,},
+	{ multi-port serial,	PCI_SUBCLASS_COMMUNICATIONS_MPSERIAL,	NULL,},
+	{ modem,		PCI_SUBCLASS_COMMUNICATIONS_MODEM,	NULL,},
+	{ GPIB,		PCI_SUBCLASS_COMMUNICATIONS_GPIB,	NULL,},
+	{ smartcard,		PCI_SUBCLASS_COMMUNICATIONS_SMARTCARD,	NULL,},
+	{ miscellaneous,	PCI_SUBCLASS_COMMUNICATIONS_MISC,	NULL,},
+	{ NULL,			0,	NULL,},
 };
 
 static const struct pci_class pci_subclass_system[] = {
@@ -326,14 +326,18 @@ int pciverbose_loaded = 0;
 /*
  * Routine to load the pciverbose kernel module as needed
  */
-void pci_load_verbose(void)
+void
+pci_load_verbose(void)
 {
+
 	if (pciverbose_loaded == 0)
 		module_autoload(pciverbose, MODULE_CLASS_MISC);
 }
 
-const char *pci_findvendor_stub(pcireg_t id_reg)
+const char *
+pci_findvendor_stub(pcireg_t id_reg)
 {
+
 	pci_load_verbose();
 	if (pciverbose_loaded)
 		return pci_findvendor(id_reg);
@@ -341,8 +345,10 @@ const char *pci_findvendor_stub(pcireg_t
 		return NULL;
 }
 
-const char *pci_findproduct_stub(pcireg_t id_reg)
+const char *
+pci_findproduct_stub(pcireg_t id_reg)
 {
+
 	pci_load_verbose();
 	if (pciverbose_loaded)
 		return pci_findproduct(id_reg);
@@ -505,15 +511,19 @@ pci_conf_print_common(
 	onoff(Parity error checking, rval, PCI_COMMAND_PARITY_ENABLE);
 	onoff(Address/data stepping, rval, PCI_COMMAND_STEPPING_ENABLE);
 	onoff(System error (SERR), rval, PCI_COMMAND_SERR_ENABLE);
-	onoff(Fast back-to-back transactions, rval, PCI_COMMAND_BACKTOBACK_ENABLE);
+	onoff(Fast back-to-back transactions, rval,
+	PCI_COMMAND_BACKTOBACK_ENABLE);
 	onoff(Interrupt disable, rval, PCI_COMMAND_INTERRUPT_DISABLE);
 
 	printf(Status register: 0x%04x\n, (rval  16)  0x);
-	onoff2(Interrupt status, rval, PCI_STATUS_INT_STATUS, active, inactive);
+	onoff2(Interrupt status, rval, PCI_STATUS_INT_STATUS, active,
+	inactive);
 	onoff(Capability List support, rval, PCI_STATUS_CAPLIST_SUPPORT);
 	onoff(66 MHz capable, rval, PCI_STATUS_66MHZ_SUPPORT);
-	onoff(User Definable Features (UDF) support, rval, PCI_STATUS_UDF_SUPPORT);
-	onoff(Fast back-to-back capable, rval, PCI_STATUS_BACKTOBACK_SUPPORT);
+	onoff(User Definable Features (UDF) support, rval,
+	PCI_STATUS_UDF_SUPPORT);
+	onoff(Fast back-to-back capable, rval,
+	PCI_STATUS_BACKTOBACK_SUPPORT);
 	onoff(Data parity error detected, rval, PCI_STATUS_PARITY_ERROR);
 
 	printf(  DEVSEL timing: );
@@ -533,8 +543,10 @@ pci_conf_print_common(
 	}
 	printf( (0x%x)\n, (rval  PCI_STATUS_DEVSEL_MASK)  25);
 
-	onoff(Slave signaled Target Abort, rval, PCI_STATUS_TARGET_TARGET_ABORT);
-	onoff(Master received Target Abort, rval, PCI_STATUS_MASTER_TARGET_ABORT);
+	onoff(Slave signaled Target Abort, rval,
+	PCI_STATUS_TARGET_TARGET_ABORT);
+	onoff(Master received Target Abort, rval,
+	PCI_STATUS_MASTER_TARGET_ABORT);
 	onoff(Master received Master Abort, rval, PCI_STATUS_MASTER_ABORT);
 	onoff(Asserted System Error (SERR), rval, PCI_STATUS_SPECIAL_ERROR);
 	onoff(Parity error detected, rval, PCI_STATUS_PARITY_DETECT);
@@ -557,7 +569,8 @@ pci_conf_print_common(
 			printf(Subclass Name: %s (0x%02x)\n,
 			subclassp-name, PCI_SUBCLASS(rval));
 		else
-			printf(

CVS commit: src/sys/netinet

2014-05-23 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri May 23 19:35:24 UTC 2014

Modified Files:
src/sys/netinet: ip_input.c ip_var.h

Log Message:
Make ip_forward() static, there is no need to expose it.


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.102 -r1.103 src/sys/netinet/ip_var.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/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.312 src/sys/netinet/ip_input.c:1.313
--- src/sys/netinet/ip_input.c:1.312	Fri May 23 19:27:48 2014
+++ src/sys/netinet/ip_input.c	Fri May 23 19:35:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.312 2014/05/23 19:27:48 rmind Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.313 2014/05/23 19:35:24 rmind Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.312 2014/05/23 19:27:48 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.313 2014/05/23 19:35:24 rmind Exp $);
 
 #include opt_inet.h
 #include opt_compat_netbsd.h
@@ -272,6 +272,7 @@ struct mowner ip_tx_mowner = MOWNER_INIT
 #endif
 
 static void		ip_input(struct mbuf *);
+static void		ip_forward(struct mbuf *, int);
 static bool		ip_dooptions(struct mbuf *);
 static struct in_ifaddr *ip_rtaddr(struct in_addr);
 static void		sysctl_net_inet_ip_setup(struct sysctllog **);
@@ -1167,7 +1168,7 @@ ip_drainstub(void)
  * The srcrt parameter indicates whether the packet is being forwarded
  * via a source route.
  */
-void
+static void
 ip_forward(struct mbuf *m, int srcrt)
 {
 	struct ip *ip = mtod(m, struct ip *);

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.102 src/sys/netinet/ip_var.h:1.103
--- src/sys/netinet/ip_var.h:1.102	Thu May 22 23:42:53 2014
+++ src/sys/netinet/ip_var.h	Fri May 23 19:35:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.102 2014/05/22 23:42:53 rmind Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.103 2014/05/23 19:35:24 rmind Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -201,7 +201,6 @@ void	in_init(void);
 int	 ip_ctloutput(int, struct socket *, struct sockopt *);
 void	 ip_drain(void);
 void	 ip_drainstub(void);
-void	 ip_forward(struct mbuf *, int);
 void	 ip_freemoptions(struct ip_moptions *);
 int	 ip_optcopy(struct ip *, struct ip *);
 u_int	 ip_optlen(struct inpcb *);



CVS commit: src/sys/net

2014-05-23 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri May 23 19:51:16 UTC 2014

Modified Files:
src/sys/net: bpfjit.c

Log Message:
Loads at offsets UINT32_MAX or greater are unreachable.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/net/bpfjit.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/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.9 src/sys/net/bpfjit.c:1.10
--- src/sys/net/bpfjit.c:1.9	Fri May 23 19:11:22 2014
+++ src/sys/net/bpfjit.c	Fri May 23 19:51:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.9 2014/05/23 19:11:22 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.10 2014/05/23 19:51:16 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include sys/cdefs.h
 #ifdef _KERNEL
-__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.9 2014/05/23 19:11:22 alnsn Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.10 2014/05/23 19:51:16 alnsn Exp $);
 #else
-__RCSID($NetBSD: bpfjit.c,v 1.9 2014/05/23 19:11:22 alnsn Exp $);
+__RCSID($NetBSD: bpfjit.c,v 1.10 2014/05/23 19:51:16 alnsn Exp $);
 #endif
 
 #include sys/types.h
@@ -945,6 +945,7 @@ optimize_pass1(const struct bpf_insn *in
 	struct bpfjit_jump *jtf;
 	size_t i;
 	uint32_t jt, jf;
+	bpfjit_abc_length_t length;
 	bpfjit_init_mask_t invalid; /* borrowed from bpf_filter() */
 	bool unreachable;
 
@@ -964,6 +965,9 @@ optimize_pass1(const struct bpf_insn *in
 
 		invalid |= insn_dat[i].invalid;
 
+		if (read_pkt_insn(insns[i], length)  length  UINT32_MAX)
+			unreachable = true;
+
 		switch (BPF_CLASS(insns[i].code)) {
 		case BPF_RET:
 			if (BPF_RVAL(insns[i].code) == BPF_A)



CVS commit: src/external/bsd/nvi/usr.bin/nvi

2014-05-23 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri May 23 19:59:17 UTC 2014

Modified Files:
src/external/bsd/nvi/usr.bin/nvi: Makefile

Log Message:
PR toolchain/48833: Ilia Zykov: nvi build fails if under /common

When autogenerating headers from source (yuck) use a more selective
pattern to avoid selecting anything if part of the current absolute
path happens to match part of the nvi source tree.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nvi/usr.bin/nvi/Makefile

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

Modified files:

Index: src/external/bsd/nvi/usr.bin/nvi/Makefile
diff -u src/external/bsd/nvi/usr.bin/nvi/Makefile:1.4 src/external/bsd/nvi/usr.bin/nvi/Makefile:1.5
--- src/external/bsd/nvi/usr.bin/nvi/Makefile:1.4	Sat Nov 30 14:52:40 2013
+++ src/external/bsd/nvi/usr.bin/nvi/Makefile	Fri May 23 19:59:17 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2013/11/30 14:52:40 christos Exp $
+#	$NetBSD: Makefile,v 1.5 2014/05/23 19:59:17 dholland Exp $
 
 .include bsd.own.mk
 
@@ -79,10 +79,11 @@ ipc_def.h: ipc.awk vipc.awk ipc_cmd.c ip
 .for i in cl common ex ip ipc vi
 DPSRCS+=${i}_extern.h
 CLEANFILES+=${i}_extern.h
-_${i}_SRCS != echo ${DIST}/${i}/*.c ${DIST}/${i}/*.xs
+# does not work, DIST isn't set yet here
+#_${i}_SRCS != echo ${DIST}/${i}/*.c ${DIST}/${i}/*.xs
 ${i}_extern.h: ${SRCS}
 	${_MKTARGET_CREATE}
-	@${TOOL_SED} -n s/^ \* PUBLIC: \(.*\)/\1/p ${.ALLSRC:M*/$i/*}  ${.TARGET}.tmp
+	@${TOOL_SED} -n s/^ \* PUBLIC: \(.*\)/\1/p ${.ALLSRC:M${DIST}/$i/*}  ${.TARGET}.tmp
 	@if cmp -s ${.TARGET}.tmp ${.TARGET}; then \
 		rm -f ${.TARGET}.tmp; \
 	else \



CVS commit: src/usr.sbin/vnconfig

2014-05-23 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri May 23 20:50:16 UTC 2014

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
PR bin/48829 Thomas Schmitt: vnconfig pretends to succeed on
nonexistent files


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/vnconfig/vnconfig.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.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.41 src/usr.sbin/vnconfig/vnconfig.c:1.42
--- src/usr.sbin/vnconfig/vnconfig.c:1.41	Sun Jun  9 13:25:40 2013
+++ src/usr.sbin/vnconfig/vnconfig.c	Fri May 23 20:50:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.41 2013/06/09 13:25:40 christos Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.42 2014/05/23 20:50:16 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -318,9 +318,10 @@ config(char *dev, char *file, char *geom
 		int	ffd;
 
 		ffd = open(file, readonly ? O_RDONLY : O_RDWR);
-		if (ffd  0)
+		if (ffd  0) {
 			warn(%s, file);
-		else {
+			rv = -1;
+		} else {
 			(void) close(ffd);
 
 			rv = ioctl(fd, VNDIOCSET, vndio);



CVS commit: src/sys/net

2014-05-23 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri May 23 22:04:09 UTC 2014

Modified Files:
src/sys/net: bpfjit.c

Log Message:
Enable ABC optimization when one branch returns 0.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/net/bpfjit.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/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.10 src/sys/net/bpfjit.c:1.11
--- src/sys/net/bpfjit.c:1.10	Fri May 23 19:51:16 2014
+++ src/sys/net/bpfjit.c	Fri May 23 22:04:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.10 2014/05/23 19:51:16 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.11 2014/05/23 22:04:09 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include sys/cdefs.h
 #ifdef _KERNEL
-__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.10 2014/05/23 19:51:16 alnsn Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.11 2014/05/23 22:04:09 alnsn Exp $);
 #else
-__RCSID($NetBSD: bpfjit.c,v 1.10 2014/05/23 19:51:16 alnsn Exp $);
+__RCSID($NetBSD: bpfjit.c,v 1.11 2014/05/23 22:04:09 alnsn Exp $);
 #endif
 
 #include sys/types.h
@@ -1146,7 +1146,27 @@ optimize_pass2(const struct bpf_insn *in
 
 		switch (BPF_CLASS(pc-code)) {
 		case BPF_RET:
-			abc_length = 0;
+			/*
+			 * It's quite common for bpf programs to
+			 * check packet bytes in increasing order
+			 * and return zero if bytes don't match
+			 * specified critetion. Such programs disable
+			 * ABC optimization completely because for
+			 * every jump there is a branch with no read
+			 * instruction.
+			 * With no side effects, BPF_RET+BPF_K 0 is
+			 * indistinguishable from out-of-bound load.
+			 * Therefore, abc_length can be set to
+			 * MAX_ABC_LENGTH and enable ABC for many
+			 * bpf programs.
+			 * If this optimization pass encounters any
+			 * instruction with a side effect, it will
+			 * reset abc_length.
+			 */
+			if (BPF_RVAL(pc-code) == BPF_K  pc-k == 0)
+abc_length = MAX_ABC_LENGTH;
+			else
+abc_length = 0;
 			break;
 
 		case BPF_JMP:



CVS commit: src/sys/dev/pci

2014-05-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 23 22:58:56 UTC 2014

Modified Files:
src/sys/dev/pci: agp_i810.c agp_i810var.h agpreg.h

Log Message:
Implement Intel AGP chipset flush.

While here, fix the use of the I915 PCI MSAC register: it lies on the
bridge device (bus 0 dev 0 func 0), not the graphics device (bus 0
dev 2 func 0).  I'm not sure we ever need to consult this register,
really -- the PCI BARs should be sized.  But I'll leave a rototill of
this mess for another day.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/agp_i810var.h
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/agpreg.h

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

Modified files:

Index: src/sys/dev/pci/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.74 src/sys/dev/pci/agp_i810.c:1.75
--- src/sys/dev/pci/agp_i810.c:1.74	Tue Mar 18 18:20:41 2014
+++ src/sys/dev/pci/agp_i810.c	Fri May 23 22:58:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.74 2014/03/18 18:20:41 riastradh Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.75 2014/05/23 22:58:56 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.74 2014/03/18 18:20:41 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.75 2014/05/23 22:58:56 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, $NetBSD: agp_i810.c,v
 #include sys/proc.h
 #include sys/device.h
 #include sys/conf.h
+#include sys/xcall.h
 
 #include dev/pci/pcivar.h
 #include dev/pci/pcireg.h
@@ -86,6 +87,7 @@ static int agp_i810_unbind_memory(struct
 static bool agp_i810_resume(device_t, const pmf_qual_t *);
 static int agp_i810_init(struct agp_softc *);
 
+static int agp_i810_setup_chipset_flush_page(struct agp_softc *);
 static int agp_i810_init(struct agp_softc *);
 
 static struct agp_methods agp_i810_methods = {
@@ -184,6 +186,40 @@ agp_i810_post_gtt_entry(struct agp_i810_
 	(void)READ4(base_off + wroff);
 }
 
+static void
+agp_flush_cache_xc(void *a __unused, void *b __unused)
+{
+
+	agp_flush_cache();
+}
+
+void
+agp_i810_chipset_flush(struct agp_i810_softc *isc)
+{
+	unsigned int timo = 2; /* * 50 us = 1 s */
+
+	switch (isc-chiptype) {
+	case CHIP_I810:
+		break;
+	case CHIP_I830:
+	case CHIP_I855:
+		xc_wait(xc_broadcast(0, agp_flush_cache_xc, NULL, NULL));
+		WRITE4(AGP_I830_HIC, READ4(AGP_I830_HIC) | __BIT(31));
+		while (ISSET(READ4(AGP_I830_HIC), __BIT(31))) {
+			if (timo-- == 0)
+break;
+			DELAY(50);
+		}
+		break;
+	case CHIP_I915:
+	case CHIP_I965:
+	case CHIP_G33:
+	case CHIP_G4X:
+		bus_space_write_4(isc-flush_bst, isc-flush_bsh, 0, 1);
+		break;
+	}
+}
+
 /* XXXthorpej -- duplicated code (see arch/x86/pci/pchb.c) */
 static int
 agp_i810_vgamatch(const struct pci_attach_args *pa)
@@ -441,9 +477,88 @@ agp_i810_attach(device_t parent, device_
 	agp_i810_vga_regbase = mmadr;
 	agp_i810_vga_bsh = isc-bsh;
 
+	/* Set up a chipset flush page if necessary.  */
+	switch (isc-chiptype) {
+	case CHIP_I915:
+	case CHIP_I965:
+	case CHIP_G33:
+	case CHIP_G4X:
+		error = agp_i810_setup_chipset_flush_page(sc);
+		if (error) {
+			aprint_error_dev(self,
+			failed to set up chipset flush page: %d\n,
+			error);
+			agp_generic_detach(sc);
+			return error;
+		}
+		break;
+	}
+
 	return agp_i810_init(sc);
 }
 
+static int
+agp_i810_setup_chipset_flush_page(struct agp_softc *sc)
+{
+	struct agp_i810_softc *const isc = sc-as_chipc;
+	pcireg_t reg, lo, hi;
+	bus_addr_t addr, minaddr, maxaddr;
+	int error;
+
+	/* We always use memory-mapped I/O.  */
+	isc-flush_bst = isc-vga_pa.pa_memt;
+
+	/* No page allocated yet.  */
+	isc-flush_addr = 0;
+
+	/* Read the PCI config register: 4-byte on gen3, 8-byte on gen=4.  */
+	if (isc-chiptype == CHIP_I915) {
+		reg = pci_conf_read(sc-as_pc, sc-as_tag, AGP_I915_IFPADDR);
+		addr = reg;
+		minaddr = PAGE_SIZE;	/* XXX PCIBIOS_MIN_MEM?  */
+		maxaddr = UINT32_MAX;
+	} else {
+		hi = pci_conf_read(sc-as_pc, sc-as_tag, AGP_I965_IFPADDR+4);
+		lo = pci_conf_read(sc-as_pc, sc-as_tag, AGP_I965_IFPADDR);
+		addr = ((bus_addr_t)hi  32) | lo;
+		minaddr = PAGE_SIZE;	/* XXX PCIBIOS_MIN_MEM?  */
+		maxaddr = UINT64_MAX;
+	}
+
+	/* Allocate or map a pre-allocated a page for it.  */
+	if (ISSET(addr, 1)) {
+		/* BIOS allocated it for us.  Use that.  */
+		error = bus_space_map(isc-flush_bst, addr  ~1, PAGE_SIZE, 0,
+		isc-flush_bsh);
+		if (error)
+			return error;
+	} else {
+		/* None allocated.  Allocate one.  */
+		error = bus_space_alloc(isc-flush_bst, minaddr, maxaddr,
+		PAGE_SIZE, PAGE_SIZE, 0, 0,
+		isc-flush_addr, isc-flush_bsh);
+		if (error)
+			return error;
+		KASSERT(isc-flush_addr != 0);
+		/* Write it into the PCI config register.  */
+		addr = isc-flush_addr | 1;
+		if (isc-chiptype == CHIP_I915) {
+			

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

2014-05-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 23 22:59:23 UTC 2014

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

Log Message:
Implement intel_gtt_chipset_flush correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/i915drm/intel_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/intel_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.2 src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.3
--- src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.2	Tue Mar 18 18:20:42 2014
+++ src/sys/external/bsd/drm2/i915drm/intel_gtt.c	Fri May 23 22:59:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_gtt.c,v 1.2 2014/03/18 18:20:42 riastradh Exp $	*/
+/*	$NetBSD: intel_gtt.c,v 1.3 2014/05/23 22:59:23 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Intel GTT stubs */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intel_gtt.c,v 1.2 2014/03/18 18:20:42 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: intel_gtt.c,v 1.3 2014/05/23 22:59:23 riastradh Exp $);
 
 #include sys/types.h			/* XXX pcivar.h needs...@!#^  */
 
@@ -59,9 +59,6 @@ void
 intel_gtt_chipset_flush(void)
 {
 
-	/*
-	 * XXX If the Linux code is any indication, this is not
-	 * sufficient...but it'll probably do for now.
-	 */
-	agp_flush_cache();
+	KASSERT(agp_i810_sc != NULL);
+	agp_i810_chipset_flush(agp_i810_sc-as_chipc);
 }



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

2014-05-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 23 23:02:47 UTC 2014

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

Log Message:
Fix GTT PTE flag bits.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.12
--- src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.11	Tue May 20 15:50:11 2014
+++ src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c	Fri May 23 23:02:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.11 2014/05/20 15:50:11 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.12 2014/05/23 23:02:47 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.11 2014/05/20 15:50:11 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.12 2014/05/23 23:02:47 riastradh Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -89,6 +89,8 @@ i915_gem_gtt_init(struct drm_device *dev
 	 * physical addresses.
 	 *
 	 * XXX pci_set_dma_mask?  pci_set_consistent_dma_mask?
+	 *
+	 * XXX DMA limits
 	 */
 	if (INTEL_INFO(dev)-gen  4)
 		drm_limit_dma_space(dev, 0,
@@ -504,11 +506,11 @@ agp_ggtt_clear_range(struct drm_device *
 
 typedef uint32_t gtt_pte_t;
 
-#define	GEN6_PTE_VALID		__BIT(0)
-#define	GEN6_PTE_UNCACHED	__BIT(1)
-#define	HSW_PTE_UNCACHED	(0)
-#define	GEN6_PTE_CACHE_LLC	__BIT(2)
-#define	GEN6_PTE_CACHE_LLC_MLC	__BIT(3)
+#define	GEN6_PTE_VALID		0x01
+#define	GEN6_PTE_UNCACHED	0x02
+#define	HSW_PTE_UNCACHED	0x00
+#define	GEN6_PTE_CACHE_LLC	0x04
+#define	GEN6_PTE_CACHE_LLC_MLC	0x06
 
 static uint32_t
 gen6_pte_addr_encode(bus_addr_t addr)



CVS commit: src/sys/netinet

2014-05-23 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri May 23 23:38:48 UTC 2014

Modified Files:
src/sys/netinet: ip_input.c

Log Message:
ip_input(), ip_savecontrol(): cache m-m_pkthdr.rcvif in a variable.


To generate a diff of this commit:
cvs rdiff -u -r1.313 -r1.314 src/sys/netinet/ip_input.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/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.313 src/sys/netinet/ip_input.c:1.314
--- src/sys/netinet/ip_input.c:1.313	Fri May 23 19:35:24 2014
+++ src/sys/netinet/ip_input.c	Fri May 23 23:38:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.313 2014/05/23 19:35:24 rmind Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.314 2014/05/23 23:38:48 rmind Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.313 2014/05/23 19:35:24 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.314 2014/05/23 23:38:48 rmind Exp $);
 
 #include opt_inet.h
 #include opt_compat_netbsd.h
@@ -385,9 +385,11 @@ ip_input(struct mbuf *m)
 	int downmatch;
 	int checkif;
 	int srcrt = 0;
+	ifnet_t *ifp;
 
 	MCLAIM(m, ip_rx_mowner);
 	KASSERT((m-m_flags  M_PKTHDR) != 0);
+	ifp = m-m_pkthdr.rcvif;
 
 	/*
 	 * If no IP addresses have been set yet but the interfaces
@@ -445,14 +447,14 @@ ip_input(struct mbuf *m)
 	/* 127/8 must not appear on wire - RFC1122 */
 	if ((ntohl(ip-ip_dst.s_addr)  IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||
 	(ntohl(ip-ip_src.s_addr)  IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) {
-		if ((m-m_pkthdr.rcvif-if_flags  IFF_LOOPBACK) == 0) {
+		if ((ifp-if_flags  IFF_LOOPBACK) == 0) {
 			IP_STATINC(IP_STAT_BADADDR);
 			goto bad;
 		}
 	}
 
 	switch (m-m_pkthdr.csum_flags 
-		((m-m_pkthdr.rcvif-if_csum_flags_rx  M_CSUM_IPv4) |
+		((ifp-if_csum_flags_rx  M_CSUM_IPv4) |
 		 M_CSUM_IPv4_BAD)) {
 	case M_CSUM_IPv4|M_CSUM_IPv4_BAD:
 		INET_CSUM_COUNTER_INCR(ip_hwcsum_bad);
@@ -468,8 +470,8 @@ ip_input(struct mbuf *m)
 		 * Must compute it ourselves.  Maybe skip checksum on
 		 * loopback interfaces.
 		 */
-		if (__predict_true(!(m-m_pkthdr.rcvif-if_flags 
- IFF_LOOPBACK) || ip_do_loopback_cksum)) {
+		if (__predict_true(!(ifp-if_flags  IFF_LOOPBACK) ||
+		ip_do_loopback_cksum)) {
 			INET_CSUM_COUNTER_INCR(ip_swcsum);
 			if (in_cksum(m, hlen) != 0)
 goto badcsum;
@@ -519,21 +521,15 @@ ip_input(struct mbuf *m)
 	 * Note that filters must _never_ set this flag, as another filter
 	 * in the list may have previously cleared it.
 	 */
-	/*
-	 * let ipfilter look at packet on the wire,
-	 * not the decapsulated packet.
-	 */
 #if defined(IPSEC)
 	if (!ipsec_indone(m))
 #else
 	if (1)
 #endif
 	{
-		struct in_addr odst;
+		struct in_addr odst = ip-ip_dst;
 
-		odst = ip-ip_dst;
-		if (pfil_run_hooks(inet_pfil_hook, m, m-m_pkthdr.rcvif,
-		PFIL_IN) != 0)
+		if (pfil_run_hooks(inet_pfil_hook, m, ifp, PFIL_IN) != 0)
 			return;
 		if (m == NULL)
 			return;
@@ -591,8 +587,7 @@ ip_input(struct mbuf *m)
 	 * we get finer grain control.
 	 */
 	checkif = ip_checkinterface  (ipforwarding == 0) 
-	(m-m_pkthdr.rcvif != NULL) 
-	((m-m_pkthdr.rcvif-if_flags  IFF_LOOPBACK) == 0);
+	ifp  (ifp-if_flags  IFF_LOOPBACK) == 0;
 
 	/*
 	 * Check our list of addresses, to see if the packet is for us.
@@ -604,7 +599,7 @@ ip_input(struct mbuf *m)
 	downmatch = 0;
 	LIST_FOREACH(ia, IN_IFADDR_HASH(ip-ip_dst.s_addr), ia_hash) {
 		if (in_hosteq(ia-ia_addr.sin_addr, ip-ip_dst)) {
-			if (checkif  ia-ia_ifp != m-m_pkthdr.rcvif)
+			if (checkif  ia-ia_ifp != ifp)
 continue;
 			if ((ia-ia_ifp-if_flags  IFF_UP) != 0)
 break;
@@ -614,8 +609,8 @@ ip_input(struct mbuf *m)
 	}
 	if (ia != NULL)
 		goto ours;
-	if (m-m_pkthdr.rcvif  m-m_pkthdr.rcvif-if_flags  IFF_BROADCAST) {
-		IFADDR_FOREACH(ifa, m-m_pkthdr.rcvif) {
+	if (ifp  ifp-if_flags  IFF_BROADCAST) {
+		IFADDR_FOREACH(ifa, ifp) {
 			if (ifa-ifa_addr-sa_family != AF_INET)
 continue;
 			ia = ifatoia(ifa);
@@ -654,7 +649,7 @@ ip_input(struct mbuf *m)
 			 * as expected when ip_mforward() is called from
 			 * ip_output().)
 			 */
-			if (ip_mforward(m, m-m_pkthdr.rcvif) != 0) {
+			if (ip_mforward(m, ifp) != 0) {
 IP_STATINC(IP_STAT_CANTFORWARD);
 m_freem(m);
 return;
@@ -674,7 +669,7 @@ ip_input(struct mbuf *m)
 		 * See if we belong to the destination multicast group on the
 		 * arrival interface.
 		 */
-		IN_LOOKUP_MULTI(ip-ip_dst, m-m_pkthdr.rcvif, inm);
+		IN_LOOKUP_MULTI(ip-ip_dst, ifp, inm);
 		if (inm == NULL) {
 			IP_STATINC(IP_STAT_CANTFORWARD);
 			m_freem(m);
@@ -1320,6 +1315,7 @@ ip_savecontrol(struct inpcb *inp, struct
 struct mbuf *m)
 {
 	struct socket *so = inp-inp_socket;
+	ifnet_t *ifp = m-m_pkthdr.rcvif;
 	int inpflags = inp-inp_flags;
 
 	if (so-so_options  SO_TIMESTAMP
@@ -1352,7 +1348,7 @@ ip_savecontrol(struct inpcb *inp, struct
 	if (inpflags