From owner-svn-src-projects@freebsd.org Sun Aug 9 00:15:23 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE6B69B7B96 for ; Sun, 9 Aug 2015 00:15:23 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A628EE33; Sun, 9 Aug 2015 00:15:23 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t790FNSI035633; Sun, 9 Aug 2015 00:15:23 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t790FIQB035613; Sun, 9 Aug 2015 00:15:18 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508090015.t790FIQB035613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 9 Aug 2015 00:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r286492 - in projects/collation: include lib/libc/locale sbin/geom/class/eli sbin/swapon share/man/man4 share/man/man5 sys/arm64/cavium sys/arm64/conf sys/cam/ata sys/conf sys/contrib/d... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 00:15:23 -0000 Author: bapt Date: Sun Aug 9 00:15:17 2015 New Revision: 286492 URL: https://svnweb.freebsd.org/changeset/base/286492 Log: Merge from HEAD Added: projects/collation/share/man/man4/iwm.4 - copied unchanged from r286491, head/share/man/man4/iwm.4 projects/collation/share/man/man4/iwmfw.4 - copied unchanged from r286491, head/share/man/man4/iwmfw.4 projects/collation/sys/arm64/cavium/ - copied from r286491, head/sys/arm64/cavium/ projects/collation/sys/contrib/dev/iwm/ - copied from r286491, head/sys/contrib/dev/iwm/ projects/collation/sys/dev/iwm/ - copied from r286491, head/sys/dev/iwm/ projects/collation/sys/modules/iwm/ - copied from r286491, head/sys/modules/iwm/ projects/collation/sys/modules/iwmfw/ - copied from r286491, head/sys/modules/iwmfw/ projects/collation/usr.bin/xargs/tests/regress.0P1.out - copied unchanged from r286491, head/usr.bin/xargs/tests/regress.0P1.out projects/collation/usr.bin/xargs/tests/regress.P1.out - copied unchanged from r286491, head/usr.bin/xargs/tests/regress.P1.out projects/collation/usr.bin/xargs/tests/regress.n2P0.out - copied unchanged from r286491, head/usr.bin/xargs/tests/regress.n2P0.out Modified: projects/collation/include/limits.h projects/collation/lib/libc/locale/utf8.c projects/collation/sbin/geom/class/eli/geli.8 projects/collation/sbin/geom/class/eli/geom_eli.c projects/collation/sbin/swapon/swapon.c projects/collation/share/man/man4/proto.4 projects/collation/share/man/man5/fstab.5 projects/collation/sys/arm64/conf/GENERIC projects/collation/sys/cam/ata/ata_da.c projects/collation/sys/conf/WITHOUT_SOURCELESS_UCODE projects/collation/sys/conf/files projects/collation/sys/conf/files.arm64 projects/collation/sys/conf/options projects/collation/sys/dev/ata/ata-all.c projects/collation/sys/dev/ata/chipsets/ata-intel.c projects/collation/sys/dev/ath/ath_rate/sample/sample.c projects/collation/sys/dev/ath/ath_rate/sample/sample.h projects/collation/sys/dev/ath/if_ath.c projects/collation/sys/dev/ath/if_ath_beacon.c projects/collation/sys/dev/ath/if_ath_debug.h projects/collation/sys/dev/ath/if_ath_keycache.c projects/collation/sys/dev/ath/if_ath_misc.h projects/collation/sys/dev/ath/if_ath_rx.c projects/collation/sys/dev/ath/if_ath_rx_edma.c projects/collation/sys/dev/ath/if_ath_sysctl.c projects/collation/sys/dev/ath/if_ath_tdma.c projects/collation/sys/dev/ath/if_ath_tx.c projects/collation/sys/dev/ath/if_ath_tx_edma.c projects/collation/sys/dev/ath/if_athvar.h projects/collation/sys/dev/bwi/bwimac.c projects/collation/sys/dev/bwi/bwiphy.c projects/collation/sys/dev/bwi/bwirf.c projects/collation/sys/dev/bwi/if_bwi.c projects/collation/sys/dev/bwi/if_bwivar.h projects/collation/sys/dev/bwn/if_bwn.c projects/collation/sys/dev/bwn/if_bwnvar.h projects/collation/sys/dev/if_ndis/if_ndis.c projects/collation/sys/dev/if_ndis/if_ndisvar.h projects/collation/sys/dev/ipw/if_ipw.c projects/collation/sys/dev/ipw/if_ipwvar.h projects/collation/sys/dev/iwi/if_iwi.c projects/collation/sys/dev/iwi/if_iwivar.h projects/collation/sys/dev/iwn/if_iwn.c projects/collation/sys/dev/iwn/if_iwnvar.h projects/collation/sys/dev/malo/if_malo.c projects/collation/sys/dev/malo/if_malo.h projects/collation/sys/dev/mwl/if_mwl.c projects/collation/sys/dev/mwl/if_mwl_pci.c projects/collation/sys/dev/mwl/if_mwlvar.h projects/collation/sys/dev/pci/pci_pci.c projects/collation/sys/dev/ral/if_ral_pci.c projects/collation/sys/dev/ral/rt2560.c projects/collation/sys/dev/ral/rt2560var.h projects/collation/sys/dev/ral/rt2661.c projects/collation/sys/dev/ral/rt2661var.h projects/collation/sys/dev/ral/rt2860.c projects/collation/sys/dev/ral/rt2860var.h projects/collation/sys/dev/uart/uart_bus.h projects/collation/sys/dev/uart/uart_core.c projects/collation/sys/dev/uart/uart_tty.c projects/collation/sys/dev/usb/wlan/if_rsu.c projects/collation/sys/dev/usb/wlan/if_rsureg.h projects/collation/sys/dev/usb/wlan/if_rum.c projects/collation/sys/dev/usb/wlan/if_rumvar.h projects/collation/sys/dev/usb/wlan/if_run.c projects/collation/sys/dev/usb/wlan/if_runvar.h projects/collation/sys/dev/usb/wlan/if_uath.c projects/collation/sys/dev/usb/wlan/if_uathvar.h projects/collation/sys/dev/usb/wlan/if_upgt.c projects/collation/sys/dev/usb/wlan/if_upgtvar.h projects/collation/sys/dev/usb/wlan/if_ural.c projects/collation/sys/dev/usb/wlan/if_uralvar.h projects/collation/sys/dev/usb/wlan/if_urtw.c projects/collation/sys/dev/usb/wlan/if_urtwn.c projects/collation/sys/dev/usb/wlan/if_urtwnreg.h projects/collation/sys/dev/usb/wlan/if_urtwvar.h projects/collation/sys/dev/usb/wlan/if_zyd.c projects/collation/sys/dev/usb/wlan/if_zydreg.h projects/collation/sys/dev/wi/if_wi.c projects/collation/sys/dev/wi/if_wi_pccard.c projects/collation/sys/dev/wi/if_wi_pci.c projects/collation/sys/dev/wi/if_wivar.h projects/collation/sys/dev/wpi/if_wpi.c projects/collation/sys/dev/wpi/if_wpivar.h projects/collation/sys/dev/wtap/if_wtap.c projects/collation/sys/dev/wtap/if_wtapvar.h projects/collation/sys/geom/eli/g_eli.c projects/collation/sys/geom/eli/g_eli.h projects/collation/sys/geom/eli/g_eli_ctl.c projects/collation/sys/kern/kern_tc.c projects/collation/sys/kern/uipc_mbuf.c projects/collation/sys/kern/uipc_mbuf2.c projects/collation/sys/modules/Makefile projects/collation/sys/net/if.c projects/collation/sys/net/if_llatbl.c projects/collation/sys/net/if_llatbl.h projects/collation/sys/net/route.c projects/collation/sys/net/route.h projects/collation/sys/net80211/ieee80211.c projects/collation/sys/net80211/ieee80211_ddb.c projects/collation/sys/net80211/ieee80211_freebsd.c projects/collation/sys/net80211/ieee80211_ioctl.c projects/collation/sys/net80211/ieee80211_output.c projects/collation/sys/net80211/ieee80211_power.c projects/collation/sys/net80211/ieee80211_proto.c projects/collation/sys/net80211/ieee80211_proto.h projects/collation/sys/net80211/ieee80211_regdomain.c projects/collation/sys/net80211/ieee80211_scan_sta.c projects/collation/sys/net80211/ieee80211_var.h projects/collation/sys/netinet/if_ether.c projects/collation/sys/netinet/in.c projects/collation/sys/netinet/in_pcb.c projects/collation/sys/netinet/in_pcb.h projects/collation/sys/netinet/in_rmx.c projects/collation/sys/netinet/ip_output.c projects/collation/sys/netinet/tcp_subr.c projects/collation/sys/netinet/tcp_usrreq.c projects/collation/sys/netinet/toecore.c projects/collation/sys/netinet6/in6.c projects/collation/sys/netinet6/in6_rmx.c projects/collation/sys/netinet6/ip6_mroute.c projects/collation/sys/netinet6/ip6_output.c projects/collation/sys/netinet6/ip6_var.h projects/collation/sys/netinet6/nd6.c projects/collation/sys/netinet6/nd6.h projects/collation/sys/netinet6/nd6_rtr.c projects/collation/sys/powerpc/booke/booke_machdep.c projects/collation/sys/sys/ata.h projects/collation/sys/sys/mbuf.h projects/collation/tools/build/mk/OptionalObsoleteFiles.inc projects/collation/usr.bin/units/units.c projects/collation/usr.bin/xargs/tests/Makefile projects/collation/usr.bin/xargs/tests/regress.sh projects/collation/usr.bin/xargs/xargs.c projects/collation/usr.sbin/ctld/login.c Directory Properties: projects/collation/ (props changed) projects/collation/lib/libc/ (props changed) projects/collation/sbin/ (props changed) projects/collation/share/ (props changed) projects/collation/share/man/man4/ (props changed) projects/collation/sys/ (props changed) projects/collation/sys/conf/ (props changed) Modified: projects/collation/include/limits.h ============================================================================== --- projects/collation/include/limits.h Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/include/limits.h Sun Aug 9 00:15:17 2015 (r286492) @@ -63,7 +63,7 @@ #define BC_DIM_MAX 2048 /* max array elements in bc(1) */ #define BC_SCALE_MAX 99 /* max scale value in bc(1) */ #define BC_STRING_MAX 1000 /* max const string length in bc(1) */ -#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ +#define COLL_WEIGHTS_MAX 10 /* max weights for order keyword */ #define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ #define LINE_MAX 2048 /* max bytes in an input line */ #define RE_DUP_MAX 255 /* max RE's in interval notation */ Modified: projects/collation/lib/libc/locale/utf8.c ============================================================================== --- projects/collation/lib/libc/locale/utf8.c Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/lib/libc/locale/utf8.c Sun Aug 9 00:15:17 2015 (r286492) @@ -146,18 +146,6 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, mask = 0x07; want = 4; lbound = 0x10000; -#if 0 - /* These would be illegal in the UTF-8 space */ - - } else if ((ch & 0xfc) == 0xf8) { - mask = 0x03; - want = 5; - lbound = 0x200000; - } else if ((ch & 0xfe) == 0xfc) { - mask = 0x01; - want = 6; - lbound = 0x4000000; -#endif } else { /* * Malformed input; input is not UTF-8. @@ -327,18 +315,9 @@ _UTF8_wcrtomb(char * __restrict s, wchar } else if ((wc & ~0xffff) == 0) { lead = 0xe0; len = 3; - } else if ((wc & ~0x1fffff) == 0) { + } else if (wc >= 0 && wc <= 0x10ffff) { lead = 0xf0; len = 4; -#if 0 - /* Again, 5 and 6 byte encodings are simply not permitted */ - } else if ((wc & ~0x3ffffff) == 0) { - lead = 0xf8; - len = 5; - } else if ((wc & ~0x7fffffff) == 0) { - lead = 0xfc; - len = 6; -#endif } else { errno = EILSEQ; return ((size_t)-1); Modified: projects/collation/sbin/geom/class/eli/geli.8 ============================================================================== --- projects/collation/sbin/geom/class/eli/geli.8 Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/sbin/geom/class/eli/geli.8 Sun Aug 9 00:15:17 2015 (r286492) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2015 +.Dd July 10, 2015 .Dt GELI 8 .Os .Sh NAME @@ -51,7 +51,7 @@ utility: .Pp .Nm .Cm init -.Op Fl bPv +.Op Fl bPTv .Op Fl a Ar aalgo .Op Fl B Ar backupfile .Op Fl e Ar ealgo @@ -80,7 +80,7 @@ utility: .Cm detach .Nm .Cm onetime -.Op Fl d +.Op Fl dT .Op Fl a Ar aalgo .Op Fl e Ar ealgo .Op Fl l Ar keylen @@ -88,7 +88,7 @@ utility: .Ar prov .Nm .Cm configure -.Op Fl bB +.Op Fl bBtT .Ar prov ... .Nm .Cm setkey @@ -351,6 +351,17 @@ Change decrypted provider's sector size. Increasing the sector size allows increased performance, because encryption/decryption which requires an initialization vector is done per sector; fewer sectors means less computational work. +.It Fl T +Don't pass through +.Dv BIO_DELETE +calls (i.e., TRIM/UNMAP). +This can prevent an attacker from knowing how much space you're actually +using and which sectors contain live data, but will also prevent the +backing store (SSD, etc) from reclaiming space you're not using, which +may degrade its performance and lifespan. +The underlying provider may or may not actually obliterate the deleted +sectors when TRIM is enabled, so it should not be considered to add any +security. .It Fl V Ar version Metadata version to use. This option is helpful when creating a provider that may be used by older @@ -456,6 +467,11 @@ Change decrypted provider's sector size. For more information, see the description of the .Cm init subcommand. +.It Fl T +Disable TRIM/UNMAP passthru. +For more information, see the description of the +.Cm init +subcommand. .El .It Cm configure Change configuration of the given providers. @@ -469,6 +485,13 @@ For more information, see the descriptio subcommand. .It Fl B Remove the BOOT flag from the given providers. +.It Fl t +Enable TRIM/UNMAP passthru. +For more information, see the description of the +.Cm init +subcommand. +.It Fl T +Disable TRIM/UNMAP passthru. .El .It Cm setkey Install a copy of the Master Key into the selected slot, encrypted with Modified: projects/collation/sbin/geom/class/eli/geom_eli.c ============================================================================== --- projects/collation/sbin/geom/class/eli/geom_eli.c Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/sbin/geom/class/eli/geom_eli.c Sun Aug 9 00:15:17 2015 (r286492) @@ -114,10 +114,11 @@ struct g_command class_commands[] = { { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, + { 'T', "notrim", NULL, G_TYPE_BOOL }, { 'V', "mdversion", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" + "[-bPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { @@ -170,17 +171,20 @@ struct g_command class_commands[] = { { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, { 'l', "keylen", "0", G_TYPE_NUMBER }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, + { 'T', "notrim", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-d] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" + "[-dT] [-a aalgo] [-e ealgo] [-l keylen] [-s sectorsize] prov" }, { "configure", G_FLAG_VERBOSE, eli_main, { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "noboot", NULL, G_TYPE_BOOL }, + { 't', "trim", NULL, G_TYPE_BOOL }, + { 'T', "notrim", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-bB] prov ..." + "[-bBtT] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { @@ -698,6 +702,8 @@ eli_init(struct gctl_req *req) md.md_flags = 0; if (gctl_get_int(req, "boot")) md.md_flags |= G_ELI_FLAG_BOOT; + if (gctl_get_int(req, "notrim")) + md.md_flags |= G_ELI_FLAG_NODELETE; md.md_ealgo = CRYPTO_ALGORITHM_MIN - 1; str = gctl_get_ascii(req, "aalgo"); if (*str != '\0') { @@ -899,26 +905,45 @@ eli_attach(struct gctl_req *req) } static void -eli_configure_detached(struct gctl_req *req, const char *prov, bool boot) +eli_configure_detached(struct gctl_req *req, const char *prov, int boot, + int trim) { struct g_eli_metadata md; + bool changed = 0; if (eli_metadata_read(req, prov, &md) == -1) return; - if (boot && (md.md_flags & G_ELI_FLAG_BOOT)) { + if (boot == 1 && (md.md_flags & G_ELI_FLAG_BOOT)) { if (verbose) printf("BOOT flag already configured for %s.\n", prov); - } else if (!boot && !(md.md_flags & G_ELI_FLAG_BOOT)) { + } else if (boot == 0 && !(md.md_flags & G_ELI_FLAG_BOOT)) { if (verbose) printf("BOOT flag not configured for %s.\n", prov); - } else { + } else if (boot >= 0) { if (boot) md.md_flags |= G_ELI_FLAG_BOOT; else md.md_flags &= ~G_ELI_FLAG_BOOT; - eli_metadata_store(req, prov, &md); + changed = 1; + } + + if (trim == 0 && (md.md_flags & G_ELI_FLAG_NODELETE)) { + if (verbose) + printf("TRIM disable flag already configured for %s.\n", prov); + } else if (trim == 1 && !(md.md_flags & G_ELI_FLAG_NODELETE)) { + if (verbose) + printf("TRIM disable flag not configured for %s.\n", prov); + } else if (trim >= 0) { + if (trim) + md.md_flags &= ~G_ELI_FLAG_NODELETE; + else + md.md_flags |= G_ELI_FLAG_NODELETE; + changed = 1; } + + if (changed) + eli_metadata_store(req, prov, &md); bzero(&md, sizeof(md)); } @@ -926,7 +951,8 @@ static void eli_configure(struct gctl_req *req) { const char *prov; - bool boot, noboot; + bool boot, noboot, trim, notrim; + int doboot, dotrim; int i, nargs; nargs = gctl_get_int(req, "nargs"); @@ -937,12 +963,30 @@ eli_configure(struct gctl_req *req) boot = gctl_get_int(req, "boot"); noboot = gctl_get_int(req, "noboot"); + trim = gctl_get_int(req, "trim"); + notrim = gctl_get_int(req, "notrim"); + doboot = -1; if (boot && noboot) { gctl_error(req, "Options -b and -B are mutually exclusive."); return; } - if (!boot && !noboot) { + if (boot) + doboot = 1; + else if (noboot) + doboot = 0; + + dotrim = -1; + if (trim && notrim) { + gctl_error(req, "Options -t and -T are mutually exclusive."); + return; + } + if (trim) + dotrim = 1; + else if (notrim) + dotrim = 0; + + if (doboot == -1 && dotrim == -1) { gctl_error(req, "No option given."); return; } @@ -953,7 +997,7 @@ eli_configure(struct gctl_req *req) for (i = 0; i < nargs; i++) { prov = gctl_get_ascii(req, "arg%d", i); if (!eli_is_attached(prov)) - eli_configure_detached(req, prov, boot); + eli_configure_detached(req, prov, doboot, dotrim); } } Modified: projects/collation/sbin/swapon/swapon.c ============================================================================== --- projects/collation/sbin/swapon/swapon.c Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/sbin/swapon/swapon.c Sun Aug 9 00:15:17 2015 (r286492) @@ -313,7 +313,7 @@ static char * swap_on_geli_args(const char *mntops) { const char *aalgo, *ealgo, *keylen_str, *sectorsize_str; - const char *aflag, *eflag, *lflag, *sflag; + const char *aflag, *eflag, *lflag, *Tflag, *sflag; char *p, *args, *token, *string, *ops; int argsize, pagesize; size_t pagesize_len; @@ -321,7 +321,7 @@ swap_on_geli_args(const char *mntops) /* Use built-in defaults for geli(8). */ aalgo = ealgo = keylen_str = ""; - aflag = eflag = lflag = ""; + aflag = eflag = lflag = Tflag = ""; /* We will always specify sectorsize. */ sflag = " -s "; @@ -365,6 +365,8 @@ swap_on_geli_args(const char *mntops) free(ops); return (NULL); } + } else if ((p = strstr(token, "notrim")) == token) { + Tflag = " -T "; } else if (strcmp(token, "sw") != 0) { warnx("Invalid option: %s", token); free(ops); @@ -387,8 +389,8 @@ swap_on_geli_args(const char *mntops) sectorsize_str = p; } - argsize = asprintf(&args, "%s%s%s%s%s%s%s%s -d", - aflag, aalgo, eflag, ealgo, lflag, keylen_str, + argsize = asprintf(&args, "%s%s%s%s%s%s%s%s%s -d", + aflag, aalgo, eflag, ealgo, lflag, keylen_str, Tflag, sflag, sectorsize_str); free(ops); Copied: projects/collation/share/man/man4/iwm.4 (from r286491, head/share/man/man4/iwm.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/collation/share/man/man4/iwm.4 Sun Aug 9 00:15:17 2015 (r286492, copy of r286491, head/share/man/man4/iwm.4) @@ -0,0 +1,153 @@ +.\" Copyright (c) 2004-2006 +.\" Damien Bergamini . 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 unmodified, 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 1, 2015 +.Dt IWM 4 +.Os +.Sh NAME +.Nm iwm +.Nd Intel IEEE 802.11ac wireless network driver +.Sh SYNOPSIS +To compile this driver into the kernel, +include the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iwm" +.Cd "device pci" +.Cd "device wlan" +.Cd "device firmware" +.Ed +.Pp +You also need to select a firmware for your device. +Choose one from: +.Bd -ragged -offset indent +.Cd "device iwm3160fw" +.Cd "device iwm7260fw" +.Cd "device iwm7265fw" +.Ed +.Pp +Or you can use +.Bd -ragged -offset indent +.Cd "device iwmfw" +.Ed +.Pp +to include them all. +.Pp +Alternatively, to load the driver as a +module at boot time, place the following lines in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_iwm_load="YES" +iwm3160fw_load="YES" +iwm7260fw_load="YES" +iwm7265fw_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for: +.Pp +.Bl -tag -width Ds -offset indent -compact +.It Intel Dual Band Wireless AC 3160 +.It Intel Dual Band Wireless AC 7260 +.It Intel Dual Band Wireless AC 7265 +.El +.Pp +.Nm +supports +.Cm station +mode operation. +Only one virtual interface may be configured at any time. +For more information on configuring this device, see +.Xr ifconfig 8 . +.Pp +This driver requires the firmware built with the +.Nm iwmfw +module to work. +.Sh EXAMPLES +Join an existing BSS network (i.e., connect to an access point): +.Bd -literal -offset indent +ifconfig wlan create wlandev iwm0 inet 192.168.0.20 \e + netmask 0xffffff00 +.Ed +.Pp +Join a specific BSS network with network name +.Dq Li my_net : +.Pp +.Dl "ifconfig wlan create wlandev iwm0 ssid my_net up" +.Pp +Join a specific BSS network with 64-bit WEP encryption: +.Bd -literal -offset indent +ifconfig wlan create wlandev iwm0 ssid my_net \e + wepmode on wepkey 0x1234567890 weptxkey 1 up +.Ed +.Pp +Join a specific BSS network with 128-bit WEP encryption: +.Bd -literal -offset indent +ifconfig wlan create wlandev iwm0 wlanmode adhoc ssid my_net \e + wepmode on wepkey 0x01020304050607080910111213 weptxkey 1 +.Ed +.Sh DIAGNOSTICS +.Bl -diag +.It "iwm%d: device timeout" +The driver will reset the hardware. +This should not happen. +.It "iwm%d: firmware error" +The onboard microcontroller crashed for some reason. +The driver will reset the hardware. +This should not happen. +.It "iwm%d: timeout waiting for firmware initialization to complete" +The onboard microcontroller failed to initialize in time. +This should not happen. +.It "iwm%d: could not load firmware image '%s'" +The driver failed to load the firmware image using the +.Xr firmware 9 +subsystem. +Verify the +.Xr iwmfw 4 +firmware module is present. +.It "iwm%d: could not load boot firmware" +An attempt to upload the boot firmware image to the onboard microcontroller +failed. +This should not happen. +.It "iwm%d: could not load microcode" +An attempt to upload the microcode image to the onboard microcontroller failed. +This should not happen. +.It "iwm%d: could not load main firmware" +An attempt to upload the main firmware image to the onboard microcontroller +failed. +This should not happen. +.El +.Sh SEE ALSO +.Xr iwmfw 4 , +.Xr pci 4 , +.Xr wlan 4 , +.Xr wlan_ccmp 4 , +.Xr wlan_tkip 4 , +.Xr wlan_wep 4 , +.Xr ifconfig 8 , +.Xr wpa_supplicant 8 Copied: projects/collation/share/man/man4/iwmfw.4 (from r286491, head/share/man/man4/iwmfw.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/collation/share/man/man4/iwmfw.4 Sun Aug 9 00:15:17 2015 (r286492, copy of r286491, head/share/man/man4/iwmfw.4) @@ -0,0 +1,66 @@ +.\" Copyright (c) 2009 Sam Leffler, Errno Consulting +.\" 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. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. +.\" +.\" $FreeBSD$ +.\" +.Dd May 28, 2015 +.Dt IWMFW 4 +.Os +.Sh NAME +.Nm iwmfw +.Nd "Firmware Module for Intel Wireless driver" +.Sh SYNOPSIS +To compile this module into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iwmfw" +.Ed +.Pp +This will include firmware images for all +.Xr iwm 4 +devices inside the kernel. +If you want to pick only the firmware image for your network adapter choose one +of the following: +.Bd -ragged -offset indent +.Cd "device iwm3160fw" +.Cd "device iwm7260fw" +.Cd "device iwm7265fw" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +iwm3160fw_load="YES" +iwm7260fw_load="YES" +iwm7265fw_load="YES" +.Ed +.Sh DESCRIPTION +This module provides access to firmware sets for the +Intel Dual Band Wireless WiFi 3160, 7260 and 7265 series of +IEEE 802.11n/11ac adapters. +It may be +statically linked into the kernel, or loaded as a module. +.Sh SEE ALSO +.Xr iwm 4 , +.Xr firmware 9 Modified: projects/collation/share/man/man4/proto.4 ============================================================================== --- projects/collation/share/man/man4/proto.4 Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/share/man/man4/proto.4 Sun Aug 9 00:15:17 2015 (r286492) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2015 +.Dd August 7, 2015 .Dt PROTO 4 .Os .\" @@ -74,7 +74,285 @@ logic in user space. Especially hardware diagnostics requires a somewhat user-friendly interface and adequate reporting. Neither is done easily as kernel code. -.\" +.Ss I/O port resources +Device special files created for I/O port resources allow +.Xr lseek 2 , +.Xr read 2 , +.Xr write 2 +and +.Xr ioctl 2 +operations to be performed on them. +The +.Xr read 2 +and +.Xr write 2 +system calls are used to perform input and output (resp.) on the port. +The amount of data that can be read or written at any single time is either +1, 2 or 4 bytes. +While the +.Nm +driver does not prevent reading or writing 8 bytes at a time for some +architectures, it should not be assumed that such actually produces +correct results. +The +.Xr lseek 2 +system call is used to select the port number, relative to the I/O port +region being represented by the device special file. +If, for example, the device special file corresponds to an I/O port region +from 0x3f8 to 0x3ff inclusive, then an offset of 4 given to lseek with a +whence value of SEEK_SET will target port 0x3fc on the next read or write +operation. +The +.Xr ioctl 2 +system call can be used for the +.Dv PROTO_IOC_REGION +request. +This ioctl request returns the extend of the resource covered by this +device special file. The extend is returned in the following structure: +.Bd -literal +struct proto_ioc_region { + unsigned long address; + unsigned long size; +}; +.Ed +.Ss Memory mapped I/O resources +The device special files created for memory mapped I/O resources behave +in the same way as those created for I/O port resources. +Additionally, device special files for memory mapped I/O resources allow +the memory to be mapped into the process' address space using +.Xr mmap 2 . +Reads and writes to the memory address returned by +.Xr mmap 2 +go directly to the hardware. +As such the use of +.Xr read 2 +and +.Xr write 2 +can be avoided, reducing the access overhead significantly. +Alignment and access width constraints put forth by the underlying device +apply. +Also, make sure the compiler does not optimize memory accesses away or has +them coalesced into bigger accesses. +.Ss DMA pseudo resource +A device special file named +.Pa busdma +is created for the purpose of doing DMA. +It only supports +.Xr ioctl 2 +and only for the +.Dv PROTO_IOC_BUSDMA +request. +This device special file does not support +.Xr read 2 +nor +.Xr write 2 . +The +.Dv PROTO_IOC_BUSDMA +request has an argument that is both in and out and is defined as +follows: +.Bd -literal +struct proto_ioc_busdma { + unsigned int request; + unsigned long key; + union { + struct { + unsigned long align; + unsigned long bndry; + unsigned long maxaddr; + unsigned long maxsz; + unsigned long maxsegsz; + unsigned int nsegs; + unsigned int datarate; + unsigned int flags; + } tag; + struct { + unsigned long tag; + unsigned int flags; + unsigned long virt_addr; + unsigned long virt_size; + unsigned int phys_nsegs; + unsigned long phys_addr; + unsigned long bus_addr; + unsigned int bus_nsegs; + } md; + struct { + unsigned int op; + unsigned long base; + unsigned long size; + } sync; + } u; + unsigned long result; +}; +.Ed +The +.Va request +field is used to specify which DMA operation is to be performed. +The +.Va key +field is used to specify which object the operation applies to. +An object is either a tag or a memory descriptor (md). +The following DMA operations are defined: +.Bl -tag -width XXXX +.It PROTO_IOC_BUSDMA_TAG_CREATE +Create a root tag. +The +.Va result +field is set on output with the key of the DMA tag. +The tag is created with the constraints given by the +.Va tag +sub-structure. These constraints correspond roughly to those that can be +given to the +.Xr bus_dma_tag_create 9 +function. +.It PROTO_IOC_BUSDMA_TAG_DERIVE +Create a derived tag. +The +.Va key +field is used to identify the parent tag from which to derive the new tag. +The key of the derived tag is returned in the +.Va result +field. +The derived tag combines the constraints of the parent tag with those +given by the +.Va tag +sub-structure. +The combined constraints are written back to the +.Va tag +sub-structure on return. +.It PROTO_IOC_BUSDMA_TAG_DESTROY +Destroy a root or derived tag previously created. +The +.Va key +field specifies the tag to destroy. +A tag can only be destroyed when not referenced anymore. +This means that derived tags that have this tag as a parent and memory +descriptors created from this tag must be destroyed first. +.It PROTO_IOC_BUSDMA_MEM_ALLOC +Allocate memory that satisfies the constraints put forth by the tag +given in the +.Va tag +field of the +.Va md +sub-structure. +The key of the memory descriptor for this memory is returned in the +.Va result +field. +The +.Va md +sub-structure is filled on return with details of the allocation. +The kernel virtual address and the size of the allocated memory are returned +in the +.Va virt_addr +and +.Va virt_size +fields. +The number of contigous physical memory segments and the address of the first +segment are returned in the +.Va phys_nsegs +and +.Va phys_addr +fields. +Allocated memory is automatically loaded and thus mapped into bus space. +The number of bus segments and the address of the first segment are returned +in the +.Va bus_nsegs +and +.Va bus_addr +fields. +The behaviour of this operation banks heavily on how +.Xr bus_dmamem_alloc 9 +is implemented, which means that memory is currently always allocated as a +single contigous region of physical memory. +In practice this also tends to give a single contigous region in bus space. +This may change over time. +.It PROTO_IOC_BUSDMA_MEM_FREE +Free previously allocated memory and destroy the memory desciptor. +The +.Nm +driver is not in a position to track whether the memory has been mapped in +the process' address space, so the application is responsible for unmapping +the memory before it is freed. +The +.Nm +driver also cannot protect against the hardware writing to or reading from +the memory, even after it has been freed. +When the memory is reused for other purposes it can be corrupted or cause +the hardware to behave in unpredictable ways when DMA has not stopped +completely before freeing. +.It PROTO_IOC_BUSDMA_MD_CREATE +Create an empty memory descriptor with the tag specified in the +.Va tag +field of the +.Va md +sub-structure. +The key of the memory descriptor is returned in the +.Va result +field. +.It PROTO_IOC_BUSDMA_MD_DESTROY +Destroy the previously created memory descriptor specified by the +.Va key +field. +When the memory descriptor is still loaded, it is unloaded first. +.It PROTO_IOC_BUSDMA_MD_LOAD +Load a contigous region of memory in the memory descriptor specified by the +.Va key +field. +The size and address in the process' virtual address space are specified +by the +.Va virt_size +and +.Va virt_addr +fields. +On return, the +.Va md +sub-structure contains the result of the operation. +The number of physical segments and the address of the first segment is +returned in the +.Va phys_nsegs +and +.Va phys_addr +fields. +The number of bus space segments and the address of the first segment in +bus space is returned in the +.Va bus_nsegs +and +.Va bus_addr +fields. +.It PROTO_IOC_BUSDMA_MD_UNLOAD +Unload the memory descriptor specified by the +.Va key +field. +.It PROTO_IOC_BUSDMA_SYNC +Guarantee that all hardware components have a coherent view of the memory +tracked by the memory descriptor, specified by the +.Va key +field. +A sub-section of the memory can be targeted by specifying the relative +offset and size of the memory to make coherent. +The offset and size are given by the +.Va base +and +.Va size +fields of the +.Va sync +sub-structure. +The +.Va op +field holds the sync operation to be performed. +This is similar to the +.Xr bus_dmamap_sync 9 +function. +.El +.Ss PCI configuration space +Access to PCI configuration space is possible through the +.Pa pcicfg +device special file. +The device special file supports +.Xr lseek 2 , +.Xr read 2 +and +.Xr write 2 . +Usage is the asme as for I/O port resources. .Sh FILES All device special files corresponding to a PCI device are located under .Pa /dev/proto/pci::: @@ -152,6 +430,16 @@ A legacy floppy controller will have the .It Pa /dev/proto/isa:0x3f0/busdma .El .\" +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr lseek 2 , +.Xr mmap 2 , +.Xr read 2 , +.Xr write 2 , +.Xr bus_dma_tag_create 9 , +.Xr bus_dmamap_sync 9 , +.Xr bus_dmamem_alloc 9 +.\" .Sh AUTHORS The .Nm @@ -166,6 +454,13 @@ It is not advisable to use this driver o .Sh MISSING FUNCTIONALITY The .Nm +driver does not fully support memory descriptors that need multiple +physical memory segments or multiple bus space segments. +At the very least, an operation is needed on the DMA pseudo resource +for the application to obtain all segments. +.Pp +The +.Nm driver does not yet support interrupts. Since interrupts cannot be handled by the driver itself, they must be converted into signals and delivered to the program that has registered Modified: projects/collation/share/man/man5/fstab.5 ============================================================================== --- projects/collation/share/man/man5/fstab.5 Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/share/man/man5/fstab.5 Sun Aug 9 00:15:17 2015 (r286492) @@ -242,6 +242,7 @@ The .Dq ealgo , .Dq aalgo , .Dq keylen , +.Dq notrim , and .Dq sectorsize options may be passed to control those Modified: projects/collation/sys/arm64/conf/GENERIC ============================================================================== --- projects/collation/sys/arm64/conf/GENERIC Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/sys/arm64/conf/GENERIC Sun Aug 9 00:15:17 2015 (r286492) @@ -89,6 +89,20 @@ device virtio_mmio device virtio_blk device vtnet +# Bus drivers +device pci +device thunder_pci + +# Ethernet NICs +device em # Intel PRO/1000 Gigabit Ethernet Family +device mii +device miibus # MII bus support + +# Block devices +device ahci +device scbus +device da + # Serial (COM) ports device uart # Generic UART driver device pl011 Modified: projects/collation/sys/cam/ata/ata_da.c ============================================================================== --- projects/collation/sys/cam/ata/ata_da.c Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/sys/cam/ata/ata_da.c Sun Aug 9 00:15:17 2015 (r286492) @@ -767,10 +767,6 @@ adastrategy(struct bio *bp) * Place it in the queue of disk activities for this disk */ if (bp->bio_cmd == BIO_DELETE) { - KASSERT((softc->flags & ADA_FLAG_CAN_TRIM) || - ((softc->flags & ADA_FLAG_CAN_CFA) && - !(softc->flags & ADA_FLAG_CAN_48BIT)), - ("BIO_DELETE but no supported TRIM method.")); bioq_disksort(&softc->trim_queue, bp); } else { if (ADA_SIO) @@ -1544,7 +1540,14 @@ adastart(struct cam_periph *periph, unio !(softc->flags & ADA_FLAG_CAN_48BIT)) { ada_cfaerase(softc, bp, ataio); } else { - panic("adastart: BIO_DELETE without method, not possible."); + /* This can happen if DMA was disabled. */ + bioq_remove(&softc->trim_queue, bp); + bp->bio_error = EOPNOTSUPP; + bp->bio_flags |= BIO_ERROR; + biodone(bp); + xpt_release_ccb(start_ccb); + adaschedule(periph); + return; } softc->trim_running = 1; start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM; Modified: projects/collation/sys/conf/WITHOUT_SOURCELESS_UCODE ============================================================================== --- projects/collation/sys/conf/WITHOUT_SOURCELESS_UCODE Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/sys/conf/WITHOUT_SOURCELESS_UCODE Sun Aug 9 00:15:17 2015 (r286492) @@ -20,6 +20,7 @@ nodevice cp nodevice ctau nodevice ipwfw nodevice iwifw +nodevice iwmfw nodevice iwnfw nodevice wpifw Modified: projects/collation/sys/conf/files ============================================================================== --- projects/collation/sys/conf/files Sun Aug 9 00:06:56 2015 (r286491) +++ projects/collation/sys/conf/files Sun Aug 9 00:15:17 2015 (r286492) @@ -1605,6 +1605,58 @@ iwi_monitor.fw optional iwimonitorfw | compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "iwi_monitor.fw" +dev/iwm/if_iwm.c optional iwm +dev/iwm/if_iwm_binding.c optional iwm +dev/iwm/if_iwm_mac_ctxt.c optional iwm +dev/iwm/if_iwm_pcie_trans.c optional iwm +dev/iwm/if_iwm_phy_ctxt.c optional iwm +dev/iwm/if_iwm_phy_db.c optional iwm +dev/iwm/if_iwm_power.c optional iwm +dev/iwm/if_iwm_scan.c optional iwm +dev/iwm/if_iwm_time_event.c optional iwm +dev/iwm/if_iwm_util.c optional iwm +iwm3160fw.c optional iwm3160fw | iwmfw \ + compile-with "${AWK} -f $S/tools/fw_stub.awk iwm3160.fw:iwm3160fw -miwm3160fw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "iwm3160fw.c" +iwm3160fw.fwo optional iwm3160fw | iwmfw \ + dependency "iwm3160.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "iwm3160fw.fwo" +iwm3160.fw optional iwm3160fw | iwmfw \ + dependency "$S/contrib/dev/iwm/iwm-3160-9.fw.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "iwm3160.fw" +iwm7260fw.c optional iwm7260fw | iwmfw \ + compile-with "${AWK} -f $S/tools/fw_stub.awk iwm7260.fw:iwm7260fw -miwm7260fw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "iwm7260fw.c" +iwm7260fw.fwo optional iwm7260fw | iwmfw \ + dependency "iwm7260.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "iwm7260fw.fwo" +iwm7260.fw optional iwm7260fw | iwmfw \ + dependency "$S/contrib/dev/iwm/iwm-7260-9.fw.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "iwm7260.fw" +iwm7265fw.c optional iwm7265fw | iwmfw \ + compile-with "${AWK} -f $S/tools/fw_stub.awk iwm7265.fw:iwm7265fw -miwm7265fw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "iwm7265fw.c" +iwm7265fw.fwo optional iwm7265fw | iwmfw \ + dependency "iwm7265.fw" \ + compile-with "${NORMAL_FWO}" \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***