From owner-svn-src-head@freebsd.org Sun Jul 9 06:40:17 2017 Return-Path: Delivered-To: svn-src-head@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 D8FD9DAC1E0; Sun, 9 Jul 2017 06:40:17 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A57EE79BB5; Sun, 9 Jul 2017 06:40:17 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v696eGJ3036326; Sun, 9 Jul 2017 06:40:16 GMT (envelope-from netchild@FreeBSD.org) Received: (from netchild@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v696eG59036325; Sun, 9 Jul 2017 06:40:16 GMT (envelope-from netchild@FreeBSD.org) Message-Id: <201707090640.v696eG59036325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: netchild set sender to netchild@FreeBSD.org using -f From: Alexander Leidinger Date: Sun, 9 Jul 2017 06:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320826 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: netchild X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 320826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 06:40:17 -0000 Author: netchild Date: Sun Jul 9 06:40:16 2017 New Revision: 320826 URL: https://svnweb.freebsd.org/changeset/base/320826 Log: - Extend pr_allow flags visually to 32 bits, to make it more obvious at first look how much flags we still have available to use in the future. - Add kmem_access flag as a placeholder (reserve it), not used yet. Differential Revision: D11451 Reviewed by: jamie Sponsored by: Hackathon Essen 2017 Modified: head/sys/sys/jail.h Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Sun Jul 9 04:34:22 2017 (r320825) +++ head/sys/sys/jail.h Sun Jul 9 06:40:16 2017 (r320826) @@ -215,23 +215,24 @@ struct prison_racct { /* by this jail or an ancestor */ /* Flags for pr_allow */ -#define PR_ALLOW_SET_HOSTNAME 0x0001 -#define PR_ALLOW_SYSVIPC 0x0002 -#define PR_ALLOW_RAW_SOCKETS 0x0004 -#define PR_ALLOW_CHFLAGS 0x0008 -#define PR_ALLOW_MOUNT 0x0010 -#define PR_ALLOW_QUOTAS 0x0020 -#define PR_ALLOW_SOCKET_AF 0x0040 -#define PR_ALLOW_MOUNT_DEVFS 0x0080 -#define PR_ALLOW_MOUNT_NULLFS 0x0100 -#define PR_ALLOW_MOUNT_ZFS 0x0200 -#define PR_ALLOW_MOUNT_PROCFS 0x0400 -#define PR_ALLOW_MOUNT_TMPFS 0x0800 -#define PR_ALLOW_MOUNT_FDESCFS 0x1000 -#define PR_ALLOW_MOUNT_LINPROCFS 0x2000 -#define PR_ALLOW_MOUNT_LINSYSFS 0x4000 -#define PR_ALLOW_RESERVED_PORTS 0x8000 -#define PR_ALLOW_ALL 0xffff +#define PR_ALLOW_SET_HOSTNAME 0x00000001 +#define PR_ALLOW_SYSVIPC 0x00000002 +#define PR_ALLOW_RAW_SOCKETS 0x00000004 +#define PR_ALLOW_CHFLAGS 0x00000008 +#define PR_ALLOW_MOUNT 0x00000010 +#define PR_ALLOW_QUOTAS 0x00000020 +#define PR_ALLOW_SOCKET_AF 0x00000040 +#define PR_ALLOW_MOUNT_DEVFS 0x00000080 +#define PR_ALLOW_MOUNT_NULLFS 0x00000100 +#define PR_ALLOW_MOUNT_ZFS 0x00000200 +#define PR_ALLOW_MOUNT_PROCFS 0x00000400 +#define PR_ALLOW_MOUNT_TMPFS 0x00000800 +#define PR_ALLOW_MOUNT_FDESCFS 0x00001000 +#define PR_ALLOW_MOUNT_LINPROCFS 0x00002000 +#define PR_ALLOW_MOUNT_LINSYSFS 0x00004000 +#define PR_ALLOW_RESERVED_PORTS 0x00008000 +#define PR_ALLOW_KMEM_ACCESS 0x00010000 /* reserved, not used yet */ +#define PR_ALLOW_ALL 0x0001ffff /* * OSD methods From owner-svn-src-head@freebsd.org Sun Jul 9 06:50:16 2017 Return-Path: Delivered-To: svn-src-head@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 77F5FDAC465; Sun, 9 Jul 2017 06:50:16 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 44CC379FF2; Sun, 9 Jul 2017 06:50:16 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v696oFYx040444; Sun, 9 Jul 2017 06:50:15 GMT (envelope-from netchild@FreeBSD.org) Received: (from netchild@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v696oFW5040443; Sun, 9 Jul 2017 06:50:15 GMT (envelope-from netchild@FreeBSD.org) Message-Id: <201707090650.v696oFW5040443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: netchild set sender to netchild@FreeBSD.org using -f From: Alexander Leidinger Date: Sun, 9 Jul 2017 06:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320827 - head/sys/dev/drm X-SVN-Group: head X-SVN-Commit-Author: netchild X-SVN-Commit-Paths: head/sys/dev/drm X-SVN-Commit-Revision: 320827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 06:50:16 -0000 Author: netchild Date: Sun Jul 9 06:50:15 2017 New Revision: 320827 URL: https://svnweb.freebsd.org/changeset/base/320827 Log: Switch prison check from PROV_DRIVER to PRIV_KMEM_WRITE (like /dev/mem). Access to the dri device gives effectively access to the entire memory of the machine (you can program the graphic card to do DMA). For current/stable/release this is a NOP, as access to memory is not allowed in a jail. This puts the dri device into the same (in)security class than /dev/mem for future use. Discussed with: anholt(?) several years ago Sponsored by: Hackathon Essen 2017 Modified: head/sys/dev/drm/drmP.h Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Sun Jul 9 06:40:16 2017 (r320826) +++ head/sys/dev/drm/drmP.h Sun Jul 9 06:50:15 2017 (r320827) @@ -220,7 +220,7 @@ enum { #define PAGE_ALIGN(addr) round_page(addr) /* DRM_SUSER returns true if the user is superuser */ -#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0) +#define DRM_SUSER(p) (priv_check(p, PRIV_KMEM_WRITE) == 0) #define DRM_AGP_FIND_DEVICE() agp_find_device() #define DRM_MTRR_WC MDF_WRITECOMBINE #define jiffies ticks From owner-svn-src-head@freebsd.org Sun Jul 9 12:13:38 2017 Return-Path: Delivered-To: svn-src-head@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 68683DB1115; Sun, 9 Jul 2017 12:13:38 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4287C824B4; Sun, 9 Jul 2017 12:13:38 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69CDbBl078029; Sun, 9 Jul 2017 12:13:37 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69CDbOm078028; Sun, 9 Jul 2017 12:13:37 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201707091213.v69CDbOm078028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 9 Jul 2017 12:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320829 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 320829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 12:13:38 -0000 Author: bde Date: Sun Jul 9 12:13:37 2017 New Revision: 320829 URL: https://svnweb.freebsd.org/changeset/base/320829 Log: Move open coding of construction of attributes for cut regions and text cursors to functions so that it is easier to fix and improve. This commit doesn't fix anything except for removing unnecessary complications and adding comments. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Sun Jul 9 10:34:31 2017 (r320828) +++ head/sys/dev/syscons/scvgarndr.c Sun Jul 9 12:13:37 2017 (r320829) @@ -344,6 +344,46 @@ static int vga_aspect_scale= 100; SYSCTL_INT(_machdep, OID_AUTO, vga_aspect_scale, CTLFLAG_RW, &vga_aspect_scale, 0, "Aspect scale ratio (3:4):actual times 100"); +static u_short +vga_flipattr(u_short a, int blink) +{ + if (blink) + a = (a & 0x8800) | ((a & 0x7000) >> 4) | + ((a & 0x0700) << 4); + else + a = ((a & 0xf000) >> 4) | ((a & 0x0f00) << 4); + return (a); +} + +static u_short +vga_cursorattr_adj(u_short a, int blink) +{ + /* + * !blink means pixel mode, and the cursor attribute in that case + * is simplistic reverse video. + */ + if (!blink) + return (vga_flipattr(a, blink)); + + /* + * The cursor attribute is usually that of the underlying char + * with the bg changed to white. If the bg is already white, + * then the bg is changed to black. The fg is usually not + * changed, but if it is the same as the new bg then it is + * changed to the inverse of the new bg. + */ + if ((a & 0x7000) == 0x7000) { + a &= 0x8f00; + if ((a & 0x0700) == 0) + a |= 0x0700; + } else { + a |= 0x7000; + if ((a & 0x0700) == 0x0700) + a &= 0xf000; + } + return (a); +} + static void vga_setmdp(scr_stat *scp) { @@ -436,8 +476,7 @@ vga_txtdraw(scr_stat *scp, int from, int count, int fl for (p = sc_vtb_pointer(&scp->scr, from); count-- > 0; ++from) { c = sc_vtb_getc(&scp->vtb, from); a = sc_vtb_geta(&scp->vtb, from); - a = (a & 0x8800) | ((a & 0x7000) >> 4) - | ((a & 0x0700) << 4); + a = vga_flipattr(a, TRUE); p = sc_vtb_putchar(&scp->scr, p, c, a); } } else { @@ -482,8 +521,7 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u if (scp->curs_attr.base >= h) return; if (flip) - a = (a & 0x8800) - | ((a & 0x7000) >> 4) | ((a & 0x0700) << 4); + a = vga_flipattr(a, TRUE); bcopy(font + c*h, font + sc->cursor_char*h, h); font = font + sc->cursor_char*h; for (i = imax(h - scp->curs_attr.base - scp->curs_attr.height, 0); @@ -496,18 +534,9 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u } else #endif /* SC_NO_FONT_LOADING */ { - if ((a & 0x7000) == 0x7000) { - a &= 0x8f00; - if ((a & 0x0700) == 0) - a |= 0x0700; - } else { - a |= 0x7000; - if ((a & 0x0700) == 0x0700) - a &= 0xf000; - } + a = vga_cursorattr_adj(a, TRUE); if (flip) - a = (a & 0x8800) - | ((a & 0x7000) >> 4) | ((a & 0x0700) << 4); + a = vga_flipattr(a, TRUE); sc_vtb_putc(&scp->scr, at, c, a); } } @@ -544,9 +573,7 @@ vga_txtcursor(scr_stat *scp, int at, int blink, int on } else { cursor_attr = sc_vtb_geta(&scp->vtb, at); if (flip) - cursor_attr = (cursor_attr & 0x8800) - | ((cursor_attr & 0x7000) >> 4) - | ((cursor_attr & 0x0700) << 4); + cursor_attr = vga_flipattr(cursor_attr, TRUE); if (scp->status & VR_CURSOR_ON) sc_vtb_putc(&scp->scr, at, sc_vtb_getc(&scp->vtb, at), @@ -875,13 +902,10 @@ vga_vgadraw_direct(scr_stat *scp, int from, int count, for (i = from; count-- > 0; ++i) { a = sc_vtb_geta(&scp->vtb, i); - if (flip) { - col1 = (((a & 0x7000) >> 4) | (a & 0x0800)) >> 8; - col2 = (((a & 0x8000) >> 4) | (a & 0x0700)) >> 8; - } else { - col1 = (a & 0x0f00) >> 8; - col2 = (a & 0xf000) >> 12; - } + if (flip) + a = vga_flipattr(a, TRUE); /* XXX */ + col1 = (a & 0x0f00) >> 8; + col2 = (a & 0xf000) >> 12; e = d; f = &(scp->font[sc_vtb_getc(&scp->vtb, i) * scp->font_size]); @@ -932,13 +956,10 @@ vga_vgadraw_planar(scr_stat *scp, int from, int count, count = scp->xsize*scp->ysize - from; for (i = from; count-- > 0; ++i) { a = sc_vtb_geta(&scp->vtb, i); - if (flip) { - col1 = ((a & 0x7000) >> 4) | (a & 0x0800); - col2 = ((a & 0x8000) >> 4) | (a & 0x0700); - } else { - col1 = (a & 0x0f00); - col2 = (a & 0xf000) >> 4; - } + if (flip) + a = vga_flipattr(a, TRUE); /* XXX */ + col1 = a & 0x0f00; + col2 = (a & 0xf000) >> 4; /* set background color in EGA/VGA latch */ if (bg != col2) { bg = col2; @@ -1002,13 +1023,12 @@ draw_pxlcursor_direct(scr_stat *scp, int at, int on, i a = sc_vtb_geta(&scp->vtb, at); - if (flip) { - col1 = ((on) ? (a & 0x0f00) : ((a & 0xf000) >> 4)) >> 8; - col2 = ((on) ? ((a & 0xf000) >> 4) : (a & 0x0f00)) >> 8; - } else { - col1 = ((on) ? ((a & 0xf000) >> 4) : (a & 0x0f00)) >> 8; - col2 = ((on) ? (a & 0x0f00) : ((a & 0xf000) >> 4)) >> 8; - } + if (flip) + a = vga_flipattr(a, FALSE); + if (on) + a = vga_cursorattr_adj(a, FALSE); + col1 = (a & 0x0f00) >> 8; + col2 = a >> 12; f = &(scp->font[sc_vtb_getc(&scp->vtb, at) * scp->font_size + scp->font_size - scp->curs_attr.base - 1]); @@ -1048,18 +1068,16 @@ draw_pxlcursor_planar(scr_stat *scp, int at, int on, i /* set background color in EGA/VGA latch */ a = sc_vtb_geta(&scp->vtb, at); if (flip) - col = (on) ? ((a & 0xf000) >> 4) : (a & 0x0f00); - else - col = (on) ? (a & 0x0f00) : ((a & 0xf000) >> 4); + a = vga_flipattr(a, FALSE); + if (on) + a = vga_cursorattr_adj(a, FALSE); + col = (a & 0xf000) >> 4; outw(GDCIDX, col | 0x00); /* set/reset */ outw(GDCIDX, 0xff08); /* bit mask */ writeb(d, 0); c = readb(d); /* set bg color in the latch */ /* foreground color */ - if (flip) - col = (on) ? (a & 0x0f00) : ((a & 0xf000) >> 4); - else - col = (on) ? ((a & 0xf000) >> 4) : (a & 0x0f00); + col = a & 0x0f00; outw(GDCIDX, col | 0x00); /* set/reset */ f = &(scp->font[sc_vtb_getc(&scp->vtb, at)*scp->font_size + scp->font_size - scp->curs_attr.base - 1]); From owner-svn-src-head@freebsd.org Sun Jul 9 12:35:20 2017 Return-Path: Delivered-To: svn-src-head@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 C8E90DB17B4; Sun, 9 Jul 2017 12:35:20 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 984F682D5C; Sun, 9 Jul 2017 12:35:20 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69CZJes086121; Sun, 9 Jul 2017 12:35:19 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69CZJBf086120; Sun, 9 Jul 2017 12:35:19 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707091235.v69CZJBf086120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 9 Jul 2017 12:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320830 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 320830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 12:35:20 -0000 Author: manu Date: Sun Jul 9 12:35:19 2017 New Revision: 320830 URL: https://svnweb.freebsd.org/changeset/base/320830 Log: if_awg: Add "allwinner,sun50i-a64-emac" compatible string. This enable ethernet on Pine64 with latest DTS. Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Sun Jul 9 12:13:37 2017 (r320829) +++ head/sys/arm/allwinner/if_awg.c Sun Jul 9 12:35:19 2017 (r320830) @@ -146,11 +146,13 @@ TUNABLE_INT("hw.awg.rx_batch", &awg_rx_batch); enum awg_type { EMAC_A83T = 1, EMAC_H3, + EMAC_A64, }; static struct ofw_compat_data compat_data[] = { { "allwinner,sun8i-a83t-emac", EMAC_A83T }, { "allwinner,sun8i-h3-emac", EMAC_H3 }, + { "allwinner,sun50i-a64-emac", EMAC_A64 }, { NULL, 0 } }; From owner-svn-src-head@freebsd.org Sun Jul 9 12:53:03 2017 Return-Path: Delivered-To: svn-src-head@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 C200FDB1C52; Sun, 9 Jul 2017 12:53:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 85854836D9; Sun, 9 Jul 2017 12:53:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69Cr2Vb094362; Sun, 9 Jul 2017 12:53:02 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69Cr25T094360; Sun, 9 Jul 2017 12:53:02 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707091253.v69Cr25T094360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 9 Jul 2017 12:53:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320831 - in head/sys: arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/conf conf X-SVN-Commit-Revision: 320831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 12:53:03 -0000 Author: manu Date: Sun Jul 9 12:53:02 2017 New Revision: 320831 URL: https://svnweb.freebsd.org/changeset/base/320831 Log: arm64: Add Allwinner I2C controller to GENERIC kernel Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Sun Jul 9 12:35:19 2017 (r320830) +++ head/sys/arm64/conf/GENERIC Sun Jul 9 12:53:02 2017 (r320831) @@ -176,6 +176,7 @@ device aw_rsb # Allwinner Reduced Serial Bus device bcm2835_bsc # Broadcom BCM283x I2C bus device iicbus device iic +device twsi # Allwinner I2C controller # Clock and reset controllers device aw_ccu # Allwinner clock controller Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sun Jul 9 12:35:19 2017 (r320830) +++ head/sys/conf/files.arm64 Sun Jul 9 12:53:02 2017 (r320831) @@ -158,6 +158,8 @@ dev/axgbe/xgbe-dev.c optional axgbe dev/axgbe/xgbe-drv.c optional axgbe dev/axgbe/xgbe-mdio.c optional axgbe dev/cpufreq/cpufreq_dt.c optional cpufreq fdt +dev/iicbus/twsi/a10_twsi.c optional twsi fdt +dev/iicbus/twsi/twsi.c optional twsi fdt dev/hwpmc/hwpmc_arm64.c optional hwpmc dev/hwpmc/hwpmc_arm64_md.c optional hwpmc dev/mbox/mbox_if.m optional soc_brcm_bcm2837 From owner-svn-src-head@freebsd.org Sun Jul 9 13:53:35 2017 Return-Path: Delivered-To: svn-src-head@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 DC744DB2873; Sun, 9 Jul 2017 13:53:35 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 40DDF10B; Sun, 9 Jul 2017 13:53:35 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69DrYUD019276; Sun, 9 Jul 2017 13:53:34 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69DrWSi019259; Sun, 9 Jul 2017 13:53:32 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707091353.v69DrWSi019259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 9 Jul 2017 13:53:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320834 - in head/sys/gnu/dts: arm include/dt-bindings/clock include/dt-bindings/genpd include/dt-bindings/gpio include/dt-bindings/input include/dt-bindings/mfd include/dt-bindings/pin... X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys/gnu/dts: arm include/dt-bindings/clock include/dt-bindings/genpd include/dt-bindings/gpio include/dt-bindings/input include/dt-bindings/mfd include/dt-bindings/pinctrl include/dt-bindings/... X-SVN-Commit-Revision: 320834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 13:53:36 -0000 Author: manu Date: Sun Jul 9 13:53:32 2017 New Revision: 320834 URL: https://svnweb.freebsd.org/changeset/base/320834 Log: Update DTS files from Linux 4.12 Notable changes: Allwinner: * H3/H5 were merged into a common dtsi file * include/dt-bindings/sun4i-a10.h is not included anymore in a lot of dts files * Add sun8i-h3-nanopi-neo-air board DTS file Added: head/sys/gnu/dts/arm/am335x-baltos-leds.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/am335x-baltos-leds.dtsi head/sys/gnu/dts/arm/armada-385-linksys-shelby.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/armada-385-linksys-shelby.dts head/sys/gnu/dts/arm/armada-385-synology-ds116.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/armada-385-synology-ds116.dts head/sys/gnu/dts/arm/bcm4708-linksys-ea6300-v1.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/bcm4708-linksys-ea6300-v1.dts head/sys/gnu/dts/arm/bcm47081-tplink-archer-c5-v2.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/bcm47081-tplink-archer-c5-v2.dts head/sys/gnu/dts/arm/bcm4709-linksys-ea9200.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/bcm4709-linksys-ea9200.dts head/sys/gnu/dts/arm/bcm47094-linksys-panamera.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/bcm47094-linksys-panamera.dts head/sys/gnu/dts/arm/bcm953012hr.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/bcm953012hr.dts head/sys/gnu/dts/arm/exynos5420-tmu-sensor-conf.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/exynos5420-tmu-sensor-conf.dtsi head/sys/gnu/dts/arm/gemini-nas4220b.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/gemini-nas4220b.dts head/sys/gnu/dts/arm/gemini-rut1xx.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/gemini-rut1xx.dts head/sys/gnu/dts/arm/gemini-sq201.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/gemini-sq201.dts head/sys/gnu/dts/arm/gemini-wbd111.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/gemini-wbd111.dts head/sys/gnu/dts/arm/gemini-wbd222.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/gemini-wbd222.dts head/sys/gnu/dts/arm/gemini.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/gemini.dtsi head/sys/gnu/dts/arm/imx28-duckbill-2-485.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx28-duckbill-2-485.dts head/sys/gnu/dts/arm/imx28-duckbill-2-enocean.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx28-duckbill-2-enocean.dts head/sys/gnu/dts/arm/imx28-duckbill-2-spi.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx28-duckbill-2-spi.dts head/sys/gnu/dts/arm/imx28-duckbill-2.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx28-duckbill-2.dts head/sys/gnu/dts/arm/imx6dl-gw5903.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6dl-gw5903.dts head/sys/gnu/dts/arm/imx6dl-gw5904.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6dl-gw5904.dts head/sys/gnu/dts/arm/imx6q-gw5903.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6q-gw5903.dts head/sys/gnu/dts/arm/imx6q-gw5904.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6q-gw5904.dts head/sys/gnu/dts/arm/imx6q-icore-ofcap10.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6q-icore-ofcap10.dts head/sys/gnu/dts/arm/imx6q-icore-ofcap12.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6q-icore-ofcap12.dts head/sys/gnu/dts/arm/imx6q-zii-rdu2.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6q-zii-rdu2.dts head/sys/gnu/dts/arm/imx6qdl-gw5903.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6qdl-gw5903.dtsi head/sys/gnu/dts/arm/imx6qdl-gw5904.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6qdl-gw5904.dtsi head/sys/gnu/dts/arm/imx6qdl-zii-rdu2.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6qdl-zii-rdu2.dtsi head/sys/gnu/dts/arm/imx6qp-nitrogen6_som2.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6qp-nitrogen6_som2.dts head/sys/gnu/dts/arm/imx6qp-zii-rdu2.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6qp-zii-rdu2.dts head/sys/gnu/dts/arm/imx6ul-isiot-common.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx6ul-isiot-common.dtsi head/sys/gnu/dts/arm/imx7d-sdb-sht11.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/imx7d-sdb-sht11.dts head/sys/gnu/dts/arm/motorola-cpcap-mapphone.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/motorola-cpcap-mapphone.dtsi head/sys/gnu/dts/arm/omap3-cpu-thermal.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/omap3-cpu-thermal.dtsi head/sys/gnu/dts/arm/rk3288-phycore-rdk.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/rk3288-phycore-rdk.dts head/sys/gnu/dts/arm/rk3288-phycore-som.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/rk3288-phycore-som.dtsi head/sys/gnu/dts/arm/rk3288-tinker.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/rk3288-tinker.dts head/sys/gnu/dts/arm/stm32h743-pinctrl.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/stm32h743-pinctrl.dtsi head/sys/gnu/dts/arm/stm32h743.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/stm32h743.dtsi head/sys/gnu/dts/arm/stm32h743i-eval.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/stm32h743i-eval.dts head/sys/gnu/dts/arm/sun8i-h3-nanopi-neo-air.dts - copied unchanged from r320832, vendor/device-tree/dist/src/arm/sun8i-h3-nanopi-neo-air.dts head/sys/gnu/dts/arm/sunxi-h3-h5.dtsi - copied unchanged from r320832, vendor/device-tree/dist/src/arm/sunxi-h3-h5.dtsi head/sys/gnu/dts/include/dt-bindings/clock/mt6797-clk.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/clock/mt6797-clk.h head/sys/gnu/dts/include/dt-bindings/clock/rv1108-cru.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/clock/rv1108-cru.h head/sys/gnu/dts/include/dt-bindings/clock/sun8i-r-ccu.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/clock/sun8i-r-ccu.h head/sys/gnu/dts/include/dt-bindings/genpd/ - copied from r320832, vendor/device-tree/dist/include/dt-bindings/genpd/ head/sys/gnu/dts/include/dt-bindings/mfd/stm32f7-rcc.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/mfd/stm32f7-rcc.h head/sys/gnu/dts/include/dt-bindings/power/imx7-power.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/power/imx7-power.h head/sys/gnu/dts/include/dt-bindings/reset/altr,rst-mgr-a10sr.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/reset/altr,rst-mgr-a10sr.h head/sys/gnu/dts/include/dt-bindings/reset/imx7-reset.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/reset/imx7-reset.h head/sys/gnu/dts/include/dt-bindings/reset/sun8i-r-ccu.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/reset/sun8i-r-ccu.h head/sys/gnu/dts/include/dt-bindings/reset/tegra210-car.h - copied unchanged from r320832, vendor/device-tree/dist/include/dt-bindings/reset/tegra210-car.h Deleted: head/sys/gnu/dts/include/dt-bindings/clock/rk1108-cru.h Modified: head/sys/gnu/dts/arm/alpine.dtsi head/sys/gnu/dts/arm/am335x-baltos-ir2110.dts head/sys/gnu/dts/arm/am335x-baltos-ir3220.dts head/sys/gnu/dts/arm/am335x-baltos-ir5221.dts head/sys/gnu/dts/arm/am335x-boneblack.dts head/sys/gnu/dts/arm/am335x-icev2.dts head/sys/gnu/dts/arm/am335x-sl50.dts head/sys/gnu/dts/arm/am33xx.dtsi head/sys/gnu/dts/arm/am3517.dtsi head/sys/gnu/dts/arm/am4372.dtsi head/sys/gnu/dts/arm/am437x-gp-evm.dts head/sys/gnu/dts/arm/am57xx-idk-common.dtsi head/sys/gnu/dts/arm/armada-385-linksys.dtsi head/sys/gnu/dts/arm/armada-385.dtsi head/sys/gnu/dts/arm/armada-388-clearfog.dts head/sys/gnu/dts/arm/armada-388.dtsi head/sys/gnu/dts/arm/armada-38x.dtsi head/sys/gnu/dts/arm/armada-xp-98dx3236.dtsi head/sys/gnu/dts/arm/armada-xp-98dx3336.dtsi head/sys/gnu/dts/arm/armada-xp-98dx4251.dtsi head/sys/gnu/dts/arm/armada-xp-db-dxbc2.dts head/sys/gnu/dts/arm/armada-xp-db-xc3-24g4xg.dts head/sys/gnu/dts/arm/armada-xp-linksys-mamba.dts head/sys/gnu/dts/arm/aspeed-ast2500-evb.dts head/sys/gnu/dts/arm/aspeed-bmc-opp-palmetto.dts head/sys/gnu/dts/arm/aspeed-bmc-opp-romulus.dts head/sys/gnu/dts/arm/aspeed-g4.dtsi head/sys/gnu/dts/arm/aspeed-g5.dtsi head/sys/gnu/dts/arm/at91-sama5d2_xplained.dts head/sys/gnu/dts/arm/at91-sama5d3_xplained.dts head/sys/gnu/dts/arm/at91-tse850-3.dts head/sys/gnu/dts/arm/at91sam9261.dtsi head/sys/gnu/dts/arm/at91sam9x5ek.dtsi head/sys/gnu/dts/arm/axp209.dtsi head/sys/gnu/dts/arm/axp22x.dtsi head/sys/gnu/dts/arm/bcm-cygnus.dtsi head/sys/gnu/dts/arm/bcm-nsp.dtsi head/sys/gnu/dts/arm/bcm2835-rpi.dtsi head/sys/gnu/dts/arm/bcm283x-rpi-smsc9512.dtsi head/sys/gnu/dts/arm/bcm283x-rpi-smsc9514.dtsi head/sys/gnu/dts/arm/bcm283x.dtsi head/sys/gnu/dts/arm/bcm4708-asus-rt-ac56u.dts head/sys/gnu/dts/arm/bcm4708-asus-rt-ac68u.dts head/sys/gnu/dts/arm/bcm4708-buffalo-wzr-1750dhp.dts head/sys/gnu/dts/arm/bcm4708-netgear-r6250.dts head/sys/gnu/dts/arm/bcm4708-netgear-r6300-v2.dts head/sys/gnu/dts/arm/bcm4708-smartrg-sr400ac.dts head/sys/gnu/dts/arm/bcm4708.dtsi head/sys/gnu/dts/arm/bcm47081-asus-rt-n18u.dts head/sys/gnu/dts/arm/bcm47081-buffalo-wzr-600dhp2.dts head/sys/gnu/dts/arm/bcm47081-buffalo-wzr-900dhp.dts head/sys/gnu/dts/arm/bcm47081.dtsi head/sys/gnu/dts/arm/bcm4709-asus-rt-ac87u.dts head/sys/gnu/dts/arm/bcm4709-buffalo-wxr-1900dhp.dts head/sys/gnu/dts/arm/bcm4709-netgear-r7000.dts head/sys/gnu/dts/arm/bcm4709-netgear-r8000.dts head/sys/gnu/dts/arm/bcm4709-tplink-archer-c9-v1.dts head/sys/gnu/dts/arm/bcm47094-dlink-dir-885l.dts head/sys/gnu/dts/arm/bcm47094-luxul-xwr-3100.dts head/sys/gnu/dts/arm/bcm47094-netgear-r8500.dts head/sys/gnu/dts/arm/bcm47189-tenda-ac9.dts head/sys/gnu/dts/arm/bcm5301x.dtsi head/sys/gnu/dts/arm/bcm53573.dtsi head/sys/gnu/dts/arm/bcm94708.dts head/sys/gnu/dts/arm/bcm94709.dts head/sys/gnu/dts/arm/bcm953012er.dts head/sys/gnu/dts/arm/bcm953012k.dts head/sys/gnu/dts/arm/bcm958522er.dts head/sys/gnu/dts/arm/bcm958525er.dts head/sys/gnu/dts/arm/bcm958525xmc.dts head/sys/gnu/dts/arm/bcm958622hr.dts head/sys/gnu/dts/arm/bcm958623hr.dts head/sys/gnu/dts/arm/bcm958625hr.dts head/sys/gnu/dts/arm/bcm958625k.dts head/sys/gnu/dts/arm/bcm988312hr.dts head/sys/gnu/dts/arm/da850-evm.dts head/sys/gnu/dts/arm/da850-lego-ev3.dts head/sys/gnu/dts/arm/da850.dtsi head/sys/gnu/dts/arm/dm8168-evm.dts head/sys/gnu/dts/arm/dm816x.dtsi head/sys/gnu/dts/arm/dra7-evm.dts head/sys/gnu/dts/arm/dra7.dtsi head/sys/gnu/dts/arm/dra74x.dtsi head/sys/gnu/dts/arm/exynos3250-rinato.dts head/sys/gnu/dts/arm/exynos3250.dtsi head/sys/gnu/dts/arm/exynos4.dtsi head/sys/gnu/dts/arm/exynos4210-origen.dts head/sys/gnu/dts/arm/exynos4210-trats.dts head/sys/gnu/dts/arm/exynos4210.dtsi head/sys/gnu/dts/arm/exynos4412-itop-scp-core.dtsi head/sys/gnu/dts/arm/exynos4412-odroid-common.dtsi head/sys/gnu/dts/arm/exynos4412-origen.dts head/sys/gnu/dts/arm/exynos4412-prime.dtsi head/sys/gnu/dts/arm/exynos4412-trats2.dts head/sys/gnu/dts/arm/exynos4412.dtsi head/sys/gnu/dts/arm/exynos5420.dtsi head/sys/gnu/dts/arm/exynos5440.dtsi head/sys/gnu/dts/arm/exynos5800.dtsi head/sys/gnu/dts/arm/imx25-eukrea-mbimxsd25-baseboard.dts head/sys/gnu/dts/arm/imx25-pdk.dts head/sys/gnu/dts/arm/imx25-pinfunc.h head/sys/gnu/dts/arm/imx25.dtsi head/sys/gnu/dts/arm/imx28-duckbill.dts head/sys/gnu/dts/arm/imx28-m28cu3.dts head/sys/gnu/dts/arm/imx28.dtsi head/sys/gnu/dts/arm/imx50.dtsi head/sys/gnu/dts/arm/imx53-qsb.dts head/sys/gnu/dts/arm/imx53-qsrb.dts head/sys/gnu/dts/arm/imx6q-b450v3.dts head/sys/gnu/dts/arm/imx6q-b650v3.dts head/sys/gnu/dts/arm/imx6q-b850v3.dts head/sys/gnu/dts/arm/imx6q-bx50v3.dtsi head/sys/gnu/dts/arm/imx6q-cm-fx6.dts head/sys/gnu/dts/arm/imx6q-icore.dts head/sys/gnu/dts/arm/imx6q-utilite-pro.dts head/sys/gnu/dts/arm/imx6qdl-icore.dtsi head/sys/gnu/dts/arm/imx6qdl-sabresd.dtsi head/sys/gnu/dts/arm/imx6qdl.dtsi head/sys/gnu/dts/arm/imx6qp-sabresd.dts head/sys/gnu/dts/arm/imx6qp.dtsi head/sys/gnu/dts/arm/imx6sx-sdb.dts head/sys/gnu/dts/arm/imx6sx.dtsi head/sys/gnu/dts/arm/imx6ul-14x14-evk.dts head/sys/gnu/dts/arm/imx6ul-geam.dtsi head/sys/gnu/dts/arm/imx6ul-isiot-emmc.dts head/sys/gnu/dts/arm/imx6ul-isiot-nand.dts head/sys/gnu/dts/arm/imx6ul-isiot.dtsi head/sys/gnu/dts/arm/imx7-colibri-eval-v3.dtsi head/sys/gnu/dts/arm/imx7-colibri.dtsi head/sys/gnu/dts/arm/imx7d-colibri-eval-v3.dts head/sys/gnu/dts/arm/imx7s.dtsi head/sys/gnu/dts/arm/keystone-k2l-netcp.dtsi head/sys/gnu/dts/arm/keystone-k2l.dtsi head/sys/gnu/dts/arm/logicpd-torpedo-37xx-devkit.dts head/sys/gnu/dts/arm/meson8.dtsi head/sys/gnu/dts/arm/meson8b.dtsi head/sys/gnu/dts/arm/moxart-uc7112lx.dts head/sys/gnu/dts/arm/moxart.dtsi head/sys/gnu/dts/arm/mt7623.dtsi head/sys/gnu/dts/arm/omap3-gta04.dtsi head/sys/gnu/dts/arm/omap3-igep.dtsi head/sys/gnu/dts/arm/omap3-n900.dts head/sys/gnu/dts/arm/omap3-n950-n9.dtsi head/sys/gnu/dts/arm/omap34xx.dtsi head/sys/gnu/dts/arm/omap36xx.dtsi head/sys/gnu/dts/arm/omap4-droid4-xt894.dts head/sys/gnu/dts/arm/omap4-panda-a4.dts head/sys/gnu/dts/arm/omap4-panda-es.dts head/sys/gnu/dts/arm/omap443x.dtsi head/sys/gnu/dts/arm/omap4460.dtsi head/sys/gnu/dts/arm/omap5.dtsi head/sys/gnu/dts/arm/qcom-apq8060-dragonboard.dts head/sys/gnu/dts/arm/qcom-msm8660.dtsi head/sys/gnu/dts/arm/qcom-msm8974-sony-xperia-honami.dts head/sys/gnu/dts/arm/qcom-msm8974.dtsi head/sys/gnu/dts/arm/r7s72100-genmai.dts head/sys/gnu/dts/arm/r7s72100-rskrza1.dts head/sys/gnu/dts/arm/r7s72100.dtsi head/sys/gnu/dts/arm/r8a73a4.dtsi head/sys/gnu/dts/arm/r8a7743.dtsi head/sys/gnu/dts/arm/r8a7745.dtsi head/sys/gnu/dts/arm/r8a7778-bockw.dts head/sys/gnu/dts/arm/r8a7779-marzen.dts head/sys/gnu/dts/arm/r8a7790-lager.dts head/sys/gnu/dts/arm/r8a7790.dtsi head/sys/gnu/dts/arm/r8a7791-koelsch.dts head/sys/gnu/dts/arm/r8a7791-porter.dts head/sys/gnu/dts/arm/r8a7791.dtsi head/sys/gnu/dts/arm/r8a7792.dtsi head/sys/gnu/dts/arm/r8a7793-gose.dts head/sys/gnu/dts/arm/r8a7793.dtsi head/sys/gnu/dts/arm/r8a7794-alt.dts head/sys/gnu/dts/arm/r8a7794-silk.dts head/sys/gnu/dts/arm/r8a7794.dtsi head/sys/gnu/dts/arm/rk1108.dtsi head/sys/gnu/dts/arm/rk3036.dtsi head/sys/gnu/dts/arm/rk3188.dtsi head/sys/gnu/dts/arm/rk322x.dtsi head/sys/gnu/dts/arm/rk3288-miqi.dts head/sys/gnu/dts/arm/rk3288-rock2-som.dtsi head/sys/gnu/dts/arm/rk3288-rock2-square.dts head/sys/gnu/dts/arm/rk3288.dtsi head/sys/gnu/dts/arm/rk3xxx.dtsi head/sys/gnu/dts/arm/s3c64xx.dtsi head/sys/gnu/dts/arm/s5pv210.dtsi head/sys/gnu/dts/arm/sama5d2.dtsi head/sys/gnu/dts/arm/socfpga.dtsi head/sys/gnu/dts/arm/socfpga_arria10.dtsi head/sys/gnu/dts/arm/socfpga_arria10_socdk.dtsi head/sys/gnu/dts/arm/socfpga_arria5_socdk.dts head/sys/gnu/dts/arm/socfpga_cyclone5_de0_sockit.dts head/sys/gnu/dts/arm/socfpga_cyclone5_mcv.dtsi head/sys/gnu/dts/arm/socfpga_cyclone5_mcvevk.dts head/sys/gnu/dts/arm/socfpga_cyclone5_socdk.dts head/sys/gnu/dts/arm/socfpga_cyclone5_sockit.dts head/sys/gnu/dts/arm/socfpga_cyclone5_socrates.dts head/sys/gnu/dts/arm/socfpga_cyclone5_sodia.dts head/sys/gnu/dts/arm/socfpga_cyclone5_vining_fpga.dts head/sys/gnu/dts/arm/socfpga_vt.dts head/sys/gnu/dts/arm/spear600-evb.dts head/sys/gnu/dts/arm/spear600.dtsi head/sys/gnu/dts/arm/ste-dbx5x0.dtsi head/sys/gnu/dts/arm/stih407-family.dtsi head/sys/gnu/dts/arm/stih410.dtsi head/sys/gnu/dts/arm/stm32429i-eval.dts head/sys/gnu/dts/arm/stm32746g-eval.dts head/sys/gnu/dts/arm/stm32f429-disco.dts head/sys/gnu/dts/arm/stm32f429.dtsi head/sys/gnu/dts/arm/stm32f469-disco.dts head/sys/gnu/dts/arm/stm32f746.dtsi head/sys/gnu/dts/arm/sun4i-a10-a1000.dts head/sys/gnu/dts/arm/sun4i-a10-cubieboard.dts head/sys/gnu/dts/arm/sun4i-a10-dserve-dsrv9703c.dts head/sys/gnu/dts/arm/sun4i-a10-hackberry.dts head/sys/gnu/dts/arm/sun4i-a10-inet1.dts head/sys/gnu/dts/arm/sun4i-a10-inet9f-rev03.dts head/sys/gnu/dts/arm/sun4i-a10-jesurun-q5.dts head/sys/gnu/dts/arm/sun4i-a10-marsboard.dts head/sys/gnu/dts/arm/sun4i-a10-mini-xplus.dts head/sys/gnu/dts/arm/sun4i-a10-mk802.dts head/sys/gnu/dts/arm/sun4i-a10-olinuxino-lime.dts head/sys/gnu/dts/arm/sun4i-a10-pcduino.dts head/sys/gnu/dts/arm/sun4i-a10-pov-protab2-ips9.dts head/sys/gnu/dts/arm/sun4i-a10.dtsi head/sys/gnu/dts/arm/sun5i-a10s-auxtek-t003.dts head/sys/gnu/dts/arm/sun5i-a10s-auxtek-t004.dts head/sys/gnu/dts/arm/sun5i-a10s-olinuxino-micro.dts head/sys/gnu/dts/arm/sun5i-a10s-r7-tv-dongle.dts head/sys/gnu/dts/arm/sun5i-a10s-wobo-i5.dts head/sys/gnu/dts/arm/sun5i-a10s.dtsi head/sys/gnu/dts/arm/sun5i-a13-empire-electronix-d709.dts head/sys/gnu/dts/arm/sun5i-a13-hsg-h702.dts head/sys/gnu/dts/arm/sun5i-a13-licheepi-one.dts head/sys/gnu/dts/arm/sun5i-a13-olinuxino-micro.dts head/sys/gnu/dts/arm/sun5i-a13-olinuxino.dts head/sys/gnu/dts/arm/sun5i-a13.dtsi head/sys/gnu/dts/arm/sun5i-gr8-chip-pro.dts head/sys/gnu/dts/arm/sun5i-gr8-evb.dts head/sys/gnu/dts/arm/sun5i-gr8.dtsi head/sys/gnu/dts/arm/sun5i-r8-chip.dts head/sys/gnu/dts/arm/sun5i-r8.dtsi head/sys/gnu/dts/arm/sun5i.dtsi head/sys/gnu/dts/arm/sun6i-a31-app4-evb1.dts head/sys/gnu/dts/arm/sun6i-a31-colombus.dts head/sys/gnu/dts/arm/sun6i-a31-hummingbird.dts head/sys/gnu/dts/arm/sun6i-a31-i7.dts head/sys/gnu/dts/arm/sun6i-a31-m9.dts head/sys/gnu/dts/arm/sun6i-a31-mele-a1000g-quad.dts head/sys/gnu/dts/arm/sun6i-a31.dtsi head/sys/gnu/dts/arm/sun6i-a31s-cs908.dts head/sys/gnu/dts/arm/sun6i-a31s-primo81.dts head/sys/gnu/dts/arm/sun6i-a31s-sina31s-core.dtsi head/sys/gnu/dts/arm/sun6i-a31s-sina31s.dts head/sys/gnu/dts/arm/sun6i-a31s-sinovoip-bpi-m2.dts head/sys/gnu/dts/arm/sun6i-a31s-yones-toptech-bs1078-v2.dts head/sys/gnu/dts/arm/sun6i-reference-design-tablet.dtsi head/sys/gnu/dts/arm/sun7i-a20-bananapi.dts head/sys/gnu/dts/arm/sun7i-a20-cubieboard2.dts head/sys/gnu/dts/arm/sun7i-a20-cubietruck.dts head/sys/gnu/dts/arm/sun7i-a20-hummingbird.dts head/sys/gnu/dts/arm/sun7i-a20-i12-tvbox.dts head/sys/gnu/dts/arm/sun7i-a20-icnova-swac.dts head/sys/gnu/dts/arm/sun7i-a20-lamobo-r1.dts head/sys/gnu/dts/arm/sun7i-a20-m3.dts head/sys/gnu/dts/arm/sun7i-a20-mk808c.dts head/sys/gnu/dts/arm/sun7i-a20-olimex-som-evb.dts head/sys/gnu/dts/arm/sun7i-a20-olinuxino-lime.dts head/sys/gnu/dts/arm/sun7i-a20-olinuxino-lime2.dts head/sys/gnu/dts/arm/sun7i-a20-olinuxino-micro.dts head/sys/gnu/dts/arm/sun7i-a20-orangepi-mini.dts head/sys/gnu/dts/arm/sun7i-a20-orangepi.dts head/sys/gnu/dts/arm/sun7i-a20-pcduino3.dts head/sys/gnu/dts/arm/sun7i-a20.dtsi head/sys/gnu/dts/arm/sun8i-a23-a33.dtsi head/sys/gnu/dts/arm/sun8i-a23-evb.dts head/sys/gnu/dts/arm/sun8i-a23-ippo-q8h-v1.2.dts head/sys/gnu/dts/arm/sun8i-a23-ippo-q8h-v5.dts head/sys/gnu/dts/arm/sun8i-a23-q8-tablet.dts head/sys/gnu/dts/arm/sun8i-a33-sinlinx-sina33.dts head/sys/gnu/dts/arm/sun8i-a33.dtsi head/sys/gnu/dts/arm/sun8i-a83t.dtsi head/sys/gnu/dts/arm/sun8i-h2-plus-orangepi-zero.dts head/sys/gnu/dts/arm/sun8i-h3-bananapi-m2-plus.dts head/sys/gnu/dts/arm/sun8i-h3-beelink-x2.dts head/sys/gnu/dts/arm/sun8i-h3-nanopi.dtsi head/sys/gnu/dts/arm/sun8i-h3-orangepi-2.dts head/sys/gnu/dts/arm/sun8i-h3-orangepi-lite.dts head/sys/gnu/dts/arm/sun8i-h3-orangepi-one.dts head/sys/gnu/dts/arm/sun8i-h3-orangepi-pc.dts head/sys/gnu/dts/arm/sun8i-h3.dtsi head/sys/gnu/dts/arm/sun9i-a80-cubieboard4.dts head/sys/gnu/dts/arm/sun9i-a80-optimus.dts head/sys/gnu/dts/arm/sun9i-a80.dtsi head/sys/gnu/dts/arm/sunxi-common-regulators.dtsi head/sys/gnu/dts/arm/sunxi-reference-design-tablet.dtsi head/sys/gnu/dts/arm/uniphier-ld4-ref.dts head/sys/gnu/dts/arm/uniphier-ld4.dtsi head/sys/gnu/dts/arm/uniphier-ld6b-ref.dts head/sys/gnu/dts/arm/uniphier-pinctrl.dtsi head/sys/gnu/dts/arm/uniphier-pro4-ace.dts head/sys/gnu/dts/arm/uniphier-pro4-ref.dts head/sys/gnu/dts/arm/uniphier-pro4-sanji.dts head/sys/gnu/dts/arm/uniphier-pro4.dtsi head/sys/gnu/dts/arm/uniphier-pro5.dtsi head/sys/gnu/dts/arm/uniphier-pxs2-gentil.dts head/sys/gnu/dts/arm/uniphier-pxs2-vodka.dts head/sys/gnu/dts/arm/uniphier-pxs2.dtsi head/sys/gnu/dts/arm/uniphier-ref-daughter.dtsi head/sys/gnu/dts/arm/uniphier-sld3-ref.dts head/sys/gnu/dts/arm/uniphier-sld3.dtsi head/sys/gnu/dts/arm/uniphier-sld8-ref.dts head/sys/gnu/dts/arm/uniphier-sld8.dtsi head/sys/gnu/dts/arm/uniphier-support-card.dtsi head/sys/gnu/dts/arm/versatile-pb.dts head/sys/gnu/dts/arm/vexpress-v2m-rs1.dtsi head/sys/gnu/dts/arm/vexpress-v2m.dtsi head/sys/gnu/dts/arm/vexpress-v2p-ca15-tc1.dts head/sys/gnu/dts/arm/vexpress-v2p-ca15_a7.dts head/sys/gnu/dts/arm/vexpress-v2p-ca5s.dts head/sys/gnu/dts/arm/vexpress-v2p-ca9.dts head/sys/gnu/dts/arm/vf610-zii-dev-rev-b.dts head/sys/gnu/dts/arm/vf610-zii-dev-rev-c.dts head/sys/gnu/dts/arm/vf610-zii-dev.dtsi head/sys/gnu/dts/include/dt-bindings/clock/gxbb-clkc.h head/sys/gnu/dts/include/dt-bindings/clock/hi6220-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r7s72100-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r8a73a4-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r8a7790-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r8a7791-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r8a7792-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r8a7793-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r8a7794-clock.h head/sys/gnu/dts/include/dt-bindings/clock/r8a7795-cpg-mssr.h head/sys/gnu/dts/include/dt-bindings/clock/rk3328-cru.h head/sys/gnu/dts/include/dt-bindings/clock/rk3368-cru.h head/sys/gnu/dts/include/dt-bindings/clock/sun50i-a64-ccu.h head/sys/gnu/dts/include/dt-bindings/clock/sun8i-h3-ccu.h head/sys/gnu/dts/include/dt-bindings/clock/tegra114-car.h head/sys/gnu/dts/include/dt-bindings/clock/tegra124-car-common.h head/sys/gnu/dts/include/dt-bindings/clock/tegra210-car.h head/sys/gnu/dts/include/dt-bindings/clock/tegra30-car.h head/sys/gnu/dts/include/dt-bindings/gpio/gpio.h head/sys/gnu/dts/include/dt-bindings/input/linux-event-codes.h head/sys/gnu/dts/include/dt-bindings/pinctrl/hisi.h head/sys/gnu/dts/include/dt-bindings/pinctrl/mt7623-pinfunc.h head/sys/gnu/dts/include/dt-bindings/power/r8a7795-sysc.h head/sys/gnu/dts/include/dt-bindings/reset/mt2701-resets.h head/sys/gnu/dts/include/dt-bindings/reset/sun8i-h3-ccu.h Directory Properties: head/sys/gnu/dts/arm/ (props changed) head/sys/gnu/dts/include/ (props changed) Modified: head/sys/gnu/dts/arm/alpine.dtsi ============================================================================== --- head/sys/gnu/dts/arm/alpine.dtsi Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/alpine.dtsi Sun Jul 9 13:53:32 2017 (r320834) @@ -41,28 +41,28 @@ compatible = "arm,cortex-a15"; device_type = "cpu"; reg = <0>; - clock-frequency = <0>; /* Filled by loader */ + clock-frequency = <1700000000>; }; cpu@1 { compatible = "arm,cortex-a15"; device_type = "cpu"; reg = <1>; - clock-frequency = <0>; /* Filled by loader */ + clock-frequency = <1700000000>; }; cpu@2 { compatible = "arm,cortex-a15"; device_type = "cpu"; reg = <2>; - clock-frequency = <0>; /* Filled by loader */ + clock-frequency = <1700000000>; }; cpu@3 { compatible = "arm,cortex-a15"; device_type = "cpu"; reg = <3>; - clock-frequency = <0>; /* Filled by loader */ + clock-frequency = <1700000000>; }; }; @@ -81,7 +81,7 @@ , , ; - clock-frequency = <0>; /* Filled by loader */ + clock-frequency = <50000000>; }; /* Interrupt Controller */ @@ -120,26 +120,26 @@ ; }; - uart0:uart@fd883000 { + uart0: uart@fd883000 { compatible = "ns16550a"; reg = <0x0 0xfd883000 0x0 0x1000>; - clock-frequency = <0>; /* Filled by loader */ + clock-frequency = <375000000>; interrupts = ; reg-shift = <2>; reg-io-width = <4>; }; - uart1:uart@0xfd884000 { + uart1: uart@fd884000 { compatible = "ns16550a"; reg = <0x0 0xfd884000 0x0 0x1000>; - clock-frequency = <0>; /* Filled by loader */ + clock-frequency = <375000000>; interrupts = ; reg-shift = <2>; reg-io-width = <4>; }; /* Internal PCIe Controller */ - pcie-internal@0xfbc00000 { + pcie@fbc00000 { compatible = "pci-host-ecam-generic"; device_type = "pci"; #size-cells = <2>; Modified: head/sys/gnu/dts/arm/am335x-baltos-ir2110.dts ============================================================================== --- head/sys/gnu/dts/arm/am335x-baltos-ir2110.dts Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am335x-baltos-ir2110.dts Sun Jul 9 13:53:32 2017 (r320834) @@ -14,6 +14,7 @@ /dts-v1/; #include "am335x-baltos.dtsi" +#include "am335x-baltos-leds.dtsi" / { model = "OnRISC Baltos iR 2110"; Modified: head/sys/gnu/dts/arm/am335x-baltos-ir3220.dts ============================================================================== --- head/sys/gnu/dts/arm/am335x-baltos-ir3220.dts Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am335x-baltos-ir3220.dts Sun Jul 9 13:53:32 2017 (r320834) @@ -14,6 +14,7 @@ /dts-v1/; #include "am335x-baltos.dtsi" +#include "am335x-baltos-leds.dtsi" / { model = "OnRISC Baltos iR 3220"; Modified: head/sys/gnu/dts/arm/am335x-baltos-ir5221.dts ============================================================================== --- head/sys/gnu/dts/arm/am335x-baltos-ir5221.dts Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am335x-baltos-ir5221.dts Sun Jul 9 13:53:32 2017 (r320834) @@ -14,6 +14,7 @@ /dts-v1/; #include "am335x-baltos.dtsi" +#include "am335x-baltos-leds.dtsi" / { model = "OnRISC Baltos iR 5221"; Copied: head/sys/gnu/dts/arm/am335x-baltos-leds.dtsi (from r320832, vendor/device-tree/dist/src/arm/am335x-baltos-leds.dtsi) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/arm/am335x-baltos-leds.dtsi Sun Jul 9 13:53:32 2017 (r320834, copy of r320832, vendor/device-tree/dist/src/arm/am335x-baltos-leds.dtsi) @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * VScom OnRISC + * http://www.vscom.de + */ + +/*#include "am33xx.dtsi"*/ + +/ { + leds { + pinctrl-names = "default"; + pinctrl-0 = <&user_leds>; + + compatible = "gpio-leds"; + + power { + label = "onrisc:red:power"; + linux,default-trigger = "default-on"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + wlan { + label = "onrisc:blue:wlan"; + gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + app { + label = "onrisc:green:app"; + gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; +}; + +&am33xx_pinmux { + user_leds: pinmux_user_leds { + pinctrl-single,pins = < + AM33XX_IOPAD(0x908, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* mii1_col.gpio3_0 PWR LED */ + AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* mii1_txd3.gpio0_16 WLAN LED */ + AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* mii1_txd2.gpio0_17 APP LED */ + >; + }; +}; Modified: head/sys/gnu/dts/arm/am335x-boneblack.dts ============================================================================== --- head/sys/gnu/dts/arm/am335x-boneblack.dts Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am335x-boneblack.dts Sun Jul 9 13:53:32 2017 (r320834) @@ -15,3 +15,14 @@ model = "TI AM335x BeagleBone Black"; compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; }; + +&cpu0_opp_table { + /* + * All PG 2.0 silicon may not support 1GHz but some of the early + * BeagleBone Blacks have PG 2.0 silicon which is guaranteed + * to support 1GHz OPP so enable it for PG 2.0 on this board. + */ + oppnitro@1000000000 { + opp-supported-hw = <0x06 0x0100>; + }; +}; Modified: head/sys/gnu/dts/arm/am335x-icev2.dts ============================================================================== --- head/sys/gnu/dts/arm/am335x-icev2.dts Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am335x-icev2.dts Sun Jul 9 13:53:32 2017 (r320834) @@ -201,6 +201,69 @@ AM33XX_IOPAD(0x938, PIN_OUTPUT_PULLUP | MUX_MODE1) /* (L16) gmii1_rxd2.uart3_txd */ >; }; + + cpsw_default: cpsw_default { + pinctrl-single,pins = < + /* Slave 1, RMII mode */ + AM33XX_IOPAD(0x90c, (PIN_INPUT_PULLUP | MUX_MODE1)) /* mii1_crs.rmii1_crs_dv */ + AM33XX_IOPAD(0x944, (PIN_INPUT_PULLUP | MUX_MODE0)) /* rmii1_refclk.rmii1_refclk */ + AM33XX_IOPAD(0x940, (PIN_INPUT_PULLUP | MUX_MODE1)) /* mii1_rxd0.rmii1_rxd0 */ + AM33XX_IOPAD(0x93c, (PIN_INPUT_PULLUP | MUX_MODE1)) /* mii1_rxd1.rmii1_rxd1 */ + AM33XX_IOPAD(0x910, (PIN_INPUT_PULLUP | MUX_MODE1)) /* mii1_rxerr.rmii1_rxerr */ + AM33XX_IOPAD(0x928, (PIN_OUTPUT_PULLDOWN | MUX_MODE1)) /* mii1_txd0.rmii1_txd0 */ + AM33XX_IOPAD(0x924, (PIN_OUTPUT_PULLDOWN | MUX_MODE1)) /* mii1_txd1.rmii1_txd1 */ + AM33XX_IOPAD(0x914, (PIN_OUTPUT_PULLDOWN | MUX_MODE1)) /* mii1_txen.rmii1_txen */ + /* Slave 2, RMII mode */ + AM33XX_IOPAD(0x870, (PIN_INPUT_PULLUP | MUX_MODE3)) /* gpmc_wait0.rmii2_crs_dv */ + AM33XX_IOPAD(0x908, (PIN_INPUT_PULLUP | MUX_MODE1)) /* mii1_col.rmii2_refclk */ + AM33XX_IOPAD(0x86c, (PIN_INPUT_PULLUP | MUX_MODE3)) /* gpmc_a11.rmii2_rxd0 */ + AM33XX_IOPAD(0x868, (PIN_INPUT_PULLUP | MUX_MODE3)) /* gpmc_a10.rmii2_rxd1 */ + AM33XX_IOPAD(0x874, (PIN_INPUT_PULLUP | MUX_MODE3)) /* gpmc_wpn.rmii2_rxerr */ + AM33XX_IOPAD(0x854, (PIN_OUTPUT_PULLDOWN | MUX_MODE3)) /* gpmc_a5.rmii2_txd0 */ + AM33XX_IOPAD(0x850, (PIN_OUTPUT_PULLDOWN | MUX_MODE3)) /* gpmc_a4.rmii2_txd1 */ + AM33XX_IOPAD(0x840, (PIN_OUTPUT_PULLDOWN | MUX_MODE3)) /* gpmc_a0.rmii2_txen */ + >; + }; + + cpsw_sleep: cpsw_sleep { + pinctrl-single,pins = < + /* Slave 1 reset value */ + AM33XX_IOPAD(0x90c, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x944, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x940, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x93c, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x910, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x928, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x924, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x914, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + + /* Slave 2 reset value */ + AM33XX_IOPAD(0x870, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x908, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x86c, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x868, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x874, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x854, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x850, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x840, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + >; + }; + + davinci_mdio_default: davinci_mdio_default { + pinctrl-single,pins = < + /* MDIO */ + AM33XX_IOPAD(0x948, (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)) /* mdio_data.mdio_data */ + AM33XX_IOPAD(0x94c, (PIN_OUTPUT_PULLUP | MUX_MODE0)) /* mdio_clk.mdio_clk */ + >; + }; + + davinci_mdio_sleep: davinci_mdio_sleep { + pinctrl-single,pins = < + /* MDIO reset value */ + AM33XX_IOPAD(0x948, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + AM33XX_IOPAD(0x94c, (PIN_INPUT_PULLDOWN | MUX_MODE7)) + >; + }; }; &i2c0 { @@ -245,6 +308,39 @@ spi-max-frequency = <1000000>; spi-cpol; }; + + spi_nor: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q64", "jedec,spi-nor"; + spi-max-frequency = <80000000>; + m25p,fast-read; + reg = <0>; + + partition@0 { + label = "u-boot-spl"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@1 { + label = "u-boot"; + reg = <0x80000 0x100000>; + read-only; + }; + + partition@2 { + label = "u-boot-env"; + reg = <0x180000 0x20000>; + read-only; + }; + + partition@3 { + label = "misc"; + reg = <0x1A0000 0x660000>; + }; + }; + }; &tscadc { @@ -349,4 +445,62 @@ pinctrl-names = "default"; pinctrl-0 = <&uart3_pins_default>; status = "okay"; +}; + +&gpio3 { + p4 { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "PR1_MII_CTRL"; + }; + + p10 { + gpio-hog; + gpios = <10 GPIO_ACTIVE_HIGH>; + /* ETH1 mux: Low for MII-PRU, high for RMII-CPSW */ + output-high; + line-name = "MUX_MII_CTL1"; + }; +}; + +&cpsw_emac0 { + phy-handle = <ðphy0>; + phy-mode = "rmii"; + dual_emac_res_vlan = <1>; +}; + +&cpsw_emac1 { + phy-handle = <ðphy1>; + phy-mode = "rmii"; + dual_emac_res_vlan = <2>; +}; + +&mac { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&cpsw_default>; + pinctrl-1 = <&cpsw_sleep>; + status = "okay"; + dual_emac; +}; + +&phy_sel { + rmii-clock-ext; +}; + +&davinci_mdio { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&davinci_mdio_default>; + pinctrl-1 = <&davinci_mdio_sleep>; + status = "okay"; + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + reset-delay-us = <2>; /* PHY datasheet states 1uS min */ + + ethphy0: ethernet-phy@1 { + reg = <1>; + }; + + ethphy1: ethernet-phy@3 { + reg = <3>; + }; }; Modified: head/sys/gnu/dts/arm/am335x-sl50.dts ============================================================================== --- head/sys/gnu/dts/arm/am335x-sl50.dts Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am335x-sl50.dts Sun Jul 9 13:53:32 2017 (r320834) @@ -220,7 +220,7 @@ mmc1_pins: pinmux_mmc1_pins { pinctrl-single,pins = < - AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */ + AM33XX_IOPAD(0x96c, PIN_INPUT | MUX_MODE7) /* uart0_rtsn.gpio1_9 */ >; }; @@ -280,10 +280,6 @@ AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE7) /* nKbdReset - gpmc_ad13.gpio1_13 */ AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE7) /* nDispReset - gpmc_ad14.gpio1_14 */ AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE7) /* USB1_enPower - gpmc_a1.gpio1_17 */ - /* AVR Programming - SPI Bus (bit bang) - Screen and Keyboard */ - AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattMOSI spi0_d0.gpio0_3 */ - AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattMISO spi0_d1.gpio0_4 */ - AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattSCLK spi0_clk.gpio0_2 */ /* PDI Bus - Battery system */ AM33XX_IOPAD(0x840, PIN_INPUT_PULLUP | MUX_MODE7) /* nBattReset gpmc_a0.gpio1_16 */ AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE7) /* BattPDIData gpmc_ad15.gpio1_15 */ @@ -384,7 +380,7 @@ pinctrl-names = "default"; pinctrl-0 = <&mmc1_pins>; bus-width = <4>; - cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; + cd-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; vmmc-supply = <&vmmcsd_fixed>; }; Modified: head/sys/gnu/dts/arm/am33xx.dtsi ============================================================================== --- head/sys/gnu/dts/arm/am33xx.dtsi Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am33xx.dtsi Sun Jul 9 13:53:32 2017 (r320834) @@ -46,24 +46,85 @@ device_type = "cpu"; reg = <0>; - /* - * To consider voltage drop between PMIC and SoC, - * tolerance value is reduced to 2% from 4% and - * voltage value is increased as a precaution. - */ - operating-points = < - /* kHz uV */ - 720000 1285000 - 600000 1225000 - 500000 1125000 - 275000 1125000 - >; - voltage-tolerance = <2>; /* 2 percentage */ + operating-points-v2 = <&cpu0_opp_table>; clocks = <&dpll_mpu_ck>; clock-names = "cpu"; clock-latency = <300000>; /* From omap-cpufreq driver */ + }; + }; + + cpu0_opp_table: opp-table { + compatible = "operating-points-v2-ti-cpu"; + syscon = <&scm_conf>; + + /* + * The three following nodes are marked with opp-suspend + * because the can not be enabled simultaneously on a + * single SoC. + */ + opp50@300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <950000 931000 969000>; + opp-supported-hw = <0x06 0x0010>; + opp-suspend; + }; + + opp100@275000000 { + opp-hz = /bits/ 64 <275000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x01 0x00FF>; + opp-suspend; + }; + + opp100@300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x06 0x0020>; + opp-suspend; + }; + + opp100@500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x01 0xFFFF>; + }; + + opp100@600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x06 0x0040>; + }; + + opp120@600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1200000 1176000 1224000>; + opp-supported-hw = <0x01 0xFFFF>; + }; + + opp120@720000000 { + opp-hz = /bits/ 64 <720000000>; + opp-microvolt = <1200000 1176000 1224000>; + opp-supported-hw = <0x06 0x0080>; + }; + + oppturbo@720000000 { + opp-hz = /bits/ 64 <720000000>; + opp-microvolt = <1260000 1234800 1285200>; + opp-supported-hw = <0x01 0xFFFF>; + }; + + oppturbo@800000000 { + opp-hz = /bits/ 64 <800000000>; + opp-microvolt = <1260000 1234800 1285200>; + opp-supported-hw = <0x06 0x0100>; + }; + + oppnitro@1000000000 { + opp-hz = /bits/ 64 <1000000000>; + opp-microvolt = <1325000 1298500 1351500>; + opp-supported-hw = <0x04 0x0200>; }; }; Modified: head/sys/gnu/dts/arm/am3517.dtsi ============================================================================== --- head/sys/gnu/dts/arm/am3517.dtsi Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am3517.dtsi Sun Jul 9 13:53:32 2017 (r320834) @@ -13,6 +13,7 @@ / { aliases { serial3 = &uart4; + can = &hecc; }; ocp@68000000 { @@ -71,6 +72,17 @@ interrupt-controller; pinctrl-single,register-width = <16>; pinctrl-single,function-mask = <0xff1f>; + }; + + hecc: can@5c050000 { + compatible = "ti,am3517-hecc"; + status = "disabled"; + reg = <0x5c050000 0x80>, + <0x5c053000 0x180>, + <0x5c052000 0x200>; + reg-names = "hecc", "hecc-ram", "mbx"; + interrupts = <24>; + clocks = <&hecc_ck>; }; }; }; Modified: head/sys/gnu/dts/arm/am4372.dtsi ============================================================================== --- head/sys/gnu/dts/arm/am4372.dtsi Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am4372.dtsi Sun Jul 9 13:53:32 2017 (r320834) @@ -50,15 +50,14 @@ clock-names = "cpu"; operating-points-v2 = <&cpu0_opp_table>; - ti,syscon-efuse = <&scm_conf 0x610 0x3f 0>; - ti,syscon-rev = <&scm_conf 0x600>; clock-latency = <300000>; /* From omap-cpufreq driver */ }; }; - cpu0_opp_table: opp_table0 { - compatible = "operating-points-v2"; + cpu0_opp_table: opp-table { + compatible = "operating-points-v2-ti-cpu"; + syscon = <&scm_conf>; opp50@300000000 { opp-hz = /bits/ 64 <300000000>; Modified: head/sys/gnu/dts/arm/am437x-gp-evm.dts ============================================================================== --- head/sys/gnu/dts/arm/am437x-gp-evm.dts Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am437x-gp-evm.dts Sun Jul 9 13:53:32 2017 (r320834) @@ -501,6 +501,21 @@ AM4372_IOPAD(0x884, PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn2.gpio1_31 */ >; }; + + uart0_pins_default: uart0_pins_default { + pinctrl-single,pins = < + AM4372_IOPAD(0x968, PIN_INPUT | MUX_MODE0) /* uart0_ctsn.uart0_ctsn */ + AM4372_IOPAD(0x96C, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_rtsn.uart0_rtsn */ + AM4372_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */ + AM4372_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */ + >; + }; +}; + +&uart0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins_default>; }; &i2c0 { Modified: head/sys/gnu/dts/arm/am57xx-idk-common.dtsi ============================================================================== --- head/sys/gnu/dts/arm/am57xx-idk-common.dtsi Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/am57xx-idk-common.dtsi Sun Jul 9 13:53:32 2017 (r320834) @@ -101,6 +101,22 @@ }; }; +&dra7_pmx_core { + dcan1_pins_default: dcan1_pins_default { + pinctrl-single,pins = < + DRA7XX_CORE_IOPAD(0x37d0, PIN_OUTPUT_PULLUP | MUX_MODE0) /* dcan1_tx */ + DRA7XX_CORE_IOPAD(0x37d4, PIN_INPUT_PULLUP | MUX_MODE0) /* dcan1_rx */ + >; + }; + + dcan1_pins_sleep: dcan1_pins_sleep { + pinctrl-single,pins = < + DRA7XX_CORE_IOPAD(0x37d0, MUX_MODE15 | PULL_UP) /* dcan1_tx.off */ + DRA7XX_CORE_IOPAD(0x37d4, MUX_MODE15 | PULL_UP) /* dcan1_rx.off */ + >; + }; +}; + &i2c1 { status = "okay"; clock-frequency = <400000>; @@ -389,6 +405,14 @@ bus-width = <8>; ti,non-removable; max-frequency = <96000000>; +}; + +&dcan1 { + status = "okay"; + pinctrl-names = "default", "sleep", "active"; + pinctrl-0 = <&dcan1_pins_sleep>; + pinctrl-1 = <&dcan1_pins_sleep>; + pinctrl-2 = <&dcan1_pins_default>; }; &qspi { Copied: head/sys/gnu/dts/arm/armada-385-linksys-shelby.dts (from r320832, vendor/device-tree/dist/src/arm/armada-385-linksys-shelby.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/arm/armada-385-linksys-shelby.dts Sun Jul 9 13:53:32 2017 (r320834, copy of r320832, vendor/device-tree/dist/src/arm/armada-385-linksys-shelby.dts) @@ -0,0 +1,114 @@ +/* + * Device Tree file for the Linksys WRT1900ACS (Shelby) + * + * Copyright (C) 2015 Imre Kaloz + * + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without + * any warranty of any kind, whether express or implied. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "armada-385-linksys.dtsi" + +/ { + model = "Linksys WRT1900ACS"; + compatible = "linksys,shelby", "linksys,armada385", "marvell,armada385", + "marvell,armada380"; + + soc { + internal-regs{ + i2c@11000 { + + pca9635@68 { + #address-cells = <1>; + #size-cells = <0>; + + wan_amber@0 { + label = "shelby:amber:wan"; + reg = <0x0>; + }; + + wan_white@1 { + label = "shelby:white:wan"; + reg = <0x1>; + }; + + wlan_2g@2 { + label = "shelby:white:wlan_2g"; + reg = <0x2>; + }; + + wlan_5g@3 { + label = "shelby:white:wlan_5g"; + reg = <0x3>; + }; + + usb2@5 { + label = "shelby:white:usb2"; + reg = <0x5>; + }; + + usb3_1@6 { + label = "shelby:white:usb3_1"; + reg = <0x6>; + }; + + usb3_2@7 { + label = "shelby:white:usb3_2"; + reg = <0x7>; + }; + + wps_white@8 { + label = "shelby:white:wps"; + reg = <0x8>; + }; + + wps_amber@9 { + label = "shelby:amber:wps"; + reg = <0x9>; + }; + }; + }; + }; + }; + + gpio-leds { + power { + label = "shelby:white:power"; + }; + + sata { + label = "shelby:white:sata"; + }; + }; +}; Modified: head/sys/gnu/dts/arm/armada-385-linksys.dtsi ============================================================================== --- head/sys/gnu/dts/arm/armada-385-linksys.dtsi Sun Jul 9 13:13:50 2017 (r320833) +++ head/sys/gnu/dts/arm/armada-385-linksys.dtsi Sun Jul 9 13:53:32 2017 (r320834) @@ -59,7 +59,8 @@ ranges = ; + MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000 + MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>; internal-regs { i2c@11000 { @@ -88,6 +89,9 @@ ethernet@70000 { status = "okay"; phy-mode = "rgmii-id"; + buffer-manager = <&bm>; + bm,pool-long = <2>; + bm,pool-short = <3>; fixed-link { speed = <1000>; full-duplex; @@ -97,6 +101,9 @@ ethernet@34000 { status = "okay"; phy-mode = "sgmii"; + buffer-manager = <&bm>; + bm,pool-long = <0>; + bm,pool-short = <1>; fixed-link { speed = <1000>; full-duplex; @@ -159,6 +166,10 @@ status = "okay"; }; + bm@c8000 { + status = "okay"; + }; + /* USB part of the eSATA/USB 2.0 port */ usb@58000 { status = "okay"; @@ -241,6 +252,10 @@ }; }; + bm-bppi { + status = "okay"; + }; + pcie-controller { status = "okay"; @@ -305,6 +320,7 @@ sata { gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; default-state = "off"; + linux,default-trigger = "disk-activity"; }; }; Copied: head/sys/gnu/dts/arm/armada-385-synology-ds116.dts (from r320832, vendor/device-tree/dist/src/arm/armada-385-synology-ds116.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/arm/armada-385-synology-ds116.dts Sun Jul 9 13:53:32 2017 (r320834, copy of r320832, vendor/device-tree/dist/src/arm/armada-385-synology-ds116.dts) @@ -0,0 +1,321 @@ +/* + * Device Tree file for Synology DS116 NAS + * + * Copyright (C) 2017 Willy Tarreau + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without + * any warranty of any kind, whether express or implied. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "armada-385.dtsi" +#include + +/ { + model = "Synology DS116"; + compatible = "marvell,a385-gp", "marvell,armada385", "marvell,armada380"; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x40000000>; /* 1 GB */ + }; + + soc { + ranges = ; + + internal-regs { + i2c@11000 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; + clock-frequency = <100000>; + + eeprom@57 { + compatible = "atmel,24c64"; + reg = <0x57>; + }; + }; + + serial@12000 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; + }; + + serial@12100 { + /* A PIC16F1829 is connected to uart1 at 9600 bps, + * and takes single-character orders : + * "1" : power off // already handled by the poweroff node + * "2" : short beep + * "3" : long beep + * "4" : turn the power LED ON + * "5" : flash the power LED + * "6" : turn the power LED OFF + * "7" : turn the status LED OFF + * "8" : turn the status LED ON + * "9" : flash the status LED + * "A" : flash the motherboard LED (D8) + * "B" : turn the motherboard LED OFF + * "C" : hard reset + */ + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; + }; + + poweroff@12100 { + compatible = "synology,power-off"; + reg = <0x12100 0x100>; + clocks = <&coreclk 0>; + }; + + ethernet@70000 { + pinctrl-names = "default"; + phy = <&phy0>; + phy-mode = "sgmii"; + buffer-manager = <&bm>; + bm,pool-long = <0>; + status = "okay"; + }; + + + mdio@72004 { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + phy0: ethernet-phy@1 { + reg = <1>; + }; + }; + + sata@a8000 { + pinctrl-names = "default"; + pinctrl-0 = <&sata0_pins>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + sata0: sata-port@0 { + reg = <0>; + target-supply = <®_5v_sata0>; + }; + }; + + bm@c8000 { + status = "okay"; + }; + + usb3@f0000 { + usb-phy = <&usb3_0_phy>; + status = "okay"; + }; + + usb3@f8000 { + usb-phy = <&usb3_1_phy>; + status = "okay"; + }; + }; + + bm-bppi { + status = "okay"; + }; + + gpio-fan { + compatible = "gpio-fan"; + gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>, + <&gpio1 17 GPIO_ACTIVE_HIGH>, + <&gpio1 16 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = < 0 0 + 1500 1 + 2500 2 + 3000 3 + 3400 4 + 3700 5 + 3900 6 + 4000 7>; + cooling-cells = <2>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + /* The green part is on gpio0.20 which is also used by + * sata0, and accesses to SATA disk 0 make it blink so it + * doesn't need to be declared here. + */ + orange { + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + label = "ds116:orange:disk"; + default-state = "off"; + }; + }; + }; + + usb3_0_phy: usb3_0_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_0_vbus>; + }; + + usb3_1_phy: usb3_1_phy { + compatible = "usb-nop-xceiv"; + vcc-supply = <®_usb3_1_vbus>; + }; + + reg_usb3_0_vbus: usb3-vbus0 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus0"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci0_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>; + }; + + reg_usb3_1_vbus: usb3-vbus1 { + compatible = "regulator-fixed"; + regulator-name = "usb3-vbus1"; + pinctrl-names = "default"; + pinctrl-0 = <&xhci1_vbus_pins>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio1 27 GPIO_ACTIVE_HIGH>; + }; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jul 9 13:56:35 2017 Return-Path: Delivered-To: svn-src-head@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 F0587DB28FB; Sun, 9 Jul 2017 13:56:35 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 BCFEE287; Sun, 9 Jul 2017 13:56:35 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69DuYfA019614; Sun, 9 Jul 2017 13:56:34 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69DuYcJ019611; Sun, 9 Jul 2017 13:56:34 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707091356.v69DuYcJ019611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 9 Jul 2017 13:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320835 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 320835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 13:56:36 -0000 Author: manu Date: Sun Jul 9 13:56:34 2017 New Revision: 320835 URL: https://svnweb.freebsd.org/changeset/base/320835 Log: dts: arm: Fix our local patches for H3 sun4i-a10.h is not included anymore, define directly the drive strengh of the pins. Modified: head/sys/boot/fdt/dts/arm/h3.dtsi head/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts Modified: head/sys/boot/fdt/dts/arm/h3.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/h3.dtsi Sun Jul 9 13:53:32 2017 (r320834) +++ head/sys/boot/fdt/dts/arm/h3.dtsi Sun Jul 9 13:56:34 2017 (r320835) @@ -96,14 +96,12 @@ "PD7", "PD8", "PD9", "PD10", "PD12", "PD13", "PD15", "PD16", "PD17"; allwinner,function = "emac"; - allwinner,drive = ; - allwinner,pull = ; + allwinner,drive = <40>; }; emac_phy_reset_pin: emac_phy_reset_pin@0 { allwinner,pins = "PD6"; allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; + allwinner,drive = <10>; }; }; Modified: head/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts Sun Jul 9 13:53:32 2017 (r320834) +++ head/sys/boot/fdt/dts/arm/orangepi-plus-2e.dts Sun Jul 9 13:56:34 2017 (r320835) @@ -50,15 +50,13 @@ emac_phy_reset_pin: emac_phy_reset_pin@0 { allwinner,pins = "PD6"; allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; + allwinner,drive = <10>; }; codec_pa_pin: codec_pa_pin@0 { allwinner,pins = "PA16"; allwinner,function = "gpio_out"; - allwinner,drive = ; - allwinner,pull = ; + allwinner,drive = <10>; }; }; From owner-svn-src-head@freebsd.org Sun Jul 9 14:15:52 2017 Return-Path: Delivered-To: svn-src-head@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 AF70ADB2E3F; Sun, 9 Jul 2017 14:15:52 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7E47AFEE; Sun, 9 Jul 2017 14:15:52 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69EFphQ027524; Sun, 9 Jul 2017 14:15:51 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69EFpbN027523; Sun, 9 Jul 2017 14:15:51 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707091415.v69EFpbN027523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 9 Jul 2017 14:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320836 - head/sys/fs/fdescfs X-SVN-Group: head X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: head/sys/fs/fdescfs X-SVN-Commit-Revision: 320836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 14:15:52 -0000 Author: dchagin Date: Sun Jul 9 14:15:51 2017 New Revision: 320836 URL: https://svnweb.freebsd.org/changeset/base/320836 Log: Eliminate the bogus casts. MFC after: 3 weeks Modified: head/sys/fs/fdescfs/fdesc_vnops.c Modified: head/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 9 13:56:34 2017 (r320835) +++ head/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 9 14:15:51 2017 (r320836) @@ -162,7 +162,7 @@ loop: * If a forced unmount is progressing, we need to drop it. The flags are * protected by the hashmtx. */ - fmp = (struct fdescmount *)mp->mnt_data; + fmp = mp->mnt_data; if (fmp == NULL || fmp->flags & FMNT_UNMOUNTF) { mtx_unlock(&fdesc_hashmtx); return (-1); @@ -207,7 +207,7 @@ loop: * If a forced unmount is progressing, we need to drop it. The flags are * protected by the hashmtx. */ - fmp = (struct fdescmount *)mp->mnt_data; + fmp = mp->mnt_data; if (fmp == NULL || fmp->flags & FMNT_UNMOUNTF) { mtx_unlock(&fdesc_hashmtx); vgone(vp); From owner-svn-src-head@freebsd.org Sun Jul 9 14:18:23 2017 Return-Path: Delivered-To: svn-src-head@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 AF232DB2EB4; Sun, 9 Jul 2017 14:18:23 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7EF421165; Sun, 9 Jul 2017 14:18:23 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69EIM0o027659; Sun, 9 Jul 2017 14:18:22 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69EIMLY027658; Sun, 9 Jul 2017 14:18:22 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707091418.v69EIMLY027658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 9 Jul 2017 14:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320837 - head/sys/fs/fdescfs X-SVN-Group: head X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: head/sys/fs/fdescfs X-SVN-Commit-Revision: 320837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 14:18:23 -0000 Author: dchagin Date: Sun Jul 9 14:18:22 2017 New Revision: 320837 URL: https://svnweb.freebsd.org/changeset/base/320837 Log: Style(9). Whitespace. MFC after: 3 weeks Modified: head/sys/fs/fdescfs/fdesc_vnops.c Modified: head/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 9 14:15:51 2017 (r320836) +++ head/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 9 14:18:22 2017 (r320837) @@ -358,7 +358,7 @@ fdesc_lookup(struct vop_lookup_args *ap) error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, LK_EXCLUSIVE, &fvp); } - + if (error) goto bad; *vpp = fvp; From owner-svn-src-head@freebsd.org Sun Jul 9 15:19:29 2017 Return-Path: Delivered-To: svn-src-head@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 5C909D87FFD; Sun, 9 Jul 2017 15:19:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1D6432DD0; Sun, 9 Jul 2017 15:19:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69FJS05056281; Sun, 9 Jul 2017 15:19:28 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69FJStL056280; Sun, 9 Jul 2017 15:19:28 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201707091519.v69FJStL056280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Jul 2017 15:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320842 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 320842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 15:19:29 -0000 Author: pfg Date: Sun Jul 9 15:19:28 2017 New Revision: 320842 URL: https://svnweb.freebsd.org/changeset/base/320842 Log: Remove stale comments. There's no real advantage in using memcpy here. Dicussed with: bde (long ago) Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jul 9 15:14:22 2017 (r320841) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jul 9 15:19:28 2017 (r320842) @@ -126,7 +126,7 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) ip->i_gid = ei->e2di_gid; ip->i_uid |= (uint32_t)ei->e2di_uid_high << 16; ip->i_gid |= (uint32_t)ei->e2di_gid_high << 16; - /* XXX use memcpy */ + for (i = 0; i < EXT2_NDADDR; i++) ip->i_db[i] = ei->e2di_blocks[i]; for (i = 0; i < EXT2_NIADDR; i++) @@ -176,7 +176,7 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_uid_high = ip->i_uid >> 16 & 0xffff; ei->e2di_gid = ip->i_gid & 0xffff; ei->e2di_gid_high = ip->i_gid >> 16 & 0xffff; - /* XXX use memcpy */ + for (i = 0; i < EXT2_NDADDR; i++) ei->e2di_blocks[i] = ip->i_db[i]; for (i = 0; i < EXT2_NIADDR; i++) From owner-svn-src-head@freebsd.org Sun Jul 9 15:41:50 2017 Return-Path: Delivered-To: svn-src-head@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 B23DED8D676; Sun, 9 Jul 2017 15:41:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 81E403688; Sun, 9 Jul 2017 15:41:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69FfnVh065637; Sun, 9 Jul 2017 15:41:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69FfnqD065636; Sun, 9 Jul 2017 15:41:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707091541.v69FfnqD065636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 9 Jul 2017 15:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320843 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 320843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 15:41:50 -0000 Author: kib Date: Sun Jul 9 15:41:49 2017 New Revision: 320843 URL: https://svnweb.freebsd.org/changeset/base/320843 Log: Fix loop termination in vm_map_find_min(). Reported by: antoine Tested by: Stefan Ehmann , Jan Kokemueller PR: 220493 Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Jul 9 15:19:28 2017 (r320842) +++ head/sys/vm/vm_map.c Sun Jul 9 15:41:49 2017 (r320843) @@ -1571,7 +1571,7 @@ vm_map_find_min(vm_map_t map, vm_object_t object, vm_o find_space, prot, max, cow); if (rv == KERN_SUCCESS || min_addr >= hint) return (rv); - *addr = min_addr; + *addr = hint = min_addr; } } From owner-svn-src-head@freebsd.org Sun Jul 9 16:57:27 2017 Return-Path: Delivered-To: svn-src-head@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 3394CD90C74; Sun, 9 Jul 2017 16:57:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F2AF8656EF; Sun, 9 Jul 2017 16:57:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69GvQVI096959; Sun, 9 Jul 2017 16:57:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69GvOar096942; Sun, 9 Jul 2017 16:57:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707091657.v69GvOar096942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 9 Jul 2017 16:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/modules X-SVN-Commit-Revision: 320844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 16:57:27 -0000 Author: imp Date: Sun Jul 9 16:57:24 2017 New Revision: 320844 URL: https://svnweb.freebsd.org/changeset/base/320844 Log: An MMC/SD/SDIO stack using CAM Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's flexible queueing will make it easier to write non-storage drivers than the legacy stack. SDIO drivers from both the kernel and as userland daemons are possible, though much of that functionality will come later. Some of the CAM integration isn't complete (there are sleeps in the device probe state machine, for example), but those minor issues can be improved in-tree more easily than out of tree and shouldn't gate progress on other fronts. Appologies to reviews if specific items have been overlooked. Submitted by: Ilya Bakulin Reviewed by: emaste, imp, mav, adrian, ian Differential Review: https://reviews.freebsd.org/D4761 merge with first commit, various compile hacks. Added: head/sys/amd64/conf/MMCCAM (contents, props changed) head/sys/arm/conf/BEAGLEBONE-MMCCAM (contents, props changed) head/sys/cam/mmc/ head/sys/cam/mmc/mmc.h - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h head/sys/cam/mmc/mmc_all.h - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h head/sys/cam/mmc/mmc_bus.h (contents, props changed) head/sys/cam/mmc/mmc_da.c (contents, props changed) head/sys/cam/mmc/mmc_sdio.c (contents, props changed) head/sys/cam/mmc/mmc_sdio.h - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h head/sys/cam/mmc/mmc_xpt.c (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/lib/libcam/Makefile head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c head/sys/arm/ti/ti_sdhci.c head/sys/cam/cam_ccb.h head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt.h head/sys/cam/cam_xpt_internal.h head/sys/cam/scsi/scsi_pass.c head/sys/conf/files head/sys/conf/options head/sys/dev/mmc/bridge.h head/sys/dev/mmc/mmcbrvar.h head/sys/dev/mmc/mmcreg.h head/sys/dev/sdhci/fsl_sdhci.c head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_acpi.c head/sys/dev/sdhci/sdhci_pci.c head/sys/modules/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Sun Jul 9 15:41:49 2017 (r320843) +++ head/etc/mtree/BSD.include.dist Sun Jul 9 16:57:24 2017 (r320844) @@ -90,6 +90,8 @@ cam ata .. + mmc + .. nvme .. scsi Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Sun Jul 9 15:41:49 2017 (r320843) +++ head/include/Makefile Sun Jul 9 16:57:24 2017 (r320844) @@ -42,7 +42,7 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdat LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm -LSUBDIRS= cam/ata cam/nvme cam/scsi \ +LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ Modified: head/lib/libcam/Makefile ============================================================================== --- head/lib/libcam/Makefile Sun Jul 9 15:41:49 2017 (r320843) +++ head/lib/libcam/Makefile Sun Jul 9 16:57:24 2017 (r320844) @@ -38,6 +38,7 @@ MLINKS+= cam.3 cam_open_device.3 \ .PATH: ${SRCTOP}/sys/cam \ ${SRCTOP}/sys/cam/ata \ + ${SRCTOP}/sys/cam/mmc \ ${SRCTOP}/sys/cam/scsi CFLAGS+= -I${.CURDIR} -I${SRCTOP}/sys Added: head/sys/amd64/conf/MMCCAM ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/conf/MMCCAM Sun Jul 9 16:57:24 2017 (r320844) @@ -0,0 +1,36 @@ +# MMCCAM is the kernel config for doing MMC on CAM development +# and testing on bhyve +# $FreeBSD$ + +include MINIMAL + +ident MMCCAM + +# Access GPT-formatted and labeled root volume +options GEOM_PART_GPT +options GEOM_LABEL + +# UART -- for bhyve console +device uart + +# kgdb stub +device bvmdebug + +# VirtIO support, needed for bhyve +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI device +device vtnet # VirtIO Ethernet device +device virtio_blk # VirtIO Block device +device virtio_scsi # VirtIO SCSI device +device virtio_balloon # VirtIO Memory Balloon device + +# CAM-specific stuff +device pass +device scbus +device da +device mmccam + +options MMCCAM +# Add CAMDEBUG stuff +options CAMDEBUG +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH|CAM_DEBUG_TRACE) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Jul 9 15:41:49 2017 (r320843) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Jul 9 16:57:24 2017 (r320844) @@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$"); #include "mmcbr_if.h" #include "sdhci_if.h" +#include "opt_mmccam.h" + #include "bcm2835_dma.h" #include #include "bcm2835_vcbus.h" @@ -253,7 +255,11 @@ bcm_sdhci_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); +#ifdef MMCCAM + sdhci_cam_start_slot(&sc->sc_slot); +#else sdhci_start_slot(&sc->sc_slot); +#endif return (0); Added: head/sys/arm/conf/BEAGLEBONE-MMCCAM ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/BEAGLEBONE-MMCCAM Sun Jul 9 16:57:24 2017 (r320844) @@ -0,0 +1,21 @@ +# +# BEAGLEBONE-MMCCAM +# +# Custom kernel for Beaglebone plus MMCCAM as opposed to the prior MMC stack. It is +# present to keep it building in tree since it wouldn't work in LINT. +# +# $FreeBSD$ + +include BEAGLEBONE + +# Add CAMDEBUG stuff +options CAMDEBUG +options CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH|CAM_DEBUG_TRACE) + +# pass(4) device +device pass +device mmccam +options MMCCAM + +nodevice mmc +nodevice mmcsd Modified: head/sys/arm/ti/ti_sdhci.c ============================================================================== --- head/sys/arm/ti/ti_sdhci.c Sun Jul 9 15:41:49 2017 (r320843) +++ head/sys/arm/ti/ti_sdhci.c Sun Jul 9 16:57:24 2017 (r320844) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -60,6 +62,8 @@ __FBSDID("$FreeBSD$"); #include #include "gpio_if.h" +#include "opt_mmccam.h" + struct ti_sdhci_softc { device_t dev; struct sdhci_fdt_gpio * gpio; @@ -122,6 +126,11 @@ static struct ofw_compat_data compat_data[] = { #define MMCHS_SD_CAPA_VS30 (1 << 25) #define MMCHS_SD_CAPA_VS33 (1 << 24) +/* Forward declarations, CAM-relataed */ +// static void ti_sdhci_cam_poll(struct cam_sim *); +// static void ti_sdhci_cam_action(struct cam_sim *, union ccb *); +// static int ti_sdhci_cam_settran_settings(struct ti_sdhci_softc *sc, union ccb *); + static inline uint32_t ti_mmchs_read_4(struct ti_sdhci_softc *sc, bus_size_t off) { @@ -241,6 +250,22 @@ ti_sdhci_write_1(device_t dev, struct sdhci_slot *slot struct ti_sdhci_softc *sc = device_get_softc(dev); uint32_t val32; +#ifdef MMCCAM + uint32_t newval32; + if (off == SDHCI_HOST_CONTROL) { + val32 = ti_mmchs_read_4(sc, MMCHS_CON); + newval32 = val32; + if (val & SDHCI_CTRL_8BITBUS) { + device_printf(dev, "Custom-enabling 8-bit bus\n"); + newval32 |= MMCHS_CON_DW8; + } else { + device_printf(dev, "Custom-disabling 8-bit bus\n"); + newval32 &= ~MMCHS_CON_DW8; + } + if (newval32 != val32) + ti_mmchs_write_4(sc, MMCHS_CON, newval32); + } +#endif val32 = RD4(sc, off & ~3); val32 &= ~(0xff << (off & 3) * 8); val32 |= (val << (off & 3) * 8); @@ -658,8 +683,11 @@ ti_sdhci_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); +#ifdef MMCCAM + sdhci_cam_start_slot(&sc->slot); +#else sdhci_start_slot(&sc->slot); - +#endif return (0); fail: @@ -730,4 +758,7 @@ static driver_t ti_sdhci_driver = { DRIVER_MODULE(sdhci_ti, simplebus, ti_sdhci_driver, ti_sdhci_devclass, NULL, NULL); MODULE_DEPEND(sdhci_ti, sdhci, 1, 1, 1); + +#ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_ti); +#endif Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Sun Jul 9 15:41:49 2017 (r320843) +++ head/sys/cam/cam_ccb.h Sun Jul 9 16:57:24 2017 (r320844) @@ -42,6 +42,7 @@ #include #include #include +#include /* General allocation length definitions for CCB structures */ #define IOCDBLEN CAM_MAX_CDBLEN /* Space for CDB bytes/pointer */ @@ -208,10 +209,10 @@ typedef enum { XPT_NVME_IO = 0x1c | XPT_FC_DEV_QUEUED, /* Execiute the requestred NVMe I/O operation */ - XPT_MMCSD_IO = 0x1d | XPT_FC_DEV_QUEUED, + XPT_MMC_IO = 0x1d | XPT_FC_DEV_QUEUED, /* Placeholder for MMC / SD / SDIO I/O stuff */ - XPT_SCAN_TGT = 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB + XPT_SCAN_TGT = 0x1e | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY, /* Scan Target */ @@ -267,6 +268,7 @@ typedef enum { PROTO_SATAPM, /* SATA Port Multiplier */ PROTO_SEMB, /* SATA Enclosure Management Bridge */ PROTO_NVME, /* NVME */ + PROTO_MMCSD, /* MMC, SD, SDIO */ } cam_proto; typedef enum { @@ -283,6 +285,7 @@ typedef enum { XPORT_ISCSI, /* iSCSI */ XPORT_SRP, /* SCSI RDMA Protocol */ XPORT_NVME, /* NVMe over PCIe */ + XPORT_MMCSD, /* MMC, SD, SDIO card */ } cam_xport; #define XPORT_IS_NVME(t) ((t) == XPORT_NVME) @@ -498,6 +501,7 @@ struct device_match_result { cam_proto protocol; struct scsi_inquiry_data inq_data; struct ata_params ident_data; + struct mmc_params mmc_ident_data; dev_result_flags flags; }; @@ -773,6 +777,16 @@ struct ccb_ataio { uint32_t unused; }; +/* + * MMC I/O Request CCB used for the XPT_MMC_IO function code. + */ +struct ccb_mmcio { + struct ccb_hdr ccb_h; + union ccb *next_ccb; /* Ptr for next CCB for action */ + struct mmc_command cmd; + struct mmc_command stop; +}; + struct ccb_accept_tio { struct ccb_hdr ccb_h; cdb_t cdb_io; /* Union for CDB bytes/pointer */ @@ -1005,7 +1019,28 @@ struct ccb_trans_settings_nvme u_int max_xfer; /* Max transfer size (0 -> unlimited */ u_int caps; }; - + +#include +struct ccb_trans_settings_mmc { + struct mmc_ios ios; +#define MMC_CLK (1 << 1) +#define MMC_VDD (1 << 2) +#define MMC_CS (1 << 3) +#define MMC_BW (1 << 4) +#define MMC_PM (1 << 5) +#define MMC_BT (1 << 6) +#define MMC_BM (1 << 7) + uint32_t ios_valid; +/* The folowing is used only for GET_TRAN_SETTINGS */ + uint32_t host_ocr; + int host_f_min; + int host_f_max; +#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers */ +#define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers */ +#define MMC_CAP_HSPEED (1 << 2) /* Can do High Speed transfers */ + uint32_t host_caps; +}; + /* Get/Set transfer rate/width/disconnection/tag queueing settings */ struct ccb_trans_settings { struct ccb_hdr ccb_h; @@ -1019,6 +1054,7 @@ struct ccb_trans_settings { struct ccb_trans_settings_ata ata; struct ccb_trans_settings_scsi scsi; struct ccb_trans_settings_nvme nvme; + struct ccb_trans_settings_mmc mmc; } proto_specific; union { u_int valid; /* Which fields to honor */ @@ -1284,6 +1320,7 @@ union ccb { struct ccb_dev_advinfo cdai; struct ccb_async casync; struct ccb_nvmeio nvmeio; + struct ccb_mmcio mmcio; }; #define CCB_CLEAR_ALL_EXCEPT_HDR(ccbp) \ @@ -1327,6 +1364,13 @@ cam_fill_smpio(struct ccb_smpio *smpio, uint32_t retri uint32_t timeout); static __inline void +cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, + uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t mmc_flags, + struct mmc_data *mmc_d, + uint32_t timeout); + +static __inline void cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int32_t flags, u_int8_t tag_action, @@ -1412,6 +1456,34 @@ cam_fill_smpio(struct ccb_smpio *smpio, uint32_t retri smpio->smp_request_len = smp_request_len; smpio->smp_response = smp_response; smpio->smp_response_len = smp_response_len; +} + +static __inline void +cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, + uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t mmc_flags, + struct mmc_data *mmc_d, + uint32_t timeout) +{ + mmcio->ccb_h.func_code = XPT_MMC_IO; + mmcio->ccb_h.flags = flags; + mmcio->ccb_h.retry_count = retries; + mmcio->ccb_h.cbfcnp = cbfcnp; + mmcio->ccb_h.timeout = timeout; + mmcio->cmd.opcode = mmc_opcode; + mmcio->cmd.arg = mmc_arg; + mmcio->cmd.flags = mmc_flags; + mmcio->stop.opcode = 0; + mmcio->stop.arg = 0; + mmcio->stop.flags = 0; + if (mmc_d != NULL) { + mmcio->cmd.data = mmc_d; + } else + mmcio->cmd.data = NULL; + mmcio->cmd.resp[0] = 0; + mmcio->cmd.resp[1] = 0; + mmcio->cmd.resp[2] = 0; + mmcio->cmd.resp[3] = 0; } static __inline void Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Sun Jul 9 15:41:49 2017 (r320843) +++ head/sys/cam/cam_periph.c Sun Jul 9 16:57:24 2017 (r320844) @@ -827,6 +827,18 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; numbufs = 1; break; + case XPT_MMC_IO: + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) + return(0); + /* Two mappings: one for cmd->data and one for cmd->data->data */ + data_ptrs[0] = (unsigned char **)&ccb->mmcio.cmd.data; + lengths[0] = sizeof(struct mmc_data *); + dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; + data_ptrs[1] = (unsigned char **)&ccb->mmcio.cmd.data->data; + lengths[1] = ccb->mmcio.cmd.data->len; + dirs[1] = ccb->ccb_h.flags & CAM_DIR_MASK; + numbufs = 2; + break; case XPT_SMP_IO: data_ptrs[0] = &ccb->smpio.smp_request; lengths[0] = ccb->smpio.smp_request_len; Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Jul 9 15:41:49 2017 (r320843) +++ head/sys/cam/cam_xpt.c Sun Jul 9 16:57:24 2017 (r320844) @@ -329,7 +329,6 @@ static xpt_devicefunc_t xptsetasyncfunc; static xpt_busfunc_t xptsetasyncbusfunc; static cam_status xptregister(struct cam_periph *periph, void *arg); -static const char * xpt_action_name(uint32_t action); static __inline int device_is_queued(struct cam_ed *device); static __inline int @@ -412,7 +411,7 @@ xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, i } return (error); } - + static int xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { @@ -820,6 +819,8 @@ xpt_scanner_thread(void *dummy) TAILQ_REMOVE(&xsoftc.ccb_scanq, &ccb->ccb_h, sim_links.tqe); xpt_unlock_buses(); + printf("xpt_scanner_thread is firing on path "); + xpt_print_path(ccb->ccb_h.path);printf("\n"); /* * Since lock can be dropped inside and path freed * by completion callback even before return here, @@ -1503,7 +1504,7 @@ xptdevicematch(struct dev_match_pattern *patterns, u_i cur_pattern = &patterns[i].pattern.device_pattern; - /* Error out if mutually exclusive options are specified. */ + /* Error out if mutually exclusive options are specified. */ if ((cur_pattern->flags & (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) == (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) return(DM_RET_ERROR); @@ -1905,6 +1906,9 @@ xptedtdevicefunc(struct cam_ed *device, void *arg) bcopy(&device->ident_data, &cdm->matches[j].result.device_result.ident_data, sizeof(struct ata_params)); + bcopy(&device->mmc_ident_data, + &cdm->matches[j].result.device_result.mmc_ident_data, + sizeof(struct mmc_params)); /* Let the user know whether this device is unconfigured */ if (device->flags & CAM_DEV_UNCONFIGURED) @@ -2690,6 +2694,8 @@ xpt_action_default(union ccb *start_ccb) if (start_ccb->ccb_h.func_code == XPT_NVME_IO) start_ccb->nvmeio.resid = 0; /* FALLTHROUGH */ + case XPT_MMC_IO: + /* XXX just like nmve_io? */ case XPT_RESET_DEV: case XPT_ENG_EXEC: case XPT_SMP_IO: @@ -2801,11 +2807,12 @@ call_sim: mtx_lock(mtx); else mtx = NULL; + CAM_DEBUG(path, CAM_DEBUG_TRACE, - ("sim->sim_action: func=%#x\n", start_ccb->ccb_h.func_code)); + ("Calling sim->sim_action(): func=%#x\n", start_ccb->ccb_h.func_code)); (*(sim->sim_action))(sim, start_ccb); CAM_DEBUG(path, CAM_DEBUG_TRACE, - ("sim->sim_action: status=%#x\n", start_ccb->ccb_h.status)); + ("sim->sim_action returned: status=%#x\n", start_ccb->ccb_h.status)); if (mtx) mtx_unlock(mtx); break; @@ -5540,7 +5547,7 @@ static struct kv map[] = { { XPT_GET_SIM_KNOB, "XPT_GET_SIM_KNOB" }, { XPT_SET_SIM_KNOB, "XPT_SET_SIM_KNOB" }, { XPT_NVME_IO, "XPT_NVME_IO" }, - { XPT_MMCSD_IO, "XPT_MMCSD_IO" }, + { XPT_MMC_IO, "XPT_MMC_IO" }, { XPT_SMP_IO, "XPT_SMP_IO" }, { XPT_SCAN_TGT, "XPT_SCAN_TGT" }, { XPT_ENG_INQ, "XPT_ENG_INQ" }, @@ -5556,7 +5563,7 @@ static struct kv map[] = { { 0, 0 } }; -static const char * +const char * xpt_action_name(uint32_t action) { static char buffer[32]; /* Only for unknown messages -- racy */ Modified: head/sys/cam/cam_xpt.h ============================================================================== --- head/sys/cam/cam_xpt.h Sun Jul 9 15:41:49 2017 (r320843) +++ head/sys/cam/cam_xpt.h Sun Jul 9 16:57:24 2017 (r320844) @@ -141,6 +141,8 @@ void xpt_copy_path(struct cam_path *new_path, void xpt_release_path(struct cam_path *path); +const char * xpt_action_name(uint32_t action); + #endif /* _KERNEL */ #endif /* _CAM_CAM_XPT_H */ Modified: head/sys/cam/cam_xpt_internal.h ============================================================================== --- head/sys/cam/cam_xpt_internal.h Sun Jul 9 15:41:49 2017 (r320843) +++ head/sys/cam/cam_xpt_internal.h Sun Jul 9 16:57:24 2017 (r320844) @@ -125,6 +125,7 @@ struct cam_ed { uint32_t rcap_len; uint8_t *rcap_buf; struct ata_params ident_data; + struct mmc_params mmc_ident_data; u_int8_t inq_flags; /* * Current settings for inquiry flags. * This allows us to override settings Copied and modified: head/sys/cam/mmc/mmc.h (from r320843, head/sys/dev/mmc/mmcbrvar.h) ============================================================================== --- head/sys/dev/mmc/mmcbrvar.h Sun Jul 9 15:41:49 2017 (r320843, copy source) +++ head/sys/cam/mmc/mmc.h Sun Jul 9 16:57:24 2017 (r320844) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2014-2016 Ilya Bakulin. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,77 +48,47 @@ * or the SD Card Association to disclose or distribute any technical * information, know-how or other confidential information to any third party. * + * Inspired coded in sys/dev/mmc. Thanks to Warner Losh , + * Bernd Walter , and other authors. + * * $FreeBSD$ */ -#ifndef DEV_MMC_MMCBRVAR_H -#define DEV_MMC_MMCBRVAR_H +#ifndef CAM_MMC_H +#define CAM_MMC_H #include - -#include "mmcbr_if.h" - -enum mmcbr_device_ivars { - MMCBR_IVAR_BUS_MODE, - MMCBR_IVAR_BUS_WIDTH, - MMCBR_IVAR_CHIP_SELECT, - MMCBR_IVAR_CLOCK, - MMCBR_IVAR_F_MIN, - MMCBR_IVAR_F_MAX, - MMCBR_IVAR_HOST_OCR, - MMCBR_IVAR_MODE, - MMCBR_IVAR_OCR, - MMCBR_IVAR_POWER_MODE, - MMCBR_IVAR_VDD, - MMCBR_IVAR_VCCQ, - MMCBR_IVAR_CAPS, - MMCBR_IVAR_TIMING, - MMCBR_IVAR_MAX_DATA, - MMCBR_IVAR_MAX_BUSY_TIMEOUT -}; - /* - * Simplified accessors for bridge devices + * This structure describes an MMC/SD card */ -#define MMCBR_ACCESSOR(var, ivar, type) \ - __BUS_ACCESSOR(mmcbr, var, MMCBR, ivar, type) +struct mmc_params { + u_int8_t model[40]; /* Card model */ -MMCBR_ACCESSOR(bus_mode, BUS_MODE, int) -MMCBR_ACCESSOR(bus_width, BUS_WIDTH, int) -MMCBR_ACCESSOR(chip_select, CHIP_SELECT, int) -MMCBR_ACCESSOR(clock, CLOCK, int) -MMCBR_ACCESSOR(f_max, F_MAX, int) -MMCBR_ACCESSOR(f_min, F_MIN, int) -MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) -MMCBR_ACCESSOR(mode, MODE, int) -MMCBR_ACCESSOR(ocr, OCR, int) -MMCBR_ACCESSOR(power_mode, POWER_MODE, int) -MMCBR_ACCESSOR(vdd, VDD, int) -MMCBR_ACCESSOR(vccq, VCCQ, int) -MMCBR_ACCESSOR(caps, CAPS, int) -MMCBR_ACCESSOR(timing, TIMING, int) -MMCBR_ACCESSOR(max_data, MAX_DATA, int) -MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) + /* Card OCR */ + uint32_t card_ocr; -static int __inline -mmcbr_update_ios(device_t dev) -{ + /* OCR of the IO portion of the card */ + uint32_t io_ocr; - return (MMCBR_UPDATE_IOS(device_get_parent(dev), dev)); -} + /* Card CID -- raw and parsed */ + uint32_t card_cid[4]; + struct mmc_cid cid; -static int __inline -mmcbr_switch_vccq(device_t dev) -{ + /* Card CSD -- raw */ + uint32_t card_csd[4]; - return (MMCBR_SWITCH_VCCQ(device_get_parent(dev), dev)); -} + /* Card RCA */ + uint16_t card_rca; -static int __inline -mmcbr_get_ro(device_t dev) -{ + /* What kind of card is it */ + uint32_t card_features; +#define CARD_FEATURE_MEMORY 0x1 +#define CARD_FEATURE_SDHC 0x1 << 1 +#define CARD_FEATURE_SDIO 0x1 << 2 +#define CARD_FEATURE_SD20 0x1 << 3 +#define CARD_FEATURE_MMC 0x1 << 4 - return (MMCBR_GET_RO(device_get_parent(dev), dev)); -} + uint8_t sdio_func_count; +} __packed; -#endif /* DEV_MMC_MMCBRVAR_H */ +#endif Copied and modified: head/sys/cam/mmc/mmc_all.h (from r320843, head/sys/dev/mmc/mmcbrvar.h) ============================================================================== --- head/sys/dev/mmc/mmcbrvar.h Sun Jul 9 15:41:49 2017 (r320843, copy source) +++ head/sys/cam/mmc/mmc_all.h Sun Jul 9 16:57:24 2017 (r320844) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2014-2016 Ilya Bakulin. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -52,74 +51,20 @@ * $FreeBSD$ */ -#ifndef DEV_MMC_MMCBRVAR_H -#define DEV_MMC_MMCBRVAR_H - -#include - -#include "mmcbr_if.h" - -enum mmcbr_device_ivars { - MMCBR_IVAR_BUS_MODE, - MMCBR_IVAR_BUS_WIDTH, - MMCBR_IVAR_CHIP_SELECT, - MMCBR_IVAR_CLOCK, - MMCBR_IVAR_F_MIN, - MMCBR_IVAR_F_MAX, - MMCBR_IVAR_HOST_OCR, - MMCBR_IVAR_MODE, - MMCBR_IVAR_OCR, - MMCBR_IVAR_POWER_MODE, - MMCBR_IVAR_VDD, - MMCBR_IVAR_VCCQ, - MMCBR_IVAR_CAPS, - MMCBR_IVAR_TIMING, - MMCBR_IVAR_MAX_DATA, - MMCBR_IVAR_MAX_BUSY_TIMEOUT -}; - /* - * Simplified accessors for bridge devices + * MMC function that should be visible to the CAM subsystem + * and are somehow useful should be declared here + * + * Like in other *_all.h, it's also a nice place to include + * some other transport-specific headers. */ -#define MMCBR_ACCESSOR(var, ivar, type) \ - __BUS_ACCESSOR(mmcbr, var, MMCBR, ivar, type) -MMCBR_ACCESSOR(bus_mode, BUS_MODE, int) -MMCBR_ACCESSOR(bus_width, BUS_WIDTH, int) -MMCBR_ACCESSOR(chip_select, CHIP_SELECT, int) -MMCBR_ACCESSOR(clock, CLOCK, int) -MMCBR_ACCESSOR(f_max, F_MAX, int) -MMCBR_ACCESSOR(f_min, F_MIN, int) -MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) -MMCBR_ACCESSOR(mode, MODE, int) -MMCBR_ACCESSOR(ocr, OCR, int) -MMCBR_ACCESSOR(power_mode, POWER_MODE, int) -MMCBR_ACCESSOR(vdd, VDD, int) -MMCBR_ACCESSOR(vccq, VCCQ, int) -MMCBR_ACCESSOR(caps, CAPS, int) -MMCBR_ACCESSOR(timing, TIMING, int) -MMCBR_ACCESSOR(max_data, MAX_DATA, int) -MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) +#ifndef CAM_MMC_ALL_H +#define CAM_MMC_ALL_H -static int __inline -mmcbr_update_ios(device_t dev) -{ +#include +#include - return (MMCBR_UPDATE_IOS(device_get_parent(dev), dev)); -} +void mmc_print_ident(struct mmc_params *ident_data); -static int __inline -mmcbr_switch_vccq(device_t dev) -{ - - return (MMCBR_SWITCH_VCCQ(device_get_parent(dev), dev)); -} - -static int __inline -mmcbr_get_ro(device_t dev) -{ - - return (MMCBR_GET_RO(device_get_parent(dev), dev)); -} - -#endif /* DEV_MMC_MMCBRVAR_H */ +#endif Added: head/sys/cam/mmc/mmc_bus.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cam/mmc/mmc_bus.h Sun Jul 9 16:57:24 2017 (r320844) @@ -0,0 +1,5 @@ +/* + * This file is in the public domain. + * $FreeBSD$ + */ +#include Added: head/sys/cam/mmc/mmc_da.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cam/mmc/mmc_da.c Sun Jul 9 16:57:24 2017 (r320844) @@ -0,0 +1,1432 @@ +/*- + * Copyright (c) 2006 Bernd Walter + * Copyright (c) 2006 M. Warner Losh + * Copyright (c) 2009 Alexander Motin + * Copyright (c) 2015-2017 Ilya Bakulin + * 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, + * without modification, immediately at the beginning of the file. + * 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 ``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. + * + * Some code derived from the sys/dev/mmc and sys/cam/ata + * Thanks to Warner Losh , Alexander Motin + * Bernd Walter , and other authors. + */ + +#include +__FBSDID("$FreeBSD$"); + +//#include "opt_sdda.h" + +#include + +#ifdef _KERNEL +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* for PRIu64 */ +#endif /* _KERNEL */ + +#ifndef _KERNEL +#include +#include +#endif /* _KERNEL */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +#include /* geometry translation */ + +#ifdef _KERNEL + +typedef enum { + SDDA_FLAG_OPEN = 0x0002, + SDDA_FLAG_DIRTY = 0x0004 +} sdda_flags; + +typedef enum { + SDDA_STATE_INIT, + SDDA_STATE_INVALID, + SDDA_STATE_NORMAL +} sdda_state; + +struct sdda_softc { + struct bio_queue_head bio_queue; + int outstanding_cmds; /* Number of active commands */ + int refcount; /* Active xpt_action() calls */ + sdda_state state; + sdda_flags flags; + struct mmc_data *mmcdata; +// sdda_quirks quirks; + struct task start_init_task; + struct disk *disk; + uint32_t raw_csd[4]; + uint8_t raw_ext_csd[512]; /* MMC only? */ + struct mmc_csd csd; + struct mmc_cid cid; + struct mmc_scr scr; + /* Calculated from CSD */ + uint64_t sector_count; + uint64_t mediasize; + + /* Calculated from CID */ + char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ + char card_sn_string[16];/* Formatted serial # for disk->d_ident */ + /* Determined from CSD + is highspeed card*/ + uint32_t card_f_max; +}; + +#define ccb_bp ppriv_ptr1 + +static disk_strategy_t sddastrategy; +static periph_init_t sddainit; +static void sddaasync(void *callback_arg, u_int32_t code, + struct cam_path *path, void *arg); +static periph_ctor_t sddaregister; +static periph_dtor_t sddacleanup; +static periph_start_t sddastart; +static periph_oninv_t sddaoninvalidate; +static void sddadone(struct cam_periph *periph, + union ccb *done_ccb); +static int sddaerror(union ccb *ccb, u_int32_t cam_flags, + u_int32_t sense_flags); + +static uint16_t get_rca(struct cam_periph *periph); +static cam_status sdda_hook_into_geom(struct cam_periph *periph); +static void sdda_start_init(void *context, union ccb *start_ccb); +static void sdda_start_init_task(void *context, int pending); + +static struct periph_driver sddadriver = +{ + sddainit, "sdda", + TAILQ_HEAD_INITIALIZER(sddadriver.units), /* generation */ 0 +}; + +PERIPHDRIVER_DECLARE(sdda, sddadriver); + +static MALLOC_DEFINE(M_SDDA, "sd_da", "sd_da buffers"); + +static const int exp[8] = { + 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 +}; + +static const int mant[16] = { + 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 +}; + +static const int cur_min[8] = { + 500, 1000, 5000, 10000, 25000, 35000, 60000, 100000 +}; + +static const int cur_max[8] = { + 1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000 +}; + +static uint16_t +get_rca(struct cam_periph *periph) { + return periph->path->device->mmc_ident_data.card_rca; +} + +static uint32_t +mmc_get_bits(uint32_t *bits, int bit_len, int start, int size) +{ + const int i = (bit_len / 32) - (start / 32) - 1; + const int shift = start & 31; + uint32_t retval = bits[i] >> shift; + if (size + shift > 32) + retval |= bits[i - 1] << (32 - shift); + return (retval & ((1llu << size) - 1)); +} + + +static void +mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) +{ + int v; + int m; + int e; + + memset(csd, 0, sizeof(*csd)); + csd->csd_structure = v = mmc_get_bits(raw_csd, 128, 126, 2); + if (v == 0) { + m = mmc_get_bits(raw_csd, 128, 115, 4); + e = mmc_get_bits(raw_csd, 128, 112, 3); + csd->tacc = (exp[e] * mant[m] + 9) / 10; + csd->nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100; + m = mmc_get_bits(raw_csd, 128, 99, 4); + e = mmc_get_bits(raw_csd, 128, 96, 3); + csd->tran_speed = exp[e] * 10000 * mant[m]; + csd->ccc = mmc_get_bits(raw_csd, 128, 84, 12); + csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 128, 80, 4); + csd->read_bl_partial = mmc_get_bits(raw_csd, 128, 79, 1); + csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1); + csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1); + csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1); + csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 59, 3)]; + csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 56, 3)]; + csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 53, 3)]; + csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 50, 3)]; + m = mmc_get_bits(raw_csd, 128, 62, 12); + e = mmc_get_bits(raw_csd, 128, 47, 3); + csd->capacity = ((1 + m) << (e + 2)) * csd->read_bl_len; + csd->erase_blk_en = mmc_get_bits(raw_csd, 128, 46, 1); + csd->erase_sector = mmc_get_bits(raw_csd, 128, 39, 7) + 1; + csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 7); + csd->wp_grp_enable = mmc_get_bits(raw_csd, 128, 31, 1); + csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); + csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); + csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); + } else if (v == 1) { + m = mmc_get_bits(raw_csd, 128, 115, 4); + e = mmc_get_bits(raw_csd, 128, 112, 3); + csd->tacc = (exp[e] * mant[m] + 9) / 10; + csd->nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100; + m = mmc_get_bits(raw_csd, 128, 99, 4); + e = mmc_get_bits(raw_csd, 128, 96, 3); + csd->tran_speed = exp[e] * 10000 * mant[m]; + csd->ccc = mmc_get_bits(raw_csd, 128, 84, 12); + csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 128, 80, 4); + csd->read_bl_partial = mmc_get_bits(raw_csd, 128, 79, 1); + csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1); + csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1); + csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1); + csd->capacity = ((uint64_t)mmc_get_bits(raw_csd, 128, 48, 22) + 1) * + 512 * 1024; + csd->erase_blk_en = mmc_get_bits(raw_csd, 128, 46, 1); + csd->erase_sector = mmc_get_bits(raw_csd, 128, 39, 7) + 1; + csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 7); + csd->wp_grp_enable = mmc_get_bits(raw_csd, 128, 31, 1); + csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); + csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); + csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); + } else + panic("unknown SD CSD version"); +} + +static void +mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd) +{ + int m; + int e; + + memset(csd, 0, sizeof(*csd)); + csd->csd_structure = mmc_get_bits(raw_csd, 128, 126, 2); + csd->spec_vers = mmc_get_bits(raw_csd, 128, 122, 4); + m = mmc_get_bits(raw_csd, 128, 115, 4); + e = mmc_get_bits(raw_csd, 128, 112, 3); + csd->tacc = exp[e] * mant[m] + 9 / 10; + csd->nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100; + m = mmc_get_bits(raw_csd, 128, 99, 4); + e = mmc_get_bits(raw_csd, 128, 96, 3); + csd->tran_speed = exp[e] * 10000 * mant[m]; + csd->ccc = mmc_get_bits(raw_csd, 128, 84, 12); + csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 128, 80, 4); + csd->read_bl_partial = mmc_get_bits(raw_csd, 128, 79, 1); + csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1); + csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1); + csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1); + csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 59, 3)]; + csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 56, 3)]; + csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 53, 3)]; + csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 50, 3)]; + m = mmc_get_bits(raw_csd, 128, 62, 12); + e = mmc_get_bits(raw_csd, 128, 47, 3); + csd->capacity = ((1 + m) << (e + 2)) * csd->read_bl_len; + csd->erase_blk_en = 0; + csd->erase_sector = (mmc_get_bits(raw_csd, 128, 42, 5) + 1) * + (mmc_get_bits(raw_csd, 128, 37, 5) + 1); + csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 5); + csd->wp_grp_enable = mmc_get_bits(raw_csd, 128, 31, 1); + csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); + csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); + csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); +} + +static void +mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid) +{ + int i; + + /* There's no version info, so we take it on faith */ + memset(cid, 0, sizeof(*cid)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jul 9 17:02:54 2017 Return-Path: Delivered-To: svn-src-head@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 15A63D91020; Sun, 9 Jul 2017 17:02:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AD4B465B09; Sun, 9 Jul 2017 17:02:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69H2qCT000906; Sun, 9 Jul 2017 17:02:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69H2qHa000905; Sun, 9 Jul 2017 17:02:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707091702.v69H2qHa000905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 9 Jul 2017 17:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320846 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 320846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 17:02:54 -0000 Author: imp Date: Sun Jul 9 17:02:52 2017 New Revision: 320846 URL: https://svnweb.freebsd.org/changeset/base/320846 Log: New command 'mmcsdcmd' for camcontrol, to allow interacting with SD cards Submitted by: Ilya Babulin Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sun Jul 9 17:02:47 2017 (r320845) +++ head/sbin/camcontrol/camcontrol.c Sun Jul 9 17:02:52 2017 (r320846) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "camcontrol.h" @@ -104,7 +105,8 @@ typedef enum { CAM_CMD_REPROBE = 0x00000025, CAM_CMD_ZONE = 0x00000026, CAM_CMD_EPC = 0x00000027, - CAM_CMD_TIMESTAMP = 0x00000028 + CAM_CMD_TIMESTAMP = 0x00000028, + CAM_CMD_MMCSD_CMD = 0x00000029 } cam_cmdmask; typedef enum { @@ -205,6 +207,7 @@ static struct camcontrol_opts option_table[] = { {"reset", CAM_CMD_RESET, CAM_ARG_NONE, NULL}, #ifndef MINIMALISTIC {"cmd", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, + {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:f:Wb:l:41S:I"}, {"command", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, {"smpcmd", CAM_CMD_SMP_CMD, CAM_ARG_NONE, "r:R:"}, {"smprg", CAM_CMD_SMP_RG, CAM_ARG_NONE, smprg_opts}, @@ -300,6 +303,8 @@ static int scsicmd(struct cam_device *device, int argc int timeout); static int smpcmd(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); +static int mmcsdcmd(struct cam_device *device, int argc, char **argv, + char *combinedopt, int retry_count, int timeout); static int smpreportgeneral(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); static int smpphycontrol(struct cam_device *device, int argc, char **argv, @@ -592,6 +597,13 @@ getdevtree(int argc, char **argv, char *combinedopt) sizeof(revision)); sprintf(tmpstr, "<%s %s>", product, revision); + } else if (dev_result->protocol == PROTO_MMCSD) { + if (strlen(dev_result->mmc_ident_data.model) > 0) { + sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model); + } else { + sprintf(tmpstr, "<%s card>", + dev_result->mmc_ident_data.card_features & CARD_FEATURE_SDIO ? "SDIO" : "unknown"); + } } else if (dev_result->protocol == PROTO_SEMB) { struct sep_identify_data *sid; @@ -7335,6 +7347,291 @@ smpcmd_bailout: } static int +mmcsdcmd(struct cam_device *device, int argc, char **argv, char *combinedopt, + int retry_count, int timeout) +{ + int c, error = 0; + union ccb *ccb; + int32_t mmc_opcode = 0, mmc_arg = 0; + int32_t mmc_flags = -1; + int retval; + int is_write = 0; + int is_bw_4 = 0, is_bw_1 = 0; + int is_highspeed = 0, is_stdspeed = 0; + int is_info_request = 0; + int flags = 0; + uint8_t mmc_data_byte; + + /* For IO_RW_EXTENDED command */ + uint8_t *mmc_data = NULL; + struct mmc_data mmc_d; + int mmc_data_len = 0; + + /* + * Note that at the moment we don't support sending SMP CCBs to + * devices that aren't probed by CAM. + */ + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("%s: error allocating CCB", __func__); + return (1); + } + + bzero(&(&ccb->ccb_h)[1], + sizeof(union ccb) - sizeof(struct ccb_hdr)); + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch (c) { + case '4': + is_bw_4 = 1; + break; + case '1': + is_bw_1 = 1; + break; + case 'S': + if (!strcmp(optarg, "high")) + is_highspeed = 1; + else + is_stdspeed = 1; + break; + case 'I': + is_info_request = 1; + break; + case 'c': + mmc_opcode = strtol(optarg, NULL, 0); + if (mmc_opcode < 0) { + warnx("invalid MMC opcode %d", + mmc_opcode); + error = 1; + goto mmccmd_bailout; + } + break; + case 'a': + mmc_arg = strtol(optarg, NULL, 0); + if (mmc_arg < 0) { + warnx("invalid MMC arg %d", + mmc_arg); + error = 1; + goto mmccmd_bailout; + } + break; + case 'f': + mmc_flags = strtol(optarg, NULL, 0); + if (mmc_flags < 0) { + warnx("invalid MMC flags %d", + mmc_flags); + error = 1; + goto mmccmd_bailout; + } + break; + case 'l': + mmc_data_len = strtol(optarg, NULL, 0); + if (mmc_data_len <= 0) { + warnx("invalid MMC data len %d", + mmc_data_len); + error = 1; + goto mmccmd_bailout; + } + break; + case 'W': + is_write = 1; + break; + case 'b': + mmc_data_byte = strtol(optarg, NULL, 0); + break; + default: + break; + } + } + flags |= CAM_DEV_QFRZDIS; /* masks are broken?! */ + + /* If flags are left default, supply the right flags */ + if (mmc_flags < 0) + switch (mmc_opcode) { + case MMC_GO_IDLE_STATE: + mmc_flags = MMC_RSP_NONE | MMC_CMD_BC; + break; + case IO_SEND_OP_COND: + mmc_flags = MMC_RSP_R4; + break; + case SD_SEND_RELATIVE_ADDR: + mmc_flags = MMC_RSP_R6 | MMC_CMD_BCR; + break; + case MMC_SELECT_CARD: + mmc_flags = MMC_RSP_R1B | MMC_CMD_AC; + mmc_arg = mmc_arg << 16; + break; + case SD_IO_RW_DIRECT: + mmc_flags = MMC_RSP_R5 | MMC_CMD_AC; + mmc_arg = SD_IO_RW_ADR(mmc_arg); + if (is_write) + mmc_arg |= SD_IO_RW_WR | SD_IO_RW_RAW | SD_IO_RW_DAT(mmc_data_byte); + break; + case SD_IO_RW_EXTENDED: + mmc_flags = MMC_RSP_R5 | MMC_CMD_ADTC; + mmc_arg = SD_IO_RW_ADR(mmc_arg); + int len_arg = mmc_data_len; + if (mmc_data_len == 512) + len_arg = 0; + + // Byte mode + mmc_arg |= SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR; + // Block mode +// mmc_arg |= SD_IOE_RW_BLK | SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR; + break; + default: + mmc_flags = MMC_RSP_R1; + break; + } + + // Switch bus width instead of sending IO command + if (is_bw_4 || is_bw_1) { + struct ccb_trans_settings_mmc *cts; + ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + ccb->ccb_h.flags = 0; + cts = &ccb->cts.proto_specific.mmc; + cts->ios.bus_width = is_bw_4 == 1 ? bus_width_4 : bus_width_1; + cts->ios_valid = MMC_BW; + if (((retval = cam_send_ccb(device, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + warn("Error sending command"); + } else { + printf("Parameters set OK\n"); + } + cam_freeccb(ccb); + return (retval); + } + + // Switch bus speed instead of sending IO command + if (is_stdspeed || is_highspeed) { + struct ccb_trans_settings_mmc *cts; + ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + ccb->ccb_h.flags = 0; + cts = &ccb->cts.proto_specific.mmc; + cts->ios.timing = is_highspeed == 1 ? bus_timing_hs : bus_timing_normal; + cts->ios_valid = MMC_BT; + if (((retval = cam_send_ccb(device, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + warn("Error sending command"); + } else { + printf("Speed set OK (HS: %d)\n", is_highspeed); + } + cam_freeccb(ccb); + return (retval); + } + + // Get information about controller and its settings + if (is_info_request) { + ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + ccb->ccb_h.flags = 0; + struct ccb_trans_settings_mmc *cts; + cts = &ccb->cts.proto_specific.mmc; + if (((retval = cam_send_ccb(device, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + warn("Error sending command"); + return (retval); + } + printf("Host controller information\n"); + printf("Host OCR: 0x%x\n", cts->host_ocr); + printf("Min frequency: %u KHz\n", cts->host_f_min / 1000); + printf("Max frequency: %u MHz\n", cts->host_f_max / 1000000); + printf("Supported bus width: "); + if (cts->host_caps & MMC_CAP_4_BIT_DATA) + printf(" 4 bit\n"); + if (cts->host_caps & MMC_CAP_8_BIT_DATA) + printf(" 8 bit\n"); + printf("\nCurrent settings:\n"); + printf("Bus width: "); + switch (cts->ios.bus_width) { + case bus_width_1: + printf("1 bit\n"); + break; + case bus_width_4: + printf("4 bit\n"); + break; + case bus_width_8: + printf("8 bit\n"); + break; + } + printf("Freq: %d.%03d MHz%s\n", + cts->ios.clock / 1000000, + (cts->ios.clock / 1000) % 1000, + cts->ios.timing == bus_timing_hs ? "(high-speed timing)" : ""); + return (0); + } + + printf("CMD %d arg %d flags %02x\n", mmc_opcode, mmc_arg, mmc_flags); + + if (mmc_data_len > 0) { + flags |= CAM_DIR_IN; + mmc_data = malloc(mmc_data_len); + memset(mmc_data, 0, mmc_data_len); + mmc_d.len = mmc_data_len; + mmc_d.data = mmc_data; + mmc_d.flags = MMC_DATA_READ; + } else flags |= CAM_DIR_NONE; + + cam_fill_mmcio(&ccb->mmcio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*flags*/ flags, + /*mmc_opcode*/ mmc_opcode, + /*mmc_arg*/ mmc_arg, + /*mmc_flags*/ mmc_flags, + /*mmc_data*/ mmc_data_len > 0 ? &mmc_d : NULL, + /*timeout*/ timeout ? timeout : 5000); + + if (((retval = cam_send_ccb(device, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + const char warnstr[] = "error sending command"; + + if (retval < 0) + warn(warnstr); + else + warnx(warnstr); + + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + } + + if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)) { + printf("MMCIO: error %d, %08x %08x %08x %08x\n", + ccb->mmcio.cmd.error, ccb->mmcio.cmd.resp[0], + ccb->mmcio.cmd.resp[1], + ccb->mmcio.cmd.resp[2], + ccb->mmcio.cmd.resp[3]); + + switch (mmc_opcode) { + case SD_IO_RW_DIRECT: + printf("IO_RW_DIRECT: resp byte %02x, cur state %d\n", + SD_R5_DATA(ccb->mmcio.cmd.resp), + (ccb->mmcio.cmd.resp[0] >> 12) & 0x3 + ); + break; + case SD_IO_RW_EXTENDED: + printf("IO_RW_EXTENDED: read %d bytes w/o error:\n", mmc_data_len); + hexdump(mmc_data, mmc_data_len, NULL, 0); + break; + case SD_SEND_RELATIVE_ADDR: + printf("SEND_RELATIVE_ADDR: published RCA %02x\n", ccb->mmcio.cmd.resp[0] >> 16); + break; + default: + printf("No command-specific decoder for CMD %d\n", mmc_opcode); + } + } +mmccmd_bailout: + if (ccb != NULL) + cam_freeccb(ccb); + + if (mmc_data_len > 0 && mmc_data != NULL) + free(mmc_data); + + return (error); +} + +static int smpreportgeneral(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout) { @@ -9628,6 +9925,10 @@ main(int argc, char **argv) error = scsicmd(cam_dev, argc, argv, combinedopt, task_attr, retry_count, timeout); break; + case CAM_CMD_MMCSD_CMD: + error = mmcsdcmd(cam_dev, argc, argv, combinedopt, + retry_count, timeout); + break; case CAM_CMD_SMP_CMD: error = smpcmd(cam_dev, argc, argv, combinedopt, retry_count, timeout); From owner-svn-src-head@freebsd.org Sun Jul 9 17:02:48 2017 Return-Path: Delivered-To: svn-src-head@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 DA2FBD9100B; Sun, 9 Jul 2017 17:02:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 979EF65AFF; Sun, 9 Jul 2017 17:02:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69H2lSi000854; Sun, 9 Jul 2017 17:02:47 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69H2lOf000852; Sun, 9 Jul 2017 17:02:47 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707091702.v69H2lOf000852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 9 Jul 2017 17:02:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320845 - in head/sys: dev/mmcnull modules/mmcnull X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: dev/mmcnull modules/mmcnull X-SVN-Commit-Revision: 320845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 17:02:49 -0000 Author: imp Date: Sun Jul 9 17:02:47 2017 New Revision: 320845 URL: https://svnweb.freebsd.org/changeset/base/320845 Log: Added mmcnull, an emulated lightweight MMC controller This emulated device attaches to the ISA bus and registers itself as HBA supporting MMC/SD cards. This allows to develop and test MMC XPT and MMC / SDIO peripheral drivers even in the VM such as bhyve. Submitted by: Ilya Babulin Added: head/sys/dev/mmcnull/ head/sys/dev/mmcnull/mmcnull.c (contents, props changed) head/sys/modules/mmcnull/ head/sys/modules/mmcnull/Makefile (contents, props changed) Added: head/sys/dev/mmcnull/mmcnull.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mmcnull/mmcnull.c Sun Jul 9 17:02:47 2017 (r320845) @@ -0,0 +1,463 @@ +/*- + * Copyright (c) 2013 Ilya Bakulin. 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 ``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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static int is_sdio_mode = 1; + +struct mmcnull_softc { + device_t dev; + struct mtx sc_mtx; + + struct cam_devq *devq; + struct cam_sim *sim; + struct cam_path *path; + + struct callout tick; + union ccb *cur_ccb; +}; + +static void mmcnull_identify(driver_t *, device_t); +static int mmcnull_probe(device_t); +static int mmcnull_attach(device_t); +static int mmcnull_detach(device_t); +static void mmcnull_action_sd(struct cam_sim *, union ccb *); +static void mmcnull_action_sdio(struct cam_sim *, union ccb *); +static void mmcnull_intr_sd(void *xsc); +static void mmcnull_intr_sdio(void *xsc); +static void mmcnull_poll(struct cam_sim *); + +static void +mmcnull_identify(driver_t *driver, device_t parent) +{ + device_t child; + + if (resource_disabled("mmcnull", 0)) + return; + + if (device_get_unit(parent) != 0) + return; + + /* Avoid duplicates. */ + if (device_find_child(parent, "mmcnull", -1)) + return; + + child = BUS_ADD_CHILD(parent, 20, "mmcnull", 0); + if (child == NULL) { + device_printf(parent, "add MMCNULL child failed\n"); + return; + } +} + + +static int +mmcnull_probe(device_t dev) +{ + device_set_desc(dev, "Emulated MMC controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +mmcnull_attach(device_t dev) +{ + struct mmcnull_softc *sc; + sim_action_func action_func; + + sc = device_get_softc(dev); + sc->dev = dev; + + mtx_init(&sc->sc_mtx, "mmcnullmtx", NULL, MTX_DEF); + + if ((sc->devq = cam_simq_alloc(1)) == NULL) + return (ENOMEM); + + if (is_sdio_mode) + action_func = mmcnull_action_sdio; + else + action_func = mmcnull_action_sd; + sc->sim = cam_sim_alloc(action_func, mmcnull_poll, "mmcnull", sc, + device_get_unit(dev), &sc->sc_mtx, 1, 1, + sc->devq); + + if (sc->sim == NULL) { + cam_simq_free(sc->devq); + device_printf(dev, "cannot allocate CAM SIM\n"); + return (EINVAL); + } + + mtx_lock(&sc->sc_mtx); + if (xpt_bus_register(sc->sim, dev, 0) != 0) { + device_printf(dev, + "cannot register SCSI pass-through bus\n"); + cam_sim_free(sc->sim, FALSE); + cam_simq_free(sc->devq); + mtx_unlock(&sc->sc_mtx); + return (EINVAL); + } + mtx_unlock(&sc->sc_mtx); + + callout_init_mtx(&sc->tick, &sc->sc_mtx, 0); /* Callout to emulate interrupts */ + + device_printf(dev, "attached OK\n"); + + return (0); +} + +static int +mmcnull_detach(device_t dev) +{ + struct mmcnull_softc *sc; + + sc = device_get_softc(dev); + + if (sc == NULL) + return (EINVAL); + + if (sc->sim != NULL) { + mtx_lock(&sc->sc_mtx); + xpt_bus_deregister(cam_sim_path(sc->sim)); + cam_sim_free(sc->sim, FALSE); + mtx_unlock(&sc->sc_mtx); + } + + if (sc->devq != NULL) + cam_simq_free(sc->devq); + + callout_drain(&sc->tick); + mtx_destroy(&sc->sc_mtx); + + device_printf(dev, "detached OK\n"); + return (0); +} + +/* + * The interrupt handler + * This implementation calls it via callout(9) + * with the mutex already taken + */ +static void +mmcnull_intr_sd(void *xsc) { + struct mmcnull_softc *sc; + union ccb *ccb; + struct ccb_mmcio *mmcio; + + sc = (struct mmcnull_softc *) xsc; + mtx_assert(&sc->sc_mtx, MA_OWNED); + + ccb = sc->cur_ccb; + mmcio = &ccb->mmcio; + device_printf(sc->dev, "mmcnull_intr: MMC command = %d\n", + mmcio->cmd.opcode); + + switch (mmcio->cmd.opcode) { + case MMC_GO_IDLE_STATE: + device_printf(sc->dev, "Reset device\n"); + break; + case SD_SEND_IF_COND: + mmcio->cmd.resp[0] = 0x1AA; // To match mmc_xpt expectations :-) + break; + case MMC_APP_CMD: + mmcio->cmd.resp[0] = R1_APP_CMD; + break; + case SD_SEND_RELATIVE_ADDR: + case MMC_SELECT_CARD: + mmcio->cmd.resp[0] = 0x1 << 16; + break; + case ACMD_SD_SEND_OP_COND: + mmcio->cmd.resp[0] = 0xc0ff8000; + mmcio->cmd.resp[0] |= MMC_OCR_CARD_BUSY; + break; + case MMC_ALL_SEND_CID: + /* Note: this is a real CID from Wandboard int mmc */ + mmcio->cmd.resp[0] = 0x1b534d30; + mmcio->cmd.resp[1] = 0x30303030; + mmcio->cmd.resp[2] = 0x10842806; + mmcio->cmd.resp[3] = 0x5700e900; + break; + case MMC_SEND_CSD: + /* Note: this is a real CSD from Wandboard int mmc */ + mmcio->cmd.resp[0] = 0x400e0032; + mmcio->cmd.resp[1] = 0x5b590000; + mmcio->cmd.resp[2] = 0x751f7f80; + mmcio->cmd.resp[3] = 0x0a404000; + break; + case MMC_READ_SINGLE_BLOCK: + case MMC_READ_MULTIPLE_BLOCK: + strcpy(mmcio->cmd.data->data, "WTF?!"); + break; + default: + device_printf(sc->dev, "mmcnull_intr_sd: unknown command\n"); + mmcio->cmd.error = 1; + } + ccb->ccb_h.status = CAM_REQ_CMP; + + sc->cur_ccb = NULL; + xpt_done(ccb); +} + +static void +mmcnull_intr_sdio_newintr(void *xsc) { + struct mmcnull_softc *sc; + struct cam_path *dpath; + + sc = (struct mmcnull_softc *) xsc; + mtx_assert(&sc->sc_mtx, MA_OWNED); + device_printf(sc->dev, "mmcnull_intr_sdio_newintr()\n"); + + /* Our path */ + if (xpt_create_path(&dpath, NULL, cam_sim_path(sc->sim), 0, 0) != CAM_REQ_CMP) { + device_printf(sc->dev, "mmcnull_intr_sdio_newintr(): cannot create path\n"); + return; + } + xpt_async(AC_UNIT_ATTENTION, dpath, NULL); + xpt_free_path(dpath); +} + +static void +mmcnull_intr_sdio(void *xsc) { + struct mmcnull_softc *sc; + union ccb *ccb; + struct ccb_mmcio *mmcio; + + sc = (struct mmcnull_softc *) xsc; + mtx_assert(&sc->sc_mtx, MA_OWNED); + + ccb = sc->cur_ccb; + mmcio = &ccb->mmcio; + device_printf(sc->dev, "mmcnull_intr: MMC command = %d\n", + mmcio->cmd.opcode); + + switch (mmcio->cmd.opcode) { + case MMC_GO_IDLE_STATE: + device_printf(sc->dev, "Reset device\n"); + break; + case SD_SEND_IF_COND: + mmcio->cmd.resp[0] = 0x1AA; // To match mmc_xpt expectations :-) + break; + case MMC_APP_CMD: + mmcio->cmd.resp[0] = R1_APP_CMD; + break; + case IO_SEND_OP_COND: + mmcio->cmd.resp[0] = 0x12345678; + mmcio->cmd.resp[0] |= ~ R4_IO_MEM_PRESENT; + break; + case SD_SEND_RELATIVE_ADDR: + case MMC_SELECT_CARD: + mmcio->cmd.resp[0] = 0x1 << 16; + break; + case ACMD_SD_SEND_OP_COND: + /* TODO: steal valid OCR from somewhere :-) */ + mmcio->cmd.resp[0] = 0x123; + mmcio->cmd.resp[0] |= MMC_OCR_CARD_BUSY; + break; + case MMC_ALL_SEND_CID: + mmcio->cmd.resp[0] = 0x1234; + mmcio->cmd.resp[1] = 0x5678; + mmcio->cmd.resp[2] = 0x9ABC; + mmcio->cmd.resp[3] = 0xDEF0; + break; + case MMC_READ_SINGLE_BLOCK: + case MMC_READ_MULTIPLE_BLOCK: + strcpy(mmcio->cmd.data->data, "WTF?!"); + break; + case SD_IO_RW_DIRECT: + device_printf(sc->dev, "Scheduling interrupt generation...\n"); + callout_reset(&sc->tick, hz / 10, mmcnull_intr_sdio_newintr, sc); + break; + default: + device_printf(sc->dev, "mmcnull_intr_sdio: unknown command\n"); + } + ccb->ccb_h.status = CAM_REQ_CMP; + + sc->cur_ccb = NULL; + xpt_done(ccb); +} + +/* + * This is a MMC IO handler + * It extracts MMC command from CCB and sends it + * to the h/w + */ +static void +mmcnull_handle_mmcio(struct cam_sim *sim, union ccb *ccb) +{ + struct mmcnull_softc *sc; + struct ccb_mmcio *mmcio; + + sc = cam_sim_softc(sim); + mmcio = &ccb->mmcio; + ccb->ccb_h.status = CAM_REQ_INPROG; + sc->cur_ccb = ccb; + + /* Real h/w will wait for the interrupt */ + if (is_sdio_mode) + callout_reset(&sc->tick, hz / 10, mmcnull_intr_sdio, sc); + else + callout_reset(&sc->tick, hz / 10, mmcnull_intr_sd, sc); +} + +static void +mmcnull_action_sd(struct cam_sim *sim, union ccb *ccb) +{ + struct mmcnull_softc *sc; + + sc = cam_sim_softc(sim); + if (sc == NULL) { + ccb->ccb_h.status = CAM_SEL_TIMEOUT; + xpt_done(ccb); + return; + } + + mtx_assert(&sc->sc_mtx, MA_OWNED); + + device_printf(sc->dev, "action: func_code %0x\n", ccb->ccb_h.func_code); + + switch (ccb->ccb_h.func_code) { + case XPT_PATH_INQ: + { + struct ccb_pathinq *cpi; + + cpi = &ccb->cpi; + cpi->version_num = 1; + cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE | PI_WIDE_16; + cpi->target_sprt = 0; + cpi->hba_misc = PIM_NOBUSRESET | PIM_SEQSCAN; + cpi->hba_eng_cnt = 0; + cpi->max_target = 0; + cpi->max_lun = 0; + cpi->initiator_id = 1; + strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strncpy(cpi->hba_vid, "FreeBSD Foundation", HBA_IDLEN); + strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->unit_number = cam_sim_unit(sim); + cpi->bus_id = cam_sim_bus(sim); + cpi->base_transfer_speed = 100; /* XXX WTF? */ + cpi->protocol = PROTO_MMCSD; + cpi->protocol_version = SCSI_REV_0; + cpi->transport = XPORT_MMCSD; + cpi->transport_version = 0; + + cpi->ccb_h.status = CAM_REQ_CMP; + break; + } + case XPT_GET_TRAN_SETTINGS: + { + struct ccb_trans_settings *cts = &ccb->cts; + struct ccb_trans_settings_mmc *mcts; + mcts = &ccb->cts.proto_specific.mmc; + + device_printf(sc->dev, "Got XPT_GET_TRAN_SETTINGS\n"); + + cts->protocol = PROTO_MMCSD; + cts->protocol_version = 0; + cts->transport = XPORT_MMCSD; + cts->transport_version = 0; + cts->xport_specific.valid = 0; + mcts->host_f_max = 12000000; + mcts->host_f_min = 200000; + mcts->host_ocr = 1; /* Fix this */ + ccb->ccb_h.status = CAM_REQ_CMP; + break; + } + case XPT_SET_TRAN_SETTINGS: + device_printf(sc->dev, "Got XPT_SET_TRAN_SETTINGS, should update IOS...\n"); + ccb->ccb_h.status = CAM_REQ_CMP; + break; + case XPT_RESET_BUS: + device_printf(sc->dev, "Got XPT_RESET_BUS, ACK it...\n"); + ccb->ccb_h.status = CAM_REQ_CMP; + break; + case XPT_MMC_IO: + /* + * Here is the HW-dependent part of + * sending the command to the underlying h/w + * At some point in the future an interrupt comes. + * Then the request will be marked as completed. + */ + device_printf(sc->dev, "Got XPT_MMC_IO\n"); + mmcnull_handle_mmcio(sim, ccb); + return; + break; + case XPT_RESET_DEV: + /* This is sent by `camcontrol reset`*/ + device_printf(sc->dev, "Got XPT_RESET_DEV\n"); + ccb->ccb_h.status = CAM_REQ_CMP; + break; + default: + device_printf(sc->dev, "Func code %d is unknown\n", ccb->ccb_h.func_code); + ccb->ccb_h.status = CAM_REQ_INVALID; + break; + } + xpt_done(ccb); + return; +} + +static void +mmcnull_action_sdio(struct cam_sim *sim, union ccb *ccb) { + mmcnull_action_sd(sim, ccb); +} + +static void +mmcnull_poll(struct cam_sim *sim) +{ + return; +} + + +static device_method_t mmcnull_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, mmcnull_identify), + DEVMETHOD(device_probe, mmcnull_probe), + DEVMETHOD(device_attach, mmcnull_attach), + DEVMETHOD(device_detach, mmcnull_detach), + DEVMETHOD_END +}; + +static driver_t mmcnull_driver = { + "mmcnull", mmcnull_methods, sizeof(struct mmcnull_softc) +}; + +static devclass_t mmcnull_devclass; + +DRIVER_MODULE(mmcnull, isa, mmcnull_driver, mmcnull_devclass, 0, 0); Added: head/sys/modules/mmcnull/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/mmcnull/Makefile Sun Jul 9 17:02:47 2017 (r320845) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/mmcnull + +KMOD= mmcnull +SRCS= mmcnull.c device_if.h bus_if.h + +.include From owner-svn-src-head@freebsd.org Sun Jul 9 17:05:50 2017 Return-Path: Delivered-To: svn-src-head@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 07EA5D91176; Sun, 9 Jul 2017 17:05:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AB7B865DC7; Sun, 9 Jul 2017 17:05:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69H5mgB001082; Sun, 9 Jul 2017 17:05:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69H5mtF001080; Sun, 9 Jul 2017 17:05:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707091705.v69H5mtF001080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 9 Jul 2017 17:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320847 - head/usr.bin/sdiotool X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.bin/sdiotool X-SVN-Commit-Revision: 320847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 17:05:50 -0000 Author: imp Date: Sun Jul 9 17:05:48 2017 New Revision: 320847 URL: https://svnweb.freebsd.org/changeset/base/320847 Log: Added new tool for doing experiments with SDIO card. Due to its experimental nature, it's not yet connected to the build. Submitted by: Ilya Babulin Added: head/usr.bin/sdiotool/ head/usr.bin/sdiotool/Makefile (contents, props changed) head/usr.bin/sdiotool/sdiotool.c (contents, props changed) Added: head/usr.bin/sdiotool/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/sdiotool/Makefile Sun Jul 9 17:05:48 2017 (r320847) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= sdiotool +SRCS= sdiotool.c + +LIBADD= cam util +MAN= + +.include Added: head/usr.bin/sdiotool/sdiotool.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/sdiotool/sdiotool.c Sun Jul 9 17:05:48 2017 (r320847) @@ -0,0 +1,649 @@ +/*- + * Copyright (c) 2016-2017 Ilya Bakulin + * 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. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +struct cis_info { + uint16_t man_id; + uint16_t prod_id; + uint16_t max_block_size; +}; + +static int sdio_rw_direct(struct cam_device *dev, + uint8_t func_number, + uint32_t addr, + uint8_t is_write, + uint8_t *data, + uint8_t *resp); +static uint8_t sdio_read_1(struct cam_device *dev, uint8_t func_number, uint32_t addr); +static void sdio_write_1(struct cam_device *dev, uint8_t func_number, uint32_t addr, uint8_t val); +static int sdio_is_func_ready(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab); +static int sdio_is_func_enabled(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab); +static int sdio_func_enable(struct cam_device *dev, uint8_t func_number, int enable); +static int sdio_is_func_intr_enabled(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab); +static int sdio_func_intr_enable(struct cam_device *dev, uint8_t func_number, int enable); +static void sdio_card_reset(struct cam_device *dev); +static uint32_t sdio_get_common_cis_addr(struct cam_device *dev); +static void probe_bcrm(struct cam_device *dev); + +/* Use CMD52 to read or write a single byte */ +int +sdio_rw_direct(struct cam_device *dev, + uint8_t func_number, + uint32_t addr, + uint8_t is_write, + uint8_t *data, uint8_t *resp) { + union ccb *ccb; + uint32_t flags; + uint32_t arg; + int retval = 0; + + ccb = cam_getccb(dev); + if (ccb == NULL) { + warnx("%s: error allocating CCB", __func__); + return (1); + } + bzero(&(&ccb->ccb_h)[1], + sizeof(union ccb) - sizeof(struct ccb_hdr)); + + flags = MMC_RSP_R5 | MMC_CMD_AC; + arg = SD_IO_RW_FUNC(func_number) | SD_IO_RW_ADR(addr); + if (is_write) + arg |= SD_IO_RW_WR | SD_IO_RW_RAW | SD_IO_RW_DAT(*data); + + cam_fill_mmcio(&ccb->mmcio, + /*retries*/ 0, + /*cbfcnp*/ NULL, + /*flags*/ CAM_DIR_NONE, + /*mmc_opcode*/ SD_IO_RW_DIRECT, + /*mmc_arg*/ arg, + /*mmc_flags*/ flags, + /*mmc_data*/ 0, + /*timeout*/ 5000); + + if (((retval = cam_send_ccb(dev, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + const char warnstr[] = "error sending command"; + + if (retval < 0) + warn(warnstr); + else + warnx(warnstr); + return (-1); + } + + *resp = ccb->mmcio.cmd.resp[0] & 0xFF; + cam_freeccb(ccb); + return (retval); +} + +#if 0 +/* + * CMD53 -- IO_RW_EXTENDED + * Use to read or write memory blocks + * + * is_increment=1: FIFO mode + * blk_count > 0: block mode + */ +int +sdio_rw_extended(struct cam_device *dev, + uint8_t func_number, + uint32_t addr, + uint8_t is_write, + uint8_t *data, size_t datalen, + uint8_t is_increment, + uint16_t blk_count) { + union ccb *ccb; + uint32_t flags; + uint32_t arg; + int retval = 0; + + if (blk_count != 0) { + warnx("%s: block mode is not supported yet", __func__); + return (1); + } + + ccb = cam_getccb(dev); + if (ccb == NULL) { + warnx("%s: error allocating CCB", __func__); + return (1); + } + bzero(&(&ccb->ccb_h)[1], + sizeof(union ccb) - sizeof(struct ccb_hdr)); + + flags = MMC_RSP_R5 | MMC_CMD_AC; + arg = SD_IO_RW_FUNC(func_number) | SD_IO_RW_ADR(addr); + if (is_write) + arg |= SD_IO_RW_WR; + + cam_fill_mmcio(&ccb->mmcio, + /*retries*/ 0, + /*cbfcnp*/ NULL, + /*flags*/ CAM_DIR_NONE, + /*mmc_opcode*/ SD_IO_RW_DIRECT, + /*mmc_arg*/ arg, + /*mmc_flags*/ flags, + /*mmc_data*/ 0, + /*timeout*/ 5000); + + if (((retval = cam_send_ccb(dev, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + const char warnstr[] = "error sending command"; + + if (retval < 0) + warn(warnstr); + else + warnx(warnstr); + return (-1); + } + + *resp = ccb->mmcio.cmd.resp[0] & 0xFF; + cam_freeccb(ccb); + return (retval); +} +#endif + +static int +sdio_read_bool_for_func(struct cam_device *dev, uint32_t addr, uint8_t func_number, uint8_t *is_enab) { + uint8_t resp; + int ret; + + ret = sdio_rw_direct(dev, 0, addr, 0, NULL, &resp); + if (ret < 0) + return ret; + + *is_enab = (resp & (1 << func_number)) > 0 ? 1 : 0; + + return (0); +} + +static int +sdio_set_bool_for_func(struct cam_device *dev, uint32_t addr, uint8_t func_number, int enable) { + uint8_t resp; + int ret; + uint8_t is_enabled; + + ret = sdio_rw_direct(dev, 0, addr, 0, NULL, &resp); + if (ret != 0) + return ret; + + is_enabled = resp & (1 << func_number); + if ((is_enabled !=0 && enable == 1) || (is_enabled == 0 && enable == 0)) + return 0; + + if (enable) + resp |= 1 << func_number; + else + resp &= ~ (1 << func_number); + + ret = sdio_rw_direct(dev, 0, addr, 1, &resp, &resp); + + return ret; +} + +static uint8_t +sdio_read_1(struct cam_device *dev, uint8_t func_number, uint32_t addr) { + uint8_t val; + sdio_rw_direct(dev, func_number, addr, 0, NULL, &val); + return val; +} + +__unused static void +sdio_write_1(struct cam_device *dev, uint8_t func_number, uint32_t addr, uint8_t val) { + uint8_t _val; + sdio_rw_direct(dev, func_number, addr, 0, &val, &_val); +} + +static int +sdio_is_func_ready(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab) { + return sdio_read_bool_for_func(dev, SD_IO_CCCR_FN_READY, func_number, is_enab); +} + +static int +sdio_is_func_enabled(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab) { + return sdio_read_bool_for_func(dev, SD_IO_CCCR_FN_ENABLE, func_number, is_enab); +} + +static int +sdio_func_enable(struct cam_device *dev, uint8_t func_number, int enable) { + return sdio_set_bool_for_func(dev, SD_IO_CCCR_FN_ENABLE, func_number, enable); +} + +static int +sdio_is_func_intr_enabled(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab) { + return sdio_read_bool_for_func(dev, SD_IO_CCCR_INT_ENABLE, func_number, is_enab); +} + +static int +sdio_func_intr_enable(struct cam_device *dev, uint8_t func_number, int enable) { + return sdio_set_bool_for_func(dev, SD_IO_CCCR_INT_ENABLE, func_number, enable); +} + +static int +sdio_card_set_bus_width(struct cam_device *dev, enum mmc_bus_width bw) { + int ret; + uint8_t ctl_val; + ret = sdio_rw_direct(dev, 0, SD_IO_CCCR_BUS_WIDTH, 0, NULL, &ctl_val); + if (ret < 0) { + warn("Error getting CCCR_BUS_WIDTH value"); + return ret; + } + ctl_val &= ~0x3; + switch (bw) { + case bus_width_1: + /* Already set to 1-bit */ + break; + case bus_width_4: + ctl_val |= CCCR_BUS_WIDTH_4; + break; + case bus_width_8: + warn("Cannot do 8-bit on SDIO yet"); + return -1; + break; + } + ret = sdio_rw_direct(dev, 0, SD_IO_CCCR_BUS_WIDTH, 1, &ctl_val, &ctl_val); + if (ret < 0) { + warn("Error setting CCCR_BUS_WIDTH value"); + return ret; + } + return ret; +} + +static int +sdio_func_read_cis(struct cam_device *dev, uint8_t func_number, + uint32_t cis_addr, struct cis_info *info) { + uint8_t tuple_id, tuple_len, tuple_count; + uint32_t addr; + + char *cis1_info[4]; + int start, i, ch, count; + char cis1_info_buf[256]; + + tuple_count = 0; /* Use to prevent infinite loop in case of parse errors */ + memset(cis1_info_buf, 0, 256); + do { + addr = cis_addr; + tuple_id = sdio_read_1(dev, 0, addr++); + if (tuple_id == SD_IO_CISTPL_END) + break; + if (tuple_id == 0) { + cis_addr++; + continue; + } + tuple_len = sdio_read_1(dev, 0, addr++); + if (tuple_len == 0 && tuple_id != 0x00) { + warn("Parse error: 0-length tuple %02X\n", tuple_id); + return -1; + } + + switch (tuple_id) { + case SD_IO_CISTPL_VERS_1: + addr += 2; + for (count = 0, start = 0, i = 0; + (count < 4) && ((i + 4) < 256); i++) { + ch = sdio_read_1(dev, 0, addr + i); + printf("count=%d, start=%d, i=%d, Got %c (0x%02x)\n", count, start, i, ch, ch); + if (ch == 0xff) + break; + cis1_info_buf[i] = ch; + if (ch == 0) { + cis1_info[count] = + cis1_info_buf + start; + start = i + 1; + count++; + } + } + printf("Card info:"); + for (i=0; i<4; i++) + if (cis1_info[i]) + printf(" %s", cis1_info[i]); + printf("\n"); + break; + case SD_IO_CISTPL_MANFID: + info->man_id = sdio_read_1(dev, 0, addr++); + info->man_id |= sdio_read_1(dev, 0, addr++) << 8; + + info->prod_id = sdio_read_1(dev, 0, addr++); + info->prod_id |= sdio_read_1(dev, 0, addr++) << 8; + break; + case SD_IO_CISTPL_FUNCID: + /* not sure if we need to parse it? */ + break; + case SD_IO_CISTPL_FUNCE: + if (tuple_len < 4) { + printf("FUNCE is too short: %d\n", tuple_len); + break; + } + if (func_number == 0) { + /* skip extended_data */ + addr++; + info->max_block_size = sdio_read_1(dev, 0, addr++); + info->max_block_size |= sdio_read_1(dev, 0, addr++) << 8; + } else { + info->max_block_size = sdio_read_1(dev, 0, addr + 0xC); + info->max_block_size |= sdio_read_1(dev, 0, addr + 0xD) << 8; + } + break; + default: + printf("Skipping tuple ID %02X len %02X\n", tuple_id, tuple_len); + } + cis_addr += tuple_len + 2; + tuple_count++; + } while (tuple_count < 20); + + return 0; +} + +static uint32_t +sdio_get_common_cis_addr(struct cam_device *dev) { + uint32_t addr; + + addr = sdio_read_1(dev, 0, SD_IO_CCCR_CISPTR); + addr |= sdio_read_1(dev, 0, SD_IO_CCCR_CISPTR + 1) << 8; + addr |= sdio_read_1(dev, 0, SD_IO_CCCR_CISPTR + 2) << 16; + + if (addr < SD_IO_CIS_START || addr > SD_IO_CIS_START + SD_IO_CIS_SIZE) { + warn("Bad CIS address: %04X\n", addr); + addr = 0; + } + + return addr; +} + +static void sdio_card_reset(struct cam_device *dev) { + int ret; + uint8_t ctl_val; + ret = sdio_rw_direct(dev, 0, SD_IO_CCCR_CTL, 0, NULL, &ctl_val); + if (ret < 0) + errx(1, "Error getting CCCR_CTL value"); + ctl_val |= CCCR_CTL_RES; + ret = sdio_rw_direct(dev, 0, SD_IO_CCCR_CTL, 1, &ctl_val, &ctl_val); + if (ret < 0) + errx(1, "Error setting CCCR_CTL value"); +} + +/* + * How Linux driver works + * + * The probing begins by calling brcmf_ops_sdio_probe() which is defined as probe function in struct sdio_driver. http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c#L1126 + * + * The driver does black magic by copying func struct for F2 and setting func number to zero there, to create an F0 func structure :) + * Driver state changes to BRCMF_SDIOD_DOWN. + * ops_sdio_probe() then calls brcmf_sdio_probe() -- at this point it has filled in sdiodev struct with the pointers to all three functions (F0, F1, F2). + * + * brcmf_sdiod_probe() sets block sizes for F1 and F2. It sets F1 block size to 64 and F2 to 512, not consulting the values stored in SDIO CCCR / FBR registers! + * Then it increases timeout for F2 (what is this?!) + * Then it enables F1 + * Then it attaches "freezer" (without PM this is NOP) + * Finally it calls brcmf_sdio_probe() http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c#L4082 + * + * Here high-level workqueues and sg tables are allocated. + * It then calls brcmf_sdio_probe_attach() + * + * Here at the beginning there is a pr_debug() call with brcmf_sdiod_regrl() inside to addr #define SI_ENUM_BASE 0x18000000. + * Return value is 0x16044330. + * Then turns off PLL: byte-write BRCMF_INIT_CLKCTL1 (0x28) -> SBSDIO_FUNC1_CHIPCLKCSR (0x1000E) + * Then it reads value back, should be 0xe8. + * Then calls brcmf_chip_attach() + * + * http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c#L1054 + * This func enumerates and resets all the cores on the dongle. + * - brcmf_sdio_buscoreprep(): force clock to ALPAvail req only: + * SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ -> SBSDIO_FUNC1_CHIPCLKCSR + * Wait up to 15ms to !SBSDIO_ALPAV(clkval) of the value from CLKCSR. + * Force ALP: + * SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP (0x21)-> SBSDIO_FUNC1_CHIPCLKCSR + * Disaable SDIO pullups: + * byte 0 -> SBSDIO_FUNC1_SDIOPULLUP (0x0001000f) + * + * Calls brcmf_chip_recognition() + * http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c#L908 + * Read 0x18000000. Get 0x16044330: chip 4330 rev 4 + * AXI chip, call brcmf_chip_dmp_erom_scan() to get info about all cores. + * Then brcmf_chip_cores_check() to check that CPU and RAM are found, + * + * Setting cores to passive: not clear which of CR4/CA7/CM3 our chip has. + * Quite a few r/w calls to different parts of the chip to reset cores.... + * Finally get_raminfo() called to fill in RAM info: + * brcmf_chip_get_raminfo: RAM: base=0x0 size=294912 (0x48000) sr=0 (0x0) + * http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c#L700 + * + * Then brcmf_chip_setup() is called, this prints and fills in chipcommon rev and PMU caps: + * brcmf_chip_setup: ccrev=39, pmurev=12, pmucaps=0x19583c0c + * http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c#L1015 + * Bus-specific setup code is NOP for SDIO. + * + * brcmf_sdio_kso_init() is called. + * Here it first reads 0x1 from SBSDIO_FUNC1_SLEEPCSR 0x18000650 and then writes it back... WTF? + * + * brcmf_sdio_drivestrengthinit() is called + * http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c#L3630 + * + * Set card control so an SDIO card reset does a WLAN backplane reset + * set PMUControl so a backplane reset does PMU state reload + * === end of brcmf_sdio_probe_attach === + + **** Finished reading at http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c#L4152, line 2025 in the dump + + * === How register reading works === + * http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c#L357 + * The address to read from is written to three byte-sized registers of F1: + * - SBSDIO_FUNC1_SBADDRLOW 0x1000A + * - SBSDIO_FUNC1_SBADDRMID 0x1000B + * - SBSDIO_FUNC1_SBADDRHIGH 0x1000C + * If this is 32-bit read , a flag is set. The address is ANDed with SBSDIO_SB_OFT_ADDR_MASK which is 0x07FFF. + * Then brcmf_sdiod_regrw_helper() is called to read the reply. + * http://lxr.free-electrons.com/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c#L306 + * Based on the address it figures out where to read it from (CCCR / FBR in F0, or somewhere in F1). + * Reads are retried three times. + * 1-byte IO is done with CMD52, more is read with CMD53 with address increment (not FIFO mode). + * http://lxr.free-electrons.com/source/drivers/mmc/core/sdio_io.c#L458 + * ================================== + * + * + */ +__unused +static void +probe_bcrm(struct cam_device *dev) { + uint32_t cis_addr; + struct cis_info info; + + sdio_card_set_bus_width(dev, bus_width_4); + cis_addr = sdio_get_common_cis_addr(dev); + printf("CIS address: %04X\n", cis_addr); + + memset(&info, 0, sizeof(info)); + sdio_func_read_cis(dev, 0, cis_addr, &info); + printf("Vendor 0x%04X product 0x%04X\n", info.man_id, info.prod_id); +} +__unused +static uint8_t * +mmap_fw() { + const char fw_path[] = "/home/kibab/repos/fbsd-bbb/brcm-firmware/brcmfmac4330-sdio.bin"; + struct stat sb; + uint8_t *fw_ptr; + + int fd = open(fw_path, O_RDONLY); + if (fd < 0) + errx(1, "Cannot open firmware file"); + if (fstat(fd, &sb) < 0) + errx(1, "Cannot get file stat"); + fw_ptr = mmap(NULL, sb.st_size, PROT_READ, 0, fd, 0); + if (fw_ptr == MAP_FAILED) + errx(1, "Cannot map the file"); + + return fw_ptr; +} + +static void +usage() { + printf("sdiotool -u \n"); + exit(0); +} + +static void +get_sdio_card_info(struct cam_device *dev) { + uint32_t cis_addr; + uint32_t fbr_addr; + struct cis_info info; + + cis_addr = sdio_get_common_cis_addr(dev); + + memset(&info, 0, sizeof(info)); + sdio_func_read_cis(dev, 0, cis_addr, &info); + printf("F0: Vendor 0x%04X product 0x%04X max block size %d bytes\n", + info.man_id, info.prod_id, info.max_block_size); + for (int i = 1; i <= 2; i++) { + fbr_addr = SD_IO_FBR_START * i + 0x9; + cis_addr = sdio_read_1(dev, 0, fbr_addr++); + cis_addr |= sdio_read_1(dev, 0, fbr_addr++) << 8; + cis_addr |= sdio_read_1(dev, 0, fbr_addr++) << 16; + memset(&info, 0, sizeof(info)); + sdio_func_read_cis(dev, i, cis_addr, &info); + printf("F%d: Vendor 0x%04X product 0x%04X max block size %d bytes\n", + i, info.man_id, info.prod_id, info.max_block_size); + } +} + +/* Test interrupt delivery when select() */ +__unused static int +sdio_signal_intr(struct cam_device *dev) { + uint8_t resp; + int ret; + + ret = sdio_rw_direct(dev, 0, 0x666, 0, NULL, &resp); + if (ret < 0) + return ret; + return (0); +} + +static void +do_intr_test(__unused struct cam_device *dev) { +} + +int +main(int argc, char **argv) { + char device[] = "pass"; + int unit = 0; + int func = 0; + uint8_t resp; + uint8_t is_enab; + __unused uint8_t *fw_ptr; + int ch; + struct cam_device *cam_dev; + int is_intr_test = 0; + + //fw_ptr = mmap_fw(); + + while ((ch = getopt(argc, argv, "Iu:")) != -1) { + switch (ch) { + case 'u': + unit = (int) strtol(optarg, NULL, 10); + break; + case 'f': + func = (int) strtol(optarg, NULL, 10); + case 'I': + is_intr_test = 1; + case '?': + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if ((cam_dev = cam_open_spec_device(device, unit, O_RDWR, NULL)) == NULL) + errx(1, "Cannot open device"); + + get_sdio_card_info(cam_dev); + if (is_intr_test > 0) + do_intr_test(cam_dev); + exit(0); + sdio_card_reset(cam_dev); + + /* Read Addr 7 of func 0 */ + int ret = sdio_rw_direct(cam_dev, 0, 7, 0, NULL, &resp); + if (ret < 0) + errx(1, "Error sending CAM command"); + printf("Result: %02x\n", resp); + + /* Check if func 1 is enabled */ + ret = sdio_is_func_enabled(cam_dev, 1, &is_enab); + if (ret < 0) + errx(1, "Cannot check if func is enabled"); + printf("F1 enabled: %d\n", is_enab); + ret = sdio_func_enable(cam_dev, 1, 1 - is_enab); + if (ret < 0) + errx(1, "Cannot enable/disable func"); + printf("F1 en/dis result: %d\n", ret); + + /* Check if func 1 is ready */ + ret = sdio_is_func_ready(cam_dev, 1, &is_enab); + if (ret < 0) + errx(1, "Cannot check if func is ready"); + printf("F1 ready: %d\n", is_enab); + + /* Check if interrupts are enabled */ + ret = sdio_is_func_intr_enabled(cam_dev, 1, &is_enab); + if (ret < 0) + errx(1, "Cannot check if func intr is enabled"); + printf("F1 intr enabled: %d\n", is_enab); + ret = sdio_func_intr_enable(cam_dev, 1, 1 - is_enab); + if (ret < 0) + errx(1, "Cannot enable/disable func intr"); + printf("F1 intr en/dis result: %d\n", ret); + + cam_close_spec_device(cam_dev); +} From owner-svn-src-head@freebsd.org Sun Jul 9 17:56:07 2017 Return-Path: Delivered-To: svn-src-head@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 6433FD91B07; Sun, 9 Jul 2017 17:56:07 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F7A366F4B; Sun, 9 Jul 2017 17:56:05 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([92.227.37.89]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M8MyE-1dpnUX1nP8-00vygS; Sun, 09 Jul 2017 19:56:03 +0200 Date: Sun, 9 Jul 2017 19:55:55 +0200 From: "O. Hartmann" To: svn-src-head@freebsd.org Cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... Message-ID: <20170709195525.188d6fa8@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201707091657.v69GvOar096942@repo.freebsd.org> References: <201707091657.v69GvOar096942@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/bOUleh6WuhKllk7dnQOTs3R"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:gjFQMGe7oFyMOqm7uTxQZDG4QVuC5VcQ+ldOtNuYFR6MhcRFHrN xLomXhuSCFL1W6rlfIi1lMBwct4oe45vwwjxn8yyN0DxpdflQQ+2bguk19TrTJLKIGz4T0E W/nuWxYcwHLk9iuDQoQ9p8Bq6oj66pJgg+0xHtIW26On3e8tgOnpXXb2D3ZoQIiq8fb9dU4 GyoK5NVnBg5Erhbr7dnDg== X-UI-Out-Filterresults: notjunk:1;V01:K0:uh/8ZsGh26M=:d3j06SvRf+BADEZqfg/tIT +ESO13hoiQn3eKgngNXE9dlk9FMAA8wlGRYSrac1gwrsTuXCWrqwTv5BfGclJCoBTfnB7ZwKU bTQS/OReXBeoNDDS7rBzkbnFuXcLKaH7mIxnWGaTV97Dir6QaFHGVXxqI/x8MCiYdmZwJv9xy E09fUgxHw2EaBnf6ov/JneI0wUN21fw5VPPW0ORkSwPzW5od5DsMr2yozYcZrqiSUe3kW+GlI EWbHk+1zmhPAqnojb7ZeN80jZIXpeDa9hrWsX+oFNcXbNDzGJLH3r86orGmd+o7uQOEs8nMpr t27x/gz7qKb+2i79l8xWaeEkwFB8tInz8r2zAq7p8Azh2Csp5dwf5YWUgYAbBuCzTncvRps9M HmfSZYlsXsI/bDZAaShFvvKmGAQMIjap6orUlnosRhauEMHnr2WfCeeMH4F/yC74PbpfOVKBn Ps/owpbO6qvWYIWIdlUPDaLwyA91o+i2gF+IS8G2gntGOmirr4wT2SzvNIYqr1JM2dt6otrwT lKI+xqu44jVRuL4XBpUWAgjrlydvRXRQZ+jTwupPmITKxx7jgVMGp2ky1QUVJ0GjQJuxErPte GyCTU+CLTh0bDlrUH8Mm0yOyIJEeDjySS21hEEmQhFLrUDjzUx27wvdHoxf8uyZQaN8fH5ENb vaSX1wdsW1SAe0azzpHFgEsve0PA9Cun7cmfAcwD825Hn2+f99omTB8BSXn/ilF/5ixPQBLqQ Rl9K3nNqFklFQ3r0Y2KhsaMliUoIwFq0RDLU6RAWiztgjqKJ86u+aj9eZgs= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 17:56:07 -0000 --Sig_/bOUleh6WuhKllk7dnQOTs3R Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Sun, 9 Jul 2017 16:57:24 +0000 (UTC) Warner Losh schrieb: > Author: imp > Date: Sun Jul 9 16:57:24 2017 > New Revision: 320844 > URL: https://svnweb.freebsd.org/changeset/base/320844 >=20 > Log: > An MMC/SD/SDIO stack using CAM > =20 > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > flexible queueing will make it easier to write non-storage drivers > than the legacy stack. SDIO drivers from both the kernel and as > userland daemons are possible, though much of that functionality will > come later. > =20 > Some of the CAM integration isn't complete (there are sleeps in the > device probe state machine, for example), but those minor issues can > be improved in-tree more easily than out of tree and shouldn't gate > progress on other fronts. Appologies to reviews if specific items > have been overlooked. > =20 > Submitted by: Ilya Bakulin > Reviewed by: emaste, imp, mav, adrian, ian > Differential Review: https://reviews.freebsd.org/D4761 > =20 > merge with first commit, various compile hacks. >=20 > Added: > head/sys/amd64/conf/MMCCAM (contents, props changed) > head/sys/arm/conf/BEAGLEBONE-MMCCAM (contents, props changed) > head/sys/cam/mmc/ > head/sys/cam/mmc/mmc.h > - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h > head/sys/cam/mmc/mmc_all.h > - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h > head/sys/cam/mmc/mmc_bus.h (contents, props changed) > head/sys/cam/mmc/mmc_da.c (contents, props changed) > head/sys/cam/mmc/mmc_sdio.c (contents, props changed) > head/sys/cam/mmc/mmc_sdio.h > - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h > head/sys/cam/mmc/mmc_xpt.c (contents, props changed) > Modified: > head/etc/mtree/BSD.include.dist > head/include/Makefile > head/lib/libcam/Makefile > head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > head/sys/arm/ti/ti_sdhci.c > head/sys/cam/cam_ccb.h > head/sys/cam/cam_periph.c > head/sys/cam/cam_xpt.c > head/sys/cam/cam_xpt.h > head/sys/cam/cam_xpt_internal.h > head/sys/cam/scsi/scsi_pass.c > head/sys/conf/files > head/sys/conf/options > head/sys/dev/mmc/bridge.h > head/sys/dev/mmc/mmcbrvar.h > head/sys/dev/mmc/mmcreg.h > head/sys/dev/sdhci/fsl_sdhci.c > head/sys/dev/sdhci/sdhci.c > head/sys/dev/sdhci/sdhci.h > head/sys/dev/sdhci/sdhci_acpi.c > head/sys/dev/sdhci/sdhci_pci.c > head/sys/modules/Makefile >=20 > Modified: head/etc/mtree/BSD.include.dist > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/etc/mtree/BSD.include.dist Sun Jul 9 15:41:49 2017 (r320843) > +++ head/etc/mtree/BSD.include.dist Sun Jul 9 16:57:24 2017 (r320844) > @@ -90,6 +90,8 @@ > cam > ata > .. > + mmc > + .. > nvme > .. > scsi >=20 > Modified: head/include/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/include/Makefile Sun Jul 9 15:41:49 2017 (r320843) > +++ head/include/Makefile Sun Jul 9 16:57:24 2017 (r320844) > @@ -42,7 +42,7 @@ LHDRS=3D aio.h errno.h fcntl.h linker_set.h poll.h stdat > LDIRS=3D bsm cam geom net net80211 netgraph netinet netinet6 \ > netipsec netsmb nfs nfsclient nfsserver sys vm > =20 > -LSUBDIRS=3D cam/ata cam/nvme cam/scsi \ > +LSUBDIRS=3D cam/ata cam/mmc cam/nvme cam/scsi \ > dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ > dev/hwpmc dev/hyperv \ > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ >=20 > Modified: head/lib/libcam/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libcam/Makefile Sun Jul 9 15:41:49 2017 (r320843) > +++ head/lib/libcam/Makefile Sun Jul 9 16:57:24 2017 (r320844) > @@ -38,6 +38,7 @@ MLINKS+=3D cam.3 cam_open_device.3 \ > =20 > .PATH: ${SRCTOP}/sys/cam \ > ${SRCTOP}/sys/cam/ata \ > + ${SRCTOP}/sys/cam/mmc \ > ${SRCTOP}/sys/cam/scsi > =20 > CFLAGS+=3D -I${.CURDIR} -I${SRCTOP}/sys >=20 > Added: head/sys/amd64/conf/MMCCAM > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/amd64/conf/MMCCAM Sun Jul 9 16:57:24 2017 (r320844) > @@ -0,0 +1,36 @@ > +# MMCCAM is the kernel config for doing MMC on CAM development > +# and testing on bhyve > +# $FreeBSD$ > + > +include MINIMAL > + > +ident MMCCAM > + > +# Access GPT-formatted and labeled root volume > +options GEOM_PART_GPT > +options GEOM_LABEL > + > +# UART -- for bhyve console > +device uart > + > +# kgdb stub > +device bvmdebug > + > +# VirtIO support, needed for bhyve > +device virtio # Generic VirtIO bus (required) > +device virtio_pci # VirtIO PCI device > +device vtnet # VirtIO Ethernet device > +device virtio_blk # VirtIO Block device > +device virtio_scsi # VirtIO SCSI device > +device virtio_balloon # VirtIO Memory Balloon device > + > +# CAM-specific stuff > +device pass > +device scbus > +device da > +device mmccam > + > +options MMCCAM > +# Add CAMDEBUG stuff > +options CAMDEBUG > +options > CAM_DEBUG_FLAGS=3D(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH|CAM_DE= BUG_TRACE) >=20 > Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Jul 9 15:41:49 > 2017 (r320843) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Jul > 9 16:57:24 2017 (r320844) @@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$"); > #include "mmcbr_if.h" > #include "sdhci_if.h" > =20 > +#include "opt_mmccam.h" > + > #include "bcm2835_dma.h" > #include > #include "bcm2835_vcbus.h" > @@ -253,7 +255,11 @@ bcm_sdhci_attach(device_t dev) > bus_generic_probe(dev); > bus_generic_attach(dev); > =20 > +#ifdef MMCCAM > + sdhci_cam_start_slot(&sc->sc_slot); > +#else > sdhci_start_slot(&sc->sc_slot); > +#endif > =20 > return (0); > =20 >=20 > Added: head/sys/arm/conf/BEAGLEBONE-MMCCAM > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/arm/conf/BEAGLEBONE-MMCCAM Sun Jul 9 16:57:24 2017 (r320844) > @@ -0,0 +1,21 @@ > +# > +# BEAGLEBONE-MMCCAM > +# > +# Custom kernel for Beaglebone plus MMCCAM as opposed to the prior MMC s= tack. It is > +# present to keep it building in tree since it wouldn't work in LINT. > +# > +# $FreeBSD$ > + > +include BEAGLEBONE > + > +# Add CAMDEBUG stuff > +options CAMDEBUG > +options > CAM_DEBUG_FLAGS=3D(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH|CAM_DE= BUG_TRACE) + > +# pass(4) device > +device pass > +device mmccam > +options MMCCAM > + > +nodevice mmc > +nodevice mmcsd >=20 > Modified: head/sys/arm/ti/ti_sdhci.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/arm/ti/ti_sdhci.c Sun Jul 9 15:41:49 2017 (r320843) > +++ head/sys/arm/ti/ti_sdhci.c Sun Jul 9 16:57:24 2017 (r320844) > @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > +#include > =20 > #include > #include > @@ -60,6 +62,8 @@ __FBSDID("$FreeBSD$"); > #include > #include "gpio_if.h" > =20 > +#include "opt_mmccam.h" > + > struct ti_sdhci_softc { > device_t dev; > struct sdhci_fdt_gpio * gpio; > @@ -122,6 +126,11 @@ static struct ofw_compat_data compat_data[] =3D { > #define MMCHS_SD_CAPA_VS30 (1 << 25) > #define MMCHS_SD_CAPA_VS33 (1 << 24) > =20 > +/* Forward declarations, CAM-relataed */ > +// static void ti_sdhci_cam_poll(struct cam_sim *); > +// static void ti_sdhci_cam_action(struct cam_sim *, union ccb *); > +// static int ti_sdhci_cam_settran_settings(struct ti_sdhci_softc *sc, u= nion ccb *); > + > static inline uint32_t > ti_mmchs_read_4(struct ti_sdhci_softc *sc, bus_size_t off) > { > @@ -241,6 +250,22 @@ ti_sdhci_write_1(device_t dev, struct sdhci_slot *sl= ot > struct ti_sdhci_softc *sc =3D device_get_softc(dev); > uint32_t val32; > =20 > +#ifdef MMCCAM > + uint32_t newval32; > + if (off =3D=3D SDHCI_HOST_CONTROL) { > + val32 =3D ti_mmchs_read_4(sc, MMCHS_CON); > + newval32 =3D val32; > + if (val & SDHCI_CTRL_8BITBUS) { > + device_printf(dev, "Custom-enabling 8-bit bus\n"); > + newval32 |=3D MMCHS_CON_DW8; > + } else { > + device_printf(dev, "Custom-disabling 8-bit bus\n"); > + newval32 &=3D ~MMCHS_CON_DW8; > + } > + if (newval32 !=3D val32) > + ti_mmchs_write_4(sc, MMCHS_CON, newval32); > + } > +#endif > val32 =3D RD4(sc, off & ~3); > val32 &=3D ~(0xff << (off & 3) * 8); > val32 |=3D (val << (off & 3) * 8); > @@ -658,8 +683,11 @@ ti_sdhci_attach(device_t dev) > bus_generic_probe(dev); > bus_generic_attach(dev); > =20 > +#ifdef MMCCAM > + sdhci_cam_start_slot(&sc->slot); > +#else > sdhci_start_slot(&sc->slot); > - > +#endif > return (0); > =20 > fail: > @@ -730,4 +758,7 @@ static driver_t ti_sdhci_driver =3D { > DRIVER_MODULE(sdhci_ti, simplebus, ti_sdhci_driver, ti_sdhci_devclass, N= ULL, > NULL); > MODULE_DEPEND(sdhci_ti, sdhci, 1, 1, 1); > + > +#ifndef MMCCAM > MMC_DECLARE_BRIDGE(sdhci_ti); > +#endif >=20 > Modified: head/sys/cam/cam_ccb.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/cam_ccb.h Sun Jul 9 15:41:49 2017 (r320843) > +++ head/sys/cam/cam_ccb.h Sun Jul 9 16:57:24 2017 (r320844) > @@ -42,6 +42,7 @@ > #include > #include > #include > +#include > =20 > /* General allocation length definitions for CCB structures */ > #define IOCDBLEN CAM_MAX_CDBLEN /* Space for CDB bytes/pointer */ > @@ -208,10 +209,10 @@ typedef enum { > XPT_NVME_IO =3D 0x1c | XPT_FC_DEV_QUEUED, > /* Execiute the requestred NVMe I/O operation */ > =20 > - XPT_MMCSD_IO =3D 0x1d | XPT_FC_DEV_QUEUED, > + XPT_MMC_IO =3D 0x1d | XPT_FC_DEV_QUEUED, > /* Placeholder for MMC / SD / SDIO I/O stuff */ > =20 > - XPT_SCAN_TGT =3D 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB > + XPT_SCAN_TGT =3D 0x1e | XPT_FC_QUEUED | XPT_FC_USER_CCB > | XPT_FC_XPT_ONLY, > /* Scan Target */ > =20 > @@ -267,6 +268,7 @@ typedef enum { > PROTO_SATAPM, /* SATA Port Multiplier */ > PROTO_SEMB, /* SATA Enclosure Management Bridge */ > PROTO_NVME, /* NVME */ > + PROTO_MMCSD, /* MMC, SD, SDIO */ > } cam_proto; > =20 > typedef enum { > @@ -283,6 +285,7 @@ typedef enum { > XPORT_ISCSI, /* iSCSI */ > XPORT_SRP, /* SCSI RDMA Protocol */ > XPORT_NVME, /* NVMe over PCIe */ > + XPORT_MMCSD, /* MMC, SD, SDIO card */ > } cam_xport; > =20 > #define XPORT_IS_NVME(t) ((t) =3D=3D XPORT_NVME) > @@ -498,6 +501,7 @@ struct device_match_result { > cam_proto protocol; > struct scsi_inquiry_data inq_data; > struct ata_params ident_data; > + struct mmc_params mmc_ident_data; > dev_result_flags flags; > }; > =20 > @@ -773,6 +777,16 @@ struct ccb_ataio { > uint32_t unused; > }; > =20 > +/* > + * MMC I/O Request CCB used for the XPT_MMC_IO function code. > + */ > +struct ccb_mmcio { > + struct ccb_hdr ccb_h; > + union ccb *next_ccb; /* Ptr for next CCB for action */ > + struct mmc_command cmd; > + struct mmc_command stop; > +}; > + > struct ccb_accept_tio { > struct ccb_hdr ccb_h; > cdb_t cdb_io; /* Union for CDB bytes/pointer */ > @@ -1005,7 +1019,28 @@ struct ccb_trans_settings_nvme=20 > u_int max_xfer; /* Max transfer size (0 -> unlimited */ > u_int caps; > }; > -=09 > + > +#include > +struct ccb_trans_settings_mmc { > + struct mmc_ios ios; > +#define MMC_CLK (1 << 1) > +#define MMC_VDD (1 << 2) > +#define MMC_CS (1 << 3) > +#define MMC_BW (1 << 4) > +#define MMC_PM (1 << 5) > +#define MMC_BT (1 << 6) > +#define MMC_BM (1 << 7) > + uint32_t ios_valid; > +/* The folowing is used only for GET_TRAN_SETTINGS */ > + uint32_t host_ocr; > + int host_f_min; > + int host_f_max; > +#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers */ > +#define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers */ > +#define MMC_CAP_HSPEED (1 << 2) /* Can do High Speed transfers */ > + uint32_t host_caps; > +}; > + > /* Get/Set transfer rate/width/disconnection/tag queueing settings */ > struct ccb_trans_settings { > struct ccb_hdr ccb_h; > @@ -1019,6 +1054,7 @@ struct ccb_trans_settings { > struct ccb_trans_settings_ata ata; > struct ccb_trans_settings_scsi scsi; > struct ccb_trans_settings_nvme nvme; > + struct ccb_trans_settings_mmc mmc; > } proto_specific; > union { > u_int valid; /* Which fields to honor */ > @@ -1284,6 +1320,7 @@ union ccb { > struct ccb_dev_advinfo cdai; > struct ccb_async casync; > struct ccb_nvmeio nvmeio; > + struct ccb_mmcio mmcio; > }; > =20 > #define CCB_CLEAR_ALL_EXCEPT_HDR(ccbp) \ > @@ -1327,6 +1364,13 @@ cam_fill_smpio(struct ccb_smpio *smpio, uint32_t r= etri > uint32_t timeout); > =20 > static __inline void > +cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, > + void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, > + uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t mmc_flags, > + struct mmc_data *mmc_d, > + uint32_t timeout); > + > +static __inline void > cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries, > void (*cbfcnp)(struct cam_periph *, union ccb *), > u_int32_t flags, u_int8_t tag_action, > @@ -1412,6 +1456,34 @@ cam_fill_smpio(struct ccb_smpio *smpio, uint32_t r= etri > smpio->smp_request_len =3D smp_request_len; > smpio->smp_response =3D smp_response; > smpio->smp_response_len =3D smp_response_len; > +} > + > +static __inline void > +cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, > + void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags, > + uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t mmc_flags, > + struct mmc_data *mmc_d, > + uint32_t timeout) > +{ > + mmcio->ccb_h.func_code =3D XPT_MMC_IO; > + mmcio->ccb_h.flags =3D flags; > + mmcio->ccb_h.retry_count =3D retries; > + mmcio->ccb_h.cbfcnp =3D cbfcnp; > + mmcio->ccb_h.timeout =3D timeout; > + mmcio->cmd.opcode =3D mmc_opcode; > + mmcio->cmd.arg =3D mmc_arg; > + mmcio->cmd.flags =3D mmc_flags; > + mmcio->stop.opcode =3D 0; > + mmcio->stop.arg =3D 0; > + mmcio->stop.flags =3D 0; > + if (mmc_d !=3D NULL) { > + mmcio->cmd.data =3D mmc_d; > + } else > + mmcio->cmd.data =3D NULL; > + mmcio->cmd.resp[0] =3D 0; > + mmcio->cmd.resp[1] =3D 0; > + mmcio->cmd.resp[2] =3D 0; > + mmcio->cmd.resp[3] =3D 0; > } > =20 > static __inline void >=20 > Modified: head/sys/cam/cam_periph.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/cam_periph.c Sun Jul 9 15:41:49 2017 (r320843) > +++ head/sys/cam/cam_periph.c Sun Jul 9 16:57:24 2017 (r320844) > @@ -827,6 +827,18 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_= ma > dirs[0] =3D ccb->ccb_h.flags & CAM_DIR_MASK; > numbufs =3D 1; > break; > + case XPT_MMC_IO: > + if ((ccb->ccb_h.flags & CAM_DIR_MASK) =3D=3D CAM_DIR_NONE) > + return(0); > + /* Two mappings: one for cmd->data and one for cmd->data->data */ > + data_ptrs[0] =3D (unsigned char **)&ccb->mmcio.cmd.data; > + lengths[0] =3D sizeof(struct mmc_data *); > + dirs[0] =3D ccb->ccb_h.flags & CAM_DIR_MASK; > + data_ptrs[1] =3D (unsigned char **)&ccb->mmcio.cmd.data->data; > + lengths[1] =3D ccb->mmcio.cmd.data->len; > + dirs[1] =3D ccb->ccb_h.flags & CAM_DIR_MASK; > + numbufs =3D 2; > + break; > case XPT_SMP_IO: > data_ptrs[0] =3D &ccb->smpio.smp_request; > lengths[0] =3D ccb->smpio.smp_request_len; >=20 > Modified: head/sys/cam/cam_xpt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/cam_xpt.c Sun Jul 9 15:41:49 2017 (r320843) > +++ head/sys/cam/cam_xpt.c Sun Jul 9 16:57:24 2017 (r320844) > @@ -329,7 +329,6 @@ static xpt_devicefunc_t xptsetasyncfunc; > static xpt_busfunc_t xptsetasyncbusfunc; > static cam_status xptregister(struct cam_periph *periph, > void *arg); > -static const char * xpt_action_name(uint32_t action); > static __inline int device_is_queued(struct cam_ed *device); > =20 > static __inline int > @@ -412,7 +411,7 @@ xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, i > } > return (error); > } > -=09 > + > static int > xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct = thread *td) > { > @@ -820,6 +819,8 @@ xpt_scanner_thread(void *dummy) > TAILQ_REMOVE(&xsoftc.ccb_scanq, &ccb->ccb_h, sim_links.tqe); > xpt_unlock_buses(); > =20 > + printf("xpt_scanner_thread is firing on path "); > + xpt_print_path(ccb->ccb_h.path);printf("\n"); > /* > * Since lock can be dropped inside and path freed > * by completion callback even before return here, > @@ -1503,7 +1504,7 @@ xptdevicematch(struct dev_match_pattern *patterns, = u_i > =20 > cur_pattern =3D &patterns[i].pattern.device_pattern; > =20 > - /* Error out if mutually exclusive options are specified. */=20 > + /* Error out if mutually exclusive options are specified. */ > if ((cur_pattern->flags & (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) > =3D=3D (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) > return(DM_RET_ERROR); > @@ -1905,6 +1906,9 @@ xptedtdevicefunc(struct cam_ed *device, void *arg) > bcopy(&device->ident_data, > &cdm->matches[j].result.device_result.ident_data, > sizeof(struct ata_params)); > + bcopy(&device->mmc_ident_data, > + &cdm->matches[j].result.device_result.mmc_ident_data, > + sizeof(struct mmc_params)); > =20 > /* Let the user know whether this device is unconfigured */ > if (device->flags & CAM_DEV_UNCONFIGURED) > @@ -2690,6 +2694,8 @@ xpt_action_default(union ccb *start_ccb) > if (start_ccb->ccb_h.func_code =3D=3D XPT_NVME_IO) > start_ccb->nvmeio.resid =3D 0; > /* FALLTHROUGH */ > + case XPT_MMC_IO: > + /* XXX just like nmve_io? */ > case XPT_RESET_DEV: > case XPT_ENG_EXEC: > case XPT_SMP_IO: > @@ -2801,11 +2807,12 @@ call_sim: > mtx_lock(mtx); > else > mtx =3D NULL; > + > CAM_DEBUG(path, CAM_DEBUG_TRACE, > - ("sim->sim_action: func=3D%#x\n", start_ccb->ccb_h.func_code)); > + ("Calling sim->sim_action(): func=3D%#x\n", > start_ccb->ccb_h.func_code)); (*(sim->sim_action))(sim, start_ccb); > CAM_DEBUG(path, CAM_DEBUG_TRACE, > - ("sim->sim_action: status=3D%#x\n", start_ccb->ccb_h.status)); > + ("sim->sim_action returned: status=3D%#x\n", > start_ccb->ccb_h.status)); if (mtx) > mtx_unlock(mtx); > break; > @@ -5540,7 +5547,7 @@ static struct kv map[] =3D { > { XPT_GET_SIM_KNOB, "XPT_GET_SIM_KNOB" }, > { XPT_SET_SIM_KNOB, "XPT_SET_SIM_KNOB" }, > { XPT_NVME_IO, "XPT_NVME_IO" }, > - { XPT_MMCSD_IO, "XPT_MMCSD_IO" }, > + { XPT_MMC_IO, "XPT_MMC_IO" }, > { XPT_SMP_IO, "XPT_SMP_IO" }, > { XPT_SCAN_TGT, "XPT_SCAN_TGT" }, > { XPT_ENG_INQ, "XPT_ENG_INQ" }, > @@ -5556,7 +5563,7 @@ static struct kv map[] =3D { > { 0, 0 } > }; > =20 > -static const char * > +const char * > xpt_action_name(uint32_t action)=20 > { > static char buffer[32]; /* Only for unknown messages -- racy */ >=20 > Modified: head/sys/cam/cam_xpt.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/cam_xpt.h Sun Jul 9 15:41:49 2017 (r320843) > +++ head/sys/cam/cam_xpt.h Sun Jul 9 16:57:24 2017 (r320844) > @@ -141,6 +141,8 @@ void xpt_copy_path(struct cam_path *new_path, > =20 > void xpt_release_path(struct cam_path *path); > =20 > +const char * xpt_action_name(uint32_t action); > + > #endif /* _KERNEL */ > =20 > #endif /* _CAM_CAM_XPT_H */ >=20 > Modified: head/sys/cam/cam_xpt_internal.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/cam_xpt_internal.h Sun Jul 9 15:41:49 2017 (r320843) > +++ head/sys/cam/cam_xpt_internal.h Sun Jul 9 16:57:24 2017 (r320844) > @@ -125,6 +125,7 @@ struct cam_ed { > uint32_t rcap_len; > uint8_t *rcap_buf; > struct ata_params ident_data; > + struct mmc_params mmc_ident_data; > u_int8_t inq_flags; /* > * Current settings for inquiry flags. > * This allows us to override settings >=20 > Copied and modified: head/sys/cam/mmc/mmc.h (from r320843, head/sys/dev/m= mc/mmcbrvar.h) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/mmc/mmcbrvar.h Sun Jul 9 15:41:49 2017 (r320843, copy > source) +++ head/sys/cam/mmc/mmc.h Sun Jul 9 16:57:24 2017 (r320844) > @@ -1,6 +1,5 @@ > /*- > - * Copyright (c) 2006 Bernd Walter. All rights reserved. > - * Copyright (c) 2006 M. Warner Losh. All rights reserved. > + * Copyright (c) 2014-2016 Ilya Bakulin. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > @@ -49,77 +48,47 @@ > * or the SD Card Association to disclose or distribute any technical > * information, know-how or other confidential information to any third = party. > * > + * Inspired coded in sys/dev/mmc. Thanks to Warner Losh , > + * Bernd Walter , and other authors. > + * > * $FreeBSD$ > */ > =20 > -#ifndef DEV_MMC_MMCBRVAR_H > -#define DEV_MMC_MMCBRVAR_H > +#ifndef CAM_MMC_H > +#define CAM_MMC_H > =20 > #include > - > -#include "mmcbr_if.h" > - > -enum mmcbr_device_ivars { > - MMCBR_IVAR_BUS_MODE, > - MMCBR_IVAR_BUS_WIDTH, > - MMCBR_IVAR_CHIP_SELECT, > - MMCBR_IVAR_CLOCK, > - MMCBR_IVAR_F_MIN, > - MMCBR_IVAR_F_MAX, > - MMCBR_IVAR_HOST_OCR, > - MMCBR_IVAR_MODE, > - MMCBR_IVAR_OCR, > - MMCBR_IVAR_POWER_MODE, > - MMCBR_IVAR_VDD, > - MMCBR_IVAR_VCCQ, > - MMCBR_IVAR_CAPS, > - MMCBR_IVAR_TIMING, > - MMCBR_IVAR_MAX_DATA, > - MMCBR_IVAR_MAX_BUSY_TIMEOUT > -}; > - > /* > - * Simplified accessors for bridge devices > + * This structure describes an MMC/SD card > */ > -#define MMCBR_ACCESSOR(var, ivar, type) \ > - __BUS_ACCESSOR(mmcbr, var, MMCBR, ivar, type) > +struct mmc_params { > + u_int8_t model[40]; /* Card model */ > =20 > -MMCBR_ACCESSOR(bus_mode, BUS_MODE, int) > -MMCBR_ACCESSOR(bus_width, BUS_WIDTH, int) > -MMCBR_ACCESSOR(chip_select, CHIP_SELECT, int) > -MMCBR_ACCESSOR(clock, CLOCK, int) > -MMCBR_ACCESSOR(f_max, F_MAX, int) > -MMCBR_ACCESSOR(f_min, F_MIN, int) > -MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) > -MMCBR_ACCESSOR(mode, MODE, int) > -MMCBR_ACCESSOR(ocr, OCR, int) > -MMCBR_ACCESSOR(power_mode, POWER_MODE, int) > -MMCBR_ACCESSOR(vdd, VDD, int) > -MMCBR_ACCESSOR(vccq, VCCQ, int) > -MMCBR_ACCESSOR(caps, CAPS, int) > -MMCBR_ACCESSOR(timing, TIMING, int) > -MMCBR_ACCESSOR(max_data, MAX_DATA, int) > -MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) > + /* Card OCR */ > + uint32_t card_ocr; > =20 > -static int __inline > -mmcbr_update_ios(device_t dev) > -{ > + /* OCR of the IO portion of the card */ > + uint32_t io_ocr; > =20 > - return (MMCBR_UPDATE_IOS(device_get_parent(dev), dev)); > -} > + /* Card CID -- raw and parsed */ > + uint32_t card_cid[4]; > + struct mmc_cid cid; > =20 > -static int __inline > -mmcbr_switch_vccq(device_t dev) > -{ > + /* Card CSD -- raw */ > + uint32_t card_csd[4]; > =20 > - return (MMCBR_SWITCH_VCCQ(device_get_parent(dev), dev)); > -} > + /* Card RCA */ > + uint16_t card_rca; > =20 > -static int __inline > -mmcbr_get_ro(device_t dev) > -{ > + /* What kind of card is it */ > + uint32_t card_features; > +#define CARD_FEATURE_MEMORY 0x1 > +#define CARD_FEATURE_SDHC 0x1 << 1 > +#define CARD_FEATURE_SDIO 0x1 << 2 > +#define CARD_FEATURE_SD20 0x1 << 3 > +#define CARD_FEATURE_MMC 0x1 << 4 > =20 > - return (MMCBR_GET_RO(device_get_parent(dev), dev)); > -} > + uint8_t sdio_func_count; > +} __packed; > =20 > -#endif /* DEV_MMC_MMCBRVAR_H */ > +#endif >=20 > Copied and modified: head/sys/cam/mmc/mmc_all.h (from r320843, > head/sys/dev/mmc/mmcbrvar.h) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D --- > head/sys/dev/mmc/mmcbrvar.h Sun Jul 9 15:41:49 2017 (r320843, copy > source) +++ head/sys/cam/mmc/mmc_all.h Sun Jul 9 16:57:24 2017 (r320844) > @@ -1,6 +1,5 @@ /*- > - * Copyright (c) 2006 Bernd Walter. All rights reserved. > - * Copyright (c) 2006 M. Warner Losh. All rights reserved. > + * Copyright (c) 2014-2016 Ilya Bakulin. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > @@ -52,74 +51,20 @@ > * $FreeBSD$ > */ > =20 > -#ifndef DEV_MMC_MMCBRVAR_H > -#define DEV_MMC_MMCBRVAR_H > - > -#include > - > -#include "mmcbr_if.h" > - > -enum mmcbr_device_ivars { > - MMCBR_IVAR_BUS_MODE, > - MMCBR_IVAR_BUS_WIDTH, > - MMCBR_IVAR_CHIP_SELECT, > - MMCBR_IVAR_CLOCK, > - MMCBR_IVAR_F_MIN, > - MMCBR_IVAR_F_MAX, > - MMCBR_IVAR_HOST_OCR, > - MMCBR_IVAR_MODE, > - MMCBR_IVAR_OCR, > - MMCBR_IVAR_POWER_MODE, > - MMCBR_IVAR_VDD, > - MMCBR_IVAR_VCCQ, > - MMCBR_IVAR_CAPS, > - MMCBR_IVAR_TIMING, > - MMCBR_IVAR_MAX_DATA, > - MMCBR_IVAR_MAX_BUSY_TIMEOUT > -}; > - > /* > - * Simplified accessors for bridge devices > + * MMC function that should be visible to the CAM subsystem > + * and are somehow useful should be declared here > + * > + * Like in other *_all.h, it's also a nice place to include > + * some other transport-specific headers. > */ > -#define MMCBR_ACCESSOR(var, ivar, type) \ > - __BUS_ACCESSOR(mmcbr, var, MMCBR, ivar, type) > =20 > -MMCBR_ACCESSOR(bus_mode, BUS_MODE, int) > -MMCBR_ACCESSOR(bus_width, BUS_WIDTH, int) > -MMCBR_ACCESSOR(chip_select, CHIP_SELECT, int) > -MMCBR_ACCESSOR(clock, CLOCK, int) > -MMCBR_ACCESSOR(f_max, F_MAX, int) > -MMCBR_ACCESSOR(f_min, F_MIN, int) > -MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) > -MMCBR_ACCESSOR(mode, MODE, int) > -MMCBR_ACCESSOR(ocr, OCR, int) > -MMCBR_ACCESSOR(power_mode, POWER_MODE, int) > -MMCBR_ACCESSOR(vdd, VDD, int) > -MMCBR_ACCESSOR(vccq, VCCQ, int) > -MMCBR_ACCESSOR(caps, CAPS, int) > -MMCBR_ACCESSOR(timing, TIMING, int) > -MMCBR_ACCESSOR(max_data, MAX_DATA, int) > -MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) > +#ifndef CAM_MMC_ALL_H > +#define CAM_MMC_ALL_H > =20 > -static int __inline > -mmcbr_update_ios(device_t dev) > -{ > +#include > +#include > =20 > - return (MMCBR_UPDATE_IOS(device_get_parent(dev), dev)); > -} > +void mmc_print_ident(struct mmc_params *ident_data); > =20 > -static int __inline > -mmcbr_switch_vccq(device_t dev) > -{ > - > - return (MMCBR_SWITCH_VCCQ(device_get_parent(dev), dev)); > -} > - > -static int __inline > -mmcbr_get_ro(device_t dev) > -{ > - > - return (MMCBR_GET_RO(device_get_parent(dev), dev)); > -} > - > -#endif /* DEV_MMC_MMCBRVAR_H */ > +#endif >=20 > Added: head/sys/cam/mmc/mmc_bus.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/cam/mmc/mmc_bus.h Sun Jul 9 16:57:24 2017 (r320844) > @@ -0,0 +1,5 @@ > +/* > + * This file is in the public domain. > + * $FreeBSD$ > + */ > +#include >=20 > Added: head/sys/cam/mmc/mmc_da.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/cam/mmc/mmc_da.c Sun Jul 9 16:57:24 2017 (r320844) > @@ -0,0 +1,1432 @@ > +/*- > + * Copyright (c) 2006 Bernd Walter > + * Copyright (c) 2006 M. Warner Losh > + * Copyright (c) 2009 Alexander Motin > + * Copyright (c) 2015-2017 Ilya Bakulin > + * 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, > + * without modification, immediately at the beginning of the file. > + * 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 distributio= n. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRAN= TIES > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIME= D. > + * 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. > + * > + * Some code derived from the sys/dev/mmc and sys/cam/ata > + * Thanks to Warner Losh , Alexander Motin > + * Bernd Walter , and other authors. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +//#include "opt_sdda.h" > + > +#include > + > +#ifdef _KERNEL > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include /* for PRIu64 */ > +#endif /* _KERNEL */ > + > +#ifndef _KERNEL > +#include > +#include > +#endif /* _KERNEL */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > + > +#include > + > +#include /* geometry translation */ > + > +#ifdef _KERNEL > + > +typedef enum { > + SDDA_FLAG_OPEN =3D 0x0002, > + SDDA_FLAG_DIRTY =3D 0x0004 > +} sdda_flags; > + > +typedef enum { > + SDDA_STATE_INIT, > + SDDA_STATE_INVALID, > + SDDA_STATE_NORMAL > +} sdda_state; > + > +struct sdda_softc { > + struct bio_queue_head bio_queue; > + int outstanding_cmds; /* Number of active commands */ > + int refcount; /* Active xpt_action() calls */ > + sdda_state state; > + sdda_flags flags; > + struct mmc_data *mmcdata; > +// sdda_quirks quirks; > + struct task start_init_task; > + struct disk *disk; > + uint32_t raw_csd[4]; > + uint8_t raw_ext_csd[512]; /* MMC only? */ > + struct mmc_csd csd; > + struct mmc_cid cid; > + struct mmc_scr scr; > + /* Calculated from CSD */ > + uint64_t sector_count; > + uint64_t mediasize; > + > + /* Calculated from CID */ > + char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ > + char card_sn_string[16];/* Formatted serial # for disk->d_ident */ > + /* Determined from CSD + is highspeed card*/ > + uint32_t card_f_max; > +}; > + > +#define ccb_bp ppriv_ptr1 > + > +static disk_strategy_t sddastrategy; > +static periph_init_t sddainit; > +static void sddaasync(void *callback_arg, u_int32_t code, > + struct cam_path *path, void *arg); > +static periph_ctor_t sddaregister; > +static periph_dtor_t sddacleanup; > +static periph_start_t sddastart; > +static periph_oninv_t sddaoninvalidate; > +static void sddadone(struct cam_periph *periph, > + union ccb *done_ccb); > +static int sddaerror(union ccb *ccb, u_int32_t cam_flags, > + u_int32_t sense_flags); > + > +static uint16_t get_rca(struct cam_periph *periph); > +static cam_status sdda_hook_into_geom(struct cam_periph *periph); > +static void sdda_start_init(void *context, union ccb *start_ccb); > +static void sdda_start_init_task(void *context, int pending); > + > +static struct periph_driver sddadriver =3D > +{ > + sddainit, "sdda", > + TAILQ_HEAD_INITIALIZER(sddadriver.units), /* generation */ 0 > +}; > + > +PERIPHDRIVER_DECLARE(sdda, sddadriver); > + > +static MALLOC_DEFINE(M_SDDA, "sd_da", "sd_da buffers"); > + > +static const int exp[8] =3D { > + 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 > +}; > + > +static const int mant[16] =3D { > + 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 > +}; > + > +static const int cur_min[8] =3D { > + 500, 1000, 5000, 10000, 25000, 35000, 60000, 100000 > +}; > + > +static const int cur_max[8] =3D { > + 1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000 > +}; > + > +static uint16_t > +get_rca(struct cam_periph *periph) { > + return periph->path->device->mmc_ident_data.card_rca; > +} > + > +static uint32_t > +mmc_get_bits(uint32_t *bits, int bit_len, int start, int size) > +{ > + const int i =3D (bit_len / 32) - (start / 32) - 1; > + const int shift =3D start & 31; > + uint32_t retval =3D bits[i] >> shift; > + if (size + shift > 32) > + retval |=3D bits[i - 1] << (32 - shift); > + return (retval & ((1llu << size) - 1)); > +} > + > + > +static void > +mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) > +{ > + int v; > + int m; > + int e; > + > + memset(csd, 0, sizeof(*csd)); > + csd->csd_structure =3D v =3D mmc_get_bits(raw_csd, 128, 126, 2); > + if (v =3D=3D 0) { > + m =3D mmc_get_bits(raw_csd, 128, 115, 4); > + e =3D mmc_get_bits(raw_csd, 128, 112, 3); > + csd->tacc =3D (exp[e] * mant[m] + 9) / 10; > + csd->nsac =3D mmc_get_bits(raw_csd, 128, 104, 8) * 100; > + m =3D mmc_get_bits(raw_csd, 128, 99, 4); > + e =3D mmc_get_bits(raw_csd, 128, 96, 3); > + csd->tran_speed =3D exp[e] * 10000 * mant[m]; > + csd->ccc =3D mmc_get_bits(raw_csd, 128, 84, 12); > + csd->read_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 80, 4); > + csd->read_bl_partial =3D mmc_get_bits(raw_csd, 128, 79, 1); > + csd->write_blk_misalign =3D mmc_get_bits(raw_csd, 128, 78, 1); > + csd->read_blk_misalign =3D mmc_get_bits(raw_csd, 128, 77, 1); > + csd->dsr_imp =3D mmc_get_bits(raw_csd, 128, 76, 1); > + csd->vdd_r_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128, 59, 3)]; > + csd->vdd_r_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128, 56, 3)]; > + csd->vdd_w_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128, 53, 3)]; > + csd->vdd_w_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128, 50, 3)]; > + m =3D mmc_get_bits(raw_csd, 128, 62, 12); > + e =3D mmc_get_bits(raw_csd, 128, 47, 3); > + csd->capacity =3D ((1 + m) << (e + 2)) * csd->read_bl_len; > + csd->erase_blk_en =3D mmc_get_bits(raw_csd, 128, 46, 1); > + csd->erase_sector =3D mmc_get_bits(raw_csd, 128, 39, 7) + 1; > + csd->wp_grp_size =3D mmc_get_bits(raw_csd, 128, 32, 7); > + csd->wp_grp_enable =3D mmc_get_bits(raw_csd, 128, 31, 1); > + csd->r2w_factor =3D 1 << mmc_get_bits(raw_csd, 128, 26, 3); > + csd->write_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 22, 4); > + csd->write_bl_partial =3D mmc_get_bits(raw_csd, 128, 21, 1); > + } else if (v =3D=3D 1) { > + m =3D mmc_get_bits(raw_csd, 128, 115, 4); > + e =3D mmc_get_bits(raw_csd, 128, 112, 3); > + csd->tacc =3D (exp[e] * mant[m] + 9) / 10; > + csd->nsac =3D mmc_get_bits(raw_csd, 128, 104, 8) * 100; > + m =3D mmc_get_bits(raw_csd, 128, 99, 4); > + e =3D mmc_get_bits(raw_csd, 128, 96, 3); > + csd->tran_speed =3D exp[e] * 10000 * mant[m]; > + csd->ccc =3D mmc_get_bits(raw_csd, 128, 84, 12); > + csd->read_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 80, 4); > + csd->read_bl_partial =3D mmc_get_bits(raw_csd, 128, 79, 1); > + csd->write_blk_misalign =3D mmc_get_bits(raw_csd, 128, 78, 1); > + csd->read_blk_misalign =3D mmc_get_bits(raw_csd, 128, 77, 1); > + csd->dsr_imp =3D mmc_get_bits(raw_csd, 128, 76, 1); > + csd->capacity =3D ((uint64_t)mmc_get_bits(raw_csd, 128, 48, 22) + 1) * > + 512 * 1024; > + csd->erase_blk_en =3D mmc_get_bits(raw_csd, 128, 46, 1); > + csd->erase_sector =3D mmc_get_bits(raw_csd, 128, 39, 7) + 1; > + csd->wp_grp_size =3D mmc_get_bits(raw_csd, 128, 32, 7); > + csd->wp_grp_enable =3D mmc_get_bits(raw_csd, 128, 31, 1); > + csd->r2w_factor =3D 1 << mmc_get_bits(raw_csd, 128, 26, 3); > + csd->write_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 22, 4); > + csd->write_bl_partial =3D mmc_get_bits(raw_csd, 128, 21, 1); > + } else > + panic("unknown SD CSD version"); > +} > + > +static void > +mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd) > +{ > + int m; > + int e; > + > + memset(csd, 0, sizeof(*csd)); > + csd->csd_structure =3D mmc_get_bits(raw_csd, 128, 126, 2); > + csd->spec_vers =3D mmc_get_bits(raw_csd, 128, 122, 4); > + m =3D mmc_get_bits(raw_csd, 128, 115, 4); > + e =3D mmc_get_bits(raw_csd, 128, 112, 3); > + csd->tacc =3D exp[e] * mant[m] + 9 / 10; > + csd->nsac =3D mmc_get_bits(raw_csd, 128, 104, 8) * 100; > + m =3D mmc_get_bits(raw_csd, 128, 99, 4); > + e =3D mmc_get_bits(raw_csd, 128, 96, 3); > + csd->tran_speed =3D exp[e] * 10000 * mant[m]; > + csd->ccc =3D mmc_get_bits(raw_csd, 128, 84, 12); > + csd->read_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 80, 4); > + csd->read_bl_partial =3D mmc_get_bits(raw_csd, 128, 79, 1); > + csd->write_blk_misalign =3D mmc_get_bits(raw_csd, 128, 78, 1); > + csd->read_blk_misalign =3D mmc_get_bits(raw_csd, 128, 77, 1); > + csd->dsr_imp =3D mmc_get_bits(raw_csd, 128, 76, 1); > + csd->vdd_r_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128, 59, 3)]; > + csd->vdd_r_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128, 56, 3)]; > + csd->vdd_w_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128, 53, 3)]; > + csd->vdd_w_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128, 50, 3)]; > + m =3D mmc_get_bits(raw_csd, 128, 62, 12); > + e =3D mmc_get_bits(raw_csd, 128, 47, 3); > + csd->capacity =3D ((1 + m) << (e + 2)) * csd->read_bl_len; > + csd->erase_blk_en =3D 0; > + csd->erase_sector =3D (mmc_get_bits(raw_csd, 128, 42, 5) + 1) * > + (mmc_get_bits(raw_csd, 128, 37, 5) + 1); > + csd->wp_grp_size =3D mmc_get_bits(raw_csd, 128, 32, 5); > + csd->wp_grp_enable =3D mmc_get_bits(raw_csd, 128, 31, 1); > + csd->r2w_factor =3D 1 << mmc_get_bits(raw_csd, 128, 26, 3); > + csd->write_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 22, 4); > + csd->write_bl_partial =3D mmc_get_bits(raw_csd, 128, 21, 1); > +} > + > +static void > +mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid) > +{ > + int i; > + > + /* There's no version info, so we take it on faith */ > + memset(cid, 0, sizeof(*cid)); >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" r320847 doesn't boot. It cycles all over a kernel panic (looks like a trap1= 2), reboots. Then, sometimes if the boot process can proceed after an erratic number of = attempts, it gets stuck in the loader's mountroot, bad device 16 error. I can not say whether this is due to this commit (On the crashing box, I ha= ve no debugging enabled an I'm back with r320829 which seems to work). --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_/bOUleh6WuhKllk7dnQOTs3R Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWWJuKwAKCRDS528fyFhY lN0DAf9dahMH57ag3QhQBI3DcqkwRwxqRVqwj+V2XX/fwqZMN22CJEfvJEwpqEGe lcTgPUbHp5nn+hA1N23LPKkjnEiRAfsGtFOFTwRuXcwvfFrgHG2SVV+bYgMuV5w+ eFTXeXzNC3fCiLVpdkib/pjcC8Ho58EIoLrkm90mvtHxTGUM9tHU =9zM0 -----END PGP SIGNATURE----- --Sig_/bOUleh6WuhKllk7dnQOTs3R-- From owner-svn-src-head@freebsd.org Sun Jul 9 17:56:40 2017 Return-Path: Delivered-To: svn-src-head@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 50C1DD91B76; Sun, 9 Jul 2017 17:56:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1FB5167080; Sun, 9 Jul 2017 17:56:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69Hud83021336; Sun, 9 Jul 2017 17:56:39 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69HudGL021335; Sun, 9 Jul 2017 17:56:39 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201707091756.v69HudGL021335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 9 Jul 2017 17:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320848 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 320848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 17:56:40 -0000 Author: kp Date: Sun Jul 9 17:56:39 2017 New Revision: 320848 URL: https://svnweb.freebsd.org/changeset/base/320848 Log: pf: Fix vnet purging pf_purge_thread() breaks up the work of iterating all states (in pf_purge_expired_states()) and tracks progress in the idx variable. If multiple vnets exist this results in pf_purge_thread() only calling pf_purge_expired_states() for part of the states (the first part of the first vnet, second part of the second vnet and so on). Combined with the mark-and-sweep approach to cleaning up old rules (in V_pf_unlinked_rules) that resulted in pf freeing rules that were still referenced by states. This in turn caused panics when pf_state_expires() encounters that state and attempts to access the rule. We need to track the progress per vnet, not globally, so idx is moved into a per-vnet V_pf_purge_idx. PR: 219251 Sponsored by: Hackathon Essen 2017 Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Sun Jul 9 17:05:48 2017 (r320847) +++ head/sys/netpfil/pf/pf.c Sun Jul 9 17:56:39 2017 (r320848) @@ -132,6 +132,9 @@ VNET_DEFINE(int, pf_tcp_iss_off); VNET_DECLARE(int, pf_vnet_active); #define V_pf_vnet_active VNET(pf_vnet_active) +static VNET_DEFINE(uint32_t, pf_purge_idx); +#define V_pf_purge_idx VNET(pf_purge_idx) + /* * Queue for pf_intr() sends. */ @@ -1427,7 +1430,6 @@ void pf_purge_thread(void *unused __unused) { VNET_ITERATOR_DECL(vnet_iter); - u_int idx = 0; sx_xlock(&pf_end_lock); while (pf_end_threads == 0) { @@ -1448,14 +1450,15 @@ pf_purge_thread(void *unused __unused) * Process 1/interval fraction of the state * table every run. */ - idx = pf_purge_expired_states(idx, pf_hashmask / + V_pf_purge_idx = + pf_purge_expired_states(V_pf_purge_idx, pf_hashmask / (V_pf_default_rule.timeout[PFTM_INTERVAL] * 10)); /* * Purge other expired types every * PFTM_INTERVAL seconds. */ - if (idx == 0) { + if (V_pf_purge_idx == 0) { /* * Order is important: * - states and src nodes reference rules From owner-svn-src-head@freebsd.org Sun Jul 9 18:26:04 2017 Return-Path: Delivered-To: svn-src-head@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 B89F2D926B4 for ; Sun, 9 Jul 2017 18:26:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7441A67DF8 for ; Sun, 9 Jul 2017 18:26:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22b.google.com with SMTP id m68so16312967ith.1 for ; Sun, 09 Jul 2017 11:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=HZ3+GMc/kt3rW6mKvnIMt4+c0XXFw9Az+hTbBe8Tm8c=; b=PoD/dMKQ7TRbIxgx9xWJyVvGYyE7BgZ+UwtaM8bu/Cp5XuM9ZwA90q9IYcmT2nRpCo jkzme9NKlQvsGPt2OT5CSN2vqhkIK1kuH4fHmjI+GclBVKNmuUc1PqZm0BljxOuxS3mW 23Ie5Nu0KSCMCdzipzXWzJ7qezadmukMlEcrWBXN15HDCATjT0P54WLNKA1bWcIXAfFc 7e4jBL9vRcGeO3b7f7E2r+6bL7K4TIcAt5TUB8Uc8sueVr3/0BZ9c8KNz7uCp6W/6NR6 QAocOv6BPDwNT3/y3+B+Qch9GmhM05PeTT8QaIHBBKyeOp6OOy53SbmAT+i2LGWO9TjE I36A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=HZ3+GMc/kt3rW6mKvnIMt4+c0XXFw9Az+hTbBe8Tm8c=; b=OpBzPUCOmHqZ4tkhtNmtHnAx9imWyx88dvuQ694nNVvugaHQgvPHeFZ9ODLHaUQ3YH XhPlZiV4Ks1HY/7YQT2xEnLTo1go+HAjtUUQvq7DKWYxdDoBFY9+8Vmh54C9+IrfUmGp /TmE3g6Vi6ElCuk2w42pqcqD4KJ/c8Z/nSlUFmPz6F47BeZIVp7Y1yy7l+/1CnfHglnL 47TQRnppd3mDbVXAUllfe8RKMowxYKlV4Oyw0vLrF1OvjkcA3NzHveFAJngVw+/UDwRT kUsOiXolixSd4MtTwVmafdjVFW2Hkt7kF6h/K1kr/9Nx/eq7m1mz8Q/TMwUOq1ZtsGUH 6fVA== X-Gm-Message-State: AIVw110cNYEWE4QyW4EMuhU4OJIpKcbegWla3xhOV00hh9Cgz5FHGeyn lsap4DRmctzBYsd1ivl4YqGeNOMKliSd X-Received: by 10.36.139.1 with SMTP id g1mr8542713ite.18.1499624763290; Sun, 09 Jul 2017 11:26:03 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.212.167 with HTTP; Sun, 9 Jul 2017 11:26:02 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:5d99:2cb7:7594:1100] In-Reply-To: <20170709195525.188d6fa8@thor.intern.walstatt.dynvpn.de> References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709195525.188d6fa8@thor.intern.walstatt.dynvpn.de> From: Warner Losh Date: Sun, 9 Jul 2017 12:26:02 -0600 X-Google-Sender-Auth: tt9EAh7pJST275HXHNeTCftP0fM Message-ID: Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... To: "O. Hartmann" Cc: "svn-src-head@freebsd.org" , Warner Losh , src-committers , "svn-src-all@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 18:26:04 -0000 Unless you are booting a MMCCAM kernel, this should be a no-op. I'll rebuild in a clean tree to make sure something weird didn't happen during the final integration... Warner On Sun, Jul 9, 2017 at 11:55 AM, O. Hartmann wrote= : > Am Sun, 9 Jul 2017 16:57:24 +0000 (UTC) > Warner Losh schrieb: > > > Author: imp > > Date: Sun Jul 9 16:57:24 2017 > > New Revision: 320844 > > URL: https://svnweb.freebsd.org/changeset/base/320844 > > > > Log: > > An MMC/SD/SDIO stack using CAM > > > > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > > flexible queueing will make it easier to write non-storage drivers > > than the legacy stack. SDIO drivers from both the kernel and as > > userland daemons are possible, though much of that functionality will > > come later. > > > > Some of the CAM integration isn't complete (there are sleeps in the > > device probe state machine, for example), but those minor issues can > > be improved in-tree more easily than out of tree and shouldn't gate > > progress on other fronts. Appologies to reviews if specific items > > have been overlooked. > > > > Submitted by: Ilya Bakulin > > Reviewed by: emaste, imp, mav, adrian, ian > > Differential Review: https://reviews.freebsd.org/D4761 > > > > merge with first commit, various compile hacks. > > > > Added: > > head/sys/amd64/conf/MMCCAM (contents, props changed) > > head/sys/arm/conf/BEAGLEBONE-MMCCAM (contents, props changed) > > head/sys/cam/mmc/ > > head/sys/cam/mmc/mmc.h > > - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h > > head/sys/cam/mmc/mmc_all.h > > - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h > > head/sys/cam/mmc/mmc_bus.h (contents, props changed) > > head/sys/cam/mmc/mmc_da.c (contents, props changed) > > head/sys/cam/mmc/mmc_sdio.c (contents, props changed) > > head/sys/cam/mmc/mmc_sdio.h > > - copied, changed from r320843, head/sys/dev/mmc/mmcbrvar.h > > head/sys/cam/mmc/mmc_xpt.c (contents, props changed) > > Modified: > > head/etc/mtree/BSD.include.dist > > head/include/Makefile > > head/lib/libcam/Makefile > > head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > > head/sys/arm/ti/ti_sdhci.c > > head/sys/cam/cam_ccb.h > > head/sys/cam/cam_periph.c > > head/sys/cam/cam_xpt.c > > head/sys/cam/cam_xpt.h > > head/sys/cam/cam_xpt_internal.h > > head/sys/cam/scsi/scsi_pass.c > > head/sys/conf/files > > head/sys/conf/options > > head/sys/dev/mmc/bridge.h > > head/sys/dev/mmc/mmcbrvar.h > > head/sys/dev/mmc/mmcreg.h > > head/sys/dev/sdhci/fsl_sdhci.c > > head/sys/dev/sdhci/sdhci.c > > head/sys/dev/sdhci/sdhci.h > > head/sys/dev/sdhci/sdhci_acpi.c > > head/sys/dev/sdhci/sdhci_pci.c > > head/sys/modules/Makefile > > > > Modified: head/etc/mtree/BSD.include.dist > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/etc/mtree/BSD.include.dist Sun Jul 9 15:41:49 2017 > (r320843) > > +++ head/etc/mtree/BSD.include.dist Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -90,6 +90,8 @@ > > cam > > ata > > .. > > + mmc > > + .. > > nvme > > .. > > scsi > > > > Modified: head/include/Makefile > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/include/Makefile Sun Jul 9 15:41:49 2017 (r320843) > > +++ head/include/Makefile Sun Jul 9 16:57:24 2017 (r320844) > > @@ -42,7 +42,7 @@ LHDRS=3D aio.h errno.h fcntl.h linker_set.h poll= .h > stdat > > LDIRS=3D bsm cam geom net net80211 netgraph netinet netinet6 \ > > netipsec netsmb nfs nfsclient nfsserver sys vm > > > > -LSUBDIRS=3D cam/ata cam/nvme cam/scsi \ > > +LSUBDIRS=3D cam/ata cam/mmc cam/nvme cam/scsi \ > > dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon > dev/firewire \ > > dev/hwpmc dev/hyperv \ > > dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ > > > > Modified: head/lib/libcam/Makefile > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/lib/libcam/Makefile Sun Jul 9 15:41:49 2017 (r320843) > > +++ head/lib/libcam/Makefile Sun Jul 9 16:57:24 2017 (r320844) > > @@ -38,6 +38,7 @@ MLINKS+=3D cam.3 cam_open_device.3 \ > > > > .PATH: ${SRCTOP}/sys/cam \ > > ${SRCTOP}/sys/cam/ata \ > > + ${SRCTOP}/sys/cam/mmc \ > > ${SRCTOP}/sys/cam/scsi > > > > CFLAGS+=3D -I${.CURDIR} -I${SRCTOP}/sys > > > > Added: head/sys/amd64/conf/MMCCAM > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/amd64/conf/MMCCAM Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -0,0 +1,36 @@ > > +# MMCCAM is the kernel config for doing MMC on CAM development > > +# and testing on bhyve > > +# $FreeBSD$ > > + > > +include MINIMAL > > + > > +ident MMCCAM > > + > > +# Access GPT-formatted and labeled root volume > > +options GEOM_PART_GPT > > +options GEOM_LABEL > > + > > +# UART -- for bhyve console > > +device uart > > + > > +# kgdb stub > > +device bvmdebug > > + > > +# VirtIO support, needed for bhyve > > +device virtio # Generic VirtIO bus > (required) > > +device virtio_pci # VirtIO PCI device > > +device vtnet # VirtIO Ethernet device > > +device virtio_blk # VirtIO Block device > > +device virtio_scsi # VirtIO SCSI device > > +device virtio_balloon # VirtIO Memory Balloon > device > > + > > +# CAM-specific stuff > > +device pass > > +device scbus > > +device da > > +device mmccam > > + > > +options MMCCAM > > +# Add CAMDEBUG stuff > > +options CAMDEBUG > > +options > > CAM_DEBUG_FLAGS=3D(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_ > DEBUG_PERIPH|CAM_DEBUG_TRACE) > > > > Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Jul 9 > 15:41:49 > > 2017 (r320843) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c > Sun Jul > > 9 16:57:24 2017 (r320844) @@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$")= ; > > #include "mmcbr_if.h" > > #include "sdhci_if.h" > > > > +#include "opt_mmccam.h" > > + > > #include "bcm2835_dma.h" > > #include > > #include "bcm2835_vcbus.h" > > @@ -253,7 +255,11 @@ bcm_sdhci_attach(device_t dev) > > bus_generic_probe(dev); > > bus_generic_attach(dev); > > > > +#ifdef MMCCAM > > + sdhci_cam_start_slot(&sc->sc_slot); > > +#else > > sdhci_start_slot(&sc->sc_slot); > > +#endif > > > > return (0); > > > > > > Added: head/sys/arm/conf/BEAGLEBONE-MMCCAM > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/arm/conf/BEAGLEBONE-MMCCAM Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -0,0 +1,21 @@ > > +# > > +# BEAGLEBONE-MMCCAM > > +# > > +# Custom kernel for Beaglebone plus MMCCAM as opposed to the prior MMC > stack. It is > > +# present to keep it building in tree since it wouldn't work in LINT. > > +# > > +# $FreeBSD$ > > + > > +include BEAGLEBONE > > + > > +# Add CAMDEBUG stuff > > +options CAMDEBUG > > +options > > CAM_DEBUG_FLAGS=3D(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH|CAM_= DEBUG_TRACE) > + > > +# pass(4) device > > +device pass > > +device mmccam > > +options MMCCAM > > + > > +nodevice mmc > > +nodevice mmcsd > > > > Modified: head/sys/arm/ti/ti_sdhci.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/arm/ti/ti_sdhci.c Sun Jul 9 15:41:49 2017 > (r320843) > > +++ head/sys/arm/ti/ti_sdhci.c Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > +#include > > > > #include > > #include > > @@ -60,6 +62,8 @@ __FBSDID("$FreeBSD$"); > > #include > > #include "gpio_if.h" > > > > +#include "opt_mmccam.h" > > + > > struct ti_sdhci_softc { > > device_t dev; > > struct sdhci_fdt_gpio * gpio; > > @@ -122,6 +126,11 @@ static struct ofw_compat_data compat_data[] =3D { > > #define MMCHS_SD_CAPA_VS30 (1 << 25) > > #define MMCHS_SD_CAPA_VS33 (1 << 24) > > > > +/* Forward declarations, CAM-relataed */ > > +// static void ti_sdhci_cam_poll(struct cam_sim *); > > +// static void ti_sdhci_cam_action(struct cam_sim *, union ccb *); > > +// static int ti_sdhci_cam_settran_settings(struct ti_sdhci_softc *sc, > union ccb *); > > + > > static inline uint32_t > > ti_mmchs_read_4(struct ti_sdhci_softc *sc, bus_size_t off) > > { > > @@ -241,6 +250,22 @@ ti_sdhci_write_1(device_t dev, struct sdhci_slot > *slot > > struct ti_sdhci_softc *sc =3D device_get_softc(dev); > > uint32_t val32; > > > > +#ifdef MMCCAM > > + uint32_t newval32; > > + if (off =3D=3D SDHCI_HOST_CONTROL) { > > + val32 =3D ti_mmchs_read_4(sc, MMCHS_CON); > > + newval32 =3D val32; > > + if (val & SDHCI_CTRL_8BITBUS) { > > + device_printf(dev, "Custom-enabling 8-bit bus\n")= ; > > + newval32 |=3D MMCHS_CON_DW8; > > + } else { > > + device_printf(dev, "Custom-disabling 8-bit bus\n"= ); > > + newval32 &=3D ~MMCHS_CON_DW8; > > + } > > + if (newval32 !=3D val32) > > + ti_mmchs_write_4(sc, MMCHS_CON, newval32); > > + } > > +#endif > > val32 =3D RD4(sc, off & ~3); > > val32 &=3D ~(0xff << (off & 3) * 8); > > val32 |=3D (val << (off & 3) * 8); > > @@ -658,8 +683,11 @@ ti_sdhci_attach(device_t dev) > > bus_generic_probe(dev); > > bus_generic_attach(dev); > > > > +#ifdef MMCCAM > > + sdhci_cam_start_slot(&sc->slot); > > +#else > > sdhci_start_slot(&sc->slot); > > - > > +#endif > > return (0); > > > > fail: > > @@ -730,4 +758,7 @@ static driver_t ti_sdhci_driver =3D { > > DRIVER_MODULE(sdhci_ti, simplebus, ti_sdhci_driver, ti_sdhci_devclass, > NULL, > > NULL); > > MODULE_DEPEND(sdhci_ti, sdhci, 1, 1, 1); > > + > > +#ifndef MMCCAM > > MMC_DECLARE_BRIDGE(sdhci_ti); > > +#endif > > > > Modified: head/sys/cam/cam_ccb.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/cam/cam_ccb.h Sun Jul 9 15:41:49 2017 (r320843) > > +++ head/sys/cam/cam_ccb.h Sun Jul 9 16:57:24 2017 (r320844) > > @@ -42,6 +42,7 @@ > > #include > > #include > > #include > > +#include > > > > /* General allocation length definitions for CCB structures */ > > #define IOCDBLEN CAM_MAX_CDBLEN /* Space for CDB > bytes/pointer */ > > @@ -208,10 +209,10 @@ typedef enum { > > XPT_NVME_IO =3D 0x1c | XPT_FC_DEV_QUEUED, > > /* Execiute the requestred NVMe I/O > operation */ > > > > - XPT_MMCSD_IO =3D 0x1d | XPT_FC_DEV_QUEUED, > > + XPT_MMC_IO =3D 0x1d | XPT_FC_DEV_QUEUED, > > /* Placeholder for MMC / SD / SDIO I/O > stuff */ > > > > - XPT_SCAN_TGT =3D 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CC= B > > + XPT_SCAN_TGT =3D 0x1e | XPT_FC_QUEUED | XPT_FC_USER_CC= B > > | XPT_FC_XPT_ONLY, > > /* Scan Target */ > > > > @@ -267,6 +268,7 @@ typedef enum { > > PROTO_SATAPM, /* SATA Port Multiplier */ > > PROTO_SEMB, /* SATA Enclosure Management Bridge */ > > PROTO_NVME, /* NVME */ > > + PROTO_MMCSD, /* MMC, SD, SDIO */ > > } cam_proto; > > > > typedef enum { > > @@ -283,6 +285,7 @@ typedef enum { > > XPORT_ISCSI, /* iSCSI */ > > XPORT_SRP, /* SCSI RDMA Protocol */ > > XPORT_NVME, /* NVMe over PCIe */ > > + XPORT_MMCSD, /* MMC, SD, SDIO card */ > > } cam_xport; > > > > #define XPORT_IS_NVME(t) ((t) =3D=3D XPORT_NVME) > > @@ -498,6 +501,7 @@ struct device_match_result { > > cam_proto protocol; > > struct scsi_inquiry_data inq_data; > > struct ata_params ident_data; > > + struct mmc_params mmc_ident_data; > > dev_result_flags flags; > > }; > > > > @@ -773,6 +777,16 @@ struct ccb_ataio { > > uint32_t unused; > > }; > > > > +/* > > + * MMC I/O Request CCB used for the XPT_MMC_IO function code. > > + */ > > +struct ccb_mmcio { > > + struct ccb_hdr ccb_h; > > + union ccb *next_ccb; /* Ptr for next CCB for action */ > > + struct mmc_command cmd; > > + struct mmc_command stop; > > +}; > > + > > struct ccb_accept_tio { > > struct ccb_hdr ccb_h; > > cdb_t cdb_io; /* Union for CDB bytes/pointer */ > > @@ -1005,7 +1019,28 @@ struct ccb_trans_settings_nvme > > u_int max_xfer; /* Max transfer size (0 -> > unlimited */ > > u_int caps; > > }; > > - > > + > > +#include > > +struct ccb_trans_settings_mmc { > > + struct mmc_ios ios; > > +#define MMC_CLK (1 << 1) > > +#define MMC_VDD (1 << 2) > > +#define MMC_CS (1 << 3) > > +#define MMC_BW (1 << 4) > > +#define MMC_PM (1 << 5) > > +#define MMC_BT (1 << 6) > > +#define MMC_BM (1 << 7) > > + uint32_t ios_valid; > > +/* The folowing is used only for GET_TRAN_SETTINGS */ > > + uint32_t host_ocr; > > + int host_f_min; > > + int host_f_max; > > +#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers *= / > > +#define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers *= / > > +#define MMC_CAP_HSPEED (1 << 2) /* Can do High Speed > transfers */ > > + uint32_t host_caps; > > +}; > > + > > /* Get/Set transfer rate/width/disconnection/tag queueing settings */ > > struct ccb_trans_settings { > > struct ccb_hdr ccb_h; > > @@ -1019,6 +1054,7 @@ struct ccb_trans_settings { > > struct ccb_trans_settings_ata ata; > > struct ccb_trans_settings_scsi scsi; > > struct ccb_trans_settings_nvme nvme; > > + struct ccb_trans_settings_mmc mmc; > > } proto_specific; > > union { > > u_int valid; /* Which fields to honor */ > > @@ -1284,6 +1320,7 @@ union ccb { > > struct ccb_dev_advinfo cdai; > > struct ccb_async casync; > > struct ccb_nvmeio nvmeio; > > + struct ccb_mmcio mmcio; > > }; > > > > #define CCB_CLEAR_ALL_EXCEPT_HDR(ccbp) \ > > @@ -1327,6 +1364,13 @@ cam_fill_smpio(struct ccb_smpio *smpio, uint32_t > retri > > uint32_t timeout); > > > > static __inline void > > +cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, > > + void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t > flags, > > + uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t > mmc_flags, > > + struct mmc_data *mmc_d, > > + uint32_t timeout); > > + > > +static __inline void > > cam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries, > > void (*cbfcnp)(struct cam_periph *, union ccb *), > > u_int32_t flags, u_int8_t tag_action, > > @@ -1412,6 +1456,34 @@ cam_fill_smpio(struct ccb_smpio *smpio, uint32_t > retri > > smpio->smp_request_len =3D smp_request_len; > > smpio->smp_response =3D smp_response; > > smpio->smp_response_len =3D smp_response_len; > > +} > > + > > +static __inline void > > +cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, > > + void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t > flags, > > + uint32_t mmc_opcode, uint32_t mmc_arg, uint32_t mmc_flags, > > + struct mmc_data *mmc_d, > > + uint32_t timeout) > > +{ > > + mmcio->ccb_h.func_code =3D XPT_MMC_IO; > > + mmcio->ccb_h.flags =3D flags; > > + mmcio->ccb_h.retry_count =3D retries; > > + mmcio->ccb_h.cbfcnp =3D cbfcnp; > > + mmcio->ccb_h.timeout =3D timeout; > > + mmcio->cmd.opcode =3D mmc_opcode; > > + mmcio->cmd.arg =3D mmc_arg; > > + mmcio->cmd.flags =3D mmc_flags; > > + mmcio->stop.opcode =3D 0; > > + mmcio->stop.arg =3D 0; > > + mmcio->stop.flags =3D 0; > > + if (mmc_d !=3D NULL) { > > + mmcio->cmd.data =3D mmc_d; > > + } else > > + mmcio->cmd.data =3D NULL; > > + mmcio->cmd.resp[0] =3D 0; > > + mmcio->cmd.resp[1] =3D 0; > > + mmcio->cmd.resp[2] =3D 0; > > + mmcio->cmd.resp[3] =3D 0; > > } > > > > static __inline void > > > > Modified: head/sys/cam/cam_periph.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/cam/cam_periph.c Sun Jul 9 15:41:49 2017 (r320843) > > +++ head/sys/cam/cam_periph.c Sun Jul 9 16:57:24 2017 (r320844) > > @@ -827,6 +827,18 @@ cam_periph_mapmem(union ccb *ccb, struct > cam_periph_ma > > dirs[0] =3D ccb->ccb_h.flags & CAM_DIR_MASK; > > numbufs =3D 1; > > break; > > + case XPT_MMC_IO: > > + if ((ccb->ccb_h.flags & CAM_DIR_MASK) =3D=3D CAM_DIR_NONE= ) > > + return(0); > > + /* Two mappings: one for cmd->data and one for > cmd->data->data */ > > + data_ptrs[0] =3D (unsigned char **)&ccb->mmcio.cmd.data; > > + lengths[0] =3D sizeof(struct mmc_data *); > > + dirs[0] =3D ccb->ccb_h.flags & CAM_DIR_MASK; > > + data_ptrs[1] =3D (unsigned char > **)&ccb->mmcio.cmd.data->data; > > + lengths[1] =3D ccb->mmcio.cmd.data->len; > > + dirs[1] =3D ccb->ccb_h.flags & CAM_DIR_MASK; > > + numbufs =3D 2; > > + break; > > case XPT_SMP_IO: > > data_ptrs[0] =3D &ccb->smpio.smp_request; > > lengths[0] =3D ccb->smpio.smp_request_len; > > > > Modified: head/sys/cam/cam_xpt.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/cam/cam_xpt.c Sun Jul 9 15:41:49 2017 (r320843) > > +++ head/sys/cam/cam_xpt.c Sun Jul 9 16:57:24 2017 (r320844) > > @@ -329,7 +329,6 @@ static xpt_devicefunc_t xptsetasyncfunc; > > static xpt_busfunc_t xptsetasyncbusfunc; > > static cam_status xptregister(struct cam_periph *periph, > > void *arg); > > -static const char * xpt_action_name(uint32_t action); > > static __inline int device_is_queued(struct cam_ed *device); > > > > static __inline int > > @@ -412,7 +411,7 @@ xptioctl(struct cdev *dev, u_long cmd, caddr_t addr= , > i > > } > > return (error); > > } > > - > > + > > static int > > xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struc= t > thread *td) > > { > > @@ -820,6 +819,8 @@ xpt_scanner_thread(void *dummy) > > TAILQ_REMOVE(&xsoftc.ccb_scanq, &ccb->ccb_h, > sim_links.tqe); > > xpt_unlock_buses(); > > > > + printf("xpt_scanner_thread is firing on path "= ); > > + xpt_print_path(ccb->ccb_h.path);printf("\n"); > > /* > > * Since lock can be dropped inside and path free= d > > * by completion callback even before return here= , > > @@ -1503,7 +1504,7 @@ xptdevicematch(struct dev_match_pattern *patterns= , > u_i > > > > cur_pattern =3D &patterns[i].pattern.device_pattern; > > > > - /* Error out if mutually exclusive options are specified. > */ > > + /* Error out if mutually exclusive options are specified. > */ > > if ((cur_pattern->flags & (DEV_MATCH_INQUIRY|DEV_MATCH_ > DEVID)) > > =3D=3D (DEV_MATCH_INQUIRY|DEV_MATCH_DEVID)) > > return(DM_RET_ERROR); > > @@ -1905,6 +1906,9 @@ xptedtdevicefunc(struct cam_ed *device, void *arg= ) > > bcopy(&device->ident_data, > > &cdm->matches[j].result.device_result.ident_data, > > sizeof(struct ata_params)); > > + bcopy(&device->mmc_ident_data, > > + &cdm->matches[j].result. > device_result.mmc_ident_data, > > + sizeof(struct mmc_params)); > > > > /* Let the user know whether this device is unconfigured = */ > > if (device->flags & CAM_DEV_UNCONFIGURED) > > @@ -2690,6 +2694,8 @@ xpt_action_default(union ccb *start_ccb) > > if (start_ccb->ccb_h.func_code =3D=3D XPT_NVME_IO) > > start_ccb->nvmeio.resid =3D 0; > > /* FALLTHROUGH */ > > + case XPT_MMC_IO: > > + /* XXX just like nmve_io? */ > > case XPT_RESET_DEV: > > case XPT_ENG_EXEC: > > case XPT_SMP_IO: > > @@ -2801,11 +2807,12 @@ call_sim: > > mtx_lock(mtx); > > else > > mtx =3D NULL; > > + > > CAM_DEBUG(path, CAM_DEBUG_TRACE, > > - ("sim->sim_action: func=3D%#x\n", > start_ccb->ccb_h.func_code)); > > + ("Calling sim->sim_action(): func=3D%#x\n", > > start_ccb->ccb_h.func_code)); (*(sim->sim_action))(sim, start_ccb); > > CAM_DEBUG(path, CAM_DEBUG_TRACE, > > - ("sim->sim_action: status=3D%#x\n", > start_ccb->ccb_h.status)); > > + ("sim->sim_action returned: status=3D%#x\n", > > start_ccb->ccb_h.status)); if (mtx) > > mtx_unlock(mtx); > > break; > > @@ -5540,7 +5547,7 @@ static struct kv map[] =3D { > > { XPT_GET_SIM_KNOB, "XPT_GET_SIM_KNOB" }, > > { XPT_SET_SIM_KNOB, "XPT_SET_SIM_KNOB" }, > > { XPT_NVME_IO, "XPT_NVME_IO" }, > > - { XPT_MMCSD_IO, "XPT_MMCSD_IO" }, > > + { XPT_MMC_IO, "XPT_MMC_IO" }, > > { XPT_SMP_IO, "XPT_SMP_IO" }, > > { XPT_SCAN_TGT, "XPT_SCAN_TGT" }, > > { XPT_ENG_INQ, "XPT_ENG_INQ" }, > > @@ -5556,7 +5563,7 @@ static struct kv map[] =3D { > > { 0, 0 } > > }; > > > > -static const char * > > +const char * > > xpt_action_name(uint32_t action) > > { > > static char buffer[32]; /* Only for unknown messages -- racy */ > > > > Modified: head/sys/cam/cam_xpt.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/cam/cam_xpt.h Sun Jul 9 15:41:49 2017 (r320843) > > +++ head/sys/cam/cam_xpt.h Sun Jul 9 16:57:24 2017 (r320844) > > @@ -141,6 +141,8 @@ void xpt_copy_path(struct > cam_path *new_path, > > > > void xpt_release_path(struct cam_path *path); > > > > +const char * xpt_action_name(uint32_t action); > > + > > #endif /* _KERNEL */ > > > > #endif /* _CAM_CAM_XPT_H */ > > > > Modified: head/sys/cam/cam_xpt_internal.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/cam/cam_xpt_internal.h Sun Jul 9 15:41:49 2017 > (r320843) > > +++ head/sys/cam/cam_xpt_internal.h Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -125,6 +125,7 @@ struct cam_ed { > > uint32_t rcap_len; > > uint8_t *rcap_buf; > > struct ata_params ident_data; > > + struct mmc_params mmc_ident_data; > > u_int8_t inq_flags; /* > > * Current settings for inquiry > flags. > > * This allows us to override > settings > > > > Copied and modified: head/sys/cam/mmc/mmc.h (from r320843, > head/sys/dev/mmc/mmcbrvar.h) > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- head/sys/dev/mmc/mmcbrvar.h Sun Jul 9 15:41:49 2017 > (r320843, copy > > source) +++ head/sys/cam/mmc/mmc.h Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -1,6 +1,5 @@ > > /*- > > - * Copyright (c) 2006 Bernd Walter. All rights reserved. > > - * Copyright (c) 2006 M. Warner Losh. All rights reserved. > > + * Copyright (c) 2014-2016 Ilya Bakulin. All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > * modification, are permitted provided that the following conditions > > @@ -49,77 +48,47 @@ > > * or the SD Card Association to disclose or distribute any technical > > * information, know-how or other confidential information to any thir= d > party. > > * > > + * Inspired coded in sys/dev/mmc. Thanks to Warner Losh >, > > + * Bernd Walter , and other authors. > > + * > > * $FreeBSD$ > > */ > > > > -#ifndef DEV_MMC_MMCBRVAR_H > > -#define DEV_MMC_MMCBRVAR_H > > +#ifndef CAM_MMC_H > > +#define CAM_MMC_H > > > > #include > > - > > -#include "mmcbr_if.h" > > - > > -enum mmcbr_device_ivars { > > - MMCBR_IVAR_BUS_MODE, > > - MMCBR_IVAR_BUS_WIDTH, > > - MMCBR_IVAR_CHIP_SELECT, > > - MMCBR_IVAR_CLOCK, > > - MMCBR_IVAR_F_MIN, > > - MMCBR_IVAR_F_MAX, > > - MMCBR_IVAR_HOST_OCR, > > - MMCBR_IVAR_MODE, > > - MMCBR_IVAR_OCR, > > - MMCBR_IVAR_POWER_MODE, > > - MMCBR_IVAR_VDD, > > - MMCBR_IVAR_VCCQ, > > - MMCBR_IVAR_CAPS, > > - MMCBR_IVAR_TIMING, > > - MMCBR_IVAR_MAX_DATA, > > - MMCBR_IVAR_MAX_BUSY_TIMEOUT > > -}; > > - > > /* > > - * Simplified accessors for bridge devices > > + * This structure describes an MMC/SD card > > */ > > -#define MMCBR_ACCESSOR(var, ivar, type) > \ > > - __BUS_ACCESSOR(mmcbr, var, MMCBR, ivar, type) > > +struct mmc_params { > > + u_int8_t model[40]; /* Card model */ > > > > -MMCBR_ACCESSOR(bus_mode, BUS_MODE, int) > > -MMCBR_ACCESSOR(bus_width, BUS_WIDTH, int) > > -MMCBR_ACCESSOR(chip_select, CHIP_SELECT, int) > > -MMCBR_ACCESSOR(clock, CLOCK, int) > > -MMCBR_ACCESSOR(f_max, F_MAX, int) > > -MMCBR_ACCESSOR(f_min, F_MIN, int) > > -MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) > > -MMCBR_ACCESSOR(mode, MODE, int) > > -MMCBR_ACCESSOR(ocr, OCR, int) > > -MMCBR_ACCESSOR(power_mode, POWER_MODE, int) > > -MMCBR_ACCESSOR(vdd, VDD, int) > > -MMCBR_ACCESSOR(vccq, VCCQ, int) > > -MMCBR_ACCESSOR(caps, CAPS, int) > > -MMCBR_ACCESSOR(timing, TIMING, int) > > -MMCBR_ACCESSOR(max_data, MAX_DATA, int) > > -MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) > > + /* Card OCR */ > > + uint32_t card_ocr; > > > > -static int __inline > > -mmcbr_update_ios(device_t dev) > > -{ > > + /* OCR of the IO portion of the card */ > > + uint32_t io_ocr; > > > > - return (MMCBR_UPDATE_IOS(device_get_parent(dev), dev)); > > -} > > + /* Card CID -- raw and parsed */ > > + uint32_t card_cid[4]; > > + struct mmc_cid cid; > > > > -static int __inline > > -mmcbr_switch_vccq(device_t dev) > > -{ > > + /* Card CSD -- raw */ > > + uint32_t card_csd[4]; > > > > - return (MMCBR_SWITCH_VCCQ(device_get_parent(dev), dev)); > > -} > > + /* Card RCA */ > > + uint16_t card_rca; > > > > -static int __inline > > -mmcbr_get_ro(device_t dev) > > -{ > > + /* What kind of card is it */ > > + uint32_t card_features; > > +#define CARD_FEATURE_MEMORY 0x1 > > +#define CARD_FEATURE_SDHC 0x1 << 1 > > +#define CARD_FEATURE_SDIO 0x1 << 2 > > +#define CARD_FEATURE_SD20 0x1 << 3 > > +#define CARD_FEATURE_MMC 0x1 << 4 > > > > - return (MMCBR_GET_RO(device_get_parent(dev), dev)); > > -} > > + uint8_t sdio_func_count; > > +} __packed; > > > > -#endif /* DEV_MMC_MMCBRVAR_H */ > > +#endif > > > > Copied and modified: head/sys/cam/mmc/mmc_all.h (from r320843, > > head/sys/dev/mmc/mmcbrvar.h) > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > --- > > head/sys/dev/mmc/mmcbrvar.h Sun Jul 9 15:41:49 2017 (r320843, > copy > > source) +++ head/sys/cam/mmc/mmc_all.h Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -1,6 +1,5 @@ /*- > > - * Copyright (c) 2006 Bernd Walter. All rights reserved. > > - * Copyright (c) 2006 M. Warner Losh. All rights reserved. > > + * Copyright (c) 2014-2016 Ilya Bakulin. All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > * modification, are permitted provided that the following conditions > > @@ -52,74 +51,20 @@ > > * $FreeBSD$ > > */ > > > > -#ifndef DEV_MMC_MMCBRVAR_H > > -#define DEV_MMC_MMCBRVAR_H > > - > > -#include > > - > > -#include "mmcbr_if.h" > > - > > -enum mmcbr_device_ivars { > > - MMCBR_IVAR_BUS_MODE, > > - MMCBR_IVAR_BUS_WIDTH, > > - MMCBR_IVAR_CHIP_SELECT, > > - MMCBR_IVAR_CLOCK, > > - MMCBR_IVAR_F_MIN, > > - MMCBR_IVAR_F_MAX, > > - MMCBR_IVAR_HOST_OCR, > > - MMCBR_IVAR_MODE, > > - MMCBR_IVAR_OCR, > > - MMCBR_IVAR_POWER_MODE, > > - MMCBR_IVAR_VDD, > > - MMCBR_IVAR_VCCQ, > > - MMCBR_IVAR_CAPS, > > - MMCBR_IVAR_TIMING, > > - MMCBR_IVAR_MAX_DATA, > > - MMCBR_IVAR_MAX_BUSY_TIMEOUT > > -}; > > - > > /* > > - * Simplified accessors for bridge devices > > + * MMC function that should be visible to the CAM subsystem > > + * and are somehow useful should be declared here > > + * > > + * Like in other *_all.h, it's also a nice place to include > > + * some other transport-specific headers. > > */ > > -#define MMCBR_ACCESSOR(var, ivar, type) > \ > > - __BUS_ACCESSOR(mmcbr, var, MMCBR, ivar, type) > > > > -MMCBR_ACCESSOR(bus_mode, BUS_MODE, int) > > -MMCBR_ACCESSOR(bus_width, BUS_WIDTH, int) > > -MMCBR_ACCESSOR(chip_select, CHIP_SELECT, int) > > -MMCBR_ACCESSOR(clock, CLOCK, int) > > -MMCBR_ACCESSOR(f_max, F_MAX, int) > > -MMCBR_ACCESSOR(f_min, F_MIN, int) > > -MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) > > -MMCBR_ACCESSOR(mode, MODE, int) > > -MMCBR_ACCESSOR(ocr, OCR, int) > > -MMCBR_ACCESSOR(power_mode, POWER_MODE, int) > > -MMCBR_ACCESSOR(vdd, VDD, int) > > -MMCBR_ACCESSOR(vccq, VCCQ, int) > > -MMCBR_ACCESSOR(caps, CAPS, int) > > -MMCBR_ACCESSOR(timing, TIMING, int) > > -MMCBR_ACCESSOR(max_data, MAX_DATA, int) > > -MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) > > +#ifndef CAM_MMC_ALL_H > > +#define CAM_MMC_ALL_H > > > > -static int __inline > > -mmcbr_update_ios(device_t dev) > > -{ > > +#include > > +#include > > > > - return (MMCBR_UPDATE_IOS(device_get_parent(dev), dev)); > > -} > > +void mmc_print_ident(struct mmc_params *ident_data); > > > > -static int __inline > > -mmcbr_switch_vccq(device_t dev) > > -{ > > - > > - return (MMCBR_SWITCH_VCCQ(device_get_parent(dev), dev)); > > -} > > - > > -static int __inline > > -mmcbr_get_ro(device_t dev) > > -{ > > - > > - return (MMCBR_GET_RO(device_get_parent(dev), dev)); > > -} > > - > > -#endif /* DEV_MMC_MMCBRVAR_H */ > > +#endif > > > > Added: head/sys/cam/mmc/mmc_bus.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/cam/mmc/mmc_bus.h Sun Jul 9 16:57:24 2017 > (r320844) > > @@ -0,0 +1,5 @@ > > +/* > > + * This file is in the public domain. > > + * $FreeBSD$ > > + */ > > +#include > > > > Added: head/sys/cam/mmc/mmc_da.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/cam/mmc/mmc_da.c Sun Jul 9 16:57:24 2017 (r320844) > > @@ -0,0 +1,1432 @@ > > +/*- > > + * Copyright (c) 2006 Bernd Walter > > + * Copyright (c) 2006 M. Warner Losh > > + * Copyright (c) 2009 Alexander Motin > > + * Copyright (c) 2015-2017 Ilya Bakulin > > + * 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, > > + * without modification, immediately at the beginning of the file. > > + * 2. Redistributions in binary form must reproduce the above copyrigh= t > > + * 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 ``AS IS'' AND ANY EXPRESS O= R > > + * 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 O= F > USE, > > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON A= NY > > + * 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. > > + * > > + * Some code derived from the sys/dev/mmc and sys/cam/ata > > + * Thanks to Warner Losh , Alexander Motin > > > + * Bernd Walter , and other authors. > > + */ > > + > > +#include > > +__FBSDID("$FreeBSD$"); > > + > > +//#include "opt_sdda.h" > > + > > +#include > > + > > +#ifdef _KERNEL > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include /* for PRIu64 */ > > +#endif /* _KERNEL */ > > + > > +#ifndef _KERNEL > > +#include > > +#include > > +#endif /* _KERNEL */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > + > > +#include > > + > > +#include /* geometry translation */ > > + > > +#ifdef _KERNEL > > + > > +typedef enum { > > + SDDA_FLAG_OPEN =3D 0x0002, > > + SDDA_FLAG_DIRTY =3D 0x0004 > > +} sdda_flags; > > + > > +typedef enum { > > + SDDA_STATE_INIT, > > + SDDA_STATE_INVALID, > > + SDDA_STATE_NORMAL > > +} sdda_state; > > + > > +struct sdda_softc { > > + struct bio_queue_head bio_queue; > > + int outstanding_cmds; /* Number of active commands */ > > + int refcount; /* Active xpt_action() calls */ > > + sdda_state state; > > + sdda_flags flags; > > + struct mmc_data *mmcdata; > > +// sdda_quirks quirks; > > + struct task start_init_task; > > + struct disk *disk; > > + uint32_t raw_csd[4]; > > + uint8_t raw_ext_csd[512]; /* MMC only? */ > > + struct mmc_csd csd; > > + struct mmc_cid cid; > > + struct mmc_scr scr; > > + /* Calculated from CSD */ > > + uint64_t sector_count; > > + uint64_t mediasize; > > + > > + /* Calculated from CID */ > > + char card_id_string[64];/* Formatted CID info (serial, MFG, etc) = */ > > + char card_sn_string[16];/* Formatted serial # for disk->d_ident *= / > > + /* Determined from CSD + is highspeed card*/ > > + uint32_t card_f_max; > > +}; > > + > > +#define ccb_bp ppriv_ptr1 > > + > > +static disk_strategy_t sddastrategy; > > +static periph_init_t sddainit; > > +static void sddaasync(void *callback_arg, u_int32_t > code, > > + struct cam_path *path, void *arg); > > +static periph_ctor_t sddaregister; > > +static periph_dtor_t sddacleanup; > > +static periph_start_t sddastart; > > +static periph_oninv_t sddaoninvalidate; > > +static void sddadone(struct cam_periph *periph, > > + union ccb *done_ccb); > > +static int sddaerror(union ccb *ccb, u_int32_t cam_flags, > > + u_int32_t sense_flags); > > + > > +static uint16_t get_rca(struct cam_periph *periph); > > +static cam_status sdda_hook_into_geom(struct cam_periph *periph); > > +static void sdda_start_init(void *context, union ccb *start_ccb); > > +static void sdda_start_init_task(void *context, int pending); > > + > > +static struct periph_driver sddadriver =3D > > +{ > > + sddainit, "sdda", > > + TAILQ_HEAD_INITIALIZER(sddadriver.units), /* generation */ 0 > > +}; > > + > > +PERIPHDRIVER_DECLARE(sdda, sddadriver); > > + > > +static MALLOC_DEFINE(M_SDDA, "sd_da", "sd_da buffers"); > > + > > +static const int exp[8] =3D { > > + 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 > > +}; > > + > > +static const int mant[16] =3D { > > + 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 > > +}; > > + > > +static const int cur_min[8] =3D { > > + 500, 1000, 5000, 10000, 25000, 35000, 60000, 100000 > > +}; > > + > > +static const int cur_max[8] =3D { > > + 1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000 > > +}; > > + > > +static uint16_t > > +get_rca(struct cam_periph *periph) { > > + return periph->path->device->mmc_ident_data.card_rca; > > +} > > + > > +static uint32_t > > +mmc_get_bits(uint32_t *bits, int bit_len, int start, int size) > > +{ > > + const int i =3D (bit_len / 32) - (start / 32) - 1; > > + const int shift =3D start & 31; > > + uint32_t retval =3D bits[i] >> shift; > > + if (size + shift > 32) > > + retval |=3D bits[i - 1] << (32 - shift); > > + return (retval & ((1llu << size) - 1)); > > +} > > + > > + > > +static void > > +mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) > > +{ > > + int v; > > + int m; > > + int e; > > + > > + memset(csd, 0, sizeof(*csd)); > > + csd->csd_structure =3D v =3D mmc_get_bits(raw_csd, 128, 126, 2); > > + if (v =3D=3D 0) { > > + m =3D mmc_get_bits(raw_csd, 128, 115, 4); > > + e =3D mmc_get_bits(raw_csd, 128, 112, 3); > > + csd->tacc =3D (exp[e] * mant[m] + 9) / 10; > > + csd->nsac =3D mmc_get_bits(raw_csd, 128, 104, 8) * 100; > > + m =3D mmc_get_bits(raw_csd, 128, 99, 4); > > + e =3D mmc_get_bits(raw_csd, 128, 96, 3); > > + csd->tran_speed =3D exp[e] * 10000 * mant[m]; > > + csd->ccc =3D mmc_get_bits(raw_csd, 128, 84, 12); > > + csd->read_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 80, = 4); > > + csd->read_bl_partial =3D mmc_get_bits(raw_csd, 128, 79, 1= ); > > + csd->write_blk_misalign =3D mmc_get_bits(raw_csd, 128, 78= , > 1); > > + csd->read_blk_misalign =3D mmc_get_bits(raw_csd, 128, 77,= 1); > > + csd->dsr_imp =3D mmc_get_bits(raw_csd, 128, 76, 1); > > + csd->vdd_r_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128= , > 59, 3)]; > > + csd->vdd_r_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128= , > 56, 3)]; > > + csd->vdd_w_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128= , > 53, 3)]; > > + csd->vdd_w_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128= , > 50, 3)]; > > + m =3D mmc_get_bits(raw_csd, 128, 62, 12); > > + e =3D mmc_get_bits(raw_csd, 128, 47, 3); > > + csd->capacity =3D ((1 + m) << (e + 2)) * csd->read_bl_len= ; > > + csd->erase_blk_en =3D mmc_get_bits(raw_csd, 128, 46, 1); > > + csd->erase_sector =3D mmc_get_bits(raw_csd, 128, 39, 7) += 1; > > + csd->wp_grp_size =3D mmc_get_bits(raw_csd, 128, 32, 7); > > + csd->wp_grp_enable =3D mmc_get_bits(raw_csd, 128, 31, 1); > > + csd->r2w_factor =3D 1 << mmc_get_bits(raw_csd, 128, 26, 3= ); > > + csd->write_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 22,= 4); > > + csd->write_bl_partial =3D mmc_get_bits(raw_csd, 128, 21, = 1); > > + } else if (v =3D=3D 1) { > > + m =3D mmc_get_bits(raw_csd, 128, 115, 4); > > + e =3D mmc_get_bits(raw_csd, 128, 112, 3); > > + csd->tacc =3D (exp[e] * mant[m] + 9) / 10; > > + csd->nsac =3D mmc_get_bits(raw_csd, 128, 104, 8) * 100; > > + m =3D mmc_get_bits(raw_csd, 128, 99, 4); > > + e =3D mmc_get_bits(raw_csd, 128, 96, 3); > > + csd->tran_speed =3D exp[e] * 10000 * mant[m]; > > + csd->ccc =3D mmc_get_bits(raw_csd, 128, 84, 12); > > + csd->read_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 80, = 4); > > + csd->read_bl_partial =3D mmc_get_bits(raw_csd, 128, 79, 1= ); > > + csd->write_blk_misalign =3D mmc_get_bits(raw_csd, 128, 78= , > 1); > > + csd->read_blk_misalign =3D mmc_get_bits(raw_csd, 128, 77,= 1); > > + csd->dsr_imp =3D mmc_get_bits(raw_csd, 128, 76, 1); > > + csd->capacity =3D ((uint64_t)mmc_get_bits(raw_csd, 128, 4= 8, > 22) + 1) * > > + 512 * 1024; > > + csd->erase_blk_en =3D mmc_get_bits(raw_csd, 128, 46, 1); > > + csd->erase_sector =3D mmc_get_bits(raw_csd, 128, 39, 7) += 1; > > + csd->wp_grp_size =3D mmc_get_bits(raw_csd, 128, 32, 7); > > + csd->wp_grp_enable =3D mmc_get_bits(raw_csd, 128, 31, 1); > > + csd->r2w_factor =3D 1 << mmc_get_bits(raw_csd, 128, 26, 3= ); > > + csd->write_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 22,= 4); > > + csd->write_bl_partial =3D mmc_get_bits(raw_csd, 128, 21, = 1); > > + } else > > + panic("unknown SD CSD version"); > > +} > > + > > +static void > > +mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd) > > +{ > > + int m; > > + int e; > > + > > + memset(csd, 0, sizeof(*csd)); > > + csd->csd_structure =3D mmc_get_bits(raw_csd, 128, 126, 2); > > + csd->spec_vers =3D mmc_get_bits(raw_csd, 128, 122, 4); > > + m =3D mmc_get_bits(raw_csd, 128, 115, 4); > > + e =3D mmc_get_bits(raw_csd, 128, 112, 3); > > + csd->tacc =3D exp[e] * mant[m] + 9 / 10; > > + csd->nsac =3D mmc_get_bits(raw_csd, 128, 104, 8) * 100; > > + m =3D mmc_get_bits(raw_csd, 128, 99, 4); > > + e =3D mmc_get_bits(raw_csd, 128, 96, 3); > > + csd->tran_speed =3D exp[e] * 10000 * mant[m]; > > + csd->ccc =3D mmc_get_bits(raw_csd, 128, 84, 12); > > + csd->read_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 80, 4); > > + csd->read_bl_partial =3D mmc_get_bits(raw_csd, 128, 79, 1); > > + csd->write_blk_misalign =3D mmc_get_bits(raw_csd, 128, 78, 1); > > + csd->read_blk_misalign =3D mmc_get_bits(raw_csd, 128, 77, 1); > > + csd->dsr_imp =3D mmc_get_bits(raw_csd, 128, 76, 1); > > + csd->vdd_r_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128, 59, 3)= ]; > > + csd->vdd_r_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128, 56, 3)= ]; > > + csd->vdd_w_curr_min =3D cur_min[mmc_get_bits(raw_csd, 128, 53, 3)= ]; > > + csd->vdd_w_curr_max =3D cur_max[mmc_get_bits(raw_csd, 128, 50, 3)= ]; > > + m =3D mmc_get_bits(raw_csd, 128, 62, 12); > > + e =3D mmc_get_bits(raw_csd, 128, 47, 3); > > + csd->capacity =3D ((1 + m) << (e + 2)) * csd->read_bl_len; > > + csd->erase_blk_en =3D 0; > > + csd->erase_sector =3D (mmc_get_bits(raw_csd, 128, 42, 5) + 1) * > > + (mmc_get_bits(raw_csd, 128, 37, 5) + 1); > > + csd->wp_grp_size =3D mmc_get_bits(raw_csd, 128, 32, 5); > > + csd->wp_grp_enable =3D mmc_get_bits(raw_csd, 128, 31, 1); > > + csd->r2w_factor =3D 1 << mmc_get_bits(raw_csd, 128, 26, 3); > > + csd->write_bl_len =3D 1 << mmc_get_bits(raw_csd, 128, 22, 4); > > + csd->write_bl_partial =3D mmc_get_bits(raw_csd, 128, 21, 1); > > +} > > + > > +static void > > +mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid) > > +{ > > + int i; > > + > > + /* There's no version info, so we take it on faith */ > > + memset(cid, 0, sizeof(*cid)); > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > _______________________________________________ > > svn-src-head@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > r320847 doesn't boot. It cycles all over a kernel panic (looks like a > trap12), reboots. > Then, sometimes if the boot process can proceed after an erratic number o= f > attempts, it > gets stuck in the loader's mountroot, bad device 16 error. > > I can not say whether this is due to this commit (On the crashing box, I > have no > debugging enabled an I'm back with r320829 which seems to work). > > -- > O. Hartmann > > Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr > Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Ab= s. 4 BDSG). > From owner-svn-src-head@freebsd.org Sun Jul 9 18:42:30 2017 Return-Path: Delivered-To: svn-src-head@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 90E6AD92C33; Sun, 9 Jul 2017 18:42:30 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 29F2268763; Sun, 9 Jul 2017 18:42:29 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id v69IgL8a060002 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 9 Jul 2017 20:42:21 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id v69IgLMX060001; Sun, 9 Jul 2017 20:42:21 +0200 (CEST) (envelope-from marius) Date: Sun, 9 Jul 2017 20:42:21 +0200 From: Marius Strobl To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... Message-ID: <20170709184221.GB38352@alchemy.franken.de> References: <201707091657.v69GvOar096942@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707091657.v69GvOar096942@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 18:42:30 -0000 On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: > Author: imp > Date: Sun Jul 9 16:57:24 2017 > New Revision: 320844 > URL: https://svnweb.freebsd.org/changeset/base/320844 > > Log: > An MMC/SD/SDIO stack using CAM > > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > flexible queueing will make it easier to write non-storage drivers > than the legacy stack. SDIO drivers from both the kernel and as > userland daemons are possible, though much of that functionality will > come later. At least with a non-MMCCAM kernel, with this revision in place I get an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during boot. Apparently this is due to the fact that sdhci(4) now enables these interrupts, but sdhci_generic_intr() neither actually handles them nor clears them from intmask. Btw., were mmc.ko and mmcsd.ko disconnected on purpose with this commit? Marius From owner-svn-src-head@freebsd.org Sun Jul 9 20:40:18 2017 Return-Path: Delivered-To: svn-src-head@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 57934D94BFF for ; Sun, 9 Jul 2017 20:40:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A1AB6F12F for ; Sun, 9 Jul 2017 20:40:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22c.google.com with SMTP id m68so17577258ith.1 for ; Sun, 09 Jul 2017 13:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=r/d3TnpUxXeoTj9JOWtnJk6V0sTCC0m43dbQdYHr68k=; b=KmgBue0s4u5O8CJeR8Viz7bAImx0LnsdWinHRswLSKMIiBCenOKX9LKiiDw4Clx9Ay EosELk/fk52Io0My7H5/+PxSJy52y+SY33zDm3QCnyY2z7iKW+5s7jL2zVfLWV7ik2vl 5LNZFOitTGGAs8d4Riku5IRAlpGwtARCUmlhUgP993aMwKlX9m5uiTdYUvQgqySnlatq eD1wy9Ym4BM7+axN05I8DT4dE51UB74j7I6I5O0nbgIHtn7LxGbpnQFirtH1CMaAGeXp J9KoJgGq0tcG73FuEP7ljRgSczXqYw9QMTqCM0r689UyrUriMhXcfQl9q0vxuSZ0T87Z JIgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=r/d3TnpUxXeoTj9JOWtnJk6V0sTCC0m43dbQdYHr68k=; b=QUy6jl1qLTsl/5feolsN/XWIGva3AyX+E8q9jy+dPTZeKGlWvCtZl52DiLI5XVmDA9 +HN1GAu46TZksFok9nuX7uc4AFWwOXx5440pkGchJxEcnOLSLtQU8dukFKAdkXZEatM6 GDr4O8W83+ekjjgj2GwlWlDNw/0PASo0wVvbFPKI+FNrVPcjUvruX2ttEgRh0oV0PTE+ b6pgaYu4zG3P/ZlwBjXFmlBGrdX+Y9KSqeHjItH946k7ie/lYzZndYe3X/tBakRqkgdq ceTxa2Q1Mi/CyWSz0UeHpn+/3C+WiXyymzJktvI5dctfRpIILAnH0Jmo8N0h3hlE044+ SgTQ== X-Gm-Message-State: AIVw113Xyp9mHUxt3a79PYWF1d6RdM+j9xixV7soHM1fgbZSmLb9MEg+ T4BiBRXMBQBVLWne2jzW0++Japol9Z7o X-Received: by 10.107.142.130 with SMTP id q124mr484761iod.173.1499632817516; Sun, 09 Jul 2017 13:40:17 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.212.167 with HTTP; Sun, 9 Jul 2017 13:40:16 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:5d99:2cb7:7594:1100] In-Reply-To: <20170709184221.GB38352@alchemy.franken.de> References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709184221.GB38352@alchemy.franken.de> From: Warner Losh Date: Sun, 9 Jul 2017 14:40:16 -0600 X-Google-Sender-Auth: e0yuve5-mzrOPO7lLtu667B2M7g Message-ID: Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... To: Marius Strobl Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 20:40:18 -0000 On Sun, Jul 9, 2017 at 12:42 PM, Marius Strobl wrote: > On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: > > Author: imp > > Date: Sun Jul 9 16:57:24 2017 > > New Revision: 320844 > > URL: https://svnweb.freebsd.org/changeset/base/320844 > > > > Log: > > An MMC/SD/SDIO stack using CAM > > > > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > > flexible queueing will make it easier to write non-storage drivers > > than the legacy stack. SDIO drivers from both the kernel and as > > userland daemons are possible, though much of that functionality will > > come later. > > At least with a non-MMCCAM kernel, with this revision in place I get > an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during > boot. Apparently this is due to the fact that sdhci(4) now enables > these interrupts, but sdhci_generic_intr() neither actually handles > them nor clears them from intmask. > OK. I'll look into it. Since I don't have an SDHCI card in the system I tested it in, I never saw these... > Btw., were mmc.ko and mmcsd.ko disconnected on purpose with this commit? No, I'll reconnect. Warner From owner-svn-src-head@freebsd.org Sun Jul 9 20:42:12 2017 Return-Path: Delivered-To: svn-src-head@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 D9335D94DB1; Sun, 9 Jul 2017 20:42:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A8C686F471; Sun, 9 Jul 2017 20:42:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69KgBmf087553; Sun, 9 Jul 2017 20:42:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69KgBQ7087552; Sun, 9 Jul 2017 20:42:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707092042.v69KgBQ7087552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 9 Jul 2017 20:42:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320849 - head/sys/modules X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/modules X-SVN-Commit-Revision: 320849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 20:42:13 -0000 Author: imp Date: Sun Jul 9 20:42:11 2017 New Revision: 320849 URL: https://svnweb.freebsd.org/changeset/base/320849 Log: Reconnect mmc and mmcsd disconnected unintentioanlly in mmccam commit. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Jul 9 17:56:39 2017 (r320848) +++ head/sys/modules/Makefile Sun Jul 9 20:42:11 2017 (r320849) @@ -251,6 +251,8 @@ SUBDIR= \ ${_mlx5} \ ${_mlx5en} \ ${_mly} \ + mmc \ + mmcsd \ mpr \ mps \ mpt \ From owner-svn-src-head@freebsd.org Sun Jul 9 20:49:03 2017 Return-Path: Delivered-To: svn-src-head@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 BEED6D94E94; Sun, 9 Jul 2017 20:49:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 8CCDA6F62C; Sun, 9 Jul 2017 20:49:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69Kn2oI090135; Sun, 9 Jul 2017 20:49:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69Kn2ve090134; Sun, 9 Jul 2017 20:49:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707092049.v69Kn2ve090134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 9 Jul 2017 20:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320850 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 320850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 20:49:03 -0000 Author: imp Date: Sun Jul 9 20:49:02 2017 New Revision: 320850 URL: https://svnweb.freebsd.org/changeset/base/320850 Log: Back out enabling the card interrupt detection bit. It is not ready to commit. Noticed by: marius@ Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sun Jul 9 20:42:11 2017 (r320849) +++ head/sys/dev/sdhci/sdhci.c Sun Jul 9 20:49:02 2017 (r320850) @@ -268,7 +268,7 @@ sdhci_init(struct sdhci_slot *slot) SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DMA_END | SDHCI_INT_DATA_END | SDHCI_INT_RESPONSE | - SDHCI_INT_ACMD12ERR | SDHCI_INT_CARD_INT; + SDHCI_INT_ACMD12ERR; if (!(slot->quirks & SDHCI_QUIRK_POLL_CARD_PRESENT) && !(slot->opt & SDHCI_NON_REMOVABLE)) { @@ -1826,10 +1826,7 @@ sdhci_generic_intr(struct sdhci_slot *slot) "Card is consuming too much power!\n"); intmask &= ~SDHCI_INT_BUS_POWER; } - /* Handle card interrupt. */ - if (intmask & SDHCI_INT_CARD_INT) { - - } + /* The rest is unknown. */ if (intmask) { WR4(slot, SDHCI_INT_STATUS, intmask); From owner-svn-src-head@freebsd.org Sun Jul 9 20:49:57 2017 Return-Path: Delivered-To: svn-src-head@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 D3C3CD94F05 for ; Sun, 9 Jul 2017 20:49:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95B596F76A for ; Sun, 9 Jul 2017 20:49:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id 188so7372138itx.0 for ; Sun, 09 Jul 2017 13:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=YxuVMm3Kh6FLb5vQZNAdzzja1xUZhCnxRLwcj5MaMCQ=; b=GO/S3WrX2kYfmrs4BktYvaPSAZP59piV8dw3zNKgrUkUvLBVsNdk7P+sfj7IwLv10+ QQ2tJR1PswInzwimH2W1IZ/23QwMu5BejLS3uWzz7OPRsW/ByxvfSgnbH8d2Kz+oepv/ YtvQDHBlVR6HZphHzy5+tcNjNeTB+S4e35ONVVMyAWnbINEFgYOYBUZexKtCm0X7e74q arZ/VlRdoRK6nd0hgskRR05zPzaQ70odDCMYYjZHPwb+/tb31PIADCwa48sFyTB1WaP6 yVBjiaxGnSJEDLmuKUk/cUZgRW77Fb4ipbgp+Me73sM15A/So16IOeElBs4U6rQCozXU CQzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=YxuVMm3Kh6FLb5vQZNAdzzja1xUZhCnxRLwcj5MaMCQ=; b=qCIKnti+tTV89XVujf+VbfAkh/ZY1zlbsaIs91GOJX+CuLrt80VyHpsfF5+7E2LVHN uLBaDlkejJIcKNp87ztRd6oq4tClL8JLBexopi2pk5MyVtACtzChXEH8yfBkxQ0KviLm O4EGZKi6aVFJcWAFCQLaSCDuIT0rM1M2B7mUghcGrRgb8cRfPi0GaOFWMaVqseJVQC0y iQk1FHk8HZgTTfaEdoVVnriKrUxTDkM5sk9tdF7ZOrwUVaNKhmoWAyixDK0+Ya+5Af3d cwxwrggjQynPwviEkddg95JJLqnu4Xlrf5ISZOXFCq0nUk1SMjn19fpFoGVVthSgWyxK bEAw== X-Gm-Message-State: AIVw1130qncENvNPbyN0DJ5gpLunaYYO/bLllFQWVdON5NM0myIbARc0 EOHmBF7edEN0RcrS9orV8buZw5RkaRLW X-Received: by 10.36.25.200 with SMTP id b191mr8978372itb.20.1499633397071; Sun, 09 Jul 2017 13:49:57 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.212.167 with HTTP; Sun, 9 Jul 2017 13:49:56 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:5d99:2cb7:7594:1100] In-Reply-To: References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709184221.GB38352@alchemy.franken.de> From: Warner Losh Date: Sun, 9 Jul 2017 14:49:56 -0600 X-Google-Sender-Auth: -CnpkUN2IjSECpiTCBp31-Pm6O8 Message-ID: Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... To: Marius Strobl Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 20:49:57 -0000 On Sun, Jul 9, 2017 at 2:40 PM, Warner Losh wrote: > > > On Sun, Jul 9, 2017 at 12:42 PM, Marius Strobl wrote: > >> On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: >> > Author: imp >> > Date: Sun Jul 9 16:57:24 2017 >> > New Revision: 320844 >> > URL: https://svnweb.freebsd.org/changeset/base/320844 >> > >> > Log: >> > An MMC/SD/SDIO stack using CAM >> > >> > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's >> > flexible queueing will make it easier to write non-storage drivers >> > than the legacy stack. SDIO drivers from both the kernel and as >> > userland daemons are possible, though much of that functionality will >> > come later. >> >> At least with a non-MMCCAM kernel, with this revision in place I get >> an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during >> boot. Apparently this is due to the fact that sdhci(4) now enables >> these interrupts, but sdhci_generic_intr() neither actually handles >> them nor clears them from intmask. >> > > OK. I'll look into it. Since I don't have an SDHCI card in the system I > tested it in, I never saw these... > Looking at the code, the problem is obvious. It looks like it came in on a late commit to the mmccam integration branch. I'll revert which should solve your problem. Looking at my notes and test systems, I did test this on a NUC, but it was an older version w/o the patch I just reverted. Sorry for the hassle. r320850 > Btw., were mmc.ko and mmcsd.ko disconnected on purpose with this commit? > > > No, I'll reconnect. > This has been done. r320849 Warner From owner-svn-src-head@freebsd.org Sun Jul 9 22:37:51 2017 Return-Path: Delivered-To: svn-src-head@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 BE209D97787; Sun, 9 Jul 2017 22:37:51 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 505CB72DD7; Sun, 9 Jul 2017 22:37:50 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id v69MblkB061656 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 10 Jul 2017 00:37:47 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id v69MblG0061655; Mon, 10 Jul 2017 00:37:47 +0200 (CEST) (envelope-from marius) Date: Mon, 10 Jul 2017 00:37:47 +0200 From: Marius Strobl To: Warner Losh Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Warner Losh Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... Message-ID: <20170709223747.GC38352@alchemy.franken.de> References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709184221.GB38352@alchemy.franken.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 22:37:51 -0000 --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jul 09, 2017 at 02:49:56PM -0600, Warner Losh wrote: > On Sun, Jul 9, 2017 at 2:40 PM, Warner Losh wrote: > > > > > > > On Sun, Jul 9, 2017 at 12:42 PM, Marius Strobl wrote: > > > >> On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: > >> > Author: imp > >> > Date: Sun Jul 9 16:57:24 2017 > >> > New Revision: 320844 > >> > URL: https://svnweb.freebsd.org/changeset/base/320844 > >> > > >> > Log: > >> > An MMC/SD/SDIO stack using CAM > >> > > >> > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > >> > flexible queueing will make it easier to write non-storage drivers > >> > than the legacy stack. SDIO drivers from both the kernel and as > >> > userland daemons are possible, though much of that functionality will > >> > come later. > >> > >> At least with a non-MMCCAM kernel, with this revision in place I get > >> an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during > >> boot. Apparently this is due to the fact that sdhci(4) now enables > >> these interrupts, but sdhci_generic_intr() neither actually handles > >> them nor clears them from intmask. > >> > > > > OK. I'll look into it. Since I don't have an SDHCI card in the system I > > tested it in, I never saw these... > > > > Looking at the code, the problem is obvious. It looks like it came in on a > late commit to the mmccam integration branch. I'll revert which should > solve your problem. Thanks, I can confirm that r320850 allows booting again. Compared to pre-r320844, sdhci(4) now still is incredibly noisy in the non-MMCCAM path, though. Can we get this removed again or at least put under sdhci_debug, along with removing the memory overhead for the non-MMCCAM case and some of the style(9) violations/inconsistencies (re-)introduced, using something like the attached patch? > Looking at my notes and test systems, I did test this > on a NUC, but it was an older version w/o the patch I just reverted. Sorry > for the hassle. r320850 Well, I might have given a different impression, but I don't actually care about NUCs as such; they are just a relatively cheap way of obtaining various combinations of Intel MMC/SDXC controllers and eMMC chips and are an acceptable loss should I ever manage to kill an eMMC chip during development. Marius --cWoXeonUoKmBZSoM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="sdhci.diff" Index: sdhci.c =================================================================== --- sdhci.c (revision 320850) +++ sdhci.c (working copy) @@ -91,7 +91,7 @@ static void sdhci_start_data(struct sdhci_slot *sl static void sdhci_card_poll(void *); static void sdhci_card_task(void *, int); -/* CAM-related */ +#ifdef MMCCAM int sdhci_cam_get_possible_host_clock(struct sdhci_slot *slot, int proposed_clock); static int sdhci_cam_update_ios(struct sdhci_slot *slot); static int sdhci_cam_request(struct sdhci_slot *slot, union ccb *ccb); @@ -98,6 +98,7 @@ static int sdhci_cam_request(struct sdhci_slot *sl static void sdhci_cam_action(struct cam_sim *sim, union ccb *ccb); static void sdhci_cam_poll(struct cam_sim *sim); static int sdhci_cam_settran_settings(struct sdhci_slot *slot, union ccb *ccb); +#endif /* helper routines */ static void sdhci_dumpregs(struct sdhci_slot *slot); @@ -1021,10 +1022,6 @@ sdhci_generic_update_ios(device_t brdev, device_t struct sdhci_slot *slot = device_get_ivars(reqdev); struct mmc_ios *ios = &slot->host.ios; - device_printf(brdev, "This is a bridge device\n"); - device_printf(reqdev, "This is a request device\n"); - - slot_printf(slot, " <--- The locking slot is this\n"); SDHCI_LOCK(slot); /* Do full reset on bus power down to clear from any state. */ if (ios->power_mode == power_off) { @@ -1121,8 +1118,9 @@ static void sdhci_req_done(struct sdhci_slot *slot) { union ccb *ccb; + if (sdhci_debug > 1) - slot_printf(slot, "sdhci_req_done()\n"); + slot_printf(slot, "%s\n", __func_); if (slot->ccb != NULL && slot->curcmd != NULL) { callout_stop(&slot->timeout_callout); ccb = slot->ccb; @@ -1139,7 +1137,7 @@ sdhci_req_done(struct sdhci_slot *slot) } } #else -static void +static void sdhci_req_done(struct sdhci_slot *slot) { struct mmc_request *req; @@ -1320,7 +1318,7 @@ sdhci_finish_command(struct sdhci_slot *slot) if (sdhci_debug > 1) slot_printf(slot, "%s: called, err %d flags %d\n", - __func__, slot->curcmd->error, slot->curcmd->flags); + __func__, slot->curcmd->error, slot->curcmd->flags); slot->cmd_done = 1; /* * Interrupt aggregation: Restore command interrupt. @@ -1356,8 +1354,8 @@ sdhci_finish_command(struct sdhci_slot *slot) } if (sdhci_debug > 1) printf("Resp: %02x %02x %02x %02x\n", - slot->curcmd->resp[0], slot->curcmd->resp[1], - slot->curcmd->resp[2], slot->curcmd->resp[3]); + slot->curcmd->resp[0], slot->curcmd->resp[1], + slot->curcmd->resp[2], slot->curcmd->resp[3]); /* If data ready - finish. */ if (slot->data_done) @@ -1441,9 +1439,10 @@ sdhci_start_data(struct sdhci_slot *slot, struct m WR2(slot, SDHCI_BLOCK_COUNT, (data->len + 511) / 512); if (sdhci_debug > 1) - slot_printf(slot, "Block size: %02x, count %lu\n", (unsigned int) - SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < 512)?data->len:512), - (unsigned long)(data->len + 511) / 512); + slot_printf(slot, "Block size: %02x, count %lu\n", + (unsigned int)SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < + 512) ? data->len : 512), (unsigned long)(data->len + 511) / + 512); } void @@ -1657,6 +1656,7 @@ static void sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask) { struct mmc_data *data; + size_t left; if (!slot->curcmd) { slot_printf(slot, "Got data interrupt 0x%08x, but " @@ -1702,7 +1702,6 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t i /* Handle DMA border. */ if (intmask & SDHCI_INT_DMA_END) { data = slot->curcmd->data; - size_t left; /* Unload DMA buffer ... */ left = data->len - slot->offset; @@ -1910,7 +1909,8 @@ sdhci_generic_write_ivar(device_t bus, device_t ch uint32_t clock, max_clock; int i; - slot_printf(slot, "sdhci_generic_write_ivar, var=%d\n", which); + if (sdhci_debug > 1) + slot_printf(slot, "%s: var=%d\n", __func__, which); switch (which) { default: return (EINVAL); @@ -1976,6 +1976,7 @@ sdhci_generic_write_ivar(device_t bus, device_t ch return (0); } +#ifdef MMCCAM /* CAM-related functions */ #include #include @@ -2294,5 +2295,6 @@ sdhci_cam_request(struct sdhci_slot *slot, union c } return (0); } +#endif /* MMCCAM */ MODULE_VERSION(sdhci, 1); Index: sdhci.h =================================================================== --- sdhci.h (revision 320850) +++ sdhci.h (working copy) @@ -28,6 +28,8 @@ #ifndef __SDHCI_H__ #define __SDHCI_H__ +#include "opt_mmccam.h" + #define DMA_BLOCK_SIZE 4096 #define DMA_BOUNDARY 0 /* DMA reload every 4K */ @@ -368,12 +370,13 @@ struct sdhci_slot { #define PLATFORM_DATA_STARTED 8 /* Data xfer is handled by platform */ struct mtx mtx; /* Slot mutex */ - /* CAM stuff */ +#ifdef MMCCAM union ccb *ccb; struct cam_devq *devq; struct cam_sim *sim; struct mtx sim_mtx; u_char card_present; /* XXX Maybe derive this from elsewhere? */ +#endif }; int sdhci_generic_read_ivar(device_t bus, device_t child, int which, @@ -400,6 +403,8 @@ bool sdhci_generic_get_card_present(device_t brdev void sdhci_generic_set_uhs_timing(device_t brdev, struct sdhci_slot *slot); void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present); -/* CAM-related */ +#ifdef MMCCAM void sdhci_cam_start_slot(struct sdhci_slot *slot); +#endif + #endif /* __SDHCI_H__ */ --cWoXeonUoKmBZSoM-- From owner-svn-src-head@freebsd.org Sun Jul 9 22:53:26 2017 Return-Path: Delivered-To: svn-src-head@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 29C48D97BE5; Sun, 9 Jul 2017 22:53:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EB18773409; Sun, 9 Jul 2017 22:53:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69MrPBu042870; Sun, 9 Jul 2017 22:53:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69MrO5v042866; Sun, 9 Jul 2017 22:53:24 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707092253.v69MrO5v042866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 9 Jul 2017 22:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320851 - in head/sys: dev/agp modules/agp X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: dev/agp modules/agp X-SVN-Commit-Revision: 320851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 22:53:26 -0000 Author: markj Date: Sun Jul 9 22:53:24 2017 New Revision: 320851 URL: https://svnweb.freebsd.org/changeset/base/320851 Log: Add a helper function to agp(4) which installs a single GTT entry. Submitted by: dumbbell MFC after: 1 week Modified: head/sys/dev/agp/agp_i810.c head/sys/dev/agp/agp_i810.h head/sys/modules/agp/Makefile Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Sun Jul 9 20:49:02 2017 (r320850) +++ head/sys/dev/agp/agp_i810.c Sun Jul 9 22:53:24 2017 (r320851) @@ -2242,6 +2242,16 @@ agp_intel_gtt_map_memory(device_t dev, vm_page_t *page return (0); } +static void +agp_intel_gtt_install_pte(device_t dev, u_int index, vm_paddr_t addr, + u_int flags) +{ + struct agp_i810_softc *sc; + + sc = device_get_softc(dev); + sc->match->driver->install_gtt_pte(dev, index, addr, flags); +} + void agp_intel_gtt_insert_sg_entries(device_t dev, struct sglist *sg_list, u_int first_entry, u_int flags) @@ -2318,6 +2328,13 @@ intel_gtt_insert_sg_entries(struct sglist *sg_list, u_ { agp_intel_gtt_insert_sg_entries(intel_agp, sg_list, first_entry, flags); +} + +void +intel_gtt_install_pte(u_int index, vm_paddr_t addr, u_int flags) +{ + + agp_intel_gtt_install_pte(intel_agp, index, addr, flags); } device_t Modified: head/sys/dev/agp/agp_i810.h ============================================================================== --- head/sys/dev/agp/agp_i810.h Sun Jul 9 20:49:02 2017 (r320850) +++ head/sys/dev/agp/agp_i810.h Sun Jul 9 22:53:24 2017 (r320851) @@ -87,6 +87,7 @@ struct intel_gtt *intel_gtt_get(void); int intel_gtt_chipset_flush(void); void intel_gtt_unmap_memory(struct sglist *sg_list); void intel_gtt_clear_range(u_int first_entry, u_int num_entries); +void intel_gtt_install_pte(u_int index, vm_paddr_t addr, u_int flags); int intel_gtt_map_memory(vm_page_t *pages, u_int num_entries, struct sglist **sg_list); void intel_gtt_insert_sg_entries(struct sglist *sg_list, u_int pg_start, Modified: head/sys/modules/agp/Makefile ============================================================================== --- head/sys/modules/agp/Makefile Sun Jul 9 20:49:02 2017 (r320850) +++ head/sys/modules/agp/Makefile Sun Jul 9 22:53:24 2017 (r320851) @@ -35,6 +35,7 @@ EXPORT_SYMS= agp_find_device \ .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" EXPORT_SYMS+= intel_gtt_clear_range \ intel_gtt_insert_pages \ + intel_gtt_install_pte \ intel_gtt_get \ intel_gtt_chipset_flush \ intel_gtt_unmap_memory \ From owner-svn-src-head@freebsd.org Sun Jul 9 22:57:01 2017 Return-Path: Delivered-To: svn-src-head@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 2E8BAD97D2C; Sun, 9 Jul 2017 22:57:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EFD8273594; Sun, 9 Jul 2017 22:57:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69Mv0kM043048; Sun, 9 Jul 2017 22:57:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69Mv0ZS043047; Sun, 9 Jul 2017 22:57:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707092257.v69Mv0ZS043047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 9 Jul 2017 22:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320852 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 320852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 22:57:01 -0000 Author: markj Date: Sun Jul 9 22:57:00 2017 New Revision: 320852 URL: https://svnweb.freebsd.org/changeset/base/320852 Log: Free existing per-thread task structs when unloading linuxkpi.ko. They are otherwise leaked. Reported and tested by: ae MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/src/linux_current.c Modified: head/sys/compat/linuxkpi/common/src/linux_current.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_current.c Sun Jul 9 22:53:24 2017 (r320851) +++ head/sys/compat/linuxkpi/common/src/linux_current.c Sun Jul 9 22:57:00 2017 (r320852) @@ -226,6 +226,23 @@ SYSINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_S static void linux_current_uninit(void *arg __unused) { + struct proc *p; + struct task_struct *ts; + struct thread *td; + + sx_slock(&allproc_lock); + FOREACH_PROC_IN_SYSTEM(p) { + PROC_LOCK(p); + FOREACH_THREAD_IN_PROC(p, td) { + if ((ts = td->td_lkpi_task) != NULL) { + td->td_lkpi_task = NULL; + put_task_struct(ts); + } + } + PROC_UNLOCK(p); + } + sx_sunlock(&allproc_lock); + EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag); } SYSUNINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_uninit, NULL); From owner-svn-src-head@freebsd.org Sun Jul 9 23:13:10 2017 Return-Path: Delivered-To: svn-src-head@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 2DBB2D98137; Sun, 9 Jul 2017 23:13:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EEAC473C16; Sun, 9 Jul 2017 23:13:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69ND8WB050951; Sun, 9 Jul 2017 23:13:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69ND8WA050950; Sun, 9 Jul 2017 23:13:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707092313.v69ND8WA050950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 9 Jul 2017 23:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320853 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 320853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 23:13:10 -0000 Author: markj Date: Sun Jul 9 23:13:08 2017 New Revision: 320853 URL: https://svnweb.freebsd.org/changeset/base/320853 Log: Add a few functions to ktime.h in the LinuxKPI, and fix nearby style. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11534 Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h Modified: head/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/ktime.h Sun Jul 9 22:57:00 2017 (r320852) +++ head/sys/compat/linuxkpi/common/include/linux/ktime.h Sun Jul 9 23:13:08 2017 (r320853) @@ -26,8 +26,9 @@ * * $FreeBSD$ */ + #ifndef _LINUX_KTIME_H -#define _LINUX_KTIME_H +#define _LINUX_KTIME_H #include #include @@ -153,7 +154,7 @@ timeval_to_ktime(struct timeval tv) #define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) #define ktime_to_ns(kt) ((kt).tv64) -static inline s64 +static inline int64_t ktime_get_ns(void) { struct timespec ts; @@ -164,6 +165,8 @@ ktime_get_ns(void) return (ktime_to_ns(kt)); } +#define ktime_get_raw_ns() ktime_get_ns() + static inline ktime_t ktime_get(void) { @@ -173,4 +176,22 @@ ktime_get(void) return (timespec_to_ktime(ts)); } -#endif /* _LINUX_KTIME_H */ +static inline ktime_t +ktime_get_boottime(void) +{ + struct timespec ts; + + nanouptime(&ts); + return (timespec_to_ktime(ts)); +} + +static inline ktime_t +ktime_get_real(void) +{ + struct timespec ts; + + nanotime(&ts); + return (timespec_to_ktime(ts)); +} + +#endif /* _LINUX_KTIME_H */ From owner-svn-src-head@freebsd.org Sun Jul 9 23:14:53 2017 Return-Path: Delivered-To: svn-src-head@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 2D59DD981D8; Sun, 9 Jul 2017 23:14:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EE40073D7F; Sun, 9 Jul 2017 23:14:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v69NEqgp051062; Sun, 9 Jul 2017 23:14:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69NEqn9051061; Sun, 9 Jul 2017 23:14:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707092314.v69NEqn9051061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 9 Jul 2017 23:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320854 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 320854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 23:14:53 -0000 Author: markj Date: Sun Jul 9 23:14:51 2017 New Revision: 320854 URL: https://svnweb.freebsd.org/changeset/base/320854 Log: Add some functions to math64.h in the LinuxKPI, and fix nearby style. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11535 Modified: head/sys/compat/linuxkpi/common/include/linux/math64.h Modified: head/sys/compat/linuxkpi/common/include/linux/math64.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/math64.h Sun Jul 9 23:13:08 2017 (r320853) +++ head/sys/compat/linuxkpi/common/include/linux/math64.h Sun Jul 9 23:14:51 2017 (r320854) @@ -26,6 +26,7 @@ * * $FreeBSD$ */ + #ifndef _LINUX_MATH64_H #define _LINUX_MATH64_H @@ -40,16 +41,47 @@ }) static inline uint64_t +div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder) +{ + + *remainder = dividend % divisor; + return (dividend / divisor); +} + +static inline int64_t +div64_s64(int64_t dividend, int64_t divisor) +{ + + return (dividend / divisor); +} + +static inline uint64_t +div64_u64(uint64_t dividend, uint64_t divisor) +{ + + return (dividend / divisor); +} + +static inline uint64_t div_u64_rem(uint64_t dividend, uint32_t divisor, uint32_t *remainder) { + *remainder = dividend % divisor; return (dividend / divisor); } +static inline int64_t +div_s64(int64_t dividend, int32_t divisor) +{ + + return (dividend / divisor); +} + static inline uint64_t div_u64(uint64_t dividend, uint32_t divisor) { + return (dividend / divisor); } -#endif /* _LINUX_MATH64_H */ +#endif /* _LINUX_MATH64_H */ From owner-svn-src-head@freebsd.org Mon Jul 10 01:37:31 2017 Return-Path: Delivered-To: svn-src-head@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 E3EEFD9A7CE for ; Mon, 10 Jul 2017 01:37:31 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 881A876F1A for ; Mon, 10 Jul 2017 01:37:31 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id m68so20582046ith.1 for ; Sun, 09 Jul 2017 18:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=W9jfee5RIxwido0nnM8QqOwQn3Y60jUivIMdUN+VZaI=; b=l+eEgPDyc9OSyjqfO6WK9wr68+UUjwI2MqJDGJKNLh1P+gRWQCYYXh5BzWAjjROThO SUYqWtnyJvGlNsYx0IQ9EoLQNv/ugPhd5ByXNSnMQNbKv2aSf/KSGypkZrzvBKXZHGoz dVwMIsRT9P4jhy5rFZl/asZL/NnEGxGwem1uurepcz5O+nfQBhf86WgJJV4x6RiAW6PK I78Rposfj52H1SX5OYDIs2Ew0ZbMi0EGyw255zQpnTLgcTTn64vw/iA9QeLg5HLe0OFo YKdmORYRrWQOS8+ZKbQNxN7U9sPvkoy8O9Kdbec9toG8cVdeRH53I2xFnYbzP+GUwzqZ LOUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=W9jfee5RIxwido0nnM8QqOwQn3Y60jUivIMdUN+VZaI=; b=NCgO/ygR9BB9Dr2B4J10KOQi4ecgmp+y8YkZHOXRqC9Wze6rLBqhwwWwiYLqmZottw 99J8CrldNmLqw1LfHHvODZvuur3Mhb+RAJiHdzQsylPSaa6tW/9HuI1O4Ole5UEeCTmb 7l3Y2sDYYsZWYjFubTzfNg2Wi/fYmnQ/++NJ4ecnbyev1i4VgOZUtve9dJQhi6uATGUB p0mzOuBePCse5jX3FTtPkx506tMjoAEfEI0AJyMg+eVhGWwvBpwV9OMCsIu5GrafMUQb ZSfDE8E4gnEcnxlv4NkfJRmnSiblrzYL/zeZ6dmWLzuVxIEKxl4unmeLKzO1PW2LbIdZ xbTA== X-Gm-Message-State: AIVw113hmlOsTlf7poJuF3EqprFChIMJ51eLhdAu1ri+B0zSUQYeQox3 rXIrxawxh0C+JmkKHbhVsGxnCq+Odj61 X-Received: by 10.36.90.203 with SMTP id v194mr9443367ita.48.1499650650867; Sun, 09 Jul 2017 18:37:30 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.212.167 with HTTP; Sun, 9 Jul 2017 18:37:30 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:5d99:2cb7:7594:1100] In-Reply-To: <20170709223747.GC38352@alchemy.franken.de> References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709184221.GB38352@alchemy.franken.de> <20170709223747.GC38352@alchemy.franken.de> From: Warner Losh Date: Sun, 9 Jul 2017 19:37:30 -0600 X-Google-Sender-Auth: Ycc0VbIvDXL9gSsAWdt8n51jMm4 Message-ID: Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... To: Marius Strobl Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Warner Losh Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 01:37:32 -0000 On Sun, Jul 9, 2017 at 4:37 PM, Marius Strobl wrote: > On Sun, Jul 09, 2017 at 02:49:56PM -0600, Warner Losh wrote: > > On Sun, Jul 9, 2017 at 2:40 PM, Warner Losh wrote: > > > > > > > > > > > On Sun, Jul 9, 2017 at 12:42 PM, Marius Strobl > wrote: > > > > > >> On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: > > >> > Author: imp > > >> > Date: Sun Jul 9 16:57:24 2017 > > >> > New Revision: 320844 > > >> > URL: https://svnweb.freebsd.org/changeset/base/320844 > > >> > > > >> > Log: > > >> > An MMC/SD/SDIO stack using CAM > > >> > > > >> > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > > >> > flexible queueing will make it easier to write non-storage drivers > > >> > than the legacy stack. SDIO drivers from both the kernel and as > > >> > userland daemons are possible, though much of that functionality > will > > >> > come later. > > >> > > >> At least with a non-MMCCAM kernel, with this revision in place I get > > >> an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during > > >> boot. Apparently this is due to the fact that sdhci(4) now enables > > >> these interrupts, but sdhci_generic_intr() neither actually handles > > >> them nor clears them from intmask. > > >> > > > > > > OK. I'll look into it. Since I don't have an SDHCI card in the system I > > > tested it in, I never saw these... > > > > > > > Looking at the code, the problem is obvious. It looks like it came in on > a > > late commit to the mmccam integration branch. I'll revert which should > > solve your problem. > > Thanks, I can confirm that r320850 allows booting again. Compared to > pre-r320844, sdhci(4) now still is incredibly noisy in the non-MMCCAM > path, though. Can we get this removed again or at least put under > sdhci_debug, along with removing the memory overhead for the non-MMCCAM > case and some of the style(9) violations/inconsistencies (re-)introduced, > using something like the attached patch? Sure. The patch failed 100% to apply, so I applied it by hand (there's on > 80 character line that I left that way on purpose because (a) the way you chunked it up was worse than before and (b) most of it should be changed to use other macros so it isn't so ugly and I left the CAM related comments in for easiler grepping). That should get rid of the worst of the re-introduced offenders. That's what happens when work collides... I'll commit in a few, after I fix the module compilation errors... > Looking at my notes and test systems, I did test this > > on a NUC, but it was an older version w/o the patch I just reverted. > Sorry > > for the hassle. r320850 > > Well, I might have given a different impression, but I don't actually > care about NUCs as such; they are just a relatively cheap way of > obtaining various combinations of Intel MMC/SDXC controllers and eMMC > chips and are an acceptable loss should I ever manage to kill an eMMC > chip during development. > Yea, I have one laying around for other reasons as well... Mine don't have eMMC in them, but do have a SD slot... Warner From owner-svn-src-head@freebsd.org Mon Jul 10 03:38:09 2017 Return-Path: Delivered-To: svn-src-head@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 F1BA7D9C3F8; Mon, 10 Jul 2017 03:38:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 BA02F799EA; Mon, 10 Jul 2017 03:38:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A3c735058723; Mon, 10 Jul 2017 03:38:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A3c7ML058722; Mon, 10 Jul 2017 03:38:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707100338.v6A3c7ML058722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 10 Jul 2017 03:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320856 - head/sys/modules/sdhci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/modules/sdhci X-SVN-Commit-Revision: 320856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 03:38:09 -0000 Author: imp Date: Mon Jul 10 03:38:07 2017 New Revision: 320856 URL: https://svnweb.freebsd.org/changeset/base/320856 Log: Add dependency on opt_cam.h and opt_mmccam.h Modified: head/sys/modules/sdhci/Makefile Modified: head/sys/modules/sdhci/Makefile ============================================================================== --- head/sys/modules/sdhci/Makefile Mon Jul 10 03:11:48 2017 (r320855) +++ head/sys/modules/sdhci/Makefile Mon Jul 10 03:38:07 2017 (r320856) @@ -3,6 +3,6 @@ .PATH: ${SRCTOP}/sys/dev/sdhci KMOD= sdhci -SRCS= sdhci.c sdhci.h sdhci_if.c sdhci_if.h device_if.h bus_if.h mmcbr_if.h +SRCS= sdhci.c sdhci.h sdhci_if.c sdhci_if.h device_if.h bus_if.h mmcbr_if.h opt_mmccam.h opt_cam.h .include From owner-svn-src-head@freebsd.org Mon Jul 10 03:38:13 2017 Return-Path: Delivered-To: svn-src-head@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 B87B6D9C41B; Mon, 10 Jul 2017 03:38:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 8867079A00; Mon, 10 Jul 2017 03:38:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A3cCPv058779; Mon, 10 Jul 2017 03:38:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A3cCR4058778; Mon, 10 Jul 2017 03:38:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707100338.v6A3cCR4058778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 10 Jul 2017 03:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320857 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 320857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 03:38:13 -0000 Author: imp Date: Mon Jul 10 03:38:12 2017 New Revision: 320857 URL: https://svnweb.freebsd.org/changeset/base/320857 Log: Opt files are included with single quotes. Modified: head/sys/cam/cam.h Modified: head/sys/cam/cam.h ============================================================================== --- head/sys/cam/cam.h Mon Jul 10 03:38:07 2017 (r320856) +++ head/sys/cam/cam.h Mon Jul 10 03:38:12 2017 (r320857) @@ -32,7 +32,7 @@ #define _CAM_CAM_H 1 #ifdef _KERNEL -#include +#include "opt_cam.h" #endif #include From owner-svn-src-head@freebsd.org Mon Jul 10 03:38:19 2017 Return-Path: Delivered-To: svn-src-head@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 2DE89D9C44E; Mon, 10 Jul 2017 03:38:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0843D79A89; Mon, 10 Jul 2017 03:38:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A3cIh4058834; Mon, 10 Jul 2017 03:38:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A3cIbn058831; Mon, 10 Jul 2017 03:38:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707100338.v6A3cIbn058831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 10 Jul 2017 03:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320858 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 320858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 03:38:19 -0000 Author: imp Date: Mon Jul 10 03:38:17 2017 New Revision: 320858 URL: https://svnweb.freebsd.org/changeset/base/320858 Log: Better contain MMCCAM parts of this file Remove some useless to the general user debugs Put debugs under sdhci_debug. Fix some style(9) regressions Submitted by: marius@ Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Mon Jul 10 03:38:12 2017 (r320857) +++ head/sys/dev/sdhci/sdhci.c Mon Jul 10 03:38:17 2017 (r320858) @@ -91,6 +91,7 @@ static void sdhci_start_data(struct sdhci_slot *slot, static void sdhci_card_poll(void *); static void sdhci_card_task(void *, int); +#ifdef MMCCAM /* CAM-related */ int sdhci_cam_get_possible_host_clock(struct sdhci_slot *slot, int proposed_clock); static int sdhci_cam_update_ios(struct sdhci_slot *slot); @@ -98,6 +99,7 @@ static int sdhci_cam_request(struct sdhci_slot *slot, static void sdhci_cam_action(struct cam_sim *sim, union ccb *ccb); static void sdhci_cam_poll(struct cam_sim *sim); static int sdhci_cam_settran_settings(struct sdhci_slot *slot, union ccb *ccb); +#endif /* helper routines */ static void sdhci_dumpregs(struct sdhci_slot *slot); @@ -1021,10 +1023,6 @@ sdhci_generic_update_ios(device_t brdev, device_t reqd struct sdhci_slot *slot = device_get_ivars(reqdev); struct mmc_ios *ios = &slot->host.ios; - device_printf(brdev, "This is a bridge device\n"); - device_printf(reqdev, "This is a request device\n"); - - slot_printf(slot, " <--- The locking slot is this\n"); SDHCI_LOCK(slot); /* Do full reset on bus power down to clear from any state. */ if (ios->power_mode == power_off) { @@ -1121,8 +1119,9 @@ static void sdhci_req_done(struct sdhci_slot *slot) { union ccb *ccb; + if (sdhci_debug > 1) - slot_printf(slot, "sdhci_req_done()\n"); + slot_printf(slot, "%s\n", __func__); if (slot->ccb != NULL && slot->curcmd != NULL) { callout_stop(&slot->timeout_callout); ccb = slot->ccb; @@ -1139,7 +1138,7 @@ sdhci_req_done(struct sdhci_slot *slot) } } #else -static void +static void sdhci_req_done(struct sdhci_slot *slot) { struct mmc_request *req; @@ -1320,7 +1319,7 @@ sdhci_finish_command(struct sdhci_slot *slot) if (sdhci_debug > 1) slot_printf(slot, "%s: called, err %d flags %d\n", - __func__, slot->curcmd->error, slot->curcmd->flags); + __func__, slot->curcmd->error, slot->curcmd->flags); slot->cmd_done = 1; /* * Interrupt aggregation: Restore command interrupt. @@ -1356,8 +1355,8 @@ sdhci_finish_command(struct sdhci_slot *slot) } if (sdhci_debug > 1) printf("Resp: %02x %02x %02x %02x\n", - slot->curcmd->resp[0], slot->curcmd->resp[1], - slot->curcmd->resp[2], slot->curcmd->resp[3]); + slot->curcmd->resp[0], slot->curcmd->resp[1], + slot->curcmd->resp[2], slot->curcmd->resp[3]); /* If data ready - finish. */ if (slot->data_done) @@ -1441,8 +1440,8 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_d WR2(slot, SDHCI_BLOCK_COUNT, (data->len + 511) / 512); if (sdhci_debug > 1) - slot_printf(slot, "Block size: %02x, count %lu\n", (unsigned int) - SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < 512)?data->len:512), + slot_printf(slot, "Block size: %02x, count %lu\n", + (unsigned int)SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < 512) ? data->len : 512), (unsigned long)(data->len + 511) / 512); } @@ -1657,6 +1656,7 @@ static void sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask) { struct mmc_data *data; + size_t left; if (!slot->curcmd) { slot_printf(slot, "Got data interrupt 0x%08x, but " @@ -1702,7 +1702,6 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intma /* Handle DMA border. */ if (intmask & SDHCI_INT_DMA_END) { data = slot->curcmd->data; - size_t left; /* Unload DMA buffer ... */ left = data->len - slot->offset; @@ -1910,7 +1909,8 @@ sdhci_generic_write_ivar(device_t bus, device_t child, uint32_t clock, max_clock; int i; - slot_printf(slot, "sdhci_generic_write_ivar, var=%d\n", which); + if (sdhci_debug > 1) + slot_printf(slot, "%s: var=%d\n", __func__, which); switch (which) { default: return (EINVAL); @@ -1976,6 +1976,7 @@ sdhci_generic_write_ivar(device_t bus, device_t child, return (0); } +#ifdef MMCCAM /* CAM-related functions */ #include #include @@ -2294,5 +2295,6 @@ sdhci_cam_request(struct sdhci_slot *slot, union ccb * } return (0); } +#endif /* MMCCAM */ MODULE_VERSION(sdhci, 1); Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Mon Jul 10 03:38:12 2017 (r320857) +++ head/sys/dev/sdhci/sdhci.h Mon Jul 10 03:38:17 2017 (r320858) @@ -28,6 +28,8 @@ #ifndef __SDHCI_H__ #define __SDHCI_H__ +#include "opt_mmccam.h" + #define DMA_BLOCK_SIZE 4096 #define DMA_BOUNDARY 0 /* DMA reload every 4K */ @@ -368,12 +370,14 @@ struct sdhci_slot { #define PLATFORM_DATA_STARTED 8 /* Data xfer is handled by platform */ struct mtx mtx; /* Slot mutex */ +#ifdef MMCCAM /* CAM stuff */ union ccb *ccb; struct cam_devq *devq; struct cam_sim *sim; struct mtx sim_mtx; u_char card_present; /* XXX Maybe derive this from elsewhere? */ +#endif }; int sdhci_generic_read_ivar(device_t bus, device_t child, int which, @@ -400,6 +404,9 @@ bool sdhci_generic_get_card_present(device_t brdev, st void sdhci_generic_set_uhs_timing(device_t brdev, struct sdhci_slot *slot); void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present); +#ifdef MMCCAM /* CAM-related */ void sdhci_cam_start_slot(struct sdhci_slot *slot); +#endif + #endif /* __SDHCI_H__ */ From owner-svn-src-head@freebsd.org Mon Jul 10 04:28:29 2017 Return-Path: Delivered-To: svn-src-head@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 701CBD9CE8C; Mon, 10 Jul 2017 04:28:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 350047AC50; Mon, 10 Jul 2017 04:28:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A4SS5j080069; Mon, 10 Jul 2017 04:28:28 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A4SSSI080068; Mon, 10 Jul 2017 04:28:28 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707100428.v6A4SSSI080068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 10 Jul 2017 04:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320859 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 320859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 04:28:29 -0000 Author: ngie Date: Mon Jul 10 04:28:28 2017 New Revision: 320859 URL: https://svnweb.freebsd.org/changeset/base/320859 Log: Fix -Wuninitialized warning with gcc Initialize mmc_data_byte to 0, as it could be used uninitialized later on. MFC with: r320846 Reported by: Jenkins (powerpc jobs) Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Mon Jul 10 03:38:17 2017 (r320858) +++ head/sbin/camcontrol/camcontrol.c Mon Jul 10 04:28:28 2017 (r320859) @@ -7360,7 +7360,7 @@ mmcsdcmd(struct cam_device *device, int argc, char **a int is_highspeed = 0, is_stdspeed = 0; int is_info_request = 0; int flags = 0; - uint8_t mmc_data_byte; + uint8_t mmc_data_byte = 0; /* For IO_RW_EXTENDED command */ uint8_t *mmc_data = NULL; From owner-svn-src-head@freebsd.org Mon Jul 10 05:08:03 2017 Return-Path: Delivered-To: svn-src-head@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 7CF11D9D698; Mon, 10 Jul 2017 05:08:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4B13F7B841; Mon, 10 Jul 2017 05:08:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A582sI096517; Mon, 10 Jul 2017 05:08:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A581rQ096507; Mon, 10 Jul 2017 05:08:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707100508.v6A581rQ096507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 10 Jul 2017 05:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320860 - in head/sys: cam/ata cam/scsi ddb dev/aic7xxx dev/drm dev/isci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam/ata cam/scsi ddb dev/aic7xxx dev/drm dev/isci X-SVN-Commit-Revision: 320860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 05:08:03 -0000 Author: imp Date: Mon Jul 10 05:08:01 2017 New Revision: 320860 URL: https://svnweb.freebsd.org/changeset/base/320860 Log: Include opt files in the kernel with "" instead of <>. Modified: head/sys/cam/ata/ata_all.c head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_enc.c head/sys/cam/scsi/scsi_sa.c head/sys/ddb/db_sym.c head/sys/dev/aic7xxx/aic79xx_osm.h head/sys/dev/aic7xxx/aic7xxx_osm.h head/sys/dev/drm/drmP.h head/sys/dev/isci/environment.h Modified: head/sys/cam/ata/ata_all.c ============================================================================== --- head/sys/cam/ata/ata_all.c Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/cam/ata/ata_all.c Mon Jul 10 05:08:01 2017 (r320860) @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef _KERNEL -#include +#include "opt_scsi.h" #include #include Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/cam/scsi/scsi_all.c Mon Jul 10 05:08:01 2017 (r320860) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef _KERNEL -#include +#include "opt_scsi.h" #include #include Modified: head/sys/cam/scsi/scsi_enc.c ============================================================================== --- head/sys/cam/scsi/scsi_enc.c Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/cam/scsi/scsi_enc.c Mon Jul 10 05:08:01 2017 (r320860) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include "opt_ses.h" MALLOC_DEFINE(M_SCSIENC, "SCSI ENC", "SCSI ENC buffers"); Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/cam/scsi/scsi_sa.c Mon Jul 10 05:08:01 2017 (r320860) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL -#include +#include "opt_sa.h" #ifndef SA_IO_TIMEOUT #define SA_IO_TIMEOUT 32 Modified: head/sys/ddb/db_sym.c ============================================================================== --- head/sys/ddb/db_sym.c Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/ddb/db_sym.c Mon Jul 10 05:08:01 2017 (r320860) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include "opt_ddb.h" /* * Multiple symbol tables Modified: head/sys/dev/aic7xxx/aic79xx_osm.h ============================================================================== --- head/sys/dev/aic7xxx/aic79xx_osm.h Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/dev/aic7xxx/aic79xx_osm.h Mon Jul 10 05:08:01 2017 (r320860) @@ -38,7 +38,7 @@ #ifndef _AIC79XX_FREEBSD_H_ #define _AIC79XX_FREEBSD_H_ -#include /* for config options */ +#include "opt_aic79xx.h" /* for config options */ #include #include Modified: head/sys/dev/aic7xxx/aic7xxx_osm.h ============================================================================== --- head/sys/dev/aic7xxx/aic7xxx_osm.h Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/dev/aic7xxx/aic7xxx_osm.h Mon Jul 10 05:08:01 2017 (r320860) @@ -37,7 +37,7 @@ #ifndef _AIC7XXX_FREEBSD_H_ #define _AIC7XXX_FREEBSD_H_ -#include /* for config options */ +#include "opt_aic7xxx.h" /* for config options */ #include #include Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/dev/drm/drmP.h Mon Jul 10 05:08:01 2017 (r320860) @@ -104,7 +104,7 @@ struct drm_file; #include "dev/drm/drm_internal.h" #include "dev/drm/drm_linux_list.h" -#include +#include "opt_drm.h" #ifdef DRM_DEBUG #undef DRM_DEBUG #define DRM_DEBUG_DEFAULT_ON 1 Modified: head/sys/dev/isci/environment.h ============================================================================== --- head/sys/dev/isci/environment.h Mon Jul 10 04:28:28 2017 (r320859) +++ head/sys/dev/isci/environment.h Mon Jul 10 05:08:01 2017 (r320860) @@ -42,7 +42,7 @@ #include #include #include -#include +#include "opt_isci.h" typedef int8_t S8; typedef uint8_t U8; From owner-svn-src-head@freebsd.org Mon Jul 10 05:16:09 2017 Return-Path: Delivered-To: svn-src-head@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 3E311D9D8BA; Mon, 10 Jul 2017 05:16:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 066977BBFA; Mon, 10 Jul 2017 05:16:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A5G7I1000709; Mon, 10 Jul 2017 05:16:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A5G74p000708; Mon, 10 Jul 2017 05:16:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707100516.v6A5G74p000708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 10 Jul 2017 05:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320861 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 320861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 05:16:09 -0000 Author: ngie Date: Mon Jul 10 05:16:07 2017 New Revision: 320861 URL: https://svnweb.freebsd.org/changeset/base/320861 Log: Fix whitespace bugs - Delete trailing whitespace. - Replace 8 single column spaces with hard tabs. - Delete lines with consisting purely of blank space. - Add space between `return` and `(`, per style(9). Special care was taken to not blindly replace 8 single column spaces with tabs; doing so could break tools that do strict string comparisons with camcontrol output. Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Mon Jul 10 05:08:01 2017 (r320860) +++ head/sbin/camcontrol/camcontrol.c Mon Jul 10 05:16:07 2017 (r320861) @@ -380,14 +380,14 @@ getoption(struct camcontrol_opts *table, char *arg, ui *argnum = opts->argnum; *subopt = opts->subopt; if (++num_matches > 1) - return(CC_OR_AMBIGUOUS); + return (CC_OR_AMBIGUOUS); } } if (num_matches > 0) - return(CC_OR_FOUND); + return (CC_OR_FOUND); else - return(CC_OR_NOT_FOUND); + return (CC_OR_NOT_FOUND); } #ifndef MINIMALISTIC @@ -409,7 +409,7 @@ getdevlist(struct cam_device *device) if (cam_send_ccb(device, ccb) < 0) { perror("error getting device list"); cam_freeccb(ccb); - return(1); + return (1); } status[0] = '\0'; @@ -447,7 +447,7 @@ getdevlist(struct cam_device *device) cam_freeccb(ccb); - return(error); + return (error); } #endif /* MINIMALISTIC */ @@ -476,7 +476,7 @@ getdevtree(int argc, char **argv, char *combinedopt) if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) { warn("couldn't open %s", XPT_DEVICE); - return(1); + return (1); } bzero(&ccb, sizeof(union ccb)); @@ -492,7 +492,7 @@ getdevtree(int argc, char **argv, char *combinedopt) if (ccb.cdm.matches == NULL) { warnx("can't malloc memory for matches"); close(fd); - return(1); + return (1); } ccb.cdm.num_matches = 0; @@ -598,12 +598,12 @@ getdevtree(int argc, char **argv, char *combinedopt) sprintf(tmpstr, "<%s %s>", product, revision); } else if (dev_result->protocol == PROTO_MMCSD) { - if (strlen(dev_result->mmc_ident_data.model) > 0) { - sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model); - } else { - sprintf(tmpstr, "<%s card>", - dev_result->mmc_ident_data.card_features & CARD_FEATURE_SDIO ? "SDIO" : "unknown"); - } + if (strlen(dev_result->mmc_ident_data.model) > 0) { + sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model); + } else { + sprintf(tmpstr, "<%s card>", + dev_result->mmc_ident_data.card_features & CARD_FEATURE_SDIO ? "SDIO" : "unknown"); + } } else if (dev_result->protocol == PROTO_SEMB) { struct sep_identify_data *sid; @@ -675,7 +675,7 @@ getdevtree(int argc, char **argv, char *combinedopt) close(fd); - return(error); + return (error); } #ifndef MINIMALISTIC @@ -711,7 +711,7 @@ testunitready(struct cam_device *device, int task_attr } cam_freeccb(ccb); - return(1); + return (1); } if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { @@ -730,7 +730,7 @@ testunitready(struct cam_device *device, int task_attr cam_freeccb(ccb); - return(error); + return (error); } static int @@ -780,7 +780,7 @@ scsistart(struct cam_device *device, int startstop, in } cam_freeccb(ccb); - return(1); + return (1); } if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) @@ -814,7 +814,7 @@ scsistart(struct cam_device *device, int startstop, in cam_freeccb(ccb); - return(error); + return (error); } int @@ -851,7 +851,7 @@ scsidoinquiry(struct cam_device *device, int argc, cha error = scsiinquiry(device, task_attr, retry_count, timeout); if (error != 0) - return(error); + return (error); if (arglist & CAM_ARG_GET_SERIAL) scsiserial(device, task_attr, retry_count, timeout); @@ -859,7 +859,7 @@ scsidoinquiry(struct cam_device *device, int argc, cha if (arglist & CAM_ARG_GET_XFERRATE) error = camxferrate(device); - return(error); + return (error); } static int @@ -874,7 +874,7 @@ scsiinquiry(struct cam_device *device, int task_attr, if (ccb == NULL) { warnx("couldn't allocate CCB"); - return(1); + return (1); } /* cam_getccb cleans up the header, caller has to zero the payload */ @@ -886,7 +886,7 @@ scsiinquiry(struct cam_device *device, int task_attr, if (inq_buf == NULL) { cam_freeccb(ccb); warnx("can't malloc memory for inquiry\n"); - return(1); + return (1); } bzero(inq_buf, sizeof(*inq_buf)); @@ -949,7 +949,7 @@ scsiinquiry(struct cam_device *device, int task_attr, } cam_freeccb(ccb); - return(1); + return (1); } if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { @@ -965,7 +965,7 @@ scsiinquiry(struct cam_device *device, int task_attr, if (error != 0) { free(inq_buf); - return(error); + return (error); } fprintf(stdout, "%s%d: ", device->device_name, @@ -974,7 +974,7 @@ scsiinquiry(struct cam_device *device, int task_attr, free(inq_buf); - return(0); + return (0); } static int @@ -990,7 +990,7 @@ scsiserial(struct cam_device *device, int task_attr, i if (ccb == NULL) { warnx("couldn't allocate CCB"); - return(1); + return (1); } /* cam_getccb cleans up the header, caller has to zero the payload */ @@ -1002,7 +1002,7 @@ scsiserial(struct cam_device *device, int task_attr, i if (serial_buf == NULL) { cam_freeccb(ccb); warnx("can't malloc memory for serial number"); - return(1); + return (1); } scsi_inquiry(&ccb->csio, @@ -1032,7 +1032,7 @@ scsiserial(struct cam_device *device, int task_attr, i cam_freeccb(ccb); free(serial_buf); - return(1); + return (1); } if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { @@ -1048,7 +1048,7 @@ scsiserial(struct cam_device *device, int task_attr, i if (error != 0) { free(serial_buf); - return(error); + return (error); } bcopy(serial_buf->serial_num, serial_num, serial_buf->length); @@ -1063,7 +1063,7 @@ scsiserial(struct cam_device *device, int task_attr, i free(serial_buf); - return(0); + return (0); } int @@ -1083,7 +1083,7 @@ camxferrate(struct cam_device *device) if (ccb == NULL) { warnx("couldn't allocate CCB"); - return(1); + return (1); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); @@ -1222,13 +1222,13 @@ camxferrate(struct cam_device *device) } } - fprintf(stdout, "\n"); + fprintf(stdout, "\n"); xferrate_bailout: cam_freeccb(ccb); - return(retval); + return (retval); } static void @@ -1251,7 +1251,7 @@ atahpa_print(struct ata_params *parm, u_int64_t hpasiz if (parm->support.command1 & ATA_SUPPORT_PROTECTED) { u_int64_t lba = lbasize48 ? lbasize48 : lbasize; printf("yes %s %ju/%ju\n", (hpasize > lba) ? "yes" : "no ", - lba, hpasize); + lba, hpasize); printf("HPA - Security "); if (parm->support.command1 & ATA_SUPPORT_MAXSECURITY) @@ -3041,8 +3041,7 @@ atasecurity(struct cam_device *device, int retry_count } error = atasecurity_erase(device, ccb, retry_count, - timeout, erase_timeout, &pwd, - quiet); + timeout, erase_timeout, &pwd, quiet); } else { warnx("Can't secure erase (security is disabled)"); error = 1; @@ -3135,7 +3134,7 @@ dorescan_or_reset(int argc, char **argv, int rescan) if (argc < 3) { warnx(must, rescan? "rescan" : "reset"); - return(1); + return (1); } tstr = argv[optind]; @@ -3147,7 +3146,7 @@ dorescan_or_reset(int argc, char **argv, int rescan) rv = parse_btl(argv[optind], &bus, &target, &lun, &arglist); if (rv != 1 && rv != 3) { warnx(must, rescan? "rescan" : "reset"); - return(1); + return (1); } } else { char name[30]; @@ -3255,7 +3254,7 @@ dorescan_or_reset(int argc, char **argv, int rescan) bailout: - return(error); + return (error); } static int @@ -3270,7 +3269,7 @@ rescan_or_reset_bus(path_id_t bus, int rescan) if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) { warnx("error opening transport layer device %s", XPT_DEVICE); warn("%s", XPT_DEVICE); - return(1); + return (1); } ccb = malloc(sizeof(*ccb)); @@ -3435,7 +3434,7 @@ bailout: } free(ccb); - return(retval); + return (retval); } static int @@ -3449,17 +3448,17 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target if (bus == CAM_BUS_WILDCARD) { warnx("invalid bus number %d", bus); - return(1); + return (1); } if (target == CAM_TARGET_WILDCARD) { warnx("invalid target number %d", target); - return(1); + return (1); } if (lun == CAM_LUN_WILDCARD) { warnx("invalid lun number %jx", (uintmax_t)lun); - return(1); + return (1); } fd = -1; @@ -3471,13 +3470,13 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target warnx("error opening transport layer device %s\n", XPT_DEVICE); warn("%s", XPT_DEVICE); - return(1); + return (1); } } else { device = cam_open_btl(bus, target, lun, O_RDWR, NULL); if (device == NULL) { warnx("%s", cam_errbuf); - return(1); + return (1); } } @@ -3495,13 +3494,13 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target if (ioctl(fd, CAMIOCOMMAND, &ccb) < 0) { warn("CAMIOCOMMAND ioctl failed"); close(fd); - return(1); + return (1); } } else { if (cam_send_ccb(device, &ccb) < 0) { warn("error sending XPT_RESET_DEV CCB"); cam_close_device(device); - return(1); + return (1); } } @@ -3518,12 +3517,12 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target && ((ccb.ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT))) { fprintf(stdout, "%s of %d:%d:%jx was successful\n", scan? "Re-scan" : "Reset", bus, target, (uintmax_t)lun); - return(0); + return (0); } else { fprintf(stdout, "%s of %d:%d:%jx returned error %#x\n", scan? "Re-scan" : "Reset", bus, target, (uintmax_t)lun, ccb.ccb_h.status & CAM_STATUS_MASK); - return(1); + return (1); } } @@ -3755,7 +3754,7 @@ next_batch: error = 1; goto defect_bailout; break; - } + } max_possible_size = (hdr_max / entry_size) * entry_size; num_returned = returned_length / entry_size; @@ -4101,7 +4100,7 @@ defect_bailout: if (ccb != NULL) cam_freeccb(ccb); - return(error); + return (error); } #endif /* MINIMALISTIC */ @@ -4302,7 +4301,7 @@ scsicmd(struct cam_device *device, int argc, char **ar if (ccb == NULL) { warnx("scsicmd: error allocating ccb"); - return(1); + return (1); } CCB_CLEAR_ALL_EXCEPT_HDR(ccb); @@ -4502,7 +4501,7 @@ scsicmd(struct cam_device *device, int argc, char **ar case 3: case 6: case 7: - /* computed by buff_encode_visit */ + /* computed by buff_encode_visit */ break; case 4: cdb_len = 16; @@ -4631,7 +4630,7 @@ scsicmd_bailout: cam_freeccb(ccb); - return(error); + return (error); } static int @@ -4685,7 +4684,7 @@ camdebug(int argc, char **argv, char *combinedopt) if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) { warnx("error opening transport layer device %s", XPT_DEVICE); warn("%s", XPT_DEVICE); - return(1); + return (1); } argc -= optind; argv += optind; @@ -4694,7 +4693,7 @@ camdebug(int argc, char **argv, char *combinedopt) warnx("you must specify \"off\", \"all\" or a bus,"); warnx("bus:target, or bus:target:lun"); close(fd); - return(1); + return (1); } tstr = *argv; @@ -4768,7 +4767,7 @@ camdebug(int argc, char **argv, char *combinedopt) close(fd); } - return(error); + return (error); } static int @@ -4786,7 +4785,7 @@ tagcontrol(struct cam_device *device, int argc, char * if (ccb == NULL) { warnx("tagcontrol: error allocating ccb"); - return(1); + return (1); } while ((c = getopt(argc, argv, combinedopt)) != -1) { @@ -4882,7 +4881,7 @@ tagcontrol(struct cam_device *device, int argc, char * tagcontrol_bailout: cam_freeccb(ccb); - return(retval); + return (retval); } static void @@ -5035,7 +5034,7 @@ get_cpi(struct cam_device *device, struct ccb_pathinq ccb = cam_getccb(device); if (ccb == NULL) { warnx("get_cpi: couldn't allocate CCB"); - return(1); + return (1); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi); ccb->ccb_h.func_code = XPT_PATH_INQ; @@ -5058,7 +5057,7 @@ get_cpi(struct cam_device *device, struct ccb_pathinq get_cpi_bailout: cam_freeccb(ccb); - return(retval); + return (retval); } /* @@ -5073,7 +5072,7 @@ get_cgd(struct cam_device *device, struct ccb_getdev * ccb = cam_getccb(device); if (ccb == NULL) { warnx("get_cgd: couldn't allocate CCB"); - return(1); + return (1); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd); ccb->ccb_h.func_code = XPT_GDEV_TYPE; @@ -5096,7 +5095,7 @@ get_cgd(struct cam_device *device, struct ccb_getdev * get_cgd_bailout: cam_freeccb(ccb); - return(retval); + return (retval); } /* @@ -5118,7 +5117,7 @@ dev_has_vpd_page(struct cam_device *dev, uint8_t page_ retval = -1; goto bailout; } - + /* cam_getccb cleans up the header, caller has to zero the payload */ CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); @@ -5165,7 +5164,7 @@ dev_has_vpd_page(struct cam_device *dev, uint8_t page_ bailout: if (ccb != NULL) cam_freeccb(ccb); - + return (retval); } @@ -5195,7 +5194,7 @@ get_device_type(struct cam_device *dev, int retry_coun break; /*NOTREACHED*/ default: *devtype = CC_DT_UNKNOWN; - goto bailout; + goto bailout; break; /*NOTREACHED*/ } @@ -5270,7 +5269,7 @@ build_ata_cmd(union ccb *ccb, uint32_t retry_count, ui /*protocol*/ protocol, /*ata_flags*/ ata_flags, /*features*/ features, - /*sector_count*/ sector_count, + /*sector_count*/ sector_count, /*lba*/ lba, /*command*/ command, /*device*/ 0, @@ -5302,7 +5301,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, /* * In this case, we have SCSI ATA PASS-THROUGH command, 12 - * or 16 byte, and need to see what + * or 16 byte, and need to see what */ if (ccb->ccb_h.flags & CAM_CDB_POINTER) opcode = ccb->csio.cdb_io.cdb_ptr[0]; @@ -5352,7 +5351,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, ((uint64_t)desc->lba_31_24 << 24) | (desc->lba_23_16 << 16) | (desc->lba_15_8 << 8) | - desc->lba_7_0; + desc->lba_7_0; *device = desc->device; *status = desc->status; @@ -5403,7 +5402,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, res = &ccb->ataio.res; *error = res->error; *status = res->status; - *device = res->device; + *device = res->device; *count = res->sector_count; *lba = (res->lba_high << 16) | (res->lba_mid << 8) | @@ -5603,7 +5602,7 @@ get_print_cts(struct cam_device *device, int user_sett if (ccb == NULL) { warnx("get_print_cts: error allocating ccb"); - return(1); + return (1); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); @@ -5643,7 +5642,7 @@ get_print_cts_bailout: cam_freeccb(ccb); - return(retval); + return (retval); } static int @@ -5666,7 +5665,7 @@ ratecontrol(struct cam_device *device, int task_attr, ccb = cam_getccb(device); if (ccb == NULL) { warnx("ratecontrol: error allocating ccb"); - return(1); + return (1); } while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c){ @@ -5998,7 +5997,7 @@ ratecontrol(struct cam_device *device, int task_attr, ratecontrol_bailout: cam_freeccb(ccb); - return(retval); + return (retval); } static int @@ -6022,7 +6021,7 @@ scsiformat(struct cam_device *device, int argc, char * if (ccb == NULL) { warnx("scsiformat: error allocating ccb"); - return(1); + return (1); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); @@ -6288,7 +6287,7 @@ scsiformat_bailout: cam_freeccb(ccb); - return(error); + return (error); } static int @@ -6317,7 +6316,7 @@ scsisanitize(struct cam_device *device, int argc, char if (ccb == NULL) { warnx("scsisanitize: error allocating ccb"); - return(1); + return (1); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); @@ -6698,7 +6697,7 @@ scsisanitize_bailout: free(data_ptr); cam_freeccb(ccb); - return(error); + return (error); } static int @@ -7328,7 +7327,7 @@ smpcmd(struct cam_device *device, int argc, char **arg } else if ((amt_written == 0) && (amt_to_write > 0)) { warnx("only wrote %u bytes out of %u", - response_size - amt_to_write, + response_size - amt_to_write, response_size); } } @@ -7352,19 +7351,19 @@ mmcsdcmd(struct cam_device *device, int argc, char **a { int c, error = 0; union ccb *ccb; - int32_t mmc_opcode = 0, mmc_arg = 0; - int32_t mmc_flags = -1; + int32_t mmc_opcode = 0, mmc_arg = 0; + int32_t mmc_flags = -1; int retval; - int is_write = 0; - int is_bw_4 = 0, is_bw_1 = 0; - int is_highspeed = 0, is_stdspeed = 0; + int is_write = 0; + int is_bw_4 = 0, is_bw_1 = 0; + int is_highspeed = 0, is_stdspeed = 0; int is_info_request = 0; int flags = 0; - uint8_t mmc_data_byte = 0; + uint8_t mmc_data_byte = 0; - /* For IO_RW_EXTENDED command */ + /* For IO_RW_EXTENDED command */ uint8_t *mmc_data = NULL; - struct mmc_data mmc_d; + struct mmc_data mmc_d; int mmc_data_len = 0; /* @@ -7382,143 +7381,143 @@ mmcsdcmd(struct cam_device *device, int argc, char **a while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { - case '4': - is_bw_4 = 1; - break; - case '1': - is_bw_1 = 1; - break; - case 'S': - if (!strcmp(optarg, "high")) - is_highspeed = 1; - else - is_stdspeed = 1; - break; + case '4': + is_bw_4 = 1; + break; + case '1': + is_bw_1 = 1; + break; + case 'S': + if (!strcmp(optarg, "high")) + is_highspeed = 1; + else + is_stdspeed = 1; + break; case 'I': is_info_request = 1; break; - case 'c': - mmc_opcode = strtol(optarg, NULL, 0); + case 'c': + mmc_opcode = strtol(optarg, NULL, 0); if (mmc_opcode < 0) { warnx("invalid MMC opcode %d", mmc_opcode); error = 1; goto mmccmd_bailout; } - break; - case 'a': - mmc_arg = strtol(optarg, NULL, 0); + break; + case 'a': + mmc_arg = strtol(optarg, NULL, 0); if (mmc_arg < 0) { warnx("invalid MMC arg %d", mmc_arg); error = 1; goto mmccmd_bailout; } - break; - case 'f': - mmc_flags = strtol(optarg, NULL, 0); + break; + case 'f': + mmc_flags = strtol(optarg, NULL, 0); if (mmc_flags < 0) { warnx("invalid MMC flags %d", mmc_flags); error = 1; goto mmccmd_bailout; } - break; - case 'l': - mmc_data_len = strtol(optarg, NULL, 0); + break; + case 'l': + mmc_data_len = strtol(optarg, NULL, 0); if (mmc_data_len <= 0) { warnx("invalid MMC data len %d", mmc_data_len); error = 1; goto mmccmd_bailout; } - break; - case 'W': - is_write = 1; - break; - case 'b': - mmc_data_byte = strtol(optarg, NULL, 0); - break; + break; + case 'W': + is_write = 1; + break; + case 'b': + mmc_data_byte = strtol(optarg, NULL, 0); + break; default: break; } } flags |= CAM_DEV_QFRZDIS; /* masks are broken?! */ - /* If flags are left default, supply the right flags */ - if (mmc_flags < 0) - switch (mmc_opcode) { - case MMC_GO_IDLE_STATE: - mmc_flags = MMC_RSP_NONE | MMC_CMD_BC; - break; - case IO_SEND_OP_COND: - mmc_flags = MMC_RSP_R4; - break; - case SD_SEND_RELATIVE_ADDR: - mmc_flags = MMC_RSP_R6 | MMC_CMD_BCR; - break; - case MMC_SELECT_CARD: - mmc_flags = MMC_RSP_R1B | MMC_CMD_AC; - mmc_arg = mmc_arg << 16; - break; - case SD_IO_RW_DIRECT: - mmc_flags = MMC_RSP_R5 | MMC_CMD_AC; - mmc_arg = SD_IO_RW_ADR(mmc_arg); - if (is_write) - mmc_arg |= SD_IO_RW_WR | SD_IO_RW_RAW | SD_IO_RW_DAT(mmc_data_byte); - break; - case SD_IO_RW_EXTENDED: - mmc_flags = MMC_RSP_R5 | MMC_CMD_ADTC; - mmc_arg = SD_IO_RW_ADR(mmc_arg); - int len_arg = mmc_data_len; - if (mmc_data_len == 512) - len_arg = 0; + /* If flags are left default, supply the right flags */ + if (mmc_flags < 0) + switch (mmc_opcode) { + case MMC_GO_IDLE_STATE: + mmc_flags = MMC_RSP_NONE | MMC_CMD_BC; + break; + case IO_SEND_OP_COND: + mmc_flags = MMC_RSP_R4; + break; + case SD_SEND_RELATIVE_ADDR: + mmc_flags = MMC_RSP_R6 | MMC_CMD_BCR; + break; + case MMC_SELECT_CARD: + mmc_flags = MMC_RSP_R1B | MMC_CMD_AC; + mmc_arg = mmc_arg << 16; + break; + case SD_IO_RW_DIRECT: + mmc_flags = MMC_RSP_R5 | MMC_CMD_AC; + mmc_arg = SD_IO_RW_ADR(mmc_arg); + if (is_write) + mmc_arg |= SD_IO_RW_WR | SD_IO_RW_RAW | SD_IO_RW_DAT(mmc_data_byte); + break; + case SD_IO_RW_EXTENDED: + mmc_flags = MMC_RSP_R5 | MMC_CMD_ADTC; + mmc_arg = SD_IO_RW_ADR(mmc_arg); + int len_arg = mmc_data_len; + if (mmc_data_len == 512) + len_arg = 0; - // Byte mode - mmc_arg |= SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR; - // Block mode + // Byte mode + mmc_arg |= SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR; + // Block mode // mmc_arg |= SD_IOE_RW_BLK | SD_IOE_RW_LEN(len_arg) | SD_IO_RW_INCR; - break; - default: - mmc_flags = MMC_RSP_R1; - break; - } + break; + default: + mmc_flags = MMC_RSP_R1; + break; + } - // Switch bus width instead of sending IO command - if (is_bw_4 || is_bw_1) { - struct ccb_trans_settings_mmc *cts; - ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - ccb->ccb_h.flags = 0; - cts = &ccb->cts.proto_specific.mmc; - cts->ios.bus_width = is_bw_4 == 1 ? bus_width_4 : bus_width_1; - cts->ios_valid = MMC_BW; - if (((retval = cam_send_ccb(device, ccb)) < 0) - || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - warn("Error sending command"); - } else { - printf("Parameters set OK\n"); - } - cam_freeccb(ccb); - return (retval); - } + // Switch bus width instead of sending IO command + if (is_bw_4 || is_bw_1) { + struct ccb_trans_settings_mmc *cts; + ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + ccb->ccb_h.flags = 0; + cts = &ccb->cts.proto_specific.mmc; + cts->ios.bus_width = is_bw_4 == 1 ? bus_width_4 : bus_width_1; + cts->ios_valid = MMC_BW; + if (((retval = cam_send_ccb(device, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + warn("Error sending command"); + } else { + printf("Parameters set OK\n"); + } + cam_freeccb(ccb); + return (retval); + } - // Switch bus speed instead of sending IO command - if (is_stdspeed || is_highspeed) { - struct ccb_trans_settings_mmc *cts; - ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - ccb->ccb_h.flags = 0; - cts = &ccb->cts.proto_specific.mmc; - cts->ios.timing = is_highspeed == 1 ? bus_timing_hs : bus_timing_normal; - cts->ios_valid = MMC_BT; - if (((retval = cam_send_ccb(device, ccb)) < 0) - || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - warn("Error sending command"); - } else { - printf("Speed set OK (HS: %d)\n", is_highspeed); - } - cam_freeccb(ccb); - return (retval); - } + // Switch bus speed instead of sending IO command + if (is_stdspeed || is_highspeed) { + struct ccb_trans_settings_mmc *cts; + ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + ccb->ccb_h.flags = 0; + cts = &ccb->cts.proto_specific.mmc; + cts->ios.timing = is_highspeed == 1 ? bus_timing_hs : bus_timing_normal; + cts->ios_valid = MMC_BT; + if (((retval = cam_send_ccb(device, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + warn("Error sending command"); + } else { + printf("Speed set OK (HS: %d)\n", is_highspeed); + } + cam_freeccb(ccb); + return (retval); + } // Get information about controller and its settings if (is_info_request) { @@ -7560,16 +7559,16 @@ mmcsdcmd(struct cam_device *device, int argc, char **a return (0); } - printf("CMD %d arg %d flags %02x\n", mmc_opcode, mmc_arg, mmc_flags); + printf("CMD %d arg %d flags %02x\n", mmc_opcode, mmc_arg, mmc_flags); - if (mmc_data_len > 0) { - flags |= CAM_DIR_IN; - mmc_data = malloc(mmc_data_len); - memset(mmc_data, 0, mmc_data_len); - mmc_d.len = mmc_data_len; - mmc_d.data = mmc_data; - mmc_d.flags = MMC_DATA_READ; - } else flags |= CAM_DIR_NONE; + if (mmc_data_len > 0) { + flags |= CAM_DIR_IN; + mmc_data = malloc(mmc_data_len); + memset(mmc_data, 0, mmc_data_len); + mmc_d.len = mmc_data_len; + mmc_d.data = mmc_data; + mmc_d.flags = MMC_DATA_READ; + } else flags |= CAM_DIR_NONE; cam_fill_mmcio(&ccb->mmcio, /*retries*/ retry_count, @@ -7597,36 +7596,35 @@ mmcsdcmd(struct cam_device *device, int argc, char **a } if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)) { - printf("MMCIO: error %d, %08x %08x %08x %08x\n", - ccb->mmcio.cmd.error, ccb->mmcio.cmd.resp[0], - ccb->mmcio.cmd.resp[1], - ccb->mmcio.cmd.resp[2], - ccb->mmcio.cmd.resp[3]); + printf("MMCIO: error %d, %08x %08x %08x %08x\n", + ccb->mmcio.cmd.error, ccb->mmcio.cmd.resp[0], + ccb->mmcio.cmd.resp[1], + ccb->mmcio.cmd.resp[2], + ccb->mmcio.cmd.resp[3]); - switch (mmc_opcode) { - case SD_IO_RW_DIRECT: - printf("IO_RW_DIRECT: resp byte %02x, cur state %d\n", - SD_R5_DATA(ccb->mmcio.cmd.resp), - (ccb->mmcio.cmd.resp[0] >> 12) & 0x3 - ); - break; - case SD_IO_RW_EXTENDED: - printf("IO_RW_EXTENDED: read %d bytes w/o error:\n", mmc_data_len); - hexdump(mmc_data, mmc_data_len, NULL, 0); - break; - case SD_SEND_RELATIVE_ADDR: - printf("SEND_RELATIVE_ADDR: published RCA %02x\n", ccb->mmcio.cmd.resp[0] >> 16); - break; - default: - printf("No command-specific decoder for CMD %d\n", mmc_opcode); - } + switch (mmc_opcode) { + case SD_IO_RW_DIRECT: + printf("IO_RW_DIRECT: resp byte %02x, cur state %d\n", + SD_R5_DATA(ccb->mmcio.cmd.resp), + (ccb->mmcio.cmd.resp[0] >> 12) & 0x3); + break; + case SD_IO_RW_EXTENDED: + printf("IO_RW_EXTENDED: read %d bytes w/o error:\n", mmc_data_len); + hexdump(mmc_data, mmc_data_len, NULL, 0); + break; + case SD_SEND_RELATIVE_ADDR: + printf("SEND_RELATIVE_ADDR: published RCA %02x\n", ccb->mmcio.cmd.resp[0] >> 16); + break; + default: + printf("No command-specific decoder for CMD %d\n", mmc_opcode); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Jul 10 06:25:31 2017 Return-Path: Delivered-To: svn-src-head@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 DC1A1D9EFE2; Mon, 10 Jul 2017 06:25:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9B3EE7DB36; Mon, 10 Jul 2017 06:25:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A6PUVB029555; Mon, 10 Jul 2017 06:25:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A6PU4T029554; Mon, 10 Jul 2017 06:25:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201707100625.v6A6PU4T029554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 10 Jul 2017 06:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320865 - head/sys/dev/isp X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/isp X-SVN-Commit-Revision: 320865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 06:25:32 -0000 Author: mav Date: Mon Jul 10 06:25:30 2017 New Revision: 320865 URL: https://svnweb.freebsd.org/changeset/base/320865 Log: "Port Type not registered" is not a real error for GIT_PT. Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Mon Jul 10 06:08:44 2017 (r320864) +++ head/sys/dev/isp/isp.c Mon Jul 10 06:25:30 2017 (r320865) @@ -3783,7 +3783,10 @@ fail: goto abort; if (rs->snscb_cthdr.ct_cmd_resp != LS_ACC) { int level; - if (rs->snscb_cthdr.ct_reason == 9 && rs->snscb_cthdr.ct_explanation == 7) { + /* FC-4 Type and Port Type not registered are not errors. */ + if (rs->snscb_cthdr.ct_reason == 9 && + (rs->snscb_cthdr.ct_explanation == 0x07 || + rs->snscb_cthdr.ct_explanation == 0x0a)) { level = ISP_LOG_SANCFG; } else { level = ISP_LOGWARN; From owner-svn-src-head@freebsd.org Mon Jul 10 08:10:46 2017 Return-Path: Delivered-To: svn-src-head@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 B49D7DA07BA; Mon, 10 Jul 2017 08:10:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 847C27FFC1; Mon, 10 Jul 2017 08:10:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A8AjS8070662; Mon, 10 Jul 2017 08:10:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A8Aj6b070661; Mon, 10 Jul 2017 08:10:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707100810.v6A8Aj6b070661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Jul 2017 08:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320868 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 320868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 08:10:46 -0000 Author: kib Date: Mon Jul 10 08:10:45 2017 New Revision: 320868 URL: https://svnweb.freebsd.org/changeset/base/320868 Log: Fix warnings, adjust style. Reviewed by: bdrewery, dim, emaste (as part of D11504) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libc/gen/dlfcn.c Modified: head/lib/libc/gen/dlfcn.c ============================================================================== --- head/lib/libc/gen/dlfcn.c Mon Jul 10 07:12:59 2017 (r320867) +++ head/lib/libc/gen/dlfcn.c Mon Jul 10 08:10:45 2017 (r320868) @@ -57,92 +57,103 @@ void _rtld_atfork_post(int *); #pragma weak _rtld_error void -_rtld_error(const char *fmt, ...) +_rtld_error(const char *fmt __unused, ...) { } #pragma weak dladdr int -dladdr(const void *addr, Dl_info *dlip) +dladdr(const void *addr __unused, Dl_info *dlip __unused) { + _rtld_error(sorry); - return 0; + return (0); } #pragma weak dlclose int -dlclose(void *handle) +dlclose(void *handle __unused) { + _rtld_error(sorry); - return -1; + return (-1); } #pragma weak dlerror char * dlerror(void) { - return sorry; + + return (sorry); } #pragma weak dllockinit void dllockinit(void *context, - void *(*lock_create)(void *context), - void (*rlock_acquire)(void *lock), - void (*wlock_acquire)(void *lock), - void (*lock_release)(void *lock), - void (*lock_destroy)(void *lock), - void (*context_destroy)(void *context)) + void *(*lock_create)(void *context) __unused, + void (*rlock_acquire)(void *lock) __unused, + void (*wlock_acquire)(void *lock) __unused, + void (*lock_release)(void *lock) __unused, + void (*lock_destroy)(void *lock) __unused, + void (*context_destroy)(void *context) __unused) { + if (context_destroy != NULL) context_destroy(context); } #pragma weak dlopen void * -dlopen(const char *name, int mode) +dlopen(const char *name __unused, int mode __unused) { + _rtld_error(sorry); - return NULL; + return (NULL); } #pragma weak dlsym void * -dlsym(void * __restrict handle, const char * __restrict name) +dlsym(void * __restrict handle __unused, const char * __restrict name __unused) { + _rtld_error(sorry); - return NULL; + return (NULL); } #pragma weak dlfunc dlfunc_t -dlfunc(void * __restrict handle, const char * __restrict name) +dlfunc(void * __restrict handle __unused, const char * __restrict name __unused) { + _rtld_error(sorry); - return NULL; + return (NULL); } #pragma weak dlvsym void * -dlvsym(void * __restrict handle, const char * __restrict name, - const char * __restrict version) +dlvsym(void * __restrict handle __unused, const char * __restrict name __unused, + const char * __restrict version __unused) { + _rtld_error(sorry); - return NULL; + return (NULL); } #pragma weak dlinfo int -dlinfo(void * __restrict handle, int request, void * __restrict p) +dlinfo(void * __restrict handle __unused, int request __unused, + void * __restrict p __unused) { + _rtld_error(sorry); - return 0; + return (0); } #pragma weak _rtld_thread_init void -_rtld_thread_init(void * li) +_rtld_thread_init(void *li __unused) { + _rtld_error(sorry); } @@ -184,8 +195,8 @@ dl_init_phdr_info(void) #pragma weak dl_iterate_phdr int -dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *), - void *data) +dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *) __unused, + void *data __unused) { __init_elf_aux_vector(); @@ -197,28 +208,29 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, #pragma weak fdlopen void * -fdlopen(int fd, int mode) +fdlopen(int fd __unused, int mode __unused) { _rtld_error(sorry); - return NULL; + return (NULL); } #pragma weak _rtld_atfork_pre void -_rtld_atfork_pre(int *locks) +_rtld_atfork_pre(int *locks __unused) { } #pragma weak _rtld_atfork_post void -_rtld_atfork_post(int *locks) +_rtld_atfork_post(int *locks __unused) { } #pragma weak _rtld_addr_phdr int -_rtld_addr_phdr(const void *addr, struct dl_phdr_info *phdr_info) +_rtld_addr_phdr(const void *addr __unused, + struct dl_phdr_info *phdr_info_a __unused) { return (0); @@ -234,7 +246,7 @@ _rtld_get_stack_prot(void) #pragma weak _rtld_is_dlopened int -_rtld_is_dlopened(void *arg) +_rtld_is_dlopened(void *arg __unused) { return (0); From owner-svn-src-head@freebsd.org Mon Jul 10 09:00:36 2017 Return-Path: Delivered-To: svn-src-head@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 71855DA1856; Mon, 10 Jul 2017 09:00:36 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 398F081588; Mon, 10 Jul 2017 09:00:36 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A90Z2o091652; Mon, 10 Jul 2017 09:00:35 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A90ZPe091651; Mon, 10 Jul 2017 09:00:35 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201707100900.v6A90ZPe091651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Mon, 10 Jul 2017 09:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320869 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 320869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 09:00:36 -0000 Author: bde Date: Mon Jul 10 09:00:35 2017 New Revision: 320869 URL: https://svnweb.freebsd.org/changeset/base/320869 Log: Fix attribute flipping for cut marking in pixel mode. The text-mode code was used, so the lightness bit was not flipped, so the flipping was unnecessarily null in some cases. E.g., the unusal color scheme of lightwhite on white (white = lightgrey in kernelspeak) is not completely unusable, except null flipping of it gave no visible marks for cut marking. Now flipping it works in pixel mode only. Fix text cursor attribute adjustment over cut marking in text mode for the usual cursor type (non-blinking full block). Apply the flipping for cut marking first and adjust that instead of vice versa. This gives a uniform color scheme for the usual text cursor type in text mode: a white block background with no change to the character foreground except for variations to avoid collisions. The old order gave a white character fg with no change in the bg in non-colliding cases. Versions before r316636 changed the bg to the non-cut-marked one about half the time using a saveunder bug; this accidentally gave something resembling a block cursor half the time. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Mon Jul 10 08:10:45 2017 (r320868) +++ head/sys/dev/syscons/scvgarndr.c Mon Jul 10 09:00:35 2017 (r320869) @@ -534,9 +534,9 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u } else #endif /* SC_NO_FONT_LOADING */ { - a = vga_cursorattr_adj(a, TRUE); if (flip) a = vga_flipattr(a, TRUE); + a = vga_cursorattr_adj(a, TRUE); sc_vtb_putc(&scp->scr, at, c, a); } } @@ -903,7 +903,7 @@ vga_vgadraw_direct(scr_stat *scp, int from, int count, a = sc_vtb_geta(&scp->vtb, i); if (flip) - a = vga_flipattr(a, TRUE); /* XXX */ + a = vga_flipattr(a, FALSE); col1 = (a & 0x0f00) >> 8; col2 = (a & 0xf000) >> 12; @@ -957,7 +957,7 @@ vga_vgadraw_planar(scr_stat *scp, int from, int count, for (i = from; count-- > 0; ++i) { a = sc_vtb_geta(&scp->vtb, i); if (flip) - a = vga_flipattr(a, TRUE); /* XXX */ + a = vga_flipattr(a, FALSE); col1 = a & 0x0f00; col2 = (a & 0xf000) >> 4; /* set background color in EGA/VGA latch */ From owner-svn-src-head@freebsd.org Mon Jul 10 14:59:23 2017 Return-Path: Delivered-To: svn-src-head@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 2DAA5DAA1CB; Mon, 10 Jul 2017 14:59:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DFFD96770D; Mon, 10 Jul 2017 14:59:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6AExMgN039222; Mon, 10 Jul 2017 14:59:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6AExL7N039212; Mon, 10 Jul 2017 14:59:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707101459.v6AExL7N039212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Jul 2017 14:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320872 - in head: contrib/mdocml lib lib/libc/gen lib/libdl share/mk X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: contrib/mdocml lib lib/libc/gen lib/libdl share/mk X-SVN-Commit-Revision: 320872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 14:59:23 -0000 Author: kib Date: Mon Jul 10 14:59:21 2017 New Revision: 320872 URL: https://svnweb.freebsd.org/changeset/base/320872 Log: Provide libdl. Create libdl.so.1 as a filter for libc.so.7 which exports public dl* functions. The functions are resolved from the rtld instead, the goal of creating library is to avoid errors from the static linker due to missed libdl. For static binaries, an empty .o is compiled into libdl.a so that static binaries still get dl stubs from libc.a. Right now lld cannot create filter objects, disable libdl on arm64 when binutils are not used. Reviewed by: bdrewery, dim (previos version); emaste Exp run: PR 220525, done by antoine Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D11504 Added: head/lib/libdl/ head/lib/libdl/Makefile (contents, props changed) head/lib/libdl/Symbol.map (contents, props changed) Modified: head/contrib/mdocml/lib.in head/lib/Makefile head/lib/libc/gen/dlfcn.c head/lib/libc/gen/dlopen.3 head/share/mk/bsd.libnames.mk head/share/mk/bsd.linker.mk head/share/mk/src.libnames.mk Modified: head/contrib/mdocml/lib.in ============================================================================== --- head/contrib/mdocml/lib.in Mon Jul 10 12:52:18 2017 (r320871) +++ head/contrib/mdocml/lib.in Mon Jul 10 14:59:21 2017 (r320872) @@ -46,6 +46,7 @@ LINE("libdevctl", "Device Control Library (libdevctl, LINE("libdevinfo", "Device and Resource Information Utility Library (libdevinfo, \\-ldevinfo)") LINE("libdevstat", "Device Statistics Library (libdevstat, \\-ldevstat)") LINE("libdisk", "Interface to Slice and Partition Labels Library (libdisk, \\-ldisk)") +LINE("libdl", "Dynamic Linker Services Filter (libdl, \\-ldl)") LINE("libdm", "Device Mapper Library (libdm, \\-ldm)") LINE("libdwarf", "DWARF Access Library (libdwarf, \\-ldwarf)") LINE("libedit", "Command Line Editor Library (libedit, \\-ledit)") Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Mon Jul 10 12:52:18 2017 (r320871) +++ head/lib/Makefile Mon Jul 10 14:59:21 2017 (r320872) @@ -40,6 +40,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libdevctl \ libdevinfo \ libdevstat \ + ${_libdl} \ libdwarf \ libedit \ libevent \ @@ -181,6 +182,10 @@ SUBDIR.${MK_BHYVE}+= libvmmapi .if ${MACHINE_CPUARCH} != "sparc64" _libproc= libproc _librtld_db= librtld_db +.endif + +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mfilter} +_libdl= libdl .endif SUBDIR.${MK_OPENSSL}+= libmp Modified: head/lib/libc/gen/dlfcn.c ============================================================================== --- head/lib/libc/gen/dlfcn.c Mon Jul 10 12:52:18 2017 (r320871) +++ head/lib/libc/gen/dlfcn.c Mon Jul 10 14:59:21 2017 (r320872) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#if !defined(IN_LIBDL) || defined(PIC) + /* * Linkage to services provided by the dynamic linker. */ @@ -157,6 +159,7 @@ _rtld_thread_init(void *li __unused) _rtld_error(sorry); } +#ifndef IN_LIBDL static pthread_once_t dl_phdr_info_once = PTHREAD_ONCE_INIT; static struct dl_phdr_info phdr_info; @@ -192,6 +195,7 @@ dl_init_phdr_info(void) } phdr_info.dlpi_adds = 1; } +#endif #pragma weak dl_iterate_phdr int @@ -199,11 +203,15 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, void *data __unused) { +#ifndef IN_LIBDL __init_elf_aux_vector(); if (__elf_aux_vector == NULL) return (1); _once(&dl_phdr_info_once, dl_init_phdr_info); return (callback(&phdr_info, sizeof(phdr_info), data)); +#else + return (0); +#endif } #pragma weak fdlopen @@ -251,3 +259,5 @@ _rtld_is_dlopened(void *arg __unused) return (0); } + +#endif /* !defined(IN_LIBDL) || defined(PIC) */ Modified: head/lib/libc/gen/dlopen.3 ============================================================================== --- head/lib/libc/gen/dlopen.3 Mon Jul 10 12:52:18 2017 (r320871) +++ head/lib/libc/gen/dlopen.3 Mon Jul 10 14:59:21 2017 (r320872) @@ -32,7 +32,7 @@ .\" @(#) dlopen.3 1.6 90/01/31 SMI .\" $FreeBSD$ .\" -.Dd February 14, 2015 +.Dd July 7, 2017 .Dt DLOPEN 3 .Os .Sh NAME @@ -376,6 +376,14 @@ option to .Xr ld 1 for symbols defined in the executable to become visible to .Fn dlsym . +.Pp +Other ELF platforms require linking with +.Lb libdl +to provide +.Fn dlopen +and other functions. +.Fx +does not require linking with the library, but supports it for compatibility. .Pp In previous implementations, it was necessary to prepend an underscore to all external symbols in order to gain symbol Added: head/lib/libdl/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libdl/Makefile Mon Jul 10 14:59:21 2017 (r320872) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +LIB=dl +SHLIB_MAJOR=1 + +.PATH: ${SRCTOP}/lib/libc/gen +CFLAGS+=-I${SRCTOP}/lib/libc/include +CFLAGS+=-DIN_LIBDL +LDFLAGS+=-Wl,-F,libc.so.7 +VERSION_DEF=${SRCTOP}/lib/libc/Versions.def +SYMBOL_MAPS=${.CURDIR}/Symbol.map + +SRCS = dlfcn.c + +.include Added: head/lib/libdl/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libdl/Symbol.map Mon Jul 10 14:59:21 2017 (r320872) @@ -0,0 +1,20 @@ +/* + * $FreeBSD$ + */ + +FBSD_1.0 { + dladdr; + dlclose; + dlerror; + dlfunc; + dlopen; + dlsym; + dlvsym; + dlinfo; + dl_iterate_phdr; +}; + + +FBSD_1.3 { + fdlopen; +}; Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Mon Jul 10 12:52:18 2017 (r320871) +++ head/share/mk/bsd.libnames.mk Mon Jul 10 14:59:21 2017 (r320872) @@ -56,6 +56,7 @@ LIBDEVDCTL?= ${LIBDESTDIR}${LIBDIR_BASE}/libdevdctl.a LIBDEVINFO?= ${LIBDESTDIR}${LIBDIR_BASE}/libdevinfo.a LIBDEVSTAT?= ${LIBDESTDIR}${LIBDIR_BASE}/libdevstat.a LIBDIALOG?= ${LIBDESTDIR}${LIBDIR_BASE}/libdialog.a +LIBDL?= ${LIBDESTDIR}${LIBDIR_BASE}/libdl.a LIBDNS?= ${LIBDESTDIR}${LIBDIR_BASE}/libdns.a LIBDPV?= ${LIBDESTDIR}${LIBDIR_BASE}/libdpv.a LIBDTRACE?= ${LIBDESTDIR}${LIBDIR_BASE}/libdtrace.a Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Mon Jul 10 12:52:18 2017 (r320871) +++ head/share/mk/bsd.linker.mk Mon Jul 10 14:59:21 2017 (r320872) @@ -70,6 +70,9 @@ ${X_}LINKER_FEATURES= .if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750 ${X_}LINKER_FEATURES+= build-id .endif +.if ${${X_}LINKER_TYPE} == "bfd" +${X_}LINKER_FEATURES+= filter +.endif .endif .else # Use LD's values Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Mon Jul 10 12:52:18 2017 (r320871) +++ head/share/mk/src.libnames.mk Mon Jul 10 14:59:21 2017 (r320872) @@ -88,6 +88,7 @@ _LIBRARIES= \ devinfo \ devstat \ dialog \ + dl \ dpv \ dtrace \ dwarf \ From owner-svn-src-head@freebsd.org Mon Jul 10 15:27:56 2017 Return-Path: Delivered-To: svn-src-head@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 2DCD5DAABEE; Mon, 10 Jul 2017 15:27:56 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 07DED68534; Mon, 10 Jul 2017 15:27:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6AFRsbm051220; Mon, 10 Jul 2017 15:27:54 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6AFRs2B051210; Mon, 10 Jul 2017 15:27:54 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201707101527.v6AFRs2B051210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 10 Jul 2017 15:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320873 - in head/sys/arm: freescale/imx ti ti/omap4 xilinx X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm: freescale/imx ti ti/omap4 xilinx X-SVN-Commit-Revision: 320873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 15:27:56 -0000 Author: andrew Date: Mon Jul 10 15:27:53 2017 New Revision: 320873 URL: https://svnweb.freebsd.org/changeset/base/320873 Log: Start to move the arm *_mp.h to be names *_machdep.h. These will be used by the reworked pl310 driver interface in https://reviews.freebsd.org/D11546 Added: head/sys/arm/freescale/imx/imx6_machdep.h - copied, changed from r320872, head/sys/arm/freescale/imx/imx6_mp.h head/sys/arm/ti/omap4/omap4_machdep.h - copied, changed from r320872, head/sys/arm/ti/omap4/omap4_mp.h head/sys/arm/xilinx/zy7_machdep.h - copied, changed from r320872, head/sys/arm/xilinx/zy7_mp.h Deleted: head/sys/arm/freescale/imx/imx6_mp.h head/sys/arm/ti/omap4/omap4_mp.h head/sys/arm/xilinx/zy7_mp.h Modified: head/sys/arm/freescale/imx/imx6_machdep.c head/sys/arm/freescale/imx/imx6_mp.c head/sys/arm/ti/omap4/omap4_mp.c head/sys/arm/ti/ti_machdep.c head/sys/arm/xilinx/zy7_machdep.c head/sys/arm/xilinx/zy7_mp.c Modified: head/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_machdep.c Mon Jul 10 14:59:21 2017 (r320872) +++ head/sys/arm/freescale/imx/imx6_machdep.c Mon Jul 10 15:27:53 2017 (r320873) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "platform_if.h" Copied and modified: head/sys/arm/freescale/imx/imx6_machdep.h (from r320872, head/sys/arm/freescale/imx/imx6_mp.h) ============================================================================== --- head/sys/arm/freescale/imx/imx6_mp.h Mon Jul 10 14:59:21 2017 (r320872, copy source) +++ head/sys/arm/freescale/imx/imx6_machdep.h Mon Jul 10 15:27:53 2017 (r320873) @@ -26,10 +26,10 @@ * $FreeBSD$ */ -#ifndef IMX6_MP_H -#define IMX6_MP_H +#ifndef IMX6_MACHDEP_H +#define IMX6_MACHDEP_H void imx6_mp_start_ap(platform_t); void imx6_mp_setmaxid(platform_t); -#endif /* IMX6_MP_H */ +#endif /* IMX6_MACHDEP_H */ Modified: head/sys/arm/freescale/imx/imx6_mp.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_mp.c Mon Jul 10 14:59:21 2017 (r320872) +++ head/sys/arm/freescale/imx/imx6_mp.c Mon Jul 10 15:27:53 2017 (r320873) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #define SCU_PHYSBASE 0x00a00000 #define SCU_SIZE 0x00001000 Copied and modified: head/sys/arm/ti/omap4/omap4_machdep.h (from r320872, head/sys/arm/ti/omap4/omap4_mp.h) ============================================================================== --- head/sys/arm/ti/omap4/omap4_mp.h Mon Jul 10 14:59:21 2017 (r320872, copy source) +++ head/sys/arm/ti/omap4/omap4_machdep.h Mon Jul 10 15:27:53 2017 (r320873) @@ -25,9 +25,10 @@ * $FreeBSD$ */ -#ifndef _OMAP4_MP_H_ -#define _OMAP4_MP_H_ +#ifndef _OMAP4_MACHDEP_H_ +#define _OMAP4_MACHDEP_H_ + void omap4_mp_setmaxid(platform_t plat); void omap4_mp_start_ap(platform_t plat); -#endif /* _OMAP4_MP_H_ */ +#endif /* _OMAP4_MACHDEP_H_ */ Modified: head/sys/arm/ti/omap4/omap4_mp.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_mp.c Mon Jul 10 14:59:21 2017 (r320872) +++ head/sys/arm/ti/omap4/omap4_mp.c Mon Jul 10 15:27:53 2017 (r320873) @@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include void omap4_mp_setmaxid(platform_t plat) Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Mon Jul 10 14:59:21 2017 (r320872) +++ head/sys/arm/ti/ti_machdep.c Mon Jul 10 15:27:53 2017 (r320873) @@ -52,8 +52,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include #include #include "platform_if.h" Modified: head/sys/arm/xilinx/zy7_machdep.c ============================================================================== --- head/sys/arm/xilinx/zy7_machdep.c Mon Jul 10 14:59:21 2017 (r320872) +++ head/sys/arm/xilinx/zy7_machdep.c Mon Jul 10 15:27:53 2017 (r320873) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include "platform_if.h" Copied and modified: head/sys/arm/xilinx/zy7_machdep.h (from r320872, head/sys/arm/xilinx/zy7_mp.h) ============================================================================== --- head/sys/arm/xilinx/zy7_mp.h Mon Jul 10 14:59:21 2017 (r320872, copy source) +++ head/sys/arm/xilinx/zy7_machdep.h Mon Jul 10 15:27:53 2017 (r320873) @@ -25,10 +25,10 @@ * $FreeBSD$ */ -#ifndef _ZY7_MP_H_ -#define _ZY7_MP_H_ +#ifndef _ZY7_MACHDEP_H_ +#define _ZY7_MACHDEP_H_ void zynq7_mp_setmaxid(platform_t); void zynq7_mp_start_ap(platform_t); -#endif /* _ZY7_MP_H_ */ +#endif /* _ZY7_MACHDEP_H_ */ Modified: head/sys/arm/xilinx/zy7_mp.c ============================================================================== --- head/sys/arm/xilinx/zy7_mp.c Mon Jul 10 14:59:21 2017 (r320872) +++ head/sys/arm/xilinx/zy7_mp.c Mon Jul 10 15:27:53 2017 (r320873) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #define ZYNQ7_CPU1_ENTRY 0xfffffff0 From owner-svn-src-head@freebsd.org Mon Jul 10 16:21:33 2017 Return-Path: Delivered-To: svn-src-head@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 55171DABB69; Mon, 10 Jul 2017 16:21:33 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C73EF6E0D2; Mon, 10 Jul 2017 16:21:32 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([92.227.37.89]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MYtId-1d7pfd0EoV-00Vhin; Mon, 10 Jul 2017 18:21:30 +0200 Date: Mon, 10 Jul 2017 18:21:22 +0200 From: "O. Hartmann" To: Marius Strobl Cc: Warner Losh , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... Message-ID: <20170710182048.3809fa38@thor.intern.walstatt.dynvpn.de> In-Reply-To: <20170709184221.GB38352@alchemy.franken.de> References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709184221.GB38352@alchemy.franken.de> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/b60ZKj7uljvEjqLtLdGX4N8"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:q6VNe8jezYFpXlKK82bl0D4eXOtt9MVROhwXYUhAMbaweL4kZ/7 YWUDmXP6Ld4a4pPo6hXeyyfBm3kUxsuQSnpNlG5SndqQOBT8Gj3mQO+Bv5mn9G6EuH8KqIW Doc2Z92VLQhG630gnQ/w8zT5lEVZh/XdVo9bwHwpNJryGLR80IVtZBzlwHZ2kPCipIi2/3f g4xYDp1zpgc8o1WNtx82g== X-UI-Out-Filterresults: notjunk:1;V01:K0:qioM958BrDM=:o8T2/fm0C1Kc6W4wJKAfYW KA/jBsffJFHKgOLrx3TEZHxuQ0dSHZgSJ7OEDkP6RH39uOp1NBGCyS8vmlZXuCHrUX8yUPf2h 33dun4hP9OFU/08KKauKeTUcBtS7mNSAjqdfiurcZcHc6OXE63AEwxmkbebdTIg85WBihUDsE 7ZuNSWAzVtzkLQf/s7NSbjSrEBCoeqotX2shxkp7j5oSxpfDLWsmSUr70cnJhLt4EqUAduexK 8AcafH3mDYAdoCAbULCHuF5PFvpPqbx12ZTWJprZaOHv+thlU2jq17giD7YJI5u5i+y49Wx/4 gw6nfFTL8aUwyr1IycwjoMJwWk6YsRF4pKFbRHG+kgfwPOir1djcrMJQQt6Dz3ETvU4AVjMR3 N8zPQhAnd/KTRHvFwyUIj8KoSiAFveajusk8zUvrJjyy0ZBZezWHD7Y7nKTX3OMZ6oJJTfwx/ 7YaDZgF4LDp3cojF22jlRtr4DbbPJjNusFLQVE7mLUJh6DzP5OcuvTTFxSsP9OCMJAlbDQ/IL 8S7q1Bo6H2lRGRzeJdlcd12EYPRDVkR1PJkXsyhatiixJVMhHjNXQ5/sS1Zv0qW2T2hN83Qlv uUjoVbsGHJDCzU/wdkTiP2GiCIlBfqiXyrz9tVO8tplaF1P/pdqZZetvQYqfJTStCVp1fzsbV i4MvqGhW89j4/fjWnfZ3DAtgLjR/Ud00Zy+QkX5idh3WUVbDrveykGWE1yeOMBdtgmjJ6lcs7 eHJmBnCZn8xJ83xIe5v9eqp8rE16o7icqrUBFv2ig6YVWJexMKNiKOOk9s8= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 16:21:33 -0000 --Sig_/b60ZKj7uljvEjqLtLdGX4N8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Sun, 9 Jul 2017 20:42:21 +0200 Marius Strobl schrieb: > On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: > > Author: imp > > Date: Sun Jul 9 16:57:24 2017 > > New Revision: 320844 > > URL: https://svnweb.freebsd.org/changeset/base/320844 > >=20 > > Log: > > An MMC/SD/SDIO stack using CAM > > =20 > > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > > flexible queueing will make it easier to write non-storage drivers > > than the legacy stack. SDIO drivers from both the kernel and as > > userland daemons are possible, though much of that functionality will > > come later. =20 >=20 > At least with a non-MMCCAM kernel, with this revision in place I get > an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during > boot. Apparently this is due to the fact that sdhci(4) now enables > these interrupts, but sdhci_generic_intr() neither actually handles > them nor clears them from intmask. >=20 > Btw., were mmc.ko and mmcsd.ko disconnected on purpose with this commit? >=20 > Marius I updated just to r320873. My box is booting off a Samsung SSD 830/UFS2 (GPT) and worked fine with r32= 0829 and hangs now again at: mountroot: Waiting for device /dev/gpt/root ... Mounting from ufs:/dev/gpt/root failed with error 19 mountroot >: ? List of GEOM managed disk devices mountroot >: What happened here? I run a custom kernel with ZFS compiled in ... --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_/b60ZKj7uljvEjqLtLdGX4N8 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWWOpggAKCRDS528fyFhY lBZIAfkB2WWazVhIby8bHIwmMZab96cj3um/wMSPrOuA7zq6bju53JsxOTAekJ40 xRURmDyZUpDhHol4kx0Sel28FRx0Af42pZk05KaDthiwPokgMdhqbJIi8OuIV3q7 b4GX0j0D70GdbIB78D5UKtAu9pyZHn/mIRAgg2Reu9lfcRhhWp+Z =0kQz -----END PGP SIGNATURE----- --Sig_/b60ZKj7uljvEjqLtLdGX4N8-- From owner-svn-src-head@freebsd.org Mon Jul 10 19:26:51 2017 Return-Path: Delivered-To: svn-src-head@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 A144FDAF2A4; Mon, 10 Jul 2017 19:26:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6D54574ECF; Mon, 10 Jul 2017 19:26:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6AJQoQO050828; Mon, 10 Jul 2017 19:26:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6AJQoEW050827; Mon, 10 Jul 2017 19:26:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201707101926.v6AJQoEW050827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Jul 2017 19:26:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320876 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 320876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 19:26:51 -0000 Author: hselasky Date: Mon Jul 10 19:26:50 2017 New Revision: 320876 URL: https://svnweb.freebsd.org/changeset/base/320876 Log: Make sure the mlx4en RX DMA ring gets stamped with software ownership in order to prevent the flow of QP to error in the firmware once UPDATE_QP is called. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Mon Jul 10 17:53:12 2017 (r320875) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Mon Jul 10 19:26:50 2017 (r320876) @@ -394,8 +394,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *pri ring->rx_mb_size = priv->rx_mb_size; ring->stride = stride; - if (ring->stride <= TXBB_SIZE) + if (ring->stride <= TXBB_SIZE) { + /* Stamp first unused send wqe */ + __be32 *ptr = (__be32 *)ring->buf; + __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT); + *ptr = stamp; + /* Move pointer to start of rx section */ ring->buf += TXBB_SIZE; + } ring->log_stride = ffs(ring->stride) - 1; ring->buf_size = ring->size * ring->stride; From owner-svn-src-head@freebsd.org Mon Jul 10 20:05:59 2017 Return-Path: Delivered-To: svn-src-head@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 EB904DB01E3 for ; Mon, 10 Jul 2017 20:05:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC8CE767A1 for ; Mon, 10 Jul 2017 20:05:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22e.google.com with SMTP id m84so51963636ita.0 for ; Mon, 10 Jul 2017 13:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=2UnOKwbjMIa8itB912VtS68QHBk5NgvAASFR4KbTWgQ=; b=Hk8PoRfst2YRTNyAlRVfaNFKpzHtIqhXQRnrylqBN5QqBoNkdSj3y9byJsv17W6B7d YjJ2SwitnYxVKa9IY68J//8NdsUmMbCT4oFIEiqQ6ji1m922GnSPG6zTv6VTpzFYWWTu qwqp933tBjDEJsZgkEpyvfyDVcXO3FD0NVP17daYEtRGDNzq1FCj0BMV6tB3RfB0KLt7 ED5mZYYwYUOo1D0djyr90p8AcWS/pDp/OYWiU1HofKG6PsFkdozGbZkwoG5SZVMT3+t3 A7jhGkgU8UqM6/xreMyuB9nc+9ybjM6UALhvrxHLzs6c/A0VO+8XT/QolHfzO4g6crbQ xmig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=2UnOKwbjMIa8itB912VtS68QHBk5NgvAASFR4KbTWgQ=; b=gkcI58sWtCEnmqtMFkQr1a7NWq7npAkAjGj02VNANBezkNEsuQ308C6wshfOAczzhe mhUDfdgA/xiRZizQj6b34EPt7jxTUdz0URB3NoOwPb7Bk0kaFPI1LQWuEj3NFomhsYbK /qOKD9RQ7YksR+bCclrXD/MORosQ+lRf+3Ycb4wCfPaKvT+ZOeiNgCqfQ3GPDMkrYLNF vrfmGtTDsc7XRTeTngFkDL+vgTcokvGLwcJ/Rfxd36o+R4vVh4EcXB4fYE227Coatb2U LOiZGrivwNSdrNGpSlPv2SsVCZH1ztFYbtc2mj4aDtkeUlsq0pWgQIAWYvrkPBAF5pDy 2KZA== X-Gm-Message-State: AIVw110/gi/h14l/e795ey0sFjvCrZks8mjhmd7Klq4dtPV5kUycgep2 UMJaabKSXUKDHyWkF0Utl9/khGNW+PJV X-Received: by 10.107.180.5 with SMTP id d5mr5936377iof.56.1499717158934; Mon, 10 Jul 2017 13:05:58 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.212.167 with HTTP; Mon, 10 Jul 2017 13:05:58 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:e566:7f4d:9206:5a72] In-Reply-To: <20170710182048.3809fa38@thor.intern.walstatt.dynvpn.de> References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709184221.GB38352@alchemy.franken.de> <20170710182048.3809fa38@thor.intern.walstatt.dynvpn.de> From: Warner Losh Date: Mon, 10 Jul 2017 14:05:58 -0600 X-Google-Sender-Auth: VU-mZXAA5ONDJRITgxGsZGpo_XE Message-ID: Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... To: "O. Hartmann" Cc: Marius Strobl , Warner Losh , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 20:06:00 -0000 On Mon, Jul 10, 2017 at 10:21 AM, O. Hartmann wrote: > Am Sun, 9 Jul 2017 20:42:21 +0200 > Marius Strobl schrieb: > > > On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: > > > Author: imp > > > Date: Sun Jul 9 16:57:24 2017 > > > New Revision: 320844 > > > URL: https://svnweb.freebsd.org/changeset/base/320844 > > > > > > Log: > > > An MMC/SD/SDIO stack using CAM > > > > > > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > > > flexible queueing will make it easier to write non-storage drivers > > > than the legacy stack. SDIO drivers from both the kernel and as > > > userland daemons are possible, though much of that functionality will > > > come later. > > > > At least with a non-MMCCAM kernel, with this revision in place I get > > an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during > > boot. Apparently this is due to the fact that sdhci(4) now enables > > these interrupts, but sdhci_generic_intr() neither actually handles > > them nor clears them from intmask. > > > > Btw., were mmc.ko and mmcsd.ko disconnected on purpose with this commit? > > > > Marius > > I updated just to r320873. > My box is booting off a Samsung SSD 830/UFS2 (GPT) and worked fine with > r320829 and hangs > now again at: > > mountroot: Waiting for device /dev/gpt/root ... > Mounting from ufs:/dev/gpt/root failed with error 19 > > mountroot >: ? > > List of GEOM managed disk devices > > mountroot >: > > What happened here? > > > I run a custom kernel with ZFS compiled in ... > > No clue. the information provided is insufficient to track down the problem. Can you give a full dmesg? And can you bisect the revs from r320829 to r320873 to see which one breaks things? Warner From owner-svn-src-head@freebsd.org Mon Jul 10 21:38:28 2017 Return-Path: Delivered-To: svn-src-head@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 74520DB1588; Mon, 10 Jul 2017 21:38:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0086778D81; Mon, 10 Jul 2017 21:38:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ALcR9Q003359; Mon, 10 Jul 2017 21:38:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ALcR1E003358; Mon, 10 Jul 2017 21:38:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707102138.v6ALcR1E003358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 10 Jul 2017 21:38:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320877 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 320877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 21:38:28 -0000 Author: imp Date: Mon Jul 10 21:38:26 2017 New Revision: 320877 URL: https://svnweb.freebsd.org/changeset/base/320877 Log: Kill some unnecessary noise. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Mon Jul 10 19:26:50 2017 (r320876) +++ head/sys/cam/cam_xpt.c Mon Jul 10 21:38:26 2017 (r320877) @@ -819,8 +819,6 @@ xpt_scanner_thread(void *dummy) TAILQ_REMOVE(&xsoftc.ccb_scanq, &ccb->ccb_h, sim_links.tqe); xpt_unlock_buses(); - printf("xpt_scanner_thread is firing on path "); - xpt_print_path(ccb->ccb_h.path);printf("\n"); /* * Since lock can be dropped inside and path freed * by completion callback even before return here, From owner-svn-src-head@freebsd.org Mon Jul 10 21:55:20 2017 Return-Path: Delivered-To: svn-src-head@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 ADBEBDB19AD; Mon, 10 Jul 2017 21:55:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7BA5479653; Mon, 10 Jul 2017 21:55:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ALtJXu011731; Mon, 10 Jul 2017 21:55:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ALtJsH011730; Mon, 10 Jul 2017 21:55:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707102155.v6ALtJsH011730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 10 Jul 2017 21:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320878 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 320878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 21:55:20 -0000 Author: imp Date: Mon Jul 10 21:55:19 2017 New Revision: 320878 URL: https://svnweb.freebsd.org/changeset/base/320878 Log: Move mmc_parmas to the end of the structure for better compatability. Modified: head/sys/cam/cam_ccb.h Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Mon Jul 10 21:38:26 2017 (r320877) +++ head/sys/cam/cam_ccb.h Mon Jul 10 21:55:19 2017 (r320878) @@ -501,8 +501,8 @@ struct device_match_result { cam_proto protocol; struct scsi_inquiry_data inq_data; struct ata_params ident_data; - struct mmc_params mmc_ident_data; dev_result_flags flags; + struct mmc_params mmc_ident_data; }; struct bus_match_result { From owner-svn-src-head@freebsd.org Mon Jul 10 21:55:26 2017 Return-Path: Delivered-To: svn-src-head@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 2920BDB19D0; Mon, 10 Jul 2017 21:55:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E7C9779676; Mon, 10 Jul 2017 21:55:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ALtPcc011785; Mon, 10 Jul 2017 21:55:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ALtPLb011784; Mon, 10 Jul 2017 21:55:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707102155.v6ALtPLb011784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 10 Jul 2017 21:55:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320879 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 320879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 21:55:26 -0000 Author: imp Date: Mon Jul 10 21:55:24 2017 New Revision: 320879 URL: https://svnweb.freebsd.org/changeset/base/320879 Log: Bump to FreeBSD_version to 1200038 for MMC CAM Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jul 10 21:55:19 2017 (r320878) +++ head/sys/sys/param.h Mon Jul 10 21:55:24 2017 (r320879) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200037 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200038 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Mon Jul 10 22:11:31 2017 Return-Path: Delivered-To: svn-src-head@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 862CDDB1D4D; Mon, 10 Jul 2017 22:11:31 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4DDD479CD2; Mon, 10 Jul 2017 22:11:31 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6AMBUqn016651; Mon, 10 Jul 2017 22:11:30 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6AMBUO2016650; Mon, 10 Jul 2017 22:11:30 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201707102211.v6AMBUO2016650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Mon, 10 Jul 2017 22:11:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320880 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: zbb X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 320880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 22:11:31 -0000 Author: zbb Date: Mon Jul 10 22:11:30 2017 New Revision: 320880 URL: https://svnweb.freebsd.org/changeset/base/320880 Log: Fix error check for Rx mbuf allocation in ENA driver ena_alloc_rx_mbuf() will return positive error code on failure. Act accordingly. Submitted by: Krishna Yenduri Modified: head/sys/dev/ena/ena.c Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Mon Jul 10 21:55:24 2017 (r320879) +++ head/sys/dev/ena/ena.c Mon Jul 10 22:11:30 2017 (r320880) @@ -1032,7 +1032,7 @@ ena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t &rx_ring->rx_buffer_info[next_to_use]; rc = ena_alloc_rx_mbuf(adapter, rx_ring, rx_info); - if (rc < 0) { + if (rc != 0) { device_printf(adapter->pdev, "failed to alloc buffer for rx queue\n"); break; From owner-svn-src-head@freebsd.org Mon Jul 10 23:51:52 2017 Return-Path: Delivered-To: svn-src-head@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 BFD9DDB353D; Mon, 10 Jul 2017 23:51:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 86A6B7C8D8; Mon, 10 Jul 2017 23:51:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ANppcF060515; Mon, 10 Jul 2017 23:51:51 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ANppbA060514; Mon, 10 Jul 2017 23:51:51 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707102351.v6ANppbA060514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 10 Jul 2017 23:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320881 - head/targets/pseudo/userland/share X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/targets/pseudo/userland/share X-SVN-Commit-Revision: 320881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 23:51:52 -0000 Author: bdrewery Date: Mon Jul 10 23:51:51 2017 New Revision: 320881 URL: https://svnweb.freebsd.org/changeset/base/320881 Log: Follow-up r318881: Disconnect groff documents. Modified: head/targets/pseudo/userland/share/Makefile.depend Modified: head/targets/pseudo/userland/share/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/share/Makefile.depend Mon Jul 10 22:11:30 2017 (r320880) +++ head/targets/pseudo/userland/share/Makefile.depend Mon Jul 10 23:51:51 2017 (r320881) @@ -15,76 +15,7 @@ DIRDEPS = \ share/doc/legal/intel_wpi \ share/doc/legal/realtek \ share/doc/llvm/clang \ - share/doc/papers/beyond4.3 \ - share/doc/papers/bufbio \ - share/doc/papers/contents \ - share/doc/papers/devfs \ - share/doc/papers/diskperf \ - share/doc/papers/fsinterface \ - share/doc/papers/hwpmc \ - share/doc/papers/jail \ - share/doc/papers/kernmalloc \ - share/doc/papers/kerntune \ - share/doc/papers/malloc \ - share/doc/papers/newvm \ - share/doc/papers/relengr \ - share/doc/papers/sysperf \ - share/doc/papers/timecounter \ share/doc/pjdfstest \ - share/doc/psd/01.cacm \ - share/doc/psd/02.implement \ - share/doc/psd/03.iosys \ - share/doc/psd/04.uprog \ - share/doc/psd/05.sysman \ - share/doc/psd/06.Clang \ - share/doc/psd/12.make \ - share/doc/psd/13.rcs/rcs \ - share/doc/psd/13.rcs/rcs_func \ - share/doc/psd/15.yacc \ - share/doc/psd/16.lex \ - share/doc/psd/17.m4 \ - share/doc/psd/18.gprof \ - share/doc/psd/20.ipctut \ - share/doc/psd/21.ipc \ - share/doc/psd/22.rpcgen \ - share/doc/psd/23.rpc \ - share/doc/psd/24.xdr \ - share/doc/psd/25.xdrrfc \ - share/doc/psd/26.rpcrfc \ - share/doc/psd/27.nfsrpc \ - share/doc/psd/contents \ - share/doc/psd/title \ - share/doc/smm/01.setup \ - share/doc/smm/02.config \ - share/doc/smm/03.fsck \ - share/doc/smm/04.quotas \ - share/doc/smm/05.fastfs \ - share/doc/smm/06.nfs \ - share/doc/smm/07.lpd \ - share/doc/smm/08.sendmailop \ - share/doc/smm/11.timedop \ - share/doc/smm/12.timed \ - share/doc/smm/18.net \ - share/doc/smm/contents \ - share/doc/smm/title \ - share/doc/usd/04.csh \ - share/doc/usd/05.dc \ - share/doc/usd/06.bc \ - share/doc/usd/07.mail \ - share/doc/usd/10.exref/exref \ - share/doc/usd/10.exref/summary \ - share/doc/usd/11.vitut \ - share/doc/usd/12.vi/summary \ - share/doc/usd/12.vi/vi \ - share/doc/usd/12.vi/viapwh \ - share/doc/usd/13.viref \ - share/doc/usd/18.msdiffs \ - share/doc/usd/19.memacros \ - share/doc/usd/20.meref \ - share/doc/usd/21.troff \ - share/doc/usd/22.trofftut \ - share/doc/usd/contents \ - share/doc/usd/title \ share/dtrace \ share/dtrace/toolkit \ share/examples \ From owner-svn-src-head@freebsd.org Mon Jul 10 23:52:05 2017 Return-Path: Delivered-To: svn-src-head@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 943C0DB3570; Mon, 10 Jul 2017 23:52:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 607607C9B9; Mon, 10 Jul 2017 23:52:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ANq4MS060571; Mon, 10 Jul 2017 23:52:04 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ANq4U9060568; Mon, 10 Jul 2017 23:52:04 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707102352.v6ANq4U9060568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 10 Jul 2017 23:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320882 - in head/usr.sbin: bhyve rpc.statd sesutil X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head/usr.sbin: bhyve rpc.statd sesutil X-SVN-Commit-Revision: 320882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 23:52:05 -0000 Author: bdrewery Date: Mon Jul 10 23:52:04 2017 New Revision: 320882 URL: https://svnweb.freebsd.org/changeset/base/320882 Log: DIRDEPS_BUILD: Update dependencies. Sponsored by: Dell EMC Isilon Modified: head/usr.sbin/bhyve/Makefile.depend head/usr.sbin/rpc.statd/Makefile.depend head/usr.sbin/sesutil/Makefile.depend Modified: head/usr.sbin/bhyve/Makefile.depend ============================================================================== --- head/usr.sbin/bhyve/Makefile.depend Mon Jul 10 23:51:51 2017 (r320881) +++ head/usr.sbin/bhyve/Makefile.depend Mon Jul 10 23:52:04 2017 (r320882) @@ -16,6 +16,7 @@ DIRDEPS = \ lib/libutil \ lib/libvmmapi \ lib/libz \ + secure/lib/libcrypto \ .include Modified: head/usr.sbin/rpc.statd/Makefile.depend ============================================================================== --- head/usr.sbin/rpc.statd/Makefile.depend Mon Jul 10 23:51:51 2017 (r320881) +++ head/usr.sbin/rpc.statd/Makefile.depend Mon Jul 10 23:52:04 2017 (r320882) @@ -7,6 +7,7 @@ DIRDEPS = \ include \ include/arpa \ include/rpc \ + include/rpcsvc \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ Modified: head/usr.sbin/sesutil/Makefile.depend ============================================================================== --- head/usr.sbin/sesutil/Makefile.depend Mon Jul 10 23:51:51 2017 (r320881) +++ head/usr.sbin/sesutil/Makefile.depend Mon Jul 10 23:52:04 2017 (r320882) @@ -8,7 +8,9 @@ DIRDEPS = \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ - lib/libcompiler_rt + lib/libcompiler_rt \ + lib/libutil \ + lib/libxo \ .include From owner-svn-src-head@freebsd.org Mon Jul 10 23:52:08 2017 Return-Path: Delivered-To: svn-src-head@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 DE7C0DB359D; Mon, 10 Jul 2017 23:52:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AA56B7CA08; Mon, 10 Jul 2017 23:52:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ANq7In060617; Mon, 10 Jul 2017 23:52:07 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ANq7Wg060616; Mon, 10 Jul 2017 23:52:07 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707102352.v6ANq7Wg060616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 10 Jul 2017 23:52:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320883 - head/etc X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/etc X-SVN-Commit-Revision: 320883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 23:52:09 -0000 Author: bdrewery Date: Mon Jul 10 23:52:07 2017 New Revision: 320883 URL: https://svnweb.freebsd.org/changeset/base/320883 Log: Fix INSTALL_AS_USER after r319020. Reviewed by: vangyzen MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/etc/Makefile Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Mon Jul 10 23:52:04 2017 (r320882) +++ head/etc/Makefile Mon Jul 10 23:52:07 2017 (r320883) @@ -342,19 +342,6 @@ distribution: MTREE_CMD?= mtree -.if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0 -MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \ - -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \ - -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \ - -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \ - -e 's,\(gid=\)[^ ]*$$,\1${_gid},' -.else -MTREE_FILTER= cat -.if !defined(NO_FSCHG) -MTREE_FSCHG= -i -.endif -.endif - MTREES= mtree/BSD.root.dist / \ mtree/BSD.var.dist /var \ mtree/BSD.usr.dist /usr \ @@ -467,3 +454,16 @@ etc-examples: etc-examples-install DESTDIR=${DESTDIR}${SHAREDIR}/examples .include + +.if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0 +MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \ + -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \ + -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \ + -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \ + -e 's,\(gid=\)[^ ]*$$,\1${_gid},' +.else +MTREE_FILTER= cat +.if !defined(NO_FSCHG) +MTREE_FSCHG= -i +.endif +.endif From owner-svn-src-head@freebsd.org Tue Jul 11 00:32:49 2017 Return-Path: Delivered-To: svn-src-head@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 CFDAFDB3FDC; Tue, 11 Jul 2017 00:32:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AB9757D981; Tue, 11 Jul 2017 00:32:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6B0WmuJ076759; Tue, 11 Jul 2017 00:32:48 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B0WmGH076750; Tue, 11 Jul 2017 00:32:48 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707110032.v6B0WmGH076750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 11 Jul 2017 00:32:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320884 - in head: lib/libc++experimental lib/libclang_rt/stats lib/libclang_rt/stats_client lib/libdl lib/libifconfig lib/librss lib/libsysdecode targets/pseudo/userland/lib X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: lib/libc++experimental lib/libclang_rt/stats lib/libclang_rt/stats_client lib/libdl lib/libifconfig lib/librss lib/libsysdecode targets/pseudo/userland/lib X-SVN-Commit-Revision: 320884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 00:32:49 -0000 Author: bdrewery Date: Tue Jul 11 00:32:48 2017 New Revision: 320884 URL: https://svnweb.freebsd.org/changeset/base/320884 Log: DIRDEPS_BUILD: Connect more libraries. Sponsored by: Dell EMC Isilon Added: head/lib/libc++experimental/Makefile.depend (contents, props changed) head/lib/libclang_rt/stats/Makefile.depend (contents, props changed) head/lib/libclang_rt/stats_client/Makefile.depend (contents, props changed) head/lib/libdl/Makefile.depend (contents, props changed) head/lib/libifconfig/Makefile.depend (contents, props changed) head/lib/librss/Makefile.depend (contents, props changed) Modified: head/lib/libsysdecode/Makefile.depend head/targets/pseudo/userland/lib/Makefile.depend Added: head/lib/libc++experimental/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc++experimental/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/xlocale \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Added: head/lib/libclang_rt/stats/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libclang_rt/stats/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -0,0 +1,16 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/arpa \ + include/xlocale \ + lib/libc++ \ + lib/ncurses/ncursesw \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Added: head/lib/libclang_rt/stats_client/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libclang_rt/stats_client/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -0,0 +1,13 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + lib/libc++ \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Added: head/lib/libdl/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libdl/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -0,0 +1,18 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Added: head/lib/libifconfig/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -0,0 +1,13 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/xlocale \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Added: head/lib/librss/Makefile.depend ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/librss/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -0,0 +1,18 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Modified: head/lib/libsysdecode/Makefile.depend ============================================================================== --- head/lib/libsysdecode/Makefile.depend Mon Jul 10 23:52:07 2017 (r320883) +++ head/lib/libsysdecode/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -74,6 +74,7 @@ DIRDEPS = \ lib/libfigpar \ lib/libgeom \ lib/libgpio \ + lib/libifconfig \ lib/libjail \ lib/libkvm \ lib/liblzma \ @@ -92,6 +93,7 @@ DIRDEPS = \ lib/libproc \ lib/libprocstat \ lib/libradius \ + lib/librss \ lib/librtld_db \ lib/libsdp \ lib/libsqlite3 \ Modified: head/targets/pseudo/userland/lib/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/lib/Makefile.depend Mon Jul 10 23:52:07 2017 (r320883) +++ head/targets/pseudo/userland/lib/Makefile.depend Tue Jul 11 00:32:48 2017 (r320884) @@ -2,9 +2,7 @@ # This file is not autogenerated - take care! -.if !defined(MK_CLANG) .include -.endif DIRDEPS = \ lib/${CSU_DIR} \ @@ -30,9 +28,12 @@ DIRDEPS = \ lib/libbsnmp/libbsnmp \ lib/libbz2 \ lib/libc \ + lib/libc_nonshared \ lib/libc++ \ + lib/libc++experimental \ lib/libcalendar \ lib/libcam \ + lib/libcapsicum \ lib/libcom_err/doc \ lib/libcompat \ lib/libcompiler_rt \ @@ -51,6 +52,7 @@ DIRDEPS = \ lib/libexecinfo \ lib/libexpat \ lib/libfetch \ + lib/libfigpar \ lib/libgeom \ lib/libgssapi \ lib/libiconv_modules/BIG5 \ @@ -76,6 +78,7 @@ DIRDEPS = \ lib/libiconv_modules/mapper_serial \ lib/libiconv_modules/mapper_std \ lib/libiconv_modules/mapper_zone \ + lib/libifconfig \ lib/libipsec \ lib/libipx \ lib/libjail \ @@ -128,6 +131,7 @@ DIRDEPS = \ lib/libradius \ lib/librpcsec_gss \ lib/librpcsvc \ + lib/librss \ lib/librt \ lib/librtld_db \ lib/libsbuf \ @@ -144,6 +148,7 @@ DIRDEPS = \ lib/libtelnet \ lib/libthr \ lib/libthread_db \ + lib/libucl \ lib/libufs \ lib/libugidfw \ lib/libulog \ @@ -158,6 +163,7 @@ DIRDEPS = \ lib/libyaml \ lib/libypclnt \ lib/libz \ + lib/libzstd \ lib/msun \ lib/ncurses/form \ lib/ncurses/formw \ @@ -175,15 +181,22 @@ DIRDEPS = \ DIRDEPS+= \ lib/libclang_rt/asan-preinit \ lib/libclang_rt/asan \ + lib/libclang_rt/asan_dynamic \ lib/libclang_rt/asan_cxx \ lib/libclang_rt/include \ lib/libclang_rt/profile \ lib/libclang_rt/safestack \ + lib/libclang_rt/stats \ + lib/libclang_rt/stats_client \ lib/libclang_rt/ubsan_standalone \ lib/libclang_rt/ubsan_standalone_cxx \ .endif +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mfilter} +DIRDEPS+= lib/libdl +.endif + .if ${MK_NAND} != "no" DIRDEPS+= lib/libnandfs .endif @@ -197,6 +210,18 @@ DIRDEPS+= \ lib/libcasper/services/cap_random \ lib/libcasper/services/cap_sysctl \ +.endif + +.if ${MK_DIALOG} != "no" +DIRDEPS+= lib/libdpv +.endif + +.if ${MK_GPIO} != "no" +DIRDEPS+= lib/libgpio +.endif + +.if ${MK_EFI} != "no" +DIRDEPS+= lib/libefivar .endif .if ${MK_OFED} != "no" From owner-svn-src-head@freebsd.org Tue Jul 11 12:32:42 2017 Return-Path: Delivered-To: svn-src-head@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 06C8FD9E699; Tue, 11 Jul 2017 12:32:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C81D972163; Tue, 11 Jul 2017 12:32:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BCWegp073061; Tue, 11 Jul 2017 12:32:40 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BCWeXu073060; Tue, 11 Jul 2017 12:32:40 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201707111232.v6BCWeXu073060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 11 Jul 2017 12:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320892 - head/etc/defaults X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/etc/defaults X-SVN-Commit-Revision: 320892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 12:32:42 -0000 Author: trasz Date: Tue Jul 11 12:32:40 2017 New Revision: 320892 URL: https://svnweb.freebsd.org/changeset/base/320892 Log: Make fsck_y_enable default to passing pass -R to fsck_ffs(8) in addition to -y. To me, fsck_y_enable means "try as hard as possible", and without -R, it... well, doesn't. Reviewed by: mckusick Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11490 Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Tue Jul 11 06:39:12 2017 (r320891) +++ head/etc/defaults/rc.conf Tue Jul 11 12:32:40 2017 (r320892) @@ -92,7 +92,7 @@ geli_autodetach="YES" # Automatically detach on last c root_rw_mount="YES" # Set to NO to inhibit remounting root read-write. root_hold_delay="30" # Time to wait for root mount hold release. fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails. -fsck_y_flags="" # Additional flags for fsck -y +fsck_y_flags="-T ffs:-R -T ufs:-R" # Additional flags for fsck -y background_fsck="YES" # Attempt to run fsck in the background where possible. background_fsck_delay="60" # Time to wait (seconds) before starting the fsck. netfs_types="nfs:NFS smbfs:SMB" # Net filesystems. From owner-svn-src-head@freebsd.org Tue Jul 11 12:35:46 2017 Return-Path: Delivered-To: svn-src-head@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 10FA0D9E75D; Tue, 11 Jul 2017 12:35:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D2C2072317; Tue, 11 Jul 2017 12:35:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BCZiB7073237; Tue, 11 Jul 2017 12:35:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BCZiFU073236; Tue, 11 Jul 2017 12:35:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707111235.v6BCZiFU073236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Jul 2017 12:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320893 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 320893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 12:35:46 -0000 Author: kib Date: Tue Jul 11 12:35:44 2017 New Revision: 320893 URL: https://svnweb.freebsd.org/changeset/base/320893 Log: Fix BIT_FLS(). The iteration index is unsigned, so testing for larger than or equal to zero makes little sense. Submitted by: Sebastian Huber MFC after: 3 days Modified: head/sys/sys/bitset.h Modified: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Tue Jul 11 12:32:40 2017 (r320892) +++ head/sys/sys/bitset.h Tue Jul 11 12:35:44 2017 (r320893) @@ -218,10 +218,10 @@ int __bit; \ \ __bit = 0; \ - for (__i = __bitset_words((_s)) - 1; __i >= 0; __i--) { \ - if ((p)->__bits[__i] != 0) { \ - __bit = flsl((p)->__bits[__i]); \ - __bit += __i * _BITSET_BITS; \ + for (__i = __bitset_words((_s)); __i > 0; __i--) { \ + if ((p)->__bits[__i - 1] != 0) { \ + __bit = flsl((p)->__bits[__i - 1]); \ + __bit += (__i - 1) * _BITSET_BITS; \ break; \ } \ } \ From owner-svn-src-head@freebsd.org Tue Jul 11 15:22:07 2017 Return-Path: Delivered-To: svn-src-head@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 B3594DA293A; Tue, 11 Jul 2017 15:22:07 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95F9A77C60; Tue, 11 Jul 2017 15:22:07 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp001.me.com by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OSX00900L2Q8H00@mr11p00im-asmtp001.me.com>; Tue, 11 Jul 2017 15:21:57 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1499786516; bh=d/L4QW999gaK+Ep0HH5IAqnWBKF5w6A1zPSJr1PSEZY=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=CGb0gpaiog7YnrschQLuHq5qyn4eCKYRNN9t7BpD53Yta9rLdQlhwNqkQUfkA+izf l6mR/XvJS4UYDsPt4whydMWOUiHiWu+jDpka8dIqZZWDoLN9XUK2FsHukoiQrwmSKd CUsCMBcmNo8QYqhMAdThCMguy5AzGuVl8KqBqjnqN4a8OG7q8sTs3Cz5XsuSGeTqlX TMxtgWTbQlrGsl/j4B6ZqLT1LbCGNLOjX8MLiw5Y2cLaN9BWsyLuUTYuhu+tuyIhRi G0ivQgMrEowlm0hlKXs6YxR0ni5AGj1vs1tJ2LuigYCys56iW7A8U0GFk2wyc/iJcx N9j9jZg2tTTvg== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OSX003P6MOIV700@mr11p00im-asmtp001.me.com>; Tue, 11 Jul 2017 15:21:55 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-11_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1701120000 definitions=main-1707110245 User-Agent: Microsoft-MacOutlook/f.21.0.170409 Date: Tue, 11 Jul 2017 08:21:54 -0700 Subject: Re: svn commit: r320892 - head/etc/defaults From: Ravi Pokala To: Edward Tomasz Napierala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: Thread-topic: svn commit: r320892 - head/etc/defaults References: <201707111232.v6BCWeXu073060@repo.freebsd.org> In-reply-to: <201707111232.v6BCWeXu073060@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 15:22:07 -0000 I appreciate the spirit of this change; thanks Trasz! A question though: you're telling the generic `fsck' to pass "-R" to either `fsck_ffs' or `fsck_ufs', as needed. But those are both names for the same executable. Won't the generic `fsck' always end up invoking (per sbin/fsck/fsck.c::ptype_map[]) `fsck_ffs'? In which case, is the `fsck_ufs' case needed here? Thanks, Ravi (rpokala@) -----Original Message----- From: on behalf of Edward Tomasz Napierala Date: 2017-07-11, Tuesday at 05:32 To: , , Subject: svn commit: r320892 - head/etc/defaults Author: trasz Date: Tue Jul 11 12:32:40 2017 New Revision: 320892 URL: https://svnweb.freebsd.org/changeset/base/320892 Log: Make fsck_y_enable default to passing pass -R to fsck_ffs(8) in addition to -y. To me, fsck_y_enable means "try as hard as possible", and without -R, it... well, doesn't. Reviewed by: mckusick Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11490 Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Tue Jul 11 06:39:12 2017 (r320891) +++ head/etc/defaults/rc.conf Tue Jul 11 12:32:40 2017 (r320892) @@ -92,7 +92,7 @@ geli_autodetach="YES" # Automatically detach on last c root_rw_mount="YES" # Set to NO to inhibit remounting root read-write. root_hold_delay="30" # Time to wait for root mount hold release. fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails. -fsck_y_flags="" # Additional flags for fsck -y +fsck_y_flags="-T ffs:-R -T ufs:-R" # Additional flags for fsck -y background_fsck="YES" # Attempt to run fsck in the background where possible. background_fsck_delay="60" # Time to wait (seconds) before starting the fsck. netfs_types="nfs:NFS smbfs:SMB" # Net filesystems. From owner-svn-src-head@freebsd.org Tue Jul 11 16:30:19 2017 Return-Path: Delivered-To: svn-src-head@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 3197DDA41E2; Tue, 11 Jul 2017 16:30:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E2DD379F70; Tue, 11 Jul 2017 16:30:18 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BGUIAb067156; Tue, 11 Jul 2017 16:30:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BGUGis067140; Tue, 11 Jul 2017 16:30:16 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201707111630.v6BGUGis067140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 11 Jul 2017 16:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320894 - in head/sys: arm/arm arm/conf arm/freescale/imx arm/include arm/ti arm/ti/omap4 arm/xilinx conf X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm/arm arm/conf arm/freescale/imx arm/include arm/ti arm/ti/omap4 arm/xilinx conf X-SVN-Commit-Revision: 320894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 16:30:19 -0000 Author: andrew Date: Tue Jul 11 16:30:16 2017 New Revision: 320894 URL: https://svnweb.freebsd.org/changeset/base/320894 Log: Add external PLATFORM access on arm, and use it in the pl310 driver. This allows multiple instances of SoCs that use the pl310 driver to be built within the same kernel: * Add access to the platform_t object from outside platform.c * Use this with the pl310 driver There is a new platform_pl310 interface to replace the existing code. SoCs need to implement the init method, and if they have special requirements to write to the two registers we care about will also need to implement the write_ctrl and write_debug methods. Differential Revision: https://reviews.freebsd.org/D11546 Added: head/sys/arm/arm/platform_pl310_if.m (contents, props changed) Modified: head/sys/arm/arm/pl310.c head/sys/arm/arm/platform.c head/sys/arm/conf/GENERIC head/sys/arm/freescale/imx/imx6_machdep.c head/sys/arm/freescale/imx/imx6_machdep.h head/sys/arm/freescale/imx/imx6_pl310.c head/sys/arm/include/pl310.h head/sys/arm/include/platformvar.h head/sys/arm/ti/omap4/omap4_l2cache.c head/sys/arm/ti/omap4/omap4_machdep.h head/sys/arm/ti/ti_machdep.c head/sys/arm/xilinx/zy7_l2cache.c head/sys/arm/xilinx/zy7_machdep.c head/sys/arm/xilinx/zy7_machdep.h head/sys/conf/files.arm Modified: head/sys/arm/arm/pl310.c ============================================================================== --- head/sys/arm/arm/pl310.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/arm/pl310.c Tue Jul 11 16:30:16 2017 (r320894) @@ -42,11 +42,18 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef PLATFORM +#include +#endif #include #include #include +#ifdef PLATFORM +#include "platform_pl310_if.h" +#endif + /* * Define this if you need to disable PL310 for debugging purpose * Spec: @@ -88,6 +95,29 @@ static struct ofw_compat_data compat_data[] = { {"arm,pl310-cache", true}, {NULL, false} }; + +#ifdef PLATFORM +static void +platform_pl310_init(struct pl310_softc *sc) +{ + + PLATFORM_PL310_INIT(platform_obj(), sc); +} + +static void +platform_pl310_write_ctrl(struct pl310_softc *sc, uint32_t val) +{ + + PLATFORM_PL310_WRITE_CTRL(platform_obj(), sc, val); +} + +static void +platform_pl310_write_debug(struct pl310_softc *sc, uint32_t val) +{ + + PLATFORM_PL310_WRITE_DEBUG(platform_obj(), sc, val); +} +#endif static void pl310_print_config(struct pl310_softc *sc) Modified: head/sys/arm/arm/platform.c ============================================================================== --- head/sys/arm/arm/platform.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/arm/platform.c Tue Jul 11 16:30:16 2017 (r320894) @@ -77,6 +77,13 @@ SET_DECLARE(platform_set, platform_def_t); static delay_func platform_delay; +platform_t +platform_obj(void) +{ + + return (plat_obj); +} + void platform_probe_and_attach(void) { Added: head/sys/arm/arm/platform_pl310_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/arm/platform_pl310_if.m Tue Jul 11 16:30:16 2017 (r320894) @@ -0,0 +1,84 @@ +#- +# Copyright (c) 2017 Andrew Turner +# 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. +# +# $FreeBSD$ +# + +#include +#include +#include +#include + +#include +#include +#include + +INTERFACE platform_pl310; + +HEADER { + struct pl310_softc; +}; + +CODE { + static void platform_pl310_default_write_ctrl(platform_t plat, + struct pl310_softc *sc, uint32_t val) + { + pl310_write4(sc, PL310_CTRL, val); + } + + static void platform_pl310_default_write_debug(platform_t plat, + struct pl310_softc *sc, uint32_t val) + { + pl310_write4(sc, PL310_DEBUG_CTRL, val); + } +}; + +/** + * Initialize the pl310, e.g. to configure the prefetch control. The following + * write functions may have already been called so they must not rely on + * this function. + */ +METHOD void init { + platform_t _plat; + struct pl310_softc *sc; +}; + +/** + * Write to the Control Register. + */ +METHOD void write_ctrl { + platform_t _plat; + struct pl310_softc *sc; + uint32_t val; +} DEFAULT platform_pl310_default_write_ctrl; + +/** + * Write to the Debug Control Register. + */ +METHOD void write_debug { + platform_t _plat; + struct pl310_softc *sc; + uint32_t val; +} DEFAULT platform_pl310_default_write_debug; Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/conf/GENERIC Tue Jul 11 16:30:16 2017 (r320894) @@ -116,6 +116,7 @@ device pty device snp device md # Memory "disks" device random # Entropy device +device pl310 # PL310 L2 cache controller device psci # I2C support Modified: head/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_machdep.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/freescale/imx/imx6_machdep.c Tue Jul 11 16:30:16 2017 (r320894) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include "platform_if.h" +#include "platform_pl310_if.h" static platform_attach_t imx6_attach; static platform_devmap_init_t imx6_devmap_init; @@ -320,6 +321,8 @@ static platform_method_t imx6_methods[] = { PLATFORMMETHOD(platform_mp_start_ap, imx6_mp_start_ap), PLATFORMMETHOD(platform_mp_setmaxid, imx6_mp_setmaxid), #endif + + PLATFORMMETHOD(platform_pl310_init, imx6_pl310_init), PLATFORMMETHOD_END, }; Modified: head/sys/arm/freescale/imx/imx6_machdep.h ============================================================================== --- head/sys/arm/freescale/imx/imx6_machdep.h Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/freescale/imx/imx6_machdep.h Tue Jul 11 16:30:16 2017 (r320894) @@ -29,7 +29,10 @@ #ifndef IMX6_MACHDEP_H #define IMX6_MACHDEP_H +struct pl310_softc; + void imx6_mp_start_ap(platform_t); void imx6_mp_setmaxid(platform_t); +void imx6_pl310_init(platform_t, struct pl310_softc *); #endif /* IMX6_MACHDEP_H */ Modified: head/sys/arm/freescale/imx/imx6_pl310.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_pl310.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/freescale/imx/imx6_pl310.c Tue Jul 11 16:30:16 2017 (r320894) @@ -40,9 +40,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + +#include "platform_pl310_if.h" + void -platform_pl310_init(struct pl310_softc *sc) +imx6_pl310_init(platform_t plat, struct pl310_softc *sc) { uint32_t reg; @@ -58,18 +63,3 @@ platform_pl310_init(struct pl310_softc *sc) pl310_set_ram_latency(sc, PL310_TAG_RAM_CTRL, 4, 2, 3); pl310_set_ram_latency(sc, PL310_DATA_RAM_CTRL, 4, 2, 3); } - -void -platform_pl310_write_ctrl(struct pl310_softc *sc, uint32_t val) -{ - - pl310_write4(sc, PL310_CTRL, val); -} - -void -platform_pl310_write_debug(struct pl310_softc *sc, uint32_t val) -{ - - pl310_write4(sc, PL310_DEBUG_CTRL, val); -} - Modified: head/sys/arm/include/pl310.h ============================================================================== --- head/sys/arm/include/pl310.h Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/include/pl310.h Tue Jul 11 16:30:16 2017 (r320894) @@ -181,8 +181,10 @@ pl310_write4(struct pl310_softc *sc, bus_size_t off, u void pl310_set_ram_latency(struct pl310_softc *sc, uint32_t which_reg, uint32_t read, uint32_t write, uint32_t setup); +#ifndef PLATFORM void platform_pl310_init(struct pl310_softc *); void platform_pl310_write_ctrl(struct pl310_softc *, uint32_t); void platform_pl310_write_debug(struct pl310_softc *, uint32_t); +#endif #endif /* PL310_H_ */ Modified: head/sys/arm/include/platformvar.h ============================================================================== --- head/sys/arm/include/platformvar.h Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/include/platformvar.h Tue Jul 11 16:30:16 2017 (r320894) @@ -114,6 +114,11 @@ DATA_SET(platform_set, VAR_NAME ## _platform) #endif +/* + * Helper to get the platform object + */ +platform_t platform_obj(void); + bool arm_tmr_timed_wait(platform_t, int); #endif /* _MACHINE_PLATFORMVAR_H_ */ Modified: head/sys/arm/ti/omap4/omap4_l2cache.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_l2cache.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/ti/omap4/omap4_l2cache.c Tue Jul 11 16:30:16 2017 (r320894) @@ -32,13 +32,18 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include +#include +#include +#include +#include + +#include "platform_pl310_if.h" + void -platform_pl310_init(struct pl310_softc *sc) +omap4_pl310_init(platform_t plat, struct pl310_softc *sc) { uint32_t aux, prefetch; @@ -70,13 +75,15 @@ platform_pl310_init(struct pl310_softc *sc) } void -platform_pl310_write_ctrl(struct pl310_softc *sc, uint32_t val) +omap4_pl310_write_ctrl(platform_t plat, struct pl310_softc *sc, uint32_t val) { + ti_smc0(val, 0, L2CACHE_WRITE_CTRL_REG); } void -platform_pl310_write_debug(struct pl310_softc *sc, uint32_t val) +omap4_pl310_write_debug(platform_t plat, struct pl310_softc *sc, uint32_t val) { + ti_smc0(val, 0, L2CACHE_WRITE_DEBUG_REG); } Modified: head/sys/arm/ti/omap4/omap4_machdep.h ============================================================================== --- head/sys/arm/ti/omap4/omap4_machdep.h Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/ti/omap4/omap4_machdep.h Tue Jul 11 16:30:16 2017 (r320894) @@ -28,7 +28,13 @@ #ifndef _OMAP4_MACHDEP_H_ #define _OMAP4_MACHDEP_H_ +struct pl310_softc; + void omap4_mp_setmaxid(platform_t plat); void omap4_mp_start_ap(platform_t plat); + +void omap4_pl310_init(platform_t, struct pl310_softc *); +void omap4_pl310_write_ctrl(platform_t, struct pl310_softc *, uint32_t); +void omap4_pl310_write_debug(platform_t, struct pl310_softc *, uint32_t); #endif /* _OMAP4_MACHDEP_H_ */ Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/ti/ti_machdep.c Tue Jul 11 16:30:16 2017 (r320894) @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); #include "platform_if.h" #if defined(SOC_OMAP4) +#include "platform_pl310_if.h" + static platform_attach_t omap4_attach; static platform_devmap_init_t ti_omap4_devmap_init; #endif @@ -139,6 +141,11 @@ static platform_method_t omap4_methods[] = { PLATFORMMETHOD(platform_mp_start_ap, omap4_mp_start_ap), PLATFORMMETHOD(platform_mp_setmaxid, omap4_mp_setmaxid), #endif + + PLATFORMMETHOD(platform_pl310_init, omap4_pl310_init), + PLATFORMMETHOD(platform_pl310_write_ctrl, omap4_pl310_write_ctrl), + PLATFORMMETHOD(platform_pl310_write_debug, omap4_pl310_write_debug), + PLATFORMMETHOD_END, }; FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 200); Modified: head/sys/arm/xilinx/zy7_l2cache.c ============================================================================== --- head/sys/arm/xilinx/zy7_l2cache.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/xilinx/zy7_l2cache.c Tue Jul 11 16:30:16 2017 (r320894) @@ -39,22 +39,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include -void -platform_pl310_init(struct pl310_softc *softc) -{ -} +#include -void -platform_pl310_write_ctrl(struct pl310_softc *sc, uint32_t val) -{ +#include "platform_pl310_if.h" - pl310_write4(sc, PL310_CTRL, val); -} - void -platform_pl310_write_debug(struct pl310_softc *sc, uint32_t val) +zynq7_pl310_init(platform_t plat, struct pl310_softc *softc) { - - pl310_write4(sc, PL310_DEBUG_CTRL, val); } Modified: head/sys/arm/xilinx/zy7_machdep.c ============================================================================== --- head/sys/arm/xilinx/zy7_machdep.c Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/xilinx/zy7_machdep.c Tue Jul 11 16:30:16 2017 (r320894) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include "platform_if.h" +#include "platform_pl310_if.h" void (*zynq7_cpu_reset)(void); @@ -92,6 +93,8 @@ static platform_method_t zynq7_methods[] = { PLATFORMMETHOD(platform_mp_setmaxid, zynq7_mp_setmaxid), PLATFORMMETHOD(platform_mp_start_ap, zynq7_mp_start_ap), #endif + + PLATFORMMETHOD(platform_pl310_init, zynq7_pl310_init), PLATFORMMETHOD_END, }; Modified: head/sys/arm/xilinx/zy7_machdep.h ============================================================================== --- head/sys/arm/xilinx/zy7_machdep.h Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/arm/xilinx/zy7_machdep.h Tue Jul 11 16:30:16 2017 (r320894) @@ -28,7 +28,11 @@ #ifndef _ZY7_MACHDEP_H_ #define _ZY7_MACHDEP_H_ +struct pl310_softc; + void zynq7_mp_setmaxid(platform_t); void zynq7_mp_start_ap(platform_t); + +void zynq7_pl310_init(platform_t, struct pl310_softc *); #endif /* _ZY7_MACHDEP_H_ */ Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Tue Jul 11 12:35:44 2017 (r320893) +++ head/sys/conf/files.arm Tue Jul 11 16:30:16 2017 (r320894) @@ -84,6 +84,7 @@ arm/arm/pl190.c optional pl190 arm/arm/pl310.c optional pl310 arm/arm/platform.c optional platform arm/arm/platform_if.m optional platform +arm/arm/platform_pl310_if.m optional platform pl310 arm/arm/pmap-v4.c optional !armv6 arm/arm/pmap-v6.c optional armv6 arm/arm/pmu.c optional pmu | fdt hwpmc From owner-svn-src-head@freebsd.org Tue Jul 11 17:02:38 2017 Return-Path: Delivered-To: svn-src-head@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 DC728DA6818; Tue, 11 Jul 2017 17:02:38 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5915B7CA62; Tue, 11 Jul 2017 17:02:38 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v6BH2aCd080929; Tue, 11 Jul 2017 10:02:36 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v6BH2aFe080928; Tue, 11 Jul 2017 10:02:36 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201707111702.v6BH2aFe080928@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r320892 - head/etc/defaults In-Reply-To: <201707111232.v6BCWeXu073060@repo.freebsd.org> To: Edward Tomasz Napierala Date: Tue, 11 Jul 2017 10:02:36 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 17:02:39 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: trasz > Date: Tue Jul 11 12:32:40 2017 > New Revision: 320892 > URL: https://svnweb.freebsd.org/changeset/base/320892 > > Log: > Make fsck_y_enable default to passing pass -R to fsck_ffs(8) in addition > to -y. To me, fsck_y_enable means "try as hard as possible", and without > -R, it... well, doesn't. To you perhaps, but it has long been and is well known that fsck -y is just that, fsck -y, not something more. If you want it to be more your already given a tunable. I now have to "detune" all installed systems using fsck_y_enable if I do not want them to do this. > > Reviewed by: mckusick > Obtained from: CheriBSD > MFC after: 2 weeks > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D11490 > > Modified: > head/etc/defaults/rc.conf > > Modified: head/etc/defaults/rc.conf > ============================================================================== > --- head/etc/defaults/rc.conf Tue Jul 11 06:39:12 2017 (r320891) > +++ head/etc/defaults/rc.conf Tue Jul 11 12:32:40 2017 (r320892) > @@ -92,7 +92,7 @@ geli_autodetach="YES" # Automatically detach on last c > root_rw_mount="YES" # Set to NO to inhibit remounting root read-write. > root_hold_delay="30" # Time to wait for root mount hold release. > fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails. ^^^ this variable and this ^^^^^^ this comment are now wrong Would probably be better to introduce a new varaible for this. > -fsck_y_flags="" # Additional flags for fsck -y > +fsck_y_flags="-T ffs:-R -T ufs:-R" # Additional flags for fsck -y > background_fsck="YES" # Attempt to run fsck in the background where possible. > background_fsck_delay="60" # Time to wait (seconds) before starting the fsck. > netfs_types="nfs:NFS smbfs:SMB" # Net filesystems. > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Jul 11 17:59:16 2017 Return-Path: Delivered-To: svn-src-head@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 8CDB4DA8D42; Tue, 11 Jul 2017 17:59:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5B4ED801D8; Tue, 11 Jul 2017 17:59:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BHxFVq008325; Tue, 11 Jul 2017 17:59:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BHxFnH008324; Tue, 11 Jul 2017 17:59:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707111759.v6BHxFnH008324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Jul 2017 17:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320895 - head/lib/libc/net X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libc/net X-SVN-Commit-Revision: 320895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 17:59:16 -0000 Author: markj Date: Tue Jul 11 17:59:15 2017 New Revision: 320895 URL: https://svnweb.freebsd.org/changeset/base/320895 Log: Don't dlclose NSS modules from nss_atexit(). As hinted in the commit log message for r259042, this is unnecessary. Moreover, as a result of that change we may invoke a DSO's atexit handler after it has been unmapped. Reviewed by: bdrewery, cem MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/lib/libc/net/nsdispatch.c Modified: head/lib/libc/net/nsdispatch.c ============================================================================== --- head/lib/libc/net/nsdispatch.c Tue Jul 11 16:30:16 2017 (r320894) +++ head/lib/libc/net/nsdispatch.c Tue Jul 11 17:59:15 2017 (r320895) @@ -525,8 +525,8 @@ fin: vector_sort(_nsmod, _nsmodsize, sizeof(*_nsmod), string_compare); } +static int exiting = 0; - static void ns_mod_free(ns_mod *mod) { @@ -536,12 +536,10 @@ ns_mod_free(ns_mod *mod) return; if (mod->unregister != NULL) mod->unregister(mod->mtab, mod->mtabsize); - if (mod->handle != nss_builtin_handle) + if (mod->handle != nss_builtin_handle && !exiting) (void)dlclose(mod->handle); } - - /* * Cleanup */ @@ -550,6 +548,7 @@ nss_atexit(void) { int isthreaded; + exiting = 1; isthreaded = __isthreaded; if (isthreaded) (void)_pthread_rwlock_wrlock(&nss_lock); @@ -560,8 +559,6 @@ nss_atexit(void) if (isthreaded) (void)_pthread_rwlock_unlock(&nss_lock); } - - /* * Finally, the actual implementation. From owner-svn-src-head@freebsd.org Tue Jul 11 18:24:07 2017 Return-Path: Delivered-To: svn-src-head@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 9866CDA977A; Tue, 11 Jul 2017 18:24:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 66F698131B; Tue, 11 Jul 2017 18:24:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BIO6Ya020372; Tue, 11 Jul 2017 18:24:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BIO6ZM020371; Tue, 11 Jul 2017 18:24:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707111824.v6BIO6ZM020371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Jul 2017 18:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320896 - head/sbin/savecore X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/savecore X-SVN-Commit-Revision: 320896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 18:24:07 -0000 Author: markj Date: Tue Jul 11 18:24:05 2017 New Revision: 320896 URL: https://svnweb.freebsd.org/changeset/base/320896 Log: Add a subroutine for comparing kerneldump identifiers. MFC after: 2 weeks Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Tue Jul 11 17:59:15 2017 (r320895) +++ head/sbin/savecore/savecore.c Tue Jul 11 18:24:05 2017 (r320896) @@ -334,6 +334,13 @@ check_space(const char *savedir, off_t dumpsize, int b return (1); } +static bool +compare_magic(const struct kerneldumpheader *kdh, const char *magic) +{ + + return (strncmp(kdh->magic, magic, sizeof(kdh->magic)) == 0); +} + #define BLOCKSIZE (1<<12) #define BLOCKMASK (~(BLOCKSIZE-1)) @@ -564,7 +571,7 @@ DoFile(const char *savedir, const char *device) } memcpy(&kdhl, temp, sizeof(kdhl)); istextdump = 0; - if (strncmp(kdhl.magic, TEXTDUMPMAGIC, sizeof kdhl) == 0) { + if (compare_magic(&kdhl, TEXTDUMPMAGIC)) { if (verbose) printf("textdump magic on last dump header on %s\n", device); @@ -578,8 +585,7 @@ DoFile(const char *savedir, const char *device) if (force == 0) goto closefd; } - } else if (memcmp(kdhl.magic, KERNELDUMPMAGIC, sizeof kdhl.magic) == - 0) { + } else if (compare_magic(&kdhl, KERNELDUMPMAGIC)) { if (dtoh32(kdhl.version) != KERNELDUMPVERSION) { syslog(LOG_ERR, "unknown version (%d) in last dump header on %s", @@ -598,8 +604,7 @@ DoFile(const char *savedir, const char *device) if (force == 0) goto closefd; - if (memcmp(kdhl.magic, KERNELDUMPMAGIC_CLEARED, - sizeof kdhl.magic) == 0) { + if (compare_magic(&kdhl, KERNELDUMPMAGIC_CLEARED)) { if (verbose) printf("forcing magic on %s\n", device); memcpy(kdhl.magic, KERNELDUMPMAGIC, From owner-svn-src-head@freebsd.org Tue Jul 11 18:46:33 2017 Return-Path: Delivered-To: svn-src-head@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 6EEC5DA9D43; Tue, 11 Jul 2017 18:46:33 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-ua0-x22e.google.com (mail-ua0-x22e.google.com [IPv6:2607:f8b0:400c:c08::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2461481CC1; Tue, 11 Jul 2017 18:46:33 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-ua0-x22e.google.com with SMTP id g40so527917uaa.3; Tue, 11 Jul 2017 11:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OIb/f0ajv5xrLrhKkgTMCeUWbhpln4YoYpBtVXhsHfg=; b=DI0eNuMeZ7CGp805KMKoQ8yipTrFYgAsHVk3vCJkPFq7oZkGQw24hKC8HQKi4holWf +qxBcb4uJ66W6WpteFeB/ai2ViAfC/stTdq39DXFcVkiP2jenu2KBa/mWqCrbQzyfPTg Z2JOEYDStUW44lZozMpDIrUGYe5YNXrnibJXQ/10TXMpDcXdHPxZxEoz7QYjFj+9soqd 64PRyRaHZfhgxV3Hnqf/SWsZIBMBsrvxy6jAhRLfaIwf7INGVAMi/Mubhfia3ZHMQt4r xcJBx/A9G0iIf9PzS20LPxKLO/AFRdkMIMqbVJSb0AesRL1D+KpCUhgkwNZJh6unsiwr Py9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OIb/f0ajv5xrLrhKkgTMCeUWbhpln4YoYpBtVXhsHfg=; b=j9kJ+rR9+DAykhxbK71EOD7rSII4SKV25kGR2hFJSUPsaB/nzzDwbhPol5MjFYWei1 PlJFRW1MUDcCEUW//LddOjYK0hV48hRphooLI1CxBq0PUaEiBsOksXA6WPy/HEoUFPSU DGy+/gR4YFxck+/lhiuWIRCzz0vGgCHbr+ULCb5aIKuopm5D4RXlaT7Kx4fRU1SOSMMC W7tXEUI9W0lBJKAEXCfJQtmbX+L00ZLtSw2DLfqsXrC4O4nySb0tqQq9MMFtpEqBzp33 VMNKfMIpEhBk4F8QAfklvoKlcKdXPLRasedmZR5XqWf2Gt1HunIc7IorqRDQ1YVU2iQJ mzfw== X-Gm-Message-State: AIVw111+KW7sQPY2oFTbaQZVqYO/kAC2PbEpZLAEkR4ESmmWFVfxe+OS O/RTIsQnPJJA2XKfK8P9VgyUSLvlfw== X-Received: by 10.176.76.36 with SMTP id l36mr721503uaf.63.1499798792154; Tue, 11 Jul 2017 11:46:32 -0700 (PDT) MIME-Version: 1.0 Sender: etnapierala@gmail.com Received: by 10.176.83.198 with HTTP; Tue, 11 Jul 2017 11:46:31 -0700 (PDT) In-Reply-To: References: <201707111232.v6BCWeXu073060@repo.freebsd.org> From: Edward Napierala Date: Tue, 11 Jul 2017 19:46:31 +0100 X-Google-Sender-Auth: z3E7LC3lj3mlXpqeRwomkfjI5pw Message-ID: Subject: Re: svn commit: r320892 - head/etc/defaults To: Ravi Pokala Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 18:46:33 -0000 Well, fsck(8) is a bit weird. Assuming you don't have /dev/md0 in your fstab(5): [trasz@v2:~]% fsck -d -t ffs -T ufs:-R /dev/md0 start (null) wait fsck_ffs /dev/md0 [trasz@v2:~]% fsck -d -t ufs -T ufs:-R /dev/md0 start (null) wait fsck_ufs -R /dev/md0 However (/ is defined as ufs in my fstab(5)): [trasz@v2:~]% fsck -d -t ffs -T ufs:-R / start / wait fsck_ufs -R /dev/ada0s1a [trasz@v2:~]% fsck -d -t ufs -T ufs:-R / start / wait fsck_ufs -R /dev/ada0s1a 2017-07-11 16:21 GMT+01:00 Ravi Pokala : > I appreciate the spirit of this change; thanks Trasz! > > A question though: you're telling the generic `fsck' to pass "-R" to > either `fsck_ffs' or `fsck_ufs', as needed. But those are both names for > the same executable. Won't the generic `fsck' always end up invoking (per > sbin/fsck/fsck.c::ptype_map[]) `fsck_ffs'? In which case, is the `fsck_ufs' > case needed here? > > Thanks, > > Ravi (rpokala@) > > -----Original Message----- > From: on behalf of Edward Tomasz > Napierala > Date: 2017-07-11, Tuesday at 05:32 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r320892 - head/etc/defaults > > Author: trasz > Date: Tue Jul 11 12:32:40 2017 > New Revision: 320892 > URL: https://svnweb.freebsd.org/changeset/base/320892 > > Log: > Make fsck_y_enable default to passing pass -R to fsck_ffs(8) in addition > to -y. To me, fsck_y_enable means "try as hard as possible", and without > -R, it... well, doesn't. > > Reviewed by: mckusick > Obtained from: CheriBSD > MFC after: 2 weeks > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D11490 > > Modified: > head/etc/defaults/rc.conf > > Modified: head/etc/defaults/rc.conf > ============================================================ > ================== > --- head/etc/defaults/rc.conf Tue Jul 11 06:39:12 2017 (r320891) > +++ head/etc/defaults/rc.conf Tue Jul 11 12:32:40 2017 (r320892) > @@ -92,7 +92,7 @@ geli_autodetach="YES" # Automatically detach on last c > root_rw_mount="YES" # Set to NO to inhibit remounting root read-write. > root_hold_delay="30" # Time to wait for root mount hold release. > fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen > fails. > -fsck_y_flags="" # Additional flags for fsck -y > +fsck_y_flags="-T ffs:-R -T ufs:-R" # Additional flags for fsck -y > background_fsck="YES" # Attempt to run fsck in the background where > possible. > background_fsck_delay="60" # Time to wait (seconds) before starting the > fsck. > netfs_types="nfs:NFS smbfs:SMB" # Net filesystems. > > > > > From owner-svn-src-head@freebsd.org Tue Jul 11 18:49:47 2017 Return-Path: Delivered-To: svn-src-head@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 F0F90DA9E0E; Tue, 11 Jul 2017 18:49:47 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-ua0-x22a.google.com (mail-ua0-x22a.google.com [IPv6:2607:f8b0:400c:c08::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A70B781EE5; Tue, 11 Jul 2017 18:49:47 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-ua0-x22a.google.com with SMTP id w19so672740uac.0; Tue, 11 Jul 2017 11:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ooFnwcBn1HwiXAaAWd91Zl4xCTx4aVJ0UOdJyYPbIkg=; b=T+OFIfK1PM4qpWVxk+2rRB9ozBViOX71pZg434mNVjnREpC9xAPwfTZHqoPfuuVxth z4fuxmlB9OYIAVHCUOEYzJqLDDkchBebU1tDdq531DbFNeAPQJ+BjIji5VzVfvDUj65C 8FpqMKmC8ic9mrG5X8wApHLjZERtPsNriEuw4ZJUmW9t6YcXA2aPXSNAt2Vk1PKsdDbV WtRGopzQYcGw8euDWY4/RM5RwymGXN0pSsI8Rxa5HanOZKBUX8dxrRnIs36++z7sELAl bQqe+i7I2P97nmJJeNzGC0J0XZSmFE/O+ZYa+Sv1FSnLOWdog0KnLxgtmWA1znRRGFQ2 9qWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ooFnwcBn1HwiXAaAWd91Zl4xCTx4aVJ0UOdJyYPbIkg=; b=LOu7GVx7SH1V1xvo72z9keuoURNQ2tqWv1WJQXYqa6oeSWs0J0GBxdaukglasCPUCq dbzssiQNzsl8Ir9Kng/12N0nIXLgOA7Z31tuh9GVTzEYMEQ9LVmwlXeDP/vgnERCRRH3 NFiLfungPDMgbwW7/ueEx6rEvdkHnDJvcnh+ylLqz8Fiuu4nsnN9QuGtksDcdcSs4Zxc SbSJWuCyNTOl5cz9xB0FxnuAxYTJ/HfBBIWvYn5N48Feej9a51X2kYA5eVdNNupnWfzt FpUdZaN3mtGvcn4uwvFBX6NS5oQs3DuD/UqSLF0CG/J1nBaBBebmLifZGj4IczHYh1vx 1tzw== X-Gm-Message-State: AIVw1116/BT0Jh0AvjQEBYTVsnh2EvS0imoBA39Rp5DhcH5PD8tuW+MK E28UUjZlFtjeXlmvOz4bv8YbBT6h7w== X-Received: by 10.176.3.117 with SMTP id 108mr756081uat.56.1499798985968; Tue, 11 Jul 2017 11:49:45 -0700 (PDT) MIME-Version: 1.0 Sender: etnapierala@gmail.com Received: by 10.176.83.198 with HTTP; Tue, 11 Jul 2017 11:49:45 -0700 (PDT) In-Reply-To: <201707111702.v6BH2aFe080928@pdx.rh.CN85.dnsmgr.net> References: <201707111232.v6BCWeXu073060@repo.freebsd.org> <201707111702.v6BH2aFe080928@pdx.rh.CN85.dnsmgr.net> From: Edward Napierala Date: Tue, 11 Jul 2017 19:49:45 +0100 X-Google-Sender-Auth: bDdqQ6ifp0ANTg1DW57-Wv55fH4 Message-ID: Subject: Re: svn commit: r320892 - head/etc/defaults To: rgrimes@freebsd.org Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 18:49:48 -0000 2017-07-11 18:02 GMT+01:00 Rodney W. Grimes : > [ Charset UTF-8 unsupported, converting... ] > > Author: trasz > > Date: Tue Jul 11 12:32:40 2017 > > New Revision: 320892 > > URL: https://svnweb.freebsd.org/changeset/base/320892 > > > > Log: > > Make fsck_y_enable default to passing pass -R to fsck_ffs(8) in > addition > > to -y. To me, fsck_y_enable means "try as hard as possible", and > without > > -R, it... well, doesn't. > > To you perhaps, but it has long been and is well known that fsck -y is > just that, fsck -y, not something more. If you want it to be more > your already given a tunable. > > I now have to "detune" all installed systems using fsck_y_enable if > I do not want them to do this. > _If_. But in most cases you do want it (imho -R should become the default eventually), and you might learn about it in a unpleasantly surprising way. Making it default is just optimizing for the common case. [..] From owner-svn-src-head@freebsd.org Tue Jul 11 18:55:53 2017 Return-Path: Delivered-To: svn-src-head@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 79C8CDAA1DF; Tue, 11 Jul 2017 18:55:53 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C285825DD; Tue, 11 Jul 2017 18:55:53 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp001.me.com by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OSX00N00V89O400@mr11p00im-asmtp001.me.com>; Tue, 11 Jul 2017 18:55:49 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1499799349; bh=h9Mvba9BO0q+6No1tT1rE36WSFgFJW2D0zt86797MlA=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=UY3ZhReSZ9zh4algQZ1k7J7Aft+VKeiT3IngLJZFrkssMQOq+wcQQcJ+uqGAaRhZ6 sXOEgSdNJ59GG9hsSzBrYGRmrFFTWtyIKrCurrtoABxWO9iCkE21GvmLOtXk0pIyry qNnj52RNdYT3O37KipPacK0FtT33ol9erUNdNyn9t02cZhGcfjupNca3ZaXyzozZq0 KbhwNgxh/nlfHSpSP5gHZgGFWkHDOL7V5GrH7iJ1mzNS/lPkn2fqwjhFXa4UTH385k lLS/826j5TS9eHRsNx6HuDe0LbNeUOVrQtXHWdWG81gfN+bLGOrsJV546ko4YMEdS8 3EIjMTC85/fBg== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OSX00N4HWKYY010@mr11p00im-asmtp001.me.com>; Tue, 11 Jul 2017 18:55:47 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-11_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1701120000 definitions=main-1707110305 User-Agent: Microsoft-MacOutlook/f.21.0.170409 Date: Tue, 11 Jul 2017 11:55:45 -0700 Subject: Re: svn commit: r320892 - head/etc/defaults From: Ravi Pokala To: Edward Napierala Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-id: Thread-topic: svn commit: r320892 - head/etc/defaults References: <201707111232.v6BCWeXu073060@repo.freebsd.org> In-reply-to: MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 18:55:53 -0000 So the answer is "magic!" ;-) Fair enough; I'll RTFSource if I'm still sufficiently curious tomorrow. :-) Thanks again, Ravi (rpokala@) -----Original Message----- From: on behalf of Edward Napierala Date: 2017-07-11, Tuesday at 11:46 To: Ravi Pokala Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r320892 - head/etc/defaults Well, fsck(8) is a bit weird. Assuming you don't have /dev/md0 in your fstab(5): [trasz@v2:~]% fsck -d -t ffs -T ufs:-R /dev/md0 start (null) wait fsck_ffs /dev/md0 [trasz@v2:~]% fsck -d -t ufs -T ufs:-R /dev/md0 start (null) wait fsck_ufs -R /dev/md0 However (/ is defined as ufs in my fstab(5)): [trasz@v2:~]% fsck -d -t ffs -T ufs:-R / start / wait fsck_ufs -R /dev/ada0s1a [trasz@v2:~]% fsck -d -t ufs -T ufs:-R / start / wait fsck_ufs -R /dev/ada0s1a 2017-07-11 16:21 GMT+01:00 Ravi Pokala : I appreciate the spirit of this change; thanks Trasz! A question though: you're telling the generic `fsck' to pass "-R" to either `fsck_ffs' or `fsck_ufs', as needed. But those are both names for the same executable. Won't the generic `fsck' always end up invoking (per sbin/fsck/fsck.c::ptype_map[]) `fsck_ffs'? In which case, is the `fsck_ufs' case needed here? Thanks, Ravi (rpokala@) -----Original Message----- From: on behalf of Edward Tomasz Napierala Date: 2017-07-11, Tuesday at 05:32 To: , , Subject: svn commit: r320892 - head/etc/defaults Author: trasz Date: Tue Jul 11 12:32:40 2017 New Revision: 320892 URL: https://svnweb.freebsd.org/changeset/base/320892 Log: Make fsck_y_enable default to passing pass -R to fsck_ffs(8) in addition to -y. To me, fsck_y_enable means "try as hard as possible", and without -R, it... well, doesn't. Reviewed by: mckusick Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11490 Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Tue Jul 11 06:39:12 2017 (r320891) +++ head/etc/defaults/rc.conf Tue Jul 11 12:32:40 2017 (r320892) @@ -92,7 +92,7 @@ geli_autodetach="YES" # Automatically detach on last c root_rw_mount="YES" # Set to NO to inhibit remounting root read-write. root_hold_delay="30" # Time to wait for root mount hold release. fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails. -fsck_y_flags="" # Additional flags for fsck -y +fsck_y_flags="-T ffs:-R -T ufs:-R" # Additional flags for fsck -y background_fsck="YES" # Attempt to run fsck in the background where possible. background_fsck_delay="60" # Time to wait (seconds) before starting the fsck. netfs_types="nfs:NFS smbfs:SMB" # Net filesystems. From owner-svn-src-head@freebsd.org Tue Jul 11 18:56:43 2017 Return-Path: Delivered-To: svn-src-head@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 77423DAA251; Tue, 11 Jul 2017 18:56:43 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7A2282736; Tue, 11 Jul 2017 18:56:42 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([80.171.206.93]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MVNDK-1dAj5r2Nwc-00YhyE; Tue, 11 Jul 2017 20:56:33 +0200 Date: Tue, 11 Jul 2017 20:56:24 +0200 From: "O. Hartmann" To: Warner Losh Cc: "O. Hartmann" , "svn-src-head@freebsd.org" , Marius Strobl , src-committers , Warner Losh , "svn-src-all@freebsd.org" Subject: Re: svn commit: r320844 - in head: etc/mtree include lib/libcam sys/amd64/conf sys/arm/broadcom/bcm2835 sys/arm/conf sys/arm/ti sys/cam sys/cam/mmc sys/cam/scsi sys/conf sys/dev/mmc sys/dev/sdhci sys/m... Message-ID: <20170711205624.6b7d9814@thor.intern.walstatt.dynvpn.de> In-Reply-To: References: <201707091657.v69GvOar096942@repo.freebsd.org> <20170709184221.GB38352@alchemy.franken.de> <20170710182048.3809fa38@thor.intern.walstatt.dynvpn.de> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/XjhC+gCxxBm=0w1GDweBtZ/"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:Cw+td4pBC5ZbW4/4F7m8sfjwUmFtYej5M4Rnmroc+po1EcwxKNk 6+0iPLiFlgoYuDB0F3Lh3Cituh9nL7RRRfo7e6BXnFNaWzUBFmrCDaODUVxeIMCuC4AMv4V XwYau9sONbXCriWwcS9kB2BnuGySeT7ZBzvVh2rkInBm7CBr95g9/h95IymLQq3zWIeYcmc s+ebLXUyN039uJuJFueUQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:NRlR7v/5IFI=:9/3iG13UuFu1Pz4Er/xe3W s8YXX6zI1F5a/80h8JHGaCCx7L8XCo7bucqCuHMMjoWM8bPpbAgu0CI/CYm8W40JZglqZj1OU Uc7iqLl8OU9KNp9RJYgcu5jn/byf4uFSf2UdSlHrVQY5o2P7cQ1vU/FKYkRzRZKj28ffdWzn0 9MzuqODv+HCbh4hcf530ZyPq7hC/X/OBsXjL0l1dV6owgg4TlbqAJk0MrGgMArxLAuuT0XBl0 EerQfrQpfLu8JkXMMUn6N8PBtjEUfGrWy2P7ZnT8iQtWaa4wauSl+dh3LZW6f5eJEmMX280hz E0F8hUwvMGrR3KeEoHAF04F6LLqNhlX/pNLX8rY3hzGItJszJjEj2BuoIdL9tRgqcT1sdhmVH D/K/3muozgW9bvaA88UX+UPAb4k6Np/Vz1PSrCO3rfsPrbyEpwvCpdYz8VjVnIddUw89nJn0c MlG2MtXyUoDOUjyaY0iDqXxffcXlycabS8KUd2I/wFCvBtMx7HSUKKrt0+UICN6vZzgL30Oxs 675PI9cIrItI5MO73rOUR4IXUAgXu1vg5fOHXjCgFZzJy6Vdg71fEQyQIPzek31xsBYd9tC2Q qtpoZ2tJXImxdJWVdkgm5iKBU8RDF9o7/AA0hfMFxW8YmYJ+n7SbYE0quUCBOhFv+nwMRRjKC oKtWprabD1PeXSIt6aYcWZvOOpEkVq8ARR5ZEAQkBzzeh1JryDRGrAt0Cr4abv/QNd9Hyc6lm D8W8f25VktkQwiNYb6wCAoS1Kp7RtZQdNC31c+B12LPPC4aIip7PlOWrKhk= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 18:56:43 -0000 --Sig_/XjhC+gCxxBm=0w1GDweBtZ/ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Mon, 10 Jul 2017 14:05:58 -0600 Warner Losh schrieb: > On Mon, Jul 10, 2017 at 10:21 AM, O. Hartmann > wrote: >=20 > > Am Sun, 9 Jul 2017 20:42:21 +0200 > > Marius Strobl schrieb: > > =20 > > > On Sun, Jul 09, 2017 at 04:57:24PM +0000, Warner Losh wrote: =20 > > > > Author: imp > > > > Date: Sun Jul 9 16:57:24 2017 > > > > New Revision: 320844 > > > > URL: https://svnweb.freebsd.org/changeset/base/320844 > > > > > > > > Log: > > > > An MMC/SD/SDIO stack using CAM > > > > > > > > Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's > > > > flexible queueing will make it easier to write non-storage drivers > > > > than the legacy stack. SDIO drivers from both the kernel and as > > > > userland daemons are possible, though much of that functionality = will > > > > come later. =20 > > > > > > At least with a non-MMCCAM kernel, with this revision in place I get > > > an endless storm of "unexpected" SDHCI_INT_CARD_INT interrupts during > > > boot. Apparently this is due to the fact that sdhci(4) now enables > > > these interrupts, but sdhci_generic_intr() neither actually handles > > > them nor clears them from intmask. > > > > > > Btw., were mmc.ko and mmcsd.ko disconnected on purpose with this comm= it? > > > > > > Marius =20 > > > > I updated just to r320873. > > My box is booting off a Samsung SSD 830/UFS2 (GPT) and worked fine with > > r320829 and hangs > > now again at: > > > > mountroot: Waiting for device /dev/gpt/root ... > > Mounting from ufs:/dev/gpt/root failed with error 19 > > > > mountroot >: ? > > > > List of GEOM managed disk devices > > > > mountroot >: > > > > What happened here? > > > > > > I run a custom kernel with ZFS compiled in ... > > > > =20 > No clue. the information provided is insufficient to track down the > problem. Can you give a full dmesg? And can you bisect the revs from > r320829 to r320873 to see which one breaks things? >=20 > Warner > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" I followed your advice given to delete /usr/obj/usr/src/sys/KERNELNAME and = rebuild the system. I use META_MODE, but I had recompiled world before from scratch sin= ce I gave up using WITH_LLD_IS_LD and needed a clean world. But after rebuilding the wor= ld, I did several updates and rebuilds with filemon after that and it seems that caus= ed the trouble! I have no sdhci driver compiled into that kernel so far. Now the box is running FreeBSD 12.0-CURRENT #1 r320896: Tue Jul 11 20:34:46= CEST 2017 amd64. Thanks for the hint. Kind regards, Oliver --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_/XjhC+gCxxBm=0w1GDweBtZ/ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWWUfWAAKCRDS528fyFhY lM5cAfoD+oprrxEnbzuOqT952T6LUkcdDn/qksQDFkSQAmFncw4/+JRMGMsQ88xn DcxD3X24MQgXCaNTwqYPFvRd7BEHAgCXnRhMz3FfbbfD+ZcpS59WiNtM6OOMd/je j5X7Np+DM3ch+IwRzZs8uaXpDJwFy3bvNWcDMswNKBWG4p8uOWer =xOca -----END PGP SIGNATURE----- --Sig_/XjhC+gCxxBm=0w1GDweBtZ/-- From owner-svn-src-head@freebsd.org Tue Jul 11 20:12:35 2017 Return-Path: Delivered-To: svn-src-head@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 5652FDAB66B; Tue, 11 Jul 2017 20:12:35 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr0-x231.google.com (mail-wr0-x231.google.com [IPv6:2a00:1450:400c:c0c::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE8BE656DE; Tue, 11 Jul 2017 20:12:34 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr0-x231.google.com with SMTP id k67so4167449wrc.2; Tue, 11 Jul 2017 13:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=6JQKWRoaFiS2Froyox2oo022VPU0hB8qOfJIvqDfmRg=; b=WZa5yuB+RW2nK/DpzEFyKRcjaYEBt2BPQ7J334Z61DKFtuIFdS+w/JHdNKNZ9NuAgj sXtjG2zPjgors7yCmPO/ym7bDLiFWHOyfGz2w23MpJgoF1mZvTfznnDw3AgQ6z6tqh3g MAjEOejQwRD8EV2KqNpSs+/iwLkcsN8UdPoCzABRks9yXvx5IeIZFI1XffP67cEPtro1 EgLyBjU8YW3nqFmXFXrPILyEvHuU2OU/fhdq5ta4zWfe8BWuTMzr89VCQEUeGUTehCXR RAZ5VqRydzwVVnuzIZfwcAudKwyok2QBW5/rnejI+j0LZA8ukkxAuIZYj7n9cufAXoIS KlWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=6JQKWRoaFiS2Froyox2oo022VPU0hB8qOfJIvqDfmRg=; b=dglKGKsRTLyPPaDrknqSRTpK0eG6wmENBo28YeUEE3Co3NyfMMt/mfnQRqjXZhdO2M z0knAOEDFvNXLOFFQDVG7SdCXD9I/3L+P1WEf857WuvNNVcRlC5v03KUfNOfPxx+AQ2p /N36HD30ZzgUT+iyIyAiv+wv26TRsMOwaD88i3OQmze7BoeXLGlAN+fIGhSZhdJtOLku PGSiI+GGa1GAZC6LXM4a4Q0g/2d9MLKWcAq1Uw5p43vOi5boKRhWtu1GCyPAH+WfsW4h IOQgLNqcuZbEi/Q65I5psqBgFXPKcDmN+q3EVtHHhqQTNNkwKCSQWsnFG0oNtQJdCiWs ukZg== X-Gm-Message-State: AIVw113Gi6aFKPFfV0jilxFtixbouDFK9VNskDwURK93IUm7oZcjHjhH 4NDJCwG/SG2Ts6rK X-Received: by 10.223.154.206 with SMTP id a72mr933541wrc.47.1499803952982; Tue, 11 Jul 2017 13:12:32 -0700 (PDT) Received: from brick (cpc92310-cmbg19-2-0-cust934.5-4.cable.virginm.net. [82.9.227.167]) by smtp.gmail.com with ESMTPSA id k75sm261991wmh.10.2017.07.11.13.12.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 13:12:32 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Tue, 11 Jul 2017 21:12:30 +0100 From: Edward Tomasz Napierala To: rgrimes@freebsd.org Cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320803 - head/sbin/mount Message-ID: <20170711201230.GB1725@brick> Mail-Followup-To: rgrimes@freebsd.org, Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <20170708171641.GA1129@brick> <201707081734.v68HYpN9068500@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707081734.v68HYpN9068500@pdx.rh.CN85.dnsmgr.net> User-Agent: Mutt/1.8.2 (2017-04-18) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 20:12:35 -0000 On 0708T1034, Rodney W. Grimes wrote: > [ Charset ISO-8859-1 unsupported, converting... ] > > On 0708T1102, Ian Lepore wrote: > > > On Sat, 2017-07-08 at 09:50 -0700, Rodney W. Grimes wrote: > > > > [ Charset UTF-8 unsupported, converting... ] > > > > > > > > > > Author: trasz > > > > > Date: Sat Jul??8 11:06:27 2017 > > > > > New Revision: 320803 > > > > > URL: https://svnweb.freebsd.org/changeset/base/320803 > > > > > > > > > > Log: > > > > > ? Fix "mount -uw /" when the filesystem type doesn't match. > > > > > ?? > > > > > ? This basically makes "mount -uw /" work when the filesystem > > > > > ? mounted on / is NFS, but the one configured in fstab(5) is UFS, > > > > > ? which can happen when you forget to modify fstab. > > > > Please do not silence user errors because they are inconvinient, > > > > this is a configuration error and the system should fail to? > > > > mount the incorrectly configured root. > > > > > > > > If we start changing things to silently ignore user configuration > > > > errors we are going down a very slippery road. > > > > It doesn't silence down the error. What it does is it makes it possible > > to use "mount -uw /" - previously it would fail in a rather nonsensical > > way, by calling "mount_nfs -o upgrade,rw /dev/ada0 /". > > It DOES silence the error. My configuration TOLD it to execute that > rather nonsensical command, your change now causes it to execute something > that my configuration did NOT tell it to do. I don't know your configuration; mine certainly didn't tell it to try to mount /dev/ada0 as NFS. What I certainly _did_ told it was to "mount -uw /", and previously, in some cases, it failed to do this. Now it works. >From a practical standpoint, it's like this: I have an NFS root filesystem mounted read-only. There's a slightly wrong fstab. I want to remount it read-write and fix it. With UFS I can. I expect the same with NFS. > > > IMO, this change fixes the right problem, but maybe does so the wrong > > > way. ?Mount -u is by definition an update to an existing mount. ?There > > > should be no need to consult /etc/fstab for an existing mount since the > > > info is available from the kernel. > > > > > > Note that I say the foregoing with my user hat on. ?I haven't looked at > > > the code to see if there's some reason why my common-sensical way of > > > thinking about it is actually impossible to implement for some reason. > > > > I wouldn't expect it to consult fstab either, to be honest. But it does, > > and I suspect changing that would break someone's config. > > It reads the fstab to get the options that may be specified there > that your mount -uw / command does not specify, realize the kernel > when mounting / does so in a very minimal way, when you invoke > mount -u the parameters in /etc/fstab come in to play. Yup, that's it. So it is right in most cases - it's just that the hack for "/" case sometimes worked in an way that's pretty obviously wrong (using the fstab value for "mounted from", but ignoring the filesystem type), although didn't hurt before reroot, because it could never happen. > I believe KIB refered to this during your differential when he said > something like "what if the options disagree". Possibly. From owner-svn-src-head@freebsd.org Tue Jul 11 20:35:24 2017 Return-Path: Delivered-To: svn-src-head@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 EBFF6DABB35 for ; Tue, 11 Jul 2017 20:35:24 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (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 CF35267147 for ; Tue, 11 Jul 2017 20:35:24 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 7624ea03-6678-11e7-bfd0-afd4446ba3af X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 7624ea03-6678-11e7-bfd0-afd4446ba3af; Tue, 11 Jul 2017 20:35:22 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v6BKZFUD044104; Tue, 11 Jul 2017 14:35:15 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1499805315.45330.14.camel@freebsd.org> Subject: Re: svn commit: r320803 - head/sbin/mount From: Ian Lepore To: Edward Tomasz Napierala , rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 11 Jul 2017 14:35:15 -0600 In-Reply-To: <20170711201230.GB1725@brick> References: <20170708171641.GA1129@brick> <201707081734.v68HYpN9068500@pdx.rh.CN85.dnsmgr.net> <20170711201230.GB1725@brick> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 20:35:25 -0000 On Tue, 2017-07-11 at 21:12 +0100, Edward Tomasz Napierala wrote: > On 0708T1034, Rodney W. Grimes wrote: > > > > [ Charset ISO-8859-1 unsupported, converting... ] > > > > > > On 0708T1102, Ian Lepore wrote: > > > > > > > > On Sat, 2017-07-08 at 09:50 -0700, Rodney W. Grimes wrote: > > > > > > > > > > [ Charset UTF-8 unsupported, converting... ] > > > > > > > > > > > > > > > > > > Author: trasz > > > > > > Date: Sat Jul??8 11:06:27 2017 > > > > > > New Revision: 320803 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/320803 > > > > > > > > > > > > Log: > > > > > > ? Fix "mount -uw /" when the filesystem type doesn't match. > > > > > > ?? > > > > > > ? This basically makes "mount -uw /" work when the > > > > > > filesystem > > > > > > ? mounted on / is NFS, but the one configured in fstab(5) > > > > > > is UFS, > > > > > > ? which can happen when you forget to modify fstab. > > > > > Please do not silence user errors because they are > > > > > inconvinient, > > > > > this is a configuration error and the system should fail to? > > > > > mount the incorrectly configured root. > > > > > > > > > > If we start changing things to silently ignore user > > > > > configuration > > > > > errors we are going down a very slippery road. > > > It doesn't silence down the error.  What it does is it makes it > > > possible > > > to use "mount -uw /" - previously it would fail in a rather > > > nonsensical > > > way, by calling "mount_nfs -o upgrade,rw /dev/ada0 /". > > It DOES silence the error.  My configuration TOLD it to execute > > that > > rather nonsensical command, your change now causes it to execute > > something > > that my configuration did NOT tell it to do. > I don't know your configuration; mine certainly didn't tell it to try > to > mount /dev/ada0 as NFS.  What I certainly _did_ told it was to "mount > -uw /", > and previously, in some cases, it failed to do this.  Now it works. > > From a practical standpoint, it's like this: I have an NFS root > filesystem > mounted read-only.  There's a slightly wrong fstab.  I want to > remount it > read-write and fix it.  With UFS I can.  I expect the same with NFS. > > > > > > > > > > > > > > IMO, this change fixes the right problem, but maybe does so the > > > > wrong > > > > way. ?Mount -u is by definition an update to an existing mount. > > > > ?There > > > > should be no need to consult /etc/fstab for an existing mount > > > > since the > > > > info is available from the kernel. > > > > > > > > Note that I say the foregoing with my user hat on. ?I haven't > > > > looked at > > > > the code to see if there's some reason why my common-sensical > > > > way of > > > > thinking about it is actually impossible to implement for some > > > > reason. > > > I wouldn't expect it to consult fstab either, to be honest.  But > > > it does, > > > and I suspect changing that would break someone's config. > > It reads the fstab to get the options that may be specified there > > that your mount -uw / command does not specify, realize the kernel > > when mounting / does so in a very minimal way, when you invoke > > mount -u the parameters in /etc/fstab come in to play. > Yup, that's it.  So it is right in most cases - it's just that the > hack > for "/" case sometimes worked in an way that's pretty obviously wrong > (using the fstab value for "mounted from", but ignoring the > filesystem > type), although didn't hurt before reroot, because it could never > happen. > > > > > I believe KIB refered to this during your differential when he said > > something like "what if the options disagree". > Possibly. I think the docs on this are pretty clear... under -u it says: The set of options is determined by applying the options specified in the argument to -o and finally applying the -r or -w option. To me, that says that nothing in /etc/fstab is germane to mount -u unless one of the other args to mount -u is -o fstab. This change (r320803) seems like an acceptable workaround, but I think the correct long term fix would be to not even open /etc/fstab on mount -u without -o fstab.  But that may be harder to do than to say; I still haven't actually looked at the code involved. -- Ian From owner-svn-src-head@freebsd.org Tue Jul 11 21:47:21 2017 Return-Path: Delivered-To: svn-src-head@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 82C16DACA95; Tue, 11 Jul 2017 21:47:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ED7B68F26; Tue, 11 Jul 2017 21:47:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 2148510AB01; Tue, 11 Jul 2017 17:47:19 -0400 (EDT) From: John Baldwin To: Ian Lepore Cc: Edward Tomasz Napierala , rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320803 - head/sbin/mount Date: Tue, 11 Jul 2017 14:47:02 -0700 Message-ID: <5242112.0aHCQARnit@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <1499805315.45330.14.camel@freebsd.org> References: <20170708171641.GA1129@brick> <20170711201230.GB1725@brick> <1499805315.45330.14.camel@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 11 Jul 2017 17:47:19 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 21:47:21 -0000 On Tuesday, July 11, 2017 02:35:15 PM Ian Lepore wrote: > I think the docs on this are pretty clear... under -u it says: > > The set of options is determined by applying the options specified > in the argument to -o and finally applying the -r or -w option. > > To me, that says that nothing in /etc/fstab is germane to mount -u > unless one of the other args to mount -u is -o fstab. > > This change (r320803) seems like an acceptable workaround, but I think > the correct long term fix would be to not even open /etc/fstab on mount > -u without -o fstab. But that may be harder to do than to say; I still > haven't actually looked at the code involved. I concur with this. I've always viewed '-u' as meaning "apply a delta to the current configuration", not "add this delta to the fstab options and then apply that entire set of options". In practice, it seems that it doesn't do either of those, but instead it seems to treats the options passed to -o as the entire list of options. This is perhaps a bit surprising. For example, suppose you had this: /etc/fstab: /dev/md0 /bar ufs ro,noauto,noexec 0 0 # mount /bar # mount | grep bar /dev/md0 on /bar (ufs, local, noexec, read-only) # mount -u -o rw /bar /dev/md0 on /bar (ufs, local) (We just lost "noexec" from fstab by upgrading to read-write) # mount -u -o nosuid /bar # mount | grep bar /dev/md0 on /bar (ufs, local, nosuid) (Did not lose "read-write" somehow, RO vs RW must be magically sticky?) # mount -u -o fstab,nosuid /bar # mount |grep bar /dev/md0 on /bar (ufs, local, noexec, nosuid) (Did not honor "ro" from fstab! Left mount RW) It would seem that there is no actual rhyme or reason to how mount -u works, and certainly Edward's change doesn't make it worse. I would like to have some kind of mode where you can toggle one or more options without disturbing others. Maybe if we had a new "special" option called "current" or some such that is like "fstab" but instead represents the options currently in force, then you could do true delta operations via 'mount -o current,rw -u /foo'. As it is, there doesn't currently seem to a reliable way to achieve that functionality. (I started this mail expecting that '-u' operated by performing deltas against the current configuration and was quite Astonished to discover the actual behavior. It seems very unsafe to use mount -u if you have any options in your fstab outside of things like "noauto" or "late".) -- John Baldwin From owner-svn-src-head@freebsd.org Tue Jul 11 21:55:22 2017 Return-Path: Delivered-To: svn-src-head@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 D8631DACD90; Tue, 11 Jul 2017 21:55:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 98E026A773; Tue, 11 Jul 2017 21:55:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BLtLAF006627; Tue, 11 Jul 2017 21:55:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BLtKbZ006618; Tue, 11 Jul 2017 21:55:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201707112155.v6BLtKbZ006618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 11 Jul 2017 21:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320900 - in head/sys: fs/cd9660 fs/ext2fs fs/fifofs fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: fs/cd9660 fs/ext2fs fs/fifofs fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs ufs/ufs X-SVN-Commit-Revision: 320900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 21:55:23 -0000 Author: jhb Date: Tue Jul 11 21:55:20 2017 New Revision: 320900 URL: https://svnweb.freebsd.org/changeset/base/320900 Log: Consistently use vop_stdpathconf() for default pathconf values. Update filesystems not currently using vop_stdpathconf() in pathconf VOPs to use vop_stdpathconf() for any configuration variables that do not have filesystem-specific values. vop_stdpathconf() is used for variables that have system-wide settings as well as providing default values for some values based on system limits. Filesystems can still explicitly override individual settings. PR: 219851 Reported by: cem Reviewed by: cem, kib, ngie MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D11541 Modified: head/sys/fs/cd9660/cd9660_vnops.c head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/fifofs/fifo_vnops.c head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/fs/nandfs/nandfs_vnops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/smbfs/smbfs_vnops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/cd9660/cd9660_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -792,20 +792,11 @@ cd9660_pathconf(ap) else *ap->a_retval = 37; return (0); - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); case _PC_NO_TRUNC: *ap->a_retval = 1; return (0); default: - return (EINVAL); + return (vop_stdpathconf(ap)); } /* NOTREACHED */ } Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/ext2fs/ext2_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -1627,18 +1627,6 @@ ext2_pathconf(struct vop_pathconf_args *ap) else *ap->a_retval = ext2_max_nlink(VTOI(ap->a_vp)); break; - case _PC_NAME_MAX: - *ap->a_retval = NAME_MAX; - break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - break; case _PC_NO_TRUNC: *ap->a_retval = 1; break; @@ -1661,11 +1649,6 @@ ext2_pathconf(struct vop_pathconf_args *ap) case _PC_MIN_HOLE_SIZE: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -1695,7 +1678,7 @@ ext2_pathconf(struct vop_pathconf_args *ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/fifofs/fifo_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -71,7 +71,6 @@ struct fifoinfo { static vop_print_t fifo_print; static vop_open_t fifo_open; static vop_close_t fifo_close; -static vop_pathconf_t fifo_pathconf; static vop_advlock_t fifo_advlock; struct vop_vector fifo_specops = { @@ -87,7 +86,7 @@ struct vop_vector fifo_specops = { .vop_mkdir = VOP_PANIC, .vop_mknod = VOP_PANIC, .vop_open = fifo_open, - .vop_pathconf = fifo_pathconf, + .vop_pathconf = vop_stdpathconf, .vop_print = fifo_print, .vop_read = VOP_PANIC, .vop_readdir = VOP_PANIC, @@ -337,34 +336,6 @@ fifo_print(ap) fifo_printinfo(ap->a_vp); printf("\n"); return (0); -} - -/* - * Return POSIX pathconf information applicable to fifo's. - */ -static int -fifo_pathconf(ap) - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - int *a_retval; - } */ *ap; -{ - - switch (ap->a_name) { - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); - default: - return (EINVAL); - } - /* NOTREACHED */ } /* Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -1875,17 +1875,11 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) case _PC_NAME_MAX: *ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12; return (0); - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); case _PC_NO_TRUNC: *ap->a_retval = 0; return (0); default: - return (EINVAL); + return (vop_stdpathconf(ap)); } /* NOTREACHED */ } Modified: head/sys/fs/nandfs/nandfs_vnops.c ============================================================================== --- head/sys/fs/nandfs/nandfs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/nandfs/nandfs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -2236,21 +2236,6 @@ nandfs_pathconf(struct vop_pathconf_args *ap) error = 0; switch (ap->a_name) { - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - break; - case _PC_NAME_MAX: - *ap->a_retval = NAME_MAX; - break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - break; case _PC_NO_TRUNC: *ap->a_retval = 1; break; @@ -2273,7 +2258,7 @@ nandfs_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -3481,12 +3481,6 @@ nfs_pathconf(struct vop_pathconf_args *ap) case _PC_NAME_MAX: *ap->a_retval = pc.pc_namemax; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = pc.pc_chownrestricted; break; @@ -3512,11 +3506,6 @@ nfs_pathconf(struct vop_pathconf_args *ap) case _PC_MAC_PRESENT: *ap->a_retval = 0; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -3549,7 +3538,7 @@ nfs_pathconf(struct vop_pathconf_args *ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/smbfs/smbfs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -907,7 +907,7 @@ smbfs_pathconf (ap) *retval = 800; /* XXX: a correct one ? */ break; default: - error = EINVAL; + error = vop_stdpathconf(ap); } return error; } Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -1344,26 +1344,6 @@ tmpfs_pathconf(struct vop_pathconf_args *v) error = 0; switch (name) { - case _PC_LINK_MAX: - *retval = LINK_MAX; - break; - - case _PC_NAME_MAX: - *retval = NAME_MAX; - break; - - case _PC_PATH_MAX: - *retval = PATH_MAX; - break; - - case _PC_PIPE_BUF: - *retval = PIPE_BUF; - break; - - case _PC_CHOWN_RESTRICTED: - *retval = 1; - break; - case _PC_NO_TRUNC: *retval = 1; break; @@ -1377,7 +1357,7 @@ tmpfs_pathconf(struct vop_pathconf_args *v) break; default: - error = EINVAL; + error = vop_stdpathconf(v); } return error; Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) +++ head/sys/ufs/ufs/ufs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) @@ -2442,21 +2442,9 @@ ufs_pathconf(ap) error = 0; switch (ap->a_name) { - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - break; case _PC_NAME_MAX: *ap->a_retval = UFS_MAXNAMLEN; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - break; - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - break; case _PC_NO_TRUNC: *ap->a_retval = 1; break; @@ -2505,11 +2493,6 @@ ufs_pathconf(ap) case _PC_MIN_HOLE_SIZE: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -2539,7 +2522,7 @@ ufs_pathconf(ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); From owner-svn-src-head@freebsd.org Wed Jul 12 02:42:58 2017 Return-Path: Delivered-To: svn-src-head@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 B8398DB12BF; Wed, 12 Jul 2017 02:42:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 945E3755D4; Wed, 12 Jul 2017 02:42:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6C2gvXL026202; Wed, 12 Jul 2017 02:42:57 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6C2gvDB026199; Wed, 12 Jul 2017 02:42:57 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707120242.v6C2gvDB026199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 12 Jul 2017 02:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320901 - in head/sys: amd64/amd64 isa x86/isa X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: amd64/amd64 isa x86/isa X-SVN-Commit-Revision: 320901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 02:42:58 -0000 Author: ian Date: Wed Jul 12 02:42:57 2017 New Revision: 320901 URL: https://svnweb.freebsd.org/changeset/base/320901 Log: Protect access to the AT realtime clock with its own mutex. The mutex protecting access to the registered realtime clock should not be overloaded to protect access to the atrtc hardware, which might not even be the registered rtc. More importantly, the resettodr mutex needs to be eliminated to remove locking/sleeping restrictions on clock drivers, and that can't happen if MD code for amd64 depends on it. This change moves the protection into what's really being protected: access to the atrtc date and time registers. This change also adds protection when the clock is accessed from xentimer_settime(), which bypasses the resettodr locking. Differential Revision: https://reviews.freebsd.org/D11483 Modified: head/sys/amd64/amd64/efirt.c head/sys/isa/rtc.h head/sys/x86/isa/atrtc.c Modified: head/sys/amd64/amd64/efirt.c ============================================================================== --- head/sys/amd64/amd64/efirt.c Tue Jul 11 21:55:20 2017 (r320900) +++ head/sys/amd64/amd64/efirt.c Wed Jul 12 02:42:57 2017 (r320901) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -445,7 +446,7 @@ efi_get_time_locked(struct efi_tm *tm) efi_status status; int error; - mtx_assert(&resettodr_lock, MA_OWNED); + mtx_assert(&atrtc_time_lock, MA_OWNED); error = efi_enter(); if (error != 0) return (error); @@ -462,9 +463,9 @@ efi_get_time(struct efi_tm *tm) if (efi_runtime == NULL) return (ENXIO); - mtx_lock(&resettodr_lock); + mtx_lock(&atrtc_time_lock); error = efi_get_time_locked(tm); - mtx_unlock(&resettodr_lock); + mtx_unlock(&atrtc_time_lock); return (error); } @@ -487,7 +488,7 @@ efi_set_time_locked(struct efi_tm *tm) efi_status status; int error; - mtx_assert(&resettodr_lock, MA_OWNED); + mtx_assert(&atrtc_time_lock, MA_OWNED); error = efi_enter(); if (error != 0) return (error); @@ -504,9 +505,9 @@ efi_set_time(struct efi_tm *tm) if (efi_runtime == NULL) return (ENXIO); - mtx_lock(&resettodr_lock); + mtx_lock(&atrtc_time_lock); error = efi_set_time_locked(tm); - mtx_unlock(&resettodr_lock); + mtx_unlock(&atrtc_time_lock); return (error); } Modified: head/sys/isa/rtc.h ============================================================================== --- head/sys/isa/rtc.h Tue Jul 11 21:55:20 2017 (r320900) +++ head/sys/isa/rtc.h Wed Jul 12 02:42:57 2017 (r320901) @@ -113,6 +113,7 @@ #ifdef _KERNEL extern struct mtx clock_lock; +extern struct mtx atrtc_time_lock; extern int atrtcclock_disable; int rtcin(int reg); void atrtc_restore(void); Modified: head/sys/x86/isa/atrtc.c ============================================================================== --- head/sys/x86/isa/atrtc.c Tue Jul 11 21:55:20 2017 (r320900) +++ head/sys/x86/isa/atrtc.c Wed Jul 12 02:42:57 2017 (r320901) @@ -53,9 +53,17 @@ __FBSDID("$FreeBSD$"); #include #include "clock_if.h" +/* + * clock_lock protects low-level access to individual hardware registers. + * atrtc_time_lock protects the entire sequence of accessing multiple registers + * to read or write the date and time. + */ #define RTC_LOCK do { if (!kdb_active) mtx_lock_spin(&clock_lock); } while (0) #define RTC_UNLOCK do { if (!kdb_active) mtx_unlock_spin(&clock_lock); } while (0) +struct mtx atrtc_time_lock; +MTX_SYSINIT(atrtc_lock_init, &atrtc_time_lock, "atrtc", MTX_DEF); + int atrtcclock_disable = 0; static int rtc_reg = -1; @@ -163,6 +171,8 @@ atrtc_set(struct timespec *ts) clock_ts_to_ct(ts, &ct); + mtx_lock(&atrtc_time_lock); + /* Disable RTC updates and interrupts. */ writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); @@ -181,6 +191,8 @@ atrtc_set(struct timespec *ts) /* Re-enable RTC updates and interrupts. */ writertc(RTC_STATUSB, rtc_statusb); rtcin(RTC_INTR); + + mtx_unlock(&atrtc_time_lock); } /********************************************************************** @@ -352,6 +364,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) * to make sure that no more than 240us pass after we start reading, * and try again if so. */ + mtx_lock(&atrtc_time_lock); while (rtcin(RTC_STATUSA) & RTCSA_TUP) continue; critical_enter(); @@ -369,6 +382,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) ct.year += (ct.year < 80 ? 2000 : 1900); #endif critical_exit(); + mtx_unlock(&atrtc_time_lock); /* Set dow = -1 because some clocks don't set it correctly. */ ct.dow = -1; return (clock_ct_to_ts(&ct, ts)); From owner-svn-src-head@freebsd.org Wed Jul 12 02:53:56 2017 Return-Path: Delivered-To: svn-src-head@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 1DB15DB162B; Wed, 12 Jul 2017 02:53:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 EC20675C31; Wed, 12 Jul 2017 02:53:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6C2rtwK030632; Wed, 12 Jul 2017 02:53:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6C2rs2W030630; Wed, 12 Jul 2017 02:53:54 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707120253.v6C2rs2W030630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 12 Jul 2017 02:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320902 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 320902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 02:53:56 -0000 Author: ian Date: Wed Jul 12 02:53:54 2017 New Revision: 320902 URL: https://svnweb.freebsd.org/changeset/base/320902 Log: Support multiple realtime clocks, and remove locking/sleeping restrictions on clock drivers. This tracks multiple concurrent realtime clock drivers in a list sorted by clock resolution. When system time changes (and periodically) the clock_settime() methods of all registered clocks are invoked. To initialize system time, each driver is tried in turn from best to worst resolution, until one succesfully returns a valid time. The code no longer holds a mutex while calling the clock_settime() and clock_gettime() methods of the registered clocks. This allows clock drivers to do whatever kind of locking or sleeping is necessary (this is especially important for i2c clock chips since i2c drivers often need to sleep). A new clock_register_flags() function allows the clock driver to pass flags. The flags currently defined help support drivers that use their own techniques to avoid roundoff errors (prevents the 4/5 rounding done by the subr_rtc code). A driver which may need to wait for resources (such as bus ownership) may pass a flag to indicate that it will obtain system time for itself after waiting for resources; this is merely an optimization to avoid the common code retrieving a timespec that will never get used. Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11484 Modified: head/sys/kern/subr_rtc.c head/sys/sys/clock.h Modified: head/sys/kern/subr_rtc.c ============================================================================== --- head/sys/kern/subr_rtc.c Wed Jul 12 02:42:57 2017 (r320901) +++ head/sys/kern/subr_rtc.c Wed Jul 12 02:53:54 2017 (r320902) @@ -63,8 +63,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include +#include #include +#include #ifdef FFCLOCK #include #endif @@ -72,116 +74,210 @@ __FBSDID("$FreeBSD$"); #include "clock_if.h" -static device_t clock_dev = NULL; -static long clock_res; -static struct timespec clock_adj; -struct mtx resettodr_lock; -MTX_SYSINIT(resettodr_init, &resettodr_lock, "tod2rl", MTX_DEF); - /* XXX: should be kern. now, it's no longer machdep. */ static int disable_rtc_set; SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, 0, "Disallow adjusting time-of-day clock"); +/* + * An instance of a realtime clock. A list of these tracks all the registered + * clocks in the system. + * + * The resadj member is used to apply a "resolution adjustment" equal to half + * the clock's resolution, which is useful mainly on clocks with a whole-second + * resolution. Because the clock truncates the fractional part, adding half the + * resolution performs 4/5 rounding. The same adjustment is applied to the + * times returned from clock_gettime(), because the fraction returned will + * always be zero, but on average the actual fraction at the time of the call + * should be about .5. + */ +struct rtc_instance { + device_t clockdev; + int resolution; + int flags; + struct timespec resadj; + LIST_ENTRY(rtc_instance) + rtc_entries; +}; + +/* + * Clocks are updated using a task running on taskqueue_thread. + */ +static void settime_task_func(void *arg, int pending); +static struct task settime_task = TASK_INITIALIZER(0, settime_task_func, NULL); + +/* + * Registered clocks are kept in a list which is sorted by resolution; the more + * accurate clocks get the first shot at providing the time. + */ +LIST_HEAD(rtc_listhead, rtc_instance); +static struct rtc_listhead rtc_list = LIST_HEAD_INITIALIZER(rtc_list); +static struct sx rtc_list_lock; +SX_SYSINIT(rtc_list_lock_init, &rtc_list_lock, "rtc list"); + +/* + * On the task thread, invoke the clock_settime() method of each registered + * clock. Do so holding only an sxlock, so that clock drivers are free to do + * whatever kind of locking or sleeping they need to. + */ +static void +settime_task_func(void *arg, int pending) +{ + struct timespec ts; + struct rtc_instance *rtc; + + sx_xlock(&rtc_list_lock); + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if (!(rtc->flags & CLOCKF_SETTIME_NO_TS)) { + getnanotime(&ts); + if (!(rtc->flags & CLOCKF_SETTIME_NO_ADJ)) { + ts.tv_sec -= utc_offset(); + timespecadd(&ts, &rtc->resadj); + } + } else { + ts.tv_sec = 0; + ts.tv_nsec = 0; + } + CLOCK_SETTIME(rtc->clockdev, &ts); + } + sx_xunlock(&rtc_list_lock); +} + void -clock_register(device_t dev, long res) /* res has units of microseconds */ +clock_register_flags(device_t clockdev, long resolution, int flags) { + struct rtc_instance *rtc, *newrtc; - if (clock_dev != NULL) { - if (clock_res <= res) { - if (bootverbose) - device_printf(dev, "not installed as " - "time-of-day clock: clock %s has higher " - "resolution\n", device_get_name(clock_dev)); - return; + newrtc = malloc(sizeof(*newrtc), M_DEVBUF, M_WAITOK); + newrtc->clockdev = clockdev; + newrtc->resolution = (int)resolution; + newrtc->flags = flags; + newrtc->resadj.tv_sec = newrtc->resolution / 2 / 1000000; + newrtc->resadj.tv_nsec = newrtc->resolution / 2 % 1000000 * 1000; + + sx_xlock(&rtc_list_lock); + if (LIST_EMPTY(&rtc_list)) { + LIST_INSERT_HEAD(&rtc_list, newrtc, rtc_entries); + } else { + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if (rtc->resolution > newrtc->resolution) { + LIST_INSERT_BEFORE(rtc, newrtc, rtc_entries); + break; + } else if (LIST_NEXT(rtc, rtc_entries) == NULL) { + LIST_INSERT_AFTER(rtc, newrtc, rtc_entries); + break; + } } - if (bootverbose) - device_printf(clock_dev, "removed as " - "time-of-day clock: clock %s has higher " - "resolution\n", device_get_name(dev)); } - clock_dev = dev; - clock_res = res; - clock_adj.tv_sec = res / 2 / 1000000; - clock_adj.tv_nsec = res / 2 % 1000000 * 1000; - if (bootverbose) - device_printf(dev, "registered as a time-of-day clock " - "(resolution %ldus, adjustment %jd.%09jds)\n", res, - (intmax_t)clock_adj.tv_sec, (intmax_t)clock_adj.tv_nsec); + sx_xunlock(&rtc_list_lock); + + device_printf(clockdev, + "registered as a time-of-day clock, resolution %d.%6.6ds\n", + newrtc->resolution / 1000000, newrtc->resolution % 1000000); } -/* - * inittodr and settodr derived from the i386 versions written - * by Christoph Robitschko , reintroduced and - * updated by Chris Stenton 8/10/94 - */ +void +clock_register(device_t dev, long res) +{ + clock_register_flags(dev, res, 0); +} + +void +clock_unregister(device_t clockdev) +{ + struct rtc_instance *rtc, *tmp; + + sx_xlock(&rtc_list_lock); + LIST_FOREACH_SAFE(rtc, &rtc_list, rtc_entries, tmp) { + if (rtc->clockdev == clockdev) { + LIST_REMOVE(rtc, rtc_entries); + free(rtc, M_DEVBUF); + } + } + sx_xunlock(&rtc_list_lock); +} + /* - * Initialize the time of day register, based on the time base which is, e.g. - * from a filesystem. + * Initialize the system time. Must be called from a context which does not + * restrict any locking or sleeping that clock drivers may need to do. + * + * First attempt to get the time from a registered realtime clock. The clocks + * are queried in order of resolution until one provides the time. If no clock + * can provide the current time, use the 'base' time provided by the caller, if + * non-zero. The 'base' time is potentially highly inaccurate, such as the last + * known good value of the system clock, or even a filesystem last-updated + * timestamp. It is used to prevent system time from appearing to move + * backwards in logs. */ void inittodr(time_t base) { struct timespec ts; + struct rtc_instance *rtc; int error; - if (clock_dev == NULL) { - printf("warning: no time-of-day clock registered, system time " - "will not be set accurately\n"); - goto wrong_time; + error = ENXIO; + sx_xlock(&rtc_list_lock); + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if ((error = CLOCK_GETTIME(rtc->clockdev, &ts)) != 0) + continue; + if (ts.tv_sec < 0 || ts.tv_nsec < 0) { + error = EINVAL; + continue; + } + if (!(rtc->flags & CLOCKF_GETTIME_NO_ADJ)) { + timespecadd(&ts, &rtc->resadj); + ts.tv_sec += utc_offset(); + } + if (bootverbose) + device_printf(rtc->clockdev, + "providing initial system time\n"); + break; } - /* XXX: We should poll all registered RTCs in case of failure */ - mtx_lock(&resettodr_lock); - error = CLOCK_GETTIME(clock_dev, &ts); - mtx_unlock(&resettodr_lock); - if (error != 0 && error != EINVAL) { - printf("warning: clock_gettime failed (%d), the system time " - "will not be set accurately\n", error); - goto wrong_time; + sx_xunlock(&rtc_list_lock); + + /* + * Do not report errors from each clock; it is expected that some clocks + * cannot provide results in some situations. Only report problems when + * no clocks could provide the time. + */ + if (error != 0) { + switch (error) { + case ENXIO: + printf("Warning: no time-of-day clock registered, "); + break; + case EINVAL: + printf("Warning: bad time from time-of-day clock, "); + break; + default: + printf("Error reading time-of-day clock (%d), ", error); + break; + } + printf("system time will not be set accurately\n"); + ts.tv_sec = (base > 0) ? base : -1; + ts.tv_nsec = 0; } - if (error == EINVAL || ts.tv_sec < 0) { - printf("Invalid time in real time clock.\n" - "Check and reset the date immediately!\n"); - goto wrong_time; - } - ts.tv_sec += utc_offset(); - timespecadd(&ts, &clock_adj); - tc_setclock(&ts); + if (ts.tv_sec >= 0) { + tc_setclock(&ts); #ifdef FFCLOCK - ffclock_reset_clock(&ts); + ffclock_reset_clock(&ts); #endif - return; - -wrong_time: - if (base > 0) { - ts.tv_sec = base; - ts.tv_nsec = 0; - tc_setclock(&ts); } } /* - * Write system time back to RTC + * Write system time back to all registered clocks, unless disabled by admin. + * This can be called from a context that restricts locking and/or sleeping; the + * actual updating is done asynchronously on a task thread. */ void resettodr(void) { - struct timespec ts; - int error; - if (disable_rtc_set || clock_dev == NULL) + if (disable_rtc_set) return; - getnanotime(&ts); - timespecadd(&ts, &clock_adj); - ts.tv_sec -= utc_offset(); - /* XXX: We should really set all registered RTCs */ - mtx_lock(&resettodr_lock); - error = CLOCK_SETTIME(clock_dev, &ts); - mtx_unlock(&resettodr_lock); - if (error != 0) - printf("warning: clock_settime failed (%d), time-of-day clock " - "not adjusted to system time\n", error); + taskqueue_enqueue(taskqueue_thread, &settime_task); } Modified: head/sys/sys/clock.h ============================================================================== --- head/sys/sys/clock.h Wed Jul 12 02:42:57 2017 (r320901) +++ head/sys/sys/clock.h Wed Jul 12 02:53:54 2017 (r320902) @@ -54,7 +54,6 @@ */ extern int tz_minuteswest; extern int tz_dsttime; -extern struct mtx resettodr_lock; int utc_offset(void); @@ -76,7 +75,34 @@ struct clocktime { int clock_ct_to_ts(struct clocktime *, struct timespec *); void clock_ts_to_ct(struct timespec *, struct clocktime *); -void clock_register(device_t, long); + +/* + * Time-of-day clock register/unregister functions, and associated flags. These + * functions can sleep. Upon return from unregister, the clock's methods are + * not running and will not be called again. + * + * Flags: + * + * CLOCKF_SETTIME_NO_TS + * Do not pass a timespec to clock_settime(), the driver obtains its own time + * and applies its own adjustments (this flag implies CLOCKF_SETTIME_NO_ADJ). + * + * CLOCKF_SETTIME_NO_ADJ + * Do not apply utc offset and resolution/accuracy adjustments to the value + * passed to clock_settime(), the driver applies them itself. + * + * CLOCKF_GETTIME_NO_ADJ + * Do not apply utc offset and resolution/accuracy adjustments to the value + * returned from clock_gettime(), the driver has already applied them. + */ + +#define CLOCKF_SETTIME_NO_TS 0x00000001 +#define CLOCKF_SETTIME_NO_ADJ 0x00000002 +#define CLOCKF_GETTIME_NO_ADJ 0x00000004 + +void clock_register(device_t _clockdev, long _resolution_us); +void clock_register_flags(device_t _clockdev, long _resolution_us, int _flags); +void clock_unregister(device_t _clockdev); /* * BCD to decimal and decimal to BCD. From owner-svn-src-head@freebsd.org Wed Jul 12 06:08:20 2017 Return-Path: Delivered-To: svn-src-head@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 8533DDB3BF1; Wed, 12 Jul 2017 06:08:20 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [IPv6:2001:470:67:39d::78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E1497A95E; Wed, 12 Jul 2017 06:08:20 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 99A22493; Tue, 11 Jul 2017 23:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1499839699; bh=zVVOlvq+HMluN8cFh0BkLWYTHfzE1LlOP+HMLm2ROyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CRQZ0y8l+tzJEC5xHK1VtMgfGO5RWgMIOLoWzaeLGdjRzMnNFmYlzvuQd2qoBTQ3K jrS7NxYf2wrNNowRcsqXw0k5Ow6iDS5eV3R08YsddVUclwoVbNjrgk/MMxSnIvxIcU En4O2l70DX83ACEK1DnScUp4pttO3gD8ePtj6J0Y= From: Peter Wemm To: Andriy Gapon Cc: svn-src-head@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r320452 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Date: Tue, 11 Jul 2017 23:08:15 -0700 Message-ID: <2865573.6VCVxXl8ZR@overcee.wemm.org> User-Agent: KMail/4.14.10 (FreeBSD/12.0-CURRENT; KDE/4.14.10; amd64; ; ) In-Reply-To: <201706281359.v5SDxKDB033681@repo.freebsd.org> References: <201706281359.v5SDxKDB033681@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart4989529.jmlK0HNQCM"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 06:08:20 -0000 --nextPart4989529.jmlK0HNQCM Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Wednesday, June 28, 2017 01:59:20 PM Andriy Gapon wrote: > A side bonus of this change is that now a vdev zio has a pointer > to its corresponding bio while the zio is active. > @@ -1094,6 +1088,15 @@ sendreq: > static void > vdev_geom_io_done(zio_t *zio) > { > +=09struct bio *bp =3D zio->io_bio; > + > +=09if (zio->io_type =3D=3D ZIO_TYPE_READ) { > +=09=09abd_return_buf_copy(zio->io_abd, bp->bio_data, zio->io_size); > +=09} else if (zio->io_type =3D=3D ZIO_TYPE_WRITE) { > +=09=09abd_return_buf(zio->io_abd, bp->bio_data, zio->io_size); > +=09} > + > +=09g_destroy_bio(bp); > } We are getting a 100% repeatable failure when trying to boot machines w= ith=20 degraded volumes in the freebsd.org cluster. <118>Setting hostname: tiny.nyi.freebsd.org. <118>Setting up harvesting: [UMA], [FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,D <118>Feeding entropy: . Fatal trap 12: page fault while in kernel mode cpuid =3D 1; apic id =3D 01 fault virtual address=09=3D 0x28 Fatal trap 12: page fault while in kernel mode cpuid =3D 3; apic id =3D 07 fault virtual address=09=3D 0x28 Fatal trap 12: page fault while in kernel mode cpuid =3D 2; apic id =3D 06 apic id =3D 00 fault virtual address =3D 0x28 =3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags =3D interrupt enabled, resume, fault virtual ad= dress =20 =3D 0x28 fault code =3D supervisor read data, page not present instruction pointer =3D 0x20:0xffffffff803aab56 stack pointer =3D 0x28:0xfffffe0239fa3a90 fault code =3D supervisor read data, page not present IOPL =3D 0 current process =3D 0 (zio_write_intr_0) frame pointer =3D 0x28:0xfffffe0239fa3aa0 db> where =20 Tracing pid 0 tid 100471 td 0xfffff80005452000 vdev_geom_io_done() at vdev_geom_io_done+0x36/frame 0xfffffe0239f9eaa0 zio_vdev_io_done() at zio_vdev_io_done+0x176/frame 0xfffffe0239f9ead0 zio_execute() at zio_execute+0xac/frame 0xfffffe0239f9eb20 This is dereferencing a null bp (ie: zio->io_bio). It traps on multipl= e cores=20 concurrently. FreeBSD 12.0-CURRENT #0 r320900: Wed Jul 12 03:00:15 UTC 2017 (This is a smoke-test machine, recycled from somewhere else) =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart4989529.jmlK0HNQCM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEBgrA0Vr/vfNVuPoUNdaXCeyAngQFAlllvM8ACgkQNdaXCeyA ngR9Vwf/dqaqhTJA8ny6hZyEsbB+lEJyfw198wADxJ+uzz9opjem/qk7wtp8dFRC zHF6JeHkQXJ9x6z2AqLeySLmoDEGCfYi6fjlZq0Qw0si8sAclgZVjIl9Vklc1aYd 3Z9cTG41RwwZsEi3oPsgx1tNWsdo3lZJAwzg9fCb2x/U+WSJlQCvOgtCEqNTgMR+ +5SeqX7vLEJ+0m0Ylf4YJbTfQC+/87TYdnlvTyYbYY8FZNODFR1gCkXNLA7uWoI2 SMM6h9HqEpg/WP4yU1nZrbg71jH5sfyV3PQcCqUcPZgZX6n8YV7Aa52kK0ndY/S5 80YWn4xVc3rqIcVm997FAWKrO7E9FA== =IFnl -----END PGP SIGNATURE----- --nextPart4989529.jmlK0HNQCM-- From owner-svn-src-head@freebsd.org Wed Jul 12 06:55:50 2017 Return-Path: Delivered-To: svn-src-head@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 F2A0EDB464C; Wed, 12 Jul 2017 06:55:49 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [IPv6:2001:470:67:39d::78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEFB77BD2A; Wed, 12 Jul 2017 06:55:49 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 109C94A9; Tue, 11 Jul 2017 23:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1499842549; bh=a6owOUc7EccgG8pj7mgEYYCfmLJfjRQJJEShEd9KsY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=l7kf/6NrRsR1DPj8efkZNGcI6NDsajlnZtosjQdOrODDC2rFSHS0oJBl7SpVDnF3a twTq/4gZbqvDpLvTj6Pdp5hAoBRuT0C6NPCgIadRUCp+HyC4seAjEW5OjT8CgzmUwq ixAD3Xn2H9KNnk6EdVZXesH6csVrtEg5MFNKzpy4= From: Peter Wemm To: Andriy Gapon Cc: svn-src-head@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r320452 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Date: Tue, 11 Jul 2017 23:55:47 -0700 Message-ID: <2227668.mxUYtcVILl@overcee.wemm.org> User-Agent: KMail/4.14.10 (FreeBSD/12.0-CURRENT; KDE/4.14.10; amd64; ; ) In-Reply-To: <2865573.6VCVxXl8ZR@overcee.wemm.org> References: <201706281359.v5SDxKDB033681@repo.freebsd.org> <2865573.6VCVxXl8ZR@overcee.wemm.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart11714779.Zx5v9CJLM2"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 06:55:50 -0000 --nextPart11714779.Zx5v9CJLM2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Tuesday, July 11, 2017 11:08:15 PM Peter Wemm wrote: > On Wednesday, June 28, 2017 01:59:20 PM Andriy Gapon wrote: > > A side bonus of this change is that now a vdev zio has a pointer > > to its corresponding bio while the zio is active. > fault virtual address =3D 0x28 >=20 > db> where > Tracing pid 0 tid 100471 td 0xfffff80005452000 > vdev_geom_io_done() at vdev_geom_io_done+0x36/frame 0xfffffe0239f9eaa= 0 > zio_vdev_io_done() at zio_vdev_io_done+0x176/frame 0xfffffe0239f9ead0= > zio_execute() at zio_execute+0xac/frame 0xfffffe0239f9eb20 Oops, truncated. taskqueue_run_locked() at taskqueue_run_locked+0x127/frame 0xfffffe0239= f9eb80 taskqueue_thread_loop() at taskqueue_thread_loop+0xc8/frame 0xfffffe023= 9f9ebb0 fork_exit() at fork_exit+0x85/frame 0xfffffe0239f9ebf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0239f9ebf0 =2D-- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart11714779.Zx5v9CJLM2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEBgrA0Vr/vfNVuPoUNdaXCeyAngQFAlllx/MACgkQNdaXCeyA ngShSgf/ZCeBGbpHC80AHWOQ+bxLgzVxTW9QXoSLatw3Nh6pIGOALOq7vkzJgdEd t8B1S8osadtqFN49+B1K8R66QP9fuFN+a5ZolwBfIwUZfGDobW6905qVwrNbIsjT dKNZA6+3iN4hqWEkTs5EelW6Ni6838pudzZdysckvQXd4QcG/cUFO2nRaSd6QnVu TyGjj5DLlqwMt5SeiNszjwbuY/mfclREPzxI68yYyX2AbueriqwBb5oDa1tIY+sq RKu7JJ9W3xnyx/Go/A1nPr4+OzmXJjUo21Ipd7P3pfRHtqKNhFTWofIsVE7LKsDU gebyM9tk8LIAsfrb6Dy9WaysdJcdww== =Ip/u -----END PGP SIGNATURE----- --nextPart11714779.Zx5v9CJLM2-- From owner-svn-src-head@freebsd.org Wed Jul 12 07:19:07 2017 Return-Path: Delivered-To: svn-src-head@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 C2920DB4A95; Wed, 12 Jul 2017 07:19:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 84B907C714; Wed, 12 Jul 2017 07:19:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6C7J6og037262; Wed, 12 Jul 2017 07:19:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6C7J6oW037261; Wed, 12 Jul 2017 07:19:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201707120719.v6C7J6oW037261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 12 Jul 2017 07:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320906 - head/crypto/heimdal/lib/krb5 X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/crypto/heimdal/lib/krb5 X-SVN-Commit-Revision: 320906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 07:19:07 -0000 Author: delphij Date: Wed Jul 12 07:19:06 2017 New Revision: 320906 URL: https://svnweb.freebsd.org/changeset/base/320906 Log: MFV r320905: Import upstream fix for CVE-2017-11103. In _krb5_extract_ticket() the KDC-REP service name must be obtained from encrypted version stored in 'enc_part' instead of the unencrypted version stored in 'ticket'. Use of the unecrypted version provides an opportunity for successful server impersonation and other attacks. Submitted by: hrs Obtained from: Heimdal Security: FreeBSD-SA-17:05.heimdal Security: CVE-2017-11103 Modified: head/crypto/heimdal/lib/krb5/ticket.c Directory Properties: head/crypto/heimdal/ (props changed) Modified: head/crypto/heimdal/lib/krb5/ticket.c ============================================================================== --- head/crypto/heimdal/lib/krb5/ticket.c Wed Jul 12 07:13:56 2017 (r320905) +++ head/crypto/heimdal/lib/krb5/ticket.c Wed Jul 12 07:19:06 2017 (r320906) @@ -713,8 +713,8 @@ _krb5_extract_ticket(krb5_context context, /* check server referral and save principal */ ret = _krb5_principalname2krb5_principal (context, &tmp_principal, - rep->kdc_rep.ticket.sname, - rep->kdc_rep.ticket.realm); + rep->enc_part.sname, + rep->enc_part.srealm); if (ret) goto out; if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){ From owner-svn-src-head@freebsd.org Wed Jul 12 07:30:15 2017 Return-Path: Delivered-To: svn-src-head@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 839CADB4D8A; Wed, 12 Jul 2017 07:30:15 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5DAC37CE5C; Wed, 12 Jul 2017 07:30:15 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6C7UEkg041448; Wed, 12 Jul 2017 07:30:14 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6C7UExf041447; Wed, 12 Jul 2017 07:30:14 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201707120730.v6C7UExf041447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 12 Jul 2017 07:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320908 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 320908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 07:30:15 -0000 Author: rlibby Date: Wed Jul 12 07:30:14 2017 New Revision: 320908 URL: https://svnweb.freebsd.org/changeset/base/320908 Log: kvprintf %b enhancements Make the %b formatter accept number formatting flags. It will now accept alternate form, precision, and length modifiers. It also now partially supports field width (but forces left justification). Reviewed by: markj Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11284 Modified: head/sys/kern/subr_prf.c Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Wed Jul 12 07:26:07 2017 (r320907) +++ head/sys/kern/subr_prf.c Wed Jul 12 07:30:14 2017 (r320908) @@ -650,7 +650,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), vo uintmax_t num; int base, lflag, qflag, tmp, width, ladjust, sharpflag, neg, sign, dot; int cflag, hflag, jflag, tflag, zflag; - int dwidth, upper; + int bconv, dwidth, upper; char padc; int stop = 0, retval = 0; @@ -676,7 +676,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), vo } percent = fmt - 1; qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; - sign = 0; dot = 0; dwidth = 0; upper = 0; + sign = 0; dot = 0; bconv = 0; dwidth = 0; upper = 0; cflag = 0; hflag = 0; jflag = 0; tflag = 0; zflag = 0; reswitch: switch (ch = (u_char)*fmt++) { case '.': @@ -724,28 +724,9 @@ reswitch: switch (ch = (u_char)*fmt++) { width = n; goto reswitch; case 'b': - num = (u_int)va_arg(ap, int); - p = va_arg(ap, char *); - for (q = ksprintn(nbuf, num, *p++, NULL, 0); *q;) - PCHAR(*q--); - - if (num == 0) - break; - - for (tmp = 0; *p;) { - n = *p++; - if (num & (1 << (n - 1))) { - PCHAR(tmp ? ',' : '<'); - for (; (n = *p) > ' '; ++p) - PCHAR(n); - tmp = 1; - } else - for (; *p > ' '; ++p) - continue; - } - if (tmp) - PCHAR('>'); - break; + ladjust = 1; + bconv = 1; + goto handle_nosign; case 'c': width -= 1; @@ -883,6 +864,10 @@ handle_nosign: num = (u_char)va_arg(ap, int); else num = va_arg(ap, u_int); + if (bconv) { + q = va_arg(ap, char *); + base = *q++; + } goto number; handle_sign: if (jflag) @@ -939,6 +924,26 @@ number: while (*p) PCHAR(*p--); + + if (bconv && num != 0) { + /* %b conversion flag format. */ + tmp = retval; + while (*q) { + n = *q++; + if (num & (1 << (n - 1))) { + PCHAR(retval != tmp ? + ',' : '<'); + for (; (n = *q) > ' '; ++q) + PCHAR(n); + } else + for (; *q > ' '; ++q) + continue; + } + if (retval != tmp) { + PCHAR('>'); + width -= retval - tmp; + } + } if (ladjust) while (width-- > 0) From owner-svn-src-head@freebsd.org Wed Jul 12 07:55:12 2017 Return-Path: Delivered-To: svn-src-head@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 B2669DB54B5; Wed, 12 Jul 2017 07:55:12 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (mail.vlakno.cz [91.217.96.224]) by mx1.freebsd.org (Postfix) with ESMTP id 41D7D7DB31; Wed, 12 Jul 2017 07:55:11 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: by vlakno.cz (Postfix, from userid 1002) id B30DCC03A30; Wed, 12 Jul 2017 09:43:26 +0200 (CEST) Date: Wed, 12 Jul 2017 09:43:26 +0200 From: Roman Divacky To: Ryan Libby Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320908 - head/sys/kern Message-ID: <20170712074326.GA41347@vlakno.cz> References: <201707120730.v6C7UExf041447@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707120730.v6C7UExf041447@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 07:55:12 -0000 Clang knows about %b modifier and can do some semantic analysis on it. Currently it type checks the first arg to be an int and the second to be a char*. Do you think it would be worth modifying the checks to include this new functionality? Do you think you would like to take a stab at it? Search for FreeBSDbArg in contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp if you want to take a look. Thanks, Roman On Wed, Jul 12, 2017 at 07:30:14AM +0000, Ryan Libby wrote: > Author: rlibby > Date: Wed Jul 12 07:30:14 2017 > New Revision: 320908 > URL: https://svnweb.freebsd.org/changeset/base/320908 > > Log: > kvprintf %b enhancements > > Make the %b formatter accept number formatting flags. It will now accept > alternate form, precision, and length modifiers. It also now partially > supports field width (but forces left justification). > > Reviewed by: markj > Approved by: markj (mentor) > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D11284 > > Modified: > head/sys/kern/subr_prf.c > > Modified: head/sys/kern/subr_prf.c > ============================================================================== > --- head/sys/kern/subr_prf.c Wed Jul 12 07:26:07 2017 (r320907) > +++ head/sys/kern/subr_prf.c Wed Jul 12 07:30:14 2017 (r320908) > @@ -650,7 +650,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), vo > uintmax_t num; > int base, lflag, qflag, tmp, width, ladjust, sharpflag, neg, sign, dot; > int cflag, hflag, jflag, tflag, zflag; > - int dwidth, upper; > + int bconv, dwidth, upper; > char padc; > int stop = 0, retval = 0; > > @@ -676,7 +676,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), vo > } > percent = fmt - 1; > qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; > - sign = 0; dot = 0; dwidth = 0; upper = 0; > + sign = 0; dot = 0; bconv = 0; dwidth = 0; upper = 0; > cflag = 0; hflag = 0; jflag = 0; tflag = 0; zflag = 0; > reswitch: switch (ch = (u_char)*fmt++) { > case '.': > @@ -724,28 +724,9 @@ reswitch: switch (ch = (u_char)*fmt++) { > width = n; > goto reswitch; > case 'b': > - num = (u_int)va_arg(ap, int); > - p = va_arg(ap, char *); > - for (q = ksprintn(nbuf, num, *p++, NULL, 0); *q;) > - PCHAR(*q--); > - > - if (num == 0) > - break; > - > - for (tmp = 0; *p;) { > - n = *p++; > - if (num & (1 << (n - 1))) { > - PCHAR(tmp ? ',' : '<'); > - for (; (n = *p) > ' '; ++p) > - PCHAR(n); > - tmp = 1; > - } else > - for (; *p > ' '; ++p) > - continue; > - } > - if (tmp) > - PCHAR('>'); > - break; > + ladjust = 1; > + bconv = 1; > + goto handle_nosign; > case 'c': > width -= 1; > > @@ -883,6 +864,10 @@ handle_nosign: > num = (u_char)va_arg(ap, int); > else > num = va_arg(ap, u_int); > + if (bconv) { > + q = va_arg(ap, char *); > + base = *q++; > + } > goto number; > handle_sign: > if (jflag) > @@ -939,6 +924,26 @@ number: > > while (*p) > PCHAR(*p--); > + > + if (bconv && num != 0) { > + /* %b conversion flag format. */ > + tmp = retval; > + while (*q) { > + n = *q++; > + if (num & (1 << (n - 1))) { > + PCHAR(retval != tmp ? > + ',' : '<'); > + for (; (n = *q) > ' '; ++q) > + PCHAR(n); > + } else > + for (; *q > ' '; ++q) > + continue; > + } > + if (retval != tmp) { > + PCHAR('>'); > + width -= retval - tmp; > + } > + } > > if (ladjust) > while (width-- > 0) > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Wed Jul 12 08:09:42 2017 Return-Path: Delivered-To: svn-src-head@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 46E69DB5AE3; Wed, 12 Jul 2017 08:09:42 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-wr0-x232.google.com (mail-wr0-x232.google.com [IPv6:2a00:1450:400c:c0c::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E3ADB7E4D8; Wed, 12 Jul 2017 08:09:41 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-wr0-x232.google.com with SMTP id c11so22523755wrc.3; Wed, 12 Jul 2017 01:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HvWo7n1N4TbDRQHKM7dO4jOrjlalYDz7WrqehRBfNxM=; b=kMcys1lRNA4OwNMnfp3pOhPO7xWWyum8rzRXOEyz6GyyU5DrmPE5NOEP1hMmGEKKp/ aVGfetezFmu5BpeF66PJqwjxwFQqM/Zh/U1EqRnNDRAHmhlos3y4mewI+9MDB5R3GhZu TuZ8cG38bNzLvCJ5JnvoD+33okTUIAGxZ10a392ugkxxI3JdhdTzNnhsHMYMZcktzD/P v4V+U+muGQpRkUzk4ziASp1atVz3Lz7eLlbflaMlwcKDVEujp/AFU2b/K3jSZxOhk0Ve 38hN/1VGos4Hvml/cfFh2evR2ruUFT/cu4UEGZHBgIXVp2+jVwvrqlNKIb3NqyTviSAi ttjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HvWo7n1N4TbDRQHKM7dO4jOrjlalYDz7WrqehRBfNxM=; b=lkrs0RC3uEzbjGxDrJ8s4luaZle2C3O1fa9eE/F/+uFbHUMLTNvTW0jbTGNdbaz6kd paBdKedoDBeKXPzT1b44iTud2xQGqcp3o4yhkS7Ws2jYqI+mvmP1pOAX7z6K1KsMRebh isF8fmGGl4VIDtigUHgGs+5Rp1WsEUJdoGob++6o85ahEAXti9i2+JbWgICX5Nvz/b7w JiTNsafuypUydZRic8EuuWOIX0RZT3TEoCuvL55vFEHwKCJM4GQkbyUZxPuyro4zsQIP SEAhLlunqEj8QsQPz1f85NvRTklwT/o3E2xXR1k0VZCYO5eRf569eFNdEJm4XpbFViVk SCTg== X-Gm-Message-State: AIVw112eYnje1FEEwcH4dz2u9QoHoqHX6htcUnCT68lDMnkGZIpfeUQu FuHg8Mb5972jX7XsgM4vCX7ziPK3ijg4 X-Received: by 10.28.9.205 with SMTP id 196mr1543707wmj.126.1499846979939; Wed, 12 Jul 2017 01:09:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.161.81 with HTTP; Wed, 12 Jul 2017 01:09:39 -0700 (PDT) In-Reply-To: <20170712074326.GA41347@vlakno.cz> References: <201707120730.v6C7UExf041447@repo.freebsd.org> <20170712074326.GA41347@vlakno.cz> From: Ryan Libby Date: Wed, 12 Jul 2017 01:09:39 -0700 Message-ID: Subject: Re: svn commit: r320908 - head/sys/kern To: Roman Divacky Cc: Ryan Libby , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 08:09:42 -0000 On Wed, Jul 12, 2017 at 12:43 AM, Roman Divacky wrote: > Clang knows about %b modifier and can do some semantic analysis on it. > Currently it type checks the first arg to be an int and the second to be > a char*. > > Do you think it would be worth modifying the checks to include > this new functionality? Do you think you would like to take a stab > at it? Yes, I plan to send that to clang upstream. I originally had those changes in this commit but I was directed rather to send them first to upstream. See here [1] for roughly what I plan to send upstream (although I have since noticed some unit tests that I guess should be extended). For now, the semantic analysis should be fine as the change should be backward compatible and I haven't yet changed any of the users of %b to use the new capabilities. Ryan [1] https://reviews.freebsd.org/D11284?id=29866 From owner-svn-src-head@freebsd.org Wed Jul 12 10:28:41 2017 Return-Path: Delivered-To: svn-src-head@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 145F8D93BE1; Wed, 12 Jul 2017 10:28:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id B3B9C827CE; Wed, 12 Jul 2017 10:28:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 7CCC31A3B3F; Wed, 12 Jul 2017 20:08:43 +1000 (AEST) Date: Wed, 12 Jul 2017 20:08:42 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320900 - in head/sys: fs/cd9660 fs/ext2fs fs/fifofs fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs ufs/ufs In-Reply-To: <201707112155.v6BLtKbZ006618@repo.freebsd.org> Message-ID: <20170712184348.Q1271@besplex.bde.org> References: <201707112155.v6BLtKbZ006618@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=K9qLy5Vgh6matLySN4AA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 10:28:41 -0000 On Tue, 11 Jul 2017, John Baldwin wrote: > Log: > Consistently use vop_stdpathconf() for default pathconf values. > > Update filesystems not currently using vop_stdpathconf() in pathconf > VOPs to use vop_stdpathconf() for any configuration variables that do > not have filesystem-specific values. vop_stdpathconf() is used for > variables that have system-wide settings as well as providing default > values for some values based on system limits. Filesystems can still > explicitly override individual settings. This is sort of backwards. Not many settings are the same for most file systems, and many that did were wrong. Now more are wrong. > Modified: head/sys/fs/cd9660/cd9660_vnops.c > ============================================================================== > --- head/sys/fs/cd9660/cd9660_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > +++ head/sys/fs/cd9660/cd9660_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > @@ -792,20 +792,11 @@ cd9660_pathconf(ap) > else > *ap->a_retval = 37; > return (0); > - case _PC_PATH_MAX: > - *ap->a_retval = PATH_MAX; > - return (0); PATH_MAX is one of the few that is system-wide. > - case _PC_PIPE_BUF: > - *ap->a_retval = PIPE_BUF; > - return (0); PIPE_BUF isn't system wide. cd9660 does support fifos, but setting it for files that aren't fifos or directories is bogus. POSIX allows such bogus settings, and needs complicated wording to describe this. E.g., PIPE_BUF for a directory is not completely bogus and it means that the value for the directory applies to all fifos in the directory and is ignored for all non-fifos in the directory. It is unclear if PIPE_BUF must be set for a directory if there is any fifo in the directory. FreeBSD's man pages give no details about this. > - case _PC_CHOWN_RESTRICTED: > - *ap->a_retval = 1; > - return (0); This is system-wide. > case _PC_NO_TRUNC: > *ap->a_retval = 1; > return (0); This is almost system-wide. > default: > - return (EINVAL); > + return (vop_stdpathconf(ap)); This is fail-unsafe. It gives bogus settings like PIPE_BUF for all cases. Case statements in file systems need to be even larger to kill defaults, and the code becomes harder to read since it is harder to see the final values. vop_stdpathconf() has defaults for: - ASYNC_IO. Is this system-wide (all in vfs?) - NAME_MAX. This is very far from system-wide - PATH_MAX. This is system-wide. - LINK_MAX. This is very far from system-wide, especially after expansion of nlink_t. Most file systems get this wrong. LINK_MAX is bogusly defined to be the constant 32767, but the value is very variable. zfs_pathconf() returns INT_MAX and zfs uses something like int32_t internally, but zfs_getattr() clamps to LINK_MAX. ext2fs limits to 32000 for ext2 and 65000 for ext4 internally but ext2_pathconf() only returns this limit in some cases -- other cases return INT_MAX. - MAX_CANON. This is garbage except for terminals (and directories). Its value is also wrong. - MAX_INPUT. Like MAX_CANON. - PIPE_BUF. Like MAX_CANON, for fifos instead of terminals. - CHOWN_RESTRICTED. Wrong for file systems that don't support ownerships or changing them. Might depend on mount options. - VDISABLE. Like MAX_CANON. This is easy to improve: - NAME_MAX, LINK_MAX: move to individual fs's - MAX_CANON, MAX_INPUT, VDISABLE: move to devfs_pathconf(). - PIPE_BUF: move to fifo_pathconf()? What about directories? > } > /* NOTREACHED */ Bogus comment. Even lint should understand that default prevents reaching this. > Modified: head/sys/fs/fifofs/fifo_vnops.c > ============================================================================== > --- head/sys/fs/fifofs/fifo_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > +++ head/sys/fs/fifofs/fifo_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > @@ -337,34 +336,6 @@ fifo_print(ap) > fifo_printinfo(ap->a_vp); > printf("\n"); > return (0); > -} > - > -/* > - * Return POSIX pathconf information applicable to fifo's. > - */ > -static int > -fifo_pathconf(ap) > - struct vop_pathconf_args /* { > - struct vnode *a_vp; > - int a_name; > - int *a_retval; > - } */ *ap; > -{ > - > - switch (ap->a_name) { > - case _PC_LINK_MAX: > - *ap->a_retval = LINK_MAX; > - return (0); > - case _PC_PIPE_BUF: > - *ap->a_retval = PIPE_BUF; > - return (0); > - case _PC_CHOWN_RESTRICTED: > - *ap->a_retval = 1; > - return (0); > - default: > - return (EINVAL); > - } > - /* NOTREACHED */ > } This was small and hopefully correct. Not many settings apply to fifos. It seems a but too small to be correct -- why would LINK_MAX apply but not PATH_MAX? Using the default, a pathconf which wants to set only 3 value would need about 15 cases to kill all the defaults. > Modified: head/sys/fs/msdosfs/msdosfs_vnops.c > ============================================================================== > --- head/sys/fs/msdosfs/msdosfs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > +++ head/sys/fs/msdosfs/msdosfs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > @@ -1875,17 +1875,11 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) > case _PC_NAME_MAX: > *ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12; > return (0); > - case _PC_PATH_MAX: > - *ap->a_retval = PATH_MAX; > - return (0); > - case _PC_CHOWN_RESTRICTED: > - *ap->a_retval = 1; > - return (0); > case _PC_NO_TRUNC: > *ap->a_retval = 0; > return (0); > default: > - return (EINVAL); > + return (vop_stdpathconf(ap)); msdosfs doesn't support pipes. It used to indicate this by not having _PC_PIPE_MAX. Now it gets this via pollution in vop_stdpathconf(ap). msdosfs also has unusual handling for LINK_MAX, NAME_MAX and NO_TRUNC. It still has this, with buggy limits in all cases: - msdosfs doesn't support links. It returns 1 for LINK_MAX instead of -1 (unsupported) - NAME_MAX doesn't really apply to shortnames. 12 is returned instead of the 2 limits 8 and 3. - msdosfs truncates only for shortnames, so NO_TRUNC = 0 is wrong for !shortnames. Almost all file systems except msdosfs return 1 for NO_TRUNC, but this is not defaulted. > Modified: head/sys/ufs/ufs/ufs_vnops.c > ============================================================================== > --- head/sys/ufs/ufs/ufs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > +++ head/sys/ufs/ufs/ufs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > @@ -2442,21 +2442,9 @@ ufs_pathconf(ap) > > error = 0; > switch (ap->a_name) { > - case _PC_LINK_MAX: > - *ap->a_retval = LINK_MAX; > - break; > case _PC_NAME_MAX: > *ap->a_retval = UFS_MAXNAMLEN; > break; LINK_MAX is basically ffs's limit. NAME_MAX _is_ ffs's limit, but it is still defaulted. I expect that some of the other defaulted limits will become more variable (so unsuitable as defaults). LINK_MAX is almost there. > @@ -2505,11 +2493,6 @@ ufs_pathconf(ap) > case _PC_MIN_HOLE_SIZE: > *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; > break; > - case _PC_ASYNC_IO: > - /* _PC_ASYNC_IO should have been handled by upper layers. */ > - KASSERT(0, ("_PC_ASYNC_IO should not get here")); > - error = EINVAL; > - break; > case _PC_PRIO_IO: > *ap->a_retval = 0; > break; But some of the newer limits like are in vfs so should have been defaulted? Bruce From owner-svn-src-head@freebsd.org Wed Jul 12 12:20:01 2017 Return-Path: Delivered-To: svn-src-head@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 C0D68D964BF; Wed, 12 Jul 2017 12:20:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 6C5179DB; Wed, 12 Jul 2017 12:20:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id EAC25104FB4; Wed, 12 Jul 2017 22:19:52 +1000 (AEST) Date: Wed, 12 Jul 2017 22:19:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: Ian Lepore , Edward Tomasz Napierala , rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320803 - head/sbin/mount In-Reply-To: <5242112.0aHCQARnit@ralph.baldwin.cx> Message-ID: <20170712200850.T1271@besplex.bde.org> References: <20170708171641.GA1129@brick> <20170711201230.GB1725@brick> <1499805315.45330.14.camel@freebsd.org> <5242112.0aHCQARnit@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=LvD3IBYkoAyHHyboNZsA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 12:20:01 -0000 On Tue, 11 Jul 2017, John Baldwin wrote: > On Tuesday, July 11, 2017 02:35:15 PM Ian Lepore wrote: >> I think the docs on this are pretty clear... under -u it says: >> >> The set of options is determined by applying the options specified >> in the argument to -o and finally applying the -r or -w option. >> >> To me, that says that nothing in /etc/fstab is germane to mount -u >> unless one of the other args to mount -u is -o fstab. >> >> This change (r320803) seems like an acceptable workaround, but I think >> the correct long term fix would be to not even open /etc/fstab on mount >> -u without -o fstab. But that may be harder to do than to say; I still >> haven't actually looked at the code involved. I thought that it did do that (not look in fstab, except possibly for pathnames). > I concur with this. I've always viewed '-u' as meaning "apply a delta > to the current configuration", not "add this delta to the fstab options > and then apply that entire set of options". In practice, it seems that > it doesn't do either of those, but instead it seems to treats the options > passed to -o as the entire list of options. This is perhaps a bit > surprising. I thought that everyone knew that the behaviour is to blow away the current options, since this is surprisingly bad. My fingers know this, and exploit it to reduce typing for mounting the root file system rw: - "rw" is not an option, but is the absense of the "ro" option, so to change the root file system from read-only to read-write, my fingers type "mount /" -- this blows away "ro" - however, all my fs's are mounted with noatime and I don't want to blow this away unintentionally. My fingers know this, so they actually type "mount -o noatime" for the previous operation. This is part of a large suite of design and implementation bugs. dwmalone@ added [-u -o] "fstab" and "current" options to give more control and save typing, but these weren't complete and they rotted with the larger design and implementation bug nmount(2). "current" only gives the current settings that are in the mount flags returned by statfs(2), and "fstab" doesn't blow away the current settings that aren't in the mount flags. nmount(2) increased the problem by making it too easy to add unstructured options that are not in the mount flags and moving parsing of options to the kernel. mount(8) with no args only displays the options in the mount flags. > For example, suppose you had this: > > /etc/fstab: > > /dev/md0 /bar ufs ro,noauto,noexec 0 0 > > # mount /bar > # mount | grep bar ooooooop > /dev/md0 on /bar (ufs, local, noexec, read-only) > # mount -u -o rw /bar > /dev/md0 on /bar (ufs, local) > > (We just lost "noexec" from fstab by upgrading to read-write) Expect to lose that are in the mount flags like this. But unstructured options tend to be sticky due to undocumented implementation details. This causes my most problems with nfs tcp/udp flags and nfs read/write sizes. Even when these were parsed in nfs_mount(8), IIRC the absence of an option in the command line was passed to the kernel as nothing and interpreted by the kernel as a null change. With nmount(2), userland does almost no option processing so more clearly passes absent options as nothing so the result is whatever undocumented interpretation the kernel prefers. For read/write sizes, nfs also "fixes" wrong sizes by adjusting to limits. There is API for determining what sizes its ends up with, so the only way to know what sizes you are setting is to always set sizes that won't be adjusted and remember what these are in userland. > # mount -u -o nosuid /bar > # mount | grep bar > /dev/md0 on /bar (ufs, local, nosuid) > > (Did not lose "read-write" somehow, RO vs RW must be magically sticky?) RW is just the default. It is not a flag, but the absense of the "ro" flag. nmount(2) still handles negative options worse than mount(8) using much much larger code, but after many years of fixes it handles this "rw" negative option well enough. Most generic flags have 3 variants like "ro", "noro" and "nonoro", and "ro" also has variants "" "rw". Non-generic flags (implemented in individual file systems) tend to have less orthogonality. Sometimes if the basic flag is "nofoo", there is no flag "foo". Sometimes there is a flag "nonofoo" to negate "foo". > # mount -u -o fstab,nosuid /bar > # mount |grep bar > /dev/md0 on /bar (ufs, local, noexec, nosuid) > > (Did not honor "ro" from fstab! Left mount RW) Correction: after many years of fixes, nmount(2) still doesn't understand the "ro" flag. This example works correctly with old mount utilities using mount(2). This is with the same current kernel -- mount(8) from FreeBSD-~5.2 parses the options correctly and then uses mount(2), while mount(8) from FreeBSD-10 uses nmount(2). Even nmount(2) can handle this, so the bug must be in parsing or concatenating fstab options. "fstab" seems to work correctly with newer mount(8) for options in fstab except "ro". > It would seem that there is no actual rhyme or reason to how mount -u works, > and certainly Edward's change doesn't make it worse. I would like to have > some kind of mode where you can toggle one or more options without disturbing > others. Maybe if we had a new "special" option called "current" or some such > that is like "fstab" but instead represents the options currently in force, > then you could do true delta operations via 'mount -o current,rw -u /foo'. > As it is, there doesn't currently seem to a reliable way to achieve that > functionality. -u -o current was implemented in 1999, but never really worked. To summarize, -u tends to preserve the current settings for everything except the mount flags that you can actually see, and should change all of those flags to 0. So -u -o -current tends to preserve everything. Bruce From owner-svn-src-head@freebsd.org Wed Jul 12 14:51:34 2017 Return-Path: Delivered-To: svn-src-head@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 01FE8D99589; Wed, 12 Jul 2017 14:51:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 BFC5665288; Wed, 12 Jul 2017 14:51:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CEpWHH022778; Wed, 12 Jul 2017 14:51:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CEpW0p022777; Wed, 12 Jul 2017 14:51:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707121451.v6CEpW0p022777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 12 Jul 2017 14:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320914 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libc/gen X-SVN-Commit-Revision: 320914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 14:51:34 -0000 Author: asomers Date: Wed Jul 12 14:51:32 2017 New Revision: 320914 URL: https://svnweb.freebsd.org/changeset/base/320914 Log: Remove an extraneous strlen from t_setdomainname.c Reported by: Coverity CID: 1377568 MFC after: 15 days X-MFC-With: 320737 Sponsored by: Spectra Logic Corp Modified: head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Wed Jul 12 11:40:09 2017 (r320913) +++ head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Wed Jul 12 14:51:32 2017 (r320914) @@ -83,7 +83,7 @@ restore_domain(void) n += r; if (r < 0) err(1, "read"); - if (setdomainname(domain, strlen(domain)) != 0) + if (setdomainname(domain, n) != 0) err(1, "setdomainname"); close(fd); } From owner-svn-src-head@freebsd.org Wed Jul 12 15:42:34 2017 Return-Path: Delivered-To: svn-src-head@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 9929CD9B4EA; Wed, 12 Jul 2017 15:42:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 4698867975; Wed, 12 Jul 2017 15:42:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 73B79D69A54; Thu, 13 Jul 2017 01:42:26 +1000 (AEST) Date: Thu, 13 Jul 2017 01:42:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320901 - in head/sys: amd64/amd64 isa x86/isa In-Reply-To: <201707120242.v6C2gvDB026199@repo.freebsd.org> Message-ID: <20170712224803.G1991@besplex.bde.org> References: <201707120242.v6C2gvDB026199@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=MLXom4X1Ctjlc9KFhS4A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 15:42:34 -0000 On Wed, 12 Jul 2017, Ian Lepore wrote: > Log: > Protect access to the AT realtime clock with its own mutex. > > The mutex protecting access to the registered realtime clock should not be > overloaded to protect access to the atrtc hardware, which might not even be > the registered rtc. More importantly, the resettodr mutex needs to be > eliminated to remove locking/sleeping restrictions on clock drivers, and > that can't happen if MD code for amd64 depends on it. This change moves the > protection into what's really being protected: access to the atrtc date and > time registers. The spin mutex provided some protection against timing bugs caused by preemption, but it is impossible to hold the mutex around the user code that is setting the time, so both the kernel and user code should check if the operation took too long and fail/retry if it did. With correct code like that, spin mutexes are still good for limiting retries. I think it is best to try to hold one around the entire kernel part of the operation, and release it when sleeping at lower levels. > Modified: head/sys/x86/isa/atrtc.c > ============================================================================== > --- head/sys/x86/isa/atrtc.c Tue Jul 11 21:55:20 2017 (r320900) > +++ head/sys/x86/isa/atrtc.c Wed Jul 12 02:42:57 2017 (r320901) > @@ -53,9 +53,17 @@ __FBSDID("$FreeBSD$"); > #include > #include "clock_if.h" > > +/* > + * clock_lock protects low-level access to individual hardware registers. > + * atrtc_time_lock protects the entire sequence of accessing multiple registers > + * to read or write the date and time. > + */ > #define RTC_LOCK do { if (!kdb_active) mtx_lock_spin(&clock_lock); } while (0) > #define RTC_UNLOCK do { if (!kdb_active) mtx_unlock_spin(&clock_lock); } while (0) This has a lot of old design and implementation bugs: - it abuses the i8254 mutex for the rtc - it obfuscates this using macros - locking individual register accesses is buggy. Register accesses need to be locked in groups like your new code does - the kdb_active hack is buggy (it can't use mutexes and is unnecessarily non-reentrant) The locks should be separate and statically allocated. > > +struct mtx atrtc_time_lock; > +MTX_SYSINIT(atrtc_lock_init, &atrtc_time_lock, "atrtc", MTX_DEF); > + I think the old mutex should be used here, after fixing it. Locking individual register access is a special case of locking groups of register acceses. It must be a spin mutex for low-level use, and that is good for high-level use too, to complete the high-level operations as soon as possible. You used this mutex for efirt.c, but I think that is another error like sharing the i8254 mutex (or the resettodr mutex). Different clock drivers should just use different mutexes. Perhaps some drivers actually need sleep mutexes. > ... > @@ -352,6 +364,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) > * to make sure that no more than 240us pass after we start reading, > * and try again if so. > */ > + mtx_lock(&atrtc_time_lock); > while (rtcin(RTC_STATUSA) & RTCSA_TUP) > continue; > critical_enter(); Note the comment about the 240us window. On i386, this was broken by SMPng, and almost fixed by starting the locking outside of the loop (a spin mutex would fix it). On i386, before SMPng, there was an splhigh() starting before the loop. rtcin() also used splhigh(). This was only shortly before SMPng -- FreeBSD-4 had both splhigh()'s, but FreeBSD-3 had neither. With no locking, an interrupt after the read of the status register can occur, and interrupt handling can easily take longer than the 240us window even if it doesn't cause preemption. critical_enter() in the above gives poor man's locking which blocks preemption but not-so-fast interrupt handlers. The race is not very important since this code only runs at boot time. The old splhigh() locking and a [spin] mutex around the loop lock out interrupts and/or preemption for too long (0-1 seconds), but again this is not very important since this code only runs at boot time. This is fixed in my version, but only for spl locking. The lock is acquired before each test in the loop and dropped after each failing test in the loop. Then operation is completed as far as necessary while the lock is still held. > @@ -369,6 +382,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) > ct.year += (ct.year < 80 ? 2000 : 1900); > #endif > critical_exit(); > + mtx_unlock(&atrtc_time_lock); > /* Set dow = -1 because some clocks don't set it correctly. */ > ct.dow = -1; > return (clock_ct_to_ts(&ct, ts)); The new mtx_lock() should be placed next to the old critical_enter() too. Put these before or after the loop depending on whether races or high latency are preferred. Bruce From owner-svn-src-head@freebsd.org Wed Jul 12 16:28:47 2017 Return-Path: Delivered-To: svn-src-head@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 9A8F2D9CA33; Wed, 12 Jul 2017 16:28:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B7326A5EF; Wed, 12 Jul 2017 16:28:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id D992310AF07; Wed, 12 Jul 2017 12:28:45 -0400 (EDT) From: John Baldwin To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320900 - in head/sys: fs/cd9660 fs/ext2fs fs/fifofs fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs ufs/ufs Date: Wed, 12 Jul 2017 09:28:42 -0700 Message-ID: <2198764.5xJVkxmjDt@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20170712184348.Q1271@besplex.bde.org> References: <201707112155.v6BLtKbZ006618@repo.freebsd.org> <20170712184348.Q1271@besplex.bde.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 12 Jul 2017 12:28:45 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 16:28:47 -0000 On Wednesday, July 12, 2017 08:08:42 PM Bruce Evans wrote: > On Tue, 11 Jul 2017, John Baldwin wrote: > > > Log: > > Consistently use vop_stdpathconf() for default pathconf values. > > > > Update filesystems not currently using vop_stdpathconf() in pathconf > > VOPs to use vop_stdpathconf() for any configuration variables that do > > not have filesystem-specific values. vop_stdpathconf() is used for > > variables that have system-wide settings as well as providing default > > values for some values based on system limits. Filesystems can still > > explicitly override individual settings. > > This is sort of backwards. Not many settings are the same for most > file systems, and many that did were wrong. Now more are wrong. > > > Modified: head/sys/fs/cd9660/cd9660_vnops.c > > ============================================================================== > > --- head/sys/fs/cd9660/cd9660_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > > +++ head/sys/fs/cd9660/cd9660_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > > @@ -792,20 +792,11 @@ cd9660_pathconf(ap) > > else > > *ap->a_retval = 37; > > return (0); > > - case _PC_PATH_MAX: > > - *ap->a_retval = PATH_MAX; > > - return (0); > > PATH_MAX is one of the few that is system-wide. > > > - case _PC_PIPE_BUF: > > - *ap->a_retval = PIPE_BUF; > > - return (0); > > PIPE_BUF isn't system wide. cd9660 does support fifos, but setting it > for files that aren't fifos or directories is bogus. POSIX allows such > bogus settings, and needs complicated wording to describe this. E.g., > PIPE_BUF for a directory is not completely bogus and it means that the > value for the directory applies to all fifos in the directory and is > ignored for all non-fifos in the directory. It is unclear if PIPE_BUF > must be set for a directory if there is any fifo in the directory. > FreeBSD's man pages give no details about this. PIPE_BUF is system wide because all FIFOs in FreeBSD are implemented via a common fifo implementation that has a single size. The wording about PIPE_BUF from http://pubs.opengroup.org/onlinepubs/009695399/functions/fpathconf.html: If path refers to a FIFO, or fildes refers to a pipe or FIFO, the value returned shall apply to the referenced object. If path or fildes refers to a directory, the value returned shall apply to any FIFO that exists or can be created within the directory. If path or fildes refers to any other type of file, it is unspecified whether an implementation supports an association of the variable name with the specified file. This leaves the value for non-directories and non-FIFOs undefined. We could perhaps add more complexity to fail with EINVAL for types other than VFIFO or VDIR, and filesystems that do not support FIFOs could fail _PC_PIPE_BUF in their fs-specific vnop, but this would not be any more correct as both behaviors fall into "undefined", but the current one is simpler to implement. > > - case _PC_CHOWN_RESTRICTED: > > - *ap->a_retval = 1; > > - return (0); > > This is system-wide. > > > case _PC_NO_TRUNC: > > *ap->a_retval = 1; > > return (0); > > This is almost system-wide. > > > default: > > - return (EINVAL); > > + return (vop_stdpathconf(ap)); > > This is fail-unsafe. It gives bogus settings like PIPE_BUF for all cases. > Case statements in file systems need to be even larger to kill defaults, > and the code becomes harder to read since it is harder to see the final > values. > > vop_stdpathconf() has defaults for: > - ASYNC_IO. Is this system-wide (all in vfs?) Yes. > - NAME_MAX. This is very far from system-wide > - PATH_MAX. This is system-wide. > - LINK_MAX. This is very far from system-wide, especially after expansion > of nlink_t. Most file systems get this wrong. LINK_MAX is bogusly > defined to be the constant 32767, but the value is very variable. > zfs_pathconf() returns INT_MAX and zfs uses something like int32_t > internally, but zfs_getattr() clamps to LINK_MAX. ext2fs limits to > 32000 for ext2 and 65000 for ext4 internally but ext2_pathconf() > only returns this limit in some cases -- other cases return INT_MAX. In theory if a filesystem supported an infinite link count or name count it would have no filesystem-specific limit and having LINK_MAX and NAME_MAX provide the system limits gives a reasonable default in that case. I don't know if any filesystem supports infinite limits in practice, but it's also true that the correct behavior in each filesystem would be to return a value like MIN(fs_limit, system_limit), not just the native filesystem limit. Perhaps this could be implemented by a post-processing step for VOP_PATHCONF that truncates values that exceed system limits to system limits. > - MAX_CANON. This is garbage except for terminals (and directories). > Its value is also wrong. > - MAX_INPUT. Like MAX_CANON. Again, POSIX leaves it undefined for other types, so it doesn't matter what we return. Quoting from the same URL for a note on these two: If path or fildes does not refer to a terminal file, it is unspecified whether an implementation supports an association of the variable name with the specified file. > - PIPE_BUF. Like MAX_CANON, for fifos instead of terminals. > - CHOWN_RESTRICTED. Wrong for file systems that don't support ownerships > or changing them. Might depend on mount options. > - VDISABLE. Like MAX_CANON. Same note for MAX_CANON applies. > > This is easy to improve: > - NAME_MAX, LINK_MAX: move to individual fs's That probably is true. In this case I was just trying to reduce overrides to the ones that were really fs-specific. The existing places that used NAME_MAX and LINK_MAX were also likely wrong as they did not return a filesystem-specific value. > - MAX_CANON, MAX_INPUT, VDISABLE: move to devfs_pathconf(). That is probably fine as well as it is simple and doesn't add complexity. > - PIPE_BUF: move to fifo_pathconf()? What about directories? I think this one should be standard for the reasons I gave above. If we really wanted to, we could make it conditional on the type (VFIFO and VDIR) without adding a lot of complexity. > > Modified: head/sys/fs/fifofs/fifo_vnops.c > > ============================================================================== > > --- head/sys/fs/fifofs/fifo_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > > +++ head/sys/fs/fifofs/fifo_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > > @@ -337,34 +336,6 @@ fifo_print(ap) > > fifo_printinfo(ap->a_vp); > > printf("\n"); > > return (0); > > -} > > - > > -/* > > - * Return POSIX pathconf information applicable to fifo's. > > - */ > > -static int > > -fifo_pathconf(ap) > > - struct vop_pathconf_args /* { > > - struct vnode *a_vp; > > - int a_name; > > - int *a_retval; > > - } */ *ap; > > -{ > > - > > - switch (ap->a_name) { > > - case _PC_LINK_MAX: > > - *ap->a_retval = LINK_MAX; > > - return (0); > > - case _PC_PIPE_BUF: > > - *ap->a_retval = PIPE_BUF; > > - return (0); > > - case _PC_CHOWN_RESTRICTED: > > - *ap->a_retval = 1; > > - return (0); > > - default: > > - return (EINVAL); > > - } > > - /* NOTREACHED */ > > } > > This was small and hopefully correct. Not many settings apply to fifos. > It seems a but too small to be correct -- why would LINK_MAX apply but > not PATH_MAX? Using the default, a pathconf which wants to set only 3 > value would need about 15 cases to kill all the defaults. This was not really correct since at least NAME_MAX was missing, but it also should never have been used as a full VOP. The parent filesystem in which the FIFO resides dictates values like LINK_MAX and NAME_MAX. The only safe way to use fifo_pathconf() is to have a per-fs wrapper that supplies FS-specific properties like NAME_MAX and LINK_MAX and only invokes fifo_pathconf for FIFO-specific properties. However, the only FIFO-specific property is PIPE_BUF, and the parent fs already has to handle that in the FS-specific pathconf VOP to support PIPE_BUF on directories, so the FS-specific pathconf VOP already works correctly for FIFOs and there is no need for a fifo_pathconf. > > Modified: head/sys/fs/msdosfs/msdosfs_vnops.c > > ============================================================================== > > --- head/sys/fs/msdosfs/msdosfs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > > +++ head/sys/fs/msdosfs/msdosfs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > > @@ -1875,17 +1875,11 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) > > case _PC_NAME_MAX: > > *ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12; > > return (0); > > - case _PC_PATH_MAX: > > - *ap->a_retval = PATH_MAX; > > - return (0); > > - case _PC_CHOWN_RESTRICTED: > > - *ap->a_retval = 1; > > - return (0); > > case _PC_NO_TRUNC: > > *ap->a_retval = 0; > > return (0); > > default: > > - return (EINVAL); > > + return (vop_stdpathconf(ap)); > > msdosfs doesn't support pipes. It used to indicate this by not having > _PC_PIPE_MAX. Now it gets this via pollution in vop_stdpathconf(ap). >From what I can tell (and from the note I referenced above), POSIX doesn't define if the variable is defined on filesystems that don't support FIFOs. It only says that the value on a directory must be true for any FIFO that "exists or can be created". Since mkfifo() will fail and open() will never return a vnode with VFIFO on such filesystems, the value is meaningless. > msdosfs also has unusual handling for LINK_MAX, NAME_MAX and NO_TRUNC. > It still has this, with buggy limits in all cases: > - msdosfs doesn't support links. It returns 1 for LINK_MAX instead of -1 > (unsupported) > - NAME_MAX doesn't really apply to shortnames. 12 is returned instead > of the 2 limits 8 and 3. > - msdosfs truncates only for shortnames, so NO_TRUNC = 0 is wrong for > !shortnames. > > Almost all file systems except msdosfs return 1 for NO_TRUNC, but this > is not defaulted. That may indeed be a good candidate for moving to stdpathconf. > > Modified: head/sys/ufs/ufs/ufs_vnops.c > > ============================================================================== > > --- head/sys/ufs/ufs/ufs_vnops.c Tue Jul 11 21:52:11 2017 (r320899) > > +++ head/sys/ufs/ufs/ufs_vnops.c Tue Jul 11 21:55:20 2017 (r320900) > > @@ -2442,21 +2442,9 @@ ufs_pathconf(ap) > > > > error = 0; > > switch (ap->a_name) { > > - case _PC_LINK_MAX: > > - *ap->a_retval = LINK_MAX; > > - break; > > case _PC_NAME_MAX: > > *ap->a_retval = UFS_MAXNAMLEN; > > break; > > LINK_MAX is basically ffs's limit. > > NAME_MAX _is_ ffs's limit, but it is still defaulted. > > I expect that some of the other defaulted limits will become more variable > (so unsuitable as defaults). LINK_MAX is almost there. > > > @@ -2505,11 +2493,6 @@ ufs_pathconf(ap) > > case _PC_MIN_HOLE_SIZE: > > *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; > > break; > > - case _PC_ASYNC_IO: > > - /* _PC_ASYNC_IO should have been handled by upper layers. */ > > - KASSERT(0, ("_PC_ASYNC_IO should not get here")); > > - error = EINVAL; > > - break; > > case _PC_PRIO_IO: > > *ap->a_retval = 0; > > break; > > But some of the newer limits like are in vfs so should have been defaulted? _PC_ASYNC_IO used to be explicitly handled in the pathconf system calls as a special case. I had moved it to vop_stdpathconf() so that it was handled in one place (rather than 3), but had missed these specific handlers in existing pathconf VOPs. System-wide pathconf values should really be in one place in vop_stdpathconf(). We might want to alter the list of things in vop_stdpathconf(), but I think all filesystems should fall through to it and only override values that are filesystem-specific. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jul 12 17:35:34 2017 Return-Path: Delivered-To: svn-src-head@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 042D1D9EDDA; Wed, 12 Jul 2017 17:35:34 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C49C070368; Wed, 12 Jul 2017 17:35:33 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CHZWWF091334; Wed, 12 Jul 2017 17:35:32 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CHZWNY091333; Wed, 12 Jul 2017 17:35:32 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707121735.v6CHZWNY091333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 12 Jul 2017 17:35:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320916 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 320916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 17:35:34 -0000 Author: sbruno Date: Wed Jul 12 17:35:32 2017 New Revision: 320916 URL: https://svnweb.freebsd.org/changeset/base/320916 Log: Reset unsupported SFP tuneable back to original entry name. Reported by: olivier@ Modified: head/sys/dev/ixgbe/if_ix.c Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Wed Jul 12 15:16:01 2017 (r320915) +++ head/sys/dev/ixgbe/if_ix.c Wed Jul 12 17:35:32 2017 (r320916) @@ -333,7 +333,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgb * doing so you are on your own :) */ static int allow_unsupported_sfp = FALSE; -SYSCTL_INT(_hw_ix, OID_AUTO, allow_unsupported_sfp, CTLFLAG_RDTUN, +SYSCTL_INT(_hw_ix, OID_AUTO, unsupported_sfp, CTLFLAG_RDTUN, &allow_unsupported_sfp, 0, "Allow unsupported SFP modules...use at your own risk"); From owner-svn-src-head@freebsd.org Wed Jul 12 18:29:26 2017 Return-Path: Delivered-To: svn-src-head@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 AD53ED9FF68; Wed, 12 Jul 2017 18:29:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7038F71EE4; Wed, 12 Jul 2017 18:29:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CITPO4012103; Wed, 12 Jul 2017 18:29:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CITPxG012102; Wed, 12 Jul 2017 18:29:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707121829.v6CITPxG012102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 12 Jul 2017 18:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320918 - head/sbin/savecore X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/savecore X-SVN-Commit-Revision: 320918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 18:29:26 -0000 Author: markj Date: Wed Jul 12 18:29:25 2017 New Revision: 320918 URL: https://svnweb.freebsd.org/changeset/base/320918 Log: Add a newline after the version string. MFC after: 3 days Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Wed Jul 12 17:51:00 2017 (r320917) +++ head/sbin/savecore/savecore.c Wed Jul 12 18:29:25 2017 (r320918) @@ -119,7 +119,7 @@ printheader(xo_handle_t *xo, const struct kerneldumphe xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t)); xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname); xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic); - xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", h->versionstring); + xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}\n", h->versionstring); xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring); xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity); xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds); From owner-svn-src-head@freebsd.org Wed Jul 12 19:01:26 2017 Return-Path: Delivered-To: svn-src-head@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 F2D2BDA0B0F; Wed, 12 Jul 2017 19:01:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C0014731D1; Wed, 12 Jul 2017 19:01:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CJ1PUx025374; Wed, 12 Jul 2017 19:01:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CJ1P7A025373; Wed, 12 Jul 2017 19:01:25 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707121901.v6CJ1P7A025373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 12 Jul 2017 19:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320919 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 320919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 19:01:27 -0000 Author: bdrewery Date: Wed Jul 12 19:01:25 2017 New Revision: 320919 URL: https://svnweb.freebsd.org/changeset/base/320919 Log: META_MODE: Fix not writing .meta files in the kernel build. This was a regression in r320220 due to improper porting of the same logic from share/mk/bsd.dep.mk and having only tested with -DNO_FILEMON at the time. Pointyhat to: bdrewery Reported by: Mark Millard, dhw, O. Hartmann Sponsored by: Dell EMC Isilon Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Wed Jul 12 18:29:25 2017 (r320918) +++ head/sys/conf/kern.post.mk Wed Jul 12 19:01:25 2017 (r320919) @@ -203,8 +203,7 @@ _meta_filemon= 1 # for _meta_filemon but not for _SKIP_DEPEND. .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(*obj) || \ ${.TARGETS:M*clean*} == ${.TARGETS} || \ - ${.TARGETS:M*install*} == ${.TARGETS} || \ - defined(_meta_filemon) + ${.TARGETS:M*install*} == ${.TARGETS} _SKIP_DEPEND= 1 .endif .if defined(_SKIP_DEPEND) || defined(_meta_filemon) From owner-svn-src-head@freebsd.org Wed Jul 12 19:52:22 2017 Return-Path: Delivered-To: svn-src-head@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 CF7F3DA2265; Wed, 12 Jul 2017 19:52:22 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [192.203.228.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B901C75676; Wed, 12 Jul 2017 19:52:22 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 6662D69A; Wed, 12 Jul 2017 12:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1499889136; bh=4x1gbAAvvLCg6yTMlZdcLHw0xHqRu5uIbzDq1sPq5Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BgxmegaSa8U7lkjqpWIjStFuBGgxbget5A/OuH1u7/nP3NdJ4bbytwEcKmIQ2d90B vwinc0NtXhrjdTQqnFLPXc7y6Vgl1RgAjUjHs+AE/ylt7vGR7wcmDn31MxYBFXhoUa +cxBFCONZDVtKEbzwA0hmGsOCs3N3kyYmMSzrXzo= From: Peter Wemm To: Andriy Gapon Cc: svn-src-head@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r320452 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Date: Wed, 12 Jul 2017 12:52:14 -0700 Message-ID: <1620155.k5U0yJ7ekR@overcee.wemm.org> User-Agent: KMail/4.14.10 (FreeBSD/12.0-CURRENT; KDE/4.14.10; amd64; ; ) In-Reply-To: <2227668.mxUYtcVILl@overcee.wemm.org> References: <201706281359.v5SDxKDB033681@repo.freebsd.org> <2865573.6VCVxXl8ZR@overcee.wemm.org> <2227668.mxUYtcVILl@overcee.wemm.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2290573.tQ58bQ8BqM"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 19:52:22 -0000 --nextPart2290573.tQ58bQ8BqM Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Tuesday, July 11, 2017 11:55:47 PM Peter Wemm wrote: > On Tuesday, July 11, 2017 11:08:15 PM Peter Wemm wrote: > > On Wednesday, June 28, 2017 01:59:20 PM Andriy Gapon wrote: > > > A side bonus of this change is that now a vdev zio has a pointe= r > > > to its corresponding bio while the zio is active. > >=20 > > fault virtual address =3D 0x28 > >=20 > >=20 > > db> where > > Tracing pid 0 tid 100471 td 0xfffff80005452000 > > vdev_geom_io_done() at vdev_geom_io_done+0x36/frame 0xfffffe0239f9e= aa0 > > zio_vdev_io_done() at zio_vdev_io_done+0x176/frame 0xfffffe0239f9ea= d0 > > zio_execute() at zio_execute+0xac/frame 0xfffffe0239f9eb20 >=20 > Oops, truncated. >=20 >=20 > taskqueue_run_locked() at taskqueue_run_locked+0x127/frame > 0xfffffe0239f9eb80 taskqueue_thread_loop() at > taskqueue_thread_loop+0xc8/frame 0xfffffe0239f9ebb0 fork_exit() at > fork_exit+0x85/frame 0xfffffe0239f9ebf0 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0239f9ebf0 > --- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- Likewise with a disk failing or being put offline. eg: the explicit o= fflining=20 case, making a vdev degrade: root@nope.ysv:/home/peter # zpool offline zroot mfid5p3 atal trap 12: page fault while in kernel mode cpuid =3D 4; apic id =3D 04 Fatal trap 12: page fault while in kernel mode fault virtual address=09=3D 0x28 Fatal trap 12: page fault while in kernel mode Fatal trap 12: page fault while in kernel mode Fatal trap 12: page fault while in kernel mode cpuid =3D 7; apic id =3D 07 cpuid =3D 1; apic id =3D 01 fault virtual address=09=3D 0x28 fault code=09=09=3D supervisor read data, page not present cpuid =3D 3; cpuid =3D 5; apic id =3D 03 Fatal trap 12: page fault while in kernel mode apic id =3D 05 fault virtual address=09=3D 0x28 fault virtual address=09=3D 0x28 fault code=09=09=3D supervisor read data, page not present instruction pointer=09=3D 0x20:0xffffffff803aab56 stack pointer=09 =3D 0x28:0xfffffe085fb3aa90 instruction pointer=09=3D 0x20:0xffffffff803aab56 fault code=09=09=3D supervisor read data, page not present cpuid =3D 6; fault virtual address=09=3D 0x28 Fatal trap 12: page fault while in kernel mode fault code=09=09=3D supervisor read data, page not present instruction pointer=09=3D 0x20:0xffffffff803aab56 stack pointer=09 =3D 0x28:0xfffffe085fb3fa90 frame pointer=09 =3D 0x28:0xfffffe085fb3aaa0 fault code=09=09=3D supervisor read data, page not present cpuid =3D 2; apic id =3D 02 apic id =3D 06 instruction pointer=09=3D 0x20:0xffffffff803aab56 fault virtual address=09=3D 0x28 fault code=09=09=3D supervisor read data, page not present stack pointer=09 =3D 0x28:0xfffffe085fb30a90 instruction pointer=09=3D 0x20:0xffffffff803aab56 stack pointer=09 =3D 0x28:0xfffffe085fb35a90 frame pointer=09 =3D 0x28:0xfffffe085fb3faa0 code segment=09=09=3D base 0x0, limit 0xfffff, type 0x1b stack pointer=09 =3D 0x28:0xfffffe085fb44a90 frame pointer=09 =3D 0x28:0xfffffe085fb44aa0 code segment=09=09=3D base 0x0, limit 0xfffff, type 0x1b =09=09=09=3D DPL 0, pres 1, long 1, def32 0, gran 1 fault virtual address=09=3D 0x28 =09=09=09=3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags=09=3D interrupt enabled, instruction pointer=09=3D 0x2= 0:6 frame pointer=09 =3D 0x28:0xfffffe085fb30aa0 code segment=09=09=3D base 0x0, limit 0xfffff, type 0x1b code segment=09=09=3D base 0x0, limit 0xfffff, type 0x1b frame pointer=09 =3D 0x28:0xfffffe085fb35aa0 code segment=09=09=3D base 0x0, limit 0xfffff, type 0x1b resume, IOPL =3D 0 stack pointer=09 =3D 0x28:0xfffffe085fb26a90 =09=09=09=3D DPL 0, pres 1, long 1, def32 0, gran 1 =09=09=09=3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags=09=3D fault code=09=09=3D supervisor read data, page n= ot frame pointer=09 =3D 0x28:0xfffffe085fb26aa0 instruction pointer=09=3D 0x20:0xffffffff803aab56 processor eflags=09=3D interrupt enabled, code segment=09=09=3D base b =09=09=09=3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags=09=3D interrupt enabled, resume, IOPL =3D 0 current process=09=09=3D 0 (zio_write_intr_2) [ thread pid 0 tid 100500 ] Stopped at vdev_geom_io_done+0x36: movq 0x28(%rbx),%rsi db> where Tracing pid 0 tid 100500 td 0xfffff8000aae6000 vdev_geom_io_done() at vdev_geom_io_done+0x36/frame 0xfffffe085fb30aa0 zio_vdev_io_done() at zio_vdev_io_done+0x176/frame 0xfffffe085fb30ad0 zio_execute() at zio_execute+0xac/frame 0xfffffe085fb30b20 taskqueue_run_locked() at taskqueue_run_locked+0x127/frame 0xfffffe085f= b30b80 taskqueue_thread_loop() at taskqueue_thread_loop+0xc8/frame 0xfffffe085= fb30bb0 fork_exit() at fork_exit+0x85/frame 0xfffffe085fb30bf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe085fb30bf0 =2D-- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- db>=20 =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart2290573.tQ58bQ8BqM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEBgrA0Vr/vfNVuPoUNdaXCeyAngQFAllmfe4ACgkQNdaXCeyA ngSo5ggAgZhd2TJF8LgBHNPATXvpnRBc6Cc75ziyroB5GXwkNnpwFy+bNIECsvff 4mxpw76talPoBbbyfjPlL7yBHnBsYKqU2KbH883If7eslPe1GHDzNta8o4z+jVje rk2QfM1hr/z6iQrT4Fj8KHFiuw3t0BVpoIhm1EripSvL+UEjwc1T8UJINnP9EFle CboNc4MHzZWM8Z3VL+8jg/d5I0uL+K/SrtCzlZHYB1b4LdN5mrABWdfuCMv9tvUO eVXZEy605xFRrj+OpfmbRaTCmwNqAMFF9X3IQSR0T86TyvOq8ggD7jOGUqV/KeEm oQzkFYOMQDJxIkcElB/gAAVDP7ZGqA== =epb0 -----END PGP SIGNATURE----- --nextPart2290573.tQ58bQ8BqM-- From owner-svn-src-head@freebsd.org Wed Jul 12 22:17:18 2017 Return-Path: Delivered-To: svn-src-head@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 9E4D2DA64BD; Wed, 12 Jul 2017 22:17:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A67E79E1A; Wed, 12 Jul 2017 22:17:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 8F88910AF07; Wed, 12 Jul 2017 18:17:11 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320918 - head/sbin/savecore Date: Wed, 12 Jul 2017 14:23:52 -0700 Message-ID: <1930640.IHpqZ2aWqS@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201707121829.v6CITPxG012102@repo.freebsd.org> References: <201707121829.v6CITPxG012102@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 12 Jul 2017 18:17:11 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 22:17:18 -0000 On Wednesday, July 12, 2017 06:29:25 PM Mark Johnston wrote: > Author: markj > Date: Wed Jul 12 18:29:25 2017 > New Revision: 320918 > URL: https://svnweb.freebsd.org/changeset/base/320918 > > Log: > Add a newline after the version string. > > MFC after: 3 days I think the version string normally has a trailing \n emedded in it? Also, have you verified that crashinfo is still able to match the Version String from the generated info.X file? I think it might as it stops printing lines once it matches the second line of the version, so I think (just reading the awk) that it will not include the extra newline in the 'ivers' compared against 'version' from gdb. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jul 12 22:26:07 2017 Return-Path: Delivered-To: svn-src-head@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 69835DA6719; Wed, 12 Jul 2017 22:26:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43C857A2B4; Wed, 12 Jul 2017 22:26:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id ACB5F10AF01; Wed, 12 Jul 2017 18:26:05 -0400 (EDT) From: John Baldwin To: Ryan Libby Cc: Roman Divacky , Ryan Libby , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320908 - head/sys/kern Date: Wed, 12 Jul 2017 15:20:58 -0700 Message-ID: <25032740.sJOsNDzvpa@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201707120730.v6C7UExf041447@repo.freebsd.org> <20170712074326.GA41347@vlakno.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 12 Jul 2017 18:26:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 22:26:07 -0000 On Wednesday, July 12, 2017 01:09:39 AM Ryan Libby wrote: > On Wed, Jul 12, 2017 at 12:43 AM, Roman Divacky wrote: > > Clang knows about %b modifier and can do some semantic analysis on it. > > Currently it type checks the first arg to be an int and the second to be > > a char*. > > > > Do you think it would be worth modifying the checks to include > > this new functionality? Do you think you would like to take a stab > > at it? > > Yes, I plan to send that to clang upstream. I originally had those > changes in this commit but I was directed rather to send them first to > upstream. See here [1] for roughly what I plan to send upstream > (although I have since noticed some unit tests that I guess should be > extended). > > For now, the semantic analysis should be fine as the change should be > backward compatible and I haven't yet changed any of the users of > %b to use the new capabilities. There is also '%b' support in GCC via -fformat-extensions. GCC 4.2.1 probably matters less, but the external GCC toolchain ports use a patch in /usr/ports/devel/powerpc64-gcc/files/freebsd-format-extensions that you may need to adjust as well. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jul 12 23:41:40 2017 Return-Path: Delivered-To: svn-src-head@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 520C3DA7AEA; Wed, 12 Jul 2017 23:41:40 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt0-x232.google.com (mail-qt0-x232.google.com [IPv6:2607:f8b0:400d:c0d::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 091107C0F4; Wed, 12 Jul 2017 23:41:40 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt0-x232.google.com with SMTP id b40so25623316qtb.2; Wed, 12 Jul 2017 16:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ErrCiTdt6Lgf7vbZUBMNWE3Eizdxj7MUZsnH2tuwbkU=; b=UdkWVDPucXNgnyt4Xz9hhfE6sqBxcy9RxxV1HO4d18gZnPbR6SGbx89JyIxEDKveS6 zmnKUh5SaMPWNeTh2kJJY9to9CTKfkyH+cuNk5t7fiwfuAO4nQ/xoHaIpwgLu7ZrhU9t 7aBIUrvlc0dYKMVfKoOE0/DbCi4C70rP9uJw39N4jE3EYQkssuTQ2JHO1AJ22o4SU8S/ tW5/k7EbLFnDaLHWozDZoQWu4GCWLp+nS2qujZ7njvuO0MGfzqDpmcoAOv+V0mDQEpQY r+mrLXpLf46daVjVUZxaZJSyjQNu9Byoz0pySsUpETS09opt3PZK7zj0Uf/U+3lgdGq6 gg6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ErrCiTdt6Lgf7vbZUBMNWE3Eizdxj7MUZsnH2tuwbkU=; b=J5+TIdNpSeXVfd3CUKxIFql373jyShHqFSwutMABy2yCbFjhzQUtiiYJd5lo2xfqOq GLsOB3GJhqrK/CKcFMJv87CU1KVvIRQhMHBYcBmE2xliKEUt2/ZW9QfOGOyxzpz9VID0 b/cqO+gd/6wH9RNtIUaerVkki88VILWPewf5aVhutXQxfSjgrp/3M4OCNnKTF1QFVqbl PERyrPIfNGR+6Dz94MtYsDHk1sTIGakUwTFrkoFNvPaRyIX7fFskU2X++unDqy2d7CEP BQPJA/JSQgMH02Pb+eMfICGcIw5RJIoPv/2oz5gD0DiXJVDLYynJqp4ySQRD6YM+dOUi c2IA== X-Gm-Message-State: AIVw110A9yj1jyaHolo54qoj7rHWgIzWOw+ESgRw5x5XId4h3/zTJymx qQqaUXBCl3zaH3Al X-Received: by 10.200.50.93 with SMTP id y29mr1536931qta.108.1499902898817; Wed, 12 Jul 2017 16:41:38 -0700 (PDT) Received: from wkstn-mjohnston.west.isilon.com (c-76-104-201-218.hsd1.wa.comcast.net. [76.104.201.218]) by smtp.gmail.com with ESMTPSA id y17sm3181706qtb.37.2017.07.12.16.41.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 16:41:38 -0700 (PDT) Sender: Mark Johnston Date: Wed, 12 Jul 2017 16:41:09 -0700 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320918 - head/sbin/savecore Message-ID: <20170712234108.GA48612@wkstn-mjohnston.west.isilon.com> References: <201707121829.v6CITPxG012102@repo.freebsd.org> <1930640.IHpqZ2aWqS@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1930640.IHpqZ2aWqS@ralph.baldwin.cx> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 23:41:40 -0000 On Wed, Jul 12, 2017 at 02:23:52PM -0700, John Baldwin wrote: > On Wednesday, July 12, 2017 06:29:25 PM Mark Johnston wrote: > > Author: markj > > Date: Wed Jul 12 18:29:25 2017 > > New Revision: 320918 > > URL: https://svnweb.freebsd.org/changeset/base/320918 > > > > Log: > > Add a newline after the version string. > > > > MFC after: 3 days > > I think the version string normally has a trailing \n emedded in it? You're right. The problem in my case is that the version string is getting truncated in mkdumpheader(), and so the trailing \n is omitted. > Also, > have you verified that crashinfo is still able to match the Version String > from the generated info.X file? I think it might as it stops printing lines > once it matches the second line of the version, so I think (just reading the > awk) that it will not include the extra newline in the 'ivers' compared > against 'version' from gdb. That's true, but it looks like it doesn't work properly in the truncated case. What if we declare a match when the version string in the info.X file matches a prefix of the version string reported by gdb? diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index 22b4793f4ff5..f5862782bb21 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -119,7 +119,7 @@ printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *devic xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t)); xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname); xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic); - xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}\n", h->versionstring); + xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", h->versionstring); xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring); xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity); xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds); diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 5c6c0e136769..d87b63461de5 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -1229,6 +1229,7 @@ void mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, uint64_t dumplen, uint32_t dumpkeysize, uint32_t blksz) { + size_t dstsize; bzero(kdh, sizeof(*kdh)); strlcpy(kdh->magic, magic, sizeof(kdh->magic)); @@ -1240,7 +1241,9 @@ mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, kdh->dumpkeysize = htod32(dumpkeysize); kdh->blocksize = htod32(blksz); strlcpy(kdh->hostname, prison0.pr_hostname, sizeof(kdh->hostname)); - strlcpy(kdh->versionstring, version, sizeof(kdh->versionstring)); + dstsize = sizeof(kdh->versionstring); + if (strlcpy(kdh->versionstring, version, dstsize) >= dstsize) + kdh->versionstring[dstsize - 2] = '\n'; if (panicstr != NULL) strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); kdh->parity = kerneldump_parity(kdh); diff --git a/usr.sbin/crashinfo/crashinfo.sh b/usr.sbin/crashinfo/crashinfo.sh index e52c01419b0d..b3029c6eea4a 100755 --- a/usr.sbin/crashinfo/crashinfo.sh +++ b/usr.sbin/crashinfo/crashinfo.sh @@ -85,8 +85,9 @@ find_kernel() # Look for a matching kernel version. for k in `sysctl -n kern.bootfile` $(ls -t /boot/*/kernel); do - kvers=$(gdb_command $k 'printf " Version String: %s", version' \ - 2>/dev/null) + kvers=$(gdb_command $k 'printf " Version String: %s", version' | \ + awk "{line=line\$0\"\n\"} END{print substr(line,1,${#ivers})}" \ + 2>/dev/null) if [ "$ivers" = "$kvers" ]; then KERNEL=$k break From owner-svn-src-head@freebsd.org Wed Jul 12 23:48:50 2017 Return-Path: Delivered-To: svn-src-head@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 8D145DA7E17; Wed, 12 Jul 2017 23:48:50 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22b.google.com (mail-qk0-x22b.google.com [IPv6:2607:f8b0:400d:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 484D37C5C8; Wed, 12 Jul 2017 23:48:50 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22b.google.com with SMTP id 16so38015632qkg.2; Wed, 12 Jul 2017 16:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5DjrsfHiOM7G/4uzt3QovxQ7pdwsN2v7If1q1r8HTlI=; b=PB9/ArMOGSFur2QkvgfFA/ZsEqp4Ow0FGJUpijgA+S2+wP5ImLcq8Onf/I4AhWeJrR QmRQYbz+xbX/aZoeoSjDPYKIJxm+bbpv6I9HURXZQPuP2+Gu4H0J80O5DS+WcMXDucEU ut/H0MduV/fuB6bAvIX8v//El4gBivvWScIgdn/APlCUP7DmE1ClkhZzkXAHLwqy6BHN XrF4S1+yZ1TOVxUOEE9yjwj951KQSI4mzhx2Oujh1Ve1fHtRZuSheJ1tv2rArdHjktKl HqpEPSLm6BM2TDJY3m1clyF2+rzb29zRwkdyf+JrieTAlmriTzupAgdgomui6u4S/WnC Yk3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5DjrsfHiOM7G/4uzt3QovxQ7pdwsN2v7If1q1r8HTlI=; b=r7iTYJJ/CL2FhaX9pnf6FATe/yjg0rkTvf/2H9DBGZhnsgAhZ9cwcasZmQpEm51iLK HiIGrkMfkdKLAQAE4KPhtKQCVxYXl0iclfk5KJ350jPuBLeiKDJRDSvc7DBLxwdgRcIM avCCJbsYjeUJ82c0fzkpYHnA51cqI0aK/VpxwCcuDRST9RWIlJkfff1ZXSFkhQaXJAul R0kZK7WWLPJyEk2woSykcPzfEhCJPwquT7yH9rHyzVZ+UixZI20kIDBPaMfFXW+AAoJj C4n2owXiL23wUktPomH3FzYncg/zAunIxXAYRny+e7PM+irBvpPUk0J0bls5rQnf067G yW/A== X-Gm-Message-State: AIVw1125b420sadJ1LomkOT4xypJhMwD/lEYwtSMGo4VnP4O1Qs37/Fn 0y1Z3IBg5GtgyGEf48pW+WHBwuy/sH/y X-Received: by 10.55.72.1 with SMTP id v1mr1298151qka.103.1499903329238; Wed, 12 Jul 2017 16:48:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.92.142 with HTTP; Wed, 12 Jul 2017 16:48:48 -0700 (PDT) In-Reply-To: <201707121735.v6CHZWNY091333@repo.freebsd.org> References: <201707121735.v6CHZWNY091333@repo.freebsd.org> From: Ngie Cooper Date: Wed, 12 Jul 2017 16:48:48 -0700 Message-ID: Subject: Re: svn commit: r320916 - head/sys/dev/ixgbe To: Sean Bruno Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 23:48:50 -0000 On Wed, Jul 12, 2017 at 10:35 AM, Sean Bruno wrote: > Author: sbruno > Date: Wed Jul 12 17:35:32 2017 > New Revision: 320916 > URL: https://svnweb.freebsd.org/changeset/base/320916 > > Log: > Reset unsupported SFP tuneable back to original entry name. > > Reported by: olivier@ The new name kinda makes more sense -- why not keep it and make a backwards compatible OID for the old name? Thanks, -Ngie From owner-svn-src-head@freebsd.org Thu Jul 13 00:11:03 2017 Return-Path: Delivered-To: svn-src-head@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 58D20DA8C70; Thu, 13 Jul 2017 00:11:03 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com [IPv6:2a00:1450:400c:c0c::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E254E7DBC5; Thu, 13 Jul 2017 00:11:02 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-wr0-x233.google.com with SMTP id c11so45234925wrc.3; Wed, 12 Jul 2017 17:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Vt5lvUGPqJhQn6UdSibP/Mu7tXjOdrnTkcJf05Ac51A=; b=hoS8M2e3RPhx/sw0Sa/gaXt5yBcdzYpElbBQz43jelX4iVMPtIja38fHWjifk056pR c59yiggKdHUStA0wLjYKRUw3+rtDSs6WB3+gWGiEXiV+zJixFXY264N7SZY9/P1NYgL5 YfsUyISoqfwEuUCTnywdIo9vysTG1VZ0vkFM3TMBt380g5m96yXe9WiXhqiaM9Dx2l34 K80jOuMlYWcl84cnkHsGKqid6dzmvYA6srq18PwebP1IfWGzL4JJVZxYwhl61Njbp0wC zBHLeJT3oMAzQLlfkz1DLvBtO4KP38iokVqQWtOQdfRLEEGYatrcJqDWmCSwqyFFrCav pLDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Vt5lvUGPqJhQn6UdSibP/Mu7tXjOdrnTkcJf05Ac51A=; b=ZeFRgWVzQEXcxkSq5+FsAFh77X0d5yKisbPkr3dcpfbAiytMzBZ974MWiCZ1JC3j+f qskG3SEuF4OLhMksb0XTlVWu2AgqlgCYGJIh097Rbxpjw/5XsDHRa+toWvD8ORhyidmI Zuv721vda75k1zOFj+Z7JxEnAwH1xlWEjHUJYRja6xzsjAHQ3kiKBt7stQ7iLOuYN/WT FaQ4GgIqHHznP4NLOTttBWd+H53dBM6hRdTg9JQcdSYd4uLxcSCw8RqqjzLiZyWtmcCj 13+3r8Jsf9f39dhXzdk3IhrQSP7oP5I24D0QiewYhzvbEHbC9YxjVJxdFWBw6UhhTMkR M6Rg== X-Gm-Message-State: AIVw113XxR+WVZaXyCHGyleU2pvIW3BAByyKemzEXNEIdFSzcELT9edn X9I08gwm/38L/VRpuOmPuez9QGHB+Q1wtzw= X-Received: by 10.223.129.163 with SMTP id 32mr574995wra.185.1499904660743; Wed, 12 Jul 2017 17:11:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.161.81 with HTTP; Wed, 12 Jul 2017 17:11:00 -0700 (PDT) In-Reply-To: <25032740.sJOsNDzvpa@ralph.baldwin.cx> References: <201707120730.v6C7UExf041447@repo.freebsd.org> <20170712074326.GA41347@vlakno.cz> <25032740.sJOsNDzvpa@ralph.baldwin.cx> From: Ryan Libby Date: Wed, 12 Jul 2017 17:11:00 -0700 Message-ID: Subject: Re: svn commit: r320908 - head/sys/kern To: John Baldwin Cc: Roman Divacky , Ryan Libby , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 00:11:03 -0000 On Wed, Jul 12, 2017 at 3:20 PM, John Baldwin wrote: > On Wednesday, July 12, 2017 01:09:39 AM Ryan Libby wrote: >> On Wed, Jul 12, 2017 at 12:43 AM, Roman Divacky wrote: >> > Clang knows about %b modifier and can do some semantic analysis on it. >> > Currently it type checks the first arg to be an int and the second to be >> > a char*. >> > >> > Do you think it would be worth modifying the checks to include >> > this new functionality? Do you think you would like to take a stab >> > at it? >> >> Yes, I plan to send that to clang upstream. I originally had those >> changes in this commit but I was directed rather to send them first to >> upstream. See here [1] for roughly what I plan to send upstream >> (although I have since noticed some unit tests that I guess should be >> extended). >> >> For now, the semantic analysis should be fine as the change should be >> backward compatible and I haven't yet changed any of the users of >> %b to use the new capabilities. > > There is also '%b' support in GCC via -fformat-extensions. GCC 4.2.1 > probably matters less, but the external GCC toolchain ports use a patch in > /usr/ports/devel/powerpc64-gcc/files/freebsd-format-extensions that you may > need to adjust as well. Thanks. I knew about the in-tree gcc format extensions, but hadn't considered ports. I'll follow up with this in a little bit. I currently have a few other patches in gestation working through some bitrot with gcc amd64 kernel builds. From owner-svn-src-head@freebsd.org Thu Jul 13 00:28:38 2017 Return-Path: Delivered-To: svn-src-head@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 47BC1DA9376; Thu, 13 Jul 2017 00:28:38 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1EA3E7E9B9; Thu, 13 Jul 2017 00:28:38 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D0Sb6E063428; Thu, 13 Jul 2017 00:28:37 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D0Sad1063422; Thu, 13 Jul 2017 00:28:36 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201707130028.v6D0Sad1063422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 13 Jul 2017 00:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320927 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test usr.bin/bsdcat usr.bin/cpio usr.bin/tar X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test usr.bin/bsdcat usr.bin/cpio usr.bin/tar X-SVN-Commit-Revision: 320927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 00:28:38 -0000 Author: mm Date: Thu Jul 13 00:28:36 2017 New Revision: 320927 URL: https://svnweb.freebsd.org/changeset/base/320927 Log: MFV r320924: Bump libarchive to 3.3.2 Vendor changes: PR #901: don't depend on stdin in a testcase MFC after: 1 week Modified: head/contrib/libarchive/NEWS head/contrib/libarchive/libarchive/archive.h head/contrib/libarchive/libarchive/test/test_archive_read_close_twice_open_filename.c head/usr.bin/bsdcat/Makefile head/usr.bin/cpio/Makefile head/usr.bin/tar/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/NEWS ============================================================================== --- head/contrib/libarchive/NEWS Thu Jul 13 00:20:37 2017 (r320926) +++ head/contrib/libarchive/NEWS Thu Jul 13 00:28:36 2017 (r320927) @@ -1,3 +1,5 @@ +Jul 09, 2017: libarchive 3.3.2 released + Mar 16, 2017: NFSv4 ACL support for Linux (librichacl) Feb 26, 2017: libarchive 3.3.1 released Modified: head/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Thu Jul 13 00:20:37 2017 (r320926) +++ head/contrib/libarchive/libarchive/archive.h Thu Jul 13 00:28:36 2017 (r320927) @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.3.1" +#define ARCHIVE_VERSION_ONLY_STRING "3.3.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: head/contrib/libarchive/libarchive/test/test_archive_read_close_twice_open_filename.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_archive_read_close_twice_open_filename.c Thu Jul 13 00:20:37 2017 (r320926) +++ head/contrib/libarchive/libarchive/test/test_archive_read_close_twice_open_filename.c Thu Jul 13 00:28:36 2017 (r320927) @@ -28,10 +28,12 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_archive_read_close_twice_open_filename) { + const char *filename = "empty.file"; struct archive* a = archive_read_new(); + assertMakeFile(filename, 0644, ""); assertEqualInt(ARCHIVE_OK, archive_read_support_format_empty(a)); - assertEqualInt(ARCHIVE_OK, archive_read_open_filename(a, 0, 0)); + assertEqualInt(ARCHIVE_OK, archive_read_open_filename(a, filename, 0)); assertEqualInt(0, archive_errno(a)); assertEqualString(NULL, archive_error_string(a)); Modified: head/usr.bin/bsdcat/Makefile ============================================================================== --- head/usr.bin/bsdcat/Makefile Thu Jul 13 00:20:37 2017 (r320926) +++ head/usr.bin/bsdcat/Makefile Thu Jul 13 00:28:36 2017 (r320927) @@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive _LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive PROG= bsdcat -BSDCAT_VERSION_STRING= 3.3.1 +BSDCAT_VERSION_STRING= 3.3.2 .PATH: ${_LIBARCHIVEDIR}/cat SRCS= bsdcat.c cmdline.c Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Thu Jul 13 00:20:37 2017 (r320926) +++ head/usr.bin/cpio/Makefile Thu Jul 13 00:28:36 2017 (r320927) @@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive _LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive PROG= bsdcpio -BSDCPIO_VERSION_STRING= 3.3.1 +BSDCPIO_VERSION_STRING= 3.3.2 .PATH: ${_LIBARCHIVEDIR}/cpio SRCS= cpio.c cmdline.c Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Thu Jul 13 00:20:37 2017 (r320926) +++ head/usr.bin/tar/Makefile Thu Jul 13 00:28:36 2017 (r320927) @@ -4,7 +4,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive PROG= bsdtar -BSDTAR_VERSION_STRING= 3.3.1 +BSDTAR_VERSION_STRING= 3.3.2 .PATH: ${_LIBARCHIVEDIR}/tar SRCS= bsdtar.c \ From owner-svn-src-head@freebsd.org Thu Jul 13 02:09:09 2017 Return-Path: Delivered-To: svn-src-head@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 9DFBADAAF10; Thu, 13 Jul 2017 02:09:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x236.google.com (mail-qt0-x236.google.com [IPv6:2607:f8b0:400d:c0d::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 57E4581231; Thu, 13 Jul 2017 02:09:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x236.google.com with SMTP id i2so27369356qta.3; Wed, 12 Jul 2017 19:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SFEvwxxtmoQC4Pk7PkFBqM1RPGVHAc2mytTvl8ydFdY=; b=jR0WUzpxYUs3DRN6AkFM/h3eW+WpVwdeUlsetBzm28V34y3rJUR1DlKKcLdSBPbI7k Mt8u0EQjxgszlgtabQEw7XlfWTiae6Nu+EzZZ3ej4ZpRUuuCa+rRsaMi6fs8BhYdA5Kr JaFJO8Y/GDszNmpfqwFa2hyb71qKGL/qJAGCbPY+Dccryfj9LYwN0MQlkcDIIhJOqorb hsKhnkmRtxB+dTfEZpivWtf1cMHh95z/zegoyLJl6p/xzIwB2I1ji6oIVPustJd6Dxw/ X+09SCsgPvpnYksTX3JSAeMR2lj7T5+ysQ5nRLqeuhHJDgp2jDWLgPGciFhMAQlJQtZv w92w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SFEvwxxtmoQC4Pk7PkFBqM1RPGVHAc2mytTvl8ydFdY=; b=hquPUEqgQSBY9ocreDNh8ek5b4cGZL3tEDTXPAHJkIESGfC82uy8lsDZSo7r69RDx6 3OH9/8o/q8HEtoOySpnR06NAC6mvzMVczk9NtJ8/ow17TVz//KYAGeBmu80NQ0YDULK+ tAO9wkK9I82cTTsGQOIW3oZViXNocI6l2I4H1wxyWW/4IhMpFbuT+m4drKc6LbnNRijy yubl6vOaE8Hk/ChKvULJ19eKJSQuOr3aiLA/TqnrIGCECt4UQr/J094W7rZFflJsROem uEHMUB2vJGCJnUWJ4IHw+XqnaoqjK3Y9sC6v9/2aIh0Ub8Rn3+djH70ckYu80dygJuzY VP1g== X-Gm-Message-State: AIVw110SE2dxTfaHJhOh7qxrRhiwdwYN8gRTgXwt2pa9lZMuFUPPmcum 8eaHRWz17rCaIa44hcBMm6G3GDhoilI8hIY= X-Received: by 10.237.58.167 with SMTP id o36mr1936801qte.128.1499911748067; Wed, 12 Jul 2017 19:09:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.92.142 with HTTP; Wed, 12 Jul 2017 19:09:07 -0700 (PDT) In-Reply-To: <201707130028.v6D0Sad1063422@repo.freebsd.org> References: <201707130028.v6D0Sad1063422@repo.freebsd.org> From: Ngie Cooper Date: Wed, 12 Jul 2017 19:09:07 -0700 Message-ID: Subject: Re: svn commit: r320927 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test usr.bin/bsdcat usr.bin/cpio usr.bin/tar To: Martin Matuska Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , "freebsd-testing@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 02:09:09 -0000 On Wed, Jul 12, 2017 at 5:28 PM, Martin Matuska wrote: > Author: mm > Date: Thu Jul 13 00:28:36 2017 > New Revision: 320927 > URL: https://svnweb.freebsd.org/changeset/base/320927 > > Log: > MFV r320924: > Bump libarchive to 3.3.2 > > Vendor changes: > PR #901: don't depend on stdin in a testcase > > MFC after: 1 week This commit broke the tests: https://ci.freebsd.org/job/FreeBSD-head-amd64-test/3457/testReport/junit/lib.libarchive/functional_test/test_archive_api_feature/ Thanks, -Ngie From owner-svn-src-head@freebsd.org Thu Jul 13 02:16:16 2017 Return-Path: Delivered-To: svn-src-head@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 81E98D9122D; Thu, 13 Jul 2017 02:16:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5C6762A5; Thu, 13 Jul 2017 02:16:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D2GFbS007689; Thu, 13 Jul 2017 02:16:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D2GFA3007687; Thu, 13 Jul 2017 02:16:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707130216.v6D2GFA3007687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 13 Jul 2017 02:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320928 - in head/sys: arm/freescale/imx dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/freescale/imx dev/usb/controller X-SVN-Commit-Revision: 320928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 02:16:16 -0000 Author: ian Date: Thu Jul 13 02:16:15 2017 New Revision: 320928 URL: https://svnweb.freebsd.org/changeset/base/320928 Log: Support the "disable-over-current" property for imx ehci controllers. It turns out that this is more than a power optization. The OTG port won't work on boards that have this property unless this setting is honored. Also ensure that the usb phy device attaches before ehci. Modified: head/sys/arm/freescale/imx/imx6_usbphy.c head/sys/dev/usb/controller/ehci_imx.c Modified: head/sys/arm/freescale/imx/imx6_usbphy.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_usbphy.c Thu Jul 13 00:28:36 2017 (r320927) +++ head/sys/arm/freescale/imx/imx6_usbphy.c Thu Jul 13 02:16:15 2017 (r320928) @@ -198,5 +198,11 @@ static driver_t usbphy_driver = { static devclass_t usbphy_devclass; -DRIVER_MODULE(usbphy, simplebus, usbphy_driver, usbphy_devclass, 0, 0); +/* + * This driver needs to start before the ehci driver, but later than the usual + * "special" drivers like clocks and cpu. Ehci starts at DEFAULT so + * DEFAULT-1000 seems good. + */ +EARLY_DRIVER_MODULE(usbphy, simplebus, usbphy_driver, usbphy_devclass, 0, 0, + BUS_PASS_DEFAULT - 1000); Modified: head/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_imx.c Thu Jul 13 00:28:36 2017 (r320927) +++ head/sys/dev/usb/controller/ehci_imx.c Thu Jul 13 02:16:15 2017 (r320928) @@ -83,12 +83,11 @@ __FBSDID("$FreeBSD$"); * data, this means that the resources (memory-mapped register range) for the * non-core registers belongs to a device other than the echi devices. * - * At the moment we have no need to access the non-core registers, so all of - * this amounts to documenting what's known. The following compat strings have - * been seen in existing FDT data: - * - "fsl,imx25-usbmisc" - * - "fsl,imx51-usbmisc"; - * - "fsl,imx6q-usbmisc"; + * Because the main ehci device cannot access registers in a range that's + * defined in the fdt data as belonging to another device, we implement a teeny + * little "usbmisc" driver which exists only to provide access to the usbmisc + * control register for each of the 4 usb controller instances. That little + * driver is implemented here in this file, before the main driver. * * In addition to the single usbmisc device, the existing FDT data defines a * separate device for each of the OTG or EHCI cores within the USBOH3. Each of @@ -133,18 +132,127 @@ __FBSDID("$FreeBSD$"); * */ -static struct ofw_compat_data compat_data[] = { - {"fsl,imx6q-usb", 1}, - {"fsl,imx53-usb", 1}, - {"fsl,imx51-usb", 1}, - {"fsl,imx28-usb", 1}, - {"fsl,imx27-usb", 1}, - {"fsl,imx25-usb", 1}, - {"fsl,imx23-usb", 1}, - {NULL, 0}, +/*----------------------------------------------------------------------------- + * imx_usbmisc driver + *---------------------------------------------------------------------------*/ + +#define USBNC_OVER_CUR_POL (1u << 8) +#define USBNC_OVER_CUR_DIS (1u << 7) + +struct imx_usbmisc_softc { + device_t dev; + struct resource *mmio; }; +static struct ofw_compat_data usbmisc_compat_data[] = { + {"fsl,imx6q-usbmisc", true}, + {"fsl,imx51-usbmisc", true}, + {"fsl,imx25-usbmisc", true}, + {NULL, false}, +}; + +static void +imx_usbmisc_set_ctrl(device_t dev, u_int index, uint32_t bits) +{ + struct imx_usbmisc_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + reg = bus_read_4(sc->mmio, index * sizeof(uint32_t)); + bus_write_4(sc->mmio, index * sizeof(uint32_t), reg | bits); +} + +static void +imx_usbmisc_clr_ctrl(device_t dev, u_int index, uint32_t bits) +{ + struct imx_usbmisc_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + reg = bus_read_4(sc->mmio, index * sizeof(uint32_t)); + bus_write_4(sc->mmio, index * sizeof(uint32_t), reg & ~bits); +} + +static int +imx_usbmisc_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, usbmisc_compat_data)->ocd_data) { + device_set_desc(dev, "i.MX USB Misc Control"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} + +static int +imx_usbmisc_detach(device_t dev) +{ + struct imx_usbmisc_softc *sc; + + sc = device_get_softc(dev); + + if (sc->mmio != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mmio); + + return (0); +} + +static int +imx_usbmisc_attach(device_t dev) +{ + struct imx_usbmisc_softc *sc; + int err, rid; + + sc = device_get_softc(dev); + err = 0; + + /* Allocate bus_space resources. */ + rid = 0; + sc->mmio = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mmio == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + return (ENXIO); + } + + OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); + + return (0); +} + +static device_method_t imx_usbmisc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, imx_usbmisc_probe), + DEVMETHOD(device_attach, imx_usbmisc_attach), + DEVMETHOD(device_detach, imx_usbmisc_detach), + + DEVMETHOD_END +}; + +static driver_t imx_usbmisc_driver = { + "imx_usbmisc", + imx_usbmisc_methods, + sizeof(struct imx_usbmisc_softc) +}; + +static devclass_t imx_usbmisc_devclass; + /* + * This driver needs to start before the ehci driver, but later than the usual + * "special" drivers like clocks and cpu. Ehci starts at DEFAULT so + * DEFAULT-1000 seems good. + */ +EARLY_DRIVER_MODULE(imx_usbmisc, simplebus, imx_usbmisc_driver, + imx_usbmisc_devclass, 0, 0, BUS_PASS_DEFAULT - 1000); + +/*----------------------------------------------------------------------------- + * imx_ehci driver... + *---------------------------------------------------------------------------*/ + +/* * Each EHCI device in the SoC has some SoC-specific per-device registers at an * offset of 0, then the standard EHCI registers begin at an offset of 0x100. */ @@ -153,10 +261,22 @@ static struct ofw_compat_data compat_data[] = { struct imx_ehci_softc { ehci_softc_t ehci_softc; + device_t dev; struct resource *ehci_mem_res; /* EHCI core regs. */ struct resource *ehci_irq_res; /* EHCI core IRQ. */ }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-usb", 1}, + {"fsl,imx53-usb", 1}, + {"fsl,imx51-usb", 1}, + {"fsl,imx28-usb", 1}, + {"fsl,imx27-usb", 1}, + {"fsl,imx25-usb", 1}, + {"fsl,imx23-usb", 1}, + {NULL, 0}, +}; + static void imx_ehci_post_reset(struct ehci_softc *ehci_softc) { @@ -215,6 +335,36 @@ imx_ehci_detach(device_t dev) return (0); } +static void +imx_ehci_disable_oc(struct imx_ehci_softc *sc) +{ + device_t usbmdev; + pcell_t usbmprops[2]; + phandle_t node; + ssize_t size; + int index; + + /* Get the reference to the usbmisc driver from the fdt data */ + node = ofw_bus_get_node(sc->dev); + size = OF_getencprop(node, "fsl,usbmisc", usbmprops, + sizeof(usbmprops)); + if (size < sizeof(usbmprops)) { + device_printf(sc->dev, "failed to retrieve fsl,usbmisc " + "property, cannot disable overcurrent protection"); + return; + } + /* Retrieve the device_t via the xref handle. */ + usbmdev = OF_device_from_xref(usbmprops[0]); + if (usbmdev == NULL) { + device_printf(sc->dev, "usbmisc device not found, " + "cannot disable overcurrent protection"); + return; + } + /* Call the device routine to set the overcurrent disable bit. */ + index = usbmprops[1]; + imx_usbmisc_set_ctrl(usbmdev, index, USBNC_OVER_CUR_DIS); +} + static int imx_ehci_attach(device_t dev) { @@ -223,6 +373,7 @@ imx_ehci_attach(device_t dev) int err, rid; sc = device_get_softc(dev); + sc->dev = dev; esc = &sc->ehci_softc; err = 0; @@ -282,6 +433,10 @@ imx_ehci_attach(device_t dev) /* Turn on clocks. */ imx_ccm_usb_enable(dev); + + /* Disable overcurrent detection, if configured to do so. */ + if (OF_hasprop(ofw_bus_get_node(sc->dev), "disable-over-current")) + imx_ehci_disable_oc(sc); /* Add USB bus device. */ esc->sc_bus.bdev = device_add_child(dev, "usbus", -1); From owner-svn-src-head@freebsd.org Thu Jul 13 02:20:08 2017 Return-Path: Delivered-To: svn-src-head@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 A627CD9144E; Thu, 13 Jul 2017 02:20:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6E935775; Thu, 13 Jul 2017 02:20:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D2K75b007869; Thu, 13 Jul 2017 02:20:07 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D2K7IV007868; Thu, 13 Jul 2017 02:20:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707130220.v6D2K7IV007868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 13 Jul 2017 02:20:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320929 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 320929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 02:20:08 -0000 Author: ian Date: Thu Jul 13 02:20:07 2017 New Revision: 320929 URL: https://svnweb.freebsd.org/changeset/base/320929 Log: Put an #ifdef notyet wrapper around a function that's not being used yet, to avoid compile warnings. Modified: head/sys/dev/usb/controller/ehci_imx.c Modified: head/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_imx.c Thu Jul 13 02:16:15 2017 (r320928) +++ head/sys/dev/usb/controller/ehci_imx.c Thu Jul 13 02:20:07 2017 (r320929) @@ -162,6 +162,7 @@ imx_usbmisc_set_ctrl(device_t dev, u_int index, uint32 bus_write_4(sc->mmio, index * sizeof(uint32_t), reg | bits); } +#ifdef notyet static void imx_usbmisc_clr_ctrl(device_t dev, u_int index, uint32_t bits) { @@ -172,6 +173,7 @@ imx_usbmisc_clr_ctrl(device_t dev, u_int index, uint32 reg = bus_read_4(sc->mmio, index * sizeof(uint32_t)); bus_write_4(sc->mmio, index * sizeof(uint32_t), reg & ~bits); } +#endif static int imx_usbmisc_probe(device_t dev) From owner-svn-src-head@freebsd.org Thu Jul 13 03:52:58 2017 Return-Path: Delivered-To: svn-src-head@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 8BE99D93A50; Thu, 13 Jul 2017 03:52:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 543243820; Thu, 13 Jul 2017 03:52:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D3qvBF049089; Thu, 13 Jul 2017 03:52:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D3qsXX049061; Thu, 13 Jul 2017 03:52:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201707130352.v6D3qsXX049061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 13 Jul 2017 03:52:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320930 - in head: etc/mtree usr.bin/hexdump usr.bin/hexdump/tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: etc/mtree usr.bin/hexdump usr.bin/hexdump/tests X-SVN-Commit-Revision: 320930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 03:52:58 -0000 Author: kevans Date: Thu Jul 13 03:52:54 2017 New Revision: 320930 URL: https://svnweb.freebsd.org/changeset/base/320930 Log: Add some basic tests for hexdump(1)'s various output flags. Formatting tests are omitted for this initial run as there are still some bugs to work out there. This covers -s flag testing on devices and non-devices that would have caught breakage found in PR 219173 as well as other subtle breakage caused locally. Reviewed by: cem, ngie Approved by: cem (acting co-mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11279 Added: head/usr.bin/hexdump/tests/ head/usr.bin/hexdump/tests/Makefile (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_UCflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_UCflag_b.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_UCflag_c.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_a.in (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_b.in (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_bflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_bflag_b.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_bflag_c.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_c.in (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_cflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_cflag_b.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_cflag_c.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_nflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_sflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out (contents, props changed) head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out (contents, props changed) head/usr.bin/hexdump/tests/hexdump_test.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/hexdump/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Jul 13 02:20:07 2017 (r320929) +++ head/etc/mtree/BSD.tests.dist Thu Jul 13 03:52:54 2017 (r320930) @@ -644,6 +644,8 @@ .. gzip .. + hexdump + .. ident .. indent Modified: head/usr.bin/hexdump/Makefile ============================================================================== --- head/usr.bin/hexdump/Makefile Thu Jul 13 02:20:07 2017 (r320929) +++ head/usr.bin/hexdump/Makefile Thu Jul 13 03:52:54 2017 (r320930) @@ -1,11 +1,17 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= hexdump SRCS= conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c MAN= hexdump.1 od.1 MLINKS= hexdump.1 hd.1 LINKS= ${BINDIR}/hexdump ${BINDIR}/od LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Added: head/usr.bin/hexdump/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/Makefile Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,31 @@ +# $FreeBSD$ + +PACKAGE= tests + +ATF_TESTS_SH= hexdump_test + +${PACKAGE}FILES+= d_hexdump_a.in +${PACKAGE}FILES+= d_hexdump_b.in +${PACKAGE}FILES+= d_hexdump_c.in +${PACKAGE}FILES+= d_hexdump_bflag_a.out +${PACKAGE}FILES+= d_hexdump_bflag_b.out +${PACKAGE}FILES+= d_hexdump_bflag_c.out +${PACKAGE}FILES+= d_hexdump_cflag_a.out +${PACKAGE}FILES+= d_hexdump_cflag_b.out +${PACKAGE}FILES+= d_hexdump_cflag_c.out +${PACKAGE}FILES+= d_hexdump_dflag_a.out +${PACKAGE}FILES+= d_hexdump_dflag_b.out +${PACKAGE}FILES+= d_hexdump_dflag_c.out +${PACKAGE}FILES+= d_hexdump_nflag_a.out +${PACKAGE}FILES+= d_hexdump_oflag_a.out +${PACKAGE}FILES+= d_hexdump_oflag_b.out +${PACKAGE}FILES+= d_hexdump_oflag_c.out +${PACKAGE}FILES+= d_hexdump_sflag_a.out +${PACKAGE}FILES+= d_hexdump_UCflag_a.out +${PACKAGE}FILES+= d_hexdump_UCflag_b.out +${PACKAGE}FILES+= d_hexdump_UCflag_c.out +${PACKAGE}FILES+= d_hexdump_xflag_a.out +${PACKAGE}FILES+= d_hexdump_xflag_b.out +${PACKAGE}FILES+= d_hexdump_xflag_c.out + +.include Added: head/usr.bin/hexdump/tests/d_hexdump_UCflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_UCflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +00000000 54 65 73 74 0a |Test.| +00000005 Added: head/usr.bin/hexdump/tests/d_hexdump_UCflag_b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_UCflag_b.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +00000000 54 68 65 20 71 75 69 63 6b 20 62 72 6f 77 6e 20 |The quick brown | +00000010 66 6f 78 20 6a 75 6d 70 65 64 20 6f 76 65 72 20 |fox jumped over | +00000020 74 68 65 20 62 6c 75 65 20 68 6f 75 73 65 0a 0a |the blue house..| +00000030 Added: head/usr.bin/hexdump/tests/d_hexdump_UCflag_c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_UCflag_c.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +00000000 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAAAAAAAA| +* +00000020 41 41 41 41 41 41 41 0a |AAAAAAA.| +00000028 Added: head/usr.bin/hexdump/tests/d_hexdump_a.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_a.in Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1 @@ +Test Added: head/usr.bin/hexdump/tests/d_hexdump_b.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_b.in Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +The quick brown fox jumped over the blue house + Added: head/usr.bin/hexdump/tests/d_hexdump_bflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_bflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +0000000 124 145 163 164 012 +0000005 Added: head/usr.bin/hexdump/tests/d_hexdump_bflag_b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_bflag_b.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 124 150 145 040 161 165 151 143 153 040 142 162 157 167 156 040 +0000010 146 157 170 040 152 165 155 160 145 144 040 157 166 145 162 040 +0000020 164 150 145 040 142 154 165 145 040 150 157 165 163 145 012 012 +0000030 Added: head/usr.bin/hexdump/tests/d_hexdump_bflag_c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_bflag_c.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 +* +0000020 101 101 101 101 101 101 101 012 +0000028 Added: head/usr.bin/hexdump/tests/d_hexdump_c.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_c.in Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1 @@ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Added: head/usr.bin/hexdump/tests/d_hexdump_cflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_cflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +0000000 T e s t \n +0000005 Added: head/usr.bin/hexdump/tests/d_hexdump_cflag_b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_cflag_b.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 T h e q u i c k b r o w n +0000010 f o x j u m p e d o v e r +0000020 t h e b l u e h o u s e \n \n +0000030 Added: head/usr.bin/hexdump/tests/d_hexdump_cflag_c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_cflag_c.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 A A A A A A A A A A A A A A A A +* +0000020 A A A A A A A \n +0000028 Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +0000000 25940 29811 00010 +0000005 Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 26708 08293 30065 25449 08299 29282 30575 08302 +0000010 28518 08312 30058 28781 25701 28448 25974 08306 +0000020 26740 08293 27746 25973 26656 30063 25971 02570 +0000030 Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 16705 16705 16705 16705 16705 16705 16705 16705 +* +0000020 16705 16705 16705 02625 +0000028 Added: head/usr.bin/hexdump/tests/d_hexdump_nflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_nflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +0000000 124 +0000001 Added: head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +0000000 062524 072163 000012 +0000005 Added: head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 064124 020145 072561 061551 020153 071142 073557 020156 +0000010 067546 020170 072552 070155 062145 067440 062566 020162 +0000020 064164 020145 066142 062565 064040 072557 062563 005012 +0000030 Added: head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 040501 040501 040501 040501 040501 040501 040501 040501 +* +0000020 040501 040501 040501 005101 +0000028 Added: head/usr.bin/hexdump/tests/d_hexdump_sflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_sflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +0000004 012 +0000005 Added: head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,2 @@ +0000000 6554 7473 000a +0000005 Added: head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 6854 2065 7571 6369 206b 7262 776f 206e +0000010 6f66 2078 756a 706d 6465 6f20 6576 2072 +0000020 6874 2065 6c62 6575 6820 756f 6573 0a0a +0000030 Added: head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,4 @@ +0000000 4141 4141 4141 4141 4141 4141 4141 4141 +* +0000020 4141 4141 4141 0a41 +0000028 Added: head/usr.bin/hexdump/tests/hexdump_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/hexdump/tests/hexdump_test.sh Thu Jul 13 03:52:54 2017 (r320930) @@ -0,0 +1,192 @@ +# +# Copyright (c) 2017 Kyle Evans +# 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. +# +# $FreeBSD$ + +atf_test_case b_flag +b_flag_head() +{ + atf_set "descr" "Verify -b output" +} +b_flag_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_bflag_a.out" \ + hexdump -b "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_bflag_b.out" \ + hexdump -b "$(atf_get_srcdir)/d_hexdump_b.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_bflag_c.out" \ + hexdump -b "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_test_case c_flag +c_flag_head() +{ + atf_set "descr" "Verify -c output" +} +c_flag_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_cflag_a.out" \ + hexdump -c "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_cflag_b.out" \ + hexdump -c "$(atf_get_srcdir)/d_hexdump_b.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_cflag_c.out" \ + hexdump -c "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_test_case C_flag +C_flag_head() +{ + atf_set "descr" "Verify -C output" +} +C_flag_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_a.out" \ + hexdump -C "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_b.out" \ + hexdump -C "$(atf_get_srcdir)/d_hexdump_b.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_c.out" \ + hexdump -C "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_test_case hd_name +hd_name_head() +{ + atf_set "descr" "Verify hd output matching -C output" +} +hd_name_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_a.out" \ + hd "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_b.out" \ + hd "$(atf_get_srcdir)/d_hexdump_b.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_c.out" \ + hd "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_test_case d_flag +d_flag_head() +{ + atf_set "descr" "Verify -d output" +} +d_flag_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_a.out" \ + hexdump -d "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_b.out" \ + hexdump -d "$(atf_get_srcdir)/d_hexdump_b.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_c.out" \ + hexdump -d "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_test_case n_flag +n_flag_head() +{ + atf_set "descr" "Check -n functionality" +} +n_flag_body() +{ + atf_check -o empty hexdump -bn 0 "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_nflag_a.out" \ + hexdump -bn 1 "$(atf_get_srcdir)/d_hexdump_a.in" +} + +atf_test_case o_flag +o_flag_head() +{ + atf_set "descr" "Verify -o output" +} +o_flag_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_a.out" \ + hexdump -o "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_b.out" \ + hexdump -o "$(atf_get_srcdir)/d_hexdump_b.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_c.out" \ + hexdump -o "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_test_case s_flag +s_flag_head() +{ + atf_set "descr" "Verify -s output" +} +s_flag_body() +{ + atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_sflag_a.out" \ + hexdump -bs 4 "$(atf_get_srcdir)/d_hexdump_a.in" + + atf_check -o not-empty hexdump -n 100 -s 1024 /dev/random +} + +atf_test_case v_flag +v_flag_head() +{ + atf_set "descr" "Verify -v functionality" +} +v_flag_body() +{ + atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)" + for i in $(seq 0 7); do + atf_check -o match:"^\*$" \ + hexdump -s ${i} "$(atf_get_srcdir)/d_hexdump_c.in" + atf_check -o not-match:"^\*$" \ + hexdump -vs ${i} "$(atf_get_srcdir)/d_hexdump_c.in" + done + + atf_check -o not-match:"^\*$" \ + hexdump -s 8 "$(atf_get_srcdir)/d_hexdump_c.in" + atf_check -o not-match:"^\*$" \ + hexdump -vs 8 "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_test_case x_flag +x_flag_head() +{ + atf_set "descr" "Verify -x output" +} +x_flag_body() +{ + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_a.out" \ + hexdump -x "$(atf_get_srcdir)/d_hexdump_a.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_b.out" \ + hexdump -x "$(atf_get_srcdir)/d_hexdump_b.in" + atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_c.out" \ + hexdump -x "$(atf_get_srcdir)/d_hexdump_c.in" +} + +atf_init_test_cases() +{ + atf_add_test_case b_flag + atf_add_test_case c_flag + atf_add_test_case C_flag + atf_add_test_case hd_name + atf_add_test_case d_flag + atf_add_test_case n_flag + atf_add_test_case o_flag + atf_add_test_case s_flag + atf_add_test_case v_flag + atf_add_test_case x_flag +} From owner-svn-src-head@freebsd.org Thu Jul 13 04:42:30 2017 Return-Path: Delivered-To: svn-src-head@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 CCA76D949F1; Thu, 13 Jul 2017 04:42:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9910164B1E; Thu, 13 Jul 2017 04:42:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D4gT5Y069333; Thu, 13 Jul 2017 04:42:29 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D4gTw2069332; Thu, 13 Jul 2017 04:42:29 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201707130442.v6D4gTw2069332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 13 Jul 2017 04:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320931 - head/contrib/libarchive/libarchive X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: head/contrib/libarchive/libarchive X-SVN-Commit-Revision: 320931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 04:42:30 -0000 Author: mm Date: Thu Jul 13 04:42:29 2017 New Revision: 320931 URL: https://svnweb.freebsd.org/changeset/base/320931 Log: Fix libarchive mismerge of r320927 MFC after: 1 week X-MFC-with: 320927 Reported by: Ngie Cooper Modified: head/contrib/libarchive/libarchive/archive.h Modified: head/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Thu Jul 13 03:52:54 2017 (r320930) +++ head/contrib/libarchive/libarchive/archive.h Thu Jul 13 04:42:29 2017 (r320931) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3003001 +#define ARCHIVE_VERSION_NUMBER 3003002 #include #include /* for wchar_t */ From owner-svn-src-head@freebsd.org Thu Jul 13 04:46:01 2017 Return-Path: Delivered-To: svn-src-head@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 581A9D94AF6; Thu, 13 Jul 2017 04:46:01 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 21C9164CA3; Thu, 13 Jul 2017 04:46:01 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D4k0ph069540; Thu, 13 Jul 2017 04:46:00 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D4k0vF069539; Thu, 13 Jul 2017 04:46:00 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201707130446.v6D4k0vF069539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 13 Jul 2017 04:46:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320932 - head/contrib/libarchive/libarchive X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: head/contrib/libarchive/libarchive X-SVN-Commit-Revision: 320932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 04:46:01 -0000 Author: mm Date: Thu Jul 13 04:46:00 2017 New Revision: 320932 URL: https://svnweb.freebsd.org/changeset/base/320932 Log: Fix libarchive mismerge of r320927 in libarchive_entry.h MFC after: 1 week X-MFC-with: 320927 Reported by: Ngie Cooper Modified: head/contrib/libarchive/libarchive/archive_entry.h Modified: head/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Thu Jul 13 04:42:29 2017 (r320931) +++ head/contrib/libarchive/libarchive/archive_entry.h Thu Jul 13 04:46:00 2017 (r320932) @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3003001 +#define ARCHIVE_VERSION_NUMBER 3003002 /* * Note: archive_entry.h is for use outside of libarchive; the From owner-svn-src-head@freebsd.org Thu Jul 13 08:19:51 2017 Return-Path: Delivered-To: svn-src-head@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 E530ED9B43C; Thu, 13 Jul 2017 08:19:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B05BF6E3F7; Thu, 13 Jul 2017 08:19:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D8JoVP055516; Thu, 13 Jul 2017 08:19:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D8JoJJ055515; Thu, 13 Jul 2017 08:19:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707130819.v6D8JoJJ055515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 13 Jul 2017 08:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320936 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 320936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 08:19:52 -0000 Author: kib Date: Thu Jul 13 08:19:50 2017 New Revision: 320936 URL: https://svnweb.freebsd.org/changeset/base/320936 Log: It is believed to be only cosmetic. Noted by: andrew Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/efirt.c Modified: head/sys/amd64/amd64/efirt.c ============================================================================== --- head/sys/amd64/amd64/efirt.c Thu Jul 13 08:13:29 2017 (r320935) +++ head/sys/amd64/amd64/efirt.c Thu Jul 13 08:19:50 2017 (r320936) @@ -194,8 +194,8 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int uint64_t idx; int bits, i, mode; - obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, 1 + NPML4EPG + - NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG, + obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, ptoa(1 + + NPML4EPG + NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG), VM_PROT_ALL, 0, NULL); VM_OBJECT_WLOCK(obj_1t1_pt); efi_pml4_page = efi_1t1_page(0); From owner-svn-src-head@freebsd.org Thu Jul 13 08:23:13 2017 Return-Path: Delivered-To: svn-src-head@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 534F6D9B6F6; Thu, 13 Jul 2017 08:23:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 228856E8A9; Thu, 13 Jul 2017 08:23:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D8NCBF059461; Thu, 13 Jul 2017 08:23:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D8NCYI059460; Thu, 13 Jul 2017 08:23:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707130823.v6D8NCYI059460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 13 Jul 2017 08:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320937 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 320937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 08:23:13 -0000 Author: kib Date: Thu Jul 13 08:23:12 2017 New Revision: 320937 URL: https://svnweb.freebsd.org/changeset/base/320937 Log: Revert r320936 to recommit with the correct log message. Modified: head/sys/amd64/amd64/efirt.c Modified: head/sys/amd64/amd64/efirt.c ============================================================================== --- head/sys/amd64/amd64/efirt.c Thu Jul 13 08:19:50 2017 (r320936) +++ head/sys/amd64/amd64/efirt.c Thu Jul 13 08:23:12 2017 (r320937) @@ -194,8 +194,8 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int uint64_t idx; int bits, i, mode; - obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, ptoa(1 + - NPML4EPG + NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG), + obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, 1 + NPML4EPG + + NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG, VM_PROT_ALL, 0, NULL); VM_OBJECT_WLOCK(obj_1t1_pt); efi_pml4_page = efi_1t1_page(0); From owner-svn-src-head@freebsd.org Thu Jul 13 08:23:39 2017 Return-Path: Delivered-To: svn-src-head@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 1DA2CD9B779; Thu, 13 Jul 2017 08:23:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E15A06E9EE; Thu, 13 Jul 2017 08:23:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D8NcgF059517; Thu, 13 Jul 2017 08:23:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D8NcpB059516; Thu, 13 Jul 2017 08:23:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707130823.v6D8NcpB059516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 13 Jul 2017 08:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320938 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 320938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 08:23:39 -0000 Author: kib Date: Thu Jul 13 08:23:37 2017 New Revision: 320938 URL: https://svnweb.freebsd.org/changeset/base/320938 Log: Fix size argument to vm_pager_allocate(), it is in bytes, not in pages. It is believed to be only cosmetic. Noted by: andrew Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/efirt.c Modified: head/sys/amd64/amd64/efirt.c ============================================================================== --- head/sys/amd64/amd64/efirt.c Thu Jul 13 08:23:12 2017 (r320937) +++ head/sys/amd64/amd64/efirt.c Thu Jul 13 08:23:37 2017 (r320938) @@ -194,8 +194,8 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int uint64_t idx; int bits, i, mode; - obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, 1 + NPML4EPG + - NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG, + obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, ptoa(1 + + NPML4EPG + NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG), VM_PROT_ALL, 0, NULL); VM_OBJECT_WLOCK(obj_1t1_pt); efi_pml4_page = efi_1t1_page(0); From owner-svn-src-head@freebsd.org Thu Jul 13 09:01:23 2017 Return-Path: Delivered-To: svn-src-head@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 452DAD9C5CF; Thu, 13 Jul 2017 09:01:23 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 12BEF6FD60; Thu, 13 Jul 2017 09:01:23 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D91MQ6072462; Thu, 13 Jul 2017 09:01:22 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D91MVI072461; Thu, 13 Jul 2017 09:01:22 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201707130901.v6D91MVI072461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Thu, 13 Jul 2017 09:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320941 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 320941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 09:01:23 -0000 Author: philip Date: Thu Jul 13 09:01:22 2017 New Revision: 320941 URL: https://svnweb.freebsd.org/changeset/base/320941 Log: Fix GRE over IPv6 tunnels with IPFW Previously, GRE packets in IPv6 tunnels would be dropped by IPFW (unless net.inet6.ip6.fw.deny_unknown_exthdrs was unset). PR: 220640 Submitted by: Kun Xie MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Thu Jul 13 08:33:02 2017 (r320940) +++ head/sys/netpfil/ipfw/ip_fw2.c Thu Jul 13 09:01:22 2017 (r320941) @@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include /* for struct grehdr */ + #include #include /* XXX for in_cksum */ @@ -1160,6 +1162,11 @@ do { \ case IPPROTO_PIM: /* XXX PIM header check? */ PULLUP_TO(hlen, ulp, struct pim); + break; + + case IPPROTO_GRE: /* RFC 1701 */ + /* XXX GRE header check? */ + PULLUP_TO(hlen, ulp, struct grehdr); break; case IPPROTO_CARP: From owner-svn-src-head@freebsd.org Thu Jul 13 10:42:39 2017 Return-Path: Delivered-To: svn-src-head@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 02576D9E709; Thu, 13 Jul 2017 10:42:39 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A135672A7B; Thu, 13 Jul 2017 10:42:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id D999D4278D6; Thu, 13 Jul 2017 20:11:18 +1000 (AEST) Date: Thu, 13 Jul 2017 20:11:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320900 - in head/sys: fs/cd9660 fs/ext2fs fs/fifofs fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs ufs/ufs In-Reply-To: <2198764.5xJVkxmjDt@ralph.baldwin.cx> Message-ID: <20170713173153.B1044@besplex.bde.org> References: <201707112155.v6BLtKbZ006618@repo.freebsd.org> <20170712184348.Q1271@besplex.bde.org> <2198764.5xJVkxmjDt@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=uZvujYp8AAAA:8 a=k9UK7QmCivZeMjNWNZcA:9 a=CjuIK1q_8ugA:10 a=HSkhpV6CZ5MA:10 a=SLzB8X_8jTLwj6mN0q5r:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 10:42:39 -0000 On Wed, 12 Jul 2017, John Baldwin wrote: > On Wednesday, July 12, 2017 08:08:42 PM Bruce Evans wrote: >> On Tue, 11 Jul 2017, John Baldwin wrote: >> >>> Log: >>> Consistently use vop_stdpathconf() for default pathconf values. >> ... >> This is sort of backwards. Not many settings are the same for most >> file systems, and many that did were wrong. Now more are wrong. >> >>> Modified: head/sys/fs/cd9660/cd9660_vnops.c >>> ... >>> - case _PC_PIPE_BUF: >>> - *ap->a_retval = PIPE_BUF; >>> - return (0); >> >> PIPE_BUF isn't system wide. cd9660 does support fifos, but setting it >> for files that aren't fifos or directories is bogus. POSIX allows such >> bogus settings, and needs complicated wording to describe this. E.g., >> PIPE_BUF for a directory is not completely bogus and it means that the >> value for the directory applies to all fifos in the directory and is >> ignored for all non-fifos in the directory. It is unclear if PIPE_BUF >> must be set for a directory if there is any fifo in the directory. >> FreeBSD's man pages give no details about this. > > PIPE_BUF is system wide because all FIFOs in FreeBSD are implemented via > a common fifo implementation that has a single size. The wording about > PIPE_BUF from > http://pubs.opengroup.org/onlinepubs/009695399/functions/fpathconf.html: > > If path refers to a FIFO, or fildes refers to a pipe or FIFO, the > value returned shall apply to the referenced object. If path or fildes > refers to a directory, the value returned shall apply to any FIFO that > exists or can be created within the directory. If path or fildes refers > to any other type of file, it is unspecified whether an implementation > supports an association of the variable name with the specified file. > > This leaves the value for non-directories and non-FIFOs undefined. We > could perhaps add more complexity to fail with EINVAL for types other > than VFIFO or VDIR, and filesystems that do not support FIFOs could > fail _PC_PIPE_BUF in their fs-specific vnop, but this would not be any > more correct as both behaviors fall into "undefined", but the current > one is simpler to implement. This is what I said was unclear. It is clear to standards lawyers but not even hinted at in FreeBSD man pages. >> This is system-wide. >> >>> case _PC_NO_TRUNC: >>> *ap->a_retval = 1; >>> return (0); There is another bug with this, and a similar, larger one with CHOWN_RESTRICTED, like the one for NAME_MAX. {NAME_MAX} is variable, so defining NAME_MAX is a bug and since it varies a lot defaulting _PC_NAME_MAX is worse than useless. Similarly for NO_TRUNC and CHOWN_RESTRICTED, except they are POSIX limits and always have prefixes and there are further bugs in the defaulting: - _POSIX_NO_TRUNC is defined as 1. This means that all file systems have it. But at least shortnames for msdosfs don't have it. As previously discussed, this is not defaulted, but it is better for defaulting than _PC_NAME_MAX since 1 is correct for most file systems. - _POSIX_CHOWN_RESTRICTED is defined as 1. This means that all file systems have it. Perhaps they are actually do. It is defaulted, but its default value is spelled 1 instead of _POSIX_CHOWN_RESTRICTED. >> - NAME_MAX. This is very far from system-wide >> - PATH_MAX. This is system-wide. >> - LINK_MAX. This is very far from system-wide, especially after expansion >> of nlink_t. Most file systems get this wrong. LINK_MAX is bogusly >> defined to be the constant 32767, but the value is very variable. >> zfs_pathconf() returns INT_MAX and zfs uses something like int32_t >> internally, but zfs_getattr() clamps to LINK_MAX. ext2fs limits to >> 32000 for ext2 and 65000 for ext4 internally but ext2_pathconf() >> only returns this limit in some cases -- other cases return INT_MAX. > > In theory if a filesystem supported an infinite link count or name count > it would have no filesystem-specific limit and having LINK_MAX and > NAME_MAX provide the system limits gives a reasonable default in that case. NAME_MAX is required to give the limit for all file systems if it is defined. _POSIX_NAME_MAX is what gives a "reasonable" default (it actually gives the minimum value for a "reasonable" {NAME_MAX}). For newer POSIX limits, a macro value of 0 means that the feature might be supported (and all its headers are present). So it wouldn't be such good style to use the macro value as the default -- pathconf() must give the runtime value which is rarely 0. We only use 0 for _POSIX_IPV6 and _POSIX_PRIORITY_SCHEDULING which are not under pathconf(). > I don't know if any filesystem supports infinite limits in practice, but > it's also true that the correct behavior in each filesystem would be to > return a value like MIN(fs_limit, system_limit), not just the native > filesystem limit. Perhaps this could be implemented by a post-processing > step for VOP_PATHCONF that truncates values that exceed system limits to > system limits. The file system should limit itself to the system limit. This already happens for {LINK_MAX}. zfs does this with bugs by not limiting the link count but reporting wrong link counts when the correct link count is not representable. pathconf() is limited to LONG_MAX, so there is always a system limit of LONG_MAX. nlink_t was recently bloated to uint64_t. UINT64_MAX is not representable by pathconf() even on 64-bit systems. >> This is easy to improve: >> - NAME_MAX, LINK_MAX: move to individual fs's > > That probably is true. In this case I was just trying to reduce overrides > to the ones that were really fs-specific. The existing places that used > NAME_MAX and LINK_MAX were also likely wrong as they did not return a > filesystem-specific value. > >> - MAX_CANON, MAX_INPUT, VDISABLE: move to devfs_pathconf(). > > That is probably fine as well as it is simple and doesn't add complexity. > >> - PIPE_BUF: move to fifo_pathconf()? What about directories? > > I think this one should be standard for the reasons I gave above. If > we really wanted to, we could make it conditional on the type (VFIFO and > VDIR) without adding a lot of complexity. Special files are also very easy to classify in vop_stdpathconf(). >>> Modified: head/sys/fs/fifofs/fifo_vnops.c >>> ... >>> -static int >>> -fifo_pathconf(ap) >>> - struct vop_pathconf_args /* { >>> - struct vnode *a_vp; >>> - int a_name; >>> - int *a_retval; >>> - } */ *ap; >>> -{ >>> - >>> - switch (ap->a_name) { >>> - case _PC_LINK_MAX: >>> - *ap->a_retval = LINK_MAX; >>> - return (0); >>> - case _PC_PIPE_BUF: >>> - *ap->a_retval = PIPE_BUF; >>> - return (0); >>> - case _PC_CHOWN_RESTRICTED: >>> - *ap->a_retval = 1; >>> - return (0); >>> - default: >>> - return (EINVAL); >>> - } >>> - /* NOTREACHED */ >>> } >> >> This was small and hopefully correct. Not many settings apply to fifos. >> It seems a but too small to be correct -- why would LINK_MAX apply but >> not PATH_MAX? Using the default, a pathconf which wants to set only 3 >> value would need about 15 cases to kill all the defaults. > > This was not really correct since at least NAME_MAX was missing, but it also > should never have been used as a full VOP. The parent filesystem in which the > FIFO resides dictates values like LINK_MAX and NAME_MAX. The only safe way to It is actually correct. Name limits are properties of directories (really file systems/mount points), and NAME_MAX and PATH_MAX are explicitly unspecified for non-directories (requirement 4). LINK_MAX and CHOWN_RESTRICTED are more properties of individual files. POSIX seems to be broken since it only requires something for them for directories (requirement 1 and 7). Requirement 4 about PIPE_BUF has the complications needed to not have this bug. >* ... >> I expect that some of the other defaulted limits will become more variable >> (so unsuitable as defaults). LINK_MAX is almost there. >> >>> @@ -2505,11 +2493,6 @@ ufs_pathconf(ap) >>> case _PC_MIN_HOLE_SIZE: >>> *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; >>> break; >>> - case _PC_ASYNC_IO: >>> - /* _PC_ASYNC_IO should have been handled by upper layers. */ >>> - KASSERT(0, ("_PC_ASYNC_IO should not get here")); >>> - error = EINVAL; >>> - break; >>> case _PC_PRIO_IO: >>> *ap->a_retval = 0; >>> break; >> >> But some of the newer limits like are in vfs so should have been defaulted? > > _PC_ASYNC_IO used to be explicitly handled in the pathconf system calls as a > special case. I had moved it to vop_stdpathconf() so that it was handled in > one place (rather than 3), but had missed these specific handlers in existing > pathconf VOPs. System-wide pathconf values should really be in one place in > vop_stdpathconf(). We might want to alter the list of things in > vop_stdpathconf(), but I think all filesystems should fall through to it > and only override values that are filesystem-specific. ufs, ext2fs and zfs have many newer POSIX limits. I think it is a bug for unistd.h to not define these as 0 (supported by headers and libraries but not by all file systems), but not many of these should be defaulted. Bruce From owner-svn-src-head@freebsd.org Thu Jul 13 13:32:24 2017 Return-Path: Delivered-To: svn-src-head@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 D432DDA2F95; Thu, 13 Jul 2017 13:32:24 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A1F5E78113; Thu, 13 Jul 2017 13:32:24 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DDWNW3085121; Thu, 13 Jul 2017 13:32:23 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DDWN7q085120; Thu, 13 Jul 2017 13:32:23 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707131332.v6DDWN7q085120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 13 Jul 2017 13:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320943 - head/etc/rc.d X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/etc/rc.d X-SVN-Commit-Revision: 320943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 13:32:24 -0000 Author: manu Date: Thu Jul 13 13:32:23 2017 New Revision: 320943 URL: https://svnweb.freebsd.org/changeset/base/320943 Log: Add ipfw_status command to etc/rc.d/ipfw This is helpful when using service/conf management tools. Sonsored-By: Gandi.net Modified: head/etc/rc.d/ipfw Modified: head/etc/rc.d/ipfw ============================================================================== --- head/etc/rc.d/ipfw Thu Jul 13 09:27:11 2017 (r320942) +++ head/etc/rc.d/ipfw Thu Jul 13 13:32:23 2017 (r320943) @@ -17,7 +17,9 @@ start_cmd="ipfw_start" start_precmd="ipfw_prestart" start_postcmd="ipfw_poststart" stop_cmd="ipfw_stop" +status_cmd="ipfw_status" required_modules="ipfw" +extra_commands="status" set_rcvar_obsolete ipv6_firewall_enable @@ -107,6 +109,18 @@ ipfw_stop() ${_coscript} quietstop fi done +} + +ipfw_status() +{ + status=$(sysctl -n net.inet.ip.fw.enable) + if [ ${status} -eq 0 ]; then + echo "ipfw is not enabled" + exit 1 + else + echo "ipfw is enabled" + exit 0 + fi } load_rc_config $name From owner-svn-src-head@freebsd.org Thu Jul 13 13:40:19 2017 Return-Path: Delivered-To: svn-src-head@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 C7247DA3106; Thu, 13 Jul 2017 13:40:19 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A101578393; Thu, 13 Jul 2017 13:40:19 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DDeIdQ086140; Thu, 13 Jul 2017 13:40:18 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DDeIE9086139; Thu, 13 Jul 2017 13:40:18 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707131340.v6DDeIE9086139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 13 Jul 2017 13:40:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320944 - head/etc/rc.d X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/etc/rc.d X-SVN-Commit-Revision: 320944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 13:40:19 -0000 Author: manu Date: Thu Jul 13 13:40:18 2017 New Revision: 320944 URL: https://svnweb.freebsd.org/changeset/base/320944 Log: Add an rc.d script to setup a netflow export via ng_netflow The default is to export netflow data on localhost on the netflow port. ngtee is used to have the lowest overhead possible. The ipfw ng hook is the netflow port (it can only be numeric) Default is netflow version 5. Sponsored-By: Gandi.net Reviewed by: bapt (earlier version), olivier (earlier version) Added: head/etc/rc.d/ipfw_netflow (contents, props changed) Added: head/etc/rc.d/ipfw_netflow ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/rc.d/ipfw_netflow Thu Jul 13 13:40:18 2017 (r320944) @@ -0,0 +1,77 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: ipfw_netflow +# REQUIRE: ipfw +# KEYWORD: nojailvnet + +. /etc/rc.subr +. /etc/network.subr + +name="ipfw_netflow" +desc="firewall, ipfw, netflow" +rcvar="${name}_enable" +start_cmd="${name}_start" +stop_cmd="${name}_stop" +start_precmd="${name}_test" +status_cmd="${name}_status" +required_modules="ipfw ng_netflow ng_ipfw" +extra_commands="status" + +: ${ipfw_netflow_hook:=9995} +: ${ipfw_netflow_rule:=01000} +: ${ipfw_netflow_ip:=127.0.0.1} +: ${ipfw_netflow_port:=9995} +: ${ipfw_netflow_version:=} + +ipfw_netflow_test() +{ + if [ "${ipfw_netflow_version}" != "" ] && [ "${ipfw_netflow_version}" != 9 ]; then + err 1 "Unknown netflow version \'${ipfw_netflow_version}\'" + fi + case "${ipfw_netflow_hook}" in + [!0-9]*) + err 1 "Bad value \"${ipfw_netflow_hook}\": Hook must be numerical" + esac + case "${ipfw_netflow_rule}" in + [!0-9]*) + err 1 "Bad value \"${ipfw_netflow_rule}\": Rule number must be numerical" + esac +} + +ipfw_netflow_is_running() +{ + ngctl show netflow: > /dev/null 2>&1 && return 0 || return 1 +} + +ipfw_netflow_status() +{ + ipfw_netflow_is_running && echo "ipfw_netflow is active" || echo "ipfw_netflow is not active" +} + +ipfw_netflow_start() +{ + ipfw_netflow_is_running && err 1 "ipfw_netflow is already active" + ipfw add ${ipfw_netflow_rule} ngtee ${ipfw_netflow_hook} ip from any to any + ngctl -f - <<-EOF + mkpeer ipfw: netflow ${ipfw_netflow_hook} iface0 + name ipfw:${ipfw_netflow_hook} netflow + mkpeer netflow: ksocket export${ipfw_netflow_version} inet/dgram/udp + msg netflow: setdlt {iface=0 dlt=12} + name netflow:export${ipfw_netflow_version} netflow_export + msg netflow:export${ipfw_netflow_version} connect inet/${ipfw_netflow_ip}:${ipfw_netflow_port} +EOF +} + +ipfw_netflow_stop() +{ + ipfw_netflow_is_running || err 1 "ipfw_netflow is not active" + ngctl shutdown netflow: + ipfw delete ${ipfw_netflow_rule} +} + +load_rc_config $name + +run_rc_command $* From owner-svn-src-head@freebsd.org Thu Jul 13 15:33:10 2017 Return-Path: Delivered-To: svn-src-head@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 13E47DA6964; Thu, 13 Jul 2017 15:33:10 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D672B7C600; Thu, 13 Jul 2017 15:33:09 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DFX8Xa035985; Thu, 13 Jul 2017 15:33:08 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DFX8Sc035983; Thu, 13 Jul 2017 15:33:08 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707131533.v6DFX8Sc035983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 13 Jul 2017 15:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320948 - in head/sys/cam: ata scsi X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys/cam: ata scsi X-SVN-Commit-Revision: 320948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 15:33:10 -0000 Author: sbruno Date: Thu Jul 13 15:33:08 2017 New Revision: 320948 URL: https://svnweb.freebsd.org/changeset/base/320948 Log: Add 4K quirks for Samsung 750 EVO SSD Submitted by: lev Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D9478 Modified: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Jul 13 15:16:45 2017 (r320947) +++ head/sys/cam/ata/ata_da.c Thu Jul 13 15:33:08 2017 (r320948) @@ -637,6 +637,14 @@ static struct ada_quirk_entry ada_quirk_table[] = }, { /* + * Samsung 750 SSDs + * 4k optimised, NCQ TRIM seems to work + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Samsung SSD 750*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* * Samsung 830 Series SSDs * 4k optimised, NCQ TRIM Broken (normal TRIM is fine) */ Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Jul 13 15:16:45 2017 (r320947) +++ head/sys/cam/scsi/scsi_da.c Thu Jul 13 15:33:08 2017 (r320948) @@ -1260,6 +1260,14 @@ static struct da_quirk_entry da_quirk_table[] = }, { /* + * Samsung 750 Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Samsung SSD 750*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* * Samsung 830 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ From owner-svn-src-head@freebsd.org Thu Jul 13 15:44:38 2017 Return-Path: Delivered-To: svn-src-head@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 CEC59DA6D58; Thu, 13 Jul 2017 15:44:38 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6E607CC55; Thu, 13 Jul 2017 15:44:38 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x244.google.com with SMTP id j186so7385394pge.1; Thu, 13 Jul 2017 08:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JeB641YopzAINOS6HLsNCKUVv03KsymMT5RHV5Kyc3Q=; b=jUC8/usF3C+FvXwRO16mJIo3VDr8htw3AAko46qy/um6IE2Wd25TZMuU3Y3nLtqMK5 wvjPX4qk46Ceb4ozOxjZdUFCCF88+BhdDF5lULcyhpuAwojvnVPV7edtN6kYx6LTokEp SuIHzNSQ7vg8Hx64qOTquzVD0cBxW+jjuwLqQXZDG24j0o67nShHU1iHsJudcD4+PaQP X2ZHT4Xb8tReBpLRs+arzz34SsthdEgmdDaKFz0vm+iNRsFR1npq6FiV/ecKTz199BWV ZPP5FPqjP+fCLOeCAnKx/Kepl48dVd5fMkTqx6fSRay7gdHi7FprYAecNwj/ZaNuk+64 koFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JeB641YopzAINOS6HLsNCKUVv03KsymMT5RHV5Kyc3Q=; b=lYpbIpW8suulgGa4lxa+OPuTK+twJR9v+AjFgfBVTd5+KpdlIcdSeLUiQAjTvLim2C Wnxlqnny1yRrmW4u6bwU3FZkI2UAXYdcPpaDQnTN2RHrhXirhEULaHWlDcWIh+ihuIyK bVnxkfpzTMPsVkBCm51EHiy8I4AY9DaqfZa7StwL2WXomGzPCCsPl0A12mh7eZoAT61v aaNf4dNLJxyIeh+1EvwSyHeAg0T73cJx+8SzQXPcQd3Re4wmDyFBgSERtkqNnM0nlM5L VBzPARKH0ZUGbR+Nv334OqgrhE3MURhn4qTHdqENDhj65brPt6T6mqW85pc2HaIXYRt9 c9DA== X-Gm-Message-State: AIVw113DGpO/JcDp7/iiYkg8KraQBWj+dWYW79HfTRp8Ng7ZtAsVeHTd 1Vy/cXCC+8C4YrGGRdU= X-Received: by 10.98.215.23 with SMTP id b23mr209940pfh.139.1499960677891; Thu, 13 Jul 2017 08:44:37 -0700 (PDT) Received: from ?IPv6:2607:fb90:836f:1053:edf1:3446:3fc:90c9? ([2607:fb90:836f:1053:edf1:3446:3fc:90c9]) by smtp.gmail.com with ESMTPSA id w125sm12605932pfb.117.2017.07.13.08.44.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 08:44:37 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r320944 - head/etc/rc.d From: Ngie Cooper X-Mailer: iPhone Mail (14F89) In-Reply-To: <201707131340.v6DDeIE9086139@repo.freebsd.org> Date: Thu, 13 Jul 2017 08:44:36 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <9D643ACB-FA58-499B-9783-71246C323ECC@gmail.com> References: <201707131340.v6DDeIE9086139@repo.freebsd.org> To: Emmanuel Vadot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 15:44:38 -0000 > On Jul 13, 2017, at 06:40, Emmanuel Vadot wrote: >=20 > Author: manu > Date: Thu Jul 13 13:40:18 2017 > New Revision: 320944 > URL: https://svnweb.freebsd.org/changeset/base/320944 >=20 > Log: > Add an rc.d script to setup a netflow export via ng_netflow > The default is to export netflow data on localhost on the netflow port. > ngtee is used to have the lowest overhead possible. > The ipfw ng hook is the netflow port (it can only be numeric) > Default is netflow version 5. Hi Emmanuel, The script isn't being installed. Could you please integrate it in to et= c/rc.d/Makefile under a block conditional on MK_IPFW/MK_NETGRAPH? Thanks! -Ngie= From owner-svn-src-head@freebsd.org Thu Jul 13 16:45:14 2017 Return-Path: Delivered-To: svn-src-head@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 78CD5DA8590; Thu, 13 Jul 2017 16:45:14 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-yb0-f171.google.com (mail-yb0-f171.google.com [209.85.213.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4421D7F1C4; Thu, 13 Jul 2017 16:45:13 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-yb0-f171.google.com with SMTP id f194so20863764yba.3; Thu, 13 Jul 2017 09:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=afPFASepAhrRxlEzMMJOaZXjp7I5KslEtijLzuwCfIQ=; b=XVdji+/hzlDQqLP5jK6PYfTm5eYcp8Mqp85SwV0qS93OvuzHciLV+eINpJ3Btj68lY EzDFEhuO+7+ncJi0WJjX1HLcskNrqZSbwJJdsRre6rQ9EhWbNl/88nibBu9VvXJneLKk byVft8/+9bYQf6t0vPG1qv9LrcEIXgE+itGuvzR98I4PB78F4xOIMzovbw0ufsWHTXSu l/YHIhx+PAzT9wDnSm0+qFNTich/SdjcUEdGLPeVz03EbrDGtPUR7N+UPDEnb7/1w65O 1WpXe/Fa1TcK/+iTPJY95myVGhRpmKK0vvwHnKRyzokeBiLYX0O2/rXxnsY68isIYy+U wp4A== X-Gm-Message-State: AIVw111jcg5VabQb9sKA/VcuXtNVPlG2zJDG6isDfq2bhtapam6Rld3d TfxztTfWbR6jkVpTQB2dY8guvMhqRlftbDs= X-Received: by 10.37.164.168 with SMTP id g37mr3665090ybi.177.1499964307059; Thu, 13 Jul 2017 09:45:07 -0700 (PDT) MIME-Version: 1.0 References: <201707121735.v6CHZWNY091333@repo.freebsd.org> In-Reply-To: From: Eric Joyner Date: Thu, 13 Jul 2017 16:44:56 +0000 Message-ID: Subject: Re: svn commit: r320916 - head/sys/dev/ixgbe To: Ngie Cooper , Sean Bruno Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 16:45:14 -0000 Yeah -- I wanted to leave it as-is in head, but revert it to the previous name in the stable branches. On Wed, Jul 12, 2017 at 4:49 PM Ngie Cooper wrote: > On Wed, Jul 12, 2017 at 10:35 AM, Sean Bruno wrote: > > Author: sbruno > > Date: Wed Jul 12 17:35:32 2017 > > New Revision: 320916 > > URL: https://svnweb.freebsd.org/changeset/base/320916 > > > > Log: > > Reset unsupported SFP tuneable back to original entry name. > > > > Reported by: olivier@ > > The new name kinda makes more sense -- why not keep it and make a > backwards compatible OID for the old name? > Thanks, > -Ngie > > From owner-svn-src-head@freebsd.org Thu Jul 13 16:56:27 2017 Return-Path: Delivered-To: svn-src-head@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 85BE5DA89F9; Thu, 13 Jul 2017 16:56:27 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 5303F7F966; Thu, 13 Jul 2017 16:56:27 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DGuQYM069576; Thu, 13 Jul 2017 16:56:26 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DGuQiD069574; Thu, 13 Jul 2017 16:56:26 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707131656.v6DGuQiD069574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 13 Jul 2017 16:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320953 - in head/sys/cam: ata scsi X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys/cam: ata scsi X-SVN-Commit-Revision: 320953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 16:56:27 -0000 Author: sbruno Date: Thu Jul 13 16:56:26 2017 New Revision: 320953 URL: https://svnweb.freebsd.org/changeset/base/320953 Log: Add 4k and NCQ_TRIM_BROKEN quirks for Samsung 845 SSDs. Submitted by: hannula@gmail.com Differential Revision: https://reviews.freebsd.org/D7967 Modified: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Jul 13 16:27:43 2017 (r320952) +++ head/sys/cam/ata/ata_da.c Thu Jul 13 16:56:26 2017 (r320953) @@ -661,6 +661,14 @@ static struct ada_quirk_entry ada_quirk_table[] = }, { /* + * Samsung 845 SSDs + * 4k optimised, NCQ TRIM Broken (normal TRIM is fine) + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Samsung SSD 845*", "*" }, + /*quirks*/ADA_Q_4K | ADA_Q_NCQ_TRIM_BROKEN + }, + { + /* * Samsung 850 SSDs * 4k optimised, NCQ TRIM broken (normal TRIM fine) */ Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Jul 13 16:27:43 2017 (r320952) +++ head/sys/cam/scsi/scsi_da.c Thu Jul 13 16:56:26 2017 (r320953) @@ -1284,6 +1284,14 @@ static struct da_quirk_entry da_quirk_table[] = }, { /* + * Samsung 845 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Samsung SSD 845*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* * Samsung 850 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ From owner-svn-src-head@freebsd.org Thu Jul 13 18:27:24 2017 Return-Path: Delivered-To: svn-src-head@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 42A8EDAAF04; Thu, 13 Jul 2017 18:27:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0C11A84117; Thu, 13 Jul 2017 18:27:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DIRNSE010894; Thu, 13 Jul 2017 18:27:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DIRNpE010893; Thu, 13 Jul 2017 18:27:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707131827.v6DIRNpE010893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 13 Jul 2017 18:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320956 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 320956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 18:27:24 -0000 Author: markj Date: Thu Jul 13 18:27:22 2017 New Revision: 320956 URL: https://svnweb.freebsd.org/changeset/base/320956 Log: Add some functions to jiffies.h. Also add some checks for overflow to existing functions. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11533 Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/jiffies.h Thu Jul 13 17:37:32 2017 (r320955) +++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h Thu Jul 13 18:27:22 2017 (r320956) @@ -68,11 +68,14 @@ timespec_to_jiffies(const struct timespec *ts) } static inline int -msecs_to_jiffies(const u64 msec) +msecs_to_jiffies(uint64_t msec) { - u64 result; + uint64_t msec_max, result; - result = howmany(msec * (u64)hz, 1000ULL); + msec_max = -1ULL / (uint64_t)hz; + if (msec > msec_max) + msec = msec_max; + result = howmany(msec * (uint64_t)hz, 1000ULL); if (result > MAX_JIFFY_OFFSET) result = MAX_JIFFY_OFFSET; @@ -80,27 +83,61 @@ msecs_to_jiffies(const u64 msec) } static inline int -usecs_to_jiffies(const u64 u) +usecs_to_jiffies(uint64_t usec) { - u64 result; + uint64_t usec_max, result; - result = howmany(u * (u64)hz, 1000000ULL); + usec_max = -1ULL / (uint64_t)hz; + if (usec > usec_max) + usec = usec_max; + result = howmany(usec * (uint64_t)hz, 1000000ULL); if (result > MAX_JIFFY_OFFSET) result = MAX_JIFFY_OFFSET; return ((int)result); } -static inline u64 -nsecs_to_jiffies(const u64 n) +static inline uint64_t +nsecs_to_jiffies64(uint64_t nsec) { + uint64_t nsec_max, result; + + nsec_max = -1ULL / (uint64_t)hz; + if (nsec > nsec_max) + nsec = nsec_max; + result = howmany(nsec * (uint64_t)hz, 1000000000ULL); + if (result > MAX_JIFFY_OFFSET) + result = MAX_JIFFY_OFFSET; + + return (result); +} + +static inline uint64_t +nsecs_to_jiffies(uint64_t n) +{ + return (usecs_to_jiffies(howmany(n, 1000ULL))); } -static inline u64 +static inline uint64_t +jiffies_to_nsecs(int j) +{ + + return ((1000000000ULL / hz) * (uint64_t)(unsigned int)j); +} + +static inline uint64_t +jiffies_to_usecs(int j) +{ + + return ((1000000ULL / hz) * (uint64_t)(unsigned int)j); +} + +static inline uint64_t get_jiffies_64(void) { - return ((u64)(unsigned)ticks); + + return ((uint64_t)(unsigned int)ticks); } static inline int From owner-svn-src-head@freebsd.org Thu Jul 13 19:17:44 2017 Return-Path: Delivered-To: svn-src-head@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 22B3DDABD9F; Thu, 13 Jul 2017 19:17:44 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA14B85DEE; Thu, 13 Jul 2017 19:17:43 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v6DJBVQJ090067; Thu, 13 Jul 2017 12:11:31 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v6DJBTMC090066; Thu, 13 Jul 2017 12:11:29 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201707131911.v6DJBTMC090066@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r320803 - head/sbin/mount In-Reply-To: <5242112.0aHCQARnit@ralph.baldwin.cx> To: John Baldwin Date: Thu, 13 Jul 2017 12:11:29 -0700 (PDT) CC: Ian Lepore , Edward Tomasz Napierala , rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 19:17:44 -0000 > On Tuesday, July 11, 2017 02:35:15 PM Ian Lepore wrote: > > I think the docs on this are pretty clear... under -u it says: > > > > The set of options is determined by applying the options specified > > in the argument to -o and finally applying the -r or -w option. > > > > To me, that says that nothing in /etc/fstab is germane to mount -u > > unless one of the other args to mount -u is -o fstab. > > > > This change (r320803) seems like an acceptable workaround, but I think > > the correct long term fix would be to not even open /etc/fstab on mount > > -u without -o fstab. But that may be harder to do than to say; I still > > haven't actually looked at the code involved. > > I concur with this. I've always viewed '-u' as meaning "apply a delta > to the current configuration", not "add this delta to the fstab options > and then apply that entire set of options". In practice, it seems that > it doesn't do either of those, but instead it seems to treats the options > passed to -o as the entire list of options. This is perhaps a bit > surprising. > > For example, suppose you had this: > > /etc/fstab: > > /dev/md0 /bar ufs ro,noauto,noexec 0 0 ... To shed some light on all of this I did the dig to find the original documentaton on mount -u, which actually makes it rather clear what and how things should be happening. Somehow this has been lost over the years: csrg change to mount.c adding -u https://svnweb.freebsd.org/csrg/sbin/mount/mount.c?r1=39329&r2=39333 csrg change to mount.8 documenting -u https://svnweb.freebsd.org/csrg/sbin/mount/mount.8?r1=39328&r2=39466 This documenting of -u clearly states that /etc/fstab shall be consulted during a mount -u, some place we lost that. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu Jul 13 20:04:44 2017 Return-Path: Delivered-To: svn-src-head@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 0AA20DACDE3; Thu, 13 Jul 2017 20:04:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C07DC2546; Thu, 13 Jul 2017 20:04:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DK4gTm053539; Thu, 13 Jul 2017 20:04:42 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DK4gDU053538; Thu, 13 Jul 2017 20:04:42 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707132004.v6DK4gDU053538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 13 Jul 2017 20:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320969 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 320969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 20:04:44 -0000 Author: gjb Date: Thu Jul 13 20:04:42 2017 New Revision: 320969 URL: https://svnweb.freebsd.org/changeset/base/320969 Log: Fix a missing comment marker. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Jul 13 19:26:23 2017 (r320968) +++ head/sys/conf/NOTES Thu Jul 13 20:04:42 2017 (r320969) @@ -302,7 +302,7 @@ options SX_NOINLINE # TURNSTILE_PROFILING enables rudimentary profiling of the hash table # used to hold active lock queues. # UMTX_PROFILING enables rudimentary profiling of the hash table used - to hold active lock queues. +# to hold active lock queues. # WITNESS enables the witness code which detects deadlocks and cycles # during locking operations. # WITNESS_KDB causes the witness code to drop into the kernel debugger if From owner-svn-src-head@freebsd.org Thu Jul 13 22:12:42 2017 Return-Path: Delivered-To: svn-src-head@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 B7FAADAF079; Thu, 13 Jul 2017 22:12:42 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 84A74663E2; Thu, 13 Jul 2017 22:12:42 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DMCfCF007005; Thu, 13 Jul 2017 22:12:41 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DMCfrC007004; Thu, 13 Jul 2017 22:12:41 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201707132212.v6DMCfrC007004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 13 Jul 2017 22:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320972 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 320972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 22:12:42 -0000 Author: erj Date: Thu Jul 13 22:12:41 2017 New Revision: 320972 URL: https://svnweb.freebsd.org/changeset/base/320972 Log: ixl(4)/ixlv(4): Stop leaking every busdma entry in receive path From Brett: In short, busdma maps for received packets were not being unloaded in the interrupt handler before the packets were passed up the network stack. The fix was to add a busdma sync and unload for the two receive maps. This bug is significant for certain busdma providers, for example IOMMUs, where not unloading the maps means that 1) the IOMMU mappings that allow the NIC to DMA the received packets into host memory stay open indefinitely, potentially violating a desired security policy, and 2) resources such as device address space addresses and host memory for bookkeeping are never freed. Without an IOMMU or bounce buffering enabled for the ixl device, I don't think adding these calls will have any significant performance impact. With the IOMMU enabled, I have noticed a performance impact on the receive side, which is expected. Submitted by: Brett Gutstein Reviewed by: erj@ MFC after: 1 week Modified: head/sys/dev/ixl/ixl_txrx.c Modified: head/sys/dev/ixl/ixl_txrx.c ============================================================================== --- head/sys/dev/ixl/ixl_txrx.c Thu Jul 13 22:01:38 2017 (r320971) +++ head/sys/dev/ixl/ixl_txrx.c Thu Jul 13 22:12:41 2017 (r320972) @@ -1578,6 +1578,18 @@ ixl_rxeof(struct ixl_queue *que, int count) else vtag = 0; + /* Remove device access to the rx buffers. */ + if (rbuf->m_head != NULL) { + bus_dmamap_sync(rxr->htag, rbuf->hmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->htag, rbuf->hmap); + } + if (rbuf->m_pack != NULL) { + bus_dmamap_sync(rxr->ptag, rbuf->pmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->ptag, rbuf->pmap); + } + /* ** Make sure bad packets are discarded, ** note that only EOP descriptor has valid From owner-svn-src-head@freebsd.org Thu Jul 13 22:45:25 2017 Return-Path: Delivered-To: svn-src-head@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 19250DAF75E; Thu, 13 Jul 2017 22:45:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DA600670D3; Thu, 13 Jul 2017 22:45:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DMjO25019263; Thu, 13 Jul 2017 22:45:24 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DMjNPN019262; Thu, 13 Jul 2017 22:45:23 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201707132245.v6DMjNPN019262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 13 Jul 2017 22:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320973 - in head/sys: conf modules/ixl X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head/sys: conf modules/ixl X-SVN-Commit-Revision: 320973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 22:45:25 -0000 Author: bdrewery Date: Thu Jul 13 22:45:23 2017 New Revision: 320973 URL: https://svnweb.freebsd.org/changeset/base/320973 Log: Fix kldload of if_ixl without PCI_IOV kernel option. This also avoids compiling in pci_iov support into the kernel if_ixoif the PCI_IOV option is disabled. Reviewed by: rstone Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11573 Modified: head/sys/conf/files.amd64 head/sys/modules/ixl/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Jul 13 22:12:41 2017 (r320972) +++ head/sys/conf/files.amd64 Thu Jul 13 22:45:23 2017 (r320973) @@ -253,7 +253,7 @@ dev/ixl/ixl_pf_main.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_qmgr.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" -dev/ixl/ixl_pf_iov.c optional ixl pci \ +dev/ixl/ixl_pf_iov.c optional ixl pci pci_iov \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_i2c.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" Modified: head/sys/modules/ixl/Makefile ============================================================================== --- head/sys/modules/ixl/Makefile Thu Jul 13 22:12:41 2017 (r320972) +++ head/sys/modules/ixl/Makefile Thu Jul 13 22:45:23 2017 (r320973) @@ -3,10 +3,11 @@ .PATH: ${SRCTOP}/sys/dev/ixl KMOD = if_ixl -SRCS = device_if.h bus_if.h pci_if.h pci_iov_if.h +SRCS = device_if.h bus_if.h pci_if.h SRCS += opt_inet.h opt_inet6.h opt_rss.h opt_ixl.h SRCS += if_ixl.c ixl_pf_main.c ixl_pf_qmgr.c ixl_txrx.c ixl_pf_i2c.c i40e_osdep.c -SRCS += ixl_pf_iov.c ixl_iw.c +SRCS += ixl_iw.c +SRCS.PCI_IOV= pci_iov_if.h ixl_pf_iov.c # Shared source SRCS += i40e_common.c i40e_nvm.c i40e_adminq.c i40e_lan_hmc.c i40e_hmc.c From owner-svn-src-head@freebsd.org Thu Jul 13 22:49:56 2017 Return-Path: Delivered-To: svn-src-head@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 C0D11DAF8C9; Thu, 13 Jul 2017 22:49:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7125667350; Thu, 13 Jul 2017 22:49:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DMntWi019461; Thu, 13 Jul 2017 22:49:55 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DMntQa019459; Thu, 13 Jul 2017 22:49:55 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707132249.v6DMntQa019459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Jul 2017 22:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320974 - head/tests/sys/aio X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/aio X-SVN-Commit-Revision: 320974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 22:49:56 -0000 Author: asomers Date: Thu Jul 13 22:49:55 2017 New Revision: 320974 URL: https://svnweb.freebsd.org/changeset/base/320974 Log: Use ATF cleanup routines in aio_test.c Remove aio_test's legacy timeout handling and cleanup routines. Instead, use ATF's builtin capabilities. ATF automatically cleans up newly created files, too, so we don't have to explicitly unlink them. The only tests than need a cleanup routine are the md(4) tests, which must destroy their md device. Reviewed by: jhb MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11468 Modified: head/tests/sys/aio/Makefile head/tests/sys/aio/aio_test.c Modified: head/tests/sys/aio/Makefile ============================================================================== --- head/tests/sys/aio/Makefile Thu Jul 13 22:45:23 2017 (r320973) +++ head/tests/sys/aio/Makefile Thu Jul 13 22:49:55 2017 (r320974) @@ -3,11 +3,12 @@ TESTSDIR= ${TESTSBASE}/sys/aio ATF_TESTS_C+= aio_test +TEST_METADATA.aio_test+= timeout="30" PLAIN_TESTS_C+= aio_kqueue_test PLAIN_TESTS_C+= lio_kqueue_test -LIBADD.aio_test+= util +LIBADD.aio_test+= util rt CFLAGS+= -I${.CURDIR:H:H} Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Thu Jul 13 22:45:23 2017 (r320973) +++ head/tests/sys/aio/aio_test.c Thu Jul 13 22:49:55 2017 (r320974) @@ -32,10 +32,11 @@ * size buffer with pseudo-random data, writing it to one fd using AIO, then * reading it from a second descriptor using AIO. For some targets, the same * fd is used for write and read (i.e., file, md device), but for others the - * operation is performed on a peer (pty, socket, fifo, etc). A timeout is - * initiated to detect undue blocking. This test does not attempt to exercise - * error cases or more subtle asynchronous behavior, just make sure that the - * basic operations work on some basic object types. + * operation is performed on a peer (pty, socket, fifo, etc). For each file + * descriptor type, several completion methods are tested. This test program + * does not attempt to exercise error cases or more subtle asynchronous + * behavior, just make sure that the basic operations work on some basic object + * types. */ #include @@ -85,43 +86,10 @@ struct aio_context { char ac_buffer[GLOBAL_MAX]; int ac_buflen; int ac_seconds; - void (*ac_cleanup)(void *arg); - void *ac_cleanup_arg; }; -static int aio_timedout; /* - * Each test run specifies a timeout in seconds. Use the somewhat obsoleted - * signal(3) and alarm(3) APIs to set this up. - */ -static void -aio_timeout_signal(int sig __unused) -{ - - aio_timedout = 1; -} - -static void -aio_timeout_start(int seconds) -{ - - aio_timedout = 0; - ATF_REQUIRE_MSG(signal(SIGALRM, aio_timeout_signal) != SIG_ERR, - "failed to set SIGALRM handler: %s", strerror(errno)); - alarm(seconds); -} - -static void -aio_timeout_stop(void) -{ - - ATF_REQUIRE_MSG(signal(SIGALRM, NULL) != SIG_ERR, - "failed to reset SIGALRM handler to default: %s", strerror(errno)); - alarm(0); -} - -/* * Fill a buffer given a seed that can be fed into srandom() to initialize * the PRNG in a repeatable manner. */ @@ -163,8 +131,7 @@ aio_test_buffer(char *buffer, int len, long seed) */ static void aio_context_init(struct aio_context *ac, int read_fd, - int write_fd, int buflen, int seconds, void (*cleanup)(void *), - void *cleanup_arg) + int write_fd, int buflen) { ATF_REQUIRE_MSG(buflen <= BUFFER_MAX, @@ -179,9 +146,6 @@ aio_context_init(struct aio_context *ac, int read_fd, aio_fill_buffer(ac->ac_buffer, buflen, ac->ac_seed); ATF_REQUIRE_MSG(aio_test_buffer(ac->ac_buffer, buflen, ac->ac_seed) != 0, "aio_test_buffer: internal error"); - ac->ac_seconds = seconds; - ac->ac_cleanup = cleanup; - ac->ac_cleanup_arg = cleanup_arg; } static ssize_t @@ -189,7 +153,7 @@ poll(struct aiocb *aio) { int error; - while ((error = aio_error(aio)) == EINPROGRESS && !aio_timedout) + while ((error = aio_error(aio)) == EINPROGRESS) usleep(25000); switch (error) { case EINPROGRESS: @@ -227,23 +191,6 @@ waitcomplete(struct aiocb *aio) } /* - * Each tester can register a callback to clean up in the event the test - * fails. Preserve the value of errno so that subsequent calls to errx() - * work properly. - */ -static void -aio_cleanup(struct aio_context *ac) -{ - int error; - - if (ac->ac_cleanup == NULL) - return; - error = errno; - (ac->ac_cleanup)(ac->ac_cleanup_arg); - errno = error; -} - -/* * Perform a simple write test of our initialized data buffer to the provided * file descriptor. */ @@ -259,37 +206,15 @@ aio_write_test(struct aio_context *ac, completion comp aio.aio_fildes = ac->ac_write_fd; aio.aio_offset = 0; - aio_timeout_start(ac->ac_seconds); - - if (aio_write(&aio) < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio_write timed out"); - } - } - aio_cleanup(ac); + if (aio_write(&aio) < 0) atf_tc_fail("aio_write failed: %s", strerror(errno)); - } len = comp(&aio); - if (len < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio timed out"); - } - } - aio_cleanup(ac); + if (len < 0) atf_tc_fail("aio failed: %s", strerror(errno)); - } - aio_timeout_stop(); - - if (len != ac->ac_buflen) { - aio_cleanup(ac); + if (len != ac->ac_buflen) atf_tc_fail("aio short write (%jd)", (intmax_t)len); - } } /* @@ -309,43 +234,18 @@ aio_read_test(struct aio_context *ac, completion comp) aio.aio_fildes = ac->ac_read_fd; aio.aio_offset = 0; - aio_timeout_start(ac->ac_seconds); - - if (aio_read(&aio) < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio_read timed out"); - } - } - aio_cleanup(ac); + if (aio_read(&aio) < 0) atf_tc_fail("aio_read failed: %s", strerror(errno)); - } len = comp(&aio); - if (len < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio timed out"); - } - } - aio_cleanup(ac); + if (len < 0) atf_tc_fail("aio failed: %s", strerror(errno)); - } - aio_timeout_stop(); + ATF_REQUIRE_EQ_MSG(len, ac->ac_buflen, + "aio short read (%jd)", (intmax_t)len); - if (len != ac->ac_buflen) { - aio_cleanup(ac); - atf_tc_fail("aio short read (%jd)", - (intmax_t)len); - } - - if (aio_test_buffer(ac->ac_buffer, ac->ac_buflen, ac->ac_seed) == 0) { - aio_cleanup(ac); + if (aio_test_buffer(ac->ac_buffer, ac->ac_buflen, ac->ac_seed) == 0) atf_tc_fail("buffer mismatched"); - } } /* @@ -360,25 +260,10 @@ aio_read_test(struct aio_context *ac, completion comp) */ #define FILE_LEN GLOBAL_MAX #define FILE_PATHNAME "testfile" -#define FILE_TIMEOUT 30 -struct aio_file_arg { - int afa_fd; -}; static void -aio_file_cleanup(void *arg) -{ - struct aio_file_arg *afa; - - afa = arg; - close(afa->afa_fd); - unlink(FILE_PATHNAME); -} - -static void aio_file_test(completion comp) { - struct aio_file_arg arg; struct aio_context ac; int fd; @@ -388,14 +273,10 @@ aio_file_test(completion comp) fd = open(FILE_PATHNAME, O_RDWR | O_CREAT, 0600); ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); - arg.afa_fd = fd; - - aio_context_init(&ac, fd, fd, FILE_LEN, - FILE_TIMEOUT, aio_file_cleanup, &arg); + aio_context_init(&ac, fd, fd, FILE_LEN); aio_write_test(&ac, comp); aio_read_test(&ac, comp); - - aio_file_cleanup(&arg); + close(fd); } ATF_TC_WITHOUT_HEAD(file_poll); @@ -418,30 +299,11 @@ ATF_TC_BODY(file_waitcomplete, tc) #define FIFO_LEN 256 #define FIFO_PATHNAME "testfifo" -#define FIFO_TIMEOUT 30 -struct aio_fifo_arg { - int afa_read_fd; - int afa_write_fd; -}; static void -aio_fifo_cleanup(void *arg) -{ - struct aio_fifo_arg *afa; - - afa = arg; - if (afa->afa_read_fd != -1) - close(afa->afa_read_fd); - if (afa->afa_write_fd != -1) - close(afa->afa_write_fd); - unlink(FIFO_PATHNAME); -} - -static void aio_fifo_test(completion comp) { int error, read_fd = -1, write_fd = -1; - struct aio_fifo_arg arg; struct aio_context ac; ATF_REQUIRE_KERNEL_MODULE("aio"); @@ -449,35 +311,29 @@ aio_fifo_test(completion comp) ATF_REQUIRE_MSG(mkfifo(FIFO_PATHNAME, 0600) != -1, "mkfifo failed: %s", strerror(errno)); - arg.afa_read_fd = -1; - arg.afa_write_fd = -1; read_fd = open(FIFO_PATHNAME, O_RDONLY | O_NONBLOCK); if (read_fd == -1) { error = errno; - aio_fifo_cleanup(&arg); errno = error; atf_tc_fail("read_fd open failed: %s", strerror(errno)); } - arg.afa_read_fd = read_fd; write_fd = open(FIFO_PATHNAME, O_WRONLY); if (write_fd == -1) { error = errno; - aio_fifo_cleanup(&arg); errno = error; atf_tc_fail("write_fd open failed: %s", strerror(errno)); } - arg.afa_write_fd = write_fd; - aio_context_init(&ac, read_fd, write_fd, FIFO_LEN, - FIFO_TIMEOUT, aio_fifo_cleanup, &arg); + aio_context_init(&ac, read_fd, write_fd, FIFO_LEN); aio_write_test(&ac, comp); aio_read_test(&ac, comp); - aio_fifo_cleanup(&arg); + close(read_fd); + close(write_fd); } ATF_TC_WITHOUT_HEAD(fifo_poll); @@ -489,7 +345,7 @@ ATF_TC_BODY(fifo_poll, tc) ATF_TC_WITHOUT_HEAD(fifo_suspend); ATF_TC_BODY(fifo_suspend, tc) { - aio_fifo_test(waitcomplete); + aio_fifo_test(suspend); } ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); @@ -498,26 +354,10 @@ ATF_TC_BODY(fifo_waitcomplete, tc) aio_fifo_test(waitcomplete); } -struct aio_unix_socketpair_arg { - int asa_sockets[2]; -}; - -static void -aio_unix_socketpair_cleanup(void *arg) -{ - struct aio_unix_socketpair_arg *asa; - - asa = arg; - close(asa->asa_sockets[0]); - close(asa->asa_sockets[1]); -} - #define UNIX_SOCKETPAIR_LEN 256 -#define UNIX_SOCKETPAIR_TIMEOUT 30 static void aio_unix_socketpair_test(completion comp) { - struct aio_unix_socketpair_arg arg; struct aio_context ac; struct rusage ru_before, ru_after; int sockets[2]; @@ -527,11 +367,7 @@ aio_unix_socketpair_test(completion comp) ATF_REQUIRE_MSG(socketpair(PF_UNIX, SOCK_STREAM, 0, sockets) != -1, "socketpair failed: %s", strerror(errno)); - arg.asa_sockets[0] = sockets[0]; - arg.asa_sockets[1] = sockets[1]; - aio_context_init(&ac, sockets[0], - sockets[1], UNIX_SOCKETPAIR_LEN, UNIX_SOCKETPAIR_TIMEOUT, - aio_unix_socketpair_cleanup, &arg); + aio_context_init(&ac, sockets[0], sockets[1], UNIX_SOCKETPAIR_LEN); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, "getrusage failed: %s", strerror(errno)); aio_write_test(&ac, comp); @@ -544,7 +380,8 @@ aio_unix_socketpair_test(completion comp) "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); - aio_unix_socketpair_cleanup(&arg); + close(sockets[0]); + close(sockets[1]); } ATF_TC_WITHOUT_HEAD(socket_poll); @@ -570,22 +407,10 @@ struct aio_pty_arg { int apa_write_fd; }; -static void -aio_pty_cleanup(void *arg) -{ - struct aio_pty_arg *apa; - - apa = arg; - close(apa->apa_read_fd); - close(apa->apa_write_fd); -}; - #define PTY_LEN 256 -#define PTY_TIMEOUT 30 static void aio_pty_test(completion comp) { - struct aio_pty_arg arg; struct aio_context ac; int read_fd, write_fd; struct termios ts; @@ -597,29 +422,25 @@ aio_pty_test(completion comp) ATF_REQUIRE_MSG(openpty(&read_fd, &write_fd, NULL, NULL, NULL) == 0, "openpty failed: %s", strerror(errno)); - arg.apa_read_fd = read_fd; - arg.apa_write_fd = write_fd; if (tcgetattr(write_fd, &ts) < 0) { error = errno; - aio_pty_cleanup(&arg); errno = error; atf_tc_fail("tcgetattr failed: %s", strerror(errno)); } cfmakeraw(&ts); if (tcsetattr(write_fd, TCSANOW, &ts) < 0) { error = errno; - aio_pty_cleanup(&arg); errno = error; atf_tc_fail("tcsetattr failed: %s", strerror(errno)); } - aio_context_init(&ac, read_fd, write_fd, PTY_LEN, - PTY_TIMEOUT, aio_pty_cleanup, &arg); + aio_context_init(&ac, read_fd, write_fd, PTY_LEN); aio_write_test(&ac, comp); aio_read_test(&ac, comp); - aio_pty_cleanup(&arg); + close(read_fd); + close(write_fd); } ATF_TC_WITHOUT_HEAD(pty_poll); @@ -640,17 +461,7 @@ ATF_TC_BODY(pty_waitcomplete, tc) aio_pty_test(waitcomplete); } -static void -aio_pipe_cleanup(void *arg) -{ - int *pipes = arg; - - close(pipes[0]); - close(pipes[1]); -} - #define PIPE_LEN 256 -#define PIPE_TIMEOUT 30 static void aio_pipe_test(completion comp) { @@ -663,12 +474,12 @@ aio_pipe_test(completion comp) ATF_REQUIRE_MSG(pipe(pipes) != -1, "pipe failed: %s", strerror(errno)); - aio_context_init(&ac, pipes[0], pipes[1], PIPE_LEN, - PIPE_TIMEOUT, aio_pipe_cleanup, pipes); + aio_context_init(&ac, pipes[0], pipes[1], PIPE_LEN); aio_write_test(&ac, comp); aio_read_test(&ac, comp); - aio_pipe_cleanup(pipes); + close(pipes[0]); + close(pipes[1]); } ATF_TC_WITHOUT_HEAD(pipe_poll); @@ -689,50 +500,45 @@ ATF_TC_BODY(pipe_waitcomplete, tc) aio_pipe_test(waitcomplete); } -struct aio_md_arg { - int ama_mdctl_fd; - int ama_unit; - int ama_fd; -}; +#define MD_LEN GLOBAL_MAX +#define MDUNIT_LINK "mdunit_link" static void -aio_md_cleanup(void *arg) +aio_md_cleanup(void) { - struct aio_md_arg *ama; struct md_ioctl mdio; - int error; + int mdctl_fd, error, n, unit; + char buf[80]; - ama = arg; - - if (ama->ama_fd != -1) - close(ama->ama_fd); - - if (ama->ama_unit != -1) { - bzero(&mdio, sizeof(mdio)); - mdio.md_version = MDIOVERSION; - mdio.md_unit = ama->ama_unit; - if (ioctl(ama->ama_mdctl_fd, MDIOCDETACH, &mdio) == -1) { - error = errno; - close(ama->ama_mdctl_fd); - errno = error; - atf_tc_fail("ioctl MDIOCDETACH failed: %s", - strerror(errno)); + mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); + ATF_REQUIRE(mdctl_fd >= 0); + n = readlink(MDUNIT_LINK, buf, sizeof(buf)); + if (n > 0) { + if (sscanf(buf, "%d", &unit) == 1 && unit >= 0) { + bzero(&mdio, sizeof(mdio)); + mdio.md_version = MDIOVERSION; + mdio.md_unit = unit; + if (ioctl(mdctl_fd, MDIOCDETACH, &mdio) == -1) { + error = errno; + close(mdctl_fd); + errno = error; + atf_tc_fail("ioctl MDIOCDETACH failed: %s", + strerror(errno)); + } } } - - close(ama->ama_mdctl_fd); + + close(mdctl_fd); } -#define MD_LEN GLOBAL_MAX -#define MD_TIMEOUT 30 static void aio_md_test(completion comp) { int error, fd, mdctl_fd, unit; char pathname[PATH_MAX]; - struct aio_md_arg arg; struct aio_context ac; struct md_ioctl mdio; + char buf[80]; ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); @@ -748,32 +554,30 @@ aio_md_test(completion comp) mdio.md_mediasize = GLOBAL_MAX; mdio.md_sectorsize = 512; - arg.ama_mdctl_fd = mdctl_fd; - arg.ama_unit = -1; - arg.ama_fd = -1; if (ioctl(mdctl_fd, MDIOCATTACH, &mdio) < 0) { error = errno; - aio_md_cleanup(&arg); errno = error; atf_tc_fail("ioctl MDIOCATTACH failed: %s", strerror(errno)); } + close(mdctl_fd); - arg.ama_unit = unit = mdio.md_unit; + /* Store the md unit number in a symlink for future cleanup */ + unit = mdio.md_unit; + snprintf(buf, sizeof(buf), "%d", unit); + ATF_REQUIRE_EQ(0, symlink(buf, MDUNIT_LINK)); snprintf(pathname, PATH_MAX, "/dev/md%d", unit); fd = open(pathname, O_RDWR); ATF_REQUIRE_MSG(fd != -1, "opening %s failed: %s", pathname, strerror(errno)); - arg.ama_fd = fd; - aio_context_init(&ac, fd, fd, MD_LEN, MD_TIMEOUT, - aio_md_cleanup, &arg); + aio_context_init(&ac, fd, fd, MD_LEN); aio_write_test(&ac, comp); aio_read_test(&ac, comp); - - aio_md_cleanup(&arg); + + close(fd); } -ATF_TC(md_poll); +ATF_TC_WITH_CLEANUP(md_poll); ATF_TC_HEAD(md_poll, tc) { @@ -783,8 +587,12 @@ ATF_TC_BODY(md_poll, tc) { aio_md_test(poll); } +ATF_TC_CLEANUP(md_poll, tc) +{ + aio_md_cleanup(); +} -ATF_TC(md_suspend); +ATF_TC_WITH_CLEANUP(md_suspend); ATF_TC_HEAD(md_suspend, tc) { @@ -794,8 +602,12 @@ ATF_TC_BODY(md_suspend, tc) { aio_md_test(suspend); } +ATF_TC_CLEANUP(md_suspend, tc) +{ + aio_md_cleanup(); +} -ATF_TC(md_waitcomplete); +ATF_TC_WITH_CLEANUP(md_waitcomplete); ATF_TC_HEAD(md_waitcomplete, tc) { @@ -804,6 +616,10 @@ ATF_TC_HEAD(md_waitcomplete, tc) ATF_TC_BODY(md_waitcomplete, tc) { aio_md_test(waitcomplete); +} +ATF_TC_CLEANUP(md_waitcomplete, tc) +{ + aio_md_cleanup(); } ATF_TC_WITHOUT_HEAD(aio_large_read_test); From owner-svn-src-head@freebsd.org Thu Jul 13 22:53:15 2017 Return-Path: Delivered-To: svn-src-head@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 3E13EDAFAE2; Thu, 13 Jul 2017 22:53:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D318C67862; Thu, 13 Jul 2017 22:53:14 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DMrDHj023464; Thu, 13 Jul 2017 22:53:13 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DMrDDG023463; Thu, 13 Jul 2017 22:53:13 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707132253.v6DMrDDG023463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 13 Jul 2017 22:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320975 - head/tests/sys/aio X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/aio X-SVN-Commit-Revision: 320975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 22:53:15 -0000 Author: asomers Date: Thu Jul 13 22:53:13 2017 New Revision: 320975 URL: https://svnweb.freebsd.org/changeset/base/320975 Log: Add tests for aio(4) completion notification via signals and threads Reviewed by: jhb MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11468 Modified: head/tests/sys/aio/aio_test.c Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Thu Jul 13 22:49:55 2017 (r320974) +++ head/tests/sys/aio/aio_test.c Thu Jul 13 22:53:13 2017 (r320975) @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -88,7 +89,9 @@ struct aio_context { int ac_seconds; }; +static sem_t completions; + /* * Fill a buffer given a seed that can be fed into srandom() to initialize * the PRNG in a repeatable manner. @@ -166,7 +169,71 @@ poll(struct aiocb *aio) } } +static void +sigusr1_handler(int sig __unused) +{ + ATF_REQUIRE_EQ(0, sem_post(&completions)); +} + +static void +thr_handler(union sigval sv __unused) +{ + ATF_REQUIRE_EQ(0, sem_post(&completions)); +} + static ssize_t +poll_signaled(struct aiocb *aio) +{ + int error; + + ATF_REQUIRE_EQ(0, sem_wait(&completions)); + error = aio_error(aio); + switch (error) { + case EINPROGRESS: + errno = EINTR; + return (-1); + case 0: + return (aio_return(aio)); + default: + return (error); + } +} + +/* + * Setup a signal handler for signal delivery tests + * This isn't thread safe, but it's ok since ATF runs each testcase in a + * separate process + */ +static struct sigevent* +setup_signal(void) +{ + static struct sigevent sev; + + ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); + sev.sigev_notify = SIGEV_SIGNAL; + sev.sigev_signo = SIGUSR1; + ATF_REQUIRE(SIG_ERR != signal(SIGUSR1, sigusr1_handler)); + return (&sev); +} + +/* + * Setup a thread for thread delivery tests + * This isn't thread safe, but it's ok since ATF runs each testcase in a + * separate process + */ +static struct sigevent* +setup_thread() +{ + static struct sigevent sev; + + ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); + sev.sigev_notify = SIGEV_THREAD; + sev.sigev_notify_function = thr_handler; + sev.sigev_notify_attributes = NULL; + return (&sev); +} + +static ssize_t suspend(struct aiocb *aio) { const struct aiocb *const iocbs[] = {aio}; @@ -195,7 +262,7 @@ waitcomplete(struct aiocb *aio) * file descriptor. */ static void -aio_write_test(struct aio_context *ac, completion comp) +aio_write_test(struct aio_context *ac, completion comp, struct sigevent *sev) { struct aiocb aio; ssize_t len; @@ -205,6 +272,8 @@ aio_write_test(struct aio_context *ac, completion comp aio.aio_nbytes = ac->ac_buflen; aio.aio_fildes = ac->ac_write_fd; aio.aio_offset = 0; + if (sev) + aio.aio_sigevent = *sev; if (aio_write(&aio) < 0) atf_tc_fail("aio_write failed: %s", strerror(errno)); @@ -222,7 +291,7 @@ aio_write_test(struct aio_context *ac, completion comp * provided file descriptor. */ static void -aio_read_test(struct aio_context *ac, completion comp) +aio_read_test(struct aio_context *ac, completion comp, struct sigevent *sev) { struct aiocb aio; ssize_t len; @@ -233,6 +302,8 @@ aio_read_test(struct aio_context *ac, completion comp) aio.aio_nbytes = ac->ac_buflen; aio.aio_fildes = ac->ac_read_fd; aio.aio_offset = 0; + if (sev) + aio.aio_sigevent = *sev; if (aio_read(&aio) < 0) atf_tc_fail("aio_read failed: %s", strerror(errno)); @@ -262,7 +333,7 @@ aio_read_test(struct aio_context *ac, completion comp) #define FILE_PATHNAME "testfile" static void -aio_file_test(completion comp) +aio_file_test(completion comp, struct sigevent *sev) { struct aio_context ac; int fd; @@ -274,34 +345,46 @@ aio_file_test(completion comp) ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); aio_context_init(&ac, fd, fd, FILE_LEN); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); close(fd); } ATF_TC_WITHOUT_HEAD(file_poll); ATF_TC_BODY(file_poll, tc) { - aio_file_test(poll); + aio_file_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(file_signal); +ATF_TC_BODY(file_signal, tc) +{ + aio_file_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(file_suspend); ATF_TC_BODY(file_suspend, tc) { - aio_file_test(suspend); + aio_file_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(file_thread); +ATF_TC_BODY(file_thread, tc) +{ + aio_file_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(file_waitcomplete); ATF_TC_BODY(file_waitcomplete, tc) { - aio_file_test(waitcomplete); + aio_file_test(waitcomplete, NULL); } #define FIFO_LEN 256 #define FIFO_PATHNAME "testfifo" static void -aio_fifo_test(completion comp) +aio_fifo_test(completion comp, struct sigevent *sev) { int error, read_fd = -1, write_fd = -1; struct aio_context ac; @@ -329,8 +412,8 @@ aio_fifo_test(completion comp) } aio_context_init(&ac, read_fd, write_fd, FIFO_LEN); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); close(read_fd); close(write_fd); @@ -339,24 +422,36 @@ aio_fifo_test(completion comp) ATF_TC_WITHOUT_HEAD(fifo_poll); ATF_TC_BODY(fifo_poll, tc) { - aio_fifo_test(poll); + aio_fifo_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(fifo_signal); +ATF_TC_BODY(fifo_signal, tc) +{ + aio_fifo_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(fifo_suspend); ATF_TC_BODY(fifo_suspend, tc) { - aio_fifo_test(suspend); + aio_fifo_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(fifo_thread); +ATF_TC_BODY(fifo_thread, tc) +{ + aio_fifo_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); ATF_TC_BODY(fifo_waitcomplete, tc) { - aio_fifo_test(waitcomplete); + aio_fifo_test(waitcomplete, NULL); } #define UNIX_SOCKETPAIR_LEN 256 static void -aio_unix_socketpair_test(completion comp) +aio_unix_socketpair_test(completion comp, struct sigevent *sev) { struct aio_context ac; struct rusage ru_before, ru_after; @@ -370,12 +465,12 @@ aio_unix_socketpair_test(completion comp) aio_context_init(&ac, sockets[0], sockets[1], UNIX_SOCKETPAIR_LEN); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, "getrusage failed: %s", strerror(errno)); - aio_write_test(&ac, comp); + aio_write_test(&ac, comp, sev); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgsnd == ru_before.ru_msgsnd + 1); ru_before = ru_after; - aio_read_test(&ac, comp); + aio_read_test(&ac, comp, sev); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); @@ -387,19 +482,31 @@ aio_unix_socketpair_test(completion comp) ATF_TC_WITHOUT_HEAD(socket_poll); ATF_TC_BODY(socket_poll, tc) { - aio_unix_socketpair_test(poll); + aio_unix_socketpair_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(socket_signal); +ATF_TC_BODY(socket_signal, tc) +{ + aio_unix_socketpair_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(socket_suspend); ATF_TC_BODY(socket_suspend, tc) { - aio_unix_socketpair_test(suspend); + aio_unix_socketpair_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(socket_thread); +ATF_TC_BODY(socket_thread, tc) +{ + aio_unix_socketpair_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(socket_waitcomplete); ATF_TC_BODY(socket_waitcomplete, tc) { - aio_unix_socketpair_test(waitcomplete); + aio_unix_socketpair_test(waitcomplete, NULL); } struct aio_pty_arg { @@ -409,7 +516,7 @@ struct aio_pty_arg { #define PTY_LEN 256 static void -aio_pty_test(completion comp) +aio_pty_test(completion comp, struct sigevent *sev) { struct aio_context ac; int read_fd, write_fd; @@ -436,8 +543,8 @@ aio_pty_test(completion comp) } aio_context_init(&ac, read_fd, write_fd, PTY_LEN); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); close(read_fd); close(write_fd); @@ -446,24 +553,36 @@ aio_pty_test(completion comp) ATF_TC_WITHOUT_HEAD(pty_poll); ATF_TC_BODY(pty_poll, tc) { - aio_pty_test(poll); + aio_pty_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(pty_signal); +ATF_TC_BODY(pty_signal, tc) +{ + aio_pty_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(pty_suspend); ATF_TC_BODY(pty_suspend, tc) { - aio_pty_test(suspend); + aio_pty_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(pty_thread); +ATF_TC_BODY(pty_thread, tc) +{ + aio_pty_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(pty_waitcomplete); ATF_TC_BODY(pty_waitcomplete, tc) { - aio_pty_test(waitcomplete); + aio_pty_test(waitcomplete, NULL); } #define PIPE_LEN 256 static void -aio_pipe_test(completion comp) +aio_pipe_test(completion comp, struct sigevent *sev) { struct aio_context ac; int pipes[2]; @@ -475,8 +594,8 @@ aio_pipe_test(completion comp) "pipe failed: %s", strerror(errno)); aio_context_init(&ac, pipes[0], pipes[1], PIPE_LEN); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); close(pipes[0]); close(pipes[1]); @@ -485,19 +604,31 @@ aio_pipe_test(completion comp) ATF_TC_WITHOUT_HEAD(pipe_poll); ATF_TC_BODY(pipe_poll, tc) { - aio_pipe_test(poll); + aio_pipe_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(pipe_signal); +ATF_TC_BODY(pipe_signal, tc) +{ + aio_pipe_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(pipe_suspend); ATF_TC_BODY(pipe_suspend, tc) { - aio_pipe_test(suspend); + aio_pipe_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(pipe_thread); +ATF_TC_BODY(pipe_thread, tc) +{ + aio_pipe_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(pipe_waitcomplete); ATF_TC_BODY(pipe_waitcomplete, tc) { - aio_pipe_test(waitcomplete); + aio_pipe_test(waitcomplete, NULL); } #define MD_LEN GLOBAL_MAX @@ -532,7 +663,7 @@ aio_md_cleanup(void) } static void -aio_md_test(completion comp) +aio_md_test(completion comp, struct sigevent *sev) { int error, fd, mdctl_fd, unit; char pathname[PATH_MAX]; @@ -571,8 +702,8 @@ aio_md_test(completion comp) "opening %s failed: %s", pathname, strerror(errno)); aio_context_init(&ac, fd, fd, MD_LEN); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); close(fd); } @@ -585,13 +716,28 @@ ATF_TC_HEAD(md_poll, tc) } ATF_TC_BODY(md_poll, tc) { - aio_md_test(poll); + aio_md_test(poll, NULL); } ATF_TC_CLEANUP(md_poll, tc) { aio_md_cleanup(); } +ATF_TC_WITH_CLEANUP(md_signal); +ATF_TC_HEAD(md_signal, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_signal, tc) +{ + aio_md_test(poll_signaled, setup_signal()); +} +ATF_TC_CLEANUP(md_signal, tc) +{ + aio_md_cleanup(); +} + ATF_TC_WITH_CLEANUP(md_suspend); ATF_TC_HEAD(md_suspend, tc) { @@ -600,13 +746,28 @@ ATF_TC_HEAD(md_suspend, tc) } ATF_TC_BODY(md_suspend, tc) { - aio_md_test(suspend); + aio_md_test(suspend, NULL); } ATF_TC_CLEANUP(md_suspend, tc) { aio_md_cleanup(); } +ATF_TC_WITH_CLEANUP(md_thread); +ATF_TC_HEAD(md_thread, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_thread, tc) +{ + aio_md_test(poll_signaled, setup_thread()); +} +ATF_TC_CLEANUP(md_thread, tc) +{ + aio_md_cleanup(); +} + ATF_TC_WITH_CLEANUP(md_waitcomplete); ATF_TC_HEAD(md_waitcomplete, tc) { @@ -615,7 +776,7 @@ ATF_TC_HEAD(md_waitcomplete, tc) } ATF_TC_BODY(md_waitcomplete, tc) { - aio_md_test(waitcomplete); + aio_md_test(waitcomplete, NULL); } ATF_TC_CLEANUP(md_waitcomplete, tc) { @@ -968,28 +1129,40 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, file_poll); + ATF_TP_ADD_TC(tp, file_signal); ATF_TP_ADD_TC(tp, file_suspend); + ATF_TP_ADD_TC(tp, file_thread); ATF_TP_ADD_TC(tp, file_waitcomplete); ATF_TP_ADD_TC(tp, fifo_poll); + ATF_TP_ADD_TC(tp, fifo_signal); ATF_TP_ADD_TC(tp, fifo_suspend); + ATF_TP_ADD_TC(tp, fifo_thread); ATF_TP_ADD_TC(tp, fifo_waitcomplete); ATF_TP_ADD_TC(tp, socket_poll); + ATF_TP_ADD_TC(tp, socket_signal); ATF_TP_ADD_TC(tp, socket_suspend); + ATF_TP_ADD_TC(tp, socket_thread); ATF_TP_ADD_TC(tp, socket_waitcomplete); ATF_TP_ADD_TC(tp, pty_poll); + ATF_TP_ADD_TC(tp, pty_signal); ATF_TP_ADD_TC(tp, pty_suspend); + ATF_TP_ADD_TC(tp, pty_thread); ATF_TP_ADD_TC(tp, pty_waitcomplete); ATF_TP_ADD_TC(tp, pipe_poll); + ATF_TP_ADD_TC(tp, pipe_signal); ATF_TP_ADD_TC(tp, pipe_suspend); + ATF_TP_ADD_TC(tp, pipe_thread); ATF_TP_ADD_TC(tp, pipe_waitcomplete); ATF_TP_ADD_TC(tp, md_poll); + ATF_TP_ADD_TC(tp, md_signal); ATF_TP_ADD_TC(tp, md_suspend); + ATF_TP_ADD_TC(tp, md_thread); ATF_TP_ADD_TC(tp, md_waitcomplete); + ATF_TP_ADD_TC(tp, aio_fsync_test); ATF_TP_ADD_TC(tp, aio_large_read_test); ATF_TP_ADD_TC(tp, aio_socket_two_reads); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); ATF_TP_ADD_TC(tp, aio_socket_short_write_cancel); - ATF_TP_ADD_TC(tp, aio_fsync_test); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Fri Jul 14 00:10:52 2017 Return-Path: Delivered-To: svn-src-head@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 F0140DB11F5; Fri, 14 Jul 2017 00:10:52 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 CA7AA6AEFA; Fri, 14 Jul 2017 00:10:52 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6E0ApLh052895; Fri, 14 Jul 2017 00:10:51 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6E0ApLQ052889; Fri, 14 Jul 2017 00:10:51 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201707140010.v6E0ApLQ052889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 14 Jul 2017 00:10:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320977 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 320977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 00:10:53 -0000 Author: rlibby Date: Fri Jul 14 00:10:51 2017 New Revision: 320977 URL: https://svnweb.freebsd.org/changeset/base/320977 Log: ixl: gcc build errors Fix minor -Werror issues when building with gcc from -Wredundant-decls, -Wunused, -Wbool-operations. Also ensure the M_IXL malloc type is only defined once. Reviewed by: efj Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11414 Modified: head/sys/dev/ixl/i40e_prototype.h head/sys/dev/ixl/if_ixlv.c head/sys/dev/ixl/ixl.h head/sys/dev/ixl/ixl_pf.h head/sys/dev/ixl/ixl_pf_main.c head/sys/dev/ixl/ixl_txrx.c Modified: head/sys/dev/ixl/i40e_prototype.h ============================================================================== --- head/sys/dev/ixl/i40e_prototype.h Thu Jul 13 23:48:05 2017 (r320976) +++ head/sys/dev/ixl/i40e_prototype.h Fri Jul 14 00:10:51 2017 (r320977) @@ -538,6 +538,4 @@ enum i40e_status_code i40e_read_phy_register(struct i4 enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw, u8 page, u16 reg, u8 phy_addr, u16 value); u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num); -enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw, - u32 time, u32 interval); #endif /* _I40E_PROTOTYPE_H_ */ Modified: head/sys/dev/ixl/if_ixlv.c ============================================================================== --- head/sys/dev/ixl/if_ixlv.c Thu Jul 13 23:48:05 2017 (r320976) +++ head/sys/dev/ixl/if_ixlv.c Fri Jul 14 00:10:51 2017 (r320977) @@ -1074,7 +1074,7 @@ retry_send: if (error == ETIMEDOUT) { if (!send_api_ver_retried) { /* Resend message, one more time */ - send_api_ver_retried++; + send_api_ver_retried = true; device_printf(dev, "%s: Timeout while verifying API version on first" " try!\n", __func__); Modified: head/sys/dev/ixl/ixl.h ============================================================================== --- head/sys/dev/ixl/ixl.h Thu Jul 13 23:48:05 2017 (r320976) +++ head/sys/dev/ixl/ixl.h Fri Jul 14 00:10:51 2017 (r320977) @@ -664,8 +664,7 @@ struct ixl_sysctl_info { char *description; }; -static uint8_t ixl_bcast_addr[ETHER_ADDR_LEN] = - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +extern const uint8_t ixl_bcast_addr[ETHER_ADDR_LEN]; /********************************************************************* * TXRX Function prototypes Modified: head/sys/dev/ixl/ixl_pf.h ============================================================================== --- head/sys/dev/ixl/ixl_pf.h Thu Jul 13 23:48:05 2017 (r320976) +++ head/sys/dev/ixl/ixl_pf.h Fri Jul 14 00:10:51 2017 (r320977) @@ -168,16 +168,9 @@ struct ixl_pf { "\nExecutes a \"Get Link Status\" command on the Admin Queue, and displays" \ " the response." \ -static char *ixl_fc_string[6] = { - "None", - "Rx", - "Tx", - "Full", - "Priority", - "Default" -}; +extern const char * const ixl_fc_string[6]; -static MALLOC_DEFINE(M_IXL, "ixl", "ixl driver allocations"); +MALLOC_DECLARE(M_IXL); /*** Functions / Macros ***/ /* Adjust the level here to 10 or over to print stats messages */ @@ -299,8 +292,8 @@ int ixl_rebuild_hw_structs_after_reset(struct ixl_pf * void ixl_set_queue_rx_itr(struct ixl_queue *); void ixl_set_queue_tx_itr(struct ixl_queue *); -void ixl_add_filter(struct ixl_vsi *, u8 *, s16 vlan); -void ixl_del_filter(struct ixl_vsi *, u8 *, s16 vlan); +void ixl_add_filter(struct ixl_vsi *, const u8 *, s16 vlan); +void ixl_del_filter(struct ixl_vsi *, const u8 *, s16 vlan); void ixl_reconfigure_filters(struct ixl_vsi *vsi); int ixl_disable_rings(struct ixl_vsi *); @@ -331,7 +324,7 @@ void ixl_init_filters(struct ixl_vsi *); void ixl_add_hw_filters(struct ixl_vsi *, int, int); void ixl_del_hw_filters(struct ixl_vsi *, int); struct ixl_mac_filter * - ixl_find_filter(struct ixl_vsi *, u8 *, s16); + ixl_find_filter(struct ixl_vsi *, const u8 *, s16); void ixl_add_mc_filter(struct ixl_vsi *, u8 *); void ixl_free_mac_filters(struct ixl_vsi *vsi); void ixl_update_vsi_stats(struct ixl_vsi *); Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Thu Jul 13 23:48:05 2017 (r320976) +++ head/sys/dev/ixl/ixl_pf_main.c Fri Jul 14 00:10:51 2017 (r320977) @@ -89,6 +89,20 @@ static int ixl_sysctl_qrx_tail_handler(SYSCTL_HANDLER_ extern int ixl_enable_iwarp; #endif +const uint8_t ixl_bcast_addr[ETHER_ADDR_LEN] = + {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +const char * const ixl_fc_string[6] = { + "None", + "Rx", + "Tx", + "Full", + "Priority", + "Default" +}; + +MALLOC_DEFINE(M_IXL, "ixl", "ixl driver allocations"); + void ixl_debug_core(struct ixl_pf *pf, enum ixl_dbg_mask mask, char *fmt, ...) { @@ -3193,7 +3207,7 @@ ixl_reconfigure_filters(struct ixl_vsi *vsi) ** This routine adds macvlan filters */ void -ixl_add_filter(struct ixl_vsi *vsi, u8 *macaddr, s16 vlan) +ixl_add_filter(struct ixl_vsi *vsi, const u8 *macaddr, s16 vlan) { struct ixl_mac_filter *f, *tmp; struct ixl_pf *pf; @@ -3239,7 +3253,7 @@ ixl_add_filter(struct ixl_vsi *vsi, u8 *macaddr, s16 v } void -ixl_del_filter(struct ixl_vsi *vsi, u8 *macaddr, s16 vlan) +ixl_del_filter(struct ixl_vsi *vsi, const u8 *macaddr, s16 vlan) { struct ixl_mac_filter *f; @@ -3264,7 +3278,7 @@ ixl_del_filter(struct ixl_vsi *vsi, u8 *macaddr, s16 v ** Find the filter with both matching mac addr and vlan id */ struct ixl_mac_filter * -ixl_find_filter(struct ixl_vsi *vsi, u8 *macaddr, s16 vlan) +ixl_find_filter(struct ixl_vsi *vsi, const u8 *macaddr, s16 vlan) { struct ixl_mac_filter *f; bool match = FALSE; Modified: head/sys/dev/ixl/ixl_txrx.c ============================================================================== --- head/sys/dev/ixl/ixl_txrx.c Thu Jul 13 23:48:05 2017 (r320976) +++ head/sys/dev/ixl/ixl_txrx.c Fri Jul 14 00:10:51 2017 (r320977) @@ -63,8 +63,6 @@ static inline void ixl_rx_input(struct rx_ring *, stru struct mbuf *, u8); static inline bool ixl_tso_detect_sparse(struct mbuf *mp); -static int ixl_tx_setup_offload(struct ixl_queue *que, - struct mbuf *mp, u32 *cmd, u32 *off); static inline u32 ixl_get_tx_head(struct ixl_queue *que); #ifdef DEV_NETMAP From owner-svn-src-head@freebsd.org Fri Jul 14 01:17:03 2017 Return-Path: Delivered-To: svn-src-head@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 D1428DB24E4; Fri, 14 Jul 2017 01:17:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 919F26FE4C; Fri, 14 Jul 2017 01:17:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22c.google.com with SMTP id v17so58936191qka.3; Thu, 13 Jul 2017 18:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4t/b+5mG/cAKM5yEQ0PpaTjnmSQ+qcDKaAGJ4TqNE5c=; b=lvZOPgquhFM0bCzQd3DfiBtkUCrOgKzHea9oTOlbQ2Y6V4cjXIg+OFsQgm7hcr0nhE bIiSAq4TVbUa2U/Avl/y40hiFRe8xDCzkiMWOgjJW+Nu3M9QuwV1EsHSIcADEuOKX96L tBtjBQgx2c+nbFJXUJJYGs6nYdbpXyl/IQhLNElNhO6O7yH/tBxuprfjzLWb4tD0bQp6 gG97blnSC7xceDLv9tJZN4qqRe8Jnb/fIzZXuThwNUo9IvNI3jNNL941HeYx0o281dYV VCXySw9raaSMndylTh8wkwXoswt+2J8HYim6AzneHjin2rx3q833t5kYwBSPrS4CJl0y HgiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4t/b+5mG/cAKM5yEQ0PpaTjnmSQ+qcDKaAGJ4TqNE5c=; b=DmN2jKfF20CLeTgf/fBm+m2EPMS7+4FKwNfuPGI8lZ1T7emYvDY1nA8V1oQ99/xhHj OEHa1yF4QgoJ1xtWgaeCIsuqtfr7hk5TtoLLxR+gR2bgYD/AXosRcti5IKQPczHLe/jL CaIN50TpFXDCwY7hM40Nf8i3n51nU/dyznMDzosRZObrfIlL/AitBiCWOYExQHBFGDUZ Xwi/i8kEJyNPbd03gU9haNqG7R8N71Ba7jA/Oyq8jsyxpu7Qldy5F1HJvf1GoEUAvAoV C6EozWHf0ojdyuvx8J3g9eoTo6q6L6RdQ0Qkhdj1isWB36tImMpYasntxX+Ntk8mta2R GDjQ== X-Gm-Message-State: AIVw11101OBPVVRf29UUaFKnON5DRuHvEq7o5MkuNVxulzc5eMsaStMu 6b2YK0qWKB+Qsp9MV6A0L7dO+oxNeo4x X-Received: by 10.55.150.193 with SMTP id y184mr8467603qkd.113.1499995022224; Thu, 13 Jul 2017 18:17:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.92.142 with HTTP; Thu, 13 Jul 2017 18:17:01 -0700 (PDT) In-Reply-To: <201707140010.v6E0ApLQ052889@repo.freebsd.org> References: <201707140010.v6E0ApLQ052889@repo.freebsd.org> From: Ngie Cooper Date: Thu, 13 Jul 2017 18:17:01 -0700 Message-ID: Subject: Re: svn commit: r320977 - head/sys/dev/ixl To: Ryan Libby Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Eric Joyner Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 01:17:03 -0000 On Thu, Jul 13, 2017 at 5:10 PM, Ryan Libby wrote: > Author: rlibby > Date: Fri Jul 14 00:10:51 2017 > New Revision: 320977 > URL: https://svnweb.freebsd.org/changeset/base/320977 ... > +const char * const ixl_fc_string[6] = { > + "None", > + "Rx", > + "Tx", > + "Full", > + "Priority", > + "Default" > +}; This should use flexible arrays, e.g., const char * const ixl_fc_string[] = { "None", ... }; -Ngie From owner-svn-src-head@freebsd.org Fri Jul 14 02:15:49 2017 Return-Path: Delivered-To: svn-src-head@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 CA405DB2F7C; Fri, 14 Jul 2017 02:15:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 948ED71663; Fri, 14 Jul 2017 02:15:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6E2FmVq005608; Fri, 14 Jul 2017 02:15:48 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6E2Fmwr005605; Fri, 14 Jul 2017 02:15:48 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707140215.v6E2Fmwr005605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 14 Jul 2017 02:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320980 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 320980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 02:15:49 -0000 Author: alc Date: Fri Jul 14 02:15:48 2017 New Revision: 320980 URL: https://svnweb.freebsd.org/changeset/base/320980 Log: Generalize vm_page_ps_is_valid() to support testing other predicates on the (super)page, renaming the function to vm_page_ps_test(). Reviewed by: kib, markj MFC after: 1 week Modified: head/sys/vm/vm_map.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Fri Jul 14 01:45:43 2017 (r320979) +++ head/sys/vm/vm_map.c Fri Jul 14 02:15:48 2017 (r320980) @@ -1962,7 +1962,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_p (pagesizes[p->psind] - 1)) == 0) { mask = atop(pagesizes[p->psind]) - 1; if (tmpidx + mask < psize && - vm_page_ps_is_valid(p)) { + vm_page_ps_test(p, PS_ALL_VALID, NULL)) { p += mask; threshold += mask; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Jul 14 01:45:43 2017 (r320979) +++ head/sys/vm/vm_page.c Fri Jul 14 02:15:48 2017 (r320980) @@ -3472,12 +3472,11 @@ vm_page_is_valid(vm_page_t m, int base, int size) } /* - * vm_page_ps_is_valid: - * - * Returns TRUE if the entire (super)page is valid and FALSE otherwise. + * Returns true if all of the specified predicates are true for the entire + * (super)page and false otherwise. */ -boolean_t -vm_page_ps_is_valid(vm_page_t m) +bool +vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m) { int i, npages; @@ -3490,10 +3489,25 @@ vm_page_ps_is_valid(vm_page_t m) * occupy adjacent entries in vm_page_array[]. */ for (i = 0; i < npages; i++) { - if (m[i].valid != VM_PAGE_BITS_ALL) - return (FALSE); + if (&m[i] == skip_m) + continue; + if ((flags & PS_NONE_BUSY) != 0 && vm_page_busied(&m[i])) + return (false); + if ((flags & PS_ALL_DIRTY) != 0) { + /* + * Calling vm_page_test_dirty() or pmap_is_modified() + * might stop this case from spuriously returning + * "false". However, that would require a write lock + * on the object containing "m[i]". + */ + if (m[i].dirty != VM_PAGE_BITS_ALL) + return (false); + } + if ((flags & PS_ALL_VALID) != 0 && + m[i].valid != VM_PAGE_BITS_ALL) + return (false); } - return (TRUE); + return (true); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Fri Jul 14 01:45:43 2017 (r320979) +++ head/sys/vm/vm_page.h Fri Jul 14 02:15:48 2017 (r320980) @@ -438,6 +438,18 @@ malloc2vm_flags(int malloc_flags) } #endif +/* + * Predicates supported by vm_page_ps_test(): + * + * PS_ALL_DIRTY is true only if the entire (super)page is dirty. + * However, it can be spuriously false when the (super)page has become + * dirty in the pmap but that information has not been propagated to the + * machine-independent layer. + */ +#define PS_ALL_DIRTY 0x1 +#define PS_ALL_VALID 0x2 +#define PS_NONE_BUSY 0x4 + void vm_page_busy_downgrade(vm_page_t m); void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); void vm_page_flash(vm_page_t m); @@ -469,7 +481,7 @@ vm_page_t vm_page_next(vm_page_t m); int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *); struct vm_pagequeue *vm_page_pagequeue(vm_page_t m); vm_page_t vm_page_prev(vm_page_t m); -boolean_t vm_page_ps_is_valid(vm_page_t m); +bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m); void vm_page_putfake(vm_page_t m); void vm_page_readahead_finish(vm_page_t m); bool vm_page_reclaim_contig(int req, u_long npages, vm_paddr_t low, From owner-svn-src-head@freebsd.org Fri Jul 14 02:33:18 2017 Return-Path: Delivered-To: svn-src-head@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 0B7D5DB3538; Fri, 14 Jul 2017 02:33:18 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-wr0-x232.google.com (mail-wr0-x232.google.com [IPv6:2a00:1450:400c:c0c::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9950671E58; Fri, 14 Jul 2017 02:33:17 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-wr0-x232.google.com with SMTP id 48so262714wrz.0; Thu, 13 Jul 2017 19:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BIGeHjLkb18461yMKujNDXufpPuaiBsA4qJJ2UjDKqA=; b=QXNzBqAbJLvIeV67pxzC9NUi/wOGjC3rivljjIuKPrOKs+CI28Hmq5+wK0m9SZdWmn AEPcTxrn6pwB/2m4x+HxOJSoSfoO36WsfzuEOoUlKAyLnS0/J+FipxVjldMYr7Vu4m4J 8wJAtJ0TXelwQKDHj4ugECyDP878M40G7xVD0qsiLfCnzfCY7whXsk66o2mgfkRkUEWv VwiCw5W5zbAmG/5kDV72AAWDAFBFbYv9bV87WL5GuOZ2LVtpR9Td+sVei0Np6UQvRmwN 6DaOibCO5KtHdffAoFgsAM1gnxNw9RGhbcDc7AX+zacmaC0vnl3r7xRzQYUjlHfgwgBf QDRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BIGeHjLkb18461yMKujNDXufpPuaiBsA4qJJ2UjDKqA=; b=CZyJh31q5UG1GP+YY16hy+KUVSGNnDL6KZ8UQt7QSh1C4OVOcLs5g5S7wQYaysEjP8 QVTl1aRDjuuLl7oWDUMnKzRK00GUB22NRMHEdXPmkr8Lm6wZEzRSkvl6Q43lCddBpr+T 2fon0C3QOi0FJ5qc34aXJYCoPdh89RMs/FiX5zcmg8+dZ1oH7Oh7xznsy6qkSGyQBmNt l/CsxHGU/zBUqp4b4Ck91iTmcAzmp4rCUr+7TZy/IHa4Igoln7RT//JAE96ph8E0gG54 PxXk+PiR2b6CC3cR8Z5SDT/FmR3//I8LcOTFHZ6aLqJ3H9eM7HChClY1cf/z3j99Y4TV eKag== X-Gm-Message-State: AIVw111KlvNTiU+wfDMfcpm/qXG7FYFVNxNqr+S1toeRHsI6BlkjAzV6 uKpjsPIsr8S8eBM07o29oMEz035f5Nth X-Received: by 10.223.129.163 with SMTP id 32mr3709014wra.185.1499999595604; Thu, 13 Jul 2017 19:33:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.161.81 with HTTP; Thu, 13 Jul 2017 19:33:14 -0700 (PDT) In-Reply-To: References: <201707140010.v6E0ApLQ052889@repo.freebsd.org> From: Ryan Libby Date: Thu, 13 Jul 2017 19:33:14 -0700 Message-ID: Subject: Re: svn commit: r320977 - head/sys/dev/ixl To: Ngie Cooper Cc: Ryan Libby , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Eric Joyner Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 02:33:18 -0000 On Thu, Jul 13, 2017 at 6:17 PM, Ngie Cooper wrote: > On Thu, Jul 13, 2017 at 5:10 PM, Ryan Libby wrote: >> Author: rlibby >> Date: Fri Jul 14 00:10:51 2017 >> New Revision: 320977 >> URL: https://svnweb.freebsd.org/changeset/base/320977 > > ... > >> +const char * const ixl_fc_string[6] = { >> + "None", >> + "Rx", >> + "Tx", >> + "Full", >> + "Priority", >> + "Default" >> +}; > > This should use flexible arrays, e.g., > > const char * const ixl_fc_string[] = { > "None", > ... > }; > > -Ngie Since this is status quo and a style point, I think I will leave this to erj's judgement. Ryan From owner-svn-src-head@freebsd.org Fri Jul 14 09:34:46 2017 Return-Path: Delivered-To: svn-src-head@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 16C61D9C3C1; Fri, 14 Jul 2017 09:34:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E659983DCA; Fri, 14 Jul 2017 09:34:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6E9Yivi086295; Fri, 14 Jul 2017 09:34:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6E9Yivq086290; Fri, 14 Jul 2017 09:34:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707140934.v6E9Yivq086290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Jul 2017 09:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320982 - in head/sys: compat/freebsd32 kern netinet sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern netinet sys X-SVN-Commit-Revision: 320982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 09:34:46 -0000 Author: kib Date: Fri Jul 14 09:34:44 2017 New Revision: 320982 URL: https://svnweb.freebsd.org/changeset/base/320982 Log: Correct sysent flags for dynamically loaded syscalls. Using the https://github.com/google/capsicum-test/ suite, the PosixMqueue.CapModeForked test was failing due to an ECAPMODE after calling kmq_notify(). On further inspection, the dynamically loaded syscall entry was initialized with sy_flags zeroed out, since SYSCALL_INIT_HELPER() left sysent.sy_flags with the default value. Add a new helper SYSCALL{,32}_INIT_HELPER_F() which takes an additional argument to specify the sy_flags value. Submitted by: Siva Mahadevan Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D11576 Modified: head/sys/compat/freebsd32/freebsd32_util.h head/sys/kern/capabilities.conf head/sys/kern/uipc_mqueue.c head/sys/netinet/sctp_syscalls.c head/sys/sys/sysent.h Modified: head/sys/compat/freebsd32/freebsd32_util.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_util.h Fri Jul 14 07:42:57 2017 (r320981) +++ head/sys/compat/freebsd32/freebsd32_util.h Fri Jul 14 09:34:44 2017 (r320982) @@ -79,23 +79,30 @@ SYSCALL32_MODULE(syscallname, & syscallname##_syscall32, & syscallname##_sysent32,\ NULL, NULL); -#define SYSCALL32_INIT_HELPER(syscallname) { \ +#define SYSCALL32_INIT_HELPER_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = FREEBSD32_SYS_##syscallname \ } -#define SYSCALL32_INIT_HELPER_COMPAT(syscallname) { \ +#define SYSCALL32_INIT_HELPER_COMPAT_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& sys_ ## syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = FREEBSD32_SYS_##syscallname \ } + +#define SYSCALL32_INIT_HELPER(syscallname) \ + SYSCALL32_INIT_HELPER_F(syscallname, 0) +#define SYSCALL32_INIT_HELPER_COMPAT(syscallname) \ + SYSCALL32_INIT_HELPER_COMPAT_F(syscallname, 0) int syscall32_register(int *offset, struct sysent *new_sysent, struct sysent *old_sysent, int flags); Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Fri Jul 14 07:42:57 2017 (r320981) +++ head/sys/kern/capabilities.conf Fri Jul 14 09:34:44 2017 (r320982) @@ -350,6 +350,8 @@ kill ## ## Allow message queue operations on file descriptors, subject to capability ## rights. +## NOTE: Corresponding sysents are initialized in sys/kern/uipc_mqueue.c with +## SYF_CAPENABLED. ## kmq_notify kmq_setattr @@ -545,6 +547,8 @@ sched_yield ## ## Allow I/O-related file descriptors, subject to capability rights. +## NOTE: Corresponding sysents are initialized in sys/netinet/sctp_syscalls.c +## with SYF_CAPENABLED. ## sctp_generic_recvmsg sctp_generic_sendmsg Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Fri Jul 14 07:42:57 2017 (r320981) +++ head/sys/kern/uipc_mqueue.c Fri Jul 14 09:34:44 2017 (r320982) @@ -2708,10 +2708,10 @@ static struct vfsconf mqueuefs_vfsconf = { static struct syscall_helper_data mq_syscalls[] = { SYSCALL_INIT_HELPER(kmq_open), - SYSCALL_INIT_HELPER(kmq_setattr), - SYSCALL_INIT_HELPER(kmq_timedsend), - SYSCALL_INIT_HELPER(kmq_timedreceive), - SYSCALL_INIT_HELPER(kmq_notify), + SYSCALL_INIT_HELPER_F(kmq_setattr, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(kmq_timedsend, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(kmq_timedreceive, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(kmq_notify, SYF_CAPENABLED), SYSCALL_INIT_HELPER(kmq_unlink), SYSCALL_INIT_LAST }; @@ -2870,10 +2870,10 @@ freebsd32_kmq_notify(struct thread *td, struct freebsd static struct syscall_helper_data mq32_syscalls[] = { SYSCALL32_INIT_HELPER(freebsd32_kmq_open), - SYSCALL32_INIT_HELPER(freebsd32_kmq_setattr), - SYSCALL32_INIT_HELPER(freebsd32_kmq_timedsend), - SYSCALL32_INIT_HELPER(freebsd32_kmq_timedreceive), - SYSCALL32_INIT_HELPER(freebsd32_kmq_notify), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_setattr, SYF_CAPENABLED), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_timedsend, SYF_CAPENABLED), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_timedreceive, SYF_CAPENABLED), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_notify, SYF_CAPENABLED), SYSCALL32_INIT_HELPER_COMPAT(kmq_unlink), SYSCALL_INIT_LAST }; Modified: head/sys/netinet/sctp_syscalls.c ============================================================================== --- head/sys/netinet/sctp_syscalls.c Fri Jul 14 07:42:57 2017 (r320981) +++ head/sys/netinet/sctp_syscalls.c Fri Jul 14 09:34:44 2017 (r320982) @@ -82,10 +82,10 @@ __FBSDID("$FreeBSD$"); #include static struct syscall_helper_data sctp_syscalls[] = { - SYSCALL_INIT_HELPER(sctp_peeloff), - SYSCALL_INIT_HELPER(sctp_generic_sendmsg), - SYSCALL_INIT_HELPER(sctp_generic_sendmsg_iov), - SYSCALL_INIT_HELPER(sctp_generic_recvmsg), + SYSCALL_INIT_HELPER_F(sctp_peeloff, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(sctp_generic_sendmsg, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(sctp_generic_sendmsg_iov, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(sctp_generic_recvmsg, SYF_CAPENABLED), SYSCALL_INIT_LAST }; Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Fri Jul 14 07:42:57 2017 (r320981) +++ head/sys/sys/sysent.h Fri Jul 14 09:34:44 2017 (r320982) @@ -230,24 +230,30 @@ struct syscall_helper_data { int syscall_no; int registered; }; -#define SYSCALL_INIT_HELPER(syscallname) { \ +#define SYSCALL_INIT_HELPER_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& sys_ ## syscallname, \ - .sy_auevent = SYS_AUE_##syscallname \ + .sy_auevent = SYS_AUE_##syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = SYS_##syscallname \ } -#define SYSCALL_INIT_HELPER_COMPAT(syscallname) { \ +#define SYSCALL_INIT_HELPER_COMPAT_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& syscallname, \ - .sy_auevent = SYS_AUE_##syscallname \ + .sy_auevent = SYS_AUE_##syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = SYS_##syscallname \ } +#define SYSCALL_INIT_HELPER(syscallname) \ + SYSCALL_INIT_HELPER_F(syscallname, 0) +#define SYSCALL_INIT_HELPER_COMPAT(syscallname) \ + SYSCALL_INIT_HELPER_COMPAT_F(syscallname, 0) #define SYSCALL_INIT_LAST { \ .syscall_no = NO_SYSCALL \ } From owner-svn-src-head@freebsd.org Fri Jul 14 10:00:01 2017 Return-Path: Delivered-To: svn-src-head@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 4A189D9CEAB; Fri, 14 Jul 2017 10:00:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id E42E184C2B; Fri, 14 Jul 2017 10:00:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 343DB1049191; Fri, 14 Jul 2017 19:33:29 +1000 (AEST) Date: Fri, 14 Jul 2017 19:33:28 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: rgrimes@freebsd.org cc: John Baldwin , Ian Lepore , Edward Tomasz Napierala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320803 - head/sbin/mount In-Reply-To: <201707131911.v6DJBTMC090066@pdx.rh.CN85.dnsmgr.net> Message-ID: <20170714181053.F1041@besplex.bde.org> References: <201707131911.v6DJBTMC090066@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=idEcj6YchW-8Py-0DSwA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 10:00:01 -0000 On Thu, 13 Jul 2017, Rodney W. Grimes wrote: >> On Tuesday, July 11, 2017 02:35:15 PM Ian Lepore wrote: >>> I think the docs on this are pretty clear... under -u it says: >>> >>> The set of options is determined by applying the options specified >>> in the argument to -o and finally applying the -r or -w option. > ... > > To shed some light on all of this I did the dig to find the original > documentaton on mount -u, which actually makes it rather clear what > and how things should be happening. Somehow this has been lost over > the years: > csrg change to mount.c adding -u > https://svnweb.freebsd.org/csrg/sbin/mount/mount.c?r1=39329&r2=39333 > > csrg change to mount.8 documenting -u > https://svnweb.freebsd.org/csrg/sbin/mount/mount.8?r1=39328&r2=39466 > This documenting of -u clearly states that /etc/fstab shall be > consulted during a mount -u, some place we lost that. FreeBSD intentionally removed this in the change that added -o fstab and -o current: X Index: mount.8 X =================================================================== X RCS file: /home/ncvs/src/sbin/mount/mount.8,v X retrieving revision 1.25 X retrieving revision 1.26 X diff -u -1 -r1.25 -r1.26 X --- mount.8 8 Apr 1999 13:59:42 -0000 1.25 X +++ mount.8 7 May 1999 05:22:07 -0000 1.26 X @@ -32,3 +32,3 @@ X .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 X -.\" $Id: mount.8,v 1.24 1998/10/16 00:06:56 des Exp $ X +.\" $Id: mount.8,v 1.25 1999/04/08 13:59:42 ghelmer Exp $ X .\" X ... X @@ -289,9 +302,5 @@ X flag is also specified. X -The set of options is determined by first extracting the options X -for the file system from the X -.Xr fstab 5 X -table, X -then applying any options specified by the X -.Fl o X -argument, X +The set of options is determined by applying the options specified X +in the argument to X +.Fl o X and finally applying the The new behaviour is easier to use. To get the old behaviour, use "fstab" for the first option in the list. To not have this option, just don't use it. If it were forced like it used to be, then canceling it would be difficult. Even boolean options are only easy to cancel if they have positive logic. E.g., the cancelation of "ro" is "noro", but the cancelation of "rw" is itself since "norw" gives the positive option "ro". "fstab" cannot be canceled by "nofstab" since that is not supported. Non-boolean options are even more difficult to cancel. E.g., to cancel rsize=16384 for nfs, you have to know the current value and specify this again. I checked that "ro" is currently broken for -o current as well as for -o fstab. Both ignore the specified setting of "ro" and force "noro". So all of: -u # with "ro" currently set -u -o fstab # with "ro" in fstab -u -o current # with "ro" currently set change the current "ro" setting to "noro" == "ro" == "" = absense of MNT_RDONLY in the mount flags. This is because nmount(2) is too hard to use, and its use for "ro" is still broken despite many attempts to fix it. nmount(2) apparently doesn't understand that the absence of "ro" means "noro". So users or utilities have to suppy "noro" to get the historical default of "rw". mount/mount.c does this. This is a cancelation like the ones that the user would have to do to cancel the old forced "fstab". The order of the flags is important for cancelation. mount is aware of this, but gets it wrong anyway: X $ svn ann mount.c | grep -C1 noro X 1558 rgrimes case 'w': X 76198 dd options = catopt(options, "noro"); X 1558 rgrimes break; X -- X 163671 ru if ((init_flags & MNT_UPDATE) && (ro == 0)) X 163671 ru options = catopt(options, "noro"); X 186505 obrien X $ svn log -r 163671 mount.c X ------------------------------------------------------------------------ X r163671 | ru | 2006-10-24 22:02:29 +0000 (Tue, 24 Oct 2006) | 12 lines X X Revert rev. 1.86 by jmallett@ as it breaks "ro" mounts specified X in /etc/fstab. X X This has been happening due to the priority inversion; options X specified on the command line should take precedence over options X from fstab over default "noro" option, but since both the default X "noro" and options specified on the command line (-w, -r, -o ...) X were put into the same "options" variable, "noro" took precedence X over fstab "ro" (this is easily visible with "mount -d"). X X PR: bin/100164 X X ------------------------------------------------------------------------ Before r163671, the options list was initialized to "noro", so "noro" was specified even without -u unless it is canceled by a later option. I don't know why this didn't work -- "noro" is the correct default, and canceling it it later should work. r163671 moves this to the MNT_UPDATE case. Cancelation still doesn't work for this cases. Manual cancelation does work: "ro" on the command line after "fstab" or "current" works to add the "ro" that should be added for "fstab" or "current". I debugged this only as far as seeing "-u -o fstab" turning into the options list "noatime,noro,???" in the kernel, where /etc/fstab has "ro,noatime". "noro" apparently gets added at the end of the options instead of the start, so it cancels "ro" instead of vice versa. Indeed, r163671 seems to move the addition to precisely this wrong place. So r163671 seems to be perfectly backwards for the -u case, and it is unclear why it was needed for the non-(-u) case. Later cancelation of "ro" by "noro" seems to work to give the bug for -u, so why doesn't later cancelation of "noro" by "ro" work to give correct behaviour before r163671? Bruce From owner-svn-src-head@freebsd.org Fri Jul 14 14:52:21 2017 Return-Path: Delivered-To: svn-src-head@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 D5418DA3BA1; Fri, 14 Jul 2017 14:52:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AF75E689E3; Fri, 14 Jul 2017 14:52:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EEqKOH017938; Fri, 14 Jul 2017 14:52:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EEqKQE017932; Fri, 14 Jul 2017 14:52:20 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201707141452.v6EEqKQE017932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 14 Jul 2017 14:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320984 - in head/sys: cam cam/scsi dev/nvme kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam cam/scsi dev/nvme kern X-SVN-Commit-Revision: 320984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 14:52:21 -0000 Author: imp Date: Fri Jul 14 14:52:20 2017 New Revision: 320984 URL: https://svnweb.freebsd.org/changeset/base/320984 Log: This adds CAM pass(4) support for NVMe IO's. Applications indicate the IO type (Admin or NVM) using XPT op-codes XPT_NVME_ADMIN or XPT_NVME_IO. Submitted by: Chuck Tuffli Differential Revision: https://reviews.freebsd.org/D10247 Modified: head/sys/cam/cam_ccb.h head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_pass.c head/sys/dev/nvme/nvme_sim.c head/sys/kern/subr_bus_dma.c Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Fri Jul 14 14:51:28 2017 (r320983) +++ head/sys/cam/cam_ccb.h Fri Jul 14 14:52:20 2017 (r320984) @@ -207,7 +207,7 @@ typedef enum { /* Serial Management Protocol */ XPT_NVME_IO = 0x1c | XPT_FC_DEV_QUEUED, - /* Execiute the requestred NVMe I/O operation */ + /* Execute the requested NVMe I/O operation */ XPT_MMC_IO = 0x1d | XPT_FC_DEV_QUEUED, /* Placeholder for MMC / SD / SDIO I/O stuff */ @@ -216,6 +216,9 @@ typedef enum { | XPT_FC_XPT_ONLY, /* Scan Target */ + XPT_NVME_ADMIN = 0x1f | XPT_FC_DEV_QUEUED, + /* Execute the requested NVMe Admin operation */ + /* HBA engine commands 0x20->0x2F */ XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY, /* HBA engine feature inquiry */ @@ -819,7 +822,7 @@ struct ccb_relsim { }; /* - * NVMe I/O Request CCB used for the XPT_NVME_IO function code. + * NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes. */ struct ccb_nvmeio { struct ccb_hdr ccb_h; @@ -1508,6 +1511,21 @@ cam_fill_nvmeio(struct ccb_nvmeio *nvmeio, u_int32_t r u_int32_t timeout) { nvmeio->ccb_h.func_code = XPT_NVME_IO; + nvmeio->ccb_h.flags = flags; + nvmeio->ccb_h.retry_count = retries; + nvmeio->ccb_h.cbfcnp = cbfcnp; + nvmeio->ccb_h.timeout = timeout; + nvmeio->data_ptr = data_ptr; + nvmeio->dxfer_len = dxfer_len; +} + +static __inline void +cam_fill_nvmeadmin(struct ccb_nvmeio *nvmeio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int32_t flags, u_int8_t *data_ptr, u_int32_t dxfer_len, + u_int32_t timeout) +{ + nvmeio->ccb_h.func_code = XPT_NVME_ADMIN; nvmeio->ccb_h.flags = flags; nvmeio->ccb_h.retry_count = retries; nvmeio->ccb_h.cbfcnp = cbfcnp; Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Fri Jul 14 14:51:28 2017 (r320983) +++ head/sys/cam/cam_periph.c Fri Jul 14 14:52:20 2017 (r320984) @@ -848,6 +848,17 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma dirs[1] = CAM_DIR_IN; numbufs = 2; break; + case XPT_NVME_IO: + case XPT_NVME_ADMIN: + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) + return (0); + if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) + return (EINVAL); + data_ptrs[0] = &ccb->nvmeio.data_ptr; + lengths[0] = ccb->nvmeio.dxfer_len; + dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; + numbufs = 1; + break; case XPT_DEV_ADVINFO: if (ccb->cdai.bufsiz == 0) return (0); @@ -1013,6 +1024,11 @@ cam_periph_unmapmem(union ccb *ccb, struct cam_periph_ case XPT_DEV_ADVINFO: numbufs = min(mapinfo->num_bufs_used, 1); data_ptrs[0] = (uint8_t **)&ccb->cdai.buf; + break; + case XPT_NVME_IO: + case XPT_NVME_ADMIN: + data_ptrs[0] = &ccb->nvmeio.data_ptr; + numbufs = min(mapinfo->num_bufs_used, 1); break; default: /* allow ourselves to be swapped once again */ Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Jul 14 14:51:28 2017 (r320983) +++ head/sys/cam/cam_xpt.c Fri Jul 14 14:52:20 2017 (r320984) @@ -2689,9 +2689,9 @@ xpt_action_default(union ccb *start_ccb) start_ccb->ataio.resid = 0; /* FALLTHROUGH */ case XPT_NVME_IO: - if (start_ccb->ccb_h.func_code == XPT_NVME_IO) - start_ccb->nvmeio.resid = 0; /* FALLTHROUGH */ + case XPT_NVME_ADMIN: + /* FALLTHROUGH */ case XPT_MMC_IO: /* XXX just like nmve_io? */ case XPT_RESET_DEV: @@ -5548,6 +5548,7 @@ static struct kv map[] = { { XPT_MMC_IO, "XPT_MMC_IO" }, { XPT_SMP_IO, "XPT_SMP_IO" }, { XPT_SCAN_TGT, "XPT_SCAN_TGT" }, + { XPT_NVME_ADMIN, "XPT_NVME_ADMIN" }, { XPT_ENG_INQ, "XPT_ENG_INQ" }, { XPT_ENG_EXEC, "XPT_ENG_EXEC" }, { XPT_EN_LUN, "XPT_EN_LUN" }, Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Fri Jul 14 14:51:28 2017 (r320983) +++ head/sys/cam/scsi/scsi_pass.c Fri Jul 14 14:52:20 2017 (r320984) @@ -1146,6 +1146,11 @@ passiocleanup(struct pass_softc *softc, struct pass_io numbufs = min(io_req->num_bufs, 1); data_ptrs[0] = (uint8_t **)&ccb->cdai.buf; break; + case XPT_NVME_IO: + case XPT_NVME_ADMIN: + data_ptrs[0] = &ccb->nvmeio.data_ptr; + numbufs = min(io_req->num_bufs, 1); + break; default: /* allow ourselves to be swapped once again */ return; @@ -1384,6 +1389,25 @@ passmemsetup(struct cam_periph *periph, struct pass_io dirs[0] = CAM_DIR_IN; numbufs = 1; break; + case XPT_NVME_ADMIN: + case XPT_NVME_IO: + if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) + return (0); + + io_req->data_flags = ccb->ccb_h.flags & CAM_DATA_MASK; + + /* + * We only support a single virtual address for NVMe + */ + if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) + return (EINVAL); + + data_ptrs[0] = &ccb->nvmeio.data_ptr; + lengths[0] = ccb->nvmeio.dxfer_len; + dirs[0] = ccb->ccb_h.flags & CAM_DIR_MASK; + numbufs = 1; + maxmap = softc->maxio; + break; default: return(EINVAL); break; /* NOTREACHED */ @@ -1957,7 +1981,8 @@ passdoioctl(struct cdev *dev, u_long cmd, caddr_t addr */ if ((fc == XPT_SCSI_IO) || (fc == XPT_ATA_IO) || (fc == XPT_SMP_IO) || (fc == XPT_DEV_MATCH) - || (fc == XPT_DEV_ADVINFO)) { + || (fc == XPT_DEV_ADVINFO) + || (fc == XPT_NVME_ADMIN) || (fc == XPT_NVME_IO)) { error = passmemsetup(periph, io_req); if (error != 0) goto camioqueue_error; Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Fri Jul 14 14:51:28 2017 (r320983) +++ head/sys/dev/nvme/nvme_sim.c Fri Jul 14 14:52:20 2017 (r320984) @@ -110,7 +110,10 @@ nvme_sim_nvmeio(struct cam_sim *sim, union ccb *ccb) memcpy(&req->cmd, &ccb->nvmeio.cmd, sizeof(ccb->nvmeio.cmd)); - nvme_ctrlr_submit_io_request(ctrlr, req); + if (ccb->ccb_h.func_code == XPT_NVME_IO) + nvme_ctrlr_submit_io_request(ctrlr, req); + else + nvme_ctrlr_submit_admin_request(ctrlr, req); ccb->ccb_h.status |= CAM_SIM_QUEUED; } @@ -225,6 +228,7 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_REQ_CMP; break; case XPT_NVME_IO: /* Execute the requested I/O operation */ + case XPT_NVME_ADMIN: /* or Admin operation */ nvme_sim_nvmeio(sim, ccb); return; /* no done */ default: Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Fri Jul 14 14:51:28 2017 (r320983) +++ head/sys/kern/subr_bus_dma.c Fri Jul 14 14:52:20 2017 (r320984) @@ -218,6 +218,16 @@ _bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t sglist_cnt = 0; break; } + case XPT_NVME_IO: + case XPT_NVME_ADMIN: { + struct ccb_nvmeio *nvmeio; + + nvmeio = &ccb->nvmeio; + data_ptr = nvmeio->data_ptr; + dxfer_len = nvmeio->dxfer_len; + sglist_cnt = 0; + break; + } default: panic("_bus_dmamap_load_ccb: Unsupported func code %d", ccb_h->func_code); From owner-svn-src-head@freebsd.org Fri Jul 14 14:53:15 2017 Return-Path: Delivered-To: svn-src-head@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 66EDCDA3D04; Fri, 14 Jul 2017 14:53:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E7D0B68CAF; Fri, 14 Jul 2017 14:53:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EErEKe020367; Fri, 14 Jul 2017 14:53:14 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EErEpf020364; Fri, 14 Jul 2017 14:53:14 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201707141453.v6EErEpf020364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 14 Jul 2017 14:53:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320986 - in head: share/man/man4 sys/dev/arcmsr X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/arcmsr X-SVN-Commit-Revision: 320986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 14:53:15 -0000 Author: delphij Date: Fri Jul 14 14:53:13 2017 New Revision: 320986 URL: https://svnweb.freebsd.org/changeset/base/320986 Log: Update arcmsr(4) to 1.40.00.00 in order to add support of ARC-1884 SATA RAID controllers. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 MFC after: 3 days Modified: head/share/man/man4/arcmsr.4 head/sys/dev/arcmsr/arcmsr.c head/sys/dev/arcmsr/arcmsr.h Modified: head/share/man/man4/arcmsr.4 ============================================================================== --- head/share/man/man4/arcmsr.4 Fri Jul 14 14:52:44 2017 (r320985) +++ head/share/man/man4/arcmsr.4 Fri Jul 14 14:53:13 2017 (r320986) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 4, 2015 +.Dd July 14, 2017 .Dt ARCMSR 4 .Os .Sh NAME @@ -147,6 +147,8 @@ ARC-1880 ARC-1882 .It ARC-1883 +.It +ARC-1884 .El .Sh FILES .Bl -tag -width ".Pa /dev/arcmsr?" -compact Modified: head/sys/dev/arcmsr/arcmsr.c ============================================================================== --- head/sys/dev/arcmsr/arcmsr.c Fri Jul 14 14:52:44 2017 (r320985) +++ head/sys/dev/arcmsr/arcmsr.c Fri Jul 14 14:53:13 2017 (r320986) @@ -77,6 +77,7 @@ ** 1.20.00.28 09/13/2013 Ching Huang Removed recursive mutex in arcmsr_abort_dr_ccbs ** 1.20.00.29 12/18/2013 Ching Huang Change simq allocation number, support ARC1883 ** 1.30.00.00 11/30/2015 Ching Huang Added support ARC1203 +** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884 ****************************************************************************************** */ @@ -148,7 +149,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.30.00.00 2015-11-30" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.40.00.00 2017-07-11" #include /* ************************************************************************** @@ -185,6 +186,8 @@ static void arcmsr_rescanLun_cb(struct cam_periph *per static void arcmsr_polling_devmap(void *arg); static void arcmsr_srb_timeout(void *arg); static void arcmsr_hbd_postqueue_isr(struct AdapterControlBlock *acb); +static void arcmsr_hbe_postqueue_isr(struct AdapterControlBlock *acb); +void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock *acb); #ifdef ARCMSR_DEBUG1 static void arcmsr_dump_data(struct AdapterControlBlock *acb); #endif @@ -376,6 +379,12 @@ static u_int32_t arcmsr_disable_allintr( struct Adapte CHIP_REG_WRITE32(HBD_MessageUnit, 0, pcief0_int_enable, ARCMSR_HBDMU_ALL_INT_DISABLE); } break; + case ACB_ADAPTER_TYPE_E: { + /* disable all outbound interrupt */ + intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, host_int_mask) ; /* disable outbound message0 int */ + CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, intmask_org | ARCMSR_HBEMU_ALL_INTMASKENABLE); + } + break; } return (intmask_org); } @@ -418,6 +427,13 @@ static void arcmsr_enable_allintr( struct AdapterContr acb->outbound_int_enable = mask; } break; + case ACB_ADAPTER_TYPE_E: { + /* enable outbound Post Queue, outbound doorbell Interrupt */ + mask = ~(ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR | ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, intmask_org & mask); + acb->outbound_int_enable = ~(intmask_org & mask) & 0x0000000f; + } + break; } } /* @@ -503,6 +519,28 @@ static u_int8_t arcmsr_hbd_wait_msgint_ready(struct Ad return (FALSE); } /* +********************************************************************** +********************************************************************** +*/ +static u_int8_t arcmsr_hbe_wait_msgint_ready(struct AdapterControlBlock *acb) +{ + u_int32_t Index, read_doorbell; + u_int8_t Retries = 0x00; + + do { + for(Index=0; Index < 100; Index++) { + read_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell); + if((read_doorbell ^ acb->in_doorbell) & ARCMSR_HBEMU_IOP2DRV_MESSAGE_CMD_DONE) { + CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0);/*clear interrupt*/ + acb->in_doorbell = read_doorbell; + return TRUE; + } + UDELAY(10000); + }/*max 1 seconds*/ + }while(Retries++ < 20);/*max 20 sec*/ + return (FALSE); +} +/* ************************************************************************ ************************************************************************ */ @@ -576,6 +614,25 @@ static void arcmsr_flush_hbd_cache(struct AdapterContr ************************************************************************ ************************************************************************ */ +static void arcmsr_flush_hbe_cache(struct AdapterControlBlock *acb) +{ + int retry_count = 30;/* enlarge wait flush adapter cache time: 10 minute */ + + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_FLUSH_CACHE); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + do { + if(arcmsr_hbe_wait_msgint_ready(acb)) { + break; + } else { + retry_count--; + } + }while(retry_count != 0); +} +/* +************************************************************************ +************************************************************************ +*/ static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { @@ -595,6 +652,10 @@ static void arcmsr_flush_adapter_cache(struct AdapterC arcmsr_flush_hbd_cache(acb); } break; + case ACB_ADAPTER_TYPE_E: { + arcmsr_flush_hbe_cache(acb); + } + break; } } /* @@ -715,6 +776,19 @@ static void arcmsr_abort_hbd_allcmd(struct AdapterCont ********************************************************************* ********************************************************************* */ +static void arcmsr_abort_hbe_allcmd(struct AdapterControlBlock *acb) +{ + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_ABORT_CMD); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) { + printf("arcmsr%d: wait 'abort all outstanding command' timeout \n", acb->pci_unit); + } +} +/* +********************************************************************* +********************************************************************* +*/ static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { @@ -734,6 +808,10 @@ static void arcmsr_abort_allcmd(struct AdapterControlB arcmsr_abort_hbd_allcmd(acb); } break; + case ACB_ADAPTER_TYPE_E: { + arcmsr_abort_hbe_allcmd(acb); + } + break; } } /* @@ -836,6 +914,9 @@ static void arcmsr_drain_donequeue(struct AdapterContr case ACB_ADAPTER_TYPE_D: srb = (struct CommandControlBlock *)(acb->vir2phy_offset+(flag_srb & 0xFFFFFFE0)); /*frame must be 32 bytes aligned*/ break; + case ACB_ADAPTER_TYPE_E: + srb = acb->psrb_pool[flag_srb]; + break; case ACB_ADAPTER_TYPE_A: case ACB_ADAPTER_TYPE_B: default: @@ -938,6 +1019,10 @@ static void arcmsr_done4abort_postqueue(struct Adapter arcmsr_hbd_postqueue_isr(acb); } break; + case ACB_ADAPTER_TYPE_E: { + arcmsr_hbe_postqueue_isr(acb); + } + break; } } /* @@ -1149,6 +1234,15 @@ static void arcmsr_post_srb(struct AdapterControlBlock ARCMSR_LOCK_RELEASE(&acb->postDone_lock); } break; + case ACB_ADAPTER_TYPE_E: { + u_int32_t ccb_post_stamp, arc_cdb_size; + + arc_cdb_size = (srb->arc_cdb_size > 0x300) ? 0x300 : srb->arc_cdb_size; + ccb_post_stamp = (srb->smid | ((arc_cdb_size-1) >> 6)); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_queueport_high, 0); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_queueport_low, ccb_post_stamp); + } + break; } } /* @@ -1184,6 +1278,12 @@ static struct QBUFFER *arcmsr_get_iop_rqbuffer( struct qbuffer = (struct QBUFFER *)&phbdmu->phbdmu->message_rbuffer; } break; + case ACB_ADAPTER_TYPE_E: { + struct HBE_MessageUnit *phbcmu = (struct HBE_MessageUnit *)acb->pmu; + + qbuffer = (struct QBUFFER *)&phbcmu->message_rbuffer; + } + break; } return(qbuffer); } @@ -1220,6 +1320,12 @@ static struct QBUFFER *arcmsr_get_iop_wqbuffer( struct qbuffer = (struct QBUFFER *)&phbdmu->phbdmu->message_wbuffer; } break; + case ACB_ADAPTER_TYPE_E: { + struct HBE_MessageUnit *phbcmu = (struct HBE_MessageUnit *)acb->pmu; + + qbuffer = (struct QBUFFER *)&phbcmu->message_wbuffer; + } + break; } return(qbuffer); } @@ -1251,6 +1357,12 @@ static void arcmsr_iop_message_read(struct AdapterCont CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_OUT_READ); } break; + case ACB_ADAPTER_TYPE_E: { + /* let IOP know data has been read */ + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + } + break; } } /* @@ -1293,6 +1405,15 @@ static void arcmsr_iop_message_wrote(struct AdapterCon CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_doorbell, ARCMSR_HBDMU_DRV2IOP_DATA_IN_READY); } break; + case ACB_ADAPTER_TYPE_E: { + /* + ** push inbound doorbell tell iop, driver data write ok + ** and wait reply on next hwinterrupt for next Qbuffer post + */ + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_WRITE_OK; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + } + break; } } /* @@ -1352,6 +1473,20 @@ static void arcmsr_stop_hbd_bgrb(struct AdapterControl ************************************************************************ ************************************************************************ */ +static void arcmsr_stop_hbe_bgrb(struct AdapterControlBlock *acb) +{ + acb->acb_flags &= ~ACB_F_MSG_START_BGRB; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_STOP_BGRB); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) { + printf("arcmsr%d: wait 'stop adapter background rebulid' timeout \n", acb->pci_unit); + } +} +/* +************************************************************************ +************************************************************************ +*/ static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { @@ -1371,6 +1506,10 @@ static void arcmsr_stop_adapter_bgrb(struct AdapterCon arcmsr_stop_hbd_bgrb(acb); } break; + case ACB_ADAPTER_TYPE_E: { + arcmsr_stop_hbe_bgrb(acb); + } + break; } } /* @@ -1446,7 +1585,8 @@ static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct u_int8_t *iop_data; u_int32_t iop_len; - if(acb->adapter_type & (ACB_ADAPTER_TYPE_C | ACB_ADAPTER_TYPE_D)) { + if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D) || + (acb->adapter_type == ACB_ADAPTER_TYPE_E)) { return(arcmsr_Read_iop_rqbuffer_data_D(acb, prbuffer)); } iop_data = (u_int8_t *)prbuffer->data; @@ -1541,7 +1681,8 @@ static void arcmsr_Write_data_2iop_wqbuffer(struct Ada u_int8_t *iop_data; int32_t allxfer_len=0; - if(acb->adapter_type & (ACB_ADAPTER_TYPE_C | ACB_ADAPTER_TYPE_D)) { + if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D) || + (acb->adapter_type == ACB_ADAPTER_TYPE_E)) { arcmsr_Write_data_2iop_wqbuffer_D(acb); return; } @@ -1694,6 +1835,14 @@ static void arcmsr_dr_handle(struct AdapterControlBloc devicemap += 4; } break; + case ACB_ADAPTER_TYPE_E: + devicemap = offsetof(struct HBE_MessageUnit, msgcode_rwbuffer[ARCMSR_FW_DEVMAP_OFFSET]); + for (target = 0; target < 4; target++) + { + deviceMapCurrent[target]=bus_space_read_4(acb->btag[0], acb->bhandle[0], devicemap); + devicemap += 4; + } + break; } if(acb->acb_flags & ACB_F_BUS_HANG_ON) @@ -1792,6 +1941,18 @@ static void arcmsr_hbd_message_isr(struct AdapterContr ************************************************************************** ************************************************************************** */ +static void arcmsr_hbe_message_isr(struct AdapterControlBlock *acb) { + u_int32_t outbound_message; + + CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); + outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + if (outbound_message == ARCMSR_SIGNATURE_GET_CONFIG) + arcmsr_dr_handle( acb ); +} +/* +************************************************************************** +************************************************************************** +*/ static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb) { u_int32_t doorbell_status; @@ -1876,6 +2037,35 @@ static void arcmsr_hbd_doorbell_isr(struct AdapterCont ************************************************************************** ************************************************************************** */ +static void arcmsr_hbe_doorbell_isr(struct AdapterControlBlock *acb) +{ + u_int32_t doorbell_status, in_doorbell; + + /* + ******************************************************************* + ** Maybe here we need to check wrqbuffer_lock is lock or not + ** DOORBELL: din! don! + ** check if there are any mail need to pack from firmware + ******************************************************************* + */ + in_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /* clear doorbell interrupt */ + doorbell_status = in_doorbell ^ acb->in_doorbell; + if(doorbell_status & ARCMSR_HBEMU_IOP2DRV_DATA_WRITE_OK) { + arcmsr_iop2drv_data_wrote_handle(acb); + } + if(doorbell_status & ARCMSR_HBEMU_IOP2DRV_DATA_READ_OK) { + arcmsr_iop2drv_data_read_handle(acb); + } + if(doorbell_status & ARCMSR_HBEMU_IOP2DRV_MESSAGE_CMD_DONE) { + arcmsr_hbe_message_isr(acb); /* messenger of "driver to iop commands" */ + } + acb->in_doorbell = in_doorbell; +} +/* +************************************************************************** +************************************************************************** +*/ static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb) { u_int32_t flag_srb; @@ -2013,6 +2203,34 @@ static void arcmsr_hbd_postqueue_isr(struct AdapterCon CHIP_REG_READ32(HBD_MessageUnit, 0, outboundlist_interrupt_cause); /*Dummy ioread32 to force pci flush */ } /* +************************************************************************** +************************************************************************** +*/ +static void arcmsr_hbe_postqueue_isr(struct AdapterControlBlock *acb) +{ + u_int16_t error; + uint32_t doneq_index; + uint16_t cmdSMID; + + /* + ***************************************************************************** + ** areca cdb command done + ***************************************************************************** + */ + bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + doneq_index = acb->doneq_index; + while ((CHIP_REG_READ32(HBE_MessageUnit, 0, reply_post_producer_index) & 0xFFFF) != doneq_index) { + cmdSMID = acb->pCompletionQ[doneq_index].cmdSMID; + error = (acb->pCompletionQ[doneq_index].cmdFlag & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; + arcmsr_drain_donequeue(acb, (u_int32_t)cmdSMID, error); + doneq_index++; + if (doneq_index >= acb->completionQ_entry) + doneq_index = 0; + } + acb->doneq_index = doneq_index; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, reply_post_consumer_index, doneq_index); +} +/* ********************************************************************** ********************************************************************** */ @@ -2143,6 +2361,37 @@ static void arcmsr_handle_hbd_isr( struct AdapterContr // CHIP_REG_READ32(HBD_MessageUnit, 0, pcief0_int_enable); } /* +********************************************************************** +********************************************************************** +*/ +static void arcmsr_handle_hbe_isr( struct AdapterControlBlock *acb) +{ + u_int32_t host_interrupt_status; + /* + ********************************************* + ** check outbound intstatus + ********************************************* + */ + host_interrupt_status = CHIP_REG_READ32(HBE_MessageUnit, 0, host_int_status) & + (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | + ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR); + if(!host_interrupt_status) { + /*it must be share irq*/ + return; + } + do { + /* MU doorbell interrupts*/ + if(host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR) { + arcmsr_hbe_doorbell_isr(acb); + } + /* MU post queue interrupts*/ + if(host_interrupt_status & ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR) { + arcmsr_hbe_postqueue_isr(acb); + } + host_interrupt_status = CHIP_REG_READ32(HBE_MessageUnit, 0, host_int_status); + } while (host_interrupt_status & (ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR | ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR)); +} +/* ****************************************************************************** ****************************************************************************** */ @@ -2161,6 +2410,9 @@ static void arcmsr_interrupt(struct AdapterControlBloc case ACB_ADAPTER_TYPE_D: arcmsr_handle_hbd_isr(acb); break; + case ACB_ADAPTER_TYPE_E: + arcmsr_handle_hbe_isr(acb); + break; default: printf("arcmsr%d: interrupt service," " unknown adapter type =%d\n", acb->pci_unit, acb->adapter_type); @@ -2205,6 +2457,12 @@ static void arcmsr_polling_devmap(void *arg) case ACB_ADAPTER_TYPE_D: CHIP_REG_WRITE32(HBD_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); break; + + case ACB_ADAPTER_TYPE_E: + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + break; } if((acb->acb_flags & ACB_F_SCSISTOPADAPTER) == 0) @@ -2907,6 +3165,7 @@ static void arcmsr_action(struct cam_sim *psim, union else cpi->base_transfer_speed = 300000; if((acb->vendor_device_id == PCIDevVenIDARC1880) || + (acb->vendor_device_id == PCIDevVenIDARC1884) || (acb->vendor_device_id == PCIDevVenIDARC1680) || (acb->vendor_device_id == PCIDevVenIDARC1214)) { @@ -2991,6 +3250,7 @@ static void arcmsr_action(struct cam_sim *psim, union cts->protocol = PROTO_SCSI; if((acb->vendor_device_id == PCIDevVenIDARC1880) || + (acb->vendor_device_id == PCIDevVenIDARC1884) || (acb->vendor_device_id == PCIDevVenIDARC1680) || (acb->vendor_device_id == PCIDevVenIDARC1214)) { @@ -3150,6 +3410,20 @@ static void arcmsr_start_hbd_bgrb(struct AdapterContro ********************************************************************** ********************************************************************** */ +static void arcmsr_start_hbe_bgrb(struct AdapterControlBlock *acb) +{ + acb->acb_flags |= ACB_F_MSG_START_BGRB; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_START_BGRB); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) { + printf("arcmsr%d: wait 'start adapter background rebulid' timeout \n", acb->pci_unit); + } +} +/* +********************************************************************** +********************************************************************** +*/ static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { @@ -3165,6 +3439,9 @@ static void arcmsr_start_adapter_bgrb(struct AdapterCo case ACB_ADAPTER_TYPE_D: arcmsr_start_hbd_bgrb(acb); break; + case ACB_ADAPTER_TYPE_E: + arcmsr_start_hbe_bgrb(acb); + break; } } /* @@ -3388,8 +3665,63 @@ polling_ccb_retry: } /* ********************************************************************** +** ********************************************************************** */ +static void arcmsr_polling_hbe_srbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_srb) +{ + struct CommandControlBlock *srb; + u_int32_t poll_srb_done=0, poll_count=0, doneq_index; + u_int16_t error, cmdSMID; + +polling_ccb_retry: + poll_count++; + bus_dmamap_sync(acb->srb_dmat, acb->srb_dmamap, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); + while(1) { + doneq_index = acb->doneq_index; + if((CHIP_REG_READ32(HBE_MessageUnit, 0, reply_post_producer_index) & 0xFFFF) == doneq_index) { + if(poll_srb_done) { + break;/*chip FIFO no ccb for completion already*/ + } else { + UDELAY(25000); + if ((poll_count > 100) && (poll_srb != NULL)) { + break; + } + if (acb->srboutstandingcount == 0) { + break; + } + goto polling_ccb_retry; + } + } + cmdSMID = acb->pCompletionQ[doneq_index].cmdSMID; + doneq_index++; + if (doneq_index >= acb->completionQ_entry) + doneq_index = 0; + acb->doneq_index = doneq_index; + srb = acb->psrb_pool[cmdSMID]; + error = (acb->pCompletionQ[doneq_index].cmdFlag & ARCMSR_SRBREPLY_FLAG_ERROR_MODE1) ? TRUE : FALSE; + if (poll_srb != NULL) + poll_srb_done = (srb == poll_srb) ? 1:0; + if((srb->acb != acb) || (srb->srb_state != ARCMSR_SRB_START)) { + if(srb->srb_state == ARCMSR_SRB_ABORTED) { + printf("arcmsr%d: scsi id=%d lun=%jx srb='%p'poll command abort successfully \n" + , acb->pci_unit, srb->pccb->ccb_h.target_id, (uintmax_t)srb->pccb->ccb_h.target_lun, srb); + srb->pccb->ccb_h.status |= CAM_REQ_ABORTED; + arcmsr_srb_complete(srb, 1); + continue; + } + printf("arcmsr%d: polling get an illegal srb command done srb='%p'srboutstandingcount=%d \n" + , acb->pci_unit, srb, acb->srboutstandingcount); + continue; + } + arcmsr_report_srb_state(acb, srb, error); + } /*drain reply FIFO*/ + CHIP_REG_WRITE32(HBE_MessageUnit, 0, reply_post_producer_index, doneq_index); +} +/* +********************************************************************** +********************************************************************** +*/ static void arcmsr_polling_srbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_srb) { switch (acb->adapter_type) { @@ -3409,6 +3741,10 @@ static void arcmsr_polling_srbdone(struct AdapterContr arcmsr_polling_hbd_srbdone(acb, poll_srb); } break; + case ACB_ADAPTER_TYPE_E: { + arcmsr_polling_hbe_srbdone(acb, poll_srb); + } + break; } } /* @@ -3615,6 +3951,58 @@ static void arcmsr_get_hbd_config(struct AdapterContro ********************************************************************** ********************************************************************** */ +static void arcmsr_get_hbe_config(struct AdapterControlBlock *acb) +{ + char *acb_firm_model = acb->firm_model; + char *acb_firm_version = acb->firm_version; + char *acb_device_map = acb->device_map; + size_t iop_firm_model = offsetof(struct HBE_MessageUnit,msgcode_rwbuffer[ARCMSR_FW_MODEL_OFFSET]); /*firm_model,15,60-67*/ + size_t iop_firm_version = offsetof(struct HBE_MessageUnit,msgcode_rwbuffer[ARCMSR_FW_VERS_OFFSET]); /*firm_version,17,68-83*/ + size_t iop_device_map = offsetof(struct HBE_MessageUnit,msgcode_rwbuffer[ARCMSR_FW_DEVMAP_OFFSET]); + int i; + + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_GET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) { + printf("arcmsr%d: wait 'get adapter firmware miscellaneous data' timeout \n", acb->pci_unit); + } + + i = 0; + while(i < 8) { + *acb_firm_model = bus_space_read_1(acb->btag[0], acb->bhandle[0], iop_firm_model+i); + /* 8 bytes firm_model, 15, 60-67*/ + acb_firm_model++; + i++; + } + i = 0; + while(i < 16) { + *acb_firm_version = bus_space_read_1(acb->btag[0], acb->bhandle[0], iop_firm_version+i); + /* 16 bytes firm_version, 17, 68-83*/ + acb_firm_version++; + i++; + } + i = 0; + while(i < 16) { + *acb_device_map = bus_space_read_1(acb->btag[0], acb->bhandle[0], iop_device_map+i); + acb_device_map++; + i++; + } + printf("Areca RAID adapter%d: %s F/W version %s \n", acb->pci_unit, acb->firm_model, acb->firm_version); + acb->firm_request_len = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[1]); /*firm_request_len, 1, 04-07*/ + acb->firm_numbers_queue = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[2]); /*firm_numbers_queue, 2, 08-11*/ + acb->firm_sdram_size = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[3]); /*firm_sdram_size, 3, 12-15*/ + acb->firm_ide_channels = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[4]); /*firm_ide_channels, 4, 16-19*/ + acb->firm_cfg_version = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[ARCMSR_FW_CFGVER_OFFSET]); /*firm_cfg_version, 25, */ + if(acb->firm_numbers_queue > ARCMSR_MAX_OUTSTANDING_CMD) + acb->maxOutstanding = ARCMSR_MAX_OUTSTANDING_CMD - 1; + else + acb->maxOutstanding = acb->firm_numbers_queue - 1; +} +/* +********************************************************************** +********************************************************************** +*/ static void arcmsr_get_firmware_spec(struct AdapterControlBlock *acb) { switch (acb->adapter_type) { @@ -3634,6 +4022,10 @@ static void arcmsr_get_firmware_spec(struct AdapterCon arcmsr_get_hbd_config(acb); } break; + case ACB_ADAPTER_TYPE_E: { + arcmsr_get_hbe_config(acb); + } + break; } } /* @@ -3695,6 +4087,18 @@ static void arcmsr_wait_firmware_ready( struct Adapter } } break; + case ACB_ADAPTER_TYPE_E: { + while ((CHIP_REG_READ32(HBE_MessageUnit, 0, outbound_msgaddr1) & ARCMSR_HBEMU_MESSAGE_FIRMWARE_OK) == 0) + { + if (timeout++ > 4000) /* (4000*15)/1000 = 60 sec */ + { + printf( "arcmsr%d:timed out waiting for firmware ready\n", acb->pci_unit); + return; + } + UDELAY(15000); /* wait 15 milli-seconds */ + } + } + break; } } /* @@ -3738,6 +4142,14 @@ static void arcmsr_clear_doorbell_queue_buffer( struct } break; + case ACB_ADAPTER_TYPE_E: { + /* empty doorbell Qbuffer if door bell ringed */ + acb->in_doorbell = CHIP_REG_READ32(HBE_MessageUnit, 0, iobound_doorbell); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); /*clear doorbell interrupt */ + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_DATA_READ_OK; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + } + break; } } /* @@ -3844,6 +4256,27 @@ static u_int32_t arcmsr_iop_confirm(struct AdapterCont } } break; + case ACB_ADAPTER_TYPE_E: { + u_int32_t cdb_phyaddr_lo32; + cdb_phyaddr_lo32 = srb_phyaddr_lo32 + offsetof(struct CommandControlBlock, arcmsr_cdb); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[0], ARCMSR_SIGNATURE_SET_CONFIG); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[1], ARCMSR_SIGNATURE_1884); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[2], cdb_phyaddr_lo32); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[3], srb_phyaddr_hi32); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[4], SRB_SIZE); + cdb_phyaddr_lo32 = srb_phyaddr_lo32 + ARCMSR_SRBS_POOL_SIZE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[5], cdb_phyaddr_lo32); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[6], srb_phyaddr_hi32); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, msgcode_rwbuffer[7], COMPLETION_Q_POOL_SIZE); + CHIP_REG_WRITE32(HBE_MessageUnit, 0, inbound_msgaddr0, ARCMSR_INBOUND_MESG0_SET_CONFIG); + acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; + CHIP_REG_WRITE32(HBE_MessageUnit, 0, iobound_doorbell, acb->out_doorbell); + if(!arcmsr_hbe_wait_msgint_ready(acb)) { + printf( "arcmsr%d: 'set srb high part physical address' timeout \n", acb->pci_unit); + return FALSE; + } + } + break; } return (TRUE); } @@ -3853,21 +4286,14 @@ static u_int32_t arcmsr_iop_confirm(struct AdapterCont */ static void arcmsr_enable_eoi_mode(struct AdapterControlBlock *acb) { - switch (acb->adapter_type) + if (acb->adapter_type == ACB_ADAPTER_TYPE_B) { - case ACB_ADAPTER_TYPE_A: - case ACB_ADAPTER_TYPE_C: - case ACB_ADAPTER_TYPE_D: - break; - case ACB_ADAPTER_TYPE_B: { - struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu; - WRITE_CHIP_REG32(0, phbbmu->drv2iop_doorbell, ARCMSR_MESSAGE_ACTIVE_EOI_MODE); - if(!arcmsr_hbb_wait_msgint_ready(acb)) { - printf( "arcmsr%d: 'iop enable eoi mode' timeout \n", acb->pci_unit); - return; - } + struct HBB_MessageUnit *phbbmu = (struct HBB_MessageUnit *)acb->pmu; + WRITE_CHIP_REG32(0, phbbmu->drv2iop_doorbell, ARCMSR_MESSAGE_ACTIVE_EOI_MODE); + if(!arcmsr_hbb_wait_msgint_ready(acb)) { + printf( "arcmsr%d: 'iop enable eoi mode' timeout \n", acb->pci_unit); + return; } - break; } } /* @@ -3913,7 +4339,8 @@ static void arcmsr_map_free_srb(void *arg, bus_dma_seg " srb dmamap bus_dmamap_create error\n", acb->pci_unit); return; } - if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D)) + if((acb->adapter_type == ACB_ADAPTER_TYPE_C) || (acb->adapter_type == ACB_ADAPTER_TYPE_D) + || (acb->adapter_type == ACB_ADAPTER_TYPE_E)) { srb_tmp->cdb_phyaddr_low = srb_phyaddr; srb_tmp->cdb_phyaddr_high = (u_int32_t)((srb_phyaddr >> 16) >> 16); @@ -3921,10 +4348,12 @@ static void arcmsr_map_free_srb(void *arg, bus_dma_seg else srb_tmp->cdb_phyaddr_low = srb_phyaddr >> 5; srb_tmp->acb = acb; + srb_tmp->smid = i << 16; acb->srbworkingQ[i] = acb->psrb_pool[i] = srb_tmp; srb_phyaddr = srb_phyaddr + SRB_SIZE; srb_tmp = (struct CommandControlBlock *)((unsigned long)srb_tmp + SRB_SIZE); } + acb->pCompletionQ = (pCompletion_Q)srb_tmp; acb->vir2phy_offset = (unsigned long)srb_tmp - (unsigned long)srb_phyaddr; } /* @@ -3992,6 +4421,12 @@ static u_int32_t arcmsr_initialize(device_t dev) max_coherent_size = ARCMSR_SRBS_POOL_SIZE; } break; + case PCIDevVenIDARC1884: + acb->adapter_type = ACB_ADAPTER_TYPE_E; + acb->adapter_bus_speed = ACB_BUS_SPEED_12G; + max_coherent_size = ARCMSR_SRBS_POOL_SIZE + COMPLETION_Q_POOL_SIZE; + acb->completionQ_entry = COMPLETION_Q_POOL_SIZE / sizeof(struct deliver_completeQ); + break; case PCIDevVenIDARC1214: { acb->adapter_type = ACB_ADAPTER_TYPE_D; acb->adapter_bus_speed = ACB_BUS_SPEED_6G; @@ -4140,141 +4575,177 @@ static u_int32_t arcmsr_initialize(device_t dev) pci_write_config(dev, PCIR_COMMAND, pci_command, 2); switch(acb->adapter_type) { case ACB_ADAPTER_TYPE_A: { - u_int32_t rid0 = PCIR_BAR(0); - vm_offset_t mem_base0; + u_int32_t rid0 = PCIR_BAR(0); + vm_offset_t mem_base0; - acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE); - if(acb->sys_res_arcmsr[0] == NULL) { - arcmsr_free_resource(acb); - printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev)); - return ENOMEM; - } - if(rman_get_start(acb->sys_res_arcmsr[0]) <= 0) { - arcmsr_free_resource(acb); - printf("arcmsr%d: rman_get_start failure!\n", device_get_unit(dev)); - return ENXIO; - } - mem_base0 = (vm_offset_t) rman_get_virtual(acb->sys_res_arcmsr[0]); - if(mem_base0 == 0) { - arcmsr_free_resource(acb); - printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev)); - return ENXIO; - } - acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]); - acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]); - acb->pmu = (struct MessageUnit_UNION *)mem_base0; + acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE); + if(acb->sys_res_arcmsr[0] == NULL) { + arcmsr_free_resource(acb); + printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev)); + return ENOMEM; } + if(rman_get_start(acb->sys_res_arcmsr[0]) <= 0) { + arcmsr_free_resource(acb); + printf("arcmsr%d: rman_get_start failure!\n", device_get_unit(dev)); + return ENXIO; + } + mem_base0 = (vm_offset_t) rman_get_virtual(acb->sys_res_arcmsr[0]); + if(mem_base0 == 0) { + arcmsr_free_resource(acb); + printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev)); + return ENXIO; + } + acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]); + acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]); + acb->pmu = (struct MessageUnit_UNION *)mem_base0; + acb->rid = 0; + } break; case ACB_ADAPTER_TYPE_B: { - struct HBB_MessageUnit *phbbmu; - struct CommandControlBlock *freesrb; - u_int32_t rid[]={ PCIR_BAR(0), PCIR_BAR(2) }; - vm_offset_t mem_base[]={0,0}; - u_long size; - if (vendor_dev_id == PCIDevVenIDARC1203) - size = sizeof(struct HBB_DOORBELL_1203); - else - size = sizeof(struct HBB_DOORBELL); - for(i=0; i < 2; i++) { - if(i == 0) { - acb->sys_res_arcmsr[i] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid[i], - RF_ACTIVE); - } else { - acb->sys_res_arcmsr[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid[i], - RF_ACTIVE); - } - if(acb->sys_res_arcmsr[i] == NULL) { - arcmsr_free_resource(acb); - printf("arcmsr%d: bus_alloc_resource %d failure!\n", device_get_unit(dev), i); - return ENOMEM; - } - if(rman_get_start(acb->sys_res_arcmsr[i]) <= 0) { - arcmsr_free_resource(acb); - printf("arcmsr%d: rman_get_start %d failure!\n", device_get_unit(dev), i); - return ENXIO; - } - mem_base[i] = (vm_offset_t) rman_get_virtual(acb->sys_res_arcmsr[i]); - if(mem_base[i] == 0) { - arcmsr_free_resource(acb); - printf("arcmsr%d: rman_get_virtual %d failure!\n", device_get_unit(dev), i); - return ENXIO; - } - acb->btag[i] = rman_get_bustag(acb->sys_res_arcmsr[i]); - acb->bhandle[i] = rman_get_bushandle(acb->sys_res_arcmsr[i]); - } - freesrb = (struct CommandControlBlock *)acb->uncacheptr; - acb->pmu = (struct MessageUnit_UNION *)((unsigned long)freesrb+ARCMSR_SRBS_POOL_SIZE); - phbbmu = (struct HBB_MessageUnit *)acb->pmu; - phbbmu->hbb_doorbell = (struct HBB_DOORBELL *)mem_base[0]; - phbbmu->hbb_rwbuffer = (struct HBB_RWBUFFER *)mem_base[1]; - if (vendor_dev_id == PCIDevVenIDARC1203) { - phbbmu->drv2iop_doorbell = offsetof(struct HBB_DOORBELL_1203, drv2iop_doorbell); - phbbmu->drv2iop_doorbell_mask = offsetof(struct HBB_DOORBELL_1203, drv2iop_doorbell_mask); - phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell); - phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell_mask); + struct HBB_MessageUnit *phbbmu; + struct CommandControlBlock *freesrb; + u_int32_t rid[]={ PCIR_BAR(0), PCIR_BAR(2) }; + vm_offset_t mem_base[]={0,0}; + u_long size; + if (vendor_dev_id == PCIDevVenIDARC1203) + size = sizeof(struct HBB_DOORBELL_1203); + else + size = sizeof(struct HBB_DOORBELL); + for(i=0; i < 2; i++) { + if(i == 0) { + acb->sys_res_arcmsr[i] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid[i], + RF_ACTIVE); } else { - phbbmu->drv2iop_doorbell = offsetof(struct HBB_DOORBELL, drv2iop_doorbell); - phbbmu->drv2iop_doorbell_mask = offsetof(struct HBB_DOORBELL, drv2iop_doorbell_mask); - phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL, iop2drv_doorbell); - phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL, iop2drv_doorbell_mask); + acb->sys_res_arcmsr[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid[i], + RF_ACTIVE); } - } - break; - case ACB_ADAPTER_TYPE_C: { - u_int32_t rid0 = PCIR_BAR(1); - vm_offset_t mem_base0; - - acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE); - if(acb->sys_res_arcmsr[0] == NULL) { + if(acb->sys_res_arcmsr[i] == NULL) { arcmsr_free_resource(acb); - printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev)); + printf("arcmsr%d: bus_alloc_resource %d failure!\n", device_get_unit(dev), i); return ENOMEM; } - if(rman_get_start(acb->sys_res_arcmsr[0]) <= 0) { + if(rman_get_start(acb->sys_res_arcmsr[i]) <= 0) { arcmsr_free_resource(acb); - printf("arcmsr%d: rman_get_start failure!\n", device_get_unit(dev)); + printf("arcmsr%d: rman_get_start %d failure!\n", device_get_unit(dev), i); return ENXIO; } - mem_base0 = (vm_offset_t) rman_get_virtual(acb->sys_res_arcmsr[0]); - if(mem_base0 == 0) { + mem_base[i] = (vm_offset_t) rman_get_virtual(acb->sys_res_arcmsr[i]); + if(mem_base[i] == 0) { arcmsr_free_resource(acb); - printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev)); + printf("arcmsr%d: rman_get_virtual %d failure!\n", device_get_unit(dev), i); return ENXIO; } - acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]); - acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]); - acb->pmu = (struct MessageUnit_UNION *)mem_base0; + acb->btag[i] = rman_get_bustag(acb->sys_res_arcmsr[i]); + acb->bhandle[i] = rman_get_bushandle(acb->sys_res_arcmsr[i]); } + freesrb = (struct CommandControlBlock *)acb->uncacheptr; + acb->pmu = (struct MessageUnit_UNION *)((unsigned long)freesrb+ARCMSR_SRBS_POOL_SIZE); + phbbmu = (struct HBB_MessageUnit *)acb->pmu; + phbbmu->hbb_doorbell = (struct HBB_DOORBELL *)mem_base[0]; + phbbmu->hbb_rwbuffer = (struct HBB_RWBUFFER *)mem_base[1]; + if (vendor_dev_id == PCIDevVenIDARC1203) { + phbbmu->drv2iop_doorbell = offsetof(struct HBB_DOORBELL_1203, drv2iop_doorbell); + phbbmu->drv2iop_doorbell_mask = offsetof(struct HBB_DOORBELL_1203, drv2iop_doorbell_mask); + phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell); + phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL_1203, iop2drv_doorbell_mask); + } else { + phbbmu->drv2iop_doorbell = offsetof(struct HBB_DOORBELL, drv2iop_doorbell); + phbbmu->drv2iop_doorbell_mask = offsetof(struct HBB_DOORBELL, drv2iop_doorbell_mask); + phbbmu->iop2drv_doorbell = offsetof(struct HBB_DOORBELL, iop2drv_doorbell); + phbbmu->iop2drv_doorbell_mask = offsetof(struct HBB_DOORBELL, iop2drv_doorbell_mask); + } + acb->rid = 0; + } break; + case ACB_ADAPTER_TYPE_C: { + u_int32_t rid0 = PCIR_BAR(1); + vm_offset_t mem_base0; + + acb->sys_res_arcmsr[0] = bus_alloc_resource_any(dev,SYS_RES_MEMORY, &rid0, RF_ACTIVE); + if(acb->sys_res_arcmsr[0] == NULL) { + arcmsr_free_resource(acb); + printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev)); + return ENOMEM; + } + if(rman_get_start(acb->sys_res_arcmsr[0]) <= 0) { + arcmsr_free_resource(acb); + printf("arcmsr%d: rman_get_start failure!\n", device_get_unit(dev)); + return ENXIO; + } + mem_base0 = (vm_offset_t) rman_get_virtual(acb->sys_res_arcmsr[0]); + if(mem_base0 == 0) { + arcmsr_free_resource(acb); + printf("arcmsr%d: rman_get_virtual failure!\n", device_get_unit(dev)); + return ENXIO; + } + acb->btag[0] = rman_get_bustag(acb->sys_res_arcmsr[0]); + acb->bhandle[0] = rman_get_bushandle(acb->sys_res_arcmsr[0]); + acb->pmu = (struct MessageUnit_UNION *)mem_base0; + acb->rid = 1; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jul 14 14:55:36 2017 Return-Path: Delivered-To: svn-src-head@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 E5DA0DA3DCE; Fri, 14 Jul 2017 14:55:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7E55968E3E; Fri, 14 Jul 2017 14:55:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EEtZpH020530; Fri, 14 Jul 2017 14:55:35 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EEtZrT020523; Fri, 14 Jul 2017 14:55:35 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201707141455.v6EEtZrT020523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 14 Jul 2017 14:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320987 - in head/contrib/zstd: . contrib/pzstd doc examples lib lib/common lib/compress lib/decompress lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWrapper/examples X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head/contrib/zstd: . contrib/pzstd doc examples lib lib/common lib/compress lib/decompress lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWrapper/examples X-SVN-Commit-Revision: 320987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 14:55:37 -0000 Author: bapt Date: Fri Jul 14 14:55:34 2017 New Revision: 320987 URL: https://svnweb.freebsd.org/changeset/base/320987 Log: Update zstd to 1.3.0 Modified: head/contrib/zstd/Makefile head/contrib/zstd/NEWS head/contrib/zstd/README.md head/contrib/zstd/appveyor.yml head/contrib/zstd/contrib/pzstd/Pzstd.cpp head/contrib/zstd/doc/zstd_manual.html head/contrib/zstd/examples/Makefile head/contrib/zstd/lib/Makefile head/contrib/zstd/lib/common/bitstream.h head/contrib/zstd/lib/common/error_private.c head/contrib/zstd/lib/common/huf.h head/contrib/zstd/lib/common/mem.h head/contrib/zstd/lib/common/pool.c head/contrib/zstd/lib/common/pool.h head/contrib/zstd/lib/common/threading.c head/contrib/zstd/lib/common/zstd_common.c head/contrib/zstd/lib/common/zstd_errors.h head/contrib/zstd/lib/common/zstd_internal.h head/contrib/zstd/lib/compress/huf_compress.c head/contrib/zstd/lib/compress/zstd_compress.c head/contrib/zstd/lib/compress/zstd_opt.h head/contrib/zstd/lib/compress/zstdmt_compress.c head/contrib/zstd/lib/compress/zstdmt_compress.h head/contrib/zstd/lib/decompress/huf_decompress.c head/contrib/zstd/lib/decompress/zstd_decompress.c head/contrib/zstd/lib/dictBuilder/cover.c head/contrib/zstd/lib/dictBuilder/zdict.c head/contrib/zstd/lib/dictBuilder/zdict.h head/contrib/zstd/lib/legacy/zstd_v04.c head/contrib/zstd/lib/legacy/zstd_v05.c head/contrib/zstd/lib/legacy/zstd_v06.c head/contrib/zstd/lib/legacy/zstd_v07.c head/contrib/zstd/lib/zstd.h head/contrib/zstd/programs/Makefile head/contrib/zstd/programs/README.md head/contrib/zstd/programs/bench.c head/contrib/zstd/programs/dibio.c head/contrib/zstd/programs/dibio.h head/contrib/zstd/programs/fileio.c head/contrib/zstd/programs/fileio.h head/contrib/zstd/programs/util.h head/contrib/zstd/programs/zstd.1 head/contrib/zstd/programs/zstd.1.md head/contrib/zstd/programs/zstdcli.c head/contrib/zstd/tests/Makefile head/contrib/zstd/tests/datagencli.c head/contrib/zstd/tests/decodecorpus.c head/contrib/zstd/tests/fullbench.c head/contrib/zstd/tests/fuzzer.c head/contrib/zstd/tests/paramgrill.c head/contrib/zstd/tests/playTests.sh head/contrib/zstd/tests/roundTripCrash.c head/contrib/zstd/tests/symbols.c head/contrib/zstd/tests/zstreamtest.c head/contrib/zstd/zlibWrapper/Makefile head/contrib/zstd/zlibWrapper/examples/zwrapbench.c head/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c Directory Properties: head/contrib/zstd/ (props changed) Modified: head/contrib/zstd/Makefile ============================================================================== --- head/contrib/zstd/Makefile Fri Jul 14 14:53:13 2017 (r320986) +++ head/contrib/zstd/Makefile Fri Jul 14 14:55:34 2017 (r320987) @@ -108,7 +108,7 @@ clean: #------------------------------------------------------------------------------ # make install is validated only for Linux, OSX, Hurd and some BSD targets #------------------------------------------------------------------------------ -ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD)) +ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD MSYS_NT)) HOST_OS = POSIX CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON @@ -117,30 +117,36 @@ CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUI list: @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs -.PHONY: install uninstall travis-install clangtest gpptest armtest usan asan uasan +.PHONY: install clangtest gpptest armtest usan asan uasan install: @$(MAKE) -C $(ZSTDDIR) $@ @$(MAKE) -C $(PRGDIR) $@ +.PHONY: uninstall uninstall: @$(MAKE) -C $(ZSTDDIR) $@ @$(MAKE) -C $(PRGDIR) $@ +.PHONY: travis-install travis-install: $(MAKE) install PREFIX=~/install_test_dir +.PHONY: gppbuild gppbuild: clean g++ -v CC=g++ $(MAKE) -C programs all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" +.PHONY: gcc5build gcc5build: clean gcc-5 -v CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror" +.PHONY: gcc6build gcc6build: clean gcc-6 -v CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror" +.PHONY: clangbuild clangbuild: clean clang -v CXX=clang++ CC=clang $(MAKE) all MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" @@ -224,10 +230,10 @@ asan-%: clean LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address" $(MAKE) -C $(TESTDIR) $* msan: clean - $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer" # datagen.c fails this test for no obvious reason + $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer" HAVE_LZMA=0 # datagen.c fails this test for no obvious reason msan-%: clean - LDFLAGS=-fuse-ld=gold MOREFLAGS="-fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer" $(MAKE) -C $(TESTDIR) $* + LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $* asan32: clean $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address" @@ -236,10 +242,11 @@ uasan: clean $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" uasan-%: clean - LDFLAGS=-fuse-ld=gold MOREFLAGS="-Og -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" $(MAKE) -C $(TESTDIR) $* + LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" $(MAKE) -C $(TESTDIR) $* tsan-%: clean - LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread" $(MAKE) -C $(TESTDIR) $* + LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests + apt-install: sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES) Modified: head/contrib/zstd/NEWS ============================================================================== --- head/contrib/zstd/NEWS Fri Jul 14 14:53:13 2017 (r320986) +++ head/contrib/zstd/NEWS Fri Jul 14 14:55:34 2017 (r320987) @@ -1,3 +1,18 @@ +v1.3.0 +cli : new : `--list` command, by Paul Cruz +cli : changed : xz/lzma support enabled by default +cli : changed : `-t *` continue processing list after a decompression error +API : added : ZSTD_versionString() +API : promoted to stable status : ZSTD_getFrameContentSize(), by Sean Purcell +API exp : new advanced API : ZSTD_compress_generic(), ZSTD_CCtx_setParameter() +API exp : new : API for static or external allocation : ZSTD_initStatic?Ctx() +API exp : added : ZSTD_decompressBegin_usingDDict(), requested by Guy Riddle (#700) +API exp : clarified memory estimation / measurement functions. +API exp : changed : strongest strategy renamed ZSTD_btultra, fastest strategy ZSTD_fast set to 1 +tools : decodecorpus can generate random dictionary-compressed samples, by Paul Cruz +new : contrib/seekable_format, demo and API, by Sean Purcell +changed : contrib/linux-kernel, updated version and license, by Nick Terrell + v1.2.0 cli : changed : Multithreading enabled by default (use target zstd-nomt or HAVE_THREAD=0 to disable) cli : new : command -T0 means "detect and use nb of cores", by Sean Purcell Modified: head/contrib/zstd/README.md ============================================================================== --- head/contrib/zstd/README.md Fri Jul 14 14:53:13 2017 (r320986) +++ head/contrib/zstd/README.md Fri Jul 14 14:55:34 2017 (r320987) @@ -6,11 +6,18 @@ and a command line utility producing and decoding `.zs For other programming languages, you can consult a list of known ports on [Zstandard homepage](http://www.zstd.net/#other-languages). -|Branch |Status | -|------------|---------| -|master | [![Build Status](https://travis-ci.org/facebook/zstd.svg?branch=master)](https://travis-ci.org/facebook/zstd) | -|dev | [![Build Status](https://travis-ci.org/facebook/zstd.svg?branch=dev)](https://travis-ci.org/facebook/zstd) | +| dev branch status | +|-------------------| +| [![Build Status][travisDevBadge]][travisLink] [![Build status][AppveyorDevBadge]][AppveyorLink] [![Build status][CircleDevBadge]][CircleLink] +[travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite" +[travisLink]: https://travis-ci.org/facebook/zstd +[AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/xt38wbdxjk5mrbem/branch/dev?svg=true "Windows test suite" +[AppveyorLink]: https://ci.appveyor.com/project/YannCollet/zstd-p0yf0 +[CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite" +[CircleLink]: https://circleci.com/gh/facebook/zstd + + As a reference, several fast compression algorithms were tested and compared on a server running Linux Debian (`Linux version 4.8.0-1-amd64`), with a Core i7-6700K CPU @ 4.0GHz, @@ -60,11 +67,11 @@ Previous charts provide results applicable to typical The smaller the amount of data to compress, the more difficult it is to compress. This problem is common to all compression algorithms, and reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new data set, there is no "past" to build upon. To solve this situation, Zstd offers a __training mode__, which can be used to tune the algorithm for a selected type of data. -Training Zstandard is achieved by provide it with a few samples (one file per sample). The result of this training is stored in a file called "dictionary", which must be loaded before compression and decompression. +Training Zstandard is achieved by providing it with a few samples (one file per sample). The result of this training is stored in a file called "dictionary", which must be loaded before compression and decompression. Using this dictionary, the compression ratio achievable on small data improves dramatically. The following example uses the `github-users` [sample set](https://github.com/facebook/zstd/releases/tag/v1.1.3), created from [github public API](https://developer.github.com/v3/users/#get-all-users). -It consists of roughly 10K records weighting about 1KB each. +It consists of roughly 10K records weighing about 1KB each. Compression Ratio | Compression Speed | Decompression Speed ------------------|-------------------|-------------------- Modified: head/contrib/zstd/appveyor.yml ============================================================================== --- head/contrib/zstd/appveyor.yml Fri Jul 14 14:53:13 2017 (r320986) +++ head/contrib/zstd/appveyor.yml Fri Jul 14 14:55:34 2017 (r320987) @@ -30,12 +30,6 @@ SCRIPT: "" TEST: "cmake" - - COMPILER: "gcc" - HOST: "mingw" - PLATFORM: "x64" - SCRIPT: "" - TEST: "pzstd" - - COMPILER: "visual" HOST: "visual" PLATFORM: "x64" @@ -88,12 +82,10 @@ ( if [%COMPILER%]==[gcc] if [%ARTIFACT%]==[true] lib\dll\example\build_package.bat && make -C programs DEBUGFLAGS= clean zstd && - cp programs\zstd.exe zstd_%PLATFORM%.exe && - appveyor PushArtifact zstd_%PLATFORM%.exe && - cp programs\zstd.exe bin\zstd.exe && - make -C programs DEBUGFLAGS= clean zstdmt && - cp programs\zstd.exe bin\zstdmt.exe && - cd bin\ && 7z a -tzip zstd-win-release-%PLATFORM%.zip * && + cd programs\ && 7z a -tzip -mx9 zstd-win-binary-%PLATFORM%.zip zstd.exe && + appveyor PushArtifact zstd-win-binary-%PLATFORM%.zip && + cp zstd.exe ..\bin\zstd.exe && + cd ..\bin\ && 7z a -tzip -mx9 zstd-win-release-%PLATFORM%.zip * && appveyor PushArtifact zstd-win-release-%PLATFORM%.zip ) ) @@ -158,13 +150,6 @@ cmake -G "Visual Studio 14 2015 Win64" .. && cd ..\..\.. && make clean - ) - - if [%TEST%]==[pzstd] ( - make -C contrib\pzstd googletest-mingw64 && - make -C contrib\pzstd pzstd.exe && - make -C contrib\pzstd tests && - make -C contrib\pzstd check && - make -C contrib\pzstd clean ) - SET "FUZZERTEST=-T30s" - if [%HOST%]==[visual] if [%CONFIGURATION%]==[Release] ( Modified: head/contrib/zstd/contrib/pzstd/Pzstd.cpp ============================================================================== --- head/contrib/zstd/contrib/pzstd/Pzstd.cpp Fri Jul 14 14:53:13 2017 (r320986) +++ head/contrib/zstd/contrib/pzstd/Pzstd.cpp Fri Jul 14 14:55:34 2017 (r320987) @@ -585,7 +585,10 @@ std::uint64_t writeFile( std::uint64_t bytesWritten = 0; std::shared_ptr out; // Grab the output queue for each decompression job (in order). - while (outs.pop(out) && !errorHolder.hasError()) { + while (outs.pop(out)) { + if (errorHolder.hasError()) { + continue; + } if (!decompress) { // If we are compressing and want to write skippable frames we can't // start writing before compression is done because we need to know the Modified: head/contrib/zstd/doc/zstd_manual.html ============================================================================== --- head/contrib/zstd/doc/zstd_manual.html Fri Jul 14 14:53:13 2017 (r320986) +++ head/contrib/zstd/doc/zstd_manual.html Fri Jul 14 14:55:34 2017 (r320987) @@ -1,10 +1,10 @@ -zstd 1.2.0 Manual +zstd 1.3.0 Manual -

zstd 1.2.0 Manual

+

zstd 1.3.0 Manual


Contents

    @@ -13,14 +13,14 @@
  1. Simple API
  2. Explicit memory management
  3. Simple dictionary API
  4. -
  5. Fast dictionary API
  6. +
  7. Bulk processing dictionary API
  8. Streaming
  9. Streaming compression - HowTo
  10. Streaming decompression - HowTo
  11. START OF ADVANCED AND EXPERIMENTAL FUNCTIONS
  12. Advanced types
  13. -
  14. Compressed size functions
  15. -
  16. Decompressed size functions
  17. +
  18. Frame size functions
  19. +
  20. Context memory usage
  21. Advanced compression functions
  22. Advanced decompression functions
  23. Advanced streaming functions
  24. @@ -31,26 +31,27 @@

Introduction

-  zstd, short for Zstandard, is a fast lossless compression algorithm, targeting real-time compression scenarios
-  at zlib-level and better compression ratios. The zstd compression library provides in-memory compression and
-  decompression functions. The library supports compression levels from 1 up to ZSTD_maxCLevel() which is 22.
+  zstd, short for Zstandard, is a fast lossless compression algorithm,
+  targeting real-time compression scenarios at zlib-level and better compression ratios.
+  The zstd compression library provides in-memory compression and decompression functions.
+  The library supports compression levels from 1 up to ZSTD_maxCLevel() which is currently 22.
   Levels >= 20, labeled `--ultra`, should be used with caution, as they require more memory.
   Compression can be done in:
     - a single step (described as Simple API)
     - a single step, reusing a context (described as Explicit memory management)
     - unbounded multiple steps (described as Streaming compression)
-  The compression ratio achievable on small data can be highly improved using compression with a dictionary in:
+  The compression ratio achievable on small data can be highly improved using a dictionary in:
     - a single step (described as Simple dictionary API)
     - a single step, reusing a dictionary (described as Fast dictionary API)
 
   Advanced experimental functions can be accessed using #define ZSTD_STATIC_LINKING_ONLY before including zstd.h.
-  These APIs shall never be used with a dynamic library.
+  Advanced experimental APIs shall never be used with a dynamic library.
   They are not "stable", their definition may change in the future. Only static linking is allowed.
 

Version


 
-
unsigned ZSTD_versionNumber(void);   /**< library version number; to be used when checking dll version */
+
unsigned ZSTD_versionNumber(void);   /**< useful to check dll version */
 

Simple API


 
@@ -66,28 +67,24 @@
 
size_t ZSTD_decompress( void* dst, size_t dstCapacity,
                   const void* src, size_t compressedSize);
 

`compressedSize` : must be the _exact_ size of some number of compressed and/or skippable frames. - `dstCapacity` is an upper bound of originalSize. + `dstCapacity` is an upper bound of originalSize to regenerate. If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data. @return : the number of bytes decompressed into `dst` (<= `dstCapacity`), or an errorCode if it fails (which can be tested using ZSTD_isError()).


unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
-

NOTE: This function is planned to be obsolete, in favour of ZSTD_getFrameContentSize. - ZSTD_getFrameContentSize functions the same way, returning the decompressed size of a single - frame, but distinguishes empty frames from frames with an unknown size, or errors. +

NOTE: This function is planned to be obsolete, in favor of ZSTD_getFrameContentSize(). + ZSTD_getFrameContentSize() works the same way, + returning the decompressed size of a single frame, + but distinguishes empty frames from frames with an unknown size, or errors. - Additionally, ZSTD_findDecompressedSize can be used instead. It can handle multiple - concatenated frames in one buffer, and so is more general. - As a result however, it requires more computation and entire frames to be passed to it, - as opposed to ZSTD_getFrameContentSize which requires only a single frame's header. - 'src' is the start of a zstd compressed frame. @return : content size to be decompressed, as a 64-bits value _if known_, 0 otherwise. - note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. + note 1 : decompressed size is an optional field, it may not be present, typically in streaming mode. When `return==0`, data to decompress could be any size. In which case, it's necessary to use streaming mode to decompress data. - Optionally, application can still use ZSTD_decompress() while relying on implied limits. + Optionally, application can use ZSTD_decompress() while relying on implied limits. (For example, data may be necessarily cut into blocks <= 16 KB). note 2 : decompressed size is always present when compression is done with ZSTD_compress() note 3 : decompressed size can be very large (64-bits value), @@ -96,7 +93,7 @@ note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. Always ensure result fits within application's authorized limits. Each application can set its own limits. - note 5 : when `return==0`, if precise failure cause is needed, use ZSTD_getFrameParams() to know more. + note 5 : when `return==0`, if precise failure cause is needed, use ZSTD_getFrameHeader() to know more.


Helper functions

int         ZSTD_maxCLevel(void);               /*!< maximum compression level available */
@@ -114,20 +111,26 @@ const char* ZSTD_getErrorName(size_t code);     /*
 ZSTD_CCtx* ZSTD_createCCtx(void);
 size_t     ZSTD_freeCCtx(ZSTD_CCtx* cctx);
 

-
size_t ZSTD_compressCCtx(ZSTD_CCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel);
+
size_t ZSTD_compressCCtx(ZSTD_CCtx* ctx,
+                         void* dst, size_t dstCapacity,
+                   const void* src, size_t srcSize,
+                         int compressionLevel);
 

Same as ZSTD_compress(), requires an allocated ZSTD_CCtx (see ZSTD_createCCtx()).


Decompression context

  When decompressing many times,
-  it is recommended to allocate a context just once, and re-use it for each successive compression operation.
+  it is recommended to allocate a context only once,
+  and re-use it for each successive compression operation.
   This will make workload friendlier for system's memory.
-  Use one context per thread for parallel execution in multi-threaded environments. 
+  Use one context per thread for parallel execution. 
 
typedef struct ZSTD_DCtx_s ZSTD_DCtx;
 ZSTD_DCtx* ZSTD_createDCtx(void);
 size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
 

-
size_t ZSTD_decompressDCtx(ZSTD_DCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
-

Same as ZSTD_decompress(), requires an allocated ZSTD_DCtx (see ZSTD_createDCtx()). +

size_t ZSTD_decompressDCtx(ZSTD_DCtx* ctx,
+                           void* dst, size_t dstCapacity,
+                     const void* src, size_t srcSize);
+

Same as ZSTD_decompress(), requires an allocated ZSTD_DCtx (see ZSTD_createDCtx())


Simple dictionary API


@@ -137,32 +140,33 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
                          const void* src, size_t srcSize,
                          const void* dict,size_t dictSize,
                                int compressionLevel);
-

Compression using a predefined Dictionary (see dictBuilder/zdict.h). - Note : This function loads the dictionary, resulting in significant startup delay. - Note : When `dict == NULL || dictSize < 8` no dictionary is used. +

Compression using a predefined Dictionary (see dictBuilder/zdict.h). + Note : This function loads the dictionary, resulting in significant startup delay. + Note : When `dict == NULL || dictSize < 8` no dictionary is used.


size_t ZSTD_decompress_usingDict(ZSTD_DCtx* dctx,
                                  void* dst, size_t dstCapacity,
                            const void* src, size_t srcSize,
                            const void* dict,size_t dictSize);
-

Decompression using a predefined Dictionary (see dictBuilder/zdict.h). - Dictionary must be identical to the one used during compression. - Note : This function loads the dictionary, resulting in significant startup delay. - Note : When `dict == NULL || dictSize < 8` no dictionary is used. +

Decompression using a predefined Dictionary (see dictBuilder/zdict.h). + Dictionary must be identical to the one used during compression. + Note : This function loads the dictionary, resulting in significant startup delay. + Note : When `dict == NULL || dictSize < 8` no dictionary is used.


-

Fast dictionary API


+

Bulk processing dictionary API


 
-
ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize, int compressionLevel);
-

When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. - ZSTD_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. - ZSTD_CDict can be created once and used by multiple threads concurrently, as its usage is read-only. - `dictBuffer` can be released after ZSTD_CDict creation, as its content is copied within CDict +

ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize,
+                             int compressionLevel);
+

When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. + ZSTD_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. + ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. + `dictBuffer` can be released after ZSTD_CDict creation, since its content is copied within CDict


size_t      ZSTD_freeCDict(ZSTD_CDict* CDict);
-

Function frees memory allocated by ZSTD_createCDict(). +

Function frees memory allocated by ZSTD_createCDict().


size_t ZSTD_compress_usingCDict(ZSTD_CCtx* cctx,
@@ -176,20 +180,20 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
 


ZSTD_DDict* ZSTD_createDDict(const void* dictBuffer, size_t dictSize);
-

Create a digested dictionary, ready to start decompression operation without startup delay. - dictBuffer can be released after DDict creation, as its content is copied inside DDict +

Create a digested dictionary, ready to start decompression operation without startup delay. + dictBuffer can be released after DDict creation, as its content is copied inside DDict


size_t      ZSTD_freeDDict(ZSTD_DDict* ddict);
-

Function frees memory allocated with ZSTD_createDDict() +

Function frees memory allocated with ZSTD_createDDict()


size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx,
                                   void* dst, size_t dstCapacity,
                             const void* src, size_t srcSize,
                             const ZSTD_DDict* ddict);
-

Decompression using a digested Dictionary. - Faster startup than ZSTD_decompress_usingDict(), recommended when same dictionary is used multiple times. +

Decompression using a digested Dictionary. + Faster startup than ZSTD_decompress_usingDict(), recommended when same dictionary is used multiple times.


Streaming


@@ -236,14 +240,18 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
   ZSTD_endStream() instructs to finish a frame.
   It will perform a flush and write frame epilogue.
   The epilogue is required for decoders to consider a frame completed.
-  Similar to ZSTD_flushStream(), it may not be able to flush the full content if `output->size` is too small.
+  ZSTD_endStream() may not be able to flush full data if `output->size` is too small.
   In which case, call again ZSTD_endStream() to complete the flush.
-  @return : nb of bytes still present within internal buffer (0 if it's empty, hence compression completed)
+  @return : 0 if frame fully completed and fully flushed,
+             or >0 if some data is still present within internal buffer
+                  (value is minimum size estimation for remaining data to flush, but it could be more)
             or an error code, which can be tested using ZSTD_isError().
 
  
 
+
typedef ZSTD_CCtx ZSTD_CStream;  /**< CCtx and CStream are now effectively same object (>= v1.3.0) */
+

ZSTD_CStream management functions

ZSTD_CStream* ZSTD_createCStream(void);
 size_t ZSTD_freeCStream(ZSTD_CStream* zcs);
 

@@ -277,6 +285,8 @@ size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffe
+
typedef ZSTD_DCtx ZSTD_DStream;  /**< DCtx and DStream are now effectively same object (>= v1.3.0) */
+

ZSTD_DStream management functions

ZSTD_DStream* ZSTD_createDStream(void);
 size_t ZSTD_freeDStream(ZSTD_DStream* zds);
 

@@ -296,7 +306,8 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_o

Advanced types


 
-
typedef enum { ZSTD_fast, ZSTD_dfast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2, ZSTD_btlazy2, ZSTD_btopt, ZSTD_btopt2 } ZSTD_strategy;   /* from faster to stronger */
+
typedef enum { ZSTD_fast=1, ZSTD_dfast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2,
+               ZSTD_btlazy2, ZSTD_btopt, ZSTD_btultra } ZSTD_strategy;   /* from faster to stronger */
 

typedef struct {
     unsigned windowLog;      /**< largest match distance : larger == more compression, more memory needed during decompression */
@@ -319,68 +330,141 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_o
     ZSTD_frameParameters fParams;
 } ZSTD_parameters;
 

+
typedef struct {
+    unsigned long long frameContentSize;
+    size_t windowSize;
+    unsigned dictID;
+    unsigned checksumFlag;
+} ZSTD_frameHeader;
+

Custom memory allocation functions

typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
 typedef void  (*ZSTD_freeFunction) (void* opaque, void* address);
 typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
+/* use this constant to defer to stdlib's functions */
+static const ZSTD_customMem ZSTD_defaultCMem = { NULL, NULL, NULL };
 

-

Compressed size functions


+

Frame size functions


 
 
size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize);
 

`src` should point to the start of a ZSTD encoded frame or skippable frame `srcSize` must be at least as large as the frame - @return : the compressed size of the frame pointed to by `src`, suitable to pass to - `ZSTD_decompress` or similar, or an error code if given invalid input. + @return : the compressed size of the frame pointed to by `src`, + suitable to pass to `ZSTD_decompress` or similar, + or an error code if given invalid input.


-

Decompressed size functions


-
-
unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize);
-

`src` should point to the start of a ZSTD encoded frame - `srcSize` must be at least as large as the frame header. A value greater than or equal - to `ZSTD_frameHeaderSize_max` is guaranteed to be large enough in all cases. - @return : decompressed size of the frame pointed to be `src` if known, otherwise - - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined - - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) +

#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
+#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
+unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize);
+

`src` should point to the start of a ZSTD encoded frame. + `srcSize` must be at least as large as the frame header. + A value >= `ZSTD_frameHeaderSize_max` is guaranteed to be large enough. + @return : - decompressed size of the frame pointed to be `src` if known + - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined + - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small)


unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
-

`src` should point the start of a series of ZSTD encoded and/or skippable frames - `srcSize` must be the _exact_ size of this series +

`src` should point the start of a series of ZSTD encoded and/or skippable frames + `srcSize` must be the _exact_ size of this series (i.e. there should be a frame boundary exactly `srcSize` bytes after `src`) - @return : the decompressed size of all data in the contained frames, as a 64-bit value _if known_ - - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN - - if an error occurred: ZSTD_CONTENTSIZE_ERROR + @return : - decompressed size of all data in all successive frames + - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN + - if an error occurred: ZSTD_CONTENTSIZE_ERROR - note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. - When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. - In which case, it's necessary to use streaming mode to decompress data. - Optionally, application can still use ZSTD_decompress() while relying on implied limits. - (For example, data may be necessarily cut into blocks <= 16 KB). - note 2 : decompressed size is always present when compression is done with ZSTD_compress() - note 3 : decompressed size can be very large (64-bits value), - potentially larger than what local system can handle as a single memory segment. - In which case, it's necessary to use streaming mode to decompress data. - note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. - Always ensure result fits within application's authorized limits. - Each application can set its own limits. - note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to - read each contained frame header. This is efficient as most of the data is skipped, - however it does mean that all frame data must be present and valid. + note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. + When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. + In which case, it's necessary to use streaming mode to decompress data. + Optionally, application can still use ZSTD_decompress() while relying on implied limits. + (For example, data may be necessarily cut into blocks <= 16 KB). + note 2 : decompressed size is always present when compression is done with ZSTD_compress() + note 3 : decompressed size can be very large (64-bits value), + potentially larger than what local system can handle as a single memory segment. + In which case, it's necessary to use streaming mode to decompress data. + note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. + Always ensure result fits within application's authorized limits. + Each application can set its own limits. + note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to + read each contained frame header. This is efficient as most of the data is skipped, + however it does mean that all frame data must be present and valid.


-

Advanced compression functions


+
size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
+

`src` should point to the start of a ZSTD frame + `srcSize` must be >= ZSTD_frameHeaderSize_prefix. + @return : size of the Frame Header +


-
size_t ZSTD_estimateCCtxSize(ZSTD_compressionParameters cParams);
-

Gives the amount of memory allocated for a ZSTD_CCtx given a set of compression parameters. - `frameContentSize` is an optional parameter, provide `0` if unknown +

Context memory usage


+
+
size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx);
+size_t ZSTD_sizeof_DCtx(const ZSTD_DCtx* dctx);
+size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs);
+size_t ZSTD_sizeof_DStream(const ZSTD_DStream* zds);
+size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict);
+size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
+

These functions give the current memory usage of selected object. + Object memory usage can evolve if it's re-used multiple times.


+
size_t ZSTD_estimateCCtxSize(int compressionLevel);
+size_t ZSTD_estimateCCtxSize_advanced(ZSTD_compressionParameters cParams);
+size_t ZSTD_estimateDCtxSize(void);
+

These functions make it possible to estimate memory usage + of a future {D,C}Ctx, before its creation. + ZSTD_estimateCCtxSize() will provide a budget large enough for any compression level up to selected one. + It will also consider src size to be arbitrarily "large", which is worst case. + If srcSize is known to always be small, ZSTD_estimateCCtxSize_advanced() can provide a tighter estimation. + ZSTD_estimateCCtxSize_advanced() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel. + Note : CCtx estimation is only correct for single-threaded compression +


+ +
size_t ZSTD_estimateCStreamSize(int compressionLevel);
+size_t ZSTD_estimateCStreamSize_advanced(ZSTD_compressionParameters cParams);
+size_t ZSTD_estimateDStreamSize(size_t windowSize);
+size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
+

ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one. + It will also consider src size to be arbitrarily "large", which is worst case. + If srcSize is known to always be small, ZSTD_estimateCStreamSize_advanced() can provide a tighter estimation. + ZSTD_estimateCStreamSize_advanced() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel. + Note : CStream estimation is only correct for single-threaded compression. + ZSTD_DStream memory budget depends on window Size. + This information can be passed manually, using ZSTD_estimateDStreamSize, + or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame(); + Note : if streaming is init with function ZSTD_init?Stream_usingDict(), + an internal ?Dict will be created, which additional size is not estimated here. + In this case, get total size by adding ZSTD_estimate?DictSize +


+ +
size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel);
+size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, unsigned byReference);
+size_t ZSTD_estimateDDictSize(size_t dictSize, unsigned byReference);
+

ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict(). + ZSTD_estimateCStreamSize_advanced() makes it possible to control precisely compression parameters, like ZSTD_createCDict_advanced(). + Note : dictionary created "byReference" are smaller +


+ +

Advanced compression functions


+
 
ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
 

Create a ZSTD compression context using external alloc and free functions


-
size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx);
-

Gives the amount of memory used by a given ZSTD_CCtx +

ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
+

workspace: The memory area to emplace the context into. + Provided pointer must 8-bytes aligned. + It must outlive context usage. + workspaceSize: Use ZSTD_estimateCCtxSize() or ZSTD_estimateCStreamSize() + to determine how large workspace must be to support scenario. + @return : pointer to ZSTD_CCtx*, or NULL if error (size too small) + Note : zstd will never resize nor malloc() when using a static cctx. + If it needs more memory than available, it will simply error out. + Note 2 : there is no corresponding "free" function. + Since workspace was allocated externally, it must be freed externally too. + Limitation 1 : currently not compatible with internal CDict creation, such as + ZSTD_CCtx_loadDictionary() or ZSTD_initCStream_usingDict(). + Limitation 2 : currently not compatible with multi-threading +


typedef enum {
@@ -399,13 +483,34 @@ typedef struct { ZSTD_allocFunction customAlloc; ZSTD_
   It is important that dictBuffer outlives CDict, it must remain read accessible throughout the lifetime of CDict 
 


-
ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize, unsigned byReference,
+
typedef enum { ZSTD_dm_auto=0,        /* dictionary is "full" if it starts with ZSTD_MAGIC_DICTIONARY, rawContent otherwize */
+               ZSTD_dm_rawContent,    /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */
+               ZSTD_dm_fullDict       /* refuses to load a dictionary if it does not respect Zstandard's specification */
+} ZSTD_dictMode_e;
+

+
ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize,
+                                      unsigned byReference, ZSTD_dictMode_e dictMode,
                                       ZSTD_compressionParameters cParams, ZSTD_customMem customMem);
 

Create a ZSTD_CDict using external alloc and free, and customized compression parameters


-
size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict);
-

Gives the amount of memory used by a given ZSTD_sizeof_CDict +

ZSTD_CDict* ZSTD_initStaticCDict(
+                void* workspace, size_t workspaceSize,
+          const void* dict, size_t dictSize,
+                unsigned byReference, ZSTD_dictMode_e dictMode,
+                ZSTD_compressionParameters cParams);
+

Generate a digested dictionary in provided memory area. + workspace: The memory area to emplace the dictionary into. + Provided pointer must 8-bytes aligned. + It must outlive dictionary usage. + workspaceSize: Use ZSTD_estimateCDictSize() + to determine how large workspace must be. + cParams : use ZSTD_getCParams() to transform a compression level + into its relevants cParams. + @return : pointer to ZSTD_CDict*, or NULL if error (size too small) + Note : there is no corresponding "free" function. + Since workspace was allocated externally, it must be freed externally. +


ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
@@ -423,8 +528,8 @@ typedef struct { ZSTD_allocFunction customAlloc; ZSTD_
 


ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize);
-

optimize params for a given `srcSize` and `dictSize`. - both values are optional, select `0` if unknown. +

optimize params for a given `srcSize` and `dictSize`. + both values are optional, select `0` if unknown.


size_t ZSTD_compress_advanced (ZSTD_CCtx* cctx,
@@ -451,22 +556,32 @@ typedef struct { ZSTD_allocFunction customAlloc; ZSTD_
   Note 3 : Skippable Frame Identifiers are considered valid. 
 


-
size_t ZSTD_estimateDCtxSize(void);
-

Gives the potential amount of memory allocated to create a ZSTD_DCtx -


-
ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
 

Create a ZSTD decompression context using external alloc and free functions


-
size_t ZSTD_sizeof_DCtx(const ZSTD_DCtx* dctx);
-

Gives the amount of memory used by a given ZSTD_DCtx +

ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize);
+

workspace: The memory area to emplace the context into. + Provided pointer must 8-bytes aligned. + It must outlive context usage. + workspaceSize: Use ZSTD_estimateDCtxSize() or ZSTD_estimateDStreamSize() + to determine how large workspace must be to support scenario. + @return : pointer to ZSTD_DCtx*, or NULL if error (size too small) + Note : zstd will never resize nor malloc() when using a static dctx. + If it needs more memory than available, it will simply error out. + Note 2 : static dctx is incompatible with legacy support + Note 3 : there is no corresponding "free" function. + Since workspace was allocated externally, it must be freed externally. + Limitation : currently not compatible with internal DDict creation, + such as ZSTD_initDStream_usingDict(). +


ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize);
 

Create a digested dictionary, ready to start decompression operation without startup delay. - Dictionary content is simply referenced, and therefore stays in dictBuffer. - It is important that dictBuffer outlives DDict, it must remain read accessible throughout the lifetime of DDict + Dictionary content is referenced, and therefore stays in dictBuffer. + It is important that dictBuffer outlives DDict, + it must remain read accessible throughout the lifetime of DDict


ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
@@ -474,8 +589,19 @@ typedef struct { ZSTD_allocFunction customAlloc; ZSTD_
 

Create a ZSTD_DDict using external alloc and free, optionally by reference


-
size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
-

Gives the amount of memory used by a given ZSTD_DDict +

ZSTD_DDict* ZSTD_initStaticDDict(void* workspace, size_t workspaceSize,
+                                 const void* dict, size_t dictSize,
+                                 unsigned byReference);
+

Generate a digested dictionary in provided memory area. + workspace: The memory area to emplace the dictionary into. + Provided pointer must 8-bytes aligned. + It must outlive dictionary usage. + workspaceSize: Use ZSTD_estimateDDictSize() + to determine how large workspace must be. + @return : pointer to ZSTD_DDict*, or NULL if error (size too small) + Note : there is no corresponding "free" function. + Since workspace was allocated externally, it must be freed externally. +


unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize);
@@ -499,19 +625,19 @@ typedef struct { ZSTD_allocFunction customAlloc; ZSTD_
     Note : this use case also happens when using a non-conformant dictionary.
   - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`).
   - This is not a Zstandard frame.
-  When identifying the exact failure cause, it's possible to use ZSTD_getFrameParams(), which will provide a more precise error code. 
+  When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code. 
 


Advanced streaming functions


 
 

Advanced Streaming compression functions

ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem);
-size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs);   /**< size of CStream is variable, depending primarily on compression level */
+ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize);    /**< same as ZSTD_initStaticCCtx() */
 size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, int compressionLevel, unsigned long long pledgedSrcSize);   /**< pledgedSrcSize must be correct, a size of 0 means unknown.  for a frame size of 0 use initCStream_advanced */
-size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel); /**< note: a dict will not be used if dict == NULL or dictSize < 8 */
+size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel); /**< creates of an internal CDict (incompatible with static CCtx), except if dict == NULL or dictSize < 8, in which case no dict is used. */
 size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, const void* dict, size_t dictSize,
                                              ZSTD_parameters params, unsigned long long pledgedSrcSize);  /**< pledgedSrcSize is optional and can be 0 (meaning unknown). note: if the contentSizeFlag is set, pledgedSrcSize == 0 means the source size is actually 0 */
 size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict);  /**< note : cdict will just be referenced, and must outlive compression session */
-size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const ZSTD_CDict* cdict, unsigned long long pledgedSrcSize, ZSTD_frameParameters fParams);  /**< same as ZSTD_initCStream_usingCDict(), with control over frame parameters */
+size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const ZSTD_CDict* cdict, ZSTD_frameParameters fParams, unsigned long long pledgedSrcSize);  /**< same as ZSTD_initCStream_usingCDict(), with control over frame parameters */
 

size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
 

start a new compression job, using same parameters from previous job. @@ -524,11 +650,11 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStre

Advanced Streaming decompression functions

typedef enum { DStream_p_maxWindowSize } ZSTD_DStreamParameter_e;
 ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem);
-size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); /**< note: a dict will not be used if dict == NULL or dictSize < 8 */
+ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize);    /**< same as ZSTD_initStaticDCtx() */
 size_t ZSTD_setDStreamParameter(ZSTD_DStream* zds, ZSTD_DStreamParameter_e paramType, unsigned paramValue);
+size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); /**< note: a dict will not be used if dict == NULL or dictSize < 8 */
 size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict);  /**< note : ddict will just be referenced, and must outlive decompression session */
 size_t ZSTD_resetDStream(ZSTD_DStream* zds);  /**< re-use decompression parameters from previous init; saves dictionary loading */
-size_t ZSTD_sizeof_DStream(const ZSTD_DStream* zds);
 

Buffer-less and synchronous inner streaming functions

   This is an advanced API, giving full control over buffer management, for users which need direct control over memory.
@@ -578,21 +704,24 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx*
   Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it.
   A ZSTD_DCtx object can be re-used multiple times.
 
-  First typical operation is to retrieve frame parameters, using ZSTD_getFrameParams().
-  It fills a ZSTD_frameParams structure which provide important information to correctly decode the frame,
-  such as the minimum rolling buffer size to allocate to decompress data (`windowSize`),
-  and the dictionary ID used.
+  First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader().
+  It fills a ZSTD_frameHeader structure with important information to correctly decode the frame,
+  such as minimum rolling buffer size to allocate to decompress data (`windowSize`),
+  and the dictionary ID in use.
   (Note : content size is optional, it may not be present. 0 means : content size unknown).
   Note that these values could be wrong, either because of data malformation, or because an attacker is spoofing deliberate false information.
   As a consequence, check that values remain within valid application range, especially `windowSize`, before allocation.
-  Each application can set its own limit, depending on local restrictions. For extended interoperability, it is recommended to support at least 8 MB.
-  Frame parameters are extracted from the beginning of the compressed frame.
-  Data fragment must be large enough to ensure successful decoding, typically `ZSTD_frameHeaderSize_max` bytes.
-  @result : 0 : successful decoding, the `ZSTD_frameParams` structure is correctly filled.
+  Each application can set its own limit, depending on local restrictions.
+  For extended interoperability, it is recommended to support windowSize of at least 8 MB.
+  Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough.
+  Data fragment must be large enough to ensure successful decoding.
+  `ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough.
+  @result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled.
            >0 : `srcSize` is too small, please provide at least @result bytes on next attempt.
            errorCode, which can be tested using ZSTD_isError().
 
-  Start decompression, with ZSTD_decompressBegin() or ZSTD_decompressBegin_usingDict().
+  Start decompression, with ZSTD_decompressBegin().
+  If decompression requires a dictionary, use ZSTD_decompressBegin_usingDict() or ZSTD_decompressBegin_usingDDict().
   Alternatively, you can copy a prepared context, using ZSTD_copyDCtx().
 
   Then use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively.
@@ -624,29 +753,196 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx*
   b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits
   c) Frame Content - any content (User Data) of length equal to Frame Size
   For skippable frames ZSTD_decompressContinue() always returns 0.
-  For skippable frames ZSTD_getFrameParams() returns fparamsPtr->windowLog==0 what means that a frame is skippable.
+  For skippable frames ZSTD_getFrameHeader() returns fparamsPtr->windowLog==0 what means that a frame is skippable.
     Note : If fparamsPtr->frameContentSize==0, it is ambiguous: the frame might actually be a Zstd encoded frame with no content.
            For purposes of decompression, it is valid in both cases to skip the frame using
            ZSTD_findFrameCompressedSize to find its size in bytes.
   It also returns Frame Size as fparamsPtr->frameContentSize.
 
-
typedef struct {
-    unsigned long long frameContentSize;
-    unsigned windowSize;
-    unsigned dictID;
-    unsigned checksumFlag;
-} ZSTD_frameParams;
-

-

Buffer-less streaming decompression functions

size_t ZSTD_getFrameParams(ZSTD_frameParams* fparamsPtr, const void* src, size_t srcSize);   /**< doesn't consume input, see details below */
+

Buffer-less streaming decompression functions

size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize);   /**< doesn't consume input */
 size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx);
 size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
+size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
 void   ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx);
-size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx);
-size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
-typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
-ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
 

+
typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
+

+

New advanced API (experimental, and compression only)


+
typedef enum {
+    /* compression parameters */
+    ZSTD_p_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table
+                              * Default level is ZSTD_CLEVEL_DEFAULT==3.
+                              * Special: value 0 means "do not change cLevel". */
+    ZSTD_p_windowLog,        /* Maximum allowed back-reference distance, expressed as power of 2.
+                              * Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
+                              * Special: value 0 means "do not change windowLog". */
+    ZSTD_p_hashLog,          /* Size of the probe table, as a power of 2.
+                              * Resulting table size is (1 << (hashLog+2)).
+                              * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
+                              * Larger tables improve compression ratio of strategies <= dFast,
+                              * and improve speed of strategies > dFast.
+                              * Special: value 0 means "do not change hashLog". */
+    ZSTD_p_chainLog,         /* Size of the full-search table, as a power of 2.
+                              * Resulting table size is (1 << (chainLog+2)).
+                              * Larger tables result in better and slower compression.
+                              * This parameter is useless when using "fast" strategy.
+                              * Special: value 0 means "do not change chainLog". */
+    ZSTD_p_searchLog,        /* Number of search attempts, as a power of 2.
+                              * More attempts result in better and slower compression.
+                              * This parameter is useless when using "fast" and "dFast" strategies.
+                              * Special: value 0 means "do not change searchLog". */
+    ZSTD_p_minMatch,         /* Minimum size of searched matches (note : repCode matches can be smaller).
+                              * Larger values make faster compression and decompression, but decrease ratio.
+                              * Must be clamped between ZSTD_SEARCHLENGTH_MIN and ZSTD_SEARCHLENGTH_MAX.
+                              * Note that currently, for all strategies < btopt, effective minimum is 4.
+                              * Note that currently, for all strategies > fast, effective maximum is 6.
+                              * Special: value 0 means "do not change minMatchLength". */
+    ZSTD_p_targetLength,     /* Only useful for strategies >= btopt.
+                              * Length of Match considered "good enough" to stop search.
+                              * Larger values make compression stronger and slower.
+                              * Special: value 0 means "do not change targetLength". */
+    ZSTD_p_compressionStrategy, /* See ZSTD_strategy enum definition.
+                              * Cast selected strategy as unsigned for ZSTD_CCtx_setParameter() compatibility.
+                              * The higher the value of selected strategy, the more complex it is,
+                              * resulting in stronger and slower compression.
+                              * Special: value 0 means "do not change strategy". */
+
+    /* frame parameters */
+    ZSTD_p_contentSizeFlag=200, /* Content size is written into frame header _whenever known_ (default:1) */
+    ZSTD_p_checksumFlag,     /* A 32-bits checksum of content is written at end of frame (default:0) */
+    ZSTD_p_dictIDFlag,       /* When applicable, dictID of dictionary is provided in frame header (default:1) */
+
+    /* dictionary parameters (must be set before ZSTD_CCtx_loadDictionary) */
+    ZSTD_p_dictMode=300,     /* Select how dictionary content must be interpreted. Value must be from type ZSTD_dictMode_e.
+                              * default : 0==auto : dictionary will be "full" if it respects specification, otherwise it will be "rawContent" */
+    ZSTD_p_refDictContent,   /* Dictionary content will be referenced, instead of copied (default:0==byCopy).
+                              * It requires that dictionary buffer outlives its users */
+
+    /* multi-threading parameters */
+    ZSTD_p_nbThreads=400,    /* Select how many threads a compression job can spawn (default:1)
+                              * More threads improve speed, but also increase memory usage.
+                              * Can only receive a value > 1 if ZSTD_MULTITHREAD is enabled.
+                              * Special: value 0 means "do not change nbThreads" */
+    ZSTD_p_jobSize,          /* Size of a compression job. Each compression job is completed in parallel.
+                              * 0 means default, which is dynamically determined based on compression parameters.
+                              * Job size must be a minimum of overlapSize, or 1 KB, whichever is largest
+                              * The minimum size is automatically and transparently enforced */
+    ZSTD_p_overlapSizeLog,   /* Size of previous input reloaded at the beginning of each job.
+                              * 0 => no overlap, 6(default) => use 1/8th of windowSize, >=9 => use full windowSize */
+
+    /* advanced parameters - may not remain available after API update */
+    ZSTD_p_forceMaxWindow=1100, /* Force back-reference distances to remain < windowSize,
+                              * even when referencing into Dictionary content (default:0) */
+
+} ZSTD_cParameter;
+

+
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value);
+

Set one compression parameter, selected by enum ZSTD_cParameter. + Note : when `value` is an enum, cast it to unsigned for proper type checking. + @result : 0, or an error code (which can be tested with ZSTD_isError()). +


+ +
size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize);
+

Total input data size to be compressed as a single frame. + This value will be controlled at the end, and result in error if not respected. + @result : 0, or an error code (which can be tested with ZSTD_isError()). + Note 1 : 0 means zero, empty. + In order to mean "unknown content size", pass constant ZSTD_CONTENTSIZE_UNKNOWN. + Note that ZSTD_CONTENTSIZE_UNKNOWN is default value for new compression jobs. + Note 2 : If all data is provided and consumed in a single round, + this value is overriden by srcSize instead. +


+ +
size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
+

Create an internal CDict from dict buffer. + Decompression will have to use same buffer. + @result : 0, or an error code (which can be tested with ZSTD_isError()). + Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, + meaning "return to no-dictionary mode". + Note 1 : `dict` content will be copied internally, + except if ZSTD_p_refDictContent is set before loading. + Note 2 : Loading a dictionary involves building tables, which are dependent on compression parameters. + For this reason, compression parameters cannot be changed anymore after loading a dictionary. + It's also a CPU-heavy operation, with non-negligible impact on latency. + Note 3 : Dictionary will be used for all future compression jobs. + To return to "no-dictionary" situation, load a NULL dictionary +


+ +
size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
+

Reference a prepared dictionary, to be used for all next compression jobs. + Note that compression parameters are enforced from within CDict, + and supercede any compression parameter previously set within CCtx. + The dictionary will remain valid for future compression jobs using same CCtx. + @result : 0, or an error code (which can be tested with ZSTD_isError()). + Special : adding a NULL CDict means "return to no-dictionary mode". + Note 1 : Currently, only one dictionary can be managed. + Adding a new dictionary effectively "discards" any previous one. + Note 2 : CDict is just referenced, its lifetime must outlive CCtx. + +


+ +
size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize);
+

Reference a prefix (single-usage dictionary) for next compression job. + Decompression need same prefix to properly regenerate data. + Prefix is **only used once**. Tables are discarded at end of compression job. + Subsequent compression jobs will be done without prefix (if none is explicitly referenced). + If there is a need to use same prefix multiple times, consider embedding it into a ZSTD_CDict instead. + @result : 0, or an error code (which can be tested with ZSTD_isError()). + Special : Adding any prefix (including NULL) invalidates any previous prefix or dictionary + Note 1 : Prefix buffer is referenced. It must outlive compression job. + Note 2 : Referencing a prefix involves building tables, which are dependent on compression parameters. + It's a CPU-heavy operation, with non-negligible impact on latency. + Note 3 : it's possible to alter ZSTD_p_dictMode using ZSTD_CCtx_setParameter() +


+ +
typedef enum {
+    ZSTD_e_continue=0, /* collect more data, encoder transparently decides when to output result, for optimal conditions */
+    ZSTD_e_flush,      /* flush any data provided so far - frame will continue, future data can still reference previous data for better compression */
+    ZSTD_e_end         /* flush any remaining data and ends current frame. Any future compression starts a new frame. */
+} ZSTD_EndDirective;
+

+
size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
+                              ZSTD_outBuffer* output,
+                              ZSTD_inBuffer* input,
+                              ZSTD_EndDirective endOp);
+

Behave about the same as ZSTD_compressStream. To note : + - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_setParameter() + - Compression parameters cannot be changed once compression is started. + - *dstPos must be <= dstCapacity, *srcPos must be <= srcSize + - *dspPos and *srcPos will be updated. They are guaranteed to remain below their respective limit. + - @return provides the minimum amount of data still to flush from internal buffers + or an error code, which can be tested using ZSTD_isError(). + if @return != 0, flush is not fully completed, there is some data left within internal buffers. + - after a ZSTD_e_end directive, if internal buffer is not fully flushed, + only ZSTD_e_end or ZSTD_e_flush operations are allowed. + It is necessary to fully flush internal buffers + before starting a new compression job, or changing compression parameters. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jul 14 14:58:11 2017 Return-Path: Delivered-To: svn-src-head@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 DBBA7DA3EF9; Fri, 14 Jul 2017 14:58:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 95A24690D5; Fri, 14 Jul 2017 14:58:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EEwAsH020654; Fri, 14 Jul 2017 14:58:10 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EEwAv6020653; Fri, 14 Jul 2017 14:58:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201707141458.v6EEwAv6020653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 14 Jul 2017 14:58:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320988 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 320988 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 14:58:12 -0000 Author: bapt Date: Fri Jul 14 14:58:10 2017 New Revision: 320988 URL: https://svnweb.freebsd.org/changeset/base/320988 Log: Update pci_vendors to 2017.07.13 MFC after: 2 days Modified: head/share/misc/pci_vendors Modified: head/share/misc/pci_vendors ============================================================================== --- head/share/misc/pci_vendors Fri Jul 14 14:55:34 2017 (r320987) +++ head/share/misc/pci_vendors Fri Jul 14 14:58:10 2017 (r320988) @@ -3,8 +3,8 @@ # # List of PCI ID's # -# Version: 2017.05.25 -# Date: 2017-05-25 03:15:02 +# Version: 2017.07.13 +# Date: 2017-07-13 03:15:01 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -561,6 +561,7 @@ 00af SAS3408 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) 1d49 0200 ThinkSystem 430-8i SAS/SATA 12Gb HBA 1d49 0202 ThinkSystem 430-8e SAS/SATA 12Gb HBA + 1d49 0204 ThinkSystem 430-8i SAS/SATA 12Gb Dense HBA 00be SAS3504 Fusion-MPT Tri-Mode RAID On Chip (ROC) 00bf SAS3404 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) 00c0 SAS3324 PCI-Express Fusion-MPT SAS-3 @@ -2139,13 +2140,12 @@ # Radeon HD 7970 X2 1787 2317 Radeon HD 7990 1787 3000 Tahiti XT2 [Radeon HD 7970 GHz Edition] - 6799 New Zealand [Radeon HD 7900 Series] 679a Tahiti PRO [Radeon HD 7950/8950 OEM / R9 280] 1002 0b01 Radeon HD 8950 OEM 1002 3000 Tahiti PRO2 [Radeon HD 7950 Boost] 1462 3000 Radeon HD 8950 OEM 174b a003 Radeon R9 280 - 679b Malta [Radeon HD 7990] + 679b Malta [Radeon HD 7990/8990 OEM] 1002 0b28 Radeon HD 8990 OEM 1002 0b2a Radeon HD 7990 1462 8036 Radeon HD 8990 OEM @@ -2205,28 +2205,34 @@ 174b e324 Sapphire Nitro R9 390 67b9 Vesuvius [Radeon R9 295X2] 67be Hawaii LE - 67c0 Ellesmere [Polaris10] + 67c0 Ellesmere [Radeon Pro WX 7100] 67c4 Ellesmere [Radeon Pro WX 7100] + 1002 0336 Radeon Pro Duo + 1002 1336 Radeon Pro Duo 67c7 Ellesmere [Radeon Pro WX 5100] 67ca Ellesmere [Polaris10] 67cc Ellesmere [Polaris10] 67cf Ellesmere [Polaris10] - 67df Ellesmere [Radeon RX 470/480] + 67df Ellesmere [Radeon RX 470/480/570/580] 1002 0b37 Radeon RX 480 1043 04a8 Radeon RX 480 1043 04b0 Radeon RX 470 1043 04fb Radeon RX 480 1043 04fd Radeon RX 480 8GB + 1458 22f0 Radeon RX 570 1462 3411 Radeon RX 470 1462 3413 Radeon RX 480 148c 2372 Radeon RX 480 148c 2373 Radeon RX 470 1682 9470 Radeon RX 470 1682 9480 Radeon RX 480 + 1682 9588 Radeon RX 580 XTR 174b e347 Radeon RX 470/480 174b e349 Radeon RX 470 1787 a470 Radeon RX 470 1787 a480 Radeon RX 480 + 1da2 e353 Sapphire Radeon RX 580 Pulse 8GB + 1da2 e366 Radeon RX 570 67e0 Baffin [Polaris11] 67e1 Baffin [Polaris11] 67e3 Baffin [Radeon Pro WX 4100] @@ -2234,7 +2240,7 @@ 67e9 Baffin [Polaris11] 67eb Baffin [Polaris11] 67ef Baffin [Radeon RX 460] - 67ff Baffin [Polaris11] + 67ff Baffin [Radeon RX 560] 6800 Wimbledon XT [Radeon HD 7970M] 1002 0124 Radeon HD 7970M 8086 2110 Radeon HD 7970M @@ -2430,6 +2436,7 @@ 144d c0c7 Radeon HD 7550M 6842 Thames LE [Radeon HD 7000M Series] 6843 Thames [Radeon HD 7670M] + 6863 Vega 10 [Radeon Vega Frontier Edition] 687f Vega [Radeon RX Vega] 6888 Cypress XT [FirePro V8800] 6889 Cypress PRO [FirePro V7800] @@ -2940,9 +2947,10 @@ 174b e308 Radeon R9 380 Nitro 4G D5 6980 Polaris12 6981 Polaris12 - 6985 Polaris12 + 6985 Lexa XT [Radeon PRO WX 3100] 6986 Polaris12 6987 Polaris12 + 6995 Lexa XT [Radeon PRO WX 2100] 699f Lexa PRO [Radeon RX 550] 700f RS100 AGP Bridge 7010 RS200/RS250 AGP Bridge @@ -3804,6 +3812,7 @@ 1014 0338 PCI-X DDR Auxiliary Cache Adapter (575C) 0302 Winnipeg PCI-X Host Bridge 0308 CalIOC2 PCI-E Root Port + 0311 FC 5740/1954 4-Port 10/100/1000 Base-TX PCI-X Adapter for POWER 0314 ZISC 036 Neural accelerator card 032d Axon - Cell Companion Chip 1014 03a1 PCIe PowerXCell 8i Cell Accelerator Board @@ -3834,6 +3843,7 @@ 1014 04c7 PCIe3 x 8 Cache SAS RAID Internal Adapter 6GB(2CCA) 1014 04c8 PCIe3 x 8 Cache SAS RAID Internal Adapter 6GB(2CD2) 1014 04c9 PCIe3 x 8 Cache SAS RAID Internal Adapter 6GB(2CCD) + 03dc POWER8 Host Bridge (PHB3) 044b GenWQE Accelerator Adapter 04aa Flash Adapter 90 (PCIe2 0.9TB) 04da PCI-E IPR SAS+ Adapter (ASIC) @@ -4499,6 +4509,8 @@ 0533 MGA G200EH 103c 3381 iLO4 0534 G200eR2 + 0538 G200eH + 1590 00e4 iLO5 VGA 0540 M91XX 102b 2080 M9140 LP PCIe x16 102b 20c0 Xenia @@ -5011,6 +5023,8 @@ 12ee PCI-X 2.0 Local Bus Adapter 1302 RMP-3 Shared Memory Driver 1303 RMP-3 (Remote Management Processor) + 22f6 iLO5 Virtual USB Controller + 1590 00e4 iLO5 Standard Virtual USB Controller 2910 E2910A PCIBus Exerciser 2925 E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer 3206 Adaptec Embedded Serial ATA HostRAID @@ -5398,6 +5412,7 @@ 1546 803c FWB-PCIE1X11B 8240 XIO2001 PCI Express-to-PCI Bridge 8241 TUSB73x0 SuperSpeed USB 3.0 xHCI Host Controller + 1014 04b2 S824 (8286-42A) 8400 ACX 100 22Mbps Wireless Interface 1186 3b00 DWL-650+ PC Card cardbus 22Mbs Wireless Adapter [AirPlus] 1186 3b01 DWL-520+ 22Mbps PCI Wireless Adapter @@ -6015,6 +6030,7 @@ 1077 02a7 QL45212-DE 25GbE Adapter 1077 e4f6 FastLinQ QL45211H 25GbE Adapter 1077 e4f7 FastLinQ QL45212H 25GbE Adapter + 1590 0223 Synergy 6810C 25/50Gb Ethernet Adapter 165c FastLinQ QL45000 Series 40GbE Controller (FCoE) 1077 e4f1 FastLinQ QL45462H 40GbE FCoE Adapter 1077 e4f2 FastLinQ QL45461H 40GbE FCoE Adapter @@ -6068,8 +6084,12 @@ 2432 ISP2432-based 4Gb Fibre Channel to PCI Express HBA 103c 7040 FC1142SR 4Gb 1-port PCIe Fibre Channel Host Bus Adapter [HPAE311A] 2532 ISP2532-based 8Gb Fibre Channel to PCI Express HBA + 1014 041e FC EN0Y/EN12 PCIe2 LP 8 Gb 4-port Fibre Channel Adapter for POWER 103c 3262 StorageWorks 81Q 103c 3263 StorageWorks 82Q + 1077 015c QLE2560 PCI Express to 8Gb FC Single Channel + 1077 015d QLE2562 PCI Express to 8Gb FC Dual Channel + 1077 015e QLE2564 PCI Express to 8Gb FC Quad Channel 1077 0167 QME2572 Dual Port FC8 HBA Mezzanine 1590 00fc StoreFabric 84Q 8Gb Quad Port Fibre Channel Host Bus Adapter 3022 ISP4022-based Ethernet NIC @@ -6084,6 +6104,7 @@ 7322 IBA7322 QDR InfiniBand HCA 8000 10GbE Converged Network Adapter (TCP/IP Networking) 8001 10GbE Converged Network Adapter (FCoE) + 1014 03af FC 5708/5270 10 Gb FCoE PCIe Dual Port Adapter for POWER 8020 cLOM8214 1/10GbE Controller 1028 1f64 QMD8262-k 10G DP bNDC KR 103c 3346 CN1000Q Dual Port Converged Network Adapter @@ -6107,15 +6128,27 @@ 8031 8300 Series 10GbE Converged Network Adapter (FCoE) 8032 8300 Series 10GbE Converged Network Adapter (iSCSI) 8070 FastLinQ QL41000 Series 10/25/40/50GbE Controller + 1077 0001 10GE 2P QL41162HxRJ-DE Adapter + 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 000b 25GE 2P QL41262HxCU-DE Adapter 1077 0011 FastLinQ QL41212H 25GbE Adapter 1077 0012 FastLinQ QL41112H 10GbE Adapter 8080 FastLinQ QL41000 Series 10/25/40/50GbE Controller (FCoE) + 1077 0001 10GE 2P QL41162HxRJ-DE Adapter + 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 000b 25GE 2P QL41262HxCU-DE Adapter 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter 1077 000e FastLinQ QL41162H 10GbE FCoE Adapter 8084 FastLinQ QL41000 Series 10/25/40/50GbE Controller (iSCSI) + 1077 0001 10GE 2P QL41162HxRJ-DE Adapter + 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 000b 25GE 2P QL41262HxCU-DE Adapter 1077 000d FastLinQ QL41262H 25GbE iSCSI Adapter 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter 8090 FastLinQ QL41000 Series Gigabit Ethernet Controller (SR-IOV VF) + 1077 0001 25GE 2P QL41262HxCU-DE Adapter + 1077 0002 10GE 2P QL41112HxCU-DE Adapter + 1077 000b 25GE 2P QL41262HxCU-DE Adapter 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter (SR-IOV VF) 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter (SR-IOV VF) 1077 0011 FastLinQ QL41212H 25GbE Adapter (SR-IOV VF) @@ -9947,6 +9980,8 @@ 0f02 GF108 [GeForce GT 730] 0f06 GF108 [GeForce GT 730] 0fb0 GM200 High Definition Audio + 0fb8 GP108 High Definition Audio Controller + 0fb9 GP107GL High Definition Audio Controller 0fbb GM204 High Definition Audio Controller 0fc0 GK107 [GeForce GT 640 OEM] 0fc1 GK107 [GeForce GT 640] @@ -10620,6 +10655,7 @@ 134f GM108M [GeForce 920MX] 137a GM108GLM [Quadro K620M / Quadro M500M] 17aa 505a Quadro M500M + 137b GM108GLM [Quadro M520 Mobile] 137d GM108M [GeForce 940A] 1380 GM107 [GeForce GTX 750 Ti] 1381 GM107 [GeForce GTX 750] @@ -10665,6 +10701,7 @@ 13d8 GM204M [GeForce GTX 970M] 13d9 GM204M [GeForce GTX 965M] 13da GM204M [GeForce GTX 980] + 13e7 GM204 [GeForce GTX 980 Engineering Sample] 13f0 GM204GL [Quadro M5000] 13f1 GM204GL [Quadro M4000] 13f2 GM204GL [Tesla M60] @@ -10690,7 +10727,7 @@ 1617 GM204M [GeForce GTX 980M] 1618 GM204M [GeForce GTX 970M] 1619 GM204M [GeForce GTX 965M] - 161a GM204M [GeForce GTX 980] + 161a GM204M [GeForce GTX 980 Mobile] 1667 GM204M [GeForce GTX 965M] 1725 GP100 172e GP100 @@ -10744,10 +10781,11 @@ 1ca7 GP107GL 1ca8 GP107GL 1caa GP107GL - 1cb1 GP107GL [Quardo P1000] - 1cb2 GP107GL [Quardo P600] - 1cb3 GP107GL [Quardo P400] + 1cb1 GP107GL [Quadro P1000] + 1cb2 GP107GL [Quadro P600] + 1cb3 GP107GL [Quadro P400] 1d01 GP108 [GeForce GT 1030] + 1d10 GP108 [GeForce MX150] 1d81 GV100 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) @@ -10771,7 +10809,8 @@ e100 Proteus-X: LightPulse IOV Fibre Channel Host Adapter e131 LightPulse 8Gb/s PCIe Shared I/O Fibre Channel Adapter e180 Proteus-X: LightPulse IOV Fibre Channel Host Adapter - e200 Lancer-X: LightPulse Fibre Channel Host Adapter + e200 LightPulse LPe16002 + 1014 03f1 PCIe2 16 Gb 2-port Fibre Channel Adapter (FC EL5B; CCIN 577F) e208 LightPulse 16Gb Fibre Channel Host Adapter (Lancer-VF) e220 OneConnect NIC (Lancer) 17aa 1054 ThinkServer LPm16002B-M6-L AnyFabric @@ -10800,6 +10839,7 @@ f0e5 Zephyr LightPulse Fibre Channel Host Adapter f0f5 Neptune LightPulse Fibre Channel Host Adapter f100 Saturn-X: LightPulse Fibre Channel Host Adapter + 1014 038a 8Gb PCI Express Dual Port FC Adapter for POWER 103c 3282 8Gb Dual-port PCI-e FC HBA f111 Saturn-X LightPulse Fibre Channel Host Adapter f112 Saturn-X LightPulse Fibre Channel Host Adapter @@ -10822,6 +10862,8 @@ fc40 Saturn-X: LightPulse Fibre Channel Host Adapter fc50 Proteus-X: LightPulse IOV Fibre Channel Host Adapter fd00 Helios-X LightPulse Fibre Channel Host Adapter +# Also IBM FC 5759 / FC 1910 for POWER + 10df fd02 LightPulse LP11002 Dual-port 4Gigabit PCI Fibre Channel Adapter fd11 Helios-X LightPulse Fibre Channel Host Adapter fd12 Helios-X LightPulse Fibre Channel Host Adapter fe00 Zephyr-X LightPulse Fibre Channel Host Adapter @@ -10923,6 +10965,7 @@ 524a RTS524A PCI Express Card Reader 5250 RTS5250 PCI Express Card Reader 525a RTS525A PCI Express Card Reader + 17aa 224f ThinkPad X1 Carbon 5th Gen 5286 RTS5286 PCI Express Card Reader 5287 RTL8411B PCI Express Card Reader 5288 RTS5288 PCI Express Card Reader @@ -11028,6 +11071,7 @@ 1775 11cc CC11/CL11 1849 8168 Motherboard (one of many) 7470 3468 TG-3468 Gigabit PCI Express Network Adapter + 8086 2055 NUC Kit DN2820FYKH 8086 d615 Desktop Board D510MO/D525MW 8169 RTL8169 PCI Gigabit Ethernet Controller 1025 0079 Aspire 5024WLMi @@ -14773,7 +14817,7 @@ 12d6 Analogic Corp 12d7 Biotronic SRL 12d8 Pericom Semiconductor - 01a7 PI7C21P100 PCI to PCI Bridge + 01a7 7C21P100 2-port PCI-X to PCI-X Bridge 400a PI7C9X442SL PCI Express Bridge Port 400e PI7C9X442SL USB OHCI Controller 400f PI7C9X442SL USB EHCI Controller @@ -15081,6 +15125,8 @@ 5160 RealSSD P420h 5161 RealSSD P420m 5163 RealSSD P425m + 5180 9100 PRO NVMe SSD + 5181 9100 MAX NVMe SSD 1345 Arescom Inc 1347 Odetics 1349 Sumitomo Electric Industries, Ltd. @@ -16081,6 +16127,7 @@ 509f T540-509F Unified Wire Ethernet Controller 50a0 T540-50A0 Unified Wire Ethernet Controller 50a1 T540-50A1 Unified Wire Ethernet Controller + 50a2 T580-50A2 Unified Wire Ethernet Controller 5401 T520-CR Unified Wire Ethernet Controller 5402 T522-CR Unified Wire Ethernet Controller 5403 T540-CR Unified Wire Ethernet Controller @@ -16133,6 +16180,7 @@ 549f T540-509F Unified Wire Ethernet Controller 54a0 T540-50A0 Unified Wire Ethernet Controller 54a1 T540-50A1 Unified Wire Ethernet Controller + 54a2 T580-50A2 Unified Wire Ethernet Controller 5501 T520-CR Unified Wire Storage Controller 5502 T522-CR Unified Wire Storage Controller 5503 T540-CR Unified Wire Storage Controller @@ -16185,6 +16233,7 @@ 559f T540-509F Unified Wire Storage Controller 55a0 T540-50A0 Unified Wire Storage Controller 55a1 T540-50A1 Unified Wire Storage Controller + 55a2 T580-50A2 Unified Wire Storage Controller 5601 T520-CR Unified Wire Storage Controller 5602 T522-CR Unified Wire Storage Controller 5603 T540-CR Unified Wire Storage Controller @@ -16237,6 +16286,7 @@ 569f T540-509F Unified Wire Storage Controller 56a0 T540-50A0 Unified Wire Storage Controller 56a1 T540-50A1 Unified Wire Storage Controller + 56a2 T580-50A2 Unified Wire Storage Controller 5701 T520-CR Unified Wire Ethernet Controller 5702 T522-CR Unified Wire Ethernet Controller 5703 T540-CR Unified Wire Ethernet Controller @@ -16328,6 +16378,7 @@ 589f T540-509F Unified Wire Ethernet Controller [VF] 58a0 T540-50A0 Unified Wire Ethernet Controller [VF] 58a1 T540-50A1 Unified Wire Ethernet Controller [VF] + 58a2 T580-50A2 Unified Wire Ethernet Controller [VF] 6001 T6225-CR Unified Wire Ethernet Controller 6002 T6225-SO-CR Unified Wire Ethernet Controller 6003 T6425-CR Unified Wire Ethernet Controller @@ -16343,6 +16394,9 @@ 6015 T6201-BT Unified Wire Ethernet Controller 6080 T6225-6080 Unified Wire Ethernet Controller 6081 T62100-6081 Unified Wire Ethernet Controller + 6082 T6225-6082 Unified Wire Ethernet Controller + 6083 T62100-6083 Unified Wire Ethernet Controller + 6084 T64100-6084 Unified Wire Ethernet Controller 6401 T6225-CR Unified Wire Ethernet Controller 6402 T6225-SO-CR Unified Wire Ethernet Controller 6403 T6425-CR Unified Wire Ethernet Controller @@ -16358,6 +16412,9 @@ 6415 T6201-BT Unified Wire Ethernet Controller 6480 T6225-6080 Unified Wire Ethernet Controller 6481 T62100-6081 Unified Wire Ethernet Controller + 6482 T6225-6082 Unified Wire Ethernet Controller + 6483 T62100-6083 Unified Wire Ethernet Controller + 6484 T64100-6084 Unified Wire Ethernet Controller 6501 T6225-CR Unified Wire Storage Controller 6502 T6225-SO-CR Unified Wire Storage Controller 6503 T6425-CR Unified Wire Storage Controller @@ -16373,6 +16430,9 @@ 6515 T6201-BT Unified Wire Storage Controller 6580 T6225-6080 Unified Wire Storage Controller 6581 T62100-6081 Unified Wire Storage Controller + 6582 T6225-6082 Unified Wire Storage Controller + 6583 T62100-6083 Unified Wire Storage Controller + 6584 T64100-6084 Unified Wire Storage Controller 6601 T6225-CR Unified Wire Storage Controller 6602 T6225-SO-CR Unified Wire Storage Controller 6603 T6425-CR Unified Wire Storage Controller @@ -16388,6 +16448,9 @@ 6615 T6201-BT Unified Wire Storage Controller 6680 T6225-6080 Unified Wire Storage Controller 6681 T62100-6081 Unified Wire Storage Controller + 6682 T6225-6082 Unified Wire Storage Controller + 6683 T62100-6083 Unified Wire Storage Controller + 6684 T64100-6084 Unified Wire Storage Controller 6801 T6225-CR Unified Wire Ethernet Controller [VF] 6802 T6225-SO-CR Unified Wire Ethernet Controller [VF] 6803 T6425-CR Unified Wire Ethernet Controller [VF] @@ -16403,6 +16466,9 @@ 6815 T6201-BT Unified Wire Ethernet Controller [VF] 6880 T6225-6080 Unified Wire Ethernet Controller [VF] 6881 T62100-6081 Unified Wire Ethernet Controller [VF] + 6882 T6225-6082 Unified Wire Ethernet Controller [VF] + 6883 T62100-6083 Unified Wire Ethernet Controller [VF] + 6884 T64100-6084 Unified Wire Ethernet Controller [VF] a000 PE10K Unified Wire Ethernet Controller 1426 Storage Technology Corp. 1427 Better On-Line Solutions @@ -17003,6 +17069,7 @@ 1028 1f68 BCM57800 1-Gigabit Ethernet 168d NetXtreme II BCM57840 10/20 Gigabit Ethernet 168e NetXtreme II BCM57810 10 Gigabit Ethernet + 1014 0492 PCIe2 2-port 10 GbE BaseT RJ45 Adapter (FC EN0W; CCIN 2CC4) 103c 1798 Flex-10 10Gb 2-port 530FLB Adapter [Meru] 103c 17a5 Flex-10 10Gb 2-port 530M Adapter 103c 18d3 Ethernet 10Gb 2-port 530T Adapter @@ -17929,7 +17996,8 @@ 0001 SOC-it 101 System Controller 1540 PROVIDEO MULTIMEDIA Co Ltd 1541 MACHONE Communications -1542 Concurrent Computer Corporation +# nee VIVID Technology Inc. +1542 Concurrent Real-Time 9260 RCIM-II Real-Time Clock & Interrupt Module 9271 RCIM-III Real-Time Clock & Interrupt Module (PCIe) 9272 Pulse Width Modulator Card @@ -18133,6 +18201,7 @@ 103c 18d6 InfiniBand FDR/EN 10/40Gb Dual Port 544QSFP Adapter 15b3 0025 ConnectX-3 IB QDR Dual Port Mezzanine Card 15b3 0026 ConnectX-3 IB FDR Dual Port Mezzanine Card + 15b3 0028 ConnectX-3 VPI Dual QSFP+ Port QDR Infiniband 40Gb/s or 10Gb Ethernet 15b3 0059 ConnectX-3 VPI IB FDR/40 GbE Single Port QSFP+ Mezzanine Card 15b3 0065 ConnectX-3 VPI IB FDR/40 GbE Dual Port QSFP+ Adapter 15b3 0066 ConnectX-3 IB FDR10 Dual Port Mezzanine Card @@ -18209,6 +18278,7 @@ 6372 MT25408 [ConnectX EN 10GigE 10GBaseT, PCIe 2.0 2.5GT/s] 6732 MT26418 [ConnectX VPI PCIe 2.0 5GT/s - IB DDR / 10GigE] 673c MT26428 [ConnectX VPI PCIe 2.0 5GT/s - IB QDR / 10GigE] + 1014 0487 GX++ 1-port 4X IB QDR Adapter for Power 795 103c 1782 4X QDR InfiniBand Mezzanine HCA for c-Class BladeSystem 15b3 0021 HP InfiniBand 4X QDR CX-2 PCI-e G2 Dual Port HCA 6746 MT26438 [ConnectX VPI PCIe 2.0 5GT/s - IB QDR / 10GigE Virtualization+] @@ -18217,6 +18287,8 @@ 6750 MT26448 [ConnectX EN 10GigE, PCIe 2.0 5GT/s] 1014 0461 2-Port 10 GbE RoCE SR LP PCIe2 (rev b0) 15b3 0018 HP 10 GbE PCI-e G2 Dual-Port NIC (rev C1) +# FC EC26 + 15b3 6572 IBM Flex System EN4132 2-port 10Gb RoCE Adapter 675a MT25408 [ConnectX EN 10GigE 10GBaseT, PCIe Gen2 5GT/s] 6764 MT26468 [ConnectX EN 10GigE, PCIe 2.0 5GT/s Virtualization+] 103c 3313 NC542m Dual Port Flex-10 10GbE BLc Adapter @@ -19746,15 +19818,15 @@ 1924 800e SFN7x42Q-R2 Flareon Ultra 7000 Series 10/40G Adapter 1924 800f SFN7xx4F-R1 Flareon Ultra 7000 Series 10G Adapter 0a03 SFC9220 10/40G Ethernet Controller - 1924 8011 SFN8022-R1 Flareon 8000 Series 10G Adapter - 1924 8012 SFN8522-R1 Flareon Ultra 8000 Series 10G Adapter - 1924 8013 SFN8042-R1 Flareon 8000 Series 10/40G Adapter - 1924 8014 SFN8542-R1 Flareon Ultra 8000 Series 10/40G Adapter - 1924 8016 SFN8022-R2 Flareon 8000 Series 10G Adapter - 1924 8017 SFN8522-R2 Flareon Ultra 8000 Series 10G Adapter - 1924 8018 SFN8042-R2 Flareon 8000 Series 10/40G Adapter - 1924 8019 SFN8542-R2 Flareon Ultra 8000 Series 10/40G Adapter - 1924 801a SFN8722-R1 Flareon Ultra 8000 Series OCP 10G Adapter + 1924 8011 SFN8022-R1 8000 Series 10G Adapter + 1924 8012 SFN8522-R1 8000 Series 10G Adapter + 1924 8013 SFN8042-R1 8000 Series 10/40G Adapter + 1924 8014 SFN8542-R1 8000 Series 10/40G Adapter + 1924 8016 SFN8022-R2 8000 Series 10G Adapte + 1924 8017 SFN8522-R2 8000 Series 10G Adapter + 1924 8018 SFN8042-R2 8000 Series 10/40G Adapter + 1924 8019 SFN8542-R2 8000 Series 10/40G Adapter + 1924 801a SFN8722-R1 8000 Series OCP 10G Adapter 1803 SFC9020 10G Ethernet Controller (Virtual Function) 1813 SFL9021 10GBASE-T Ethernet Controller (Virtual Function) 1903 SFC9120 10G Ethernet Controller (Virtual Function) @@ -20008,20 +20080,29 @@ 0212 BladeEngine2 10Gb Gen2 PCIe iSCSI Adapter 0221 BladeEngine3 10Gb Gen2 PCIe Network Adapter 0222 BladeEngine3 10Gb Gen2 PCIe iSCSI Adapter - 0700 OneConnect 10Gb NIC + 0700 OneConnect OCe10100/OCe10102 Series 10 GbE 103c 1747 NC550SFP DualPort 10GbE Server Adapter 103c 1749 NC550SFP Dual Port Server Adapter 103c 174a NC551m Dual Port FlexFabric 10Gb Adapter 103c 174b StorageWorks NC550 DualPort Converged Network Adapter 103c 3314 NC551i Dual Port FlexFabric 10Gb Adapter 0702 OneConnect 10Gb iSCSI Initiator - 0704 OneConnect 10Gb FCoE Initiator + 0704 OneConnect OCe10100/OCe10102 Series 10 GbE CNA + 10df e602 OneConnect OCe10100 10Gb CNA + 10df e630 OneConnect OCe10102-FM-E / OCe10102-FX-E for EMC VNX Symmetrix 0710 OneConnect 10Gb NIC (be3) +# FC 5287 / FC 5284; CCIN 5287 + 1014 03d0 PCIe2 2-port 10GbE SR Adapter for POWER +# FC 5288 / FC 5286; CCIN 5288 + 1014 03d1 PCIe2 2-port 10GbE SFP+ Copper Adapter for POWER + 1014 0409 Integrated Multifunction Card with Dual 10GbE SR Optical + Dual 1GbE for Power 750/760 + 1014 040a Integrated Multifunction Card with Dual 10GbE SR Copper + Dual 1GbE for Power 750/760 103c 3315 NC553i 10Gb 2-port FlexFabric Converged Network Adapter 103c 3340 NC552SFP 2-port 10Gb Server Adapter 103c 3341 NC552m 10Gb 2-port FlexFabric Converged Network Adapter 103c 3345 NC553m 10Gb 2-port FlexFabric Converged Network Adapter 103c 337b NC554FLB 10Gb 2-port FlexFabric Converged Network Adapter + 10df e733 Flex System EN4054 4-port 10Gb Ethernet Mezzanine Adapter 0712 OneConnect 10Gb iSCSI Initiator (be3) 0714 OneConnect 10Gb FCoE Initiator (be3) 103c 3315 NC553i 10Gb 2-port FlexFabric Converged Network Adapter @@ -20297,6 +20378,7 @@ 001e ADQ208 001f DSU 0020 ADQ14 + 0023 ADQ7 2014 TX320 2019 S6000 # now owned by HGST (a Western Digital subsidiary) @@ -20505,6 +20587,7 @@ 0004 ExaNIC X10-GM 0005 ExaNIC X40 0006 ExaNIC X10-HPT + 0007 ExaNIC X40 1cf7 Subspace Dynamics 1d00 Pure Storage 1d18 RME @@ -20549,10 +20632,11 @@ 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1d78 DERA 1d7c Aerotech, Inc. -1d87 Rockchip Inc. RK3399 PCI Express Root Port +1d87 Fuzhou Rockchip Electronics Co., Ltd 1d8f Enyx 1d95 Graphcore Ltd 1da1 Teko Telecom S.r.l. +1da2 Sapphire Technology Limited 1de1 Tekram Technology Co.,Ltd. 0391 TRM-S1040 [DC-315 / DC-395 series] 2020 DC-390 @@ -20605,6 +20689,7 @@ 1fc9 3015 Ethernet Adapter 4026 TN9610 10GbE SFP+ Ethernet Adapter 4027 TN9710P 10GBase-T/NBASE-T Ethernet Adapter + 1154 0368 LGY-PCIE-MG 1432 8104 10 Gigabit Ethernet PCI Express Adapter 1fc9 3015 Ethernet Adapter 4527 TN9710Q 5GBase-T/NBASE-T Ethernet Adapter @@ -22513,6 +22598,7 @@ 10ba 80003ES2LAN Gigabit Ethernet Controller (Copper) 10bb 80003ES2LAN Gigabit Ethernet Controller (Serdes) 10bc 82571EB Gigabit Ethernet Controller (Copper) + 1014 0368 4-Port 10/100/1000 Base-TX PCI Express Adapter for POWER 103c 704b NC364T PCI Express Quad Port Gigabit Server Adapter 108e 11bc x4 PCI-Express Quad Gigabit Ethernet UTP Low Profile Adapter 8086 10bc PRO/1000 PT Quad Port LP Server Adapter @@ -23016,6 +23102,7 @@ 1529 82599 10 Gigabit Dual Port Network Connection with FCoE 152a 82599 10 Gigabit Dual Port Backplane Connection with FCoE 152e 82599 Virtual Function + 152f I350 Virtual Function 1530 X540 Virtual Function 1533 I210 Gigabit Network Connection 103c 0003 Ethernet I210-T1 GbE NIC @@ -23074,6 +23161,8 @@ 18d4 0c08 X550 10Gb 2-port RJ45 OCP Mezz Card MOP81-I-10GT2 8086 0001 Ethernet Converged Network Adapter X550-T2 8086 001a Ethernet Converged Network Adapter X550-T2 + 8086 001b Ethernet Server Adapter X550-T2 for OCP + 8086 001d Ethernet 10G 2P X550-t Adapter 8086 0022 Ethernet Converged Network Adapter X550-T2 1564 X550 Virtual Function 1565 X550 Virtual Function @@ -23216,22 +23305,38 @@ 15be Ethernet Connection (6) I219-V 15bf JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] 15c0 JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] + 15c2 Ethernet Connection X553 Backplane + 15c3 Ethernet Connection X553 Backplane + 15c4 Ethernet Connection X553 10 GbE SFP+ 15c5 X553 Virtual Function + 15c6 Ethernet Connection X553 1GbE + 15c7 Ethernet Connection X553 1GbE + 15c8 Ethernet Connection X553/X557-AT 10GBASE-T + 15ce Ethernet Connection X553 10 GbE SFP+ 15d0 Ethernet SDI Adapter FM10420-100GbE-QDA2 15d1 Ethernet Controller 10G X550T 8086 0002 Ethernet Converged Network Adapter X550-T1 + 8086 001b Ethernet Server Adapter X550-T1 for OCP 8086 0021 Ethernet Converged Network Adapter X550-T1 8086 00a2 Ethernet Converged Network Adapter X550-T1 15d2 JHL6540 Thunderbolt 3 NHI (C step) [Alpine Ridge 4C 2016] 15d3 JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] + 15d4 JHL6540 Thunderbolt 3 USB Controller (C step) [Alpine Ridge 4C 2016] 15d5 Ethernet SDI Adapter FM10420-25GbE-DA2 8086 0001 Intel(R) Ethernet SDI Adapter FM10420-25GbE-DA2 15d6 Ethernet Connection (5) I219-V 15d7 Ethernet Connection (4) I219-LM 15d8 Ethernet Connection (4) I219-V + 17aa 224f ThinkPad X1 Carbon 5th Gen 15d9 JHL6340 Thunderbolt 3 NHI (C step) [Alpine Ridge 2C 2016] 15da JHL6340 Thunderbolt 3 Bridge (C step) [Alpine Ridge 2C 2016] + 15df Ethernet Connection (8) I219-LM + 15e0 Ethernet Connection (8) I219-V + 15e1 Ethernet Connection (9) I219-LM + 15e2 Ethernet Connection (9) I219-V 15e3 Ethernet Connection (5) I219-LM + 15e4 Ethernet Connection X553 1GbE + 15e5 Ethernet Connection X553 1GbE 1600 Broadwell-U Host Bridge -OPI 1601 Broadwell-U PCI Express x16 Controller 1602 Broadwell-U Integrated Graphics @@ -23271,31 +23376,32 @@ 163d Broadwell-U Integrated Graphics 163e Broadwell-U Integrated Graphics 1889 Ethernet Adaptive Virtual Function - 1900 Skylake Host Bridge/DRAM Registers - 1901 Skylake PCIe Controller (x16) + 1900 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 1901 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) 1902 HD Graphics 510 - 1903 Skylake Processor Thermal Subsystem - 1904 Skylake Host Bridge/DRAM Registers + 1903 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem + 1904 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers 1028 06f3 Latitude 3570 17aa 382a B51-80 Laptop - 1905 Skylake PCIe Controller (x8) + 1905 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x8) 1906 HD Graphics 510 17aa 382a B51-80 Laptop - 1908 Skylake Host Bridge/DRAM Registers - 1909 Skylake PCIe Controller (x4) - 190c Skylake Host Bridge/DRAM Registers - 190f Skylake Host Bridge/DRAM Registers - 1910 Skylake Host Bridge/DRAM Registers - 1911 Skylake Gaussian Mixture Model + 1908 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 1909 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x4) + 190c Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 190f Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 1910 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 1911 Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model + 17aa 224f ThinkPad X1 Carbon 5th Gen 1912 HD Graphics 530 1916 HD Graphics 520 1028 06f3 Latitude 3570 - 1918 Skylake Host Bridge/DRAM Registers - 1919 Skylake Imaging Unit + 1918 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 1919 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Imaging Unit 191b HD Graphics 530 191d HD Graphics P530 191e HD Graphics 515 - 191f Skylake Host Bridge/DRAM Registers + 191f Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers 1921 HD Graphics 520 1926 Iris Graphics 540 1927 Iris Graphics 550 @@ -24531,6 +24637,7 @@ 24fd Wireless 8265 / 8275 # Windstorm Peak 8086 0010 Dual Band Wireless-AC 8265 + 8086 1130 Dual Band Wireless-AC 8265 2500 82820 820 (Camino) Chipset Host Bridge (MCH) 1028 0095 Precision Workstation 220 Chipset 1043 801c P3C-2000 system chipset @@ -26676,6 +26783,7 @@ 17aa 4021 Intel Ethernet Connection X722 for 10G SFP+ 17aa 4022 Ethernet Connection X722 for 10GbE SFP+ 37d1 Ethernet Connection X722 for 1GbE + 14cd 0010 88E1514 Ethernet OCP 2x1G RJ45 Phy Card [USI-1514-1GbaseT] 1590 0216 Ethernet 1Gb 2-port 368i Adapter 1590 0217 Ethernet 1Gb 2-port 368FLR-MMT Adapter 1590 0247 Ethernet 1Gb 4-port 369i Adapter @@ -27229,9 +27337,13 @@ 5845 QEMU NVM Express Controller 1af4 1100 QEMU Virtual Machine 5902 HD Graphics 610 + 5904 Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers + 17aa 224f ThinkPad X1 Carbon 5th Gen 590f Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers 5910 Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers 5912 HD Graphics 630 + 5916 HD Graphics 620 + 17aa 224f ThinkPad X1 Carbon 5th Gen 5a84 Celeron N3350/Pentium N4200/Atom E3900 Series Integrated Graphics Controller 5a88 Celeron N3350/Pentium N4200/Atom E3900 Series Imaging Unit 5a98 Celeron N3350/Pentium N4200/Atom E3900 Series Audio Cluster @@ -27908,6 +28020,8 @@ 9d03 Sunrise Point-LP SATA Controller [AHCI mode] 1028 06f3 Latitude 3570 17aa 382a B51-80 Laptop + 9d10 Sunrise Point-LP PCI Express Root Port #1 + 9d12 Sunrise Point-LP PCI Express Root Port #3 9d14 Sunrise Point-LP PCI Express Root Port #5 17aa 382a B51-80 Laptop 9d15 Sunrise Point-LP PCI Express Root Port #6 @@ -27918,9 +28032,11 @@ 17aa 382a B51-80 Laptop 9d21 Sunrise Point-LP PMC 1028 06f3 Latitude 3570 + 17aa 224f ThinkPad X1 Carbon 5th Gen 17aa 382a B51-80 Laptop 9d23 Sunrise Point-LP SMBus 1028 06f3 Latitude 3570 + 17aa 224f ThinkPad X1 Carbon 5th Gen 17aa 382a B51-80 Laptop 9d27 Sunrise Point-LP Serial IO UART Controller #0 9d28 Sunrise Point-LP Serial IO UART Controller #1 @@ -27932,14 +28048,18 @@ 17aa 382a B51-80 Laptop 9d31 Sunrise Point-LP Thermal subsystem 1028 06f3 Latitude 3570 + 17aa 224f ThinkPad X1 Carbon 5th Gen 17aa 382a B51-80 Laptop 9d3a Sunrise Point-LP CSME HECI #1 1028 06f3 Latitude 3570 + 17aa 224f ThinkPad X1 Carbon 5th Gen 17aa 382a B51-80 Laptop 9d43 Sunrise Point-LP LPC Controller 17aa 382a B51-80 Laptop 9d48 Sunrise Point-LP LPC Controller 1028 06f3 Latitude 3570 + 9d58 Sunrise Point-LP LPC Controller + 17aa 224f ThinkPad X1 Carbon 5th Gen 9d60 Sunrise Point-LP Serial IO I2C Controller #0 1028 06f3 Latitude 3570 8086 9d60 100 Series PCH/Sunrise Point PCH I2C0 [Skylake/Kaby Lake LPSS I2C] @@ -28520,6 +28640,20 @@ 9005 0552 Series 8 - ASR-8805 - 8 internal 0 external 12G SAS Port/PCIe 3.0 9005 0553 Series 8 - ASR-8085 - 0 internal 8 external 12G SAS Port/PCIe 3.0 9005 0554 Series 8 - ASR-8885 - 8 internal 8 external 12G SAS Port/PCIe 3.0 + 028f Smart Storage PQI 12G SAS/PCIe 3 + 103c 0600 Smart Array P408i-p SR Gen10 + 103c 0601 Smart Array P408e-p SR Gen10 + 103c 0602 Smart Array P408i-a SR Gen10 + 103c 0603 Smart Array P408i-c SR Gen10 + 103c 0650 Smart Array E208i-p SR Gen10 + 103c 0651 Smart Array E208e-p SR Gen10 + 103c 0652 Smart Array E208i-c SR Gen10 + 103c 0654 Smart Array E208i-a SR Gen10 + 103c 0655 Smart Array P408e-m SR Gen10 + 103c 0700 Smart Array P204i-c SR Gen10 + 103c 0701 Smart Array P204i-b SR Gen10 + 103c 1100 Smart Array P816i-a SR Gen10 + 103c 1101 Smart Array P416ie-m SR G10 0410 AIC-9410W SAS (Razor HBA RAID) 9005 0410 ASC-48300(Spirit RAID) 9005 0411 ASC-58300 (Oakmont RAID) From owner-svn-src-head@freebsd.org Fri Jul 14 15:42:14 2017 Return-Path: Delivered-To: svn-src-head@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 26D58DA4B32; Fri, 14 Jul 2017 15:42:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E3BE66A639; Fri, 14 Jul 2017 15:42:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EFgD0e040168; Fri, 14 Jul 2017 15:42:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EFgD04040167; Fri, 14 Jul 2017 15:42:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707141542.v6EFgD04040167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Jul 2017 15:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320989 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 320989 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 15:42:14 -0000 Author: kib Date: Fri Jul 14 15:42:12 2017 New Revision: 320989 URL: https://svnweb.freebsd.org/changeset/base/320989 Log: Language improvements. Submitted by: wblock MFC after: 3 days Differential revision: https://reviews.freebsd.org/D10826 Modified: head/libexec/rtld-elf/rtld.1 Modified: head/libexec/rtld-elf/rtld.1 ============================================================================== --- head/libexec/rtld-elf/rtld.1 Fri Jul 14 14:58:10 2017 (r320988) +++ head/libexec/rtld-elf/rtld.1 Fri Jul 14 15:42:12 2017 (r320989) @@ -309,7 +309,7 @@ The syntax of the direct invocation is .Op Ar image arguments .Ed .Pp -The options are as follows: +The options are: .Bl -tag -width indent .It Fl f Ar fd File descriptor @@ -339,21 +339,22 @@ Ends the options. The argument following .Fl - -is interpreted as the path of binary to execute. +is interpreted as the path of the binary to execute. .El .Pp -To conform to user expectation to not break some naively restricted -execution environments, in the direct execution mode +In the direct execution mode, .Nm -emulates verification of the binary execute permission -for current user. +emulates verification of the binary execute permission for the +current user. +This is done to avoid breaking user expectations in naively restricted +execution environments. The verification only uses Unix .Dv DACs , ignores .Dv ACLs -and is racy by its nature. -The environments which rely on such restrictions are weak -and breakable on its own. +and is naturally prone to race conditions. +Environments which rely on such restrictions are weak +and breakable on their own. .Sh FILES .Bl -tag -width ".Pa /var/run/ld-elf32.so.hints" -compact .It Pa /var/run/ld-elf.so.hints From owner-svn-src-head@freebsd.org Fri Jul 14 16:05:56 2017 Return-Path: Delivered-To: svn-src-head@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 205AEDA63EC; Fri, 14 Jul 2017 16:05:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D74066B068; Fri, 14 Jul 2017 16:05:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EG5sGh049500; Fri, 14 Jul 2017 16:05:54 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EG5suS049499; Fri, 14 Jul 2017 16:05:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201707141605.v6EG5suS049499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 14 Jul 2017 16:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320990 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 320990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 16:05:56 -0000 Author: pfg Date: Fri Jul 14 16:05:54 2017 New Revision: 320990 URL: https://svnweb.freebsd.org/changeset/base/320990 Log: libthr: 'count' is unsigned so don't check for negative values. Obtained from: DragonFlyBSD (git e7db8139) Modified: head/lib/libthr/thread/thr_barrier.c Modified: head/lib/libthr/thread/thr_barrier.c ============================================================================== --- head/lib/libthr/thread/thr_barrier.c Fri Jul 14 15:42:12 2017 (r320989) +++ head/lib/libthr/thread/thr_barrier.c Fri Jul 14 16:05:54 2017 (r320990) @@ -100,7 +100,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier, pthread_barrier_t bar; int pshared; - if (barrier == NULL || count <= 0) + if (barrier == NULL || count == 0) return (EINVAL); if (attr == NULL || *attr == NULL || From owner-svn-src-head@freebsd.org Fri Jul 14 16:28:12 2017 Return-Path: Delivered-To: svn-src-head@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 40107DA6A24; Fri, 14 Jul 2017 16:28:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 CBDC66BA1B; Fri, 14 Jul 2017 16:28:11 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v6EGS6rf018208 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 14 Jul 2017 19:28:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v6EGS6rf018208 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v6EGS6YP018207; Fri, 14 Jul 2017 19:28:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 14 Jul 2017 19:28:06 +0300 From: Konstantin Belousov To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320990 - head/lib/libthr/thread Message-ID: <20170714162806.GX1935@kib.kiev.ua> References: <201707141605.v6EG5suS049499@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707141605.v6EG5suS049499@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 16:28:12 -0000 On Fri, Jul 14, 2017 at 04:05:54PM +0000, Pedro F. Giffuni wrote: > Author: pfg > Date: Fri Jul 14 16:05:54 2017 > New Revision: 320990 > URL: https://svnweb.freebsd.org/changeset/base/320990 > > Log: > libthr: 'count' is unsigned so don't check for negative values. count is unsigned but pthread_barrier.b_count is not. At very least, this change is half-done. > > Obtained from: DragonFlyBSD (git e7db8139) > > Modified: > head/lib/libthr/thread/thr_barrier.c > > Modified: head/lib/libthr/thread/thr_barrier.c > ============================================================================== > --- head/lib/libthr/thread/thr_barrier.c Fri Jul 14 15:42:12 2017 (r320989) > +++ head/lib/libthr/thread/thr_barrier.c Fri Jul 14 16:05:54 2017 (r320990) > @@ -100,7 +100,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier, > pthread_barrier_t bar; > int pshared; > > - if (barrier == NULL || count <= 0) > + if (barrier == NULL || count == 0) > return (EINVAL); > > if (attr == NULL || *attr == NULL || From owner-svn-src-head@freebsd.org Fri Jul 14 16:45:48 2017 Return-Path: Delivered-To: svn-src-head@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 38354DA725A; Fri, 14 Jul 2017 16:45:48 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0EE576C464; Fri, 14 Jul 2017 16:45:47 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EGjkkF065874; Fri, 14 Jul 2017 16:45:46 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EGjkL6065872; Fri, 14 Jul 2017 16:45:46 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201707141645.v6EGjkL6065872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 14 Jul 2017 16:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320991 - in head: lib/libmt usr.bin/mt X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in head: lib/libmt usr.bin/mt X-SVN-Commit-Revision: 320991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 16:45:48 -0000 Author: ken Date: Fri Jul 14 16:45:46 2017 New Revision: 320991 URL: https://svnweb.freebsd.org/changeset/base/320991 Log: Add IBM TS1155 density codes to libmt and the mt(1) man page. These are taken directly from the density report from a TS1155 tape drive. (Using mt getdensity) lib/libmt/mtlib.c: Add 3592B5 encrypted/unencrypted density codes, and bpmm/bpi values. The bpmm/bpi values are the same as TS1150, but there are 50% more tracks. usr.bin/mt/mt.1: Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi values and number of tracks. Bump the man page date. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/lib/libmt/mtlib.c head/usr.bin/mt/mt.1 Modified: head/lib/libmt/mtlib.c ============================================================================== --- head/lib/libmt/mtlib.c Fri Jul 14 16:05:54 2017 (r320990) +++ head/lib/libmt/mtlib.c Fri Jul 14 16:45:46 2017 (r320991) @@ -641,6 +641,7 @@ static struct densities { { 0x53, 13452, 341681, "3592A3 (unencrypted)" }, { 0x54, 19686, 500024, "3592A4 (unencrypted)" }, { 0x55, 20670, 525018, "3592A5 (unencrypted)" }, + { 0x56, 20670, 525018, "3592B5 (unencrypted)" }, { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, { 0x5C, 19107, 485318, "LTO-7" }, @@ -650,6 +651,7 @@ static struct densities { { 0x73, 13452, 341681, "3592A3 (encrypted)" }, { 0x74, 19686, 500024, "3592A4 (encrypted)" }, { 0x75, 20670, 525018, "3592A5 (encrypted)" }, + { 0x76, 20670, 525018, "3592B5 (encrypted)" }, { 0x8c, 1789, 45434, "EXB-8500c" }, { 0x90, 1703, 43245, "EXB-8200c" }, { 0, 0, 0, NULL } Modified: head/usr.bin/mt/mt.1 ============================================================================== --- head/usr.bin/mt/mt.1 Fri Jul 14 16:05:54 2017 (r320990) +++ head/usr.bin/mt/mt.1 Fri Jul 14 16:45:46 2017 (r320991) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 11, 2017 +.Dd July 14, 2017 .Dt MT 1 .Os .Sh NAME @@ -518,6 +518,7 @@ Value Width Tracks Density Code Typ 0x53 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (unencrypted) 0x54 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (unencrypted) 0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted) +0x56 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (unencrypted) 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 @@ -527,6 +528,7 @@ Value Width Tracks Density Code Typ 0x73 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (encrypted) 0x74 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (encrypted) 0x75 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (encrypted) +0x76 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (encrypted) 0x8c 8.0 (0.315) 1 1,789 (45,434) RLL CS EXB-8500c 5,9 0x90 8.0 (0.315) 1 1,703 (43,245) RLL CS EXB-8200c 5,9 .Ed From owner-svn-src-head@freebsd.org Fri Jul 14 17:07:29 2017 Return-Path: Delivered-To: svn-src-head@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 6231CDA82B5; Fri, 14 Jul 2017 17:07:29 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2F7B06E57B; Fri, 14 Jul 2017 17:07:29 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EH7SML076956; Fri, 14 Jul 2017 17:07:28 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EH7STB076955; Fri, 14 Jul 2017 17:07:28 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201707141707.v6EH7STB076955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Fri, 14 Jul 2017 17:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320992 - head/lib/libc/stdlib X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: head/lib/libc/stdlib X-SVN-Commit-Revision: 320992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 17:07:29 -0000 Author: brd (doc,ports committer) Date: Fri Jul 14 17:07:28 2017 New Revision: 320992 URL: https://svnweb.freebsd.org/changeset/base/320992 Log: Add a complete example to tsearch(3) Reviewed by: wblock, sevan, bruffer MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11053 Modified: head/lib/libc/stdlib/tsearch.3 Modified: head/lib/libc/stdlib/tsearch.3 ============================================================================== --- head/lib/libc/stdlib/tsearch.3 Fri Jul 14 16:45:46 2017 (r320991) +++ head/lib/libc/stdlib/tsearch.3 Fri Jul 14 17:07:28 2017 (r320992) @@ -27,7 +27,7 @@ .\" OpenBSD: tsearch.3,v 1.2 1998/06/21 22:13:49 millert Exp .\" $FreeBSD$ .\" -.Dd October 9, 2016 +.Dd June 4, 2017 .Dt TSEARCH 3 .Os .Sh NAME @@ -130,6 +130,64 @@ is NULL or the datum cannot be found. The .Fn twalk function returns no value. +.Sh EXAMPLES +This example uses +.Fn tsearch +to search for four strings in +.Dv root . +Because the strings are not already present, they are added. +.Fn tsearch +is called twice on the fourth string to demonstrate that a string is not added when it is already present. +.Fn tfind +is used to find the single instance of the fourth string, and +.Fn tdelete +removes it. +Finally, +.Fn twalk +is used to return and display the resulting binary search tree. +.Bd -literal +#include +#include +#include + +int +comp(const void *a, const void *b) +{ + + return strcmp(a, b); +} + +void +printwalk(const posix_tnode * node, VISIT v, int __unused0) +{ + + if (v == postorder || v == leaf) { + printf("node: %s\n\\", *(char **)node); + } +} + +int +main(void) +{ + posix_tnode *root = NULL; + + char one[] = "blah1"; + char two[] = "blah-2"; + char three[] = "blah-3"; + char four[] = "blah-4"; + + tsearch(one, &root, comp); + tsearch(two, &root, comp); + tsearch(three, &root, comp); + tsearch(four, &root, comp); + tsearch(four, &root, comp); + printf("four: %s\n", *(char **)tfind(four, &root, comp)); + tdelete(four, &root, comp); + + twalk(root, printwalk); + return 0; +} +.Ed .Sh SEE ALSO .Xr bsearch 3 , .Xr hsearch 3 , From owner-svn-src-head@freebsd.org Fri Jul 14 17:27:17 2017 Return-Path: Delivered-To: svn-src-head@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 21180DA8B1B; Fri, 14 Jul 2017 17:27:17 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E30636F57A; Fri, 14 Jul 2017 17:27:16 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EHRGWm085914; Fri, 14 Jul 2017 17:27:16 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EHRGU3085913; Fri, 14 Jul 2017 17:27:16 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201707141727.v6EHRGU3085913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Fri, 14 Jul 2017 17:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320993 - head/lib/libc/stdlib X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: head/lib/libc/stdlib X-SVN-Commit-Revision: 320993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 17:27:17 -0000 Author: brd (doc,ports committer) Date: Fri Jul 14 17:27:15 2017 New Revision: 320993 URL: https://svnweb.freebsd.org/changeset/base/320993 Log: Follow up to r320992, properly escape the backslash so it renders properly. MFC after: 1 week Forgotten by: brd X-MFC-With: r320992 Modified: head/lib/libc/stdlib/tsearch.3 Modified: head/lib/libc/stdlib/tsearch.3 ============================================================================== --- head/lib/libc/stdlib/tsearch.3 Fri Jul 14 17:07:28 2017 (r320992) +++ head/lib/libc/stdlib/tsearch.3 Fri Jul 14 17:27:15 2017 (r320993) @@ -162,7 +162,7 @@ printwalk(const posix_tnode * node, VISIT v, int __unu { if (v == postorder || v == leaf) { - printf("node: %s\n\\", *(char **)node); + printf("node: %s\en", *(char **)node); } } @@ -181,7 +181,7 @@ main(void) tsearch(three, &root, comp); tsearch(four, &root, comp); tsearch(four, &root, comp); - printf("four: %s\n", *(char **)tfind(four, &root, comp)); + printf("four: %s\en", *(char **)tfind(four, &root, comp)); tdelete(four, &root, comp); twalk(root, printwalk); From owner-svn-src-head@freebsd.org Fri Jul 14 18:13:55 2017 Return-Path: Delivered-To: svn-src-head@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 730D1DA974B; Fri, 14 Jul 2017 18:13:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 39E2F70EAA; Fri, 14 Jul 2017 18:13:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EIDsSm006888; Fri, 14 Jul 2017 18:13:54 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EIDsda006887; Fri, 14 Jul 2017 18:13:54 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707141813.v6EIDsda006887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 14 Jul 2017 18:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320996 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 320996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 18:13:55 -0000 Author: ian Date: Fri Jul 14 18:13:54 2017 New Revision: 320996 URL: https://svnweb.freebsd.org/changeset/base/320996 Log: Allow setting debug.clocktime as a tunable. Print 64-bit time_t correctly on 32-bit systems. Modified: head/sys/kern/subr_clock.c Modified: head/sys/kern/subr_clock.c ============================================================================== --- head/sys/kern/subr_clock.c Fri Jul 14 17:41:15 2017 (r320995) +++ head/sys/kern/subr_clock.c Fri Jul 14 18:13:54 2017 (r320996) @@ -72,7 +72,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, adjkerntz, CTLTYPE_INT "Local offset from UTC in seconds"); static int ct_debug; -SYSCTL_INT(_debug, OID_AUTO, clocktime, CTLFLAG_RW, +SYSCTL_INT(_debug, OID_AUTO, clocktime, CTLFLAG_RWTUN, &ct_debug, 0, "Enable printing of clocktime debugging"); static int wall_cmos_clock; @@ -171,7 +171,7 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * ts->tv_nsec = ct->nsec; if (ct_debug) - printf(" = %ld.%09ld\n", (long)ts->tv_sec, (long)ts->tv_nsec); + printf(" = %jd.%09ld\n", (intmax_t)ts->tv_sec, ts->tv_nsec); return (0); } @@ -209,8 +209,8 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * ct->sec = rsec; ct->nsec = ts->tv_nsec; if (ct_debug) { - printf("ts_to_ct(%ld.%09ld) = ", - (long)ts->tv_sec, (long)ts->tv_nsec); + printf("ts_to_ct(%jd.%09ld) = ", + (intmax_t)ts->tv_sec, ts->tv_nsec); print_ct(ct); printf("\n"); } From owner-svn-src-head@freebsd.org Fri Jul 14 18:36:16 2017 Return-Path: Delivered-To: svn-src-head@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 A80CEDA9D1F; Fri, 14 Jul 2017 18:36:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 75B0271819; Fri, 14 Jul 2017 18:36:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EIaFw6015056; Fri, 14 Jul 2017 18:36:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EIaF8R015055; Fri, 14 Jul 2017 18:36:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707141836.v6EIaF8R015055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 14 Jul 2017 18:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320997 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 320997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 18:36:16 -0000 Author: ian Date: Fri Jul 14 18:36:15 2017 New Revision: 320997 URL: https://svnweb.freebsd.org/changeset/base/320997 Log: Minor optimization: instead of converting between days and years using loops that start in 1970, assume most conversions are going to be for recent dates and use a precomputed number of days through the end of 2016. Modified: head/sys/kern/subr_clock.c Modified: head/sys/kern/subr_clock.c ============================================================================== --- head/sys/kern/subr_clock.c Fri Jul 14 18:13:54 2017 (r320996) +++ head/sys/kern/subr_clock.c Fri Jul 14 18:36:15 2017 (r320997) @@ -97,6 +97,13 @@ static const int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +/* + * Optimization: using a precomputed count of days between POSIX_BASE_YEAR and a + * recent year avoids lots of needless loop iterations in conversion. + * recent_base_days is the number of days through the end of recent_base_year. + */ +static const int recent_base_year = 2016; +static const int recent_base_days = 17167; /* * This inline avoids some unnecessary modulo operations @@ -157,8 +164,14 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * * Compute days since start of time * First from years, then from months. */ - days = 0; - for (i = POSIX_BASE_YEAR; i < year; i++) + if (year > recent_base_year) { + i = recent_base_year; + days = recent_base_days; + } else { + i = POSIX_BASE_YEAR; + days = 0; + } + for (; i < year; i++) days += days_in_year(i); /* Months */ @@ -188,8 +201,14 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * ct->dow = day_of_week(days); - /* Subtract out whole years, counting them in i. */ - for (year = POSIX_BASE_YEAR; days >= days_in_year(year); year++) + /* Subtract out whole years. */ + if (days >= recent_base_days) { + year = recent_base_year + 1; + days -= recent_base_days; + } else { + year = POSIX_BASE_YEAR; + } + for (; days >= days_in_year(year); year++) days -= days_in_year(year); ct->year = year; From owner-svn-src-head@freebsd.org Fri Jul 14 21:13:07 2017 Return-Path: Delivered-To: svn-src-head@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 590C4DAC631; Fri, 14 Jul 2017 21:13:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 19F6D76D6F; Fri, 14 Jul 2017 21:13:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ELD6KU083058; Fri, 14 Jul 2017 21:13:06 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ELD6dq083057; Fri, 14 Jul 2017 21:13:06 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201707142113.v6ELD6dq083057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 14 Jul 2017 21:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320999 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 320999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 21:13:07 -0000 Author: brooks Date: Fri Jul 14 21:13:05 2017 New Revision: 320999 URL: https://svnweb.freebsd.org/changeset/base/320999 Log: Add 32-bit compat for kinfo_proc's ki_tdaddr. This appears to have been an oversight in r213536. Reviewed by: markj MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11521 Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Fri Jul 14 20:47:41 2017 (r320998) +++ head/sys/kern/kern_proc.c Fri Jul 14 21:13:05 2017 (r320999) @@ -1301,6 +1301,7 @@ freebsd32_kinfo_proc_out(const struct kinfo_proc *ki, PTRTRIM_CP(*ki, *ki32, ki_pcb); PTRTRIM_CP(*ki, *ki32, ki_kstack); PTRTRIM_CP(*ki, *ki32, ki_udata); + PTRTRIM_CP(*ki, *ki32, ki_tdaddr); CP(*ki, *ki32, ki_sflag); CP(*ki, *ki32, ki_tdflags); } From owner-svn-src-head@freebsd.org Fri Jul 14 21:50:05 2017 Return-Path: Delivered-To: svn-src-head@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 A4CC6DAD1FA; Fri, 14 Jul 2017 21:50:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7462677BC3; Fri, 14 Jul 2017 21:50:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ELo4lW095348; Fri, 14 Jul 2017 21:50:04 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ELo4QG095347; Fri, 14 Jul 2017 21:50:04 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707142150.v6ELo4QG095347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 14 Jul 2017 21:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321001 - head/tests/sys/aio X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/aio X-SVN-Commit-Revision: 321001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 21:50:05 -0000 Author: asomers Date: Fri Jul 14 21:50:04 2017 New Revision: 321001 URL: https://svnweb.freebsd.org/changeset/base/321001 Log: Fix the build with GCC after r320975 Reported by: pfg MFC after: 20 days X-MFC-With: 320975 Sponsored by: Spectra Logic Corp Modified: head/tests/sys/aio/aio_test.c Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Fri Jul 14 21:43:57 2017 (r321000) +++ head/tests/sys/aio/aio_test.c Fri Jul 14 21:50:04 2017 (r321001) @@ -222,7 +222,7 @@ setup_signal(void) * separate process */ static struct sigevent* -setup_thread() +setup_thread(void) { static struct sigevent sev; From owner-svn-src-head@freebsd.org Sat Jul 15 00:45:23 2017 Return-Path: Delivered-To: svn-src-head@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 711EFDAFCAD; Sat, 15 Jul 2017 00:45:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 3E79A8098A; Sat, 15 Jul 2017 00:45:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6F0jMuQ069953; Sat, 15 Jul 2017 00:45:22 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6F0jMoC069952; Sat, 15 Jul 2017 00:45:22 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201707150045.v6F0jMoC069952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 15 Jul 2017 00:45:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321002 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 321002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 00:45:23 -0000 Author: ian Date: Sat Jul 15 00:45:22 2017 New Revision: 321002 URL: https://svnweb.freebsd.org/changeset/base/321002 Log: Revert r320997. There are reports of it getting the wrong results, so clearly my testing was insuffficent, and it's best to just revert it until I get it straightened out. Modified: head/sys/kern/subr_clock.c Modified: head/sys/kern/subr_clock.c ============================================================================== --- head/sys/kern/subr_clock.c Fri Jul 14 21:50:04 2017 (r321001) +++ head/sys/kern/subr_clock.c Sat Jul 15 00:45:22 2017 (r321002) @@ -97,13 +97,6 @@ static const int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -/* - * Optimization: using a precomputed count of days between POSIX_BASE_YEAR and a - * recent year avoids lots of needless loop iterations in conversion. - * recent_base_days is the number of days through the end of recent_base_year. - */ -static const int recent_base_year = 2016; -static const int recent_base_days = 17167; /* * This inline avoids some unnecessary modulo operations @@ -164,14 +157,8 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * * Compute days since start of time * First from years, then from months. */ - if (year > recent_base_year) { - i = recent_base_year; - days = recent_base_days; - } else { - i = POSIX_BASE_YEAR; - days = 0; - } - for (; i < year; i++) + days = 0; + for (i = POSIX_BASE_YEAR; i < year; i++) days += days_in_year(i); /* Months */ @@ -201,14 +188,8 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * ct->dow = day_of_week(days); - /* Subtract out whole years. */ - if (days >= recent_base_days) { - year = recent_base_year + 1; - days -= recent_base_days; - } else { - year = POSIX_BASE_YEAR; - } - for (; days >= days_in_year(year); year++) + /* Subtract out whole years, counting them in i. */ + for (year = POSIX_BASE_YEAR; days >= days_in_year(year); year++) days -= days_in_year(year); ct->year = year; From owner-svn-src-head@freebsd.org Sat Jul 15 01:49:56 2017 Return-Path: Delivered-To: svn-src-head@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 34D10DB2280; Sat, 15 Jul 2017 01:49:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0E75982AB8; Sat, 15 Jul 2017 01:49:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6F1ntFm094116; Sat, 15 Jul 2017 01:49:55 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6F1ntjD094115; Sat, 15 Jul 2017 01:49:55 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707150149.v6F1ntjD094115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 15 Jul 2017 01:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321003 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 321003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 01:49:56 -0000 Author: alc Date: Sat Jul 15 01:49:54 2017 New Revision: 321003 URL: https://svnweb.freebsd.org/changeset/base/321003 Log: Extract the innermost loop of pmap_remove() out into its own function, pmap_remove_ptes(). (This new function will also be used by an upcoming change to pmap_enter() that adds support for psind == 1 mappings.) Submitted by: Yufeng Zhou (an earlier version) Reviewed by: kib, markj MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Jul 15 00:45:22 2017 (r321002) +++ head/sys/amd64/amd64/pmap.c Sat Jul 15 01:49:54 2017 (r321003) @@ -629,6 +629,9 @@ static int pmap_remove_pte(pmap_t pmap, pt_entry_t *pt static vm_page_t pmap_remove_pt_page(pmap_t pmap, vm_offset_t va); static void pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, struct spglist *free); +static bool pmap_remove_ptes(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, + pd_entry_t *pde, struct spglist *free, + struct rwlock **lockp); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m, struct rwlock **lockp); static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, @@ -3736,6 +3739,44 @@ pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry } /* + * Removes the specified range of addresses from the page table page. + */ +static bool +pmap_remove_ptes(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, + pd_entry_t *pde, struct spglist *free, struct rwlock **lockp) +{ + pt_entry_t PG_G, *pte; + vm_offset_t va; + bool anyvalid; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + PG_G = pmap_global_bit(pmap); + anyvalid = false; + va = eva; + for (pte = pmap_pde_to_pte(pde, sva); sva != eva; pte++, + sva += PAGE_SIZE) { + if (*pte == 0) { + if (va != eva) { + pmap_invalidate_range(pmap, va, sva); + va = eva; + } + continue; + } + if ((*pte & PG_G) == 0) + anyvalid = true; + else if (va == eva) + va = sva; + if (pmap_remove_pte(pmap, pte, sva, *pde, free, lockp)) { + sva += PAGE_SIZE; + break; + } + } + if (va != eva) + pmap_invalidate_range(pmap, va, sva); + return (anyvalid); +} + +/* * Remove the given range of addresses from the specified map. * * It is assumed that the start and end are properly @@ -3745,11 +3786,11 @@ void pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { struct rwlock *lock; - vm_offset_t va, va_next; + vm_offset_t va_next; pml4_entry_t *pml4e; pdp_entry_t *pdpe; pd_entry_t ptpaddr, *pde; - pt_entry_t *pte, PG_G, PG_V; + pt_entry_t PG_G, PG_V; struct spglist free; int anyvalid; @@ -3852,28 +3893,8 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t if (va_next > eva) va_next = eva; - va = va_next; - for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++, - sva += PAGE_SIZE) { - if (*pte == 0) { - if (va != va_next) { - pmap_invalidate_range(pmap, va, sva); - va = va_next; - } - continue; - } - if ((*pte & PG_G) == 0) - anyvalid = 1; - else if (va == va_next) - va = sva; - if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free, - &lock)) { - sva += PAGE_SIZE; - break; - } - } - if (va != va_next) - pmap_invalidate_range(pmap, va, sva); + if (pmap_remove_ptes(pmap, sva, va_next, pde, &free, &lock)) + anyvalid = 1; } if (lock != NULL) rw_wunlock(lock); From owner-svn-src-head@freebsd.org Sat Jul 15 09:04:24 2017 Return-Path: Delivered-To: svn-src-head@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 CE8CCDBE0DB; Sat, 15 Jul 2017 09:04:24 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9C17D69EB1; Sat, 15 Jul 2017 09:04:24 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6F94N4C058658; Sat, 15 Jul 2017 09:04:23 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6F94NYG058657; Sat, 15 Jul 2017 09:04:23 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201707150904.v6F94NYG058657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 15 Jul 2017 09:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321008 - head/etc/rc.d X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/etc/rc.d X-SVN-Commit-Revision: 321008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 09:04:24 -0000 Author: manu Date: Sat Jul 15 09:04:23 2017 New Revision: 321008 URL: https://svnweb.freebsd.org/changeset/base/321008 Log: etc/rc.d: Only install ipfw_netflow is MK_IPFW and MK_NETGRAPH is defined While here only install ipfw rc script if MK_IPFW is defined. Reported by: ngie Modified: head/etc/rc.d/Makefile Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Sat Jul 15 08:27:23 2017 (r321007) +++ head/etc/rc.d/Makefile Sat Jul 15 09:04:23 2017 (r321008) @@ -47,7 +47,6 @@ FILES= DAEMON \ ip6addrctl \ ipfilter \ ipfs \ - ipfw \ ipmon \ ipnat \ ipsec \ @@ -204,6 +203,13 @@ HASTPACKAGE= hast .if ${MK_INETD} != "no" FILES+= inetd +.endif + +.if ${MK_IPFW} != "no" +FILES+= ipfw +.if ${MK_NETGRAPH} != "no" +FILES+= ipfw_netflow +.endif .endif .if ${MK_ISCSI} != "no" From owner-svn-src-head@freebsd.org Sat Jul 15 09:22:28 2017 Return-Path: Delivered-To: svn-src-head@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 45C92DBE42A; Sat, 15 Jul 2017 09:22:28 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 28CE46A6D6; Sat, 15 Jul 2017 09:22:26 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id b6125dc1; Sat, 15 Jul 2017 11:15:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=sdiMpWzK4N/myL/663qgvZKgWJs=; b=SxTDFl3KHKd96OweHQx5oYUzl/F9 BR58Z0RcWLQSBh783j7vyS/OGgu25+slKhovZdKRseBI/6Z+hi0w9rEDC/0BW0/V yo2sP4RfH7x1bh0KLlkUMol4rsMwl8iRLdnAEoqWf6eKX1Exku1pK3uMk8k/lZQS jW9odnxo/MK+YtM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=ifUyA60sy8v3MOLtOg4/ymzRStIIzHgZW/RMiikB4tbZV+OjS8QSCWaE 8dLXb5+7+70QmZXKnRmD7DnzY09n6IjX8avHXBE2qzmOem7CwYl4QN7qHJYC+CA6 Q2QFRmpKqtg/1yX1Mxx78QpMpPxnnJlDYBG9cZzbuikKsOY0Glg= Received: from arcadia (sal69-2-78-192-146-206.fbxo.proxad.net [78.192.146.206]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 46e6ed5d TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sat, 15 Jul 2017 11:15:42 +0200 (CEST) Date: Sat, 15 Jul 2017 11:15:41 +0200 From: Emmanuel Vadot To: Ngie Cooper Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320944 - head/etc/rc.d Message-Id: <20170715111541.0680aae867a2146673fec94e@bidouilliste.com> In-Reply-To: <9D643ACB-FA58-499B-9783-71246C323ECC@gmail.com> References: <201707131340.v6DDeIE9086139@repo.freebsd.org> <9D643ACB-FA58-499B-9783-71246C323ECC@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 09:22:28 -0000 On Thu, 13 Jul 2017 08:44:36 -0700 Ngie Cooper wrote: > > > On Jul 13, 2017, at 06:40, Emmanuel Vadot wrote: > > > > Author: manu > > Date: Thu Jul 13 13:40:18 2017 > > New Revision: 320944 > > URL: https://svnweb.freebsd.org/changeset/base/320944 > > > > Log: > > Add an rc.d script to setup a netflow export via ng_netflow > > The default is to export netflow data on localhost on the netflow port. > > ngtee is used to have the lowest overhead possible. > > The ipfw ng hook is the netflow port (it can only be numeric) > > Default is netflow version 5. > > Hi Emmanuel, > The script isn't being installed. Could you please integrate it in to etc/rc.d/Makefile under a block conditional on MK_IPFW/MK_NETGRAPH? > Thanks! > -Ngie Fixed in 321008, thanks! -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Sat Jul 15 15:00:14 2017 Return-Path: Delivered-To: svn-src-head@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 A935EAFBFCC; Sat, 15 Jul 2017 15:00:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 78F3872C8D; Sat, 15 Jul 2017 15:00:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FF0Dm3000471; Sat, 15 Jul 2017 15:00:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FF0DWG000470; Sat, 15 Jul 2017 15:00:13 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201707151500.v6FF0DWG000470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 15 Jul 2017 15:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321011 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 321011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 15:00:14 -0000 Author: pfg Date: Sat Jul 15 15:00:13 2017 New Revision: 321011 URL: https://svnweb.freebsd.org/changeset/base/321011 Log: libthr: check for possible overflow in the pthread_barrier_init() count. Following up on r320900, where the check for negative count values was removed, add a check to prevent integer overflow. This is to account that b_count, b_waiters but most importantly the total number of threads in the system are signed values. Discussed with: kib MFC after: 2 weeks Modified: head/lib/libthr/thread/thr_barrier.c Modified: head/lib/libthr/thread/thr_barrier.c ============================================================================== --- head/lib/libthr/thread/thr_barrier.c Sat Jul 15 14:57:24 2017 (r321010) +++ head/lib/libthr/thread/thr_barrier.c Sat Jul 15 15:00:13 2017 (r321011) @@ -100,7 +100,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier, pthread_barrier_t bar; int pshared; - if (barrier == NULL || count == 0) + if (barrier == NULL || count == 0 || count > INT_MAX) return (EINVAL); if (attr == NULL || *attr == NULL || From owner-svn-src-head@freebsd.org Sat Jul 15 16:42:56 2017 Return-Path: Delivered-To: svn-src-head@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 ABDB4AFD700; Sat, 15 Jul 2017 16:42:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7744E7540E; Sat, 15 Jul 2017 16:42:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FGgtda043918; Sat, 15 Jul 2017 16:42:55 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FGgthE043917; Sat, 15 Jul 2017 16:42:55 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201707151642.v6FGgthE043917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 15 Jul 2017 16:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321015 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 321015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 16:42:56 -0000 Author: alc Date: Sat Jul 15 16:42:55 2017 New Revision: 321015 URL: https://svnweb.freebsd.org/changeset/base/321015 Log: Style-only change: Consistently use the variable name "pdpg" throughout this file. Previously, half of the pointers to a vm_page being used as a page directory page were named "pdpg" and the rest were named "mpde". Discussed with: kib MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Jul 15 15:26:38 2017 (r321014) +++ head/sys/amd64/amd64/pmap.c Sat Jul 15 16:42:55 2017 (r321015) @@ -4556,23 +4556,23 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t { pd_entry_t *pde, newpde; pt_entry_t PG_V; - vm_page_t mpde; + vm_page_t pdpg; struct spglist free; PG_V = pmap_valid_bit(pmap); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpde = pmap_allocpde(pmap, va, NULL)) == NULL) { + if ((pdpg = pmap_allocpde(pmap, va, NULL)) == NULL) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); } - pde = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mpde)); + pde = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pdpg)); pde = &pde[pmap_pde_index(va)]; if ((*pde & PG_V) != 0) { - KASSERT(mpde->wire_count > 1, - ("pmap_enter_pde: mpde's wire count is too low")); - mpde->wire_count--; + KASSERT(pdpg->wire_count > 1, + ("pmap_enter_pde: pdpg's wire count is too low")); + pdpg->wire_count--; CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); @@ -4588,7 +4588,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m), lockp)) { SLIST_INIT(&free); - if (pmap_unwire_ptp(pmap, va, mpde, &free)) { + if (pmap_unwire_ptp(pmap, va, pdpg, &free)) { /* * Although "va" is not mapped, paging- * structure caches could nonetheless have @@ -5013,6 +5013,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ vm_offset_t addr; vm_offset_t end_addr = src_addr + len; vm_offset_t va_next; + vm_page_t dst_pdpg, dstmpte, srcmpte; pt_entry_t PG_A, PG_M, PG_V; if (dst_addr != src_addr) @@ -5047,7 +5048,6 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ for (addr = src_addr; addr < end_addr; addr = va_next) { pt_entry_t *src_pte, *dst_pte; - vm_page_t dstmpde, dstmpte, srcmpte; pml4_entry_t *pml4e; pdp_entry_t *pdpe; pd_entry_t srcptepaddr, *pde; @@ -5083,11 +5083,11 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ if (srcptepaddr & PG_PS) { if ((addr & PDRMASK) != 0 || addr + NBPDR > end_addr) continue; - dstmpde = pmap_allocpde(dst_pmap, addr, NULL); - if (dstmpde == NULL) + dst_pdpg = pmap_allocpde(dst_pmap, addr, NULL); + if (dst_pdpg == NULL) break; pde = (pd_entry_t *) - PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpde)); + PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dst_pdpg)); pde = &pde[pmap_pde_index(addr)]; if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 || pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr & @@ -5096,7 +5096,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE); atomic_add_long(&pmap_pde_mappings, 1); } else - dstmpde->wire_count--; + dst_pdpg->wire_count--; continue; } @@ -6447,8 +6447,8 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_of pdp_entry_t newpdpe, oldpdpe; pd_entry_t *firstpde, newpde, *pde; pt_entry_t PG_A, PG_M, PG_RW, PG_V; - vm_paddr_t mpdepa; - vm_page_t mpde; + vm_paddr_t pdpgpa; + vm_page_t pdpg; PG_A = pmap_accessed_bit(pmap); PG_M = pmap_modified_bit(pmap); @@ -6459,15 +6459,15 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_of oldpdpe = *pdpe; KASSERT((oldpdpe & (PG_PS | PG_V)) == (PG_PS | PG_V), ("pmap_demote_pdpe: oldpdpe is missing PG_PS and/or PG_V")); - if ((mpde = vm_page_alloc(NULL, va >> PDPSHIFT, VM_ALLOC_INTERRUPT | + if ((pdpg = vm_page_alloc(NULL, va >> PDPSHIFT, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { CTR2(KTR_PMAP, "pmap_demote_pdpe: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); } - mpdepa = VM_PAGE_TO_PHYS(mpde); - firstpde = (pd_entry_t *)PHYS_TO_DMAP(mpdepa); - newpdpe = mpdepa | PG_M | PG_A | (oldpdpe & PG_U) | PG_RW | PG_V; + pdpgpa = VM_PAGE_TO_PHYS(pdpg); + firstpde = (pd_entry_t *)PHYS_TO_DMAP(pdpgpa); + newpdpe = pdpgpa | PG_M | PG_A | (oldpdpe & PG_U) | PG_RW | PG_V; KASSERT((oldpdpe & PG_A) != 0, ("pmap_demote_pdpe: oldpdpe is missing PG_A")); KASSERT((oldpdpe & (PG_M | PG_RW)) != PG_RW, From owner-svn-src-head@freebsd.org Sat Jul 15 17:59:29 2017 Return-Path: Delivered-To: svn-src-head@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 61BCAAFEF26; Sat, 15 Jul 2017 17:59:29 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 22F137D83D; Sat, 15 Jul 2017 17:59:29 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FHxSkm077679; Sat, 15 Jul 2017 17:59:28 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FHxS4x077678; Sat, 15 Jul 2017 17:59:28 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201707151759.v6FHxS4x077678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sat, 15 Jul 2017 17:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321023 - head/usr.sbin/ctladm X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/usr.sbin/ctladm X-SVN-Commit-Revision: 321023 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 17:59:29 -0000 Author: bcr (doc committer) Date: Sat Jul 15 17:59:28 2017 New Revision: 321023 URL: https://svnweb.freebsd.org/changeset/base/321023 Log: The ctladm man page incorrectly duplicated the text for the delete subcommand in the modify section. Rewrite the modify description text in two places to say modify/modified instead of remove/removed. PR: 220710 Submitted by: sseekamp@risei.net Reviewed by: mav@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11608 Modified: head/usr.sbin/ctladm/ctladm.8 Modified: head/usr.sbin/ctladm/ctladm.8 ============================================================================== --- head/usr.sbin/ctladm/ctladm.8 Sat Jul 15 17:44:29 2017 (r321022) +++ head/usr.sbin/ctladm/ctladm.8 Sat Jul 15 17:59:28 2017 (r321023) @@ -35,7 +35,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd January 23, 2017 +.Dd July 15, 2017 .Dt CTLADM 8 .Os .Sh NAME @@ -751,13 +751,13 @@ Modify a LUN size. The backend, the LUN number, and the size must be specified. .Bl -tag -width 14n .It Fl b Ar backend -Specify the backend that owns the LUN to be removed. +Specify the backend that owns the LUN to be modified. Examples are .Dq ramdisk and .Dq block . .It Fl l Ar lun_id -Specify the LUN number to remove. +Specify the LUN number to modify. .It Fl o Ar name=value Specify a backend-specific name/value pair. Multiple From owner-svn-src-head@freebsd.org Sat Jul 15 19:22:09 2017 Return-Path: Delivered-To: svn-src-head@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 AEC9BB7A19D; Sat, 15 Jul 2017 19:22:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 533A381D7B; Sat, 15 Jul 2017 19:22:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FJM8UQ018472; Sat, 15 Jul 2017 19:22:08 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FJM1Uq018398; Sat, 15 Jul 2017 19:22:01 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201707151922.v6FJM1Uq018398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 15 Jul 2017 19:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321030 - in head: etc/mtree sbin/pfctl sbin/pfctl/tests sbin/pfctl/tests/files targets/pseudo/tests X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head: etc/mtree sbin/pfctl sbin/pfctl/tests sbin/pfctl/tests/files targets/pseudo/tests X-SVN-Commit-Revision: 321030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 19:22:09 -0000 Author: kp Date: Sat Jul 15 19:22:01 2017 New Revision: 321030 URL: https://svnweb.freebsd.org/changeset/base/321030 Log: pfctl parser tests Copy the most important test cases from OpenBSD's corresponding src/regress/sbin/pfctl, those that run pfctl on a test input file and check correctness of its output. We have also added some new tests using the same format. The tests consist of a collection of input files (pf*.in) and corresponding output files (pf*.ok). We run pfctl -nv on the input files and check that the output matches the output files. If any discrepancy is discovered during future development in the source tree, we know that a regression bug has been introduced into the tree. Submitted by: paggas Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11322 Added: head/sbin/pfctl/tests/ head/sbin/pfctl/tests/Makefile (contents, props changed) head/sbin/pfctl/tests/files/ head/sbin/pfctl/tests/files/Makefile (contents, props changed) head/sbin/pfctl/tests/files/pf0001.in (contents, props changed) head/sbin/pfctl/tests/files/pf0001.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0002.in (contents, props changed) head/sbin/pfctl/tests/files/pf0002.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0003.in (contents, props changed) head/sbin/pfctl/tests/files/pf0003.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0004.in (contents, props changed) head/sbin/pfctl/tests/files/pf0004.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0005.in (contents, props changed) head/sbin/pfctl/tests/files/pf0005.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0006.in (contents, props changed) head/sbin/pfctl/tests/files/pf0006.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0007.in (contents, props changed) head/sbin/pfctl/tests/files/pf0007.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0008.in (contents, props changed) head/sbin/pfctl/tests/files/pf0008.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0009.in (contents, props changed) head/sbin/pfctl/tests/files/pf0009.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0010.in (contents, props changed) head/sbin/pfctl/tests/files/pf0010.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0011.in (contents, props changed) head/sbin/pfctl/tests/files/pf0011.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0012.in (contents, props changed) head/sbin/pfctl/tests/files/pf0012.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0013.in (contents, props changed) head/sbin/pfctl/tests/files/pf0013.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0014.in (contents, props changed) head/sbin/pfctl/tests/files/pf0014.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0016.in (contents, props changed) head/sbin/pfctl/tests/files/pf0016.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0018.in (contents, props changed) head/sbin/pfctl/tests/files/pf0018.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0019.in (contents, props changed) head/sbin/pfctl/tests/files/pf0019.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0020.in (contents, props changed) head/sbin/pfctl/tests/files/pf0020.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0022.in (contents, props changed) head/sbin/pfctl/tests/files/pf0022.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0023.in (contents, props changed) head/sbin/pfctl/tests/files/pf0023.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0024.in (contents, props changed) head/sbin/pfctl/tests/files/pf0024.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0025.in (contents, props changed) head/sbin/pfctl/tests/files/pf0025.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0026.in (contents, props changed) head/sbin/pfctl/tests/files/pf0026.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0028.in (contents, props changed) head/sbin/pfctl/tests/files/pf0028.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0030.in (contents, props changed) head/sbin/pfctl/tests/files/pf0030.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0031.in (contents, props changed) head/sbin/pfctl/tests/files/pf0031.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0032.in (contents, props changed) head/sbin/pfctl/tests/files/pf0032.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0034.in (contents, props changed) head/sbin/pfctl/tests/files/pf0034.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0035.in (contents, props changed) head/sbin/pfctl/tests/files/pf0035.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0038.in (contents, props changed) head/sbin/pfctl/tests/files/pf0038.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0039.in (contents, props changed) head/sbin/pfctl/tests/files/pf0039.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0040.in (contents, props changed) head/sbin/pfctl/tests/files/pf0040.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0041.in (contents, props changed) head/sbin/pfctl/tests/files/pf0041.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0047.in (contents, props changed) head/sbin/pfctl/tests/files/pf0047.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0048.in (contents, props changed) head/sbin/pfctl/tests/files/pf0048.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0049.in (contents, props changed) head/sbin/pfctl/tests/files/pf0049.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0050.in (contents, props changed) head/sbin/pfctl/tests/files/pf0050.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0052.in (contents, props changed) head/sbin/pfctl/tests/files/pf0052.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0053.in (contents, props changed) head/sbin/pfctl/tests/files/pf0053.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0055.in (contents, props changed) head/sbin/pfctl/tests/files/pf0055.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0056.in (contents, props changed) head/sbin/pfctl/tests/files/pf0056.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0057.in (contents, props changed) head/sbin/pfctl/tests/files/pf0057.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0060.in (contents, props changed) head/sbin/pfctl/tests/files/pf0060.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0061.in (contents, props changed) head/sbin/pfctl/tests/files/pf0061.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0065.in (contents, props changed) head/sbin/pfctl/tests/files/pf0065.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0067.in (contents, props changed) head/sbin/pfctl/tests/files/pf0067.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0069.in (contents, props changed) head/sbin/pfctl/tests/files/pf0069.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0070.in (contents, props changed) head/sbin/pfctl/tests/files/pf0070.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0071.in (contents, props changed) head/sbin/pfctl/tests/files/pf0071.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0072.in (contents, props changed) head/sbin/pfctl/tests/files/pf0072.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0074.in (contents, props changed) head/sbin/pfctl/tests/files/pf0074.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0075.in (contents, props changed) head/sbin/pfctl/tests/files/pf0075.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0077.in (contents, props changed) head/sbin/pfctl/tests/files/pf0077.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0078.in (contents, props changed) head/sbin/pfctl/tests/files/pf0078.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0079.in (contents, props changed) head/sbin/pfctl/tests/files/pf0079.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0081.in (contents, props changed) head/sbin/pfctl/tests/files/pf0081.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0082.in (contents, props changed) head/sbin/pfctl/tests/files/pf0082.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0084.in (contents, props changed) head/sbin/pfctl/tests/files/pf0084.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0085.in (contents, props changed) head/sbin/pfctl/tests/files/pf0085.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0087.in (contents, props changed) head/sbin/pfctl/tests/files/pf0087.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0088.in (contents, props changed) head/sbin/pfctl/tests/files/pf0088.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0089.in (contents, props changed) head/sbin/pfctl/tests/files/pf0089.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0090.in (contents, props changed) head/sbin/pfctl/tests/files/pf0090.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0091.in (contents, props changed) head/sbin/pfctl/tests/files/pf0091.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0092.in (contents, props changed) head/sbin/pfctl/tests/files/pf0092.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0094.in (contents, props changed) head/sbin/pfctl/tests/files/pf0094.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0095.in (contents, props changed) head/sbin/pfctl/tests/files/pf0095.include (contents, props changed) head/sbin/pfctl/tests/files/pf0095.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0096.in (contents, props changed) head/sbin/pfctl/tests/files/pf0096.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0097.in (contents, props changed) head/sbin/pfctl/tests/files/pf0097.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0098.in (contents, props changed) head/sbin/pfctl/tests/files/pf0098.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0100.in (contents, props changed) head/sbin/pfctl/tests/files/pf0100.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0101.in (contents, props changed) head/sbin/pfctl/tests/files/pf0101.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0102.in (contents, props changed) head/sbin/pfctl/tests/files/pf0102.ok (contents, props changed) head/sbin/pfctl/tests/files/pf0104.in (contents, props changed) head/sbin/pfctl/tests/files/pf0104.ok (contents, props changed) head/sbin/pfctl/tests/files/pf1001.in (contents, props changed) head/sbin/pfctl/tests/files/pf1001.ok (contents, props changed) head/sbin/pfctl/tests/files/pf1002.in (contents, props changed) head/sbin/pfctl/tests/files/pf1002.ok (contents, props changed) head/sbin/pfctl/tests/files/pf1003.in (contents, props changed) head/sbin/pfctl/tests/files/pf1003.ok (contents, props changed) head/sbin/pfctl/tests/files/pf1004.in (contents, props changed) head/sbin/pfctl/tests/files/pf1004.ok (contents, props changed) head/sbin/pfctl/tests/files/pfctl_test_descr.sh (contents, props changed) head/sbin/pfctl/tests/pfctl_test.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/sbin/pfctl/Makefile head/targets/pseudo/tests/Makefile.depend Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sat Jul 15 19:18:37 2017 (r321029) +++ head/etc/mtree/BSD.tests.dist Sat Jul 15 19:22:01 2017 (r321030) @@ -378,6 +378,10 @@ .. mdconfig .. + pfctl + files + .. + .. .. secure lib Modified: head/sbin/pfctl/Makefile ============================================================================== --- head/sbin/pfctl/Makefile Sat Jul 15 19:18:37 2017 (r321029) +++ head/sbin/pfctl/Makefile Sat Jul 15 19:22:01 2017 (r321030) @@ -31,4 +31,8 @@ YFLAGS= LIBADD= m md +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/sbin/pfctl/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/Makefile Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +ATF_TESTS_SH= pfctl_test + +SUBDIR+= files + +.include Added: head/sbin/pfctl/tests/files/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/Makefile Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sbin/pfctl/files +BINDIR= ${TESTSDIR} + +# We use ${.CURDIR} as workaround so that the glob patterns work. +FILES= ${.CURDIR}/pf????.in +FILES+= ${.CURDIR}/pf????.include +FILES+= ${.CURDIR}/pf????.ok +FILES+= ${.CURDIR}/pfctl_test_descr.sh + +.include Added: head/sbin/pfctl/tests/files/pf0001.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0001.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,8 @@ +pass in all +pass in from any to any no state +pass in proto tcp from any port <= 1024 to any label foo_bar +pass in proto tcp from any to any port = 25 +pass in proto tcp from 10.0.0.0/8 port > 1024 to ! 10.1.2.3 port != 22 +pass in proto igmp from 10.0.0.0/8 to 10.1.1.1 allow-opts +pass in proto tcp from { 1.2.3.4, 1.2.3.5 } to any label \ +"$nr:$proto:$srcaddr:$srcport:$dstaddr:$dstport" Added: head/sbin/pfctl/tests/files/pf0001.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0001.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,8 @@ +pass in all flags S/SA keep state +pass in all no state +pass in proto tcp from any port <= 1024 to any flags S/SA keep state label "foo_bar" +pass in proto tcp from any to any port = smtp flags S/SA keep state +pass in inet proto tcp from 10.0.0.0/8 port > 1024 to ! 10.1.2.3 port != ssh flags S/SA keep state +pass in inet proto igmp from 10.0.0.0/8 to 10.1.1.1 keep state allow-opts +pass in inet proto tcp from 1.2.3.4 to any flags S/SA keep state label "6:tcp:1.2.3.4::any:" +pass in inet proto tcp from 1.2.3.5 to any flags S/SA keep state label "7:tcp:1.2.3.5::any:" Added: head/sbin/pfctl/tests/files/pf0002.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0002.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,34 @@ +# test + +block out log on tun1000000 all +block in log on tun1000000 all + +block return-rst out log on tun1000000 proto tcp all +block return-rst in log on tun1000000 proto tcp all +block return-icmp out log on tun1000000 proto udp all +block return-icmp in log on tun1000000 proto udp all + +block out log quick on tun1000000 from ! 157.161.48.183 to any + +block in quick on tun1000000 from any to 255.255.255.255 + +block in log quick on tun1000000 from 10.0.0.0/8 to any +block in log quick on tun1000000 from 172.16.0.0/12 to any +block in quick log on tun1000000 from 192.168.0.0/16 to any +block in quick log on tun1000000 from 255.255.255.255/32 to any + +block in log quick from no-route to any + +pass out on tun1000000 inet proto icmp all icmp-type 8 code 0 keep state +pass in on tun1000000 inet proto icmp all icmp-type 8 code 0 keep state + +pass out on tun1000000 proto udp all keep state + +pass in on tun1000000 proto udp from any to any port = domain keep state + +pass out on tun1000000 proto tcp all keep state + +pass in on tun1000000 proto tcp from any to any port = ssh keep state +pass in on tun1000000 proto tcp from any to any port = smtp keep state +pass in on tun1000000 proto tcp from any to any port = domain keep state +pass in on tun1000000 proto tcp from any to any port = auth keep state Added: head/sbin/pfctl/tests/files/pf0002.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0002.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,22 @@ +block drop out log on tun1000000 all +block drop in log on tun1000000 all +block return-rst out log on tun1000000 proto tcp all +block return-rst in log on tun1000000 proto tcp all +block return-icmp(port-unr, port-unr) out log on tun1000000 proto udp all +block return-icmp(port-unr, port-unr) in log on tun1000000 proto udp all +block drop out log quick on tun1000000 inet from ! 157.161.48.183 to any +block drop in quick on tun1000000 inet from any to 255.255.255.255 +block drop in log quick on tun1000000 inet from 10.0.0.0/8 to any +block drop in log quick on tun1000000 inet from 172.16.0.0/12 to any +block drop in log quick on tun1000000 inet from 192.168.0.0/16 to any +block drop in log quick on tun1000000 inet from 255.255.255.255 to any +block drop in log quick from no-route to any +pass out on tun1000000 inet proto icmp all icmp-type echoreq code 0 keep state +pass in on tun1000000 inet proto icmp all icmp-type echoreq code 0 keep state +pass out on tun1000000 proto udp all keep state +pass in on tun1000000 proto udp from any to any port = domain keep state +pass out on tun1000000 proto tcp all flags S/SA keep state +pass in on tun1000000 proto tcp from any to any port = ssh flags S/SA keep state +pass in on tun1000000 proto tcp from any to any port = smtp flags S/SA keep state +pass in on tun1000000 proto tcp from any to any port = domain flags S/SA keep state +pass in on tun1000000 proto tcp from any to any port = auth flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0003.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0003.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,13 @@ +pass in all +pass in from any to any + +block in proto tcp from any to any flags FUPEW/FSRPAUEW +block in proto tcp from any to any flags SF/SFRA +block in proto tcp from any to any flags /SFRAW + +pass in proto { udp, icmp, tcp } from any to any flags S/SA +pass in from any to any flags S/SA no state +pass in from any to any flags any no state +pass in from any to any flags any +pass in from any to any keep state +pass in from any to any Added: head/sbin/pfctl/tests/files/pf0003.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0003.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,13 @@ +pass in all flags S/SA keep state +pass in all flags S/SA keep state +block drop in proto tcp all flags FPUEW/FSRPAUEW +block drop in proto tcp all flags FS/FSRA +block drop in proto tcp all flags /FSRAW +pass in proto udp all keep state +pass in proto icmp all keep state +pass in proto tcp all flags S/SA keep state +pass in all flags S/SA no state +pass in all no state +pass in all flags any keep state +pass in all flags S/SA keep state +pass in all flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0004.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0004.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,16 @@ +block in all +block in proto tcp all +block in proto { tcp, udp } all + +block in from any to any +block in from 10.0.0.0/8 to any +block in from ! 10.0.0.0/8 to any +block in from { 10.0.0.0/8, 172.16.0.0/12 } to any + +block in proto tcp from any port = ssh to any +block in proto tcp from any port { ssh, ftp >< 2048, != 1234, >= www } \ + to any port 1024:2048 + +block in proto { tcp, udp } from { 10.0.0.0/8, 172.16.0.0/12 } port { ssh, ftp } \ + to { 192.168.0.0/16, 12.34.56.78 } port { 6667, 6668, 6669:65535 } + Added: head/sbin/pfctl/tests/files/pf0004.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0004.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,62 @@ +block drop in all +block drop in proto tcp all +block drop in proto tcp all +block drop in proto udp all +block drop in all +block drop in inet from 10.0.0.0/8 to any +block drop in inet from ! 10.0.0.0/8 to any +block drop in inet from 10.0.0.0/8 to any +block drop in inet from 172.16.0.0/12 to any +block drop in proto tcp from any port = ssh to any +block drop in proto tcp from any port = ssh to any port 1024:2048 +block drop in proto tcp from any port 21 >< 2048 to any port 1024:2048 +block drop in proto tcp from any port != 1234 to any port 1024:2048 +block drop in proto tcp from any port >= 80 to any port 1024:2048 +block drop in inet proto tcp from 10.0.0.0/8 port = ssh to 192.168.0.0/16 port = ircd +block drop in inet proto tcp from 10.0.0.0/8 port = ssh to 192.168.0.0/16 port = 6668 +block drop in inet proto tcp from 10.0.0.0/8 port = ssh to 192.168.0.0/16 port 6669:65535 +block drop in inet proto tcp from 10.0.0.0/8 port = ssh to 12.34.56.78 port = ircd +block drop in inet proto tcp from 10.0.0.0/8 port = ssh to 12.34.56.78 port = 6668 +block drop in inet proto tcp from 10.0.0.0/8 port = ssh to 12.34.56.78 port 6669:65535 +block drop in inet proto tcp from 10.0.0.0/8 port = ftp to 192.168.0.0/16 port = ircd +block drop in inet proto tcp from 10.0.0.0/8 port = ftp to 192.168.0.0/16 port = 6668 +block drop in inet proto tcp from 10.0.0.0/8 port = ftp to 192.168.0.0/16 port 6669:65535 +block drop in inet proto tcp from 10.0.0.0/8 port = ftp to 12.34.56.78 port = ircd +block drop in inet proto tcp from 10.0.0.0/8 port = ftp to 12.34.56.78 port = 6668 +block drop in inet proto tcp from 10.0.0.0/8 port = ftp to 12.34.56.78 port 6669:65535 +block drop in inet proto tcp from 172.16.0.0/12 port = ssh to 192.168.0.0/16 port = ircd +block drop in inet proto tcp from 172.16.0.0/12 port = ssh to 192.168.0.0/16 port = 6668 +block drop in inet proto tcp from 172.16.0.0/12 port = ssh to 192.168.0.0/16 port 6669:65535 +block drop in inet proto tcp from 172.16.0.0/12 port = ssh to 12.34.56.78 port = ircd +block drop in inet proto tcp from 172.16.0.0/12 port = ssh to 12.34.56.78 port = 6668 +block drop in inet proto tcp from 172.16.0.0/12 port = ssh to 12.34.56.78 port 6669:65535 +block drop in inet proto tcp from 172.16.0.0/12 port = ftp to 192.168.0.0/16 port = ircd +block drop in inet proto tcp from 172.16.0.0/12 port = ftp to 192.168.0.0/16 port = 6668 +block drop in inet proto tcp from 172.16.0.0/12 port = ftp to 192.168.0.0/16 port 6669:65535 +block drop in inet proto tcp from 172.16.0.0/12 port = ftp to 12.34.56.78 port = ircd +block drop in inet proto tcp from 172.16.0.0/12 port = ftp to 12.34.56.78 port = 6668 +block drop in inet proto tcp from 172.16.0.0/12 port = ftp to 12.34.56.78 port 6669:65535 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 192.168.0.0/16 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 192.168.0.0/16 port = 6668 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 192.168.0.0/16 port 6669:65535 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 12.34.56.78 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 12.34.56.78 port = 6668 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 12.34.56.78 port 6669:65535 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 192.168.0.0/16 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 192.168.0.0/16 port = 6668 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 192.168.0.0/16 port 6669:65535 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 12.34.56.78 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 12.34.56.78 port = 6668 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 12.34.56.78 port 6669:65535 +block drop in inet proto udp from 172.16.0.0/12 port = ssh to 192.168.0.0/16 port = 6667 +block drop in inet proto udp from 172.16.0.0/12 port = ssh to 192.168.0.0/16 port = 6668 +block drop in inet proto udp from 172.16.0.0/12 port = ssh to 192.168.0.0/16 port 6669:65535 +block drop in inet proto udp from 172.16.0.0/12 port = ssh to 12.34.56.78 port = 6667 +block drop in inet proto udp from 172.16.0.0/12 port = ssh to 12.34.56.78 port = 6668 +block drop in inet proto udp from 172.16.0.0/12 port = ssh to 12.34.56.78 port 6669:65535 +block drop in inet proto udp from 172.16.0.0/12 port = ftp to 192.168.0.0/16 port = 6667 +block drop in inet proto udp from 172.16.0.0/12 port = ftp to 192.168.0.0/16 port = 6668 +block drop in inet proto udp from 172.16.0.0/12 port = ftp to 192.168.0.0/16 port 6669:65535 +block drop in inet proto udp from 172.16.0.0/12 port = ftp to 12.34.56.78 port = 6667 +block drop in inet proto udp from 172.16.0.0/12 port = ftp to 12.34.56.78 port = 6668 +block drop in inet proto udp from 172.16.0.0/12 port = ftp to 12.34.56.78 port 6669:65535 Added: head/sbin/pfctl/tests/files/pf0005.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0005.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,6 @@ +foo = "ssh, ftp" +bar = "other thing" +inside="10.0.0.0/8" + +block in proto udp from $inside port { echo, $foo, ident } \ + to 12.34.56.78 port { 6667, 0x10 } Added: head/sbin/pfctl/tests/files/pf0005.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0005.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,11 @@ +foo = "ssh, ftp" +bar = "other thing" +inside = "10.0.0.0/8" +block drop in inet proto udp from 10.0.0.0/8 port = echo to 12.34.56.78 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = echo to 12.34.56.78 port = 16 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 12.34.56.78 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = ssh to 12.34.56.78 port = 16 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 12.34.56.78 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = ftp to 12.34.56.78 port = 16 +block drop in inet proto udp from 10.0.0.0/8 port = auth to 12.34.56.78 port = 6667 +block drop in inet proto udp from 10.0.0.0/8 port = auth to 12.34.56.78 port = 16 Added: head/sbin/pfctl/tests/files/pf0006.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0006.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,3 @@ +a=b +c=x +a_b_c=d Added: head/sbin/pfctl/tests/files/pf0006.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0006.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,3 @@ +a = "b" +c = "x" +a_b_c = "d" Added: head/sbin/pfctl/tests/files/pf0007.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0007.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,34 @@ +# test modulate state + +block out log on tun1000000 all +block in log on tun1000000 all + +block return-rst out log on tun1000000 proto tcp all +block return-rst in log on tun1000000 proto tcp all +block return-icmp out log on tun1000000 proto udp all +block return-icmp in log on tun1000000 proto udp all + +block out log quick on tun1000000 from ! 157.161.48.183 to any + +block in quick on tun1000000 from any to 255.255.255.255 + +block in log quick on tun1000000 from 10.0.0.0/8 to any +block in log quick on tun1000000 from 172.16.0.0/12 to any +block in log quick on tun1000000 from 192.168.0.0/16 to any +block in log quick on tun1000000 from 255.255.255.255/32 to any + +pass out on tun1000000 inet proto icmp all icmp-type 8 code 0 keep state +pass in on tun1000000 inet proto icmp all icmp-type 8 code 0 keep state + +pass out on tun1000000 proto udp all keep state + +pass in on tun1000000 proto udp from any to any port = domain keep state + +pass out on tun1000000 proto tcp all modulate state +pass in on tun1000000 proto { tcp udp icmp } all modulate state +pass in on tun1000000 proto { udp tcp icmp } all flags S/SA synproxy state + +pass in on tun1000000 proto tcp from any to any port = ssh modulate state +pass in on tun1000000 proto tcp from any to any port = smtp modulate state +pass in on tun1000000 proto tcp from any to any port = domain modulate state +pass in on tun1000000 proto tcp from any to any port = auth modulate state Added: head/sbin/pfctl/tests/files/pf0007.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0007.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,27 @@ +block drop out log on tun1000000 all +block drop in log on tun1000000 all +block return-rst out log on tun1000000 proto tcp all +block return-rst in log on tun1000000 proto tcp all +block return-icmp(port-unr, port-unr) out log on tun1000000 proto udp all +block return-icmp(port-unr, port-unr) in log on tun1000000 proto udp all +block drop out log quick on tun1000000 inet from ! 157.161.48.183 to any +block drop in quick on tun1000000 inet from any to 255.255.255.255 +block drop in log quick on tun1000000 inet from 10.0.0.0/8 to any +block drop in log quick on tun1000000 inet from 172.16.0.0/12 to any +block drop in log quick on tun1000000 inet from 192.168.0.0/16 to any +block drop in log quick on tun1000000 inet from 255.255.255.255 to any +pass out on tun1000000 inet proto icmp all icmp-type echoreq code 0 keep state +pass in on tun1000000 inet proto icmp all icmp-type echoreq code 0 keep state +pass out on tun1000000 proto udp all keep state +pass in on tun1000000 proto udp from any to any port = domain keep state +pass out on tun1000000 proto tcp all flags S/SA modulate state +pass in on tun1000000 proto tcp all flags S/SA modulate state +pass in on tun1000000 proto udp all keep state +pass in on tun1000000 proto icmp all keep state +pass in on tun1000000 proto udp all keep state +pass in on tun1000000 proto tcp all flags S/SA synproxy state +pass in on tun1000000 proto icmp all keep state +pass in on tun1000000 proto tcp from any to any port = ssh flags S/SA modulate state +pass in on tun1000000 proto tcp from any to any port = smtp flags S/SA modulate state +pass in on tun1000000 proto tcp from any to any port = domain flags S/SA modulate state +pass in on tun1000000 proto tcp from any to any port = auth flags S/SA modulate state Added: head/sbin/pfctl/tests/files/pf0008.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0008.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,2 @@ +extern = "{ ! 10.0.0.0/8, 10.1.2.3 }" +block out log on tun1000001 from $extern to any Added: head/sbin/pfctl/tests/files/pf0008.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0008.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,3 @@ +extern = "{ ! 10.0.0.0/8, 10.1.2.3 }" +block drop out log on tun1000001 inet from ! 10.0.0.0/8 to any +block drop out log on tun1000001 inet from 10.1.2.3 to any Added: head/sbin/pfctl/tests/files/pf0009.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0009.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,3 @@ +interfaces = "{ enc0, tun1000000 }" + +block in on $interfaces all Added: head/sbin/pfctl/tests/files/pf0009.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0009.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,3 @@ +interfaces = "{ enc0, tun1000000 }" +block drop in on enc0 all +block drop in on tun1000000 all Added: head/sbin/pfctl/tests/files/pf0010.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0010.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,31 @@ +# return variants +pass in inet proto icmp all +pass in inet6 proto icmp6 all +block in inet proto icmp all +block in inet6 proto icmp6 all +block return-rst in inet proto tcp all +block return-rst in inet6 proto tcp all +block return-rst(ttl 10) in inet proto tcp all +block return-rst(ttl 10) in inet6 proto tcp all +block return-icmp in inet proto icmp all +block return-icmp(0) in inet proto icmp all +block return-icmp(net-unr) in inet proto icmp all +block return-icmp(5) in inet proto icmp all +block return-icmp(srcfail) in inet proto icmp all +block return-icmp(10) in inet proto icmp all +block return-icmp(host-prohib) in inet proto icmp all +block return-icmp(15) in inet proto icmp all +block return-icmp(cutoff-preced) in inet proto icmp all +block return-icmp6 in inet6 proto icmp6 all +block return-icmp6(0) in inet6 proto icmp6 all +block return-icmp6(noroute-unr) in inet6 proto icmp6 all +block return-icmp6(1) in inet6 proto icmp6 all +block return-icmp6(admin-unr) in inet6 proto icmp6 all +block return-icmp6(2) in inet6 proto icmp6 all +block return-icmp6(notnbr-unr) in inet6 proto icmp6 all +block return-icmp6(3) in inet6 proto icmp6 all +block return-icmp6(addr-unr) in inet6 proto icmp6 all +block return-icmp6(4) in inet6 proto icmp6 all +block return-icmp6(port-unr) in inet6 proto icmp6 all +block return-icmp(5, 1) in all +block return-icmp(srcfail, admin-unr) in all Added: head/sbin/pfctl/tests/files/pf0010.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0010.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,30 @@ +pass in inet proto icmp all keep state +pass in inet6 proto ipv6-icmp all keep state +block drop in inet proto icmp all +block drop in inet6 proto ipv6-icmp all +block return-rst in inet proto tcp all +block return-rst in inet6 proto tcp all +block return-rst(ttl 10) in inet proto tcp all +block return-rst(ttl 10) in inet6 proto tcp all +block return-icmp(port-unr) in inet proto icmp all +block return-icmp(net-unr) in inet proto icmp all +block return-icmp(net-unr) in inet proto icmp all +block return-icmp(srcfail) in inet proto icmp all +block return-icmp(srcfail) in inet proto icmp all +block return-icmp(host-prohib) in inet proto icmp all +block return-icmp(host-prohib) in inet proto icmp all +block return-icmp(cutoff-preced) in inet proto icmp all +block return-icmp(cutoff-preced) in inet proto icmp all +block return-icmp6(port-unr) in inet6 proto ipv6-icmp all +block return-icmp6(noroute-unr) in inet6 proto ipv6-icmp all +block return-icmp6(noroute-unr) in inet6 proto ipv6-icmp all +block return-icmp6(admin-unr) in inet6 proto ipv6-icmp all +block return-icmp6(admin-unr) in inet6 proto ipv6-icmp all +block return-icmp6(notnbr-unr) in inet6 proto ipv6-icmp all +block return-icmp6(notnbr-unr) in inet6 proto ipv6-icmp all +block return-icmp6(addr-unr) in inet6 proto ipv6-icmp all +block return-icmp6(addr-unr) in inet6 proto ipv6-icmp all +block return-icmp6(port-unr) in inet6 proto ipv6-icmp all +block return-icmp6(port-unr) in inet6 proto ipv6-icmp all +block return-icmp(srcfail, admin-unr) in all +block return-icmp(srcfail, admin-unr) in all Added: head/sbin/pfctl/tests/files/pf0011.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0011.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,18 @@ +pass in inet proto icmp all icmp-type 0 +pass in inet proto icmp all icmp-type 0 code 0 +pass in inet proto icmp all icmp-type 1 +pass in inet proto icmp all icmp-type 1 code 1 +pass in inet6 proto ipv6-icmp all icmp6-type 0 +pass in inet6 proto ipv6-icmp all icmp6-type 0 code 0 +pass in inet6 proto ipv6-icmp all icmp6-type 1 +pass in inet6 proto ipv6-icmp all icmp6-type 1 code 1 +block in inet proto icmp all icmp-type 0 +block in inet proto icmp all icmp-type 0 code 0 +block in inet proto icmp all icmp-type 1 +block in inet proto icmp all icmp-type 1 code 1 +block in inet6 proto ipv6-icmp all icmp6-type 0 +block in inet6 proto ipv6-icmp all icmp6-type 0 code 0 +block in inet6 proto ipv6-icmp all icmp6-type 1 +block in inet6 proto ipv6-icmp all icmp6-type 1 code 1 +pass in inet proto icmp all icmp-type unreach code needfrag +pass in inet6 proto ipv6-icmp all icmp6-type timex code reassemb Added: head/sbin/pfctl/tests/files/pf0011.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0011.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,18 @@ +pass in inet proto icmp all icmp-type echorep keep state +pass in inet proto icmp all icmp-type echorep code 0 keep state +pass in inet proto icmp all icmp-type 1 keep state +pass in inet proto icmp all icmp-type 1 code 1 keep state +pass in inet6 proto ipv6-icmp all icmp6-type 0 keep state +pass in inet6 proto ipv6-icmp all icmp6-type 0 code 0 keep state +pass in inet6 proto ipv6-icmp all icmp6-type unreach keep state +pass in inet6 proto ipv6-icmp all icmp6-type unreach code admin-unr keep state +block drop in inet proto icmp all icmp-type echorep +block drop in inet proto icmp all icmp-type echorep code 0 +block drop in inet proto icmp all icmp-type 1 +block drop in inet proto icmp all icmp-type 1 code 1 +block drop in inet6 proto ipv6-icmp all icmp6-type 0 +block drop in inet6 proto ipv6-icmp all icmp6-type 0 code 0 +block drop in inet6 proto ipv6-icmp all icmp6-type unreach +block drop in inet6 proto ipv6-icmp all icmp6-type unreach code admin-unr +pass in inet proto icmp all icmp-type unreach code needfrag keep state +pass in inet6 proto ipv6-icmp all icmp6-type timex code reassemb keep state Added: head/sbin/pfctl/tests/files/pf0012.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0012.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +pass in from 127.0.0.1 to 127.0.0.1/8 no state +pass in from 127.0.0.1/16 to 127.0.0.1/24 no state +pass in from 127.0.0.1/25 to ! 127.0.0.1/26 +pass in inet from ! localhost to localhost/16 +pass in inet from ! lo0 to ! lo0/8 Added: head/sbin/pfctl/tests/files/pf0012.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0012.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +pass in inet from 127.0.0.1 to 127.0.0.0/8 no state +pass in inet from 127.0.0.0/16 to 127.0.0.0/24 no state +pass in inet from 127.0.0.0/25 to ! 127.0.0.0/26 flags S/SA keep state +pass in inet from ! 127.0.0.1 to 127.0.0.0/16 flags S/SA keep state +pass in inet from ! 127.0.0.1 to ! 127.0.0.0/8 flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0013.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0013.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,22 @@ +pass in quick on enc0 from any to any +pass in quick on enc0 inet from any to any +pass in quick on enc0 inet6 from any to any + +#pass out quick on tun1000000 inet from any to any route-to tun1000001 +#pass out quick on tun1000000 from any to 192.168.1.1 route-to tun1000001 +#pass out quick on tun1000000 from any to fec0::1 route-to tun1000001 + +#pass in on tun1000000 proto tcp from any to any port = 21 dup-to (tun1000001 192.168.1.1) +#pass in on tun1000000 proto tcp from any to any port = 21 dup-to (tun1000001 fec0::1) + +#pass in quick on tun1000000 from 192.168.1.1/32 to 10.1.1.1/32 route-to tun1000001 +#pass in quick on tun1000000 from fec0::1/64 to fec1::2/128 route-to tun1000001 + +#pass in on tun1000000 proto tcp from any to any port = 21 reply-to (tun1000001 192.168.1.1) +#pass in on tun1000000 proto tcp from any to any port = 21 reply-to (tun1000001 fec0::1) + +#pass in quick on tun1000000 from 192.168.1.1/32 to 10.1.1.1/32 reply-to tun1000001 +#pass in quick on tun1000000 from fec0::1/64 to fec1::2/128 reply-to tun1000001 + +#pass in quick on tun1000000 from 192.168.1.1/32 to 10.1.1.1/32 dup-to (tun1000001 192.168.1.100) +#pass in quick on tun1000000 from fec0::1/64 to fec1::2/128 dup-to (tun1000001 fec1::2) Added: head/sbin/pfctl/tests/files/pf0013.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0013.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,3 @@ +pass in quick on enc0 all flags S/SA keep state +pass in quick on enc0 inet all flags S/SA keep state +pass in quick on enc0 inet6 all flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0014.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0014.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,6 @@ +pass in quick on lo0 from fe80::1%lo0 to fe80::1%lo0 +pass in quick from fe80::1%lo0 to fe80::1%lo0 +pass in quick from fe80::1%lo0 to any +pass in quick from any to fe80::1%lo0 +pass in quick on lo0 from fe80::1%lo0 to any +pass in quick on lo0 from any to fe80::1%lo0 Added: head/sbin/pfctl/tests/files/pf0014.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0014.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,6 @@ +pass in quick on lo0 inet6 from fe80::1 to fe80::1 flags S/SA keep state +pass in quick on lo0 inet6 from fe80::1 to fe80::1 flags S/SA keep state +pass in quick on lo0 inet6 from fe80::1 to any flags S/SA keep state +pass in quick on lo0 inet6 from any to fe80::1 flags S/SA keep state +pass in quick on lo0 inet6 from fe80::1 to any flags S/SA keep state +pass in quick on lo0 inet6 from any to fe80::1 flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0016.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0016.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +# Test rule order processing: should fail unless nat -> filter +#match out on lo0 from 192.168.1.1 to any nat-to 10.0.0.1 +#match in on lo0 proto tcp from any to 1.2.3.4/32 port 2222 rdr-to 10.0.0.10 port 22 +#match on lo0 from 192.168.1.1 to any binat-to 10.0.0.1 +pass in on lo1000000 from any to any no state Added: head/sbin/pfctl/tests/files/pf0016.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0016.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1 @@ +pass in on lo1000000 all no state Added: head/sbin/pfctl/tests/files/pf0018.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0018.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,19 @@ +# test nat + +TEST_LIST1 = "{ 192.168.1.5, 192.168.1.6, 192.168.1.7 }" +TEST_LIST2 = "{ 172.6.1.1, 172.14.1.2/32, 172.16.2.0/24 }" + +#match out on lo0 from 192.168.1.1 to any nat-to 10.0.0.1 +#match out on lo0 proto tcp from 192.168.1.2 to any nat-to 10.0.0.2 +#match out on lo0 proto udp from 192.168.1.3 to any nat-to 10.0.0.3 +#match out on lo0 proto icmp from 192.168.1.4 to any nat-to 10.0.0.4 + +#match out on lo0 inet from $TEST_LIST1 to $TEST_LIST2 nat-to lo0 + +#match out on lo0 inet from 192.168.0.1/24 to any nat-to (lo0) + +#match out on lo0 from 192.168.1.8 to ! 172.17.0.0/16 nat-to 10.0.0.8 + +#match out on ! lo0 proto { udp, tcp } from any to any nat-to 10.0.0.8 static-port + +#match out on { lo0, tun1000000 } from any to any nat-to 10.0.0.8 Added: head/sbin/pfctl/tests/files/pf0018.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0018.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,2 @@ +TEST_LIST1 = "{ 192.168.1.5, 192.168.1.6, 192.168.1.7 }" +TEST_LIST2 = "{ 172.6.1.1, 172.14.1.2/32, 172.16.2.0/24 }" Added: head/sbin/pfctl/tests/files/pf0019.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0019.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,9 @@ +EVIL = "lo0" +GOOD = "{ lo0, lo1000000 }" +GOOD_NET = "{ 127.0.0.0/24, 10.0.1.0/24 }" +DEST_NET = "{ 1.2.3.4/25, 2.4.6.8/30 }" + +#match in on lo0 proto tcp from any to 1.2.3.4/32 port 2222 rdr-to 10.0.0.10 port 22 + +# Test list processing +#match in on $GOOD proto tcp from $GOOD_NET to $DEST_NET port 21 rdr-to 127.0.0.1 port 8021 Added: head/sbin/pfctl/tests/files/pf0019.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0019.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,4 @@ +EVIL = "lo0" +GOOD = "{ lo0, lo1000000 }" +GOOD_NET = "{ 127.0.0.0/24, 10.0.1.0/24 }" +DEST_NET = "{ 1.2.3.4/25, 2.4.6.8/30 }" Added: head/sbin/pfctl/tests/files/pf0020.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0020.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,9 @@ +# Test whether list expansion in NAT/RDR works correctly + +EVIL = "lo0" +GOOD = "{ lo0, lo1000000 }" +GOOD_NET = "{ 127.0.0.0/24, 10.0.1.0/24 }" +DEST_NET = "{ 1.2.3.4/25, 2.4.6.8/30 }" + +#match out on $EVIL inet from $GOOD_NET to $DEST_NET nat-to $EVIL +#match in on $GOOD proto tcp from $GOOD_NET to $DEST_NET port 21 rdr-to 127.0.0.1 port 8021 Added: head/sbin/pfctl/tests/files/pf0020.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0020.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,4 @@ +EVIL = "lo0" +GOOD = "{ lo0, lo1000000 }" +GOOD_NET = "{ 127.0.0.0/24, 10.0.1.0/24 }" +DEST_NET = "{ 1.2.3.4/25, 2.4.6.8/30 }" Added: head/sbin/pfctl/tests/files/pf0022.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0022.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,8 @@ +set optimization aggressive +set timeout { tcp.closing 6, tcp.opening 6 } +set timeout tcp.first 6 +set limit states 500 +set limit {states 1000,frags 1000} +set loginterface lo0 +set loginterface none +set hostid 1 Added: head/sbin/pfctl/tests/files/pf0022.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0022.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,10 @@ +set optimization aggressive +set timeout tcp.closing 6 +set timeout tcp.opening 6 +set timeout tcp.first 6 +set limit states 500 +set limit states 1000 +set limit frags 1000 +set loginterface lo0 +set loginterface none +set hostid 0x00000001 Added: head/sbin/pfctl/tests/files/pf0023.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0023.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,2 @@ +#test negated interface matching +block in on ! lo0 all Added: head/sbin/pfctl/tests/files/pf0023.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0023.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1 @@ +block drop in on ! lo0 all Added: head/sbin/pfctl/tests/files/pf0024.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0024.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,8 @@ +#test variable concat +a="ssh" +b="ftp" +c=$a $b +d=$a $b $a $b +e=$a $b $b "test" $a $b + +pass in proto tcp from any to any port { $c } Added: head/sbin/pfctl/tests/files/pf0024.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0024.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,7 @@ +a = "ssh" +b = "ftp" +c = "ssh ftp" +d = "ssh ftp ssh ftp" +e = "ssh ftp ftp test ssh ftp" +pass in proto tcp from any to any port = ssh flags S/SA keep state +pass in proto tcp from any to any port = ftp flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0025.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0025.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,4 @@ +antispoof for lo0 +antispoof log quick for lo0 inet +antispoof for (lo0) +antispoof log quick for (lo0) inet Added: head/sbin/pfctl/tests/files/pf0025.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0025.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +block drop in on ! lo0 inet6 from ::1 to any +block drop in on ! lo0 inet from 127.0.0.0/8 to any +block drop in log quick on ! lo0 inet from 127.0.0.0/8 to any +block drop in on ! lo0 from (lo0:network) to any +block drop in log quick on ! lo0 inet from (lo0:network) to any Added: head/sbin/pfctl/tests/files/pf0026.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0026.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,2 @@ +block in on lo0 inet from ! (lo0) to any +block out on lo0 inet from any to ! (lo0) Added: head/sbin/pfctl/tests/files/pf0026.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0026.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,2 @@ +block drop in on lo0 inet from ! (lo0) to any +block drop out on lo0 inet from any to ! (lo0) Added: head/sbin/pfctl/tests/files/pf0028.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0028.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,7 @@ +# test logging keywords, and log quick/quick log order +block in log (all) quick on lo0 all +block in quick log on lo0 all +block in quick log (all) on lo0 all +block in log quick on lo0 all +block in log on lo0 all +block in log (all) on lo0 all Added: head/sbin/pfctl/tests/files/pf0028.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0028.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,6 @@ +block drop in log (all) quick on lo0 all +block drop in log quick on lo0 all +block drop in log (all) quick on lo0 all +block drop in log quick on lo0 all +block drop in log on lo0 all +block drop in log (all) on lo0 all Added: head/sbin/pfctl/tests/files/pf0030.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0030.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,7 @@ +#test line continuation + +block \ + in \ + on lo0 \ + from any \ + to any Added: head/sbin/pfctl/tests/files/pf0030.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0030.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1 @@ +block drop in on lo0 all Added: head/sbin/pfctl/tests/files/pf0031.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0031.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,21 @@ +set block-policy drop +block return in on lo0 all +block return in on lo0 inet all +block return in on lo0 inet6 all +block drop in on lo0 all +block drop in on lo0 inet all +block drop in on lo0 inet6 all +block in on lo0 all +block in on lo0 inet all +block in on lo0 inet6 all +#set block-policy return +block return in on lo0 all +block return in on lo0 inet all +block return in on lo0 inet6 all +block drop in on lo0 all +block drop in on lo0 inet all +block drop in on lo0 inet6 all +block in on lo0 all +block in on lo0 inet all +block in on lo0 inet6 all + Added: head/sbin/pfctl/tests/files/pf0031.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0031.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,19 @@ +set block-policy drop +block return in on lo0 all +block return in on lo0 inet all +block return in on lo0 inet6 all +block drop in on lo0 all +block drop in on lo0 inet all +block drop in on lo0 inet6 all +block drop in on lo0 all +block drop in on lo0 inet all +block drop in on lo0 inet6 all +block return in on lo0 all +block return in on lo0 inet all +block return in on lo0 inet6 all +block drop in on lo0 all +block drop in on lo0 inet all +block drop in on lo0 inet6 all +block drop in on lo0 all +block drop in on lo0 inet all +block drop in on lo0 inet6 all Added: head/sbin/pfctl/tests/files/pf0032.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0032.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,7 @@ +pass in from 10/8 to any +pass in from 10.1/8 to any +pass in from 192.168.37.29/25 to any +pass in from 192.168.37.29/24 to any +pass in from 192.168.37.29/16 to any +pass in from 192.168.37.29/8 to any + Added: head/sbin/pfctl/tests/files/pf0032.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0032.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,6 @@ +pass in inet from 10.0.0.0/8 to any flags S/SA keep state +pass in inet from 10.0.0.0/8 to any flags S/SA keep state +pass in inet from 192.168.37.0/25 to any flags S/SA keep state +pass in inet from 192.168.37.0/24 to any flags S/SA keep state +pass in inet from 192.168.0.0/16 to any flags S/SA keep state +pass in inet from 192.0.0.0/8 to any flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0034.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0034.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +#mixed af, probability +pass in from any to { 127.0.0.1, 2000::1 } +pass in probability 0.5 +pass in probability 50% +pass in inet6 proto tcp from ::1 probability 0.8% Added: head/sbin/pfctl/tests/files/pf0034.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0034.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +pass in inet from any to 127.0.0.1 flags S/SA keep state +pass in inet6 from any to 2000::1 flags S/SA keep state +pass in all flags S/SA keep state probability 50% +pass in all flags S/SA keep state probability 50% +pass in inet6 proto tcp from ::1 to any flags S/SA keep state probability 0.8% Added: head/sbin/pfctl/tests/files/pf0035.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0035.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +#test matching on tos + +intf = "lo0" +pass out on $intf inet proto tcp from any to any port 22 tos 0x10 +pass out on $intf inet proto tcp from any to any port 22 tos 0x08 Added: head/sbin/pfctl/tests/files/pf0035.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0035.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,3 @@ +intf = "lo0" +pass out on lo0 inet proto tcp from any to any port = ssh flags S/SA tos 0x10 keep state +pass out on lo0 inet proto tcp from any to any port = ssh flags S/SA tos 0x08 keep state Added: head/sbin/pfctl/tests/files/pf0038.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0038.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,5 @@ +# test + +pass in on tun1000000 proto tcp from any to any user bin +pass in on tun1000000 proto tcp from any to any group bin +pass in on tun1000000 proto tcp from any to any group wheel user root user bin Added: head/sbin/pfctl/tests/files/pf0038.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0038.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,4 @@ +pass in on tun1000000 proto tcp all user = 3 flags S/SA keep state +pass in on tun1000000 proto tcp all group = 7 flags S/SA keep state +pass in on tun1000000 proto tcp all user = 3 group = 0 flags S/SA keep state +pass in on tun1000000 proto tcp all user = 0 group = 0 flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0039.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0039.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,25 @@ +#test random ordered opts + +body1="pass in log quick on lo0 inet proto icmp all " +body2="pass in log quick on lo0 inet proto tcp all " +o_user="user root " +o_user2="user bin " +o_group="group wheel " +o_group2="group nobody " +o_flags="flags S/SA " +o_icmpspec="icmp-type 0 code 0 " +o_tos="tos 0x08 " +o_keep="keep state " +o_fragment="fragment " +o_allowopts="allow-opts " +o_label="label blah" +o_prio="set prio 2" + +$body2 $o_fragment $o_keep $o_label $o_tos +$body2 $o_user $o_prio $o_tos $o_keep $o_group $o_label $o_allowopts \ +$o_user2 $o_group2 +$body1 $o_icmpspec $o_keep $o_label $o_prio +$body2 $o_keep +$body2 $o_label $o_keep $o_prio $o_tos +$body1 $o_icmpspec $o_tos +$body2 $o_flags $o_allowopts Added: head/sbin/pfctl/tests/files/pf0039.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0039.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,24 @@ +body1 = "pass in log quick on lo0 inet proto icmp all " +body2 = "pass in log quick on lo0 inet proto tcp all " +o_user = "user root " +o_user2 = "user bin " +o_group = "group wheel " +o_group2 = "group nobody " +o_flags = "flags S/SA " +o_icmpspec = "icmp-type 0 code 0 " +o_tos = "tos 0x08 " +o_keep = "keep state " +o_fragment = "fragment " +o_allowopts = "allow-opts " +o_label = "label blah" +o_prio = "set prio 2" +pass in log quick on lo0 inet proto tcp all tos 0x08 keep state fragment label "blah" +pass in log quick on lo0 inet proto tcp all user = 3 group = 65534 flags S/SA tos 0x08 set ( prio 2 ) keep state allow-opts label "blah" +pass in log quick on lo0 inet proto tcp all user = 3 group = 0 flags S/SA tos 0x08 set ( prio 2 ) keep state allow-opts label "blah" +pass in log quick on lo0 inet proto tcp all user = 0 group = 65534 flags S/SA tos 0x08 set ( prio 2 ) keep state allow-opts label "blah" +pass in log quick on lo0 inet proto tcp all user = 0 group = 0 flags S/SA tos 0x08 set ( prio 2 ) keep state allow-opts label "blah" +pass in log quick on lo0 inet proto icmp all icmp-type echorep code 0 set ( prio 2 ) keep state label "blah" +pass in log quick on lo0 inet proto tcp all flags S/SA keep state +pass in log quick on lo0 inet proto tcp all flags S/SA tos 0x08 set ( prio 2 ) keep state label "blah" +pass in log quick on lo0 inet proto icmp all icmp-type echorep code 0 tos 0x08 keep state +pass in log quick on lo0 inet proto tcp all flags S/SA keep state allow-opts Added: head/sbin/pfctl/tests/files/pf0040.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0040.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,20 @@ +block +block return +block return-rst proto tcp +pass +pass in no state +pass out no state +pass all no state +block in all +block out all +block from any to any +pass in from any to any +pass out from any to any +block on lo0 +pass on lo0 all +block on lo0 from any to any +pass proto tcp flags S/SA +pass proto udp keep state +pass in proto udp all keep state +pass out proto udp from any to any keep state +pass out on lo0 proto tcp from any to any port 25 keep state Added: head/sbin/pfctl/tests/files/pf0040.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0040.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,20 @@ +block drop all +block return all +block return-rst proto tcp all +pass all flags S/SA keep state +pass in all no state +pass out all no state +pass all no state +block drop in all +block drop out all +block drop all +pass in all flags S/SA keep state +pass out all flags S/SA keep state +block drop on lo0 all +pass on lo0 all flags S/SA keep state +block drop on lo0 all +pass proto tcp all flags S/SA keep state +pass proto udp all keep state +pass in proto udp all keep state +pass out proto udp all keep state +pass out on lo0 proto tcp from any to any port = smtp flags S/SA keep state Added: head/sbin/pfctl/tests/files/pf0041.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0041.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,12 @@ +anchor foo +anchor bar all +anchor bar from any to any +anchor foo inet +anchor foo inet6 +anchor foo inet all +anchor foo proto tcp +anchor foo inet proto tcp from 10.1.2.3 port smtp to 10.2.3.4 port ssh +anchor foobar inet6 proto udp from ::1 port 1 to ::1 port 2 +anchor filteropt out proto tcp to any port 22 user root +anchor filteropt in proto tcp to (self) port 22 group sshd +anchor filteropt out inet proto icmp all icmp-type echoreq Added: head/sbin/pfctl/tests/files/pf0041.ok ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0041.ok Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,12 @@ +anchor "foo" all +anchor "bar" all +anchor "bar" all +anchor "foo" inet all +anchor "foo" inet6 all +anchor "foo" inet all +anchor "foo" proto tcp all +anchor "foo" inet proto tcp from 10.1.2.3 port = smtp to 10.2.3.4 port = ssh +anchor "foobar" inet6 proto udp from ::1 port = tcpmux to ::1 port = compressnet +anchor "filteropt" out proto tcp from any to any port = ssh user = 0 +anchor "filteropt" in proto tcp from any to (self) port = ssh group = 22 +anchor "filteropt" out inet proto icmp all icmp-type echoreq Added: head/sbin/pfctl/tests/files/pf0047.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/files/pf0047.in Sat Jul 15 19:22:01 2017 (r321030) @@ -0,0 +1,67 @@ +pass in on lo0 all label "" + +pass in all label "$if" +pass in on lo0 all label "$if" +pass in on lo0 all label "$if$if" + +pass in on lo0 all label "$srcaddr" +pass in on lo0 from 0/0 to any label "$srcaddr" +pass in on lo0 from 127.0.0.1 to any label "$srcaddr" +pass in on lo0 from 127.0.0.1 to any label "$srcaddr$srcaddr" +pass in on lo0 from 127.0.0.1 to any label ":$srcaddr:$srcaddr:" +pass in on lo0 from 127.0.0.1/8 to any label "$srcaddr" +pass in on lo0 from 127.0.0.1/16 to any label "$srcaddr$srcaddr" +pass in on lo0 from 127.0.0.1/31 to any label ":$srcaddr:$srcaddr:" +pass in on lo0 inet6 from fe80::1 to any label "$srcaddr" +pass in on lo0 inet6 from fe80::1 to any label "$srcaddr$srcaddr" +pass in on lo0 inet6 from fe80::1 to any label ":$srcaddr:$srcaddr:" +pass in on lo0 inet6 from lo0/8 to any label "$srcaddr" +pass in on lo0 inet6 from lo0/64 to any label "$srcaddr$srcaddr" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Jul 15 19:54:04 2017 Return-Path: Delivered-To: svn-src-head@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 BDFB6B7AE35; Sat, 15 Jul 2017 19:54:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7FEFE82E70; Sat, 15 Jul 2017 19:54:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FJs3ct030822; Sat, 15 Jul 2017 19:54:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FJs36p030820; Sat, 15 Jul 2017 19:54:03 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201707151954.v6FJs36p030820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 15 Jul 2017 19:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321034 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 321034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 19:54:04 -0000 Author: tuexen Date: Sat Jul 15 19:54:03 2017 New Revision: 321034 URL: https://svnweb.freebsd.org/changeset/base/321034 Log: Fix the handling of Explicit EOR mode. While there, appropriately handle the overhead depending on the usage of DATA or I-DATA chunks. Take the overhead only into account, when required. Joint work with rrs@ MFC after: 1 week Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Jul 15 19:52:59 2017 (r321033) +++ head/sys/netinet/sctp_output.c Sat Jul 15 19:54:03 2017 (r321034) @@ -6250,11 +6250,7 @@ sctp_get_frag_point(struct sctp_tcb *stcb, } else { ovh = SCTP_MIN_V4_OVERHEAD; } - if (stcb->asoc.idata_supported) { - ovh += sizeof(struct sctp_idata_chunk); - } else { - ovh += sizeof(struct sctp_data_chunk); - } + ovh += SCTP_DATA_CHUNK_OVERHEAD(stcb); if (stcb->asoc.sctp_frag_point > asoc->smallest_mtu) siz = asoc->smallest_mtu - ovh; else @@ -6759,7 +6755,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct s } } un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + (stcb->asoc.stream_queue_cnt * SCTP_DATA_CHUNK_OVERHEAD(stcb))); if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && @@ -7459,11 +7455,7 @@ dont_do_it: } else { atomic_subtract_int(&sp->length, to_move); } - if (stcb->asoc.idata_supported == 0) { - leading = sizeof(struct sctp_data_chunk); - } else { - leading = sizeof(struct sctp_idata_chunk); - } + leading = SCTP_DATA_CHUNK_OVERHEAD(stcb); if (M_LEADINGSPACE(chk->data) < leading) { /* Not enough room for a chunk header, get some */ struct mbuf *m; @@ -7505,11 +7497,7 @@ dont_do_it: M_ALIGN(chk->data, 4); } } - if (stcb->asoc.idata_supported == 0) { - SCTP_BUF_PREPEND(chk->data, sizeof(struct sctp_data_chunk), M_NOWAIT); - } else { - SCTP_BUF_PREPEND(chk->data, sizeof(struct sctp_idata_chunk), M_NOWAIT); - } + SCTP_BUF_PREPEND(chk->data, SCTP_DATA_CHUNK_OVERHEAD(stcb), M_NOWAIT); if (chk->data == NULL) { /* HELP, TSNH since we assured it would not above? */ #ifdef INVARIANTS @@ -7522,13 +7510,8 @@ dont_do_it: to_move = 0; goto out_of; } - if (stcb->asoc.idata_supported == 0) { - sctp_snd_sb_alloc(stcb, sizeof(struct sctp_data_chunk)); - chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_data_chunk)); - } else { - sctp_snd_sb_alloc(stcb, sizeof(struct sctp_idata_chunk)); - chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_idata_chunk)); - } + sctp_snd_sb_alloc(stcb, SCTP_DATA_CHUNK_OVERHEAD(stcb)); + chk->book_size = chk->send_size = (uint16_t)(to_move + SCTP_DATA_CHUNK_OVERHEAD(stcb)); chk->book_size_scale = 0; chk->sent = SCTP_DATAGRAM_UNSENT; @@ -7728,11 +7711,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb, break; } /* Need an allowance for the data chunk header too */ - if (stcb->asoc.idata_supported == 0) { - space_left -= sizeof(struct sctp_data_chunk); - } else { - space_left -= sizeof(struct sctp_idata_chunk); - } + space_left -= SCTP_DATA_CHUNK_OVERHEAD(stcb); /* must make even word boundary */ space_left &= 0xfffffffc; @@ -7749,18 +7728,10 @@ sctp_fill_outqueue(struct sctp_tcb *stcb, strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); total_moved += moved; space_left -= moved; - if (stcb->asoc.idata_supported == 0) { - if (space_left >= sizeof(struct sctp_data_chunk)) { - space_left -= sizeof(struct sctp_data_chunk); - } else { - space_left = 0; - } + if (space_left >= SCTP_DATA_CHUNK_OVERHEAD(stcb)) { + space_left -= SCTP_DATA_CHUNK_OVERHEAD(stcb); } else { - if (space_left >= sizeof(struct sctp_idata_chunk)) { - space_left -= sizeof(struct sctp_idata_chunk); - } else { - space_left = 0; - } + space_left = 0; } space_left &= 0xfffffffc; } @@ -10209,8 +10180,7 @@ do_it_again: * and we have data in flight we stop, except if we * are handling a fragmented user message. */ - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + un_sent = stcb->asoc.total_output_queue_size - stcb->asoc.total_flight; if ((un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD)) && (stcb->asoc.total_flight > 0)) { /* && sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) {*/ @@ -12448,7 +12418,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb, sp->sender_all_done = 0; sp->some_taken = 0; sp->put_last_out = 0; - resv_in_first = sizeof(struct sctp_data_chunk); + resv_in_first = SCTP_DATA_CHUNK_OVERHEAD(stcb); sp->data = sp->tail_mbuf = NULL; if (sp->length == 0) { *error = 0; @@ -12865,12 +12835,19 @@ sctp_lower_sosend(struct socket *so, } /* would we block? */ if (non_blocking) { + uint32_t amount; + if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); hold_tcblock = 1; } - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); - if ((SCTP_SB_LIMIT_SND(so) < (sndlen + inqueue_bytes + stcb->asoc.sb_send_resv)) || + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (user_marks_eor == 0) { + amount = sndlen; + } else { + amount = 1; + } + if ((SCTP_SB_LIMIT_SND(so) < (amount + inqueue_bytes + stcb->asoc.sb_send_resv)) || (stcb->asoc.chunks_on_out_queue >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EWOULDBLOCK); if (sndlen > SCTP_SB_LIMIT_SND(so)) @@ -13036,7 +13013,7 @@ sctp_lower_sosend(struct socket *so, goto out_unlocked; } /* Calculate the maximum we can send */ - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { if (non_blocking) { /* we already checked for non-blocking above. */ @@ -13093,7 +13070,7 @@ sctp_lower_sosend(struct socket *so, ((stcb->asoc.chunks_on_out_queue + stcb->asoc.stream_queue_cnt) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { /* No room right now ! */ SOCKBUF_LOCK(&so->so_snd); - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); while ((SCTP_SB_LIMIT_SND(so) < (inqueue_bytes + local_add_more)) || ((stcb->asoc.stream_queue_cnt + stcb->asoc.chunks_on_out_queue) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { SCTPDBG(SCTP_DEBUG_OUTPUT1, "pre_block limit:%u <(inq:%d + %d) || (%d+%d > %d)\n", @@ -13129,7 +13106,7 @@ sctp_lower_sosend(struct socket *so, SOCKBUF_UNLOCK(&so->so_snd); goto out_unlocked; } - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); } if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; @@ -13222,8 +13199,9 @@ skip_preblock: /* How much room do we have? */ struct mbuf *new_tail, *mm; - if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) - max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size; + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) + max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; else max_len = 0; @@ -13299,8 +13277,8 @@ skip_preblock: hold_tcblock = 1; } sctp_prune_prsctp(stcb, asoc, srcv, sndlen); - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); - if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; else max_len = 0; @@ -13341,8 +13319,7 @@ skip_preblock: } asoc->ifp_had_enobuf = 0; } - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + un_sent = stcb->asoc.total_output_queue_size - stcb->asoc.total_flight; if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && @@ -13416,7 +13393,8 @@ skip_preblock: * size we KNOW we will get to sleep safely with the * wakeup flag in place. */ - if (SCTP_SB_LIMIT_SND(so) <= (stcb->asoc.total_output_queue_size + + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (SCTP_SB_LIMIT_SND(so) <= (inqueue_bytes + min(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTP_SB_LIMIT_SND(so)))) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK, @@ -13613,8 +13591,7 @@ skip_out_eof: } asoc->ifp_had_enobuf = 0; } - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + un_sent = stcb->asoc.total_output_queue_size - stcb->asoc.total_flight; if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Sat Jul 15 19:52:59 2017 (r321033) +++ head/sys/netinet/sctp_output.h Sat Jul 15 19:54:03 2017 (r321034) @@ -135,6 +135,11 @@ void sctp_fix_ecn_echo(struct sctp_association *); void sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net); + +#define SCTP_DATA_CHUNK_OVERHEAD(stcb) ((stcb)->asoc.idata_supported ? \ + sizeof(struct sctp_idata_chunk) : \ + sizeof(struct sctp_data_chunk)) + int sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct thread *, int); From owner-svn-src-head@freebsd.org Sat Jul 15 20:53:09 2017 Return-Path: Delivered-To: svn-src-head@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 60409B7BD1C; Sat, 15 Jul 2017 20:53:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2F9C58475C; Sat, 15 Jul 2017 20:53:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FKr8I4055466; Sat, 15 Jul 2017 20:53:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FKr8CJ055464; Sat, 15 Jul 2017 20:53:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707152053.v6FKr8CJ055464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 15 Jul 2017 20:53:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321035 - in head: sbin/savecore sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: sbin/savecore sys/kern X-SVN-Commit-Revision: 321035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 20:53:09 -0000 Author: markj Date: Sat Jul 15 20:53:08 2017 New Revision: 321035 URL: https://svnweb.freebsd.org/changeset/base/321035 Log: Revert r320918 and have mkdumpheader() handle version string truncation. Reported by: jhb MFC after: 1 week Modified: head/sbin/savecore/savecore.c head/sys/kern/kern_shutdown.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Sat Jul 15 19:54:03 2017 (r321034) +++ head/sbin/savecore/savecore.c Sat Jul 15 20:53:08 2017 (r321035) @@ -119,7 +119,7 @@ printheader(xo_handle_t *xo, const struct kerneldumphe xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t)); xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname); xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic); - xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}\n", h->versionstring); + xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", h->versionstring); xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring); xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity); xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds); Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sat Jul 15 19:54:03 2017 (r321034) +++ head/sys/kern/kern_shutdown.c Sat Jul 15 20:53:08 2017 (r321035) @@ -1229,6 +1229,7 @@ void mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, uint64_t dumplen, uint32_t dumpkeysize, uint32_t blksz) { + size_t dstsize; bzero(kdh, sizeof(*kdh)); strlcpy(kdh->magic, magic, sizeof(kdh->magic)); @@ -1240,7 +1241,9 @@ mkdumpheader(struct kerneldumpheader *kdh, char *magic kdh->dumpkeysize = htod32(dumpkeysize); kdh->blocksize = htod32(blksz); strlcpy(kdh->hostname, prison0.pr_hostname, sizeof(kdh->hostname)); - strlcpy(kdh->versionstring, version, sizeof(kdh->versionstring)); + dstsize = sizeof(kdh->versionstring); + if (strlcpy(kdh->versionstring, version, dstsize) >= dstsize) + kdh->versionstring[dstsize - 2] = '\n'; if (panicstr != NULL) strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); kdh->parity = kerneldump_parity(kdh); From owner-svn-src-head@freebsd.org Sat Jul 15 21:19:30 2017 Return-Path: Delivered-To: svn-src-head@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 D6110B7C0ED; Sat, 15 Jul 2017 21:19:30 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6A56284F48; Sat, 15 Jul 2017 21:19:30 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FLJTw5064278; Sat, 15 Jul 2017 21:19:29 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FLJSNX064263; Sat, 15 Jul 2017 21:19:28 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201707152119.v6FLJSNX064263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sat, 15 Jul 2017 21:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321036 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Commit-Revision: 321036 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 21:19:31 -0000 Author: sjg Date: Sat Jul 15 21:19:27 2017 New Revision: 321036 URL: https://svnweb.freebsd.org/changeset/base/321036 Log: Import bmake-20170711 Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 head/contrib/bmake/buf.h head/contrib/bmake/dir.h head/contrib/bmake/hash.h head/contrib/bmake/main.c head/contrib/bmake/make.1 head/contrib/bmake/meta.c head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/dirdeps.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/lib.mk head/contrib/bmake/mk/meta.stage.mk head/contrib/bmake/mk/meta.sys.mk head/contrib/bmake/mk/meta2deps.py head/contrib/bmake/mk/own.mk head/contrib/bmake/sprite.h head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/ChangeLog Sat Jul 15 21:19:27 2017 (r321036) @@ -1,3 +1,16 @@ +2017-07-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170711 + forgot to update after merge on 20170708 ;-) + o main.c: refactor to reduce size of main function. + add -v option to always fully expand values. + o meta.c: ensure command output in meta file has ending newline + even when filemon not being used. + When matching ${.MAKE.META.IGNORE_PATTERNS} do not use + pathname via ':L' since any ':' in pathname breaks that. + Instead set a '${.p.}' to pathname in the target context and + use that. + 2017-05-10 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20170510 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/Makefile Sat Jul 15 21:19:27 2017 (r321036) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.92 2017/05/10 22:29:04 sjg Exp $ +# $Id: Makefile,v 1.94 2017/07/15 18:22:14 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20170510 +_MAKE_VERSION= 20170711 PROG= bmake Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/bmake.1 Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $ +.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34:20 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd February 1, 2017 +.Dd June 22, 2017 .Dt BMAKE 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl m Ar directory .Op Fl T Ar file .Op Fl V Ar variable +.Op Fl v Ar variable .Op Ar variable=value .Op Ar target ... .Sh DESCRIPTION @@ -206,7 +207,9 @@ Print debugging information about target list maintena .It Ar V Force the .Fl V -option to print raw values of variables. +option to print raw values of variables, overriding the default behavior +set via +.Va .MAKE.EXPAND_VARIABLES . .It Ar v Print debugging information about variable assignment. .It Ar x @@ -334,20 +337,39 @@ for each job started and completed. Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up-to-date. .It Fl V Ar variable -Print -.Nm Ns 's -idea of the value of -.Ar variable , -in the global context. +Print the value of +.Ar variable . Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or undefined variable. +The value printed is extracted from the global context after all +makefiles have been read. +By default, the raw variable contents (which may +include additional unexpanded variable references) are shown. If .Ar variable contains a .Ql \&$ -then the value will be expanded before printing. +then the value will be recursively expanded to its complete resultant +text before printing. +The expanded value will also be printed if +.Va .MAKE.EXPAND_VARIABLES +is set to true and +the +.Fl dV +option has not been used to override it. +Note that loop-local and target-local variables, as well as values +taken temporarily by global variables during makefile processing, are +not accessible via this option. +The +.Fl dv +debug mode can be used to see these at the cost of generating +substantial extraneous output. +.It Fl v Ar variable +Like +.Fl V +but the variable is always expanded to its complete value. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -657,7 +679,7 @@ The seven local variables are as follows: .Bl -tag -width ".ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as -.Ql Va \&\*[Gt] . +.Ql Va \&> . .It Va .ARCHIVE The name of the archive file; also known as .Ql Va \&! . @@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the s target is to be transformed (the .Dq implied source); also known as -.Ql Va \&\*[Lt] . +.Ql Va \&< . It is not defined in explicit rules. .It Va .MEMBER The name of the archive member; also known as @@ -691,9 +713,9 @@ in archive member rules. .El .Pp The shorter forms -.Ql ( Va \*[Gt] , +.Ql ( Va > , .Ql Va \&! , -.Ql Va \*[Lt] , +.Ql Va < , .Ql Va % , .Ql Va \&? , .Ql Va * , @@ -776,6 +798,10 @@ from which generated dependencies are read. A boolean that controls the default behavior of the .Fl V option. +If true, variable values printed with +.Fl V +are fully expanded; if false, the raw variable contents (which may +include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . @@ -1287,7 +1313,7 @@ it is anchored at the end of each word. Inside .Ar new_string , an ampersand -.Pq Ql \*[Am] +.Pq Ql & is replaced by .Ar old_string (without any @@ -1751,7 +1777,7 @@ may be any one of the following: .Bl -tag -width "Cm XX" .It Cm \&|\&| Logical OR. -.It Cm \&\*[Am]\*[Am] +.It Cm \&&& Logical .Tn AND ; of higher precedence than @@ -1768,7 +1794,7 @@ The boolean operator may be used to logically negate an entire conditional. It is of higher precedence than -.Ql Ic \&\*[Am]\*[Am] . +.Ql Ic \&&& . .Pp The value of .Ar expression Modified: head/contrib/bmake/bmake.cat1 ============================================================================== --- head/contrib/bmake/bmake.cat1 Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/bmake.cat1 Sat Jul 15 21:19:27 2017 (r321036) @@ -6,8 +6,8 @@ NNAAMMEE SSYYNNOOPPSSIISS bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s] [--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s] - [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] - [_t_a_r_g_e_t _._._.] + [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [--vv _v_a_r_i_a_b_l_e] + [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.] DDEESSCCRRIIPPTTIIOONN bbmmaakkee is a program designed to simplify the maintenance of other pro- @@ -118,7 +118,9 @@ DDEESSCCRRIIPPTTIIOONN _t Print debugging information about target list mainte- nance. - _V Force the --VV option to print raw values of variables. + _V Force the --VV option to print raw values of variables, + overriding the default behavior set via + _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S. _v Print debugging information about variable assignment. @@ -209,13 +211,26 @@ DDEESSCCRRIIPPTTIIOONN to-date. --VV _v_a_r_i_a_b_l_e - Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con- - text. Do not build any targets. Multiple instances of this - option may be specified; the variables will be printed one per - line, with a blank line for each null or undefined variable. If - _v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before - printing. + Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple + instances of this option may be specified; the variables will be + printed one per line, with a blank line for each null or unde- + fined variable. The value printed is extracted from the global + context after all makefiles have been read. By default, the raw + variable contents (which may include additional unexpanded vari- + able references) are shown. If _v_a_r_i_a_b_l_e contains a `$' then the + value will be recursively expanded to its complete resultant text + before printing. The expanded value will also be printed if + _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S is set to true and the --ddVV option has not + been used to override it. Note that loop-local and target-local + variables, as well as values taken temporarily by global vari- + ables during makefile processing, are not accessible via this + option. The --ddvv debug mode can be used to see these at the cost + of generating substantial extraneous output. + --vv _v_a_r_i_a_b_l_e + Like --VV but the variable is always expanded to its complete + value. + --WW Treat any warnings during makefile parsing as errors. --ww Print entering and leaving directory messages, pre and post pro- @@ -488,7 +503,10 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S A boolean that controls the default behavior of the --VV - option. + option. If true, variable values printed with --VV are + fully expanded; if false, the raw variable contents + (which may include additional unexpanded variable refer- + ences) are shown. _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. @@ -1523,4 +1541,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 7.1_RC1 February 1, 2017 NetBSD 7.1_RC1 +NetBSD 7.1_RC1 June 22, 2017 NetBSD 7.1_RC1 Modified: head/contrib/bmake/buf.h ============================================================================== --- head/contrib/bmake/buf.h Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/buf.h Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.17 2012/04/24 20:26:58 sjg Exp $ */ +/* $NetBSD: buf.h,v 1.19 2017/05/31 22:02:06 maya Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -77,8 +77,8 @@ * Header for users of the buf library. */ -#ifndef _BUF_H -#define _BUF_H +#ifndef MAKE_BUF_H +#define MAKE_BUF_H typedef char Byte; @@ -116,4 +116,4 @@ void Buf_Init(Buffer *, int); Byte *Buf_Destroy(Buffer *, Boolean); Byte *Buf_DestroyCompact(Buffer *); -#endif /* _BUF_H */ +#endif /* MAKE_BUF_H */ Modified: head/contrib/bmake/dir.h ============================================================================== --- head/contrib/bmake/dir.h Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/dir.h Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.15 2012/04/07 18:29:08 christos Exp $ */ +/* $NetBSD: dir.h,v 1.18 2017/05/31 22:02:06 maya Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -75,8 +75,8 @@ /* dir.h -- */ -#ifndef _DIR -#define _DIR +#ifndef MAKE_DIR_H +#define MAKE_DIR_H typedef struct Path { char *name; /* Name of directory */ @@ -105,4 +105,4 @@ void Dir_PrintPath(Lst); void Dir_Destroy(void *); void * Dir_CopyDir(void *); -#endif /* _DIR */ +#endif /* MAKE_DIR_H */ Modified: head/contrib/bmake/hash.h ============================================================================== --- head/contrib/bmake/hash.h Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/hash.h Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.11 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: hash.h,v 1.12 2017/05/31 21:07:03 maya Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -78,8 +78,8 @@ * which maintains hash tables. */ -#ifndef _HASH -#define _HASH +#ifndef _HASH_H +#define _HASH_H /* * The following defines one entry in the hash table. @@ -146,4 +146,4 @@ void Hash_DeleteEntry(Hash_Table *, Hash_Entry *); Hash_Entry *Hash_EnumFirst(Hash_Table *, Hash_Search *); Hash_Entry *Hash_EnumNext(Hash_Search *); -#endif /* _HASH */ +#endif /* _HASH_H */ Modified: head/contrib/bmake/main.c ============================================================================== --- head/contrib/bmake/main.c Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/main.c Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $ */ +/* $NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $"); #endif #endif /* not lint */ #endif @@ -159,7 +159,9 @@ Boolean deleteOnError; /* .DELETE_ON_ERROR: set */ static Boolean noBuiltins; /* -r flag */ static Lst makefiles; /* ordered list of makefiles to read */ -static Boolean printVars; /* print value of one or more vars */ +static int printVars; /* -[vV] argument */ +#define COMPAT_VARS 1 +#define EXPAND_VARS 2 static Lst variables; /* list of variables to print */ int maxJobs; /* -j argument */ static int maxJobTokens; /* -j argument */ @@ -421,7 +423,7 @@ MainParseArgs(int argc, char **argv) Boolean inOption, dashDash = FALSE; char found_path[MAXPATHLEN + 1]; /* for searching for sys.mk */ -#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstw" +#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstv:w" /* Can't actually use getopt(3) because rescanning is not portable */ getopt_def = OPTFLAGS; @@ -546,8 +548,9 @@ rearg: Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); break; case 'V': + case 'v': if (argvalue == NULL) goto noarg; - printVars = TRUE; + printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS; (void)Lst_AtEnd(variables, argvalue); Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL); Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); @@ -877,6 +880,89 @@ MakeMode(const char *mode) free(mp); } +static void +doPrintVars(void) +{ + LstNode ln; + Boolean expandVars; + + if (printVars == EXPAND_VARS) + expandVars = TRUE; + else if (debugVflag) + expandVars = FALSE; + else + expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); + + for (ln = Lst_First(variables); ln != NULL; + ln = Lst_Succ(ln)) { + char *var = (char *)Lst_Datum(ln); + char *value; + char *p1; + + if (strchr(var, '$')) { + value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, + VARF_WANTRES); + } else if (expandVars) { + char tmp[128]; + int len = snprintf(tmp, sizeof(tmp), "${%s}", var); + + if (len >= (int)sizeof(tmp)) + Fatal("%s: variable name too big: %s", + progname, var); + value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL, + VARF_WANTRES); + } else { + value = Var_Value(var, VAR_GLOBAL, &p1); + } + printf("%s\n", value ? value : ""); + free(p1); + } +} + +static Boolean +runTargets(void) +{ + Lst targs; /* target nodes to create -- passed to Make_Init */ + Boolean outOfDate; /* FALSE if all targets up to date */ + + /* + * Have now read the entire graph and need to make a list of + * targets to create. If none was given on the command line, + * we consult the parsing module to find the main target(s) + * to create. + */ + if (Lst_IsEmpty(create)) + targs = Parse_MainName(); + else + targs = Targ_FindList(create, TARG_CREATE); + + if (!compatMake) { + /* + * Initialize job module before traversing the graph + * now that any .BEGIN and .END targets have been read. + * This is done only if the -q flag wasn't given + * (to prevent the .BEGIN from being executed should + * it exist). + */ + if (!queryFlag) { + Job_Init(); + jobsRunning = TRUE; + } + + /* Traverse the graph, checking on all the targets */ + outOfDate = Make_Run(targs); + } else { + /* + * Compat_Init will take care of creating all the + * targets as well as initializing the module. + */ + Compat_Run(targs); + outOfDate = FALSE; + } + Lst_Destroy(targs, NULL); + return outOfDate; +} + /*- * main -- * The main function, for obvious reasons. Initializes variables @@ -897,8 +983,7 @@ MakeMode(const char *mode) int main(int argc, char **argv) { - Lst targs; /* target nodes to create -- passed to Make_Init */ - Boolean outOfDate = FALSE; /* FALSE if all targets up to date */ + Boolean outOfDate; /* FALSE if all targets up to date */ struct stat sb, sa; char *p1, *path; char mdpath[MAXPATHLEN]; @@ -1027,7 +1112,7 @@ main(int argc, char **argv) create = Lst_Init(FALSE); makefiles = Lst_Init(FALSE); - printVars = FALSE; + printVars = 0; debugVflag = FALSE; variables = Lst_Init(FALSE); beSilent = FALSE; /* Print commands as executed */ @@ -1406,73 +1491,13 @@ main(int argc, char **argv) /* print the values of any variables requested by the user */ if (printVars) { - LstNode ln; - Boolean expandVars; - - if (debugVflag) - expandVars = FALSE; - else - expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE); - for (ln = Lst_First(variables); ln != NULL; - ln = Lst_Succ(ln)) { - char *var = (char *)Lst_Datum(ln); - char *value; - - if (strchr(var, '$')) { - value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, - VARF_WANTRES); - } else if (expandVars) { - char tmp[128]; - - if (snprintf(tmp, sizeof(tmp), "${%s}", var) >= (int)(sizeof(tmp))) - Fatal("%s: variable name too big: %s", - progname, var); - value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL, - VARF_WANTRES); - } else { - value = Var_Value(var, VAR_GLOBAL, &p1); - } - printf("%s\n", value ? value : ""); - free(p1); - } + doPrintVars(); + outOfDate = FALSE; } else { - /* - * Have now read the entire graph and need to make a list of - * targets to create. If none was given on the command line, - * we consult the parsing module to find the main target(s) - * to create. - */ - if (Lst_IsEmpty(create)) - targs = Parse_MainName(); - else - targs = Targ_FindList(create, TARG_CREATE); - - if (!compatMake) { - /* - * Initialize job module before traversing the graph - * now that any .BEGIN and .END targets have been read. - * This is done only if the -q flag wasn't given - * (to prevent the .BEGIN from being executed should - * it exist). - */ - if (!queryFlag) { - Job_Init(); - jobsRunning = TRUE; - } - - /* Traverse the graph, checking on all the targets */ - outOfDate = Make_Run(targs); - } else { - /* - * Compat_Init will take care of creating all the - * targets as well as initializing the module. - */ - Compat_Run(targs); - } + outOfDate = runTargets(); } #ifdef CLEANUP - Lst_Destroy(targs, NULL); Lst_Destroy(variables, NULL); Lst_Destroy(makefiles, NULL); Lst_Destroy(create, (FreeProc *)free); @@ -1931,7 +1956,8 @@ usage(void) "usage: %s [-BeikNnqrstWwX] \n\ [-C directory] [-D variable] [-d flags] [-f makefile]\n\ [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n\ - [-V variable] [variable=value] [target ...]\n", progname); + [-V variable] [-v variable] [variable=value] [target ...]\n", + progname); exit(2); } Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/make.1 Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $ +.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34:20 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd February 1, 2017 +.Dd June 22, 2017 .Dt MAKE 1 .Os .Sh NAME @@ -48,6 +48,7 @@ .Op Fl m Ar directory .Op Fl T Ar file .Op Fl V Ar variable +.Op Fl v Ar variable .Op Ar variable=value .Op Ar target ... .Sh DESCRIPTION @@ -206,7 +207,9 @@ Print debugging information about target list maintena .It Ar V Force the .Fl V -option to print raw values of variables. +option to print raw values of variables, overriding the default behavior +set via +.Va .MAKE.EXPAND_VARIABLES . .It Ar v Print debugging information about variable assignment. .It Ar x @@ -334,20 +337,39 @@ for each job started and completed. Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up-to-date. .It Fl V Ar variable -Print -.Nm Ns 's -idea of the value of -.Ar variable , -in the global context. +Print the value of +.Ar variable . Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or undefined variable. +The value printed is extracted from the global context after all +makefiles have been read. +By default, the raw variable contents (which may +include additional unexpanded variable references) are shown. If .Ar variable contains a .Ql \&$ -then the value will be expanded before printing. +then the value will be recursively expanded to its complete resultant +text before printing. +The expanded value will also be printed if +.Va .MAKE.EXPAND_VARIABLES +is set to true and +the +.Fl dV +option has not been used to override it. +Note that loop-local and target-local variables, as well as values +taken temporarily by global variables during makefile processing, are +not accessible via this option. +The +.Fl dv +debug mode can be used to see these at the cost of generating +substantial extraneous output. +.It Fl v Ar variable +Like +.Fl V +but the variable is always expanded to its complete value. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -657,7 +679,7 @@ The seven local variables are as follows: .Bl -tag -width ".ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as -.Ql Va \&\*[Gt] . +.Ql Va \&> . .It Va .ARCHIVE The name of the archive file; also known as .Ql Va \&! . @@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the s target is to be transformed (the .Dq implied source); also known as -.Ql Va \&\*[Lt] . +.Ql Va \&< . It is not defined in explicit rules. .It Va .MEMBER The name of the archive member; also known as @@ -691,9 +713,9 @@ in archive member rules. .El .Pp The shorter forms -.Ql ( Va \*[Gt] , +.Ql ( Va > , .Ql Va \&! , -.Ql Va \*[Lt] , +.Ql Va < , .Ql Va % , .Ql Va \&? , .Ql Va * , @@ -787,6 +809,10 @@ from which generated dependencies are read. A boolean that controls the default behavior of the .Fl V option. +If true, variable values printed with +.Fl V +are fully expanded; if false, the raw variable contents (which may +include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . @@ -1298,7 +1324,7 @@ it is anchored at the end of each word. Inside .Ar new_string , an ampersand -.Pq Ql \*[Am] +.Pq Ql & is replaced by .Ar old_string (without any @@ -1762,7 +1788,7 @@ may be any one of the following: .Bl -tag -width "Cm XX" .It Cm \&|\&| Logical OR. -.It Cm \&\*[Am]\*[Am] +.It Cm \&&& Logical .Tn AND ; of higher precedence than @@ -1779,7 +1805,7 @@ The boolean operator may be used to logically negate an entire conditional. It is of higher precedence than -.Ql Ic \&\*[Am]\*[Am] . +.Ql Ic \&&& . .Pp The value of .Ar expression Modified: head/contrib/bmake/meta.c ============================================================================== --- head/contrib/bmake/meta.c Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/meta.c Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.67 2016/08/17 15:52:42 sjg Exp $ */ +/* $NetBSD: meta.c,v 1.68 2017/07/09 04:54:00 sjg Exp $ */ /* * Implement 'meta' mode. @@ -727,7 +727,7 @@ meta_job_error(Job *job, GNode *gn, int flags, int sta pbm = &Mybm; } if (pbm->mfp != NULL) { - fprintf(pbm->mfp, "*** Error code %d%s\n", + fprintf(pbm->mfp, "\n*** Error code %d%s\n", status, (flags & JOB_IGNERR) ? "(ignored)" : ""); @@ -782,13 +782,13 @@ int meta_cmd_finish(void *pbmp) { int error = 0; -#ifdef USE_FILEMON BuildMon *pbm = pbmp; int x; if (!pbm) pbm = &Mybm; +#ifdef USE_FILEMON if (pbm->filemon_fd >= 0) { if (close(pbm->filemon_fd) < 0) error = errno; @@ -796,8 +796,9 @@ meta_cmd_finish(void *pbmp) if (error == 0 && x != 0) error = x; pbm->filemon_fd = pbm->mon_fd = -1; - } + } else #endif + fprintf(pbm->mfp, "\n"); /* ensure end with newline */ return error; } @@ -861,6 +862,8 @@ fgetLine(char **bufp, size_t *szp, int o, FILE *fp) newsz = ROUNDUP((fs.st_size / 2), BUFSIZ); if (newsz <= bufsz) newsz = ROUNDUP(fs.st_size, BUFSIZ); + if (newsz <= bufsz) + return x; /* truncated */ if (DEBUG(META)) fprintf(debug_file, "growing buffer %u -> %u\n", (unsigned)bufsz, (unsigned)newsz); @@ -948,10 +951,10 @@ meta_ignore(GNode *gn, const char *p) if (metaIgnorePatterns) { char *pm; - snprintf(fname, sizeof(fname), - "${%s:@m@${%s:L:M$m}@}", - MAKE_META_IGNORE_PATTERNS, p); - pm = Var_Subst(NULL, fname, gn, VARF_WANTRES); + Var_Set(".p.", p, gn, 0); + pm = Var_Subst(NULL, + "${" MAKE_META_IGNORE_PATTERNS ":@m@${.p.:M$m}@}", + gn, VARF_WANTRES); if (*pm) { #ifdef DEBUG_META_MODE if (DEBUG(META)) Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/mk/ChangeLog Sat Jul 15 21:19:27 2017 (r321036) @@ -1,3 +1,22 @@ +2017-06-30 Simon J. Gerraty + + * install-mk (MK_VERSION): 20170630 + + * meta.stage.mk: avoid triggering stage_* targets with nothing to do. + +2017-05-23 Simon J. Gerraty + + * meta2deps.py: take special care of '..' + +2017-05-15 Simon J. Gerraty + + * install-mk (MK_VERSION): 20170515 + + * dirdeps.mk (DEP_EXPORT_VARS): on rare occasions it is + useful/necessary for a Makefile.depend file to export some knobs. + This is complicated when we are doing DIRDEPS_CACHE, so we will + handle export of any variables listed in DEP_EXPORT_VARS. + 2017-05-08 Simon J. Gerraty * install-mk (MK_VERSION): 20170505 Modified: head/contrib/bmake/mk/dirdeps.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps.mk Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/mk/dirdeps.mk Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.88 2017/04/24 20:34:59 sjg Exp $ +# $Id: dirdeps.mk,v 1.89 2017/05/17 17:41:47 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -636,6 +636,11 @@ _build_all_dirs := ${_build_all_dirs:O:u} x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \ echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo x!= { ${_build_all_dirs:@x@${target($x):?:echo '$x: _DIRDEP_USE';}@} echo; } >&3; echo +.if !empty(DEP_EXPORT_VARS) +# Discouraged, but there are always exceptions. +# Handle it here rather than explain how. +x!= { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3; echo +.endif .else # this makes it all happen dirdeps: ${_build_all_dirs} @@ -644,6 +649,11 @@ ${_build_all_dirs}: _DIRDEP_USE .if ${_debug_reldir} .info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs} +.endif + +.if !empty(DEP_EXPORT_VARS) +.export ${DEP_EXPORT_VARS} +DEP_EXPORT_VARS= .endif # this builds the dependency graph Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/mk/install-mk Sat Jul 15 21:19:27 2017 (r321036) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.145 2017/05/09 04:05:32 sjg Exp $ +# $Id: install-mk,v 1.148 2017/06/30 23:46:15 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20170505 +MK_VERSION=20170630 OWNER= GROUP= MODE=444 Modified: head/contrib/bmake/mk/lib.mk ============================================================================== --- head/contrib/bmake/mk/lib.mk Sat Jul 15 20:53:08 2017 (r321035) +++ head/contrib/bmake/mk/lib.mk Sat Jul 15 21:19:27 2017 (r321036) @@ -1,4 +1,4 @@ -# $Id: lib.mk,v 1.61 2017/05/06 17:30:09 sjg Exp $ +# $Id: lib.mk,v 1.62 2017/06/11 03:24:04 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -268,8 +268,7 @@ ${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} .S.o .s.o: - @echo ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} - @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} + ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} .if (${LD_X} == "") .c.po: @@ -282,21 +281,18 @@ ${CXX_SUFFIXES:%=%.po}: ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} .else .c.po: - @echo ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}.o + ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}.o @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o ${CXX_SUFFIXES:%=%.po}: - @echo ${COMPILE.cc} ${CXX_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o - @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} + ${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o + ${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o .S${PICO} .s${PICO}: - @echo ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o - @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} + ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o + ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o .endif @@ -312,21 +308,18 @@ ${CXX_SUFFIXES:%=%${PICO}}: .else .c${PICO}: - @echo ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o - @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} + ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o + ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o ${CXX_SUFFIXES:%=%${PICO}}: - @echo ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o - @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} + ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o + ${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o .S.po .s.po: - @echo ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} - @${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o - @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} + ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o + ${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} @rm -f ${.TARGET}.o .endif @@ -418,7 +411,7 @@ lib${LIB}.${LD_so}:: lib${LIB}.a .else # MK_LIBTOOL=yes lib${LIB}.a:: ${OBJS} - @echo building standard ${LIB} library + @${META_NOECHO} building standard ${LIB} library @rm -f ${.TARGET} @${AR} ${AR_cq} ${.TARGET} ${LD_objs} ${RANLIB} ${.TARGET} @@ -426,7 +419,7 @@ lib${LIB}.a:: ${OBJS} POBJS+= ${OBJS:.o=.po} .NOPATH: ${POBJS} lib${LIB}_p.a:: ${POBJS} - @echo building profiled ${LIB} library + @${META_NOECHO} building profiled ${LIB} library @rm -f ${.TARGET} @${AR} ${AR_cq} ${.TARGET} ${LD_pobjs} ${RANLIB} ${.TARGET} @@ -434,7 +427,7 @@ lib${LIB}_p.a:: ${POBJS} SOBJS+= ${OBJS:.o=${PICO}} .NOPATH: ${SOBJS} lib${LIB}_pic.a:: ${SOBJS} - @echo building shared object ${LIB} library + @${META_NOECHO} building shared object ${LIB} library @rm -f ${.TARGET} @${AR} ${AR_cq} ${.TARGET} ${LD_sobjs} ${RANLIB} ${.TARGET} @@ -444,7 +437,7 @@ lib${LIB}_pic.a:: ${SOBJS} # bound to be non-portable... # this is known to work for NetBSD 1.6 and FreeBSD 4.2 lib${LIB}.${LD_so}: ${SOLIB} ${DPADD} - @echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\) + @${META_NOECHO} building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\) @rm -f ${.TARGET} .if ${TARGET_OSNAME} == "NetBSD" || ${TARGET_OSNAME} == "FreeBSD" .if ${OBJECT_FMT} == "ELF" @@ -468,7 +461,7 @@ LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} .NOPATH: ${LOBJS} LLIBS?= -lc llib-l${LIB}.ln: ${LOBJS} - @echo building llib-l${LIB}.ln + @${META_NOECHO} building llib-l${LIB}.ln @rm -f llib-l${LIB}.ln @${LINT} -C${LIB} ${LOBJS} ${LLIBS} @@ -508,10 +501,8 @@ LIB_INSTALL_OWN ?= -o ${LIBOWN} -g ${LIBGRP} .include *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***