CVS commit: src/sys/dev/pci

2015-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 16 00:25:52 UTC 2015

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

Log Message:
 Fix a bug that the first access to NVM is failed on 8254[17] which use
SPI EEPROM. Observed on Dell PowerEdge [12]850. Thanks Tom Ivar Helbekkmo
for debugging.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.312 src/sys/dev/pci/if_wm.c:1.313
--- src/sys/dev/pci/if_wm.c:1.312	Sun Feb 15 21:32:33 2015
+++ src/sys/dev/pci/if_wm.c	Mon Feb 16 00:25:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.312 2015/02/15 21:32:33 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.313 2015/02/16 00:25:52 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.312 2015/02/15 21:32:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.313 2015/02/16 00:25:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1757,6 +1757,7 @@ wm_attach(device_t parent, device_t self
 	case WM_T_82541_2:
 	case WM_T_82547:
 	case WM_T_82547_2:
+		sc->sc_flags |= WM_F_LOCK_EECD;
 		reg = CSR_READ(sc, WMREG_EECD);
 		if (reg & EECD_EE_TYPE) {
 			/* SPI */
@@ -1772,7 +1773,6 @@ wm_attach(device_t parent, device_t self
 sc->sc_nvm_addrbits = 6;
 			}
 		}
-		sc->sc_flags |= WM_F_LOCK_EECD;
 		break;
 	case WM_T_82571:
 	case WM_T_82572:



CVS commit: src/sys/dev/pci

2015-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Feb 15 21:32:33 UTC 2015

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

Log Message:
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
  Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/if_wmreg.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.311 src/sys/dev/pci/if_wm.c:1.312
--- src/sys/dev/pci/if_wm.c:1.311	Fri Feb 13 09:00:50 2015
+++ src/sys/dev/pci/if_wm.c	Sun Feb 15 21:32:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.311 2015/02/13 09:00:50 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.312 2015/02/15 21:32:33 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.311 2015/02/13 09:00:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.312 2015/02/15 21:32:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -565,6 +565,7 @@ static void	wm_set_pcie_completion_timeo
 static void	wm_get_auto_rd_done(struct wm_softc *);
 static void	wm_lan_init_done(struct wm_softc *);
 static void	wm_get_cfg_done(struct wm_softc *);
+static void	wm_initialize_hardware_bits(struct wm_softc *);
 static void	wm_reset(struct wm_softc *);
 static int	wm_add_rxbuf(struct wm_softc *, int);
 static void	wm_rxdrain(struct wm_softc *);
@@ -3230,6 +3231,200 @@ wm_get_cfg_done(struct wm_softc *sc)
 	}
 }
 
+/* Init hardware bits */
+void
+wm_initialize_hardware_bits(struct wm_softc *sc)
+{
+	uint32_t tarc0, tarc1, reg;
+	
+	/* For 82571 variant, 80003 and ICHs */
+	if (((sc->sc_type >= WM_T_82571) && (sc->sc_type <= WM_T_82583))
+	|| (sc->sc_type >= WM_T_80003)) {
+
+		/* Transmit Descriptor Control 0 */
+		reg = CSR_READ(sc, WMREG_TXDCTL(0));
+		reg |= TXDCTL_COUNT_DESC;
+		CSR_WRITE(sc, WMREG_TXDCTL(0), reg);
+
+		/* Transmit Descriptor Control 1 */
+		reg = CSR_READ(sc, WMREG_TXDCTL(1));
+		reg |= TXDCTL_COUNT_DESC;
+		CSR_WRITE(sc, WMREG_TXDCTL(1), reg);
+
+		/* TARC0 */
+		tarc0 = CSR_READ(sc, WMREG_TARC0);
+		switch (sc->sc_type) {
+		case WM_T_82571:
+		case WM_T_82572:
+		case WM_T_82573:
+		case WM_T_82574:
+		case WM_T_82583:
+		case WM_T_80003:
+			/* Clear bits 30..27 */
+			tarc0 &= ~__BITS(30, 27);
+			break;
+		default:
+			break;
+		}
+
+		switch (sc->sc_type) {
+		case WM_T_82571:
+		case WM_T_82572:
+			tarc0 |= __BITS(26, 23); /* TARC0 bits 23-26 */
+
+			tarc1 = CSR_READ(sc, WMREG_TARC1);
+			tarc1 &= ~__BITS(30, 29); /* Clear bits 30 and 29 */
+			tarc1 |= __BITS(26, 24); /* TARC1 bits 26-24 */
+			/* 8257[12] Errata No.7 */
+			tarc1 |= __BIT(22); /* TARC1 bits 22 */
+
+			/* TARC1 bit 28 */
+			if ((CSR_READ(sc, WMREG_TCTL) & TCTL_MULR) != 0)
+tarc1 &= ~__BIT(28);
+			else
+tarc1 |= __BIT(28);
+			CSR_WRITE(sc, WMREG_TARC1, tarc1);
+
+			/*
+			 * 8257[12] Errata No.13
+			 * Disable Dyamic Clock Gating.
+			 */
+			reg = CSR_READ(sc, WMREG_CTRL_EXT);
+			reg &= ~CTRL_EXT_DMA_DYN_CLK;
+			CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
+			break;
+		case WM_T_82573:
+		case WM_T_82574:
+		case WM_T_82583:
+			if ((sc->sc_type == WM_T_82574)
+			|| (sc->sc_type == WM_T_82583))
+tarc0 |= __BIT(26); /* TARC0 bit 26 */
+
+			/* Extended Device Control */
+			reg = CSR_READ(sc, WMREG_CTRL_EXT);
+			reg &= ~__BIT(23);	/* Clear bit 23 */
+			reg |= __BIT(22);	/* Set bit 22 */
+			CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
+
+			/* Device Control */
+			sc->sc_ctrl &= ~__BIT(29);	/* Clear bit 29 */
+			CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
+
+			/* PCIe Control Register */
+			if ((sc->sc_type == WM_T_82574)
+			|| (sc->sc_type == WM_T_82583)) {
+/*
+ * Document says this bit must be set for
+ * proper operation.
+ */
+reg = CSR_READ(sc, WMREG_GCR);
+reg |= __BIT(22);
+CSR_WRITE(sc, WMREG_GCR, reg);
+
+/*
+ * Apply workaround for hardware errata
+ * documented in errata docs Fixes issue where
+ * some error prone or unreliable PCIe
+ * completions are occurring, particularly
+ * with ASPM enabled. Without fix, issue can
+ * cause Tx timeouts.
+ */
+reg = CSR_READ(sc, WMREG_GCR2);
+reg |= __BIT(0);
+CSR_WRITE(sc, WMREG_GCR2, reg);
+			}
+			break;
+		case WM_T_80003:
+			/* TARC0 */
+			if ((sc->sc_mediatype == WM_MEDIATYPE_FIBER)
+			|| (sc->sc_mediatype == WM_MEDIATYPE_SERDES))
+tarc0 &= ~__BIT(20); /* Clear bits 20 */
+
+			/* TARC1 bit 28 */
+			tarc1 = CSR_READ(sc, WMREG_TARC1);
+			if ((CSR_READ(sc, WMREG_TCTL) & TCTL_MULR) != 0)
+tarc1 &= ~__BIT(28);
+			else
+tarc1 |= __BIT(28);
+			CSR_WRITE(sc, WMREG_TARC1, tarc1);
+			break;
+		case WM_T_I

CVS commit: src/sbin/devpubd

2015-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 15 21:46:49 UTC 2015

Modified Files:
src/sbin/devpubd: Makefile devpubd.c

Log Message:
let's make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/devpubd.c

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

Modified files:

Index: src/sbin/devpubd/Makefile
diff -u src/sbin/devpubd/Makefile:1.4 src/sbin/devpubd/Makefile:1.5
--- src/sbin/devpubd/Makefile:1.4	Sun Aug 11 02:04:38 2013
+++ src/sbin/devpubd/Makefile	Sun Feb 15 16:46:49 2015
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.4 2013/08/11 06:04:38 dholland Exp $
+# $NetBSD: Makefile,v 1.5 2015/02/15 21:46:49 christos Exp $
 
 PROG=		devpubd
 SRCS=		devpubd.c
 MAN=		devpubd.8
+WARNS=		6
 
 BINDIR?=	/sbin
 

Index: src/sbin/devpubd/devpubd.c
diff -u src/sbin/devpubd/devpubd.c:1.3 src/sbin/devpubd/devpubd.c:1.4
--- src/sbin/devpubd/devpubd.c:1.3	Sun Feb 15 10:56:30 2015
+++ src/sbin/devpubd/devpubd.c	Sun Feb 15 16:46:49 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $	*/
+/*	$NetBSD: devpubd.c,v 1.4 2015/02/15 21:46:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -36,7 +36,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2011-2015\
 Jared D. McNeill . All rights reserved.");
-__RCSID("$NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $");
+__RCSID("$NetBSD: devpubd.c,v 1.4 2015/02/15 21:46:49 christos Exp $");
 
 #include 
 #include 
@@ -87,7 +87,8 @@ devpubd_eventhandler(const char *event, 
 {
 	char **argv;
 	pid_t pid;
-	int status, i, ndevs;
+	int status;
+	size_t i, ndevs;
 
 	for (ndevs = 0, i = 0; device[i] != NULL; i++) {
 		++ndevs;
@@ -95,7 +96,7 @@ devpubd_eventhandler(const char *event, 
 		device[i]);
 	}
 
-	argv = calloc(3 + ndevs, sizeof(char *));
+	argv = calloc(3 + ndevs, sizeof(*argv));
 	argv[0] = __UNCONST(devpubd_script);
 	argv[1] = __UNCONST(event);
 	for (i = 0; i < ndevs; i++) {
@@ -148,7 +149,7 @@ devpubd_eventloop(void)
 		prop_dictionary_get_cstring_nocopy(ev, "device", &device[0]);
 
 		printf("%s: event='%s', device='%s'\n", __func__,
-		event, device);
+		event, device[0]);
 
 		devpubd_eventhandler(event, device);
 
@@ -227,7 +228,7 @@ devpubd_init(void)
 {
 	struct devpubd_probe_event *ev;
 	const char **devs;
-	int ndevs, i;
+	size_t ndevs, i;
 
 	TAILQ_INIT(&devpubd_probe_events);
 	devpubd_probe(NULL);
@@ -242,7 +243,7 @@ devpubd_init(void)
 	}
 	devpubd_eventhandler(DEVPUBD_ATTACH_EVENT, devs);
 	free(devs);
-	while (ev = TAILQ_FIRST(&devpubd_probe_events)) {
+	while ((ev = TAILQ_FIRST(&devpubd_probe_events)) != NULL) {
 		TAILQ_REMOVE(&devpubd_probe_events, ev, entries);
 		free(ev->device);
 		free(ev);



CVS commit: src/sys/dev/pci

2015-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Feb 15 21:27:57 UTC 2015

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

Log Message:
Add some devices:
- Radeon HD 54xx Audio
- Dell DARC 4 devices
- Some Intel IOP332 devices
- Intel 63xxESB AC'97 Audio Controller
- Some Intel E7520 devices


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1214 src/sys/dev/pci/pcidevs:1.1215
--- src/sys/dev/pci/pcidevs:1.1214	Sun Jan 25 10:48:31 2015
+++ src/sys/dev/pci/pcidevs	Sun Feb 15 21:27:57 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1214 2015/01/25 10:48:31 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1215 2015/02/15 21:27:57 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1523,6 +1523,7 @@ product ATI RADEON_HD7340	0x9808	Radeon 
 product ATI RADEON_HD2600_HD	0xaa08	Radeon HD2600 HD Audio Controller
 product ATI RADEON_HD4350_HD	0xaa38	Radeon HD4350 HD Audio Controller
 product ATI RADEON_HD5600_HDMI	0xaa60	Redwood HDMI Audio
+product ATI RADEON_HD54XX_HDA	0xaa68	Radeon HD 54xx Audio
 
 /* Auravision products */
 product AURAVISION VXP524	0x01f7	VxP524 PCI Video Processor
@@ -2050,7 +2051,10 @@ product DELL PERC_3DI_2		0x0008	PERC 3/D
 product DELL PERC_3DI_3		0x000a	PERC 3/Di
 product DELL PERC_4DI		0x000e	PERC 4/Di
 product DELL PERC_4DI_2		0x000f	PERC 4/Di
+product DELL DRAC_4		0x0011	DRAC 4
+product DELL DRAC_4_VUART	0x0012	DRAC 4 Virtual UART
 product DELL PERC_4ESI		0x0013	PERC 4e/Si
+product DELL DRAC_4_SMIC	0x0014	DRAC 4 SMIC
 product DELL PERC_5		0x0015	PERC 5
 product DELL PERC_6 		0x0060	PERC 6
 product DELL PERC_3DI_2_SUB	0x00cf	PERC 3/Di
@@ -2579,6 +2583,8 @@ product INTEL 6700PXH_IOXAPIC	0x0326	670
 product INTEL 6700PXH_PCIE0	0x0329	6700PXH PCI Express-to-PCI Bridge #0
 product INTEL 6700PXH_PCIE1	0x032a	6700PXH PCI Express-to-PCI Bridge #1
 product INTEL 6702PXH_PCIX	0x032c	6702PXH PCI Express-to-PCIX
+product INTEL IOP332_A		0x0330	IOP332 PCI Express-to-PCI Bridge #0
+product INTEL IOP332_B		0x0332	IOP332 PCI Express-to-PCI Bridge #1
 product INTEL 80331		0x0335	Lindsay I/O Processor PCI-X Bridge
 product INTEL 41210A		0x0340	Serial to Parallel PCI Bridge A
 product INTEL 41210B		0x0341	Serial to Parallel PCI Bridge B
@@ -3345,6 +3351,7 @@ product INTEL 63XXESB_EXP_1	0x2690	63xxE
 product INTEL 63XXESB_EXP_2	0x2692	63xxESB PCI Express Port #2
 product INTEL 63XXESB_EXP_3	0x2694	63xxESB PCI Express Port #3
 product INTEL 63XXESB_EXP_4	0x2696	63xxESB PCI Express Port #4
+product INTEL 63XXESB_ACA	0x2698	63xxESB AC'97 Audio Controller
 product INTEL 63XXESB_HDA	0x269a	63xxESB High Definition Audio Controller
 product INTEL 63XXESB_SMB	0x269b	63xxESB SMBus Controller
 product INTEL 63XXESB_IDE	0x269e	63xxESB IDE Controller
@@ -3568,9 +3575,14 @@ product INTEL 82855GM_MC	0x3584	82855GM 
 product INTEL 82855GM_CP	0x3585	82855GM GMCH Configuration Process
 product INTEL E7525_MCH		0x3590	E7525 Memory Controller Hub
 product INTEL E7525_MCHER	0x3591	E7525 Error Reporting Device
+product INTEL E7520_DMA		0x3594	E7520 DMA Controller
 product INTEL E7525_PCIE_A	0x3595	E7525 PCI Express Port A
 product INTEL E7525_PCIE_A1	0x3596	E7525 PCI Express Port A1
 product INTEL E7525_PCIE_B	0x3597	E7525 PCI Express Port B
+product INTEL E7520_PCIE_B1	0x3598	E7520 PCI Express Port B1
+product INTEL E7520_PCIE_C	0x3599	E7520 PCI Express Port C
+product INTEL E7520_PCIE_C1	0x359a	E7520 PCI Express Port C1
+product INTEL E7520_CFG		0x359b	E7520 Extended Configuration
 product INTEL 82801JD_SATA_IDE	0x3a00	82801JD SATA Controller (IDE mode)
 product INTEL 82801JD_SATA_AHCI	0x3a02	82801JD SATA Controller (AHCI mode)
 product INTEL 82801JD_SATA_RAID	0x3a02	82801JD SATA Controller (RAID mode)



CVS commit: src

2015-02-15 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Sun Feb 15 20:21:29 UTC 2015

Modified Files:
src/lib/libperfuse: ops.c perfuse.c
src/lib/libpuffs: puffs.3
src/sys/fs/puffs: puffs_msgif.h puffs_sys.h puffs_vfsops.c
puffs_vnops.c

Log Message:
Add PUFFS_KFLAG_NOFLUSH_META to prevent sending metadata flush to FUSE

FUSE filesystems do not expect to get metadata updates for [amc]time
and size, they updates the value on their own after operations.

The PUFFS PUFFS_KFLAG_NOFLUSH_META option prevents regular metadata cache
flushes to the filesystem , and libperfuse uses it to match Linux FUSE
behavior.

While there, fix a bug in SETATTR: do not update kernel metadata cache
from SETATTR reply when the request is asynchronous, as we do not have
the reply yet.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.35 -r1.36 src/lib/libperfuse/perfuse.c
cvs rdiff -u -r1.59 -r1.60 src/lib/libpuffs/puffs.3
cvs rdiff -u -r1.83 -r1.84 src/sys/fs/puffs/puffs_msgif.h
cvs rdiff -u -r1.88 -r1.89 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.115 -r1.116 src/sys/fs/puffs/puffs_vfsops.c
cvs rdiff -u -r1.199 -r1.200 src/sys/fs/puffs/puffs_vnops.c

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

Modified files:

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.82 src/lib/libperfuse/ops.c:1.83
--- src/lib/libperfuse/ops.c:1.82	Tue Jan 13 16:51:30 2015
+++ src/lib/libperfuse/ops.c	Sun Feb 15 20:21:29 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.82 2015/01/13 16:51:30 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.83 2015/02/15 20:21:29 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -1828,6 +1828,7 @@ perfuse_node_setattr_ttl(struct puffs_us
 		fsi->valid |= FUSE_FATTR_LOCKOWNER;
 	}
 
+#ifndef PUFFS_KFLAG_NOFLUSH_META
 	/*
 	 * ftruncate() sends only va_size, and metadata cache
 	 * flush adds va_atime and va_mtime. Some FUSE
@@ -1856,6 +1857,7 @@ perfuse_node_setattr_ttl(struct puffs_us
 	 */
 	if (fsi->valid == FUSE_FATTR_ATIME)
 		fsi->valid &= ~FUSE_FATTR_ATIME;
+#endif /* PUFFS_KFLAG_NOFLUSH_META */
 		
 	/*
 	 * If nothing remain, discard the operation.

Index: src/lib/libperfuse/perfuse.c
diff -u src/lib/libperfuse/perfuse.c:1.35 src/lib/libperfuse/perfuse.c:1.36
--- src/lib/libperfuse/perfuse.c:1.35	Fri Oct 31 15:12:15 2014
+++ src/lib/libperfuse/perfuse.c	Sun Feb 15 20:21:29 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.35 2014/10/31 15:12:15 manu Exp $ */
+/*  $NetBSD: perfuse.c,v 1.36 2015/02/15 20:21:29 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -539,6 +539,15 @@ perfuse_init(struct perfuse_callbacks *p
 	puffs_flags |= PUFFS_FLAG_IAONDEMAND;
 #endif
 
+	/*
+	 * FUSE filesystem do not expect [amc]time and size
+	 * updates to be sent by the kernel, they do the
+	 * updates on their own after other operations.
+	 */
+#ifdef PUFFS_KFLAG_NOFLUSH_META
+	puffs_flags |= PUFFS_KFLAG_NOFLUSH_META;
+#endif
+
 	if (perfuse_diagflags & PDF_PUFFS)
 		puffs_flags |= PUFFS_FLAG_OPDUMP;
 

Index: src/lib/libpuffs/puffs.3
diff -u src/lib/libpuffs/puffs.3:1.59 src/lib/libpuffs/puffs.3:1.60
--- src/lib/libpuffs/puffs.3:1.59	Tue Mar 18 18:20:38 2014
+++ src/lib/libpuffs/puffs.3	Sun Feb 15 20:21:29 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs.3,v 1.59 2014/03/18 18:20:38 riastradh Exp $
+.\"	$NetBSD: puffs.3,v 1.60 2015/02/15 20:21:29 manu Exp $
 .\"
 .\" Copyright (c) 2006, 2007, 2008 Antti Kantee.  All rights reserved.
 .\"
@@ -263,6 +263,9 @@ Never send lookups for
 .Dq ..
 to the filesystem.
 Parent vnodes are all kept active until their children are reclaimed.
+.It Dv PUFFS_KFLAG_NOFLUSH_META
+Do not send metadata cache flushes for time and size to the filesystem,
+which should take care of updating the values on its own.
 .It Dv PUFFS_FLAG_OPDUMP
 This option makes the framework dump a textual representation of
 each operation before executing it.

Index: src/sys/fs/puffs/puffs_msgif.h
diff -u src/sys/fs/puffs/puffs_msgif.h:1.83 src/sys/fs/puffs/puffs_msgif.h:1.84
--- src/sys/fs/puffs/puffs_msgif.h:1.83	Fri Oct 31 14:20:54 2014
+++ src/sys/fs/puffs/puffs_msgif.h	Sun Feb 15 20:21:29 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_msgif.h,v 1.83 2014/10/31 14:20:54 manu Exp $	*/
+/*	$NetBSD: puffs_msgif.h,v 1.84 2015/02/15 20:21:29 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -163,7 +163,8 @@ struct puffs_kargs {
 #define PUFFS_KFLAG_NOCACHE_ATTR	0x040	/* no attrib cache (unused) */
 #define PUFFS_KFLAG_CACHE_FS_TTL	0x080	/* cache use TTL from FS*/
 #define PUFFS_KFLAG_CACHE_DOTDOT	0x100	/* don't send lookup for .. */
-#define PUFFS_KFLAG_MASK		0x1bf
+#define PUFFS_KFLAG_NOFLUSH_META	0x200	/* don't flush metadata cache*/
+#define PUFFS_KFLAG_MASK		0x3bf
 
 #define PUFFS_FHFLAG_DYNAMIC		0x01
 #define PUFFS_FHFLAG_NFSV2		0x02

Ind

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

2015-02-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 15 17:21:08 UTC 2015

Modified Files:
src/sys/arch/arm/arm: cpu_in_cksum.S

Log Message:
Really fix arm_cksumdata for <4 bytes of data


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/arm/cpu_in_cksum.S

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

Modified files:

Index: src/sys/arch/arm/arm/cpu_in_cksum.S
diff -u src/sys/arch/arm/arm/cpu_in_cksum.S:1.10 src/sys/arch/arm/arm/cpu_in_cksum.S:1.11
--- src/sys/arch/arm/arm/cpu_in_cksum.S:1.10	Sat Feb 14 23:12:29 2015
+++ src/sys/arch/arm/arm/cpu_in_cksum.S	Sun Feb 15 17:21:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_in_cksum.S,v 1.10 2015/02/14 23:12:29 skrll Exp $	*/
+/*	$NetBSD: cpu_in_cksum.S,v 1.11 2015/02/15 17:21:08 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-RCSID("$NetBSD: cpu_in_cksum.S,v 1.10 2015/02/14 23:12:29 skrll Exp $")
+RCSID("$NetBSD: cpu_in_cksum.S,v 1.11 2015/02/15 17:21:08 skrll Exp $")
 	
 #include "assym.h"
 
@@ -190,7 +190,7 @@ ASENTRY_NP(arm_cksumdata)
 #else
 	RETc(eq)			/* done */
 #endif
-	adds	r7, r7, r1		/* undo sub */
+	adds	r1, r1, r7		/* undo sub */
 	subs	r7, r7, r1
 	lsls	r7, r7, #3
 #if defined(__ARMEB__)



CVS commit: src/sbin/devpubd

2015-02-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb 15 15:56:30 UTC 2015

Modified Files:
src/sbin/devpubd: devpubd-run-hooks.in devpubd.c
src/sbin/devpubd/hooks: 01-makedev 02-wedgenames

Log Message:
At startup, instead of doing run-hooks for each device, call run-hooks
once with a list of all found devices. This lets us batch calls to MAKEDEV
which results in a noticeable improvement in Raspberry Pi boot time.

Run the initial device enumeration hooks before detaching from the foreground,
ensuring that any required devices have been created before the rc.d script
exits.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/devpubd/devpubd-run-hooks.in \
src/sbin/devpubd/devpubd.c
cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/hooks/01-makedev \
src/sbin/devpubd/hooks/02-wedgenames

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

Modified files:

Index: src/sbin/devpubd/devpubd-run-hooks.in
diff -u src/sbin/devpubd/devpubd-run-hooks.in:1.2 src/sbin/devpubd/devpubd-run-hooks.in:1.3
--- src/sbin/devpubd/devpubd-run-hooks.in:1.2	Sun Dec  4 13:01:54 2011
+++ src/sbin/devpubd/devpubd-run-hooks.in	Sun Feb 15 15:56:30 2015
@@ -1,18 +1,19 @@
 #!/bin/sh
 #
-# $NetBSD: devpubd-run-hooks.in,v 1.2 2011/12/04 13:01:54 jmcneill Exp $
+# $NetBSD: devpubd-run-hooks.in,v 1.3 2015/02/15 15:56:30 jmcneill Exp $
 #
 # devpubd run hooks
 
 devpubd_event=$1
-devpubd_device=$2
+shift
+devpubd_devices=$@
 devpubd_hooks_base=@HOOKSDIR@
 
 case $devpubd_event in
 device-attach|device-detach)
 	for hook in ${devpubd_hooks_base}/*; do
 		if [ -x "${hook}" ]; then
-			"${hook}" ${devpubd_event} ${devpubd_device}
+			"${hook}" ${devpubd_event} ${devpubd_devices}
 		fi
 	done
 	;;
Index: src/sbin/devpubd/devpubd.c
diff -u src/sbin/devpubd/devpubd.c:1.2 src/sbin/devpubd/devpubd.c:1.3
--- src/sbin/devpubd/devpubd.c:1.2	Fri Sep 16 15:42:56 2011
+++ src/sbin/devpubd/devpubd.c	Sun Feb 15 15:56:30 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: devpubd.c,v 1.2 2011/09/16 15:42:56 joerg Exp $	*/
+/*	$NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -34,10 +34,11 @@
  */
 
 #include 
-__COPYRIGHT("@(#) Copyright (c) 2011\
+__COPYRIGHT("@(#) Copyright (c) 2011-2015\
 Jared D. McNeill . All rights reserved.");
-__RCSID("$NetBSD: devpubd.c,v 1.2 2011/09/16 15:42:56 joerg Exp $");
+__RCSID("$NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $");
 
+#include 
 #include 
 #include 
 #include 
@@ -57,18 +58,24 @@ __RCSID("$NetBSD: devpubd.c,v 1.2 2011/0
 static int drvctl_fd = -1;
 static const char devpubd_script[] = DEVPUBD_RUN_HOOKS;
 
+struct devpubd_probe_event {
+	char *device;
+	TAILQ_ENTRY(devpubd_probe_event) entries;
+};
+
+static TAILQ_HEAD(, devpubd_probe_event) devpubd_probe_events;
+
 #define	DEVPUBD_ATTACH_EVENT	"device-attach"
 #define	DEVPUBD_DETACH_EVENT	"device-detach"
 
 __dead static void
-devpubd_exec(const char *path, const char *event, const char *device)
+devpubd_exec(const char *path, char * const *argv)
 {
 	int error;
 
-	error = execl(path, path, event, device, NULL);
+	error = execv(path, argv);
 	if (error) {
-		syslog(LOG_ERR, "couldn't exec '%s %s %s': %m",
-		path, event, device);
+		syslog(LOG_ERR, "couldn't exec '%s': %m", path);
 		exit(EXIT_FAILURE);
 	}
 
@@ -76,12 +83,25 @@ devpubd_exec(const char *path, const cha
 }
 
 static void
-devpubd_eventhandler(const char *event, const char *device)
+devpubd_eventhandler(const char *event, const char **device)
 {
+	char **argv;
 	pid_t pid;
-	int status;
+	int status, i, ndevs;
+
+	for (ndevs = 0, i = 0; device[i] != NULL; i++) {
+		++ndevs;
+		syslog(LOG_DEBUG, "event = '%s', device = '%s'", event,
+		device[i]);
+	}
 
-	syslog(LOG_DEBUG, "event = '%s', device = '%s'", event, device);
+	argv = calloc(3 + ndevs, sizeof(char *));
+	argv[0] = __UNCONST(devpubd_script);
+	argv[1] = __UNCONST(event);
+	for (i = 0; i < ndevs; i++) {
+		argv[2 + i] = __UNCONST(device[i]);
+	}
+	argv[2 + i] = NULL;
 
 	pid = fork();
 	switch (pid) {
@@ -89,7 +109,7 @@ devpubd_eventhandler(const char *event, 
 		syslog(LOG_ERR, "fork failed: %m");
 		break;
 	case 0:
-		devpubd_exec(devpubd_script, event, device);
+		devpubd_exec(devpubd_script, argv);
 		/* NOTREACHED */
 	default:
 		if (waitpid(pid, &status, 0) == -1) {
@@ -105,23 +125,27 @@ devpubd_eventhandler(const char *event, 
 		}
 		break;
 	}
+
+	free(argv);
 }
 
 __dead static void
 devpubd_eventloop(void)
 {
-	const char *event, *device;
+	const char *event, *device[2];
 	prop_dictionary_t ev;
 	int res;
 
 	assert(drvctl_fd != -1);
 
+	device[1] = NULL;
+
 	for (;;) {
 		res = prop_dictionary_recv_ioctl(drvctl_fd, DRVGETEVENT, &ev);
 		if (res)
 			err(EXIT_FAILURE, "DRVGETEVENT failed");
 		prop_dictionary_get_cstring_nocopy(ev, "event", &event);
-		prop_dictionary_get_cstring_nocopy(ev, "device", &device);
+		prop_dictionary_get_cstring_nocopy(ev, 

CVS commit: src/usr.sbin/syslogd

2015-02-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 15 14:51:57 UTC 2015

Modified Files:
src/usr.sbin/syslogd: syslogd.h

Log Message:
Format string annotation.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/syslogd/syslogd.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/syslogd/syslogd.h
diff -u src/usr.sbin/syslogd/syslogd.h:1.5 src/usr.sbin/syslogd/syslogd.h:1.6
--- src/usr.sbin/syslogd/syslogd.h:1.5	Tue Feb 10 20:38:15 2015
+++ src/usr.sbin/syslogd/syslogd.h	Sun Feb 15 14:51:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.h,v 1.5 2015/02/10 20:38:15 christos Exp $	*/
+/*	$NetBSD: syslogd.h,v 1.6 2015/02/15 14:51:57 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -151,7 +151,8 @@ char *strndup(const char *str, size_t n)
 #ifdef NDEBUG
 #define DPRINTF(x, ...) (void)0
 #else
-void dbprintf(const char *, const char *, size_t, const char *, ...);
+void dbprintf(const char *, const char *, size_t, const char *, ...)
+__printflike(4, 5);
 #define DPRINTF(x, ...) /*LINTED null effect */(void)(Debug & (x) \
 ? dbprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) : 0)
 #endif



CVS commit: src/sys/ufs/ffs

2015-02-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Feb 15 11:04:44 UTC 2015

Modified Files:
src/sys/ufs/ffs: ffs_appleufs.c

Log Message:
Revert a change in my previous commit that broke the checksum calculation.
Noted by dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/ufs/ffs/ffs_appleufs.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/ufs/ffs/ffs_appleufs.c
diff -u src/sys/ufs/ffs/ffs_appleufs.c:1.14 src/sys/ufs/ffs/ffs_appleufs.c:1.15
--- src/sys/ufs/ffs/ffs_appleufs.c:1.14	Sat Feb 14 08:07:39 2015
+++ src/sys/ufs/ffs/ffs_appleufs.c	Sun Feb 15 11:04:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_appleufs.c,v 1.14 2015/02/14 08:07:39 maxv Exp $	*/
+/*	$NetBSD: ffs_appleufs.c,v 1.15 2015/02/15 11:04:43 maxv Exp $	*/
 
 /*
  * Copyright (c) 2002 Darrin B. Jewell
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_appleufs.c,v 1.14 2015/02/14 08:07:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_appleufs.c,v 1.15 2015/02/15 11:04:43 maxv Exp $");
 
 #include 
 #include 
@@ -89,6 +89,7 @@ ffs_appleufs_validate(const char *name, 
 		return EINVAL;
 
 	*n = *o;
+	n->ul_checksum = 0;
 	n->ul_checksum = ffs_appleufs_cksum(n);
 	n->ul_magic = be32toh(o->ul_magic);
 	n->ul_version = be32toh(o->ul_version);



CVS commit: src/sys/kern

2015-02-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 15 10:48:22 UTC 2015

Modified Files:
src/sys/kern: vfs_syscalls.c

Log Message:
A syscall like posix_fallocate() that is not supposed to set errno in
userland needs to always return 0 and store the error code *retval.


To generate a diff of this commit:
cvs rdiff -u -r1.492 -r1.493 src/sys/kern/vfs_syscalls.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/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.492 src/sys/kern/vfs_syscalls.c:1.493
--- src/sys/kern/vfs_syscalls.c:1.492	Wed Nov 26 10:50:36 2014
+++ src/sys/kern/vfs_syscalls.c	Sun Feb 15 10:48:21 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.492 2014/11/26 10:50:36 manu Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.493 2015/02/15 10:48:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.492 2014/11/26 10:50:36 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.493 2015/02/15 10:48:21 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -4716,12 +4716,14 @@ sys_posix_fallocate(struct lwp *l, const
 	len = SCARG(uap, len);
 	
 	if (pos < 0 || len < 0 || len > OFF_T_MAX - pos) {
-		return EINVAL;
+		*retval = EINVAL;
+		return 0;
 	}
 	
 	error = fd_getvnode(fd, &fp);
 	if (error) {
-		return error;
+		*retval = error;
+		return 0;
 	}
 	if ((fp->f_flag & FWRITE) == 0) {
 		error = EBADF;
@@ -4739,7 +4741,8 @@ sys_posix_fallocate(struct lwp *l, const
 
 fail:
 	fd_putfile(fd);
-	return error;
+	*retval = error;
+	return 0;
 }
 
 /*



CVS commit: src/sys/arch/sh3/sh3

2015-02-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 15 10:48:13 UTC 2015

Modified Files:
src/sys/arch/sh3/sh3: locore_subr.S

Log Message:
port-sh3/49613: errno does not set by some systemcall at error case

Branch to correct point when error detected.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sh3/sh3/locore_subr.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/sh3/sh3/locore_subr.S
diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.54 src/sys/arch/sh3/sh3/locore_subr.S:1.55
--- src/sys/arch/sh3/sh3/locore_subr.S:1.54	Tue Feb  1 01:54:14 2011
+++ src/sys/arch/sh3/sh3/locore_subr.S	Sun Feb 15 10:48:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.55 2015/02/15 10:48:13 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $")
+__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.55 2015/02/15 10:48:13 skrll Exp $")
 
 
 /*
@@ -645,7 +645,7 @@ ENTRY(copyinstr)
 
 	mov.l	.L_copyinstr_VM_MAXUSER_ADDRESS, r3
 	cmp/hi	r3,	r4		/* bomb if usrc isn't in user space */
-	bt	4f
+	bt	5f
 	mov	r3,	r0
 	sub	r4,	r0
 	cmp/hi	r6,	r0		/* don't beyond user space */