CVS commit: src/sys/arch/evbarm

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:47:15 UTC 2015

Added Files:
src/sys/arch/evbarm/conf: files.vexpress mk.vexpress std.vexpress
src/sys/arch/evbarm/vexpress: if_smsh_axi.c platform.h vexpress_axi.c
vexpress_intr.h vexpress_machdep.c vexpress_plcom.c
vexpress_plmmc.c vexpress_space.c vexpress_start.S vexpress_var.h

Log Message:
Add support for Versatile Express A15 board.

This has not been tested with real hardware, just with the software
model emulated by QEMU.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/files.vexpress \
src/sys/arch/evbarm/conf/mk.vexpress \
src/sys/arch/evbarm/conf/std.vexpress
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/vexpress/if_smsh_axi.c \
src/sys/arch/evbarm/vexpress/platform.h \
src/sys/arch/evbarm/vexpress/vexpress_axi.c \
src/sys/arch/evbarm/vexpress/vexpress_intr.h \
src/sys/arch/evbarm/vexpress/vexpress_machdep.c \
src/sys/arch/evbarm/vexpress/vexpress_plcom.c \
src/sys/arch/evbarm/vexpress/vexpress_plmmc.c \
src/sys/arch/evbarm/vexpress/vexpress_space.c \
src/sys/arch/evbarm/vexpress/vexpress_start.S \
src/sys/arch/evbarm/vexpress/vexpress_var.h

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

Added files:

Index: src/sys/arch/evbarm/conf/files.vexpress
diff -u /dev/null src/sys/arch/evbarm/conf/files.vexpress:1.1
--- /dev/null	Mon Feb  9 07:47:15 2015
+++ src/sys/arch/evbarm/conf/files.vexpress	Mon Feb  9 07:47:15 2015
@@ -0,0 +1,68 @@
+#	$NetBSD: files.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+#
+# Versatile Express board configuration info
+#
+
+file	arch/evbarm/vexpress/vexpress_machdep.c
+
+include arch/arm/pic/files.pic
+include arch/arm/cortex/files.cortex
+
+filearch/arm/arm32/arm32_boot.c
+filearch/arm/arm32/arm32_kvminit.c
+filearch/arm/arm32/arm32_reboot.c
+filearch/arm/arm32/irq_dispatch.S
+
+file	arch/evbarm/vexpress/vexpress_space.c
+
+# VEXPRESS AXI/AHB bus interface and SoC domains
+device  axi { [addr=-1], [size=0], [irq=-1], [irqbase=-1]} : bus_space_generic
+attach  axi at mainbus
+filearch/evbarm/vexpress/vexpress_axi.c	axi
+
+# UART Interface
+attach  plcom at axi with vexpressplcom
+filearch/evbarm/vexpress/vexpress_plcom.c	vexpressplcom
+
+# MMCI host controller
+attach	plmmc at axi with vexpressplmmc
+file	arch/evbarm/vexpress/vexpress_plmmc.c	vexpressplmmc
+
+# SMSC LAN9118
+attach  smsh at axi with smsh_axi
+filearch/evbarm/vexpress/if_smsh_axi.c	smsh_axi
+
+#	$NetBSD: files.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+#
+# Versatile Express board configuration info
+#
+
+file	arch/evbarm/vexpress/vexpress_machdep.c
+
+include arch/arm/pic/files.pic
+include arch/arm/cortex/files.cortex
+
+filearch/arm/arm32/arm32_boot.c
+filearch/arm/arm32/arm32_kvminit.c
+filearch/arm/arm32/arm32_reboot.c
+filearch/arm/arm32/irq_dispatch.S
+
+file	arch/evbarm/vexpress/vexpress_space.c
+
+# VEXPRESS AXI/AHB bus interface and SoC domains
+device  axi { [addr=-1], [size=0], [irq=-1], [irqbase=-1]} : bus_space_generic
+attach  axi at mainbus
+filearch/evbarm/vexpress/vexpress_axi.c	axi
+
+# UART Interface
+attach  plcom at axi with vexpressplcom
+filearch/evbarm/vexpress/vexpress_plcom.c	vexpressplcom
+
+# MMCI host controller
+attach	plmmc at axi with vexpressplmmc
+file	arch/evbarm/vexpress/vexpress_plmmc.c	vexpressplmmc
+
+# SMSC LAN9118
+attach  smsh at axi with smsh_axi
+filearch/evbarm/vexpress/if_smsh_axi.c	smsh_axi
+
Index: src/sys/arch/evbarm/conf/mk.vexpress
diff -u /dev/null src/sys/arch/evbarm/conf/mk.vexpress:1.1
--- /dev/null	Mon Feb  9 07:47:15 2015
+++ src/sys/arch/evbarm/conf/mk.vexpress	Mon Feb  9 07:47:15 2015
@@ -0,0 +1,70 @@
+#	$NetBSD: mk.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+
+.if !empty(MACHINE_ARCH:M*eb)
+EXTRA_LINKFLAGS+=	--be8
+.endif
+
+SYSTEM_FIRST_OBJ=	vexpress_start.o
+SYSTEM_FIRST_SFILE=	${THISARM}/vexpress/vexpress_start.S
+
+_OSRELEASE!=		${HOST_SH} $S/conf/osrelease.sh
+
+KERNEL_BASE_PHYS?=$(LOADADDRESS)
+KERNEL_BASE_VIRT?=$(LOADADDRESS)
+
+MKUBOOTIMAGEARGS=	-A arm -T kernel
+MKUBOOTIMAGEARGS+=	-a $(KERNEL_BASE_PHYS) -e $(KERNEL_BASE_PHYS)
+MKUBOOTIMAGEARGS+=	-n NetBSD/$(BOARDTYPE) ${_OSRELEASE}
+MKUBOOTIMAGEARGS_NONE=	${MKUBOOTIMAGEARGS} -C none
+MKUBOOTIMAGEARGS_GZ=	${MKUBOOTIMAGEARGS} -C gz
+
+SYSTEM_LD_TAIL_EXTRA+=; \
+	echo ${OBJCOPY} -S -O binary $@ $@.bin; \
+	${OBJCOPY} -S -O binary $@ $@.bin; \
+	echo ${TOOL_GZIP} -9c $@.bin  $@.bin.gz; \
+	${TOOL_GZIP} -9c $@.bin  $@.bin.gz; \
+	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
+	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
+	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+	echo
+
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
+EXTRA_KERNELS+= 

CVS commit: src/sys/arch/evbarm

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:47:15 UTC 2015

Added Files:
src/sys/arch/evbarm/conf: files.vexpress mk.vexpress std.vexpress
src/sys/arch/evbarm/vexpress: if_smsh_axi.c platform.h vexpress_axi.c
vexpress_intr.h vexpress_machdep.c vexpress_plcom.c
vexpress_plmmc.c vexpress_space.c vexpress_start.S vexpress_var.h

Log Message:
Add support for Versatile Express A15 board.

This has not been tested with real hardware, just with the software
model emulated by QEMU.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/files.vexpress \
src/sys/arch/evbarm/conf/mk.vexpress \
src/sys/arch/evbarm/conf/std.vexpress
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/vexpress/if_smsh_axi.c \
src/sys/arch/evbarm/vexpress/platform.h \
src/sys/arch/evbarm/vexpress/vexpress_axi.c \
src/sys/arch/evbarm/vexpress/vexpress_intr.h \
src/sys/arch/evbarm/vexpress/vexpress_machdep.c \
src/sys/arch/evbarm/vexpress/vexpress_plcom.c \
src/sys/arch/evbarm/vexpress/vexpress_plmmc.c \
src/sys/arch/evbarm/vexpress/vexpress_space.c \
src/sys/arch/evbarm/vexpress/vexpress_start.S \
src/sys/arch/evbarm/vexpress/vexpress_var.h

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



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

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:50:24 UTC 2015

Added Files:
src/sys/arch/evbarm/conf: VEXPRESS_A15

Log Message:
Add configuration file for Versatile Express A15 board.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/VEXPRESS_A15

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

Added files:

Index: src/sys/arch/evbarm/conf/VEXPRESS_A15
diff -u /dev/null src/sys/arch/evbarm/conf/VEXPRESS_A15:1.1
--- /dev/null	Mon Feb  9 07:50:24 2015
+++ src/sys/arch/evbarm/conf/VEXPRESS_A15	Mon Feb  9 07:50:24 2015
@@ -0,0 +1,434 @@
+#
+#	$NetBSD: VEXPRESS_A15,v 1.1 2015/02/09 07:50:24 slp Exp $
+#
+#	VEXPRESS_A15 -- Versatile Express A15 kernel
+#
+
+include	arch/evbarm/conf/std.vexpress
+
+# estimated number of users
+
+maxusers	32
+
+# Standard system options
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+#options 	NTP		# NTP phase/frequency locked loop
+
+# CPU options
+options 	CPU_CORTEX
+options 	CPU_CORTEXA7
+options 	CPU_CORTEXA15
+#options 	MULTIPROCESSOR
+
+options 	PMAPCOUNTERS
+options 	BUSDMA_COUNTERS
+#options 	EXYNOS_CONSOLE_EARLY
+#options 	UVMHIST
+#options 	USBHIST
+#options 	USBHIST_SIZE=10
+#options 	UVMHIST_PRINT,KERNHIST_DELAY=0
+options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
+options 	PMAP_NEED_ALLOC_POOLPAGE
+
+# Specify the memory size in megabytes (optional).
+#options 	MEMSIZE=512
+
+# File systems
+file-system	FFS		# UFS
+#file-system	LFS		# log-structured file system
+file-system	MFS		# memory file system
+file-system	NFS		# Network file system
+#file-system 	ADOSFS		# AmigaDOS-compatible file system
+#file-system 	EXT2FS		# second extended file system (linux)
+#file-system	CD9660		# ISO 9660 + Rock Ridge file system
+file-system	MSDOSFS		# MS-DOS file system
+#file-system	FDESC		# /dev/fd
+file-system	KERNFS		# /kern
+#file-system	NULLFS		# loopback file system
+file-system	PROCFS		# /proc
+#file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g  sshfs)
+#file-system	UMAPFS		# NULLFS + uid and gid remapping
+#file-system	UNION		# union file system
+file-system	TMPFS		# memory file system
+file-system	PTYFS		# /dev/pts/N support
+
+# File system options
+#options 	QUOTA		# legacy UFS quotas
+#options 	QUOTA2		# new, in-filesystem UFS quotas
+#options 	FFS_EI		# FFS Endian Independent support
+#options 	NFSSERVER
+options 	WAPBL		# File system journaling support
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+
+# Networking options
+
+#options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	PIM		# Protocol Independent Multicast
+#options 	NETATALK	# AppleTalk networking
+#options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+#options 	PPP_DEFLATE	# Deflate compression support for PPP
+#options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
+
+options 	NFS_BOOT_BOOTP
+options 	NFS_BOOT_DHCP
+#options 	NFS_BOOT_BOOTSTATIC
+#options 	NFS_BOOTSTATIC_MYIP=\192.168.1.4\
+#options 	NFS_BOOTSTATIC_GWIP=\192.168.1.1\
+#options 	NFS_BOOTSTATIC_MASK=\255.255.255.0\
+#options 	NFS_BOOTSTATIC_SERVADDR=\192.168.1.1\
+#options 	NFS_BOOTSTATIC_SERVER=\192.168.1.1:/nfs/sdp2430\
+
+options 	NFS_BOOT_RWSIZE=1024
+
+# Compatibility options
+
+options 	COMPAT_NETBSD32	# allow running arm (e.g. non-earm) binaries
+#options 	COMPAT_43	# 4.3BSD compatibility.
+#options 	COMPAT_09	# NetBSD 0.9,
+#options 	COMPAT_10	# NetBSD 1.0,
+#options 	COMPAT_11	# NetBSD 1.1,
+#options 	COMPAT_12	# NetBSD 1.2,
+#options 	COMPAT_13	# NetBSD 1.3,
+#options 	COMPAT_14	# NetBSD 1.4,
+#options 	COMPAT_15	# NetBSD 1.5,
+#options 	COMPAT_16	# NetBSD 1.6,
+#options 	COMPAT_20	# NetBSD 2.0,
+options 	COMPAT_30	# NetBSD 3.0,
+options 	COMPAT_40	# NetBSD 4.0,
+options 	COMPAT_50	# NetBSD 5.0,
+options 	COMPAT_60	# NetBSD 6.0, and
+options 	COMPAT_70	# NetBSD 7.0 binary compatibility.
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+#options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# Shared memory options
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+# Device options
+
+#options 	MEMORY_DISK_HOOKS	# boottime setup of ramdisk
+#options 	MEMORY_DISK_ROOT_SIZE=8192	# Size in blocks
+#options 	MEMORY_DISK_DYNAMIC
+#options 	MINIROOTSIZE=1000	# Size in blocks
+#options 	MEMORY_DISK_IS_ROOT	# use memory disk as root
+
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+
+# Miscellaneous kernel options
+options 	KTRACE		# system call tracing, a la ktrace(1)
+#options 	KMEMSTATS	# kernel 

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

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:50:24 UTC 2015

Added Files:
src/sys/arch/evbarm/conf: VEXPRESS_A15

Log Message:
Add configuration file for Versatile Express A15 board.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/VEXPRESS_A15

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



CVS commit: src/sys/dev/ic

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:53:39 UTC 2015

Modified Files:
src/sys/dev/ic: lan9118.c

Log Message:
Configure interrupt polarity before enabling PHY.

This prevents a interrupt storm when running under QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/lan9118.c

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



CVS commit: src/sys/dev/ic

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:53:39 UTC 2015

Modified Files:
src/sys/dev/ic: lan9118.c

Log Message:
Configure interrupt polarity before enabling PHY.

This prevents a interrupt storm when running under QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/lan9118.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/ic/lan9118.c
diff -u src/sys/dev/ic/lan9118.c:1.17 src/sys/dev/ic/lan9118.c:1.18
--- src/sys/dev/ic/lan9118.c:1.17	Sun Aug 10 16:44:35 2014
+++ src/sys/dev/ic/lan9118.c	Mon Feb  9 07:53:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lan9118.c,v 1.17 2014/08/10 16:44:35 tls Exp $	*/
+/*	$NetBSD: lan9118.c,v 1.18 2015/02/09 07:53:39 slp Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lan9118.c,v 1.17 2014/08/10 16:44:35 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: lan9118.c,v 1.18 2015/02/09 07:53:39 slp Exp $);
 
 /*
  * The LAN9118 Family
@@ -169,6 +169,10 @@ lan9118_attach(struct lan9118_softc *sc)
 		return EINVAL;
 	}
 
+	/* Configure interrupt polarity */
+	bus_space_write_4(sc-sc_iot, sc-sc_ioh, LAN9118_IRQ_CFG,
+	LAN9118_IRQ_CFG_IRQ_TYPE | LAN9118_IRQ_CFG_IRQ_POL);
+
 	val = bus_space_read_4(sc-sc_iot, sc-sc_ioh, LAN9118_ID_REV);
 	sc-sc_id = LAN9118_ID_REV_ID(val);
 	sc-sc_rev = LAN9118_ID_REV_REV(val);



CVS commit: src/sys/arch/arm

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:55:52 UTC 2015

Modified Files:
src/sys/arch/arm/include: vfpreg.h
src/sys/arch/arm/vfp: vfp_init.c

Log Message:
Add VFP IDs for QEMU's emulated Cortex-A15.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/include/vfpreg.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/vfp/vfp_init.c

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



CVS commit: src/sys/arch/arm

2015-02-08 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Mon Feb  9 07:55:52 UTC 2015

Modified Files:
src/sys/arch/arm/include: vfpreg.h
src/sys/arch/arm/vfp: vfp_init.c

Log Message:
Add VFP IDs for QEMU's emulated Cortex-A15.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/include/vfpreg.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/vfp/vfp_init.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/include/vfpreg.h
diff -u src/sys/arch/arm/include/vfpreg.h:1.13 src/sys/arch/arm/include/vfpreg.h:1.14
--- src/sys/arch/arm/include/vfpreg.h:1.13	Tue Mar 18 07:03:22 2014
+++ src/sys/arch/arm/include/vfpreg.h	Mon Feb  9 07:55:52 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfpreg.h,v 1.13 2014/03/18 07:03:22 matt Exp $ */
+/*  $NetBSD: vfpreg.h,v 1.14 2015/02/09 07:55:52 slp Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -64,6 +64,7 @@
 #define FPU_VFP_CORTEXA8	0x410330c0
 #define FPU_VFP_CORTEXA9	0x41033090
 #define FPU_VFP_CORTEXA15	0x410330f0
+#define FPU_VFP_CORTEXA15_QEMU	0x410430f0
 #define FPU_VFP_MV88SV58XX	0x56022090
 
 #define VFP_FPEXC_EX		0x8000	/* EXception status bit */

Index: src/sys/arch/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.41 src/sys/arch/arm/vfp/vfp_init.c:1.42
--- src/sys/arch/arm/vfp/vfp_init.c:1.41	Fri Jul 18 22:54:53 2014
+++ src/sys/arch/arm/vfp/vfp_init.c	Mon Feb  9 07:55:52 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfp_init.c,v 1.41 2014/07/18 22:54:53 matt Exp $ */
+/*  $NetBSD: vfp_init.c,v 1.42 2015/02/09 07:55:52 slp Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -94,6 +94,7 @@ load_vfpregs(const struct vfpreg *fregs)
 	case FPU_VFP_CORTEXA8:
 	case FPU_VFP_CORTEXA9:
 	case FPU_VFP_CORTEXA15:
+	case FPU_VFP_CORTEXA15_QEMU:
 #endif
 		load_vfpregs_hi(fregs-vfp_regs);
 #ifdef CPU_ARM11
@@ -115,6 +116,7 @@ save_vfpregs(struct vfpreg *fregs)
 	case FPU_VFP_CORTEXA8:
 	case FPU_VFP_CORTEXA9:
 	case FPU_VFP_CORTEXA15:
+	case FPU_VFP_CORTEXA15_QEMU:
 #endif
 		save_vfpregs_hi(fregs-vfp_regs);
 #ifdef CPU_ARM11
@@ -312,6 +314,7 @@ vfp_attach(struct cpu_info *ci)
 	case FPU_VFP_CORTEXA8:
 	case FPU_VFP_CORTEXA9:
 	case FPU_VFP_CORTEXA15:
+	case FPU_VFP_CORTEXA15_QEMU:
 		if (armreg_cpacr_read()  CPACR_V7_ASEDIS) {
 			model = VFP 4.0+;
 		} else {



CVS commit: src/sys/ufs/ufs

2014-10-21 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Tue Oct 21 10:39:26 UTC 2014

Modified Files:
src/sys/ufs/ufs: ufs_extern.h ufs_inode.c ufs_vnops.c

Log Message:
Move and unify indirect block truncate algorithm into a separate function.

Reviewed by joerg.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/ufs/ufs/ufs_extern.h
cvs rdiff -u -r1.90 -r1.91 src/sys/ufs/ufs/ufs_inode.c
cvs rdiff -u -r1.222 -r1.223 src/sys/ufs/ufs/ufs_vnops.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_extern.h
diff -u src/sys/ufs/ufs/ufs_extern.h:1.75 src/sys/ufs/ufs/ufs_extern.h:1.76
--- src/sys/ufs/ufs/ufs_extern.h:1.75	Sun May 25 13:48:40 2014
+++ src/sys/ufs/ufs/ufs_extern.h	Tue Oct 21 10:39:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_extern.h,v 1.75 2014/05/25 13:48:40 hannken Exp $	*/
+/*	$NetBSD: ufs_extern.h,v 1.76 2014/10/21 10:39:26 slp Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -111,6 +111,7 @@ int	ufs_getlbns(struct vnode *, daddr_t,
 /* ufs_inode.c */
 int	ufs_reclaim(struct vnode *);
 int	ufs_balloc_range(struct vnode *, off_t, off_t, kauth_cred_t, int);
+int	ufs_wapbl_truncate(struct vnode *, uint64_t, uint64_t, uint64_t);
 
 /* ufs_lookup.c */
 void	ufs_dirbad(struct inode *, doff_t, const char *);

Index: src/sys/ufs/ufs/ufs_inode.c
diff -u src/sys/ufs/ufs/ufs_inode.c:1.90 src/sys/ufs/ufs/ufs_inode.c:1.91
--- src/sys/ufs/ufs/ufs_inode.c:1.90	Thu May  8 08:21:53 2014
+++ src/sys/ufs/ufs/ufs_inode.c	Tue Oct 21 10:39:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_inode.c,v 1.90 2014/05/08 08:21:53 hannken Exp $	*/
+/*	$NetBSD: ufs_inode.c,v 1.91 2014/10/21 10:39:26 slp Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_inode.c,v 1.90 2014/05/08 08:21:53 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_inode.c,v 1.91 2014/10/21 10:39:26 slp Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -102,40 +102,25 @@ ufs_inactive(void *v)
 #ifdef UFS_EXTATTR
 		ufs_extattr_vnode_inactive(vp, curlwp);
 #endif
-		error = UFS_WAPBL_BEGIN(vp-v_mount);
-		if (error)
-			goto out;
-		logged = 1;
 		if (ip-i_size != 0) {
+			uint64_t incr = MNINDIR(ip-i_ump) 
+			vp-v_mount-mnt_fs_bshift; /* Power of 2 */
+			uint64_t base = UFS_NDADDR 
+			vp-v_mount-mnt_fs_bshift;
 			/*
 			 * When journaling, only truncate one indirect block
 			 * at a time
 			 */
-			if (vp-v_mount-mnt_wapbl) {
-uint64_t incr = MNINDIR(ip-i_ump) 
-vp-v_mount-mnt_fs_bshift; /* Power of 2 */
-uint64_t base = UFS_NDADDR 
-vp-v_mount-mnt_fs_bshift;
-while (!error  ip-i_size  base + incr) {
-	/*
-	 * round down to next full indirect
-	 * block boundary.
-	 */
-	uint64_t nsize = base +
-	((ip-i_size - base - 1) 
-	~(incr - 1));
-	error = UFS_TRUNCATE(vp, nsize, 0,
-	NOCRED);
-	if (error)
-		break;
-	UFS_WAPBL_END(vp-v_mount);
-	error = UFS_WAPBL_BEGIN(vp-v_mount);
-	if (error)
-		goto out;
-}
+			if (vp-v_mount-mnt_wapbl  ip-i_size  base + incr) {
+error = ufs_wapbl_truncate(vp, incr, base, 0);
 			}
-			if (!error)
+			if (!error) {
+error = UFS_WAPBL_BEGIN(vp-v_mount);
+if (error)
+	goto out;
+logged = 1;
 error = UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED);
+			}
 		}
 #if defined(QUOTA) || defined(QUOTA2)
 		(void)chkiq(ip, -1, NOCRED, 0);
@@ -309,3 +294,35 @@ ufs_balloc_range(struct vnode *vp, off_t
  	kmem_free(pgs, pgssize);
 	return error;
 }
+
+int
+ufs_wapbl_truncate(struct vnode *vp, uint64_t incr, uint64_t base,
+uint64_t newsize)
+{
+	struct inode *ip = VTOI(vp);
+	int error;
+
+	error = UFS_WAPBL_BEGIN(vp-v_mount);
+	if (error)
+		return error;
+
+	while (ip-i_size  base + incr) {
+		/*
+		 * round down to next full indirect
+		 * block boundary.
+		 */
+		uint64_t nsize =
+		base + ((ip-i_size - base - 1)  ~(incr - 1));
+		error = UFS_TRUNCATE(vp, nsize, 0, NOCRED);
+		if (error)
+			break;
+		UFS_WAPBL_END(vp-v_mount);
+		error = UFS_WAPBL_BEGIN(vp-v_mount);
+		if (error)
+			return error;
+	}
+	UFS_WAPBL_END(vp-v_mount);
+
+	return error;
+}
+

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.222 src/sys/ufs/ufs/ufs_vnops.c:1.223
--- src/sys/ufs/ufs/ufs_vnops.c:1.222	Sat Oct 18 08:33:30 2014
+++ src/sys/ufs/ufs/ufs_vnops.c	Tue Oct 21 10:39:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.222 2014/10/18 08:33:30 snj Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.223 2014/10/21 10:39:26 slp Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_vnops.c,v 1.222 2014/10/18 08:33:30 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_vnops.c,v 1.223 2014/10/21 10:39:26 slp Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -464,6 +464,8 @@ ufs_setattr(void *v)
 	int		error;
 	

CVS commit: src/sys/ufs/ufs

2014-10-21 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Tue Oct 21 10:39:26 UTC 2014

Modified Files:
src/sys/ufs/ufs: ufs_extern.h ufs_inode.c ufs_vnops.c

Log Message:
Move and unify indirect block truncate algorithm into a separate function.

Reviewed by joerg.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/ufs/ufs/ufs_extern.h
cvs rdiff -u -r1.90 -r1.91 src/sys/ufs/ufs/ufs_inode.c
cvs rdiff -u -r1.222 -r1.223 src/sys/ufs/ufs/ufs_vnops.c

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



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

2013-11-10 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Sun Nov 10 12:07:52 UTC 2013

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

Log Message:
On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/compat/linux/common/linux_misc.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_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.226 src/sys/compat/linux/common/linux_misc.c:1.227
--- src/sys/compat/linux/common/linux_misc.c:1.226	Tue Sep 24 13:27:50 2013
+++ src/sys/compat/linux/common/linux_misc.c	Sun Nov 10 12:07:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_misc.c,v 1.226 2013/09/24 13:27:50 njoly Exp $	*/
+/*	$NetBSD: linux_misc.c,v 1.227 2013/11/10 12:07:52 slp Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_misc.c,v 1.226 2013/09/24 13:27:50 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_misc.c,v 1.227 2013/11/10 12:07:52 slp Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -784,9 +784,10 @@ again:
 			}
 			idb.d_off = (linux_off_t)off;
 			idb.d_reclen = (u_short)linux_reclen;
+			/* Linux puts d_type at the end of each record */
+			*((char *)idb + idb.d_reclen - 1) = bdp-d_type;
 		}
 		strcpy(idb.d_name, bdp-d_name);
-		idb.d_name[strlen(idb.d_name) + 1] = bdp-d_type;
 		if ((error = copyout((void *)idb, outp, linux_reclen)))
 			goto out;
 		/* advance past this real entry */



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

2013-11-10 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Sun Nov 10 12:07:52 UTC 2013

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

Log Message:
On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/compat/linux/common/linux_misc.c

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



CVS commit: src/distrib/notes/common

2013-08-28 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Wed Aug 28 15:39:30 UTC 2013

Modified Files:
src/distrib/notes/common: main

Log Message:
Added slp@ to NetBSD Developers list.


To generate a diff of this commit:
cvs rdiff -u -r1.496 -r1.497 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.496 src/distrib/notes/common/main:1.497
--- src/distrib/notes/common/main:1.496	Fri Jun 21 10:05:52 2013
+++ src/distrib/notes/common/main	Wed Aug 28 15:39:30 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: main,v 1.496 2013/06/21 10:05:52 shm Exp $
+.\	$NetBSD: main,v 1.497 2013/08/28 15:39:30 slp Exp $
 .\
 .\ Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -1272,6 +1272,7 @@ If you're one of them, and would like to
 .It Ta Joel Lindholm Ta Mt j...@netbsd.org
 .It Ta Tonnerre Lombard Ta Mt tonne...@netbsd.org
 .It Ta Mike Long Ta Mt mi...@netbsd.org
+.It Ta Sergio Lopez Ta Mt s...@netbsd.org
 .It Ta Michael Lorenz Ta Mt macal...@netbsd.org
 .It Ta Warner Losh Ta Mt i...@netbsd.org
 .It Ta Tomasz Luchowski Ta Mt zun...@netbsd.org



CVS commit: src/distrib/notes/common

2013-08-28 Thread Sergio Lopez
Module Name:src
Committed By:   slp
Date:   Wed Aug 28 15:39:30 UTC 2013

Modified Files:
src/distrib/notes/common: main

Log Message:
Added slp@ to NetBSD Developers list.


To generate a diff of this commit:
cvs rdiff -u -r1.496 -r1.497 src/distrib/notes/common/main

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