svn commit: r257108 - in user/ed/newcons: . cddl/contrib/opensolaris/cmd/zfs contrib/gperf/src etc etc/mtree lib/libcrypt lib/libcrypt/tests sbin/fsck_ffs sbin/geom/class/part sbin/growfs sbin/mdco...
Aleksandr Rybalko
ray at FreeBSD.org
Fri Oct 25 08:41:42 UTC 2013
Author: ray
Date: Fri Oct 25 08:41:36 2013
New Revision: 257108
URL: http://svnweb.freebsd.org/changeset/base/257108
Log:
MFC @r257107.
Added:
user/ed/newcons/etc/mtree/BSD.tests.dist
- copied unchanged from r257107, head/etc/mtree/BSD.tests.dist
user/ed/newcons/share/man/man7/tests.7
- copied unchanged from r257107, head/share/man/man7/tests.7
user/ed/newcons/share/mk/plain.test.mk
- copied unchanged from r257107, head/share/mk/plain.test.mk
user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spi.c
- copied unchanged from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c
user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spireg.h
- copied unchanged from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spireg.h
user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spivar.h
- copied unchanged from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h
user/ed/newcons/sys/dev/iwn/if_iwn_debug.h
- copied unchanged from r257107, head/sys/dev/iwn/if_iwn_debug.h
user/ed/newcons/sys/dev/ofw/ofw_nexus.c
- copied unchanged from r257107, head/sys/dev/ofw/ofw_nexus.c
user/ed/newcons/sys/dev/ofw/ofw_nexus.h
- copied unchanged from r257107, head/sys/dev/ofw/ofw_nexus.h
user/ed/newcons/sys/dev/spibus/ofw_spibus.c
- copied unchanged from r257107, head/sys/dev/spibus/ofw_spibus.c
user/ed/newcons/sys/mips/conf/ALFA_HORNET_UB
- copied unchanged from r257107, head/sys/mips/conf/ALFA_HORNET_UB
user/ed/newcons/sys/mips/conf/ALFA_HORNET_UB.hints
- copied unchanged from r257107, head/sys/mips/conf/ALFA_HORNET_UB.hints
user/ed/newcons/tests/
- copied from r257107, head/tests/
user/ed/newcons/tools/build/options/WITHOUT_TESTS
- copied unchanged from r257107, head/tools/build/options/WITHOUT_TESTS
Deleted:
user/ed/newcons/sys/kern/dtio_kdtrace.c
user/ed/newcons/sys/mips/conf/BERI_SIM.hints
user/ed/newcons/sys/modules/dtrace/dtio/
Modified:
user/ed/newcons/Makefile.inc1
user/ed/newcons/ObsoleteFiles.inc
user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8
user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
user/ed/newcons/contrib/gperf/src/search.cc
user/ed/newcons/etc/Makefile
user/ed/newcons/etc/mtree/BSD.usr.dist
user/ed/newcons/lib/libcrypt/Makefile
user/ed/newcons/lib/libcrypt/tests/Makefile
user/ed/newcons/sbin/fsck_ffs/ea.c
user/ed/newcons/sbin/geom/class/part/geom_part.c
user/ed/newcons/sbin/growfs/debug.c
user/ed/newcons/sbin/mdconfig/mdconfig.c
user/ed/newcons/share/man/man5/src.conf.5
user/ed/newcons/share/man/man7/Makefile
user/ed/newcons/share/man/man7/hier.7
user/ed/newcons/share/mk/bsd.files.mk
user/ed/newcons/share/mk/bsd.own.mk
user/ed/newcons/share/mk/bsd.test.mk
user/ed/newcons/sys/arm/broadcom/bcm2835/files.bcm2835
user/ed/newcons/sys/arm/conf/RPI-B
user/ed/newcons/sys/arm/mv/gpio.c
user/ed/newcons/sys/boot/fdt/dts/bcm2835.dtsi
user/ed/newcons/sys/cam/ata/ata_da.c
user/ed/newcons/sys/cam/cam_xpt.c
user/ed/newcons/sys/cam/ctl/ctl_backend_block.c
user/ed/newcons/sys/cam/scsi/scsi_da.c
user/ed/newcons/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
user/ed/newcons/sys/conf/NOTES
user/ed/newcons/sys/conf/files
user/ed/newcons/sys/conf/files.powerpc
user/ed/newcons/sys/dev/fdt/fdt_common.c
user/ed/newcons/sys/dev/fdt/fdt_pci.c
user/ed/newcons/sys/dev/fdt/simplebus.c
user/ed/newcons/sys/dev/iscsi/icl.c
user/ed/newcons/sys/dev/iwn/if_iwn.c
user/ed/newcons/sys/dev/iwn/if_iwnreg.h
user/ed/newcons/sys/dev/oce/oce_hw.c
user/ed/newcons/sys/dev/oce/oce_hw.h
user/ed/newcons/sys/dev/oce/oce_if.c
user/ed/newcons/sys/dev/oce/oce_if.h
user/ed/newcons/sys/dev/oce/oce_mbox.c
user/ed/newcons/sys/dev/oce/oce_queue.c
user/ed/newcons/sys/dev/oce/oce_sysctl.c
user/ed/newcons/sys/dev/oce/oce_util.c
user/ed/newcons/sys/dev/ofw/ofw_bus.h
user/ed/newcons/sys/dev/ofw/ofw_bus_if.m
user/ed/newcons/sys/dev/ofw/ofw_bus_subr.c
user/ed/newcons/sys/dev/ofw/ofw_console.c
user/ed/newcons/sys/dev/ofw/ofw_fdt.c
user/ed/newcons/sys/dev/ofw/ofw_iicbus.c
user/ed/newcons/sys/dev/ofw/openfirm.c
user/ed/newcons/sys/dev/pci/pci.c
user/ed/newcons/sys/dev/pci/pci_private.h
user/ed/newcons/sys/dev/pci/pcireg.h
user/ed/newcons/sys/dev/pci/pcivar.h
user/ed/newcons/sys/dev/spibus/spibus.c
user/ed/newcons/sys/dev/spibus/spibusvar.h
user/ed/newcons/sys/dev/uart/uart_dev_imx.c
user/ed/newcons/sys/fs/ext2fs/ext2_vnops.c
user/ed/newcons/sys/kern/subr_devstat.c
user/ed/newcons/sys/mips/include/pte.h
user/ed/newcons/sys/modules/dtrace/Makefile
user/ed/newcons/sys/modules/dtrace/dtraceall/dtraceall.c
user/ed/newcons/sys/net/if_tap.c
user/ed/newcons/sys/net80211/ieee80211_output.c
user/ed/newcons/sys/net80211/ieee80211_proto.c
user/ed/newcons/sys/net80211/ieee80211_proto.h
user/ed/newcons/sys/netinet6/icmp6.c
user/ed/newcons/sys/powerpc/booke/platform_bare.c
user/ed/newcons/sys/powerpc/include/intr_machdep.h
user/ed/newcons/sys/powerpc/mpc85xx/atpic.c
user/ed/newcons/sys/powerpc/ofw/ofw_pci.c
user/ed/newcons/sys/powerpc/ofw/ofw_pcib_pci.c
user/ed/newcons/sys/powerpc/ofw/ofw_pcibus.c
user/ed/newcons/sys/powerpc/ofw/openpic_ofw.c
user/ed/newcons/sys/powerpc/powermac/powermac_thermal.c
user/ed/newcons/sys/powerpc/powerpc/intr_machdep.c
user/ed/newcons/sys/powerpc/powerpc/nexus.c
user/ed/newcons/sys/powerpc/powerpc/pic_if.m
user/ed/newcons/sys/powerpc/pseries/vdevice.c
user/ed/newcons/sys/sparc64/include/bus.h
user/ed/newcons/sys/sparc64/include/bus_private.h
user/ed/newcons/sys/sparc64/pci/fire.c
user/ed/newcons/sys/sparc64/pci/psycho.c
user/ed/newcons/sys/sparc64/pci/schizo.c
user/ed/newcons/sys/sparc64/sbus/sbus.c
user/ed/newcons/sys/sparc64/sparc64/bus_machdep.c
user/ed/newcons/sys/sys/time.h
user/ed/newcons/sys/ufs/ffs/ffs_vnops.c
user/ed/newcons/sys/ufs/ufs/dinode.h
user/ed/newcons/sys/x86/x86/io_apic.c
user/ed/newcons/usr.sbin/bhyve/bhyverun.c
user/ed/newcons/usr.sbin/bhyve/ioapic.c
user/ed/newcons/usr.sbin/bhyve/pci_virtio_block.c
user/ed/newcons/usr.sbin/bhyveload/bhyveload.c
user/ed/newcons/usr.sbin/freebsd-update/freebsd-update.sh
user/ed/newcons/usr.sbin/pkg/config.c
user/ed/newcons/usr.sbin/pkg/config.h
user/ed/newcons/usr.sbin/pkg/dns_utils.c
user/ed/newcons/usr.sbin/pkg/dns_utils.h
user/ed/newcons/usr.sbin/pkg/pkg.c
Directory Properties:
user/ed/newcons/ (props changed)
user/ed/newcons/cddl/ (props changed)
user/ed/newcons/cddl/contrib/opensolaris/ (props changed)
user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/ (props changed)
user/ed/newcons/sbin/ (props changed)
user/ed/newcons/sys/ (props changed)
user/ed/newcons/sys/boot/ (props changed)
user/ed/newcons/sys/conf/ (props changed)
user/ed/newcons/usr.sbin/bhyve/ (props changed)
user/ed/newcons/usr.sbin/bhyveload/ (props changed)
Modified: user/ed/newcons/Makefile.inc1
==============================================================================
--- user/ed/newcons/Makefile.inc1 Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/Makefile.inc1 Fri Oct 25 08:41:36 2013 (r257108)
@@ -58,6 +58,7 @@
# use that new version. And the new (dynamically-linked) /bin/sh
# will expect to find appropriate libraries in /lib and /libexec.
#
+SRCDIR?= ${.CURDIR}
.if defined(SUBDIR_OVERRIDE)
SUBDIR= ${SUBDIR_OVERRIDE}
.else
@@ -84,6 +85,9 @@ SUBDIR+=secure
SUBDIR+=share
.endif
SUBDIR+=sys usr.bin usr.sbin
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
.if ${MK_OFED} != "no"
SUBDIR+=contrib/ofed
.endif
@@ -128,10 +132,10 @@ OSRELDATE= 0
.endif
.if !defined(VERSION)
-REVISION!= make -C ${.CURDIR}/release -V REVISION
-BRANCH!= make -C ${.CURDIR}/release -V BRANCH
+REVISION!= make -C ${SRCDIR}/release -V REVISION
+BRANCH!= make -C ${SRCDIR}/release -V BRANCH
SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
- ${.CURDIR}/sys/sys/param.h
+ ${SRCDIR}/sys/sys/param.h
VERSION= FreeBSD ${REVISION}-${BRANCH} ${TARGET_ARCH} ${SRCRELDATE}
.endif
@@ -488,6 +492,10 @@ _worldtmp:
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
-p ${WORLDTMP}/usr/lib >/dev/null
.endif
+.if ${MK_TESTS} != "no"
+ mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
+ -p ${WORLDTMP}${TESTSBASE} >/dev/null
+.endif
.for _mtree in ${LOCAL_MTREE}
mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
.endfor
Modified: user/ed/newcons/ObsoleteFiles.inc
==============================================================================
--- user/ed/newcons/ObsoleteFiles.inc Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/ObsoleteFiles.inc Fri Oct 25 08:41:36 2013 (r257108)
@@ -38,6 +38,8 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20131023: remove never used iscsi directory
+OLD_DIRS+=usr/share/examples/iscsi
# 20131014: libbsdyml becomes private
OLD_FILES+=usr/lib/libbsdyml.a
OLD_FILES+=usr/lib/libbsdyml.so
@@ -2491,6 +2493,7 @@ OLD_FILES+=usr/sbin/zfs
OLD_FILES+=usr/sbin/zpool
# 20070423: rc.bluetooth (examples) removed
OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth
+OLD_DIRS+=usr/share/examples/netgraph/bluetooth
# 20070421: worm.4 removed
OLD_FILES+=usr/share/man/man4/worm.4.gz
# 20070417: trunk(4) renamed to lagg(4)
Modified: user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==============================================================================
--- user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 08:41:36 2013 (r257108)
@@ -25,10 +25,11 @@
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
+.\" Copyright (c) 2013, Steven Hartland <smh at FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
-.Dd September 20, 2013
+.Dd October 23, 2013
.Dt ZFS 8
.Os
.Sh NAME
@@ -61,7 +62,7 @@
.Op , Ns ...
.Sm on
.Nm
-.Cm snapshot
+.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem at snapname Ns | Ns Ar volume at snapname
@@ -157,7 +158,7 @@
.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
.Fl a | Ar filesystem
.Nm
-.Cm unmount
+.Cm unmount Ns | Ns Cm umount
.Op Fl f
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Nm
@@ -172,11 +173,11 @@
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Nm
-.Cm receive
+.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
-.Cm receive
+.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Op Fl d | e
.Ar filesystem
@@ -1653,7 +1654,7 @@ options, as they can destroy large porti
behavior for mounted file systems in use.
.It Xo
.Nm
-.Cm snapshot
+.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem at snapname Ns | Ns volume at snapname
@@ -1865,7 +1866,7 @@ syntax.
A comma-separated list of types to display, where
.Ar type
is one of
-.Sy filesystem , snapshot , volume , No or Sy all .
+.Sy filesystem , snapshot , snap, volume , No or Sy all .
For example, specifying
.Fl t Cm snapshot
displays only snapshots.
@@ -2194,7 +2195,7 @@ Mount the specified filesystem.
.El
.It Xo
.Nm
-.Cm unmount
+.Cm unmount Ns | Ns Cm umount
.Op Fl f
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Xc
@@ -2377,13 +2378,13 @@ on future versions of
.Tn ZFS .
.It Xo
.Nm
-.Cm receive
+.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
.It Xo
.Nm
-.Cm receive
+.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Op Fl d | e
.Ar filesystem
Modified: user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Oct 25 08:41:36 2013 (r257108)
@@ -259,9 +259,9 @@ get_usage(zfs_help_t idx)
case HELP_PROMOTE:
return (gettext("\tpromote <clone-filesystem>\n"));
case HELP_RECEIVE:
- return (gettext("\treceive [-vnFu] <filesystem|volume|"
+ return (gettext("\treceive|recv [-vnFu] <filesystem|volume|"
"snapshot>\n"
- "\treceive [-vnFu] [-d | -e] <filesystem>\n"));
+ "\treceive|recv [-vnFu] [-d | -e] <filesystem>\n"));
case HELP_RENAME:
return (gettext("\trename [-f] <filesystem|volume|snapshot> "
"<filesystem|volume|snapshot>\n"
@@ -280,10 +280,10 @@ get_usage(zfs_help_t idx)
case HELP_SHARE:
return (gettext("\tshare <-a | filesystem>\n"));
case HELP_SNAPSHOT:
- return (gettext("\tsnapshot [-r] [-o property=value] ... "
+ return (gettext("\tsnapshot|snap [-r] [-o property=value] ... "
"<filesystem at snapname|volume at snapname> ...\n"));
case HELP_UNMOUNT:
- return (gettext("\tunmount [-f] "
+ return (gettext("\tunmount|umount [-f] "
"<-a | filesystem|mountpoint>\n"));
case HELP_UNSHARE:
return (gettext("\tunshare "
@@ -3027,7 +3027,7 @@ zfs_do_list(int argc, char **argv)
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
while (*optarg != '\0') {
static char *type_subopts[] = { "filesystem",
- "volume", "snapshot", "all", NULL };
+ "volume", "snapshot", "snap", "all", NULL };
switch (getsubopt(&optarg, type_subopts,
&value)) {
@@ -3038,9 +3038,10 @@ zfs_do_list(int argc, char **argv)
types |= ZFS_TYPE_VOLUME;
break;
case 2:
+ case 3:
types |= ZFS_TYPE_SNAPSHOT;
break;
- case 3:
+ case 4:
types = ZFS_TYPE_DATASET;
break;
@@ -6726,6 +6727,12 @@ main(int argc, char **argv)
cmdname = "receive";
/*
+ * The 'snap' command is an alias for 'snapshot'
+ */
+ if (strcmp(cmdname, "snap") == 0)
+ cmdname = "snapshot";
+
+ /*
* Special case '-?'
*/
if (strcmp(cmdname, "-?") == 0)
Modified: user/ed/newcons/contrib/gperf/src/search.cc
==============================================================================
--- user/ed/newcons/contrib/gperf/src/search.cc Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/contrib/gperf/src/search.cc Fri Oct 25 08:41:36 2013 (r257108)
@@ -36,7 +36,10 @@
/* ============================== Portability ============================== */
/* Assume ISO C++ 'for' scoping rule. */
-#define for if (0) ; else for
+/* This code is used to work around scoping issues with visual studio 6 from
+ * 1998. Comment it out here to queisce numerous -Wdangling-else warnings
+ * from clang.
+#define for if (0) ; else for */
/* Dynamically allocated array with dynamic extent:
Modified: user/ed/newcons/etc/Makefile
==============================================================================
--- user/ed/newcons/etc/Makefile Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/etc/Makefile Fri Oct 25 08:41:36 2013 (r257108)
@@ -139,6 +139,9 @@ BIN1+= regdomain.xml
BIN2= netstart pccard_ether rc.suspend rc.resume
MTREE= BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
+.if ${MK_TESTS} != "no"
+MTREE+= BSD.tests.dist
+.endif
.if ${MK_SENDMAIL} != "no"
MTREE+= BSD.sendmail.dist
.endif
@@ -314,6 +317,9 @@ MTREES+= mtree/BSD.debug.dist /usr/lib
.if ${MK_GROFF} != "no"
MTREES+= mtree/BSD.groff.dist /usr
.endif
+.if ${MK_TESTS} != "no"
+MTREES+= mtree/BSD.tests.dist ${TESTSBASE}
+.endif
.if ${MK_SENDMAIL} != "no"
MTREES+= mtree/BSD.sendmail.dist /
.endif
Copied: user/ed/newcons/etc/mtree/BSD.tests.dist (from r257107, head/etc/mtree/BSD.tests.dist)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/ed/newcons/etc/mtree/BSD.tests.dist Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/etc/mtree/BSD.tests.dist)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+#
+# Please see the file src/etc/mtree/README before making changes to this file.
+#
+
+/set type=dir uname=root gname=wheel mode=0755
+.
+ lib
+ libcrypt
+ ..
+ ..
+..
Modified: user/ed/newcons/etc/mtree/BSD.usr.dist
==============================================================================
--- user/ed/newcons/etc/mtree/BSD.usr.dist Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/etc/mtree/BSD.usr.dist Fri Oct 25 08:41:36 2013 (r257108)
@@ -325,8 +325,6 @@
..
ipfw
..
- iscsi
- ..
jails
..
kld
@@ -360,8 +358,6 @@
mdoc
..
netgraph
- bluetooth
- ..
..
pc-sysinstall
..
Modified: user/ed/newcons/lib/libcrypt/Makefile
==============================================================================
--- user/ed/newcons/lib/libcrypt/Makefile Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/lib/libcrypt/Makefile Fri Oct 25 08:41:36 2013 (r257108)
@@ -37,4 +37,9 @@ WARNS?= 2
PRECIOUSLIB=
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.lib.mk>
+.include <bsd.subdir.mk>
Modified: user/ed/newcons/lib/libcrypt/tests/Makefile
==============================================================================
--- user/ed/newcons/lib/libcrypt/tests/Makefile Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/lib/libcrypt/tests/Makefile Fri Oct 25 08:41:36 2013 (r257108)
@@ -2,6 +2,8 @@
# exercise libcrypt
+TESTSDIR= ${TESTSBASE}/lib/libcrypt
+
ATF_TESTS_C= crypt_tests
CFLAGS+= -I${.CURDIR:H}
Modified: user/ed/newcons/sbin/fsck_ffs/ea.c
==============================================================================
--- user/ed/newcons/sbin/fsck_ffs/ea.c Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/sbin/fsck_ffs/ea.c Fri Oct 25 08:41:36 2013 (r257108)
@@ -65,7 +65,7 @@ eascan(struct inodesc *idesc, struct ufs
char dbuf[DIRBLKSIZ];
printf("Inode %ju extsize %ju\n",
- (intmax_t)idesc->id_number, (intmax_t)dp->di_extsize);
+ (intmax_t)idesc->id_number, (uintmax_t)dp->di_extsize);
if (dp->di_extsize == 0)
return 0;
if (dp->di_extsize <= sblock.fs_fsize)
Modified: user/ed/newcons/sbin/geom/class/part/geom_part.c
==============================================================================
--- user/ed/newcons/sbin/geom/class/part/geom_part.c Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/sbin/geom/class/part/geom_part.c Fri Oct 25 08:41:36 2013 (r257108)
@@ -364,7 +364,11 @@ gpart_autofill_resize(struct gctl_req *r
}
offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment;
- last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0);
+ s = find_geomcfg(gp, "last");
+ if (s == NULL)
+ errx(EXIT_FAILURE, "Final block not found for geom %s",
+ gp->lg_name);
+ last = (off_t)strtoimax(s, NULL, 0);
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
s = find_provcfg(pp, "index");
if (s == NULL)
@@ -502,8 +506,16 @@ gpart_autofill(struct gctl_req *req)
if (size > alignment)
size = ALIGNDOWN(size, alignment);
- first = (off_t)strtoimax(find_geomcfg(gp, "first"), NULL, 0);
- last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0);
+ s = find_geomcfg(gp, "first");
+ if (s == NULL)
+ errx(EXIT_FAILURE, "Starting block not found for geom %s",
+ gp->lg_name);
+ first = (off_t)strtoimax(s, NULL, 0);
+ s = find_geomcfg(gp, "last");
+ if (s == NULL)
+ errx(EXIT_FAILURE, "Final block not found for geom %s",
+ gp->lg_name);
+ last = (off_t)strtoimax(s, NULL, 0);
grade = ~0ULL;
a_first = ALIGNUP(first + offset, alignment);
last = ALIGNDOWN(last + offset, alignment);
@@ -587,12 +599,22 @@ gpart_show_geom(struct ggeom *gp, const
int idx, wblocks, wname, wmax;
scheme = find_geomcfg(gp, "scheme");
+ if (scheme == NULL)
+ errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name);
s = find_geomcfg(gp, "first");
+ if (s == NULL)
+ errx(EXIT_FAILURE, "Starting block not found for geom %s",
+ gp->lg_name);
first = (off_t)strtoimax(s, NULL, 0);
s = find_geomcfg(gp, "last");
+ if (s == NULL)
+ errx(EXIT_FAILURE, "Final block not found for geom %s",
+ gp->lg_name);
last = (off_t)strtoimax(s, NULL, 0);
wblocks = strlen(s);
s = find_geomcfg(gp, "state");
+ if (s == NULL)
+ errx(EXIT_FAILURE, "State not found for geom %s", gp->lg_name);
if (s != NULL && *s != 'C')
s = NULL;
wmax = strlen(gp->lg_name);
@@ -748,6 +770,8 @@ gpart_backup(struct gctl_req *req, unsig
abort();
pp = LIST_FIRST(&gp->lg_consumer)->lg_provider;
s = find_geomcfg(gp, "last");
+ if (s == NULL)
+ abort();
wblocks = strlen(s);
wtype = 0;
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
@@ -757,6 +781,8 @@ gpart_backup(struct gctl_req *req, unsig
wtype = i;
}
s = find_geomcfg(gp, "entries");
+ if (s == NULL)
+ abort();
windex = strlen(s);
printf("%s %s\n", scheme, s);
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
@@ -1177,6 +1203,8 @@ gpart_bootcode(struct gctl_req *req, uns
if (gp == NULL)
errx(EXIT_FAILURE, "No such geom: %s.", s);
s = find_geomcfg(gp, "scheme");
+ if (s == NULL)
+ errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name);
vtoc8 = 0;
if (strcmp(s, "VTOC8") == 0)
vtoc8 = 1;
Modified: user/ed/newcons/sbin/growfs/debug.c
==============================================================================
--- user/ed/newcons/sbin/growfs/debug.c Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/sbin/growfs/debug.c Fri Oct 25 08:41:36 2013 (r257108)
@@ -765,7 +765,7 @@ dbg_dump_ufs2_ino(struct fs *sb, const c
fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen);
fprintf(dbg_log, "kernflags u_int32_t 0x%08x\n", ino->di_kernflags);
fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags);
- fprintf(dbg_log, "extsize int32_t 0x%08x\n", ino->di_extsize);
+ fprintf(dbg_log, "extsize u_int32_t 0x%08x\n", ino->di_extsize);
/* XXX: What do we do with di_extb[NXADDR]? */
Modified: user/ed/newcons/sbin/mdconfig/mdconfig.c
==============================================================================
--- user/ed/newcons/sbin/mdconfig/mdconfig.c Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/sbin/mdconfig/mdconfig.c Fri Oct 25 08:41:36 2013 (r257108)
@@ -481,12 +481,18 @@ md_list(const char *units, int opt, cons
printf("\n");
/* XXX: Check if it's enough to clean everything. */
geom_stats_snapshot_free(sq);
- if (((opt & OPT_UNIT) && (fflag == NULL) && ufound) ||
- ((opt & OPT_UNIT) == 0 && (fflag != NULL) && ffound) ||
- ((opt & OPT_UNIT) && (fflag != NULL) && ufound && ffound))
- return (0);
- else
- return (-1);
+ if (opt & OPT_UNIT) {
+ if (((fflag == NULL) && ufound) ||
+ ((fflag == NULL) && (units != NULL) && ufound) ||
+ ((fflag != NULL) && ffound) ||
+ ((fflag != NULL) && (units != NULL) && ufound && ffound))
+ return (0);
+ } else if (opt & OPT_LIST) {
+ if ((fflag == NULL) ||
+ ((fflag != NULL) && ffound))
+ return (0);
+ }
+ return (-1);
}
/*
Modified: user/ed/newcons/share/man/man5/src.conf.5
==============================================================================
--- user/ed/newcons/share/man/man5/src.conf.5 Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/share/man/man5/src.conf.5 Fri Oct 25 08:41:36 2013 (r257108)
@@ -1,7 +1,7 @@
.\" DO NOT EDIT-- this file is automatically generated.
.\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des
.\" $FreeBSD$
-.Dd October 6, 2013
+.Dd October 24, 2013
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -208,10 +208,6 @@ When set, it also enforces the following
.Va WITHOUT_CLANG_EXTRAS
.It
.Va WITHOUT_CLANG_FULL
-.It
-.Va WITHOUT_CLANG_IS_CC
-.It
-.Va WITHOUT_LLDB
.El
.It Va WITH_CLANG
.\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru
@@ -323,11 +319,7 @@ When set, it also enforces the following
.It
.Va WITHOUT_CLANG_FULL
.It
-.Va WITHOUT_CLANG_IS_CC
-.It
.Va WITHOUT_GROFF
-.It
-.Va WITHOUT_LLDB
.El
.It Va WITH_DEBUG_FILES
.\" from FreeBSD: head/tools/build/options/WITH_DEBUG_FILES 251512 2013-06-07 21:40:02Z emaste
@@ -910,7 +902,7 @@ This includes
.Xr rsh 1 ,
etc.
.It Va WITHOUT_RCS
-.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 156932 2006-03-21 07:50:50Z ru
+.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 256198 2013-10-09 17:07:20Z gjb
Set to not build
.Xr rcs 1
and related utilities.
@@ -1030,13 +1022,9 @@ When set, it also enforces the following
.It
.Va WITHOUT_CLANG_FULL
.It
-.Va WITHOUT_CLANG_IS_CC
-.It
.Va WITHOUT_GCC
.It
.Va WITHOUT_GDB
-.It
-.Va WITHOUT_LLDB
.El
.It Va WITHOUT_UNBOUND
.\" from FreeBSD: head/tools/build/options/WITHOUT_UNBOUND 255597 2013-09-15 14:51:23Z des
Modified: user/ed/newcons/share/man/man7/Makefile
==============================================================================
--- user/ed/newcons/share/man/man7/Makefile Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/share/man/man7/Makefile Fri Oct 25 08:41:36 2013 (r257108)
@@ -29,6 +29,10 @@ MAN= adding_user.7 \
sticky.7 \
tuning.7
+.if ${MK_TESTS} != "no"
+MAN+= tests.7
+.endif
+
MLINKS= intro.7 miscellaneous.7
MLINKS+= security.7 securelevel.7
MLINKS+= c99.7 c.7
Modified: user/ed/newcons/share/man/man7/hier.7
==============================================================================
--- user/ed/newcons/share/man/man7/hier.7 Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/share/man/man7/hier.7 Fri Oct 25 08:41:36 2013 (r257108)
@@ -32,7 +32,7 @@
.\" @(#)hier.7 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$
.\"
-.Dd January 21, 2010
+.Dd October 19, 2013
.Dt HIER 7
.Os
.Sh NAME
@@ -692,6 +692,12 @@ source code for files in
source code for files in
.Pa /usr/sbin
.El
+.Pp
+.It Pa tests/
+The
+.Fx
+test suite.
+See tests(7) for more details.
.El
.It Pa /var/
multi-purpose log, temporary, transient, and spool files
Copied: user/ed/newcons/share/man/man7/tests.7 (from r257107, head/share/man/man7/tests.7)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/ed/newcons/share/man/man7/tests.7 Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/share/man/man7/tests.7)
@@ -0,0 +1,199 @@
+.\" $FreeBSD$
+.\" $NetBSD: tests.kyua.7,v 1.2 2013/07/20 21:39:59 wiz Exp $
+.\"
+.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
+.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd October 19, 2013
+.Dt TESTS 7
+.Os
+.Sh NAME
+.Nm tests
+.Nd introduction to the FreeBSD test suite
+.Sh DESCRIPTION
+The
+.Fx
+test suite provides a collection of automated tests for two major purposes.
+On the one hand, the test suite aids
+.Em developers
+in catching bugs and regressions in the code when they performing modifications
+to the source tree.
+On the other hand, the test suite allows
+.Em end users
+(and, in particular, system administrators) to verify that fresh installations
+of the
+.Fx
+operating system behave correctly in their hardware platform and also to ensure
+that the system does not suffer from regressions during regular system
+operation and maintenance.
+.Pp
+The
+.Fx
+test suite is installed under the
+.Pa /usr/tests
+hierarchy.
+.Pp
+This manual page describes how to execute the test suite and how to configure
+some of its optional features.
+.Ss When to run the tests?
+Before diving into the details of how to run the test suite, here are some
+scenarios in which you should be running them:
+.Bl -bullet -offset indent
+.It
+After a fresh installation of
+.Fx
+to ensure that the system works correctly on your hardware platform.
+.It
+After an upgrade of
+.Fx
+to a different version to ensure that the new code works well on your
+hardware platform and that the upgrade did not introduce regressions in your
+configuration.
+.It
+After performing changes to the source tree to catch any bugs and/or regressions
+introduced by the modifications.
+.It
+Periodically, maybe from a
+.Xr cron 8
+job, to ensure that any changes to the system (such as the installation of
+third-party packages or manual modifications to configuration files) do not
+introduce unexpected failures.
+.El
+.Ss Running the tests
+First of all, you will need to install the
+.Sq ports/devel/kyua
+package.
+.Pp
+Use the following command to run the whole test suite:
+.Bd -literal -offset indent
+$ kyua test -k /usr/tests/Kyuafile
+.Ed
+.Pp
+The above will go through all test programs in
+.Pa /usr/tests
+recursively, execute them, store their results and debugging data in Kyua
+database (by default in
+.Pa ~/.kyua/store.db ) ,
+and print a summary of the results.
+This summary includes a brief count of all total tests run and how many of
+them failed.
+.Pp
+It is possible to restrict which tests to run by providing their names in
+the command line.
+For example, this would execute the tests for the
+.Xr cp 1
+and
+.Xr cut 1
+utilities:
+.Bd -literal -offset indent
+$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut
+.Ed
+.Ss Obtaining reports of the tests execution
+Additional information of the results of the execution can be later extracted
+from the database by using the various reporting commands of Kyua.
+For example, the following would extract a plain-text report of the executed
+tests and show which ones failed:
+.Bd -literal -offset indent
+$ kyua report
+.Ed
+.Pp
+This other example would generate an HTML report ready to be published on a
+web server:
+.Bd -literal -offset indent
+$ kyua report-html --output ~/public_html/tests
+.Ed
+.Pp
+For further details on the command-line interface of Kyua, please refer
+to its manual page
+.Xr kyua 1 .
+.\".Ss Configuring the tests
+.\"Some test cases in the
+.\".Fx
+.\"test suite require the administrator to manually set up some configuration
+.\"properties before they can run.
+.\"Unless these properties are defined, the tests that require them will be marked
+.\"as skipped and thus they will not be really executed.
+.\".Pp
+.\"Test suites are configured by defining the values to their configuration
+.\"variables in
+.\".Pa /usr/local/etc/kyua/kyua.conf .
+.\"The format of this file is detailed in
+.\".Xr kyua.conf 5 .
+.\".Pp
+.\"The following configuration variables are available in the
+.\".Fx
+.\"test suite:
+.\".Bl -tag
+.\".It NONE REGISTERED YET
+.\"TBD.
+.Ss What to do if something fails?
+If there is
+.Em any failure
+during the execution of the test suite, please considering reporting it to the
+.Fx
+developers so that the failure can be analyzed and fixed.
+To do so, either send a message to the appropriate mailing list or file a
+problem report.
+For more details please refer to:
+.Bl -bullet -offset indent -compact
+.It
+.Lk http://lists.freebsd.org/ "FreeBSD Mailing Lists"
+.It
+.Lk http://www.freebsd.org/send-pr.html "Submit a FreeBSD Problem Report"
+.El
+.Sh FILES
+.Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX
+.It Pa /usr/local/etc/kyua/kyua.conf
+System-wide configuration file for
+.Xr kyua 1 .
+.It Pa ~/.kyua/kyua.conf
+User-specific configuration file for
+.Xr kyua 1 ;
+overrides the system file.
+.It Pa ~/.kyua/store.db
+Default database used by Kyua to maintain the data of the executed tests.
+.It Pa /usr/tests/
+Location of the
+.Fx
+test suite.
+.It Pa /usr/tests/Kyuafile
+Top-level test suite definition file.
+.El
+.Sh SEE ALSO
+.Xr kyua 1 .
+.Sh HISTORY
+The collection of test programs in
+.Pa /usr/tests
+first appeared in
+.Fx 11.0 .
+.Pp
+The
+.Nm
+manual page first appeared in
+.Nx 6.0
+and was later ported to
+.Fx 11.0 .
+.Sh AUTHORS
+.An Julio Merino Aq Mt jmmv at google.com
Modified: user/ed/newcons/share/mk/bsd.files.mk
==============================================================================
--- user/ed/newcons/share/mk/bsd.files.mk Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/share/mk/bsd.files.mk Fri Oct 25 08:41:36 2013 (r257108)
@@ -14,9 +14,9 @@ buildfiles: ${${group}}
all: buildfiles
-.if !target(installfiles)
.for group in ${FILESGROUPS}
.if defined(${group}) && !empty(${group})
+installfiles: installfiles-${group}
${group}OWN?= ${SHAREOWN}
${group}GRP?= ${SHAREGRP}
@@ -37,7 +37,7 @@ ${group}NAME_${file:T}?= ${${group}NAME}
.else
${group}NAME_${file:T}?= ${file:T}
.endif
-installfiles: _${group}INS_${file:T}
+installfiles-${group}: _${group}INS_${file:T}
_${group}INS_${file:T}: ${file}
${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
-g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
@@ -48,7 +48,7 @@ _${group}FILES+= ${file}
.endif
.endfor
.if !empty(_${group}FILES)
-installfiles: _${group}INS
+installfiles-${group}: _${group}INS
_${group}INS: ${_${group}FILES}
.if defined(${group}NAME)
${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
@@ -63,7 +63,5 @@ _${group}INS: ${_${group}FILES}
.endif # defined(${group}) && !empty(${group})
.endfor
-.endif # !target(installfiles)
-
realinstall: installfiles
.ORDER: beforeinstall installfiles
Modified: user/ed/newcons/share/mk/bsd.own.mk
==============================================================================
--- user/ed/newcons/share/mk/bsd.own.mk Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/share/mk/bsd.own.mk Fri Oct 25 08:41:36 2013 (r257108)
@@ -377,6 +377,7 @@ __DEFAULT_NO_OPTIONS = \
PKGTOOLS \
SHARED_TOOLCHAIN \
SVN \
+ TESTS \
USB_GADGET_EXAMPLES
#
@@ -664,4 +665,8 @@ $xGRP= ${_gid}
.endif # !_WITHOUT_SRCCONF
+# Pointer to the top directory into which tests are installed. Should not be
+# overriden by Makefiles, but the user may choose to set this in src.conf(5).
+TESTSBASE?= /usr/tests
+
.endif # !target(__<bsd.own.mk>__)
Modified: user/ed/newcons/share/mk/bsd.test.mk
==============================================================================
--- user/ed/newcons/share/mk/bsd.test.mk Fri Oct 25 06:48:57 2013 (r257107)
+++ user/ed/newcons/share/mk/bsd.test.mk Fri Oct 25 08:41:36 2013 (r257108)
@@ -12,10 +12,6 @@
.include <bsd.init.mk>
-# Pointer to the top directory into which tests are installed. Should not be
-# overriden by Makefiles, but the user may choose to set this in src.conf(5).
-TESTSBASE?= /usr/tests
-
# Directory in which to install tests defined by the current Makefile.
# Makefiles have to override this to point to a subdirectory of TESTSBASE.
TESTSDIR?= .
Copied: user/ed/newcons/share/mk/plain.test.mk (from r257107, head/share/mk/plain.test.mk)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/ed/newcons/share/mk/plain.test.mk Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/share/mk/plain.test.mk)
@@ -0,0 +1,51 @@
+# $FreeBSD$
+#
+# Logic to build and install plain test programs. A plain test programs it not
+# supposed to use any specific testing framework: all it does is run some code
+# and report the test's pass or fail status via a 0 or 1 exit code.
+
+.include <bsd.init.mk>
+
+# List of C, C++ and shell test programs to build.
+#
+# Programs listed here are built according to the semantics of bsd.prog.mk for
+# PROGS, PROGS_CXX and SCRIPTS, respectively.
+#
+# Test programs registered in this manner are set to be installed into TESTSDIR
+# (which should be overriden by the Makefile) and are not required to provide a
+# manpage.
+PLAIN_TESTS_C?=
+PLAIN_TESTS_CXX?=
+PLAIN_TESTS_SH?=
+
+.if !empty(PLAIN_TESTS_C)
+PROGS+= ${PLAIN_TESTS_C}
+_TESTS+= ${PLAIN_TESTS_C}
+.for _T in ${PLAIN_TESTS_C}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+TEST_INTERFACE.${_T}= plain
+.endfor
+.endif
+
+.if !empty(PLAIN_TESTS_CXX)
+PROGS_CXX+= ${PLAIN_TESTS_CXX}
+PROGS+= ${PLAIN_TESTS_CXX}
+_TESTS+= ${PLAIN_TESTS_CXX}
+.for _T in ${PLAIN_TESTS_CXX}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+TEST_INTERFACE.${_T}= plain
+.endfor
+.endif
+
+.if !empty(PLAIN_TESTS_SH)
+SCRIPTS+= ${PLAIN_TESTS_SH}
+_TESTS+= ${PLAIN_TESTS_SH}
+.for _T in ${PLAIN_TESTS_SH}
+SCRIPTSDIR_${_T}= ${TESTSDIR}
+TEST_INTERFACE.${_T}= plain
+.endfor
+.endif
+
+.include <bsd.test.mk>
Copied: user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spi.c (from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spi.c Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c)
@@ -0,0 +1,521 @@
+/*-
+ * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo at freebsd.org>
+ * Copyright (c) 2013 Luiz Otavio O Souza <loos at freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sysctl.h>
+
+#include <machine/bus.h>
+#include <machine/cpu.h>
+#include <machine/cpufunc.h>
+#include <machine/resource.h>
+#include <machine/fdt.h>
+#include <machine/frame.h>
+#include <machine/intr.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <dev/spibus/spi.h>
+#include <dev/spibus/spibusvar.h>
+
+#include <arm/broadcom/bcm2835/bcm2835_gpio.h>
+#include <arm/broadcom/bcm2835/bcm2835_spireg.h>
+#include <arm/broadcom/bcm2835/bcm2835_spivar.h>
+
+#include "spibus_if.h"
+
+static void bcm_spi_intr(void *);
+
+#ifdef BCM_SPI_DEBUG
+static void
+bcm_spi_printr(device_t dev)
+{
+ struct bcm_spi_softc *sc;
+ uint32_t reg;
+
+ sc = device_get_softc(dev);
+ reg = BCM_SPI_READ(sc, SPI_CS);
+ device_printf(dev, "CS=%b\n", reg,
+ "\20\1CS0\2CS1\3CPHA\4CPOL\7CSPOL"
+ "\10TA\11DMAEN\12INTD\13INTR\14ADCS\15REN\16LEN"
+ "\21DONE\22RXD\23TXD\24RXR\25RXF\26CSPOL0\27CSPOL1"
+ "\30CSPOL2\31DMA_LEN\32LEN_LONG");
+ reg = BCM_SPI_READ(sc, SPI_CLK) & SPI_CLK_MASK;
+ if (reg % 2)
+ reg--;
+ if (reg == 0)
+ reg = 65536;
+ device_printf(dev, "CLK=%uMhz/%d=%luhz\n",
+ SPI_CORE_CLK / 1000000, reg, SPI_CORE_CLK / reg);
+ reg = BCM_SPI_READ(sc, SPI_DLEN) & SPI_DLEN_MASK;
+ device_printf(dev, "DLEN=%d\n", reg);
+ reg = BCM_SPI_READ(sc, SPI_LTOH) & SPI_LTOH_MASK;
+ device_printf(dev, "LTOH=%d\n", reg);
+ reg = BCM_SPI_READ(sc, SPI_DC);
+ device_printf(dev, "DC=RPANIC=%#x RDREQ=%#x TPANIC=%#x TDREQ=%#x\n",
+ (reg & SPI_DC_RPANIC_MASK) >> SPI_DC_RPANIC_SHIFT,
+ (reg & SPI_DC_RDREQ_MASK) >> SPI_DC_RDREQ_SHIFT,
+ (reg & SPI_DC_TPANIC_MASK) >> SPI_DC_TPANIC_SHIFT,
+ (reg & SPI_DC_TDREQ_MASK) >> SPI_DC_TDREQ_SHIFT);
+}
+#endif
+
+static void
+bcm_spi_modifyreg(struct bcm_spi_softc *sc, uint32_t off, uint32_t mask,
+ uint32_t value)
+{
+ uint32_t reg;
+
+ mtx_assert(&sc->sc_mtx, MA_OWNED);
+ reg = BCM_SPI_READ(sc, off);
+ reg &= ~mask;
+ reg |= value;
+ BCM_SPI_WRITE(sc, off, reg);
+}
+
+static int
+bcm_spi_clock_proc(SYSCTL_HANDLER_ARGS)
+{
+ struct bcm_spi_softc *sc;
+ uint32_t clk;
+ int error;
+
+ sc = (struct bcm_spi_softc *)arg1;
+
+ BCM_SPI_LOCK(sc);
+ clk = BCM_SPI_READ(sc, SPI_CLK);
+ BCM_SPI_UNLOCK(sc);
+ clk &= 0xffff;
+ if (clk == 0)
+ clk = 65536;
+ clk = SPI_CORE_CLK / clk;
+
+ error = sysctl_handle_int(oidp, &clk, sizeof(clk), req);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+
+ clk = SPI_CORE_CLK / clk;
+ if (clk <= 1)
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list