From owner-svn-src-stable-10@FreeBSD.ORG Mon Oct 28 22:41:36 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AF94A3E1; Mon, 28 Oct 2013 22:41:36 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9C7782561; Mon, 28 Oct 2013 22:41:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9SMfaWs070167; Mon, 28 Oct 2013 22:41:36 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9SMfawT070166; Mon, 28 Oct 2013 22:41:36 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201310282241.r9SMfawT070166@svn.freebsd.org> From: Peter Grehan Date: Mon, 28 Oct 2013 22:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257285 - stable/10/sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 22:41:36 -0000 Author: grehan Date: Mon Oct 28 22:41:36 2013 New Revision: 257285 URL: http://svnweb.freebsd.org/changeset/base/257285 Log: MFC r257078 Fix panic in the tap driver when a tap and vmnet interface were created after each other e.g. ifconfig tap0 ifconfig vmnet0 Appears to be a cut'n'paste error from the tap code to the vmnet code where the name string wasn't updated in the call to make_dev(). Approved by: re (glebius) Modified: stable/10/sys/net/if_tap.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/net/if_tap.c ============================================================================== --- stable/10/sys/net/if_tap.c Mon Oct 28 22:26:03 2013 (r257284) +++ stable/10/sys/net/if_tap.c Mon Oct 28 22:41:36 2013 (r257285) @@ -205,7 +205,7 @@ vmnet_clone_create(struct if_clone *ifc, i = clone_create(&tapclones, &tap_cdevsw, &unit, &dev, VMNET_DEV_MASK); if (i) { dev = make_dev(&tap_cdevsw, unit | VMNET_DEV_MASK, UID_ROOT, - GID_WHEEL, 0600, "%s%d", tapname, unit); + GID_WHEEL, 0600, "%s%d", vmnetname, unit); } tapcreate(dev); From owner-svn-src-stable-10@FreeBSD.ORG Mon Oct 28 22:49:12 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1B3CE570; Mon, 28 Oct 2013 22:49:12 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E249525A0; Mon, 28 Oct 2013 22:49:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9SMnBUB071081; Mon, 28 Oct 2013 22:49:11 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9SMnB12071079; Mon, 28 Oct 2013 22:49:11 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201310282249.r9SMnB12071079@svn.freebsd.org> From: Colin Percival Date: Mon, 28 Oct 2013 22:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257286 - stable/10/contrib/subversion/subversion/libsvn_subr X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 22:49:12 -0000 Author: cperciva Date: Mon Oct 28 22:49:11 2013 New Revision: 257286 URL: http://svnweb.freebsd.org/changeset/base/257286 Log: MFC r257129: Remove time and date stamps from svn* binaries, in order to make the builds reproducible. Approved by: re (glebius) Modified: stable/10/contrib/subversion/subversion/libsvn_subr/opt.c stable/10/contrib/subversion/subversion/libsvn_subr/version.c Directory Properties: stable/10/contrib/subversion/ (props changed) Modified: stable/10/contrib/subversion/subversion/libsvn_subr/opt.c ============================================================================== --- stable/10/contrib/subversion/subversion/libsvn_subr/opt.c Mon Oct 28 22:41:36 2013 (r257285) +++ stable/10/contrib/subversion/subversion/libsvn_subr/opt.c Mon Oct 28 22:49:11 2013 (r257286) @@ -1115,10 +1115,8 @@ svn_opt__print_version_info(const char * return svn_cmdline_printf(pool, "%s\n", SVN_VER_NUMBER); SVN_ERR(svn_cmdline_printf(pool, _("%s, version %s\n" - " compiled %s, %s on %s\n\n"), + " compiled on %s\n\n"), pgm_name, SVN_VERSION, - svn_version_ext_build_date(info), - svn_version_ext_build_time(info), svn_version_ext_build_host(info))); SVN_ERR(svn_cmdline_printf(pool, "%s\n", svn_version_ext_copyright(info))); Modified: stable/10/contrib/subversion/subversion/libsvn_subr/version.c ============================================================================== --- stable/10/contrib/subversion/subversion/libsvn_subr/version.c Mon Oct 28 22:41:36 2013 (r257285) +++ stable/10/contrib/subversion/subversion/libsvn_subr/version.c Mon Oct 28 22:49:11 2013 (r257286) @@ -125,8 +125,8 @@ svn_version_extended(svn_boolean_t verbo { svn_version_extended_t *info = apr_pcalloc(pool, sizeof(*info)); - info->build_date = __DATE__; - info->build_time = __TIME__; + info->build_date = NULL; + info->build_time = NULL; info->build_host = SVN_BUILD_HOST; info->copyright = apr_pstrdup (pool, _("Copyright (C) 2013 The Apache Software Foundation.\n" From owner-svn-src-stable-10@FreeBSD.ORG Mon Oct 28 23:47:53 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DFA60A6A; Mon, 28 Oct 2013 23:47:53 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CB684293F; Mon, 28 Oct 2013 23:47:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9SNlr4R091270; Mon, 28 Oct 2013 23:47:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9SNlrQl091263; Mon, 28 Oct 2013 23:47:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201310282347.r9SNlrQl091263@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 28 Oct 2013 23:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257292 - in stable/10/sys: conf powerpc/conf powerpc/pseries X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 23:47:54 -0000 Author: nwhitehorn Date: Mon Oct 28 23:47:52 2013 New Revision: 257292 URL: http://svnweb.freebsd.org/changeset/base/257292 Log: MFC r256777-256779,256788: Add driver for POWER hypervisor interpartition ethernet. Approved by: re (glebius) Added: stable/10/sys/powerpc/pseries/phyp_llan.c - copied, changed from r256778, head/sys/powerpc/pseries/phyp_llan.c Modified: stable/10/sys/conf/files.powerpc stable/10/sys/powerpc/conf/GENERIC64 stable/10/sys/powerpc/pseries/phyp-hvcall.S Directory Properties: stable/10/sys/ (props changed) stable/10/sys/conf/ (props changed) Modified: stable/10/sys/conf/files.powerpc ============================================================================== --- stable/10/sys/conf/files.powerpc Mon Oct 28 23:42:44 2013 (r257291) +++ stable/10/sys/conf/files.powerpc Mon Oct 28 23:47:52 2013 (r257292) @@ -228,6 +228,7 @@ powerpc/ps3/ps3-hvcall.S optional ps3 sc powerpc/pseries/phyp-hvcall.S optional pseries powerpc64 powerpc/pseries/mmu_phyp.c optional pseries powerpc64 powerpc/pseries/phyp_console.c optional pseries powerpc64 uart +powerpc/pseries/phyp_llan.c optional llan powerpc/pseries/phyp_vscsi.c optional pseries powerpc64 scbus powerpc/pseries/platform_chrp.c optional pseries powerpc/pseries/plpar_iommu.c optional pseries powerpc64 Modified: stable/10/sys/powerpc/conf/GENERIC64 ============================================================================== --- stable/10/sys/powerpc/conf/GENERIC64 Mon Oct 28 23:42:44 2013 (r257291) +++ stable/10/sys/powerpc/conf/GENERIC64 Mon Oct 28 23:47:52 2013 (r257292) @@ -128,6 +128,7 @@ device em # Intel PRO/1000 Gigabit Eth device igb # Intel PRO/1000 PCIE Server Gigabit Family device ixgbe # Intel PRO/10GbE PCIE Ethernet Family device glc # Sony Playstation 3 Ethernet +device llan # IBM pSeries Virtual Ethernet # PCI Ethernet NICs that use the common MII bus controller code. device miibus # MII bus support Modified: stable/10/sys/powerpc/pseries/phyp-hvcall.S ============================================================================== --- stable/10/sys/powerpc/pseries/phyp-hvcall.S Mon Oct 28 23:42:44 2013 (r257291) +++ stable/10/sys/powerpc/pseries/phyp-hvcall.S Mon Oct 28 23:47:52 2013 (r257292) @@ -36,6 +36,8 @@ ASENTRY(phyp_hcall) mflr %r0 std %r0,16(%r1) + ld %r11,112(%r1) /* Last couple args into volatile regs*/ + ld %r12,120(%r1) hc /* invoke the hypervisor */ ld %r0,16(%r1) mtlr %r0 Copied and modified: stable/10/sys/powerpc/pseries/phyp_llan.c (from r256778, head/sys/powerpc/pseries/phyp_llan.c) ============================================================================== --- head/sys/powerpc/pseries/phyp_llan.c Sun Oct 20 01:31:09 2013 (r256778, copy source) +++ stable/10/sys/powerpc/pseries/phyp_llan.c Mon Oct 28 23:47:52 2013 (r257292) @@ -60,6 +60,11 @@ __FBSDID("$FreeBSD$"); #define LLAN_MAX_TX_PACKETS 100 #define LLAN_RX_BUF_LEN 8*PAGE_SIZE +#define LLAN_BUFDESC_VALID (1ULL << 63) +#define LLAN_ADD_MULTICAST 0x1 +#define LLAN_DEL_MULTICAST 0x2 +#define LLAN_CLEAR_MULTICAST 0x3 + struct llan_xfer { struct mbuf *rx_mbuf; bus_dmamap_t rx_dmamap; @@ -113,6 +118,7 @@ static int llan_ioctl(struct ifnet *ifp, static void llan_rx_load_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int err); static int llan_add_rxbuf(struct llan_softc *sc, struct llan_xfer *rx); +static int llan_set_multicast(struct llan_softc *sc); static devclass_t llan_devclass; static device_method_t llan_methods[] = { @@ -249,7 +255,7 @@ llan_init(void *xsc) sc->rx_dma_slot = 0; sc->rx_valid_val = 1; - rx_buf_desc = (1UL << 63); /* valid */ + rx_buf_desc = LLAN_BUFDESC_VALID; rx_buf_desc |= (sc->rx_buf_len << 32); rx_buf_desc |= sc->rx_buf_phys; memcpy(&macaddr, sc->mac_address, 8); @@ -307,7 +313,7 @@ llan_add_rxbuf(struct llan_softc *sc, st bus_dmamap_sync(sc->rxbuf_dma_tag, rx->rx_dmamap, BUS_DMASYNC_PREREAD); - rx->rx_bufdesc = (1UL << 63); /* valid */ + rx->rx_bufdesc = LLAN_BUFDESC_VALID; rx->rx_bufdesc |= (((uint64_t)segs[0].ds_len) << 32); rx->rx_bufdesc |= segs[0].ds_addr; error = phyp_hcall(H_ADD_LOGICAL_LAN_BUFFER, sc->unit, rx->rx_bufdesc); @@ -376,20 +382,19 @@ llan_send_packet(void *xsc, bus_dma_segm bzero(bufdescs, sizeof(bufdescs)); for (i = 0; i < nsegs; i++) { - bufdescs[i] = (1UL << 63); /* valid */ + bufdescs[i] = LLAN_BUFDESC_VALID; bufdescs[i] |= (((uint64_t)segs[i].ds_len) << 32); bufdescs[i] |= segs[i].ds_addr; } - error = phyp_hcall(H_SEND_LOGICAL_LAN, sc->unit, bufdescs[0], + phyp_hcall(H_SEND_LOGICAL_LAN, sc->unit, bufdescs[0], bufdescs[1], bufdescs[2], bufdescs[3], bufdescs[4], bufdescs[5], 0); -#if 0 - if (error) - sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE; - - /* XXX: handle H_BUSY? */ - /* H_SEND_LOGICAL_LAN returning 0 implies completion of the send op */ -#endif + /* + * The hypercall returning implies completion -- or that the call will + * not complete. In principle, we should try a few times if we get back + * H_BUSY based on the continuation token in R4. For now, just drop + * the packet in such cases. + */ } static void @@ -425,9 +430,9 @@ llan_start_locked(struct ifnet *ifp) } } - bus_dmamap_load_mbuf(sc->tx_dma_tag, sc->tx_dma_map, //xfer->dmamap, + bus_dmamap_load_mbuf(sc->tx_dma_tag, sc->tx_dma_map, mb_head, llan_send_packet, sc, 0); - bus_dmamap_unload(sc->tx_dma_tag, sc->tx_dma_map); // XXX + bus_dmamap_unload(sc->tx_dma_tag, sc->tx_dma_map); m_freem(mb_head); } } @@ -443,11 +448,50 @@ llan_start(struct ifnet *ifp) } static int +llan_set_multicast(struct llan_softc *sc) +{ + struct ifnet *ifp = sc->ifp; + struct ifmultiaddr *inm; + uint64_t macaddr; + + mtx_assert(&sc->io_lock, MA_OWNED); + + phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_CLEAR_MULTICAST, 0); + + if_maddr_rlock(ifp); + TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { + if (inm->ifma_addr->sa_family != AF_LINK) + continue; + + memcpy((uint8_t *)&macaddr + 2, + LLADDR((struct sockaddr_dl *)inm->ifma_addr), 6); + phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_ADD_MULTICAST, + macaddr); + } + if_maddr_runlock(ifp); + + return (0); +} + +static int llan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - int err; + int err = 0; + struct llan_softc *sc = ifp->if_softc; - err = ether_ioctl(ifp, cmd, data); + switch (cmd) { + case SIOCADDMULTI: + case SIOCDELMULTI: + mtx_lock(&sc->io_lock); + if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + llan_set_multicast(sc); + mtx_unlock(&sc->io_lock); + break; + case SIOCSIFFLAGS: + default: + err = ether_ioctl(ifp, cmd, data); + break; + } return (err); } From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 07:33:54 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D71BC6A5; Tue, 29 Oct 2013 07:33:54 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4215200E; Tue, 29 Oct 2013 07:33:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T7XsbC050897; Tue, 29 Oct 2013 07:33:54 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T7XsP4050893; Tue, 29 Oct 2013 07:33:54 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201310290733.r9T7XsP4050893@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 29 Oct 2013 07:33:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257309 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 07:33:54 -0000 Author: bapt Date: Tue Oct 29 07:33:53 2013 New Revision: 257309 URL: http://svnweb.freebsd.org/changeset/base/257309 Log: MFC: r256968, r256971, r256978 Improve SRV records support for the pkg(8) bootstrap: - order srv records by priorities - for all entries of the same priority, order randomly respect the weight - select the port where to fetch from respect the port provided in the SRV record Allow to bootstrap by doing pkg add ./a/path/to/a/pkg_package.txz Approved by: re (glebius) Modified: stable/10/usr.sbin/pkg/dns_utils.c stable/10/usr.sbin/pkg/dns_utils.h stable/10/usr.sbin/pkg/pkg.c Directory Properties: stable/10/usr.sbin/pkg/ (props changed) Modified: stable/10/usr.sbin/pkg/dns_utils.c ============================================================================== --- stable/10/usr.sbin/pkg/dns_utils.c Tue Oct 29 07:25:54 2013 (r257308) +++ stable/10/usr.sbin/pkg/dns_utils.c Tue Oct 29 07:33:53 2013 (r257309) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012 Baptiste Daroussin + * Copyright (c) 2012-2013 Baptiste Daroussin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,77 @@ typedef union { unsigned char buf[1024]; } dns_query; +static int +srv_priority_cmp(const void *a, const void *b) +{ + const struct dns_srvinfo *da, *db; + unsigned int r, l; + + da = *(struct dns_srvinfo * const *)a; + db = *(struct dns_srvinfo * const *)b; + + l = da->priority; + r = db->priority; + + return ((l > r) - (l < r)); +} + +static int +srv_final_cmp(const void *a, const void *b) +{ + const struct dns_srvinfo *da, *db; + unsigned int r, l, wr, wl; + int res; + + da = *(struct dns_srvinfo * const *)a; + db = *(struct dns_srvinfo * const *)b; + + l = da->priority; + r = db->priority; + + res = ((l > r) - (l < r)); + + if (res == 0) { + wl = da->finalweight; + wr = db->finalweight; + res = ((wr > wl) - (wr < wl)); + } + + return (res); +} + +static void +compute_weight(struct dns_srvinfo **d, int first, int last) +{ + int i, j, totalweight; + int *chosen; + + chosen = malloc(sizeof(int) * (last - first + 1)); + totalweight = 0; + + for (i = 0; i <= last; i++) + totalweight += d[i]->weight; + + if (totalweight == 0) + return; + + for (i = 0; i <= last; i++) { + for (;;) { + chosen[i] = random() % (d[i]->weight * 100 / totalweight); + for (j = 0; j < i; j++) { + if (chosen[i] == chosen[j]) + break; + } + if (j == i) { + d[i]->finalweight = chosen[i]; + break; + } + } + } + + free(chosen); +} + struct dns_srvinfo * dns_getsrvinfo(const char *zone) { @@ -46,7 +117,7 @@ dns_getsrvinfo(const char *zone) unsigned char *end, *p; char host[MAXHOSTNAMELEN]; dns_query q; - int len, qdcount, ancount, n, i; + int len, qdcount, ancount, n, i, f, l; unsigned int type, class, ttl, priority, weight, port; if ((len = res_query(zone, C_IN, T_SRV, q.buf, sizeof(q.buf))) == -1 || @@ -125,6 +196,21 @@ dns_getsrvinfo(const char *zone) n++; } + qsort(res, n, sizeof(res[0]), srv_priority_cmp); + + priority = f = l = 0; + for (i = 0; i < n; i++) { + if (res[i]->priority != priority) { + if (f != l) + compute_weight(res, f, l); + f = i; + priority = res[i]->priority; + } + l = i; + } + + qsort(res, n, sizeof(res[0]), srv_final_cmp); + for (i = 0; i < n - 1; i++) res[i]->next = res[i + 1]; Modified: stable/10/usr.sbin/pkg/dns_utils.h ============================================================================== --- stable/10/usr.sbin/pkg/dns_utils.h Tue Oct 29 07:25:54 2013 (r257308) +++ stable/10/usr.sbin/pkg/dns_utils.h Tue Oct 29 07:33:53 2013 (r257309) @@ -35,6 +35,7 @@ struct dns_srvinfo { unsigned int priority; unsigned int weight; unsigned int port; + unsigned int finalweight; char host[MAXHOSTNAMELEN]; struct dns_srvinfo *next; }; Modified: stable/10/usr.sbin/pkg/pkg.c ============================================================================== --- stable/10/usr.sbin/pkg/pkg.c Tue Oct 29 07:25:54 2013 (r257308) +++ stable/10/usr.sbin/pkg/pkg.c Tue Oct 29 07:33:53 2013 (r257309) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -191,8 +192,10 @@ bootstrap_pkg(void) } } - if (mirrors != NULL) + if (mirrors != NULL) { strlcpy(u->host, current->host, sizeof(u->host)); + u->port = current->port; + } remote = fetchXGet(u, &st, ""); if (remote == NULL) { @@ -295,7 +298,9 @@ int main(__unused int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; + char pkgstatic[MAXPATHLEN]; bool yes = false; + int fd, ret; snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); @@ -309,6 +314,19 @@ main(__unused int argc, char *argv[]) if (argv[1] != NULL && strcmp(argv[1], "-N") == 0) errx(EXIT_FAILURE, "pkg is not installed"); + if (argc > 2 && strcmp(argv[1], "add") == 0 && + access(argv[2], R_OK) == 0) { + fd = open(argv[2], O_RDONLY); + if (fd == -1) + err(EXIT_FAILURE, "Unable to open %s", argv[2]); + + if ((ret = extract_pkg_static(fd, pkgstatic, MAXPATHLEN)) == 0) + ret = install_pkg_static(pkgstatic, argv[2]); + close(fd); + if (ret != 0) + exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); + } /* * Do not ask for confirmation if either of stdin or stdout is * not tty. Check the environment to see if user has answer From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 07:33:56 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 28FAE6A6; Tue, 29 Oct 2013 07:33:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1677C2010; Tue, 29 Oct 2013 07:33:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T7Xtxw050936; Tue, 29 Oct 2013 07:33:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T7XtjT050935; Tue, 29 Oct 2013 07:33:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310290733.r9T7XtjT050935@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 29 Oct 2013 07:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257310 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 07:33:56 -0000 Author: kib Date: Tue Oct 29 07:33:55 2013 New Revision: 257310 URL: http://svnweb.freebsd.org/changeset/base/257310 Log: MFC r256847: Print more useful information about the transfer that trigger the assertion. Approved by: re (glebius) Modified: stable/10/sys/kern/uipc_syscalls.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/kern/uipc_syscalls.c ============================================================================== --- stable/10/sys/kern/uipc_syscalls.c Tue Oct 29 07:33:53 2013 (r257309) +++ stable/10/sys/kern/uipc_syscalls.c Tue Oct 29 07:33:55 2013 (r257310) @@ -2070,7 +2070,8 @@ free_page: } KASSERT(error != 0 || (m->wire_count > 0 && vm_page_is_valid(m, off & PAGE_MASK, xfsize)), - ("wrong page state m %p", m)); + ("wrong page state m %p off %#jx xfsize %d", m, (uintmax_t)off, + xfsize)); VM_OBJECT_WUNLOCK(obj); return (error); } From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 07:35:19 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BA7C0A9A; Tue, 29 Oct 2013 07:35:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A7AAD2023; Tue, 29 Oct 2013 07:35:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T7ZJiZ051202; Tue, 29 Oct 2013 07:35:19 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T7ZJFH051201; Tue, 29 Oct 2013 07:35:19 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310290735.r9T7ZJFH051201@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 29 Oct 2013 07:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257311 - stable/10/sys/dev/drm2/i915 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 07:35:19 -0000 Author: kib Date: Tue Oct 29 07:35:19 2013 New Revision: 257311 URL: http://svnweb.freebsd.org/changeset/base/257311 Log: MFC r256848: Use plain register read for waiting of the reset completion notification, to avoid gt_lock recursion. Approved by: re (glebius) Modified: stable/10/sys/dev/drm2/i915/i915_drv.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- stable/10/sys/dev/drm2/i915/i915_drv.c Tue Oct 29 07:33:55 2013 (r257310) +++ stable/10/sys/dev/drm2/i915/i915_drv.c Tue Oct 29 07:35:19 2013 (r257311) @@ -685,7 +685,7 @@ gen6_do_reset(struct drm_device *dev, u8 /* Spin waiting for the device to ack the reset request */ ret = _intel_wait_for(dev, - (I915_READ(GEN6_GDRST) & GEN6_GRDOM_FULL) == 0, + (I915_READ_NOTRACE(GEN6_GDRST) & GEN6_GRDOM_FULL) == 0, 500, 1, "915rst"); /* If reset with a user forcewake, try to restore, otherwise turn it off */ From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 09:23:51 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AA2B8E29; Tue, 29 Oct 2013 09:23:51 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 970F2267F; Tue, 29 Oct 2013 09:23:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T9Npwm091923; Tue, 29 Oct 2013 09:23:51 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T9NpL9091922; Tue, 29 Oct 2013 09:23:51 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310290923.r9T9NpL9091922@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 29 Oct 2013 09:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257320 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 09:23:51 -0000 Author: glebius Date: Tue Oct 29 09:23:51 2013 New Revision: 257320 URL: http://svnweb.freebsd.org/changeset/base/257320 Log: Merge r256537 from head: Make getutxent(3) more robust against bad utx.log files. Whenever we read zeroes, don't stop processing the file, but read until its end or valid data. In collaboration with: ed Approved by: re (kib) Modified: stable/10/lib/libc/gen/getutxent.c Directory Properties: stable/10/lib/libc/ (props changed) Modified: stable/10/lib/libc/gen/getutxent.c ============================================================================== --- stable/10/lib/libc/gen/getutxent.c Tue Oct 29 09:04:25 2013 (r257319) +++ stable/10/lib/libc/gen/getutxent.c Tue Oct 29 09:23:51 2013 (r257320) @@ -122,9 +122,20 @@ getfutxent(struct futx *fu) if (udb == UTXDB_LOG) { uint16_t len; +retry: if (fread(&len, sizeof(len), 1, uf) != 1) return (-1); len = be16toh(len); + if (len == 0) { + /* + * XXX: Though zero-size records are valid in theory, + * they can never occur in practice. Zero-size records + * indicate file corruption. Seek one byte forward, to + * see if we can find a record there. + */ + ungetc('\0', uf); + goto retry; + } if (len > sizeof *fu) { /* Forward compatibility. */ if (fread(fu, sizeof(*fu), 1, uf) != 1) From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 09:24:39 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B1E98E5; Tue, 29 Oct 2013 09:24:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9F1F22699; Tue, 29 Oct 2013 09:24:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T9Od8h092046; Tue, 29 Oct 2013 09:24:39 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T9Odsp092045; Tue, 29 Oct 2013 09:24:39 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310290924.r9T9Odsp092045@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 29 Oct 2013 09:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257321 - stable/10/sbin/ifconfig X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 09:24:39 -0000 Author: glebius Date: Tue Oct 29 09:24:39 2013 New Revision: 257321 URL: http://svnweb.freebsd.org/changeset/base/257321 Log: Merge r256824 from head: Provide a working example line for an interface with 1 address running with CARP. Currently, we've got a problem that interface isn't IFF_UP at the time we assign it a redundant address, and the latter gets stuck in INIT state. Additional SIOCSIFFLAGS from ifconfig(8) kicks it to a working state. A proper fix is kernel side and appeared to be non-trivial, not to be checked in before 10.0-RELEASE. Submitted by: Ole Myhre Approved by: re (kib) Modified: stable/10/sbin/ifconfig/ifconfig.8 Directory Properties: stable/10/sbin/ifconfig/ (props changed) Modified: stable/10/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/10/sbin/ifconfig/ifconfig.8 Tue Oct 29 09:23:51 2013 (r257320) +++ stable/10/sbin/ifconfig/ifconfig.8 Tue Oct 29 09:24:39 2013 (r257321) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd January 10, 2013 +.Dd October 21, 2013 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2690,7 +2690,7 @@ as a synonym for the canonical form of t .Pp Configure a single CARP redundant address on igb0, and then switch it to be master: -.Dl # ifconfig igb0 vhid 1 10.0.0.1/24 pass foobar +.Dl # ifconfig igb0 vhid 1 10.0.0.1/24 pass foobar up .Dl # ifconfig igb0 vhid 1 state master .Pp Configure the interface From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 11:36:32 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 47D878BB; Tue, 29 Oct 2013 11:36:32 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 322B52E51; Tue, 29 Oct 2013 11:36:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TBaWXG037292; Tue, 29 Oct 2013 11:36:32 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TBaWHa037291; Tue, 29 Oct 2013 11:36:32 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201310291136.r9TBaWHa037291@svn.freebsd.org> From: Steven Hartland Date: Tue, 29 Oct 2013 11:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257327 - stable/10/contrib/llvm/tools/clang/tools/driver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 11:36:32 -0000 Author: smh Date: Tue Oct 29 11:36:31 2013 New Revision: 257327 URL: http://svnweb.freebsd.org/changeset/base/257327 Log: MFC r257109: Add clang-CC and CC to list of hints allowing clang to identify its operating mode as c++ instead of defaulting to c for the binary names CC and clang-CC. This fixes builds that use cmake which automatically sets CXX to /usr/bin/CC by default. PR: bin/182442 Approved by: re (glebius) Modified: stable/10/contrib/llvm/tools/clang/tools/driver/driver.cpp Directory Properties: stable/10/contrib/llvm/tools/clang/ (props changed) Modified: stable/10/contrib/llvm/tools/clang/tools/driver/driver.cpp ============================================================================== --- stable/10/contrib/llvm/tools/clang/tools/driver/driver.cpp Tue Oct 29 11:28:11 2013 (r257326) +++ stable/10/contrib/llvm/tools/clang/tools/driver/driver.cpp Tue Oct 29 11:36:31 2013 (r257327) @@ -284,11 +284,13 @@ static void ParseProgName(SmallVectorImp } suffixes [] = { { "clang", false, false }, { "clang++", true, false }, + { "clang-CC", true, false }, { "clang-c++", true, false }, { "clang-cc", false, false }, { "clang-cpp", false, true }, { "clang-g++", true, false }, { "clang-gcc", false, false }, + { "CC", true, false }, { "cc", false, false }, { "cpp", false, true }, { "++", true, false }, From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 12:25:23 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 38D378AF; Tue, 29 Oct 2013 12:25:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0B2AF2253; Tue, 29 Oct 2013 12:25:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TCPMBR053723; Tue, 29 Oct 2013 12:25:22 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TCPMSG053719; Tue, 29 Oct 2013 12:25:22 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201310291225.r9TCPMSG053719@svn.freebsd.org> From: Bryan Drewery Date: Tue, 29 Oct 2013 12:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257328 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 12:25:23 -0000 Author: bdrewery (ports committer) Date: Tue Oct 29 12:25:22 2013 New Revision: 257328 URL: http://svnweb.freebsd.org/changeset/base/257328 Log: MFC r257051: Add support for using "pkg+http://" for the PACKAGESITE. pkg 1.2 is adding this support as well. This should help lessen the confusion on why the default SRV PACKAGESITE does not load in a browser. Approved by: bapt Approved by: re (glebius) Modified: stable/10/usr.sbin/pkg/config.c stable/10/usr.sbin/pkg/config.h stable/10/usr.sbin/pkg/pkg.c Directory Properties: stable/10/usr.sbin/pkg/ (props changed) Modified: stable/10/usr.sbin/pkg/config.c ============================================================================== --- stable/10/usr.sbin/pkg/config.c Tue Oct 29 11:36:31 2013 (r257327) +++ stable/10/usr.sbin/pkg/config.c Tue Oct 29 12:25:22 2013 (r257328) @@ -62,7 +62,7 @@ static struct config_entry c[] = { [PACKAGESITE] = { PKG_CONFIG_STRING, "PACKAGESITE", - "http://pkg.FreeBSD.org/${ABI}/latest", + URL_SCHEME_PREFIX "http://pkg.FreeBSD.org/${ABI}/latest", NULL, false, }, Modified: stable/10/usr.sbin/pkg/config.h ============================================================================== --- stable/10/usr.sbin/pkg/config.h Tue Oct 29 11:36:31 2013 (r257327) +++ stable/10/usr.sbin/pkg/config.h Tue Oct 29 12:25:22 2013 (r257328) @@ -30,6 +30,7 @@ #define _PKG_CONFIG_H #define _LOCALBASE "/usr/local" +#define URL_SCHEME_PREFIX "pkg+" typedef enum { PACKAGESITE = 0, Modified: stable/10/usr.sbin/pkg/pkg.c ============================================================================== --- stable/10/usr.sbin/pkg/pkg.c Tue Oct 29 11:36:31 2013 (r257327) +++ stable/10/usr.sbin/pkg/pkg.c Tue Oct 29 12:25:22 2013 (r257328) @@ -168,6 +168,13 @@ bootstrap_pkg(void) warnx("No MIRROR_TYPE defined"); return (-1); } + + /* Support pkg+http:// for PACKAGESITE which is the new format + in 1.2 to avoid confusion on why http://pkg.FreeBSD.org has + no A record. */ + if (strncmp(URL_SCHEME_PREFIX, packagesite, + strlen(URL_SCHEME_PREFIX)) == 0) + packagesite += strlen(URL_SCHEME_PREFIX); snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite); snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 12:53:24 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C23914A8; Tue, 29 Oct 2013 12:53:24 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9B82471; Tue, 29 Oct 2013 12:53:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TCrOYm064528; Tue, 29 Oct 2013 12:53:24 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TCrOsl064526; Tue, 29 Oct 2013 12:53:24 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201310291253.r9TCrOsl064526@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Tue, 29 Oct 2013 12:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257330 - stable/10/sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 12:53:24 -0000 Author: melifaro Date: Tue Oct 29 12:53:23 2013 New Revision: 257330 URL: http://svnweb.freebsd.org/changeset/base/257330 Log: MFC r256624: Fix long-standing issue with incorrect radix mask calculation. Usual symptoms are messages like rn_delete: inconsistent annotation rn_addmask: mask impossibly already in tree routing daemon constantly deleting IPv6 default route or inability to flush/delete particular prefix in ipfw table. Changes: * Assume 32 bytes as maximum radix key length * Remove rn_init() * Statically allocate rn_ones/rn_zeroes * Make separate mask tree for each "normal" tree instead of system global one * Remove "optimization" on masks reusage and key zeroying * Change rn_addmask() arguments to accept tree pointer (no users in base) MFC changes: * keep rn_init() * create global mask tree, protected with mutex, for old rn_addmask users (currently 0 in base) * Add new rn_addmask_r() function (rn_addmask in head) with additional argument to accept tree pointer PR: kern/182851, kern/169206, kern/135476, kern/134531 Found by: Slawa Olhovchenkov Reviewed by: glebius (previous versions) Sponsored by: Yandex LLC Approved by: re (glebius) Modified: stable/10/sys/net/radix.c stable/10/sys/net/radix.h Modified: stable/10/sys/net/radix.c ============================================================================== --- stable/10/sys/net/radix.c Tue Oct 29 12:34:11 2013 (r257329) +++ stable/10/sys/net/radix.c Tue Oct 29 12:53:23 2013 (r257330) @@ -66,27 +66,27 @@ static struct radix_node *rn_search(void *, struct radix_node *), *rn_search_m(void *, struct radix_node *, void *); -static int max_keylen; -static struct radix_mask *rn_mkfreelist; -static struct radix_node_head *mask_rnhead; +static void rn_detachhead_internal(void **head); +static int rn_inithead_internal(void **head, int off); + +#define RADIX_MAX_KEY_LEN 32 + +static char rn_zeros[RADIX_MAX_KEY_LEN]; +static char rn_ones[RADIX_MAX_KEY_LEN] = { + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, +}; + /* - * Work area -- the following point to 3 buffers of size max_keylen, - * allocated in this order in a block of memory malloc'ed by rn_init. - * rn_zeros, rn_ones are set in rn_init and used in readonly afterwards. - * addmask_key is used in rn_addmask in rw mode and not thread-safe. + * XXX: Compat stuff for old rn_addmask() users */ -static char *rn_zeros, *rn_ones, *addmask_key; - -#define MKGet(m) { \ - if (rn_mkfreelist) { \ - m = rn_mkfreelist; \ - rn_mkfreelist = (m)->rm_mklist; \ - } else \ - R_Malloc(m, struct radix_mask *, sizeof (struct radix_mask)); } - -#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);} +static struct radix_node_head *mask_rnhead_compat; +#ifdef _KERNEL +static struct mtx mask_mtx; +#endif -#define rn_masktop (mask_rnhead->rnh_treetop) static int rn_lexobetter(void *m_arg, void *n_arg); static struct radix_mask * @@ -230,7 +230,8 @@ rn_lookup(v_arg, m_arg, head) caddr_t netmask = 0; if (m_arg) { - x = rn_addmask(m_arg, 1, head->rnh_treetop->rn_offset); + x = rn_addmask_r(m_arg, head->rnh_masks, 1, + head->rnh_treetop->rn_offset); if (x == 0) return (0); netmask = x->rn_key; @@ -489,53 +490,47 @@ on1: } struct radix_node * -rn_addmask(n_arg, search, skip) - int search, skip; - void *n_arg; +rn_addmask_r(void *arg, struct radix_node_head *maskhead, int search, int skip) { - caddr_t netmask = (caddr_t)n_arg; + caddr_t netmask = (caddr_t)arg; register struct radix_node *x; register caddr_t cp, cplim; register int b = 0, mlen, j; - int maskduplicated, m0, isnormal; + int maskduplicated, isnormal; struct radix_node *saved_x; - static int last_zeroed = 0; + char addmask_key[RADIX_MAX_KEY_LEN]; - if ((mlen = LEN(netmask)) > max_keylen) - mlen = max_keylen; + if ((mlen = LEN(netmask)) > RADIX_MAX_KEY_LEN) + mlen = RADIX_MAX_KEY_LEN; if (skip == 0) skip = 1; if (mlen <= skip) - return (mask_rnhead->rnh_nodes); + return (maskhead->rnh_nodes); + + bzero(addmask_key, RADIX_MAX_KEY_LEN); if (skip > 1) bcopy(rn_ones + 1, addmask_key + 1, skip - 1); - if ((m0 = mlen) > skip) - bcopy(netmask + skip, addmask_key + skip, mlen - skip); + bcopy(netmask + skip, addmask_key + skip, mlen - skip); /* * Trim trailing zeroes. */ for (cp = addmask_key + mlen; (cp > addmask_key) && cp[-1] == 0;) cp--; mlen = cp - addmask_key; - if (mlen <= skip) { - if (m0 >= last_zeroed) - last_zeroed = mlen; - return (mask_rnhead->rnh_nodes); - } - if (m0 < last_zeroed) - bzero(addmask_key + m0, last_zeroed - m0); - *addmask_key = last_zeroed = mlen; - x = rn_search(addmask_key, rn_masktop); + if (mlen <= skip) + return (maskhead->rnh_nodes); + *addmask_key = mlen; + x = rn_search(addmask_key, maskhead->rnh_treetop); if (bcmp(addmask_key, x->rn_key, mlen) != 0) x = 0; if (x || search) return (x); - R_Zalloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x)); + R_Zalloc(x, struct radix_node *, RADIX_MAX_KEY_LEN + 2 * sizeof (*x)); if ((saved_x = x) == 0) return (0); netmask = cp = (caddr_t)(x + 2); bcopy(addmask_key, cp, mlen); - x = rn_insert(cp, mask_rnhead, &maskduplicated, x); + x = rn_insert(cp, maskhead, &maskduplicated, x); if (maskduplicated) { log(LOG_ERR, "rn_addmask: mask impossibly already in tree"); Free(saved_x); @@ -568,6 +563,23 @@ rn_addmask(n_arg, search, skip) return (x); } +struct radix_node * +rn_addmask(void *n_arg, int search, int skip) +{ + struct radix_node *tt; + +#ifdef _KERNEL + mtx_lock(&mask_mtx); +#endif + tt = rn_addmask_r(&mask_rnhead_compat, n_arg, search, skip); + +#ifdef _KERNEL + mtx_unlock(&mask_mtx); +#endif + + return (tt); +} + static int /* XXX: arbitrary ordering for non-contiguous masks */ rn_lexobetter(m_arg, n_arg) void *m_arg, *n_arg; @@ -590,12 +602,12 @@ rn_new_radix_mask(tt, next) { register struct radix_mask *m; - MKGet(m); + R_Malloc(m, struct radix_mask *, sizeof (struct radix_mask)); if (m == 0) { - log(LOG_ERR, "Mask for route not entered\n"); + log(LOG_ERR, "Failed to allocate route mask\n"); return (0); } - bzero(m, sizeof *m); + bzero(m, sizeof(*m)); m->rm_bit = tt->rn_bit; m->rm_flags = tt->rn_flags; if (tt->rn_flags & RNF_NORMAL) @@ -629,7 +641,8 @@ rn_addroute(v_arg, n_arg, head, treenode * nodes and possibly save time in calculating indices. */ if (netmask) { - if ((x = rn_addmask(netmask, 0, top->rn_offset)) == 0) + x = rn_addmask_r(netmask, head->rnh_masks, 0, top->rn_offset); + if (x == NULL) return (0); b_leaf = x->rn_bit; b = -1 - x->rn_bit; @@ -808,7 +821,8 @@ rn_delete(v_arg, netmask_arg, head) * Delete our route from mask lists. */ if (netmask) { - if ((x = rn_addmask(netmask, 1, head_off)) == 0) + x = rn_addmask_r(netmask, head->rnh_masks, 1, head_off); + if (x == NULL) return (0); netmask = x->rn_key; while (tt->rn_mask != netmask) @@ -841,7 +855,7 @@ rn_delete(v_arg, netmask_arg, head) for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) if (m == saved_m) { *mp = m->rm_mklist; - MKFree(m); + Free(m); break; } if (m == 0) { @@ -932,7 +946,7 @@ on1: struct radix_mask *mm = m->rm_mklist; x->rn_mklist = 0; if (--(m->rm_refs) < 0) - MKFree(m); + Free(m); m = mm; } if (m) @@ -1128,10 +1142,8 @@ rn_walktree(h, f, w) * bits starting at 'off'. * Return 1 on success, 0 on error. */ -int -rn_inithead(head, off) - void **head; - int off; +static int +rn_inithead_internal(void **head, int off) { register struct radix_node_head *rnh; register struct radix_node *t, *tt, *ttt; @@ -1163,8 +1175,8 @@ rn_inithead(head, off) return (1); } -int -rn_detachhead(void **head) +static void +rn_detachhead_internal(void **head) { struct radix_node_head *rnh; @@ -1176,28 +1188,60 @@ rn_detachhead(void **head) Free(rnh); *head = NULL; +} + +int +rn_inithead(void **head, int off) +{ + struct radix_node_head *rnh; + + if (*head != NULL) + return (1); + + if (rn_inithead_internal(head, off) == 0) + return (0); + + rnh = (struct radix_node_head *)(*head); + + if (rn_inithead_internal((void **)&rnh->rnh_masks, 0) == 0) { + rn_detachhead_internal(head); + return (0); + } + + return (1); +} + +int +rn_detachhead(void **head) +{ + struct radix_node_head *rnh; + + KASSERT((head != NULL && *head != NULL), + ("%s: head already freed", __func__)); + + rnh = *head; + + rn_detachhead_internal((void **)&rnh->rnh_masks); + rn_detachhead_internal(head); return (1); } void rn_init(int maxk) { - char *cp, *cplim; - - max_keylen = maxk; - if (max_keylen == 0) { + if ((maxk <= 0) || (maxk > RADIX_MAX_KEY_LEN)) { log(LOG_ERR, - "rn_init: radix functions require max_keylen be set\n"); + "rn_init: max_keylen must be within 1..%d\n", + RADIX_MAX_KEY_LEN); return; } - R_Malloc(rn_zeros, char *, 3 * max_keylen); - if (rn_zeros == NULL) - panic("rn_init"); - bzero(rn_zeros, 3 * max_keylen); - rn_ones = cp = rn_zeros + max_keylen; - addmask_key = cplim = rn_ones + max_keylen; - while (cp < cplim) - *cp++ = -1; - if (rn_inithead((void **)(void *)&mask_rnhead, 0) == 0) + + /* + * XXX: Compat for old rn_addmask() users + */ + if (rn_inithead((void **)(void *)&mask_rnhead_compat, 0) == 0) panic("rn_init 2"); +#ifdef _KERNEL + mtx_init(&mask_mtx, "radix_mask", NULL, MTX_DEF); +#endif } Modified: stable/10/sys/net/radix.h ============================================================================== --- stable/10/sys/net/radix.h Tue Oct 29 12:34:11 2013 (r257329) +++ stable/10/sys/net/radix.h Tue Oct 29 12:53:23 2013 (r257330) @@ -136,6 +136,7 @@ struct radix_node_head { #ifdef _KERNEL struct rwlock rnh_lock; /* locks entire radix tree */ #endif + struct radix_node_head *rnh_masks; /* Storage for our masks */ }; #ifndef _KERNEL @@ -167,6 +168,7 @@ int rn_detachhead(void **); int rn_refines(void *, void *); struct radix_node *rn_addmask(void *, int, int), + *rn_addmask_r(void *, struct radix_node_head *, int, int), *rn_addroute (void *, void *, struct radix_node_head *, struct radix_node [2]), *rn_delete(void *, void *, struct radix_node_head *), From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 14:07:42 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id ABD064AC; Tue, 29 Oct 2013 14:07:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9902E293D; Tue, 29 Oct 2013 14:07:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TE7gDK089587; Tue, 29 Oct 2013 14:07:42 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TE7gdb089586; Tue, 29 Oct 2013 14:07:42 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201310291407.r9TE7gdb089586@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 29 Oct 2013 14:07:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257339 - stable/10/sys/dev/iscsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 14:07:42 -0000 Author: trasz Date: Tue Oct 29 14:07:42 2013 New Revision: 257339 URL: http://svnweb.freebsd.org/changeset/base/257339 Log: MFC r257061: Don't spin with mutex hold when there is not enough room in the send socket buffer. While here, make the code flow somewhat nicer. Thanks to mav@ for tracking it down. Approved by: re (glebius) Modified: stable/10/sys/dev/iscsi/icl.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/iscsi/icl.c ============================================================================== --- stable/10/sys/dev/iscsi/icl.c Tue Oct 29 14:07:31 2013 (r257338) +++ stable/10/sys/dev/iscsi/icl.c Tue Oct 29 14:07:42 2013 (r257339) @@ -723,11 +723,7 @@ icl_receive_thread(void *arg) for (;;) { if (ic->ic_disconnecting) { //ICL_DEBUG("terminating"); - ICL_CONN_LOCK(ic); - ic->ic_receive_running = false; - ICL_CONN_UNLOCK(ic); - kthread_exit(); - return; + break; } SOCKBUF_LOCK(&so->so_rcv); @@ -740,6 +736,11 @@ icl_receive_thread(void *arg) icl_conn_receive_pdus(ic, available); } + + ICL_CONN_LOCK(ic); + ic->ic_receive_running = false; + ICL_CONN_UNLOCK(ic); + kthread_exit(); } static int @@ -879,22 +880,19 @@ icl_send_thread(void *arg) ICL_CONN_LOCK(ic); ic->ic_send_running = true; - ICL_CONN_UNLOCK(ic); for (;;) { - ICL_CONN_LOCK(ic); if (ic->ic_disconnecting) { //ICL_DEBUG("terminating"); - ic->ic_send_running = false; - ICL_CONN_UNLOCK(ic); - kthread_exit(); - return; + break; } - if (TAILQ_EMPTY(&ic->ic_to_send)) - cv_wait(&ic->ic_send_cv, &ic->ic_lock); icl_conn_send_pdus(ic); - ICL_CONN_UNLOCK(ic); + cv_wait(&ic->ic_send_cv, &ic->ic_lock); } + + ic->ic_send_running = false; + ICL_CONN_UNLOCK(ic); + kthread_exit(); } static int From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 18:36:46 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 925E517F; Tue, 29 Oct 2013 18:36:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6F72D2C71; Tue, 29 Oct 2013 18:36:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TIakaV082771; Tue, 29 Oct 2013 18:36:46 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TIaiXQ082763; Tue, 29 Oct 2013 18:36:44 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201310291836.r9TIaiXQ082763@svn.freebsd.org> From: Bryan Drewery Date: Tue, 29 Oct 2013 18:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257353 - in stable/10: etc etc/keys etc/mtree etc/pkg share/man/man7 usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 18:36:46 -0000 Author: bdrewery (ports committer) Date: Tue Oct 29 18:36:44 2013 New Revision: 257353 URL: http://svnweb.freebsd.org/changeset/base/257353 Log: MFC: r256770,r257142,r257145,r257146,r257147,r257148, r257149,r257150,r257158,r257159,r257164,r257168, r257193 - Support checking signature for pkg bootstrap from remote and for 'pkg add ./pkg.txz' - Be verbose on where pkg is being bootstrapped from. - Add support for reading configuration files from /etc/pkg. For now only /etc/pkg/FreeBSD.conf is supported. - Add test package signing key fingerprint into /etc/keys/pkg/trusted. - Disable fingerprint checking by default for now as the official packages are not yet signed. Approved by: bapt Approved by: re (glebius) Added: stable/10/etc/keys/ - copied from r257150, head/etc/keys/ stable/10/etc/pkg/ - copied from r257145, head/etc/pkg/ Modified: stable/10/etc/Makefile stable/10/etc/mtree/BSD.root.dist stable/10/etc/pkg/FreeBSD.conf stable/10/share/man/man7/hier.7 stable/10/usr.sbin/pkg/Makefile stable/10/usr.sbin/pkg/config.c stable/10/usr.sbin/pkg/config.h stable/10/usr.sbin/pkg/pkg.c Directory Properties: stable/10/etc/ (props changed) stable/10/share/man/man7/ (props changed) stable/10/usr.sbin/pkg/ (props changed) Modified: stable/10/etc/Makefile ============================================================================== --- stable/10/etc/Makefile Tue Oct 29 18:13:04 2013 (r257352) +++ stable/10/etc/Makefile Tue Oct 29 18:36:44 2013 (r257353) @@ -221,7 +221,11 @@ distribution: ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install ${_+_}cd ${.CURDIR}/devd; ${MAKE} install ${_+_}cd ${.CURDIR}/gss; ${MAKE} install + ${_+_}cd ${.CURDIR}/keys; ${MAKE} install ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install +.if ${MK_PKGBOOTSTRAP} != "no" + ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install +.endif ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install ${_+_}cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap Modified: stable/10/etc/mtree/BSD.root.dist ============================================================================== --- stable/10/etc/mtree/BSD.root.dist Tue Oct 29 18:13:04 2013 (r257352) +++ stable/10/etc/mtree/BSD.root.dist Tue Oct 29 18:36:44 2013 (r257353) @@ -34,6 +34,14 @@ .. gss .. + keys + pkg + revoked + .. + trusted + .. + .. + .. mail .. mtree @@ -52,6 +60,8 @@ weekly .. .. + pkg + .. ppp .. rc.d Modified: stable/10/etc/pkg/FreeBSD.conf ============================================================================== --- head/etc/pkg/FreeBSD.conf Sat Oct 26 03:31:05 2013 (r257145) +++ stable/10/etc/pkg/FreeBSD.conf Tue Oct 29 18:36:44 2013 (r257353) @@ -2,5 +2,7 @@ FreeBSD: { url: "pkg+http://pkg.freebsd.org/${ABI}/latest", mirror_type: "srv", + signature_type: "none", + fingerprints: "/etc/keys/pkg", enabled: "yes" } Modified: stable/10/share/man/man7/hier.7 ============================================================================== --- stable/10/share/man/man7/hier.7 Tue Oct 29 18:13:04 2013 (r257352) +++ stable/10/share/man/man7/hier.7 Tue Oct 29 18:36:44 2013 (r257353) @@ -32,7 +32,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 21, 2010 +.Dd October 23, 2013 .Dt HIER 7 .Os .Sh NAME @@ -94,6 +94,15 @@ bluetooth configuration files gnats configuration files; see .Xr send-pr 1 +.It Pa keys/ +known trusted and revoked keys. +.Pp +.Bl -tag -width ".Pa keys/pkg/" -compact +.It Pa keys/pkg/ +fingerprints for +.Xr pkg 8 +.El +.Pp .It Pa localtime local timezone information; see Modified: stable/10/usr.sbin/pkg/Makefile ============================================================================== --- stable/10/usr.sbin/pkg/Makefile Tue Oct 29 18:13:04 2013 (r257352) +++ stable/10/usr.sbin/pkg/Makefile Tue Oct 29 18:36:44 2013 (r257353) @@ -6,8 +6,9 @@ SRCS= pkg.c dns_utils.c config.c NO_MAN= yes CFLAGS+=-I${.CURDIR}/../../contrib/libyaml/include .PATH: ${.CURDIR}/../../contrib/libyaml/include -DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBYAML} ${LIBSBUF} -LDADD= -larchive -lelf -lfetch -lyaml -lsbuf +DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBYAML} ${LIBSBUF} ${LIBSSL} \ + ${LIBCRYPTO} +LDADD= -larchive -lelf -lfetch -lyaml -lsbuf -lssl -lcrypto USEPRIVATELIB= yaml .include Modified: stable/10/usr.sbin/pkg/config.c ============================================================================== --- stable/10/usr.sbin/pkg/config.c Tue Oct 29 18:13:04 2013 (r257352) +++ stable/10/usr.sbin/pkg/config.c Tue Oct 29 18:36:44 2013 (r257353) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2013 Baptiste Daroussin + * Copyright (c) 2013 Bryan Drewery * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,7 +87,21 @@ static struct config_entry c[] = { "NO", NULL, false, - } + }, + [SIGNATURE_TYPE] = { + PKG_CONFIG_STRING, + "SIGNATURE_TYPE", + NULL, + NULL, + false, + }, + [FINGERPRINTS] = { + PKG_CONFIG_STRING, + "FINGERPRINTS", + NULL, + NULL, + false, + }, }; static const char * @@ -460,7 +475,7 @@ subst_packagesite(const char *abi) } static void -config_parse(yaml_document_t *doc, yaml_node_t *node) +config_parse(yaml_document_t *doc, yaml_node_t *node, pkg_conf_file_t conftype) { yaml_node_pair_t *pair; yaml_node_t *key, *val; @@ -495,15 +510,39 @@ config_parse(yaml_document_t *doc, yaml_ } sbuf_clear(buf); - for (j = 0; j < strlen(key->data.scalar.value); ++j) - sbuf_putc(buf, toupper(key->data.scalar.value[j])); - sbuf_finish(buf); + if (conftype == CONFFILE_PKG) { + for (j = 0; j < strlen(key->data.scalar.value); ++j) + sbuf_putc(buf, + toupper(key->data.scalar.value[j])); + sbuf_finish(buf); + } else if (conftype == CONFFILE_REPO) { + /* The CONFFILE_REPO type is more restrictive. Only + parse known elements. */ + if (strcasecmp(key->data.scalar.value, "url") == 0) + sbuf_cpy(buf, "PACKAGESITE"); + else if (strcasecmp(key->data.scalar.value, + "mirror_type") == 0) + sbuf_cpy(buf, "MIRROR_TYPE"); + else if (strcasecmp(key->data.scalar.value, + "signature_type") == 0) + sbuf_cpy(buf, "SIGNATURE_TYPE"); + else if (strcasecmp(key->data.scalar.value, + "fingerprints") == 0) + sbuf_cpy(buf, "FINGERPRINTS"); + else { /* Skip unknown entries for future use. */ + ++pair; + continue; + } + sbuf_finish(buf); + } + for (i = 0; i < CONFIG_SIZE; i++) { if (strcmp(sbuf_data(buf), c[i].key) == 0) break; } + /* Silently skip unknown keys to be future compatible. */ if (i == CONFIG_SIZE) { ++pair; continue; @@ -522,13 +561,80 @@ config_parse(yaml_document_t *doc, yaml_ sbuf_delete(buf); } -int -config_init(void) +/*- + * Parse new repo style configs in style: + * Name: + * URL: + * MIRROR_TYPE: + * etc... + */ +static void +parse_repo_file(yaml_document_t *doc, yaml_node_t *node) +{ + yaml_node_pair_t *pair; + + pair = node->data.mapping.pairs.start; + while (pair < node->data.mapping.pairs.top) { + yaml_node_t *key = yaml_document_get_node(doc, pair->key); + yaml_node_t *val = yaml_document_get_node(doc, pair->value); + + if (key->data.scalar.length <= 0) { + ++pair; + continue; + } + + if (val->type != YAML_MAPPING_NODE) { + ++pair; + continue; + } + + config_parse(doc, val, CONFFILE_REPO); + ++pair; + } +} + + +static int +read_conf_file(const char *confpath, pkg_conf_file_t conftype) { FILE *fp; yaml_parser_t parser; yaml_document_t doc; yaml_node_t *node; + + if ((fp = fopen(confpath, "r")) == NULL) { + if (errno != ENOENT) + err(EXIT_FAILURE, "Unable to open configuration " + "file %s", confpath); + /* no configuration present */ + return (1); + } + + yaml_parser_initialize(&parser); + yaml_parser_set_input_file(&parser, fp); + yaml_parser_load(&parser, &doc); + + node = yaml_document_get_root_node(&doc); + + if (node == NULL || node->type != YAML_MAPPING_NODE) + warnx("Invalid configuration format, ignoring the " + "configuration file %s", confpath); + else { + if (conftype == CONFFILE_PKG) + config_parse(&doc, node, conftype); + else if (conftype == CONFFILE_REPO) + parse_repo_file(&doc, node); + } + + yaml_document_delete(&doc); + yaml_parser_delete(&parser); + + return (0); +} + +int +config_init(void) +{ const char *val; int i; const char *localbase; @@ -544,37 +650,23 @@ config_init(void) } localbase = getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE; - snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", localbase); + snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", + localbase); - if ((fp = fopen(confpath, "r")) == NULL) { - if (errno != ENOENT) - err(EXIT_FAILURE, "Unable to open configuration file %s", confpath); - /* no configuration present */ + if (access(confpath, F_OK) == 0 && read_conf_file(confpath, + CONFFILE_PKG)) goto finalize; - } - yaml_parser_initialize(&parser); - yaml_parser_set_input_file(&parser, fp); - yaml_parser_load(&parser, &doc); - - node = yaml_document_get_root_node(&doc); - - if (node != NULL) { - if (node->type != YAML_MAPPING_NODE) - warnx("Invalid configuration format, ignoring the configuration file"); - else - config_parse(&doc, node); - } else { - warnx("Invalid configuration format, ignoring the configuration file"); - } - - yaml_document_delete(&doc); - yaml_parser_delete(&parser); + snprintf(confpath, sizeof(confpath), "/etc/pkg/FreeBSD.conf"); + if (access(confpath, F_OK) == 0 && read_conf_file(confpath, + CONFFILE_REPO)) + goto finalize; finalize: if (c[ABI].val == NULL && c[ABI].value == NULL) { if (pkg_get_myabi(abi, BUFSIZ) != 0) - errx(EXIT_FAILURE, "Failed to determine the system ABI"); + errx(EXIT_FAILURE, "Failed to determine the system " + "ABI"); c[ABI].val = abi; } Modified: stable/10/usr.sbin/pkg/config.h ============================================================================== --- stable/10/usr.sbin/pkg/config.h Tue Oct 29 18:13:04 2013 (r257352) +++ stable/10/usr.sbin/pkg/config.h Tue Oct 29 18:36:44 2013 (r257353) @@ -37,6 +37,8 @@ typedef enum { ABI, MIRROR_TYPE, ASSUME_ALWAYS_YES, + SIGNATURE_TYPE, + FINGERPRINTS, CONFIG_SIZE } pkg_config_key; @@ -45,6 +47,11 @@ typedef enum { PKG_CONFIG_BOOL, } pkg_config_t; +typedef enum { + CONFFILE_PKG=0, + CONFFILE_REPO, +} pkg_conf_file_t; + int config_init(void); void config_finish(void); int config_string(pkg_config_key, const char **); Modified: stable/10/usr.sbin/pkg/pkg.c ============================================================================== --- stable/10/usr.sbin/pkg/pkg.c Tue Oct 29 18:13:04 2013 (r257352) +++ stable/10/usr.sbin/pkg/pkg.c Tue Oct 29 18:36:44 2013 (r257353) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2012-2013 Baptiste Daroussin + * Copyright (c) 2013 Bryan Drewery * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,10 +29,15 @@ __FBSDID("$FreeBSD$"); #include +#include +#include +#include #include +#define _WITH_GETLINE #include #include +#include #include #include #include @@ -43,10 +49,37 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + +#include +#include #include "dns_utils.h" #include "config.h" +struct sig_cert { + char *name; + unsigned char *sig; + int siglen; + unsigned char *cert; + int certlen; + bool trusted; +}; + +typedef enum { + HASH_UNKNOWN, + HASH_SHA256, +} hash_t; + +struct fingerprint { + hash_t type; + char *name; + char hash[BUFSIZ]; + STAILQ_ENTRY(fingerprint) next; +}; + +STAILQ_HEAD(fingerprint_list, fingerprint); + static int extract_pkg_static(int fd, char *p, int sz) { @@ -102,7 +135,7 @@ cleanup: } static int -install_pkg_static(char *path, char *pkgpath) +install_pkg_static(const char *path, const char *pkgpath) { int pstat; pid_t pid; @@ -129,58 +162,34 @@ install_pkg_static(char *path, char *pkg } static int -bootstrap_pkg(void) +fetch_to_fd(const char *url, char *path) { struct url *u; - FILE *remote; - FILE *config; - char *site; struct dns_srvinfo *mirrors, *current; - /* To store _https._tcp. + hostname + \0 */ - char zone[MAXHOSTNAMELEN + 13]; - char url[MAXPATHLEN]; - char conf[MAXPATHLEN]; - char tmppkg[MAXPATHLEN]; - const char *packagesite, *mirror_type; - char buf[10240]; - char pkgstatic[MAXPATHLEN]; - int fd, retry, ret, max_retry; struct url_stat st; + FILE *remote; + /* To store _https._tcp. + hostname + \0 */ + int fd; + int retry, max_retry; off_t done, r; - time_t now; - time_t last; + time_t now, last; + char buf[10240]; + char zone[MAXHOSTNAMELEN + 13]; + static const char *mirror_type = NULL; done = 0; last = 0; max_retry = 3; - ret = -1; - remote = NULL; - config = NULL; current = mirrors = NULL; + remote = NULL; - printf("Bootstrapping pkg please wait\n"); - - if (config_string(PACKAGESITE, &packagesite) != 0) { - warnx("No PACKAGESITE defined"); - return (-1); - } - if (config_string(MIRROR_TYPE, &mirror_type) != 0) { + if (mirror_type == NULL && config_string(MIRROR_TYPE, &mirror_type) + != 0) { warnx("No MIRROR_TYPE defined"); return (-1); } - /* Support pkg+http:// for PACKAGESITE which is the new format - in 1.2 to avoid confusion on why http://pkg.FreeBSD.org has - no A record. */ - if (strncmp(URL_SCHEME_PREFIX, packagesite, - strlen(URL_SCHEME_PREFIX)) == 0) - packagesite += strlen(URL_SCHEME_PREFIX); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite); - - snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - - if ((fd = mkstemp(tmppkg)) == -1) { + if ((fd = mkstemp(path)) == -1) { warn("mkstemp()"); return (-1); } @@ -228,7 +237,7 @@ bootstrap_pkg(void) if (write(fd, buf, r) != r) { warn("write()"); - goto cleanup; + goto fetchfail; } done += r; @@ -240,7 +249,558 @@ bootstrap_pkg(void) if (ferror(remote)) goto fetchfail; - if ((ret = extract_pkg_static(fd, pkgstatic, MAXPATHLEN)) == 0) + goto cleanup; + +fetchfail: + if (fd != -1) { + close(fd); + fd = -1; + unlink(path); + } + +cleanup: + if (remote != NULL) + fclose(remote); + + return fd; +} + +static struct fingerprint * +parse_fingerprint(yaml_document_t *doc, yaml_node_t *node) +{ + yaml_node_pair_t *pair; + yaml_char_t *function, *fp; + struct fingerprint *f; + hash_t fct = HASH_UNKNOWN; + + function = fp = NULL; + + pair = node->data.mapping.pairs.start; + while (pair < node->data.mapping.pairs.top) { + yaml_node_t *key = yaml_document_get_node(doc, pair->key); + yaml_node_t *val = yaml_document_get_node(doc, pair->value); + + if (key->data.scalar.length <= 0) { + ++pair; + continue; + } + + if (val->type != YAML_SCALAR_NODE) { + ++pair; + continue; + } + + if (strcasecmp(key->data.scalar.value, "function") == 0) + function = val->data.scalar.value; + else if (strcasecmp(key->data.scalar.value, "fingerprint") + == 0) + fp = val->data.scalar.value; + + ++pair; + continue; + } + + if (fp == NULL || function == NULL) + return (NULL); + + if (strcasecmp(function, "sha256") == 0) + fct = HASH_SHA256; + + if (fct == HASH_UNKNOWN) { + fprintf(stderr, "Unsupported hashing function: %s\n", function); + return (NULL); + } + + f = calloc(1, sizeof(struct fingerprint)); + f->type = fct; + strlcpy(f->hash, fp, sizeof(f->hash)); + + return (f); +} + +static void +free_fingerprint_list(struct fingerprint_list* list) +{ + struct fingerprint* fingerprint; + + STAILQ_FOREACH(fingerprint, list, next) { + if (fingerprint->name) + free(fingerprint->name); + free(fingerprint); + } + free(list); +} + +static struct fingerprint * +load_fingerprint(const char *dir, const char *filename) +{ + yaml_parser_t parser; + yaml_document_t doc; + yaml_node_t *node; + FILE *fp; + struct fingerprint *f; + char path[MAXPATHLEN]; + + f = NULL; + + snprintf(path, MAXPATHLEN, "%s/%s", dir, filename); + + if ((fp = fopen(path, "r")) == NULL) + return (NULL); + + yaml_parser_initialize(&parser); + yaml_parser_set_input_file(&parser, fp); + yaml_parser_load(&parser, &doc); + + node = yaml_document_get_root_node(&doc); + if (node == NULL || node->type != YAML_MAPPING_NODE) + goto out; + + f = parse_fingerprint(&doc, node); + f->name = strdup(filename); + +out: + yaml_document_delete(&doc); + yaml_parser_delete(&parser); + fclose(fp); + + return (f); +} + +static struct fingerprint_list * +load_fingerprints(const char *path, int *count) +{ + DIR *d; + struct dirent *ent; + struct fingerprint *finger; + struct fingerprint_list *fingerprints; + + *count = 0; + + fingerprints = calloc(1, sizeof(struct fingerprint_list)); + if (fingerprints == NULL) + return (NULL); + STAILQ_INIT(fingerprints); + + if ((d = opendir(path)) == NULL) + return (NULL); + + while ((ent = readdir(d))) { + if (strcmp(ent->d_name, ".") == 0 || + strcmp(ent->d_name, "..") == 0) + continue; + finger = load_fingerprint(path, ent->d_name); + if (finger != NULL) { + STAILQ_INSERT_TAIL(fingerprints, finger, next); + ++(*count); + } + } + + closedir(d); + + return (fingerprints); +} + +static void +sha256_hash(unsigned char hash[SHA256_DIGEST_LENGTH], + char out[SHA256_DIGEST_LENGTH * 2 + 1]) +{ + int i; + + for (i = 0; i < SHA256_DIGEST_LENGTH; i++) + sprintf(out + (i * 2), "%02x", hash[i]); + + out[SHA256_DIGEST_LENGTH * 2] = '\0'; +} + +static void +sha256_buf(char *buf, size_t len, char out[SHA256_DIGEST_LENGTH * 2 + 1]) +{ + unsigned char hash[SHA256_DIGEST_LENGTH]; + SHA256_CTX sha256; + + out[0] = '\0'; + + SHA256_Init(&sha256); + SHA256_Update(&sha256, buf, len); + SHA256_Final(hash, &sha256); + sha256_hash(hash, out); +} + +static int +sha256_fd(int fd, char out[SHA256_DIGEST_LENGTH * 2 + 1]) +{ + int my_fd; + FILE *fp; + char buffer[BUFSIZ]; + unsigned char hash[SHA256_DIGEST_LENGTH]; + size_t r; + int ret; + SHA256_CTX sha256; + + my_fd = -1; + fp = NULL; + r = 0; + ret = 1; + + out[0] = '\0'; + + /* Duplicate the fd so that fclose(3) does not close it. */ + if ((my_fd = dup(fd)) == -1) { + warnx("dup"); + goto cleanup; + } + + if ((fp = fdopen(my_fd, "rb")) == NULL) { + warnx("fdopen"); + goto cleanup; + } + + SHA256_Init(&sha256); + + while ((r = fread(buffer, 1, BUFSIZ, fp)) > 0) + SHA256_Update(&sha256, buffer, r); + + if (ferror(fp) != 0) { + warnx("fread"); + goto cleanup; + } + + SHA256_Final(hash, &sha256); + sha256_hash(hash, out); + ret = 0; + +cleanup: + if (fp != NULL) + fclose(fp); + else if (my_fd != -1) + close(my_fd); + (void)lseek(fd, 0, SEEK_SET); + + return (ret); +} + +static EVP_PKEY * +load_public_key_buf(const unsigned char *cert, int certlen) +{ + EVP_PKEY *pkey; + BIO *bp; + char errbuf[1024]; + + bp = BIO_new_mem_buf(__DECONST(void *, cert), certlen); + + if ((pkey = PEM_read_bio_PUBKEY(bp, NULL, NULL, NULL)) == NULL) + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + + BIO_free(bp); + + return (pkey); +} + +static bool +rsa_verify_cert(int fd, const unsigned char *key, int keylen, + unsigned char *sig, int siglen) +{ + EVP_MD_CTX *mdctx; + EVP_PKEY *pkey; + char sha256[(SHA256_DIGEST_LENGTH * 2) + 2]; + char errbuf[1024]; + bool ret; + + pkey = NULL; + mdctx = NULL; + ret = false; + + /* Compute SHA256 of the package. */ + if (lseek(fd, 0, 0) == -1) { + warn("lseek"); + goto cleanup; + } + if ((sha256_fd(fd, sha256)) == -1) { + warnx("Error creating SHA256 hash for package"); + goto cleanup; + } + + if ((pkey = load_public_key_buf(key, keylen)) == NULL) { + warnx("Error reading public key"); + goto cleanup; + } + + /* Verify signature of the SHA256(pkg) is valid. */ + if ((mdctx = EVP_MD_CTX_create()) == NULL) { + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + goto error; + } + + if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, pkey) != 1) { + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + goto error; + } + if (EVP_DigestVerifyUpdate(mdctx, sha256, strlen(sha256)) != 1) { + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + goto error; + } + + if (EVP_DigestVerifyFinal(mdctx, sig, siglen) != 1) { + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + goto error; + } + + ret = true; + printf("done\n"); + goto cleanup; + +error: + printf("failed\n"); + +cleanup: + if (pkey) + EVP_PKEY_free(pkey); + if (mdctx) + EVP_MD_CTX_destroy(mdctx); + ERR_free_strings(); + + return (ret); +} + +static struct sig_cert * +parse_cert(int fd) { + int my_fd; + struct sig_cert *sc; + FILE *fp; + struct sbuf *buf, *sig, *cert; + char *line; + size_t linecap; + ssize_t linelen; + + buf = NULL; + my_fd = -1; + sc = NULL; + line = NULL; + linecap = 0; + + if (lseek(fd, 0, 0) == -1) { + warn("lseek"); + return (NULL); + } + + /* Duplicate the fd so that fclose(3) does not close it. */ + if ((my_fd = dup(fd)) == -1) { + warnx("dup"); + return (NULL); + } + + if ((fp = fdopen(my_fd, "rb")) == NULL) { + warn("fdopen"); + close(my_fd); + return (NULL); + } + + sig = sbuf_new_auto(); + cert = sbuf_new_auto(); + + while ((linelen = getline(&line, &linecap, fp)) > 0) { + if (strcmp(line, "SIGNATURE\n") == 0) { + buf = sig; + continue; + } else if (strcmp(line, "CERT\n") == 0) { + buf = cert; + continue; + } else if (strcmp(line, "END\n") == 0) { + break; + } + if (buf != NULL) + sbuf_bcat(buf, line, linelen); + } + + fclose(fp); + + /* Trim out unrelated trailing newline */ + sbuf_setpos(sig, sbuf_len(sig) - 1); + + sbuf_finish(sig); + sbuf_finish(cert); + + sc = calloc(1, sizeof(struct sig_cert)); + sc->siglen = sbuf_len(sig); + sc->sig = calloc(1, sc->siglen); + memcpy(sc->sig, sbuf_data(sig), sc->siglen); + + sc->certlen = sbuf_len(cert); + sc->cert = strdup(sbuf_data(cert)); + + sbuf_delete(sig); + sbuf_delete(cert); + + return (sc); +} + +static bool +verify_signature(int fd_pkg, int fd_sig) +{ + struct fingerprint_list *trusted, *revoked; + struct fingerprint *fingerprint; + struct sig_cert *sc; + bool ret; + int trusted_count, revoked_count; + const char *fingerprints; + char path[MAXPATHLEN]; + char hash[SHA256_DIGEST_LENGTH * 2 + 1]; + + sc = NULL; + trusted = revoked = NULL; + ret = false; + + /* Read and parse fingerprints. */ + if (config_string(FINGERPRINTS, &fingerprints) != 0) { + warnx("No CONFIG_FINGERPRINTS defined"); + goto cleanup; + } + + snprintf(path, MAXPATHLEN, "%s/trusted", fingerprints); + if ((trusted = load_fingerprints(path, &trusted_count)) == NULL) { + warnx("Error loading trusted certificates"); + goto cleanup; + } + + if (trusted_count == 0 || trusted == NULL) { + fprintf(stderr, "No trusted certificates found.\n"); + goto cleanup; + } + + snprintf(path, MAXPATHLEN, "%s/revoked", fingerprints); + if ((revoked = load_fingerprints(path, &revoked_count)) == NULL) { + warnx("Error loading revoked certificates"); + goto cleanup; + } + + /* Read certificate and signature in. */ + if ((sc = parse_cert(fd_sig)) == NULL) { + warnx("Error parsing certificate"); + goto cleanup; + } + /* Explicitly mark as non-trusted until proven otherwise. */ + sc->trusted = false; + + /* Parse signature and pubkey out of the certificate */ + sha256_buf(sc->cert, sc->certlen, hash); + + /* Check if this hash is revoked */ + if (revoked != NULL) { + STAILQ_FOREACH(fingerprint, revoked, next) { + if (strcasecmp(fingerprint->hash, hash) == 0) { + fprintf(stderr, "The package was signed with " + "revoked certificate %s\n", + fingerprint->name); + goto cleanup; + } + } + } + + STAILQ_FOREACH(fingerprint, trusted, next) { + if (strcasecmp(fingerprint->hash, hash) == 0) { + sc->trusted = true; + sc->name = strdup(fingerprint->name); + break; + } + } + + if (sc->trusted == false) { + fprintf(stderr, "No trusted fingerprint found matching " + "package's certificate\n"); + goto cleanup; + } + + /* Verify the signature. */ + printf("Verifying signature with trusted certificate %s... ", sc->name); + if (rsa_verify_cert(fd_pkg, sc->cert, sc->certlen, sc->sig, + sc->siglen) == false) { + fprintf(stderr, "Signature is not valid\n"); + goto cleanup; + } + + ret = true; + +cleanup: + if (trusted) + free_fingerprint_list(trusted); + if (revoked) + free_fingerprint_list(revoked); + if (sc) { + if (sc->cert) + free(sc->cert); + if (sc->sig) + free(sc->sig); + if (sc->name) + free(sc->name); + free(sc); + } + + return (ret); +} + +static int +bootstrap_pkg(void) +{ + FILE *config; + int fd_pkg, fd_sig; + int ret; + char *site; + char url[MAXPATHLEN]; + char conf[MAXPATHLEN]; + char tmppkg[MAXPATHLEN]; + char tmpsig[MAXPATHLEN]; + const char *packagesite; + const char *signature_type; + char pkgstatic[MAXPATHLEN]; + + fd_sig = -1; + ret = -1; + config = NULL; + + if (config_string(PACKAGESITE, &packagesite) != 0) { + warnx("No PACKAGESITE defined"); + return (-1); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 18:37:39 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7B6442B4; Tue, 29 Oct 2013 18:37:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 645212C7C; Tue, 29 Oct 2013 18:37:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TIbdgW082898; Tue, 29 Oct 2013 18:37:39 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TIbdtC082897; Tue, 29 Oct 2013 18:37:39 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201310291837.r9TIbdtC082897@svn.freebsd.org> From: Bryan Drewery Date: Tue, 29 Oct 2013 18:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257354 - stable/10/share/man/man7 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 18:37:39 -0000 Author: bdrewery (ports committer) Date: Tue Oct 29 18:37:38 2013 New Revision: 257354 URL: http://svnweb.freebsd.org/changeset/base/257354 Log: MFC r257151: Document /var/cache/pkg into hier(7) which pkg(8) uses. Approved by: bapt Approved by: re (glebius) Modified: stable/10/share/man/man7/hier.7 Directory Properties: stable/10/share/man/man7/ (props changed) Modified: stable/10/share/man/man7/hier.7 ============================================================================== --- stable/10/share/man/man7/hier.7 Tue Oct 29 18:36:44 2013 (r257353) +++ stable/10/share/man/man7/hier.7 Tue Oct 29 18:37:38 2013 (r257354) @@ -729,6 +729,14 @@ directory containing output spool files .Pp .It Pa backups/ miscellaneous backup files +.It Pa cache/ +miscellaneous cached files +.Bl -tag -width ".Pa pkg/" -compact +.It Pa pkg/ +cached packages for +.Xr pkg 8 +.El +.Pp .It Pa crash/ default directory to store kernel crash dumps; see .Xr crash 8 From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 19:50:41 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3FD82D09; Tue, 29 Oct 2013 19:50:41 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2BDAC212A; Tue, 29 Oct 2013 19:50:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TJofNM007986; Tue, 29 Oct 2013 19:50:41 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TJofXk007985; Tue, 29 Oct 2013 19:50:41 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201310291950.r9TJofXk007985@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Tue, 29 Oct 2013 19:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257358 - stable/10/sys/dev/drm2/radeon X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 19:50:41 -0000 Author: dumbbell Date: Tue Oct 29 19:50:40 2013 New Revision: 257358 URL: http://svnweb.freebsd.org/changeset/base/257358 Log: MFC r256771: drm/radeon: radeonkms depends on firmware(9) Submitted by: tijl@ Approved by: re (kib) Modified: stable/10/sys/dev/drm2/radeon/radeon_drv.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/drm2/radeon/radeon_drv.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_drv.c Tue Oct 29 18:47:07 2013 (r257357) +++ stable/10/sys/dev/drm2/radeon/radeon_drv.c Tue Oct 29 19:50:40 2013 (r257358) @@ -512,3 +512,4 @@ MODULE_DEPEND(radeonkms, agp, 1, 1, 1); MODULE_DEPEND(radeonkms, iicbus, 1, 1, 1); MODULE_DEPEND(radeonkms, iic, 1, 1, 1); MODULE_DEPEND(radeonkms, iicbb, 1, 1, 1); +MODULE_DEPEND(radeonkms, firmware, 1, 1, 1); From owner-svn-src-stable-10@FreeBSD.ORG Tue Oct 29 21:00:55 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0E2222CE; Tue, 29 Oct 2013 21:00:55 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D49A4270B; Tue, 29 Oct 2013 21:00:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9TL0sRL034735; Tue, 29 Oct 2013 21:00:54 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9TL0sRR034734; Tue, 29 Oct 2013 21:00:54 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310292100.r9TL0sRR034734@svn.freebsd.org> From: Andre Oppermann Date: Tue, 29 Oct 2013 21:00:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257367 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 21:00:55 -0000 Author: andre Date: Tue Oct 29 21:00:54 2013 New Revision: 257367 URL: http://svnweb.freebsd.org/changeset/base/257367 Log: MFC r256920: The TCP delayed ACK logic isn't aware of LRO passing up large aggregated segments thinking it received only one segment. This causes it to enable the delay the ACK for 100ms to wait for another segment which may never come because all the data was received already. Doing delayed ACK for LRO segments is bogus for two reasons: a) it pushes us further away from acking every other packet; b) it introduces additional delay in responding to the sender. The latter is especially bad because it is in the nature of LRO to aggregated all segments of a burst with no more coming until an ACK is sent back. Change the delayed ACK logic to detect LRO segments by being larger than the MSS for this connection and issuing an immediate ACK for them to keep the ACK clock ticking without interruption. Reported by: julian, cperciva Tested by: cperciva Reviewed by: lstewart Approved by: re (glebius) Modified: stable/10/sys/netinet/tcp_input.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Tue Oct 29 20:53:09 2013 (r257366) +++ stable/10/sys/netinet/tcp_input.c Tue Oct 29 21:00:54 2013 (r257367) @@ -508,10 +508,13 @@ do { \ * the ack that opens up a 0-sized window and * - delayed acks are enabled or * - this is a half-synchronized T/TCP connection. + * - the segment size is not larger than the MSS and LRO wasn't used + * for this segment. */ -#define DELAY_ACK(tp) \ +#define DELAY_ACK(tp, tlen) \ ((!tcp_timer_active(tp, TT_DELACK) && \ (tp->t_flags & TF_RXWIN0SENT) == 0) && \ + (tlen <= tp->t_maxopd) && \ (V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN))) /* @@ -1863,7 +1866,7 @@ tcp_do_segment(struct mbuf *m, struct tc } /* NB: sorwakeup_locked() does an implicit unlock. */ sorwakeup_locked(so); - if (DELAY_ACK(tp)) { + if (DELAY_ACK(tp, tlen)) { tp->t_flags |= TF_DELACK; } else { tp->t_flags |= TF_ACKNOW; @@ -1954,7 +1957,7 @@ tcp_do_segment(struct mbuf *m, struct tc * If there's data, delay ACK; if there's also a FIN * ACKNOW will be turned on later. */ - if (DELAY_ACK(tp) && tlen != 0) + if (DELAY_ACK(tp, tlen) && tlen != 0) tcp_timer_activate(tp, TT_DELACK, tcp_delacktime); else @@ -2926,7 +2929,7 @@ dodata: /* XXX */ if (th->th_seq == tp->rcv_nxt && LIST_EMPTY(&tp->t_segq) && TCPS_HAVEESTABLISHED(tp->t_state)) { - if (DELAY_ACK(tp)) + if (DELAY_ACK(tp, tlen)) tp->t_flags |= TF_DELACK; else tp->t_flags |= TF_ACKNOW; From owner-svn-src-stable-10@FreeBSD.ORG Wed Oct 30 03:53:42 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 453301E8; Wed, 30 Oct 2013 03:53:42 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 089E5201A; Wed, 30 Oct 2013 03:53:41 +0000 (UTC) Received: from Julian-MBP3.local (ppp121-45-253-246.lns20.per2.internode.on.net [121.45.253.246]) (authenticated bits=0) by vps1.elischer.org (8.14.7/8.14.7) with ESMTP id r9U3rbJ9021685 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 29 Oct 2013 20:53:39 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <527082BB.5000300@freebsd.org> Date: Wed, 30 Oct 2013 11:53:31 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Andre Oppermann , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r257367 - stable/10/sys/netinet References: <201310292100.r9TL0sRR034734@svn.freebsd.org> In-Reply-To: <201310292100.r9TL0sRR034734@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 03:53:42 -0000 I think 9 needs this too... On 10/30/13, 5:00 AM, Andre Oppermann wrote: > Author: andre > Date: Tue Oct 29 21:00:54 2013 > New Revision: 257367 > URL: http://svnweb.freebsd.org/changeset/base/257367 > > Log: > MFC r256920: > > The TCP delayed ACK logic isn't aware of LRO passing up large aggregated > segments thinking it received only one segment. This causes it to enable > the delay the ACK for 100ms to wait for another segment which may never > come because all the data was received already. > > Doing delayed ACK for LRO segments is bogus for two reasons: a) it pushes > us further away from acking every other packet; b) it introduces additional > delay in responding to the sender. The latter is especially bad because it > is in the nature of LRO to aggregated all segments of a burst with no more > coming until an ACK is sent back. > > Change the delayed ACK logic to detect LRO segments by being larger than > the MSS for this connection and issuing an immediate ACK for them to keep > the ACK clock ticking without interruption. > > Reported by: julian, cperciva > Tested by: cperciva > Reviewed by: lstewart > > Approved by: re (glebius) > > Modified: > stable/10/sys/netinet/tcp_input.c > Directory Properties: > stable/10/sys/ (props changed) > > Modified: stable/10/sys/netinet/tcp_input.c > ============================================================================== > --- stable/10/sys/netinet/tcp_input.c Tue Oct 29 20:53:09 2013 (r257366) > +++ stable/10/sys/netinet/tcp_input.c Tue Oct 29 21:00:54 2013 (r257367) > @@ -508,10 +508,13 @@ do { \ > * the ack that opens up a 0-sized window and > * - delayed acks are enabled or > * - this is a half-synchronized T/TCP connection. > + * - the segment size is not larger than the MSS and LRO wasn't used > + * for this segment. > */ > -#define DELAY_ACK(tp) \ > +#define DELAY_ACK(tp, tlen) \ > ((!tcp_timer_active(tp, TT_DELACK) && \ > (tp->t_flags & TF_RXWIN0SENT) == 0) && \ > + (tlen <= tp->t_maxopd) && \ > (V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN))) > > /* > @@ -1863,7 +1866,7 @@ tcp_do_segment(struct mbuf *m, struct tc > } > /* NB: sorwakeup_locked() does an implicit unlock. */ > sorwakeup_locked(so); > - if (DELAY_ACK(tp)) { > + if (DELAY_ACK(tp, tlen)) { > tp->t_flags |= TF_DELACK; > } else { > tp->t_flags |= TF_ACKNOW; > @@ -1954,7 +1957,7 @@ tcp_do_segment(struct mbuf *m, struct tc > * If there's data, delay ACK; if there's also a FIN > * ACKNOW will be turned on later. > */ > - if (DELAY_ACK(tp) && tlen != 0) > + if (DELAY_ACK(tp, tlen) && tlen != 0) > tcp_timer_activate(tp, TT_DELACK, > tcp_delacktime); > else > @@ -2926,7 +2929,7 @@ dodata: /* XXX */ > if (th->th_seq == tp->rcv_nxt && > LIST_EMPTY(&tp->t_segq) && > TCPS_HAVEESTABLISHED(tp->t_state)) { > - if (DELAY_ACK(tp)) > + if (DELAY_ACK(tp, tlen)) > tp->t_flags |= TF_DELACK; > else > tp->t_flags |= TF_ACKNOW; > From owner-svn-src-stable-10@FreeBSD.ORG Wed Oct 30 08:05:40 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7D3CE826; Wed, 30 Oct 2013 08:05:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5B8CA2C03; Wed, 30 Oct 2013 08:05:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9U85eHE074980; Wed, 30 Oct 2013 08:05:40 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9U85dIV074972; Wed, 30 Oct 2013 08:05:39 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201310300805.r9U85dIV074972@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 30 Oct 2013 08:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257375 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 08:05:40 -0000 Author: hselasky Date: Wed Oct 30 08:05:39 2013 New Revision: 257375 URL: http://svnweb.freebsd.org/changeset/base/257375 Log: MFC r257206: Fix a deadlock when trying to power off a USB device. The deadlock happens because the code in question is trying to modify the parent USB port registers outside the USB explore thread. Approved by: re (glebius) Modified: stable/10/sys/dev/usb/usb_dev.c stable/10/sys/dev/usb/usb_device.h stable/10/sys/dev/usb/usb_generic.c stable/10/sys/dev/usb/usb_hub.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/usb/usb_dev.c ============================================================================== --- stable/10/sys/dev/usb/usb_dev.c Wed Oct 30 07:51:08 2013 (r257374) +++ stable/10/sys/dev/usb/usb_dev.c Wed Oct 30 08:05:39 2013 (r257375) @@ -1099,7 +1099,7 @@ usb_ioctl(struct cdev *dev, u_long cmd, /* Wait for re-enumeration, if any */ - while (f->udev->re_enumerate_wait != 0) { + while (f->udev->re_enumerate_wait != USB_RE_ENUM_DONE) { usb_unref_device(cpd, &refs); Modified: stable/10/sys/dev/usb/usb_device.h ============================================================================== --- stable/10/sys/dev/usb/usb_device.h Wed Oct 30 07:51:08 2013 (r257374) +++ stable/10/sys/dev/usb/usb_device.h Wed Oct 30 08:05:39 2013 (r257375) @@ -238,6 +238,9 @@ struct usb_device { uint8_t driver_added_refcount; /* our driver added generation count */ uint8_t power_mode; /* see USB_POWER_XXX */ uint8_t re_enumerate_wait; /* set if re-enum. is in progress */ +#define USB_RE_ENUM_DONE 0 +#define USB_RE_ENUM_START 1 +#define USB_RE_ENUM_PWR_OFF 2 uint8_t ifaces_max; /* number of interfaces present */ uint8_t endpoints_max; /* number of endpoints present */ Modified: stable/10/sys/dev/usb/usb_generic.c ============================================================================== --- stable/10/sys/dev/usb/usb_generic.c Wed Oct 30 07:51:08 2013 (r257374) +++ stable/10/sys/dev/usb/usb_generic.c Wed Oct 30 08:05:39 2013 (r257375) @@ -1762,16 +1762,11 @@ ugen_set_power_mode(struct usb_fifo *f, switch (mode) { case USB_POWER_MODE_OFF: - /* get the device unconfigured */ - err = ugen_set_config(f, USB_UNCONFIG_INDEX); - if (err) { - DPRINTFN(0, "Could not unconfigure " - "device (ignored)\n"); + if (udev->flags.usb_mode == USB_MODE_HOST && + udev->re_enumerate_wait == USB_RE_ENUM_DONE) { + udev->re_enumerate_wait = USB_RE_ENUM_PWR_OFF; } - - /* clear port enable */ - err = usbd_req_clear_port_feature(udev->parent_hub, - NULL, udev->port_no, UHF_PORT_ENABLE); + /* set power mode will wake up the explore thread */ break; case USB_POWER_MODE_ON: @@ -1819,9 +1814,9 @@ ugen_set_power_mode(struct usb_fifo *f, /* if we are powered off we need to re-enumerate first */ if (old_mode == USB_POWER_MODE_OFF) { - if (udev->flags.usb_mode == USB_MODE_HOST) { - if (udev->re_enumerate_wait == 0) - udev->re_enumerate_wait = 1; + if (udev->flags.usb_mode == USB_MODE_HOST && + udev->re_enumerate_wait == USB_RE_ENUM_DONE) { + udev->re_enumerate_wait = USB_RE_ENUM_START; } /* set power mode will wake up the explore thread */ } Modified: stable/10/sys/dev/usb/usb_hub.c ============================================================================== --- stable/10/sys/dev/usb/usb_hub.c Wed Oct 30 07:51:08 2013 (r257374) +++ stable/10/sys/dev/usb/usb_hub.c Wed Oct 30 08:05:39 2013 (r257375) @@ -248,7 +248,8 @@ uhub_explore_sub(struct uhub_softc *sc, uint8_t do_unlock; do_unlock = usbd_enum_lock(child); - if (child->re_enumerate_wait) { + switch (child->re_enumerate_wait) { + case USB_RE_ENUM_START: err = usbd_set_config_index(child, USB_UNCONFIG_INDEX); if (err != 0) { @@ -263,8 +264,33 @@ uhub_explore_sub(struct uhub_softc *sc, err = usb_probe_and_attach(child, USB_IFACE_INDEX_ANY); } - child->re_enumerate_wait = 0; + child->re_enumerate_wait = USB_RE_ENUM_DONE; err = 0; + break; + + case USB_RE_ENUM_PWR_OFF: + /* get the device unconfigured */ + err = usbd_set_config_index(child, + USB_UNCONFIG_INDEX); + if (err) { + DPRINTFN(0, "Could not unconfigure " + "device (ignored)\n"); + } + + /* clear port enable */ + err = usbd_req_clear_port_feature(child->parent_hub, + NULL, child->port_no, UHF_PORT_ENABLE); + if (err) { + DPRINTFN(0, "Could not disable port " + "(ignored)\n"); + } + child->re_enumerate_wait = USB_RE_ENUM_DONE; + err = 0; + break; + + default: + child->re_enumerate_wait = USB_RE_ENUM_DONE; + break; } if (do_unlock) usbd_enum_unlock(child); @@ -2086,7 +2112,7 @@ usb_peer_should_wakeup(struct usb_device return (((udev->power_mode == USB_POWER_MODE_ON) && (udev->flags.usb_mode == USB_MODE_HOST)) || (udev->driver_added_refcount != udev->bus->driver_added_refcount) || - (udev->re_enumerate_wait != 0) || + (udev->re_enumerate_wait != USB_RE_ENUM_DONE) || (udev->pwr_save.type_refs[UE_ISOCHRONOUS] != 0) || (udev->pwr_save.write_refs != 0) || ((udev->pwr_save.read_refs != 0) && @@ -2502,6 +2528,8 @@ usbd_set_power_mode(struct usb_device *u #if USB_HAVE_POWERD usb_bus_power_update(udev->bus); +#else + usb_needs_explore(udev->bus, 0 /* no probe */ ); #endif } @@ -2540,8 +2568,8 @@ usbd_filter_power_mode(struct usb_device void usbd_start_re_enumerate(struct usb_device *udev) { - if (udev->re_enumerate_wait == 0) { - udev->re_enumerate_wait = 1; + if (udev->re_enumerate_wait == USB_RE_ENUM_DONE) { + udev->re_enumerate_wait = USB_RE_ENUM_START; usb_needs_explore(udev->bus, 0); } } From owner-svn-src-stable-10@FreeBSD.ORG Wed Oct 30 20:42:12 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AAE0AFDA; Wed, 30 Oct 2013 20:42:12 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 96AA42204; Wed, 30 Oct 2013 20:42:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9UKgC3M039761; Wed, 30 Oct 2013 20:42:12 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9UKgAgJ039738; Wed, 30 Oct 2013 20:42:10 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201310302042.r9UKgAgJ039738@svn.freebsd.org> From: Neel Natu Date: Wed, 30 Oct 2013 20:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257396 - in stable/10: share/examples/bhyve usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 20:42:12 -0000 Author: neel Date: Wed Oct 30 20:42:09 2013 New Revision: 257396 URL: http://svnweb.freebsd.org/changeset/base/257396 Log: MFC r257293. Add support for PCI-to-ISA LPC bridge emulation. If the LPC bus is attached to a virtual machine then we implicitly create COM1 and COM2 ISA devices. Prior to this change the only way of attaching a COM port to the virtual machine was by presenting it as a PCI device that is mapped at the legacy I/O address 0x3F8 or 0x2F8. There were some issues with the original approach: - It did not work at all with UEFI because UEFI will reprogram the PCI device BARs and remap the COM1/COM2 ports at non-legacy addresses. - OpenBSD GENERIC kernel does not create a /dev/console because it expects the uart device at the legacy 0x3F8/0x2F8 address to be an ISA device. - It was functional with a FreeBSD guest but caused the console to appear on /dev/ttyu2 which was not intuitive. The uart emulation is now independent of the bus on which it resides. Thus it is possible to have uart devices on the PCI bus in addition to the legacy COM1/COM2 devices behind the LPC bus. The command line option to attach ISA COM1/COM2 ports to a virtual machine is "-s ,lpc -l com1,stdio". The command line option to create a PCI-attached uart device is: "-s ,uart[,stdio]" The command line option to create PCI-attached COM1/COM2 device is: "-S ,uart[,stdio]". This style of creating COM ports is deprecated. Approved by: re (glebius) Added: stable/10/usr.sbin/bhyve/legacy_irq.c - copied unchanged from r257293, head/usr.sbin/bhyve/legacy_irq.c stable/10/usr.sbin/bhyve/legacy_irq.h - copied unchanged from r257293, head/usr.sbin/bhyve/legacy_irq.h stable/10/usr.sbin/bhyve/pci_lpc.c - copied, changed from r257293, head/usr.sbin/bhyve/pci_lpc.c stable/10/usr.sbin/bhyve/pci_lpc.h - copied unchanged from r257293, head/usr.sbin/bhyve/pci_lpc.h stable/10/usr.sbin/bhyve/uart_emul.c - copied unchanged from r257293, head/usr.sbin/bhyve/uart_emul.c stable/10/usr.sbin/bhyve/uart_emul.h - copied unchanged from r257293, head/usr.sbin/bhyve/uart_emul.h Modified: stable/10/share/examples/bhyve/vmrun.sh stable/10/usr.sbin/bhyve/Makefile stable/10/usr.sbin/bhyve/bhyverun.c stable/10/usr.sbin/bhyve/inout.c stable/10/usr.sbin/bhyve/inout.h stable/10/usr.sbin/bhyve/pci_emul.c stable/10/usr.sbin/bhyve/pci_emul.h stable/10/usr.sbin/bhyve/pci_uart.c Directory Properties: stable/10/share/examples/bhyve/ (props changed) stable/10/usr.sbin/bhyve/ (props changed) Modified: stable/10/share/examples/bhyve/vmrun.sh ============================================================================== --- stable/10/share/examples/bhyve/vmrun.sh Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/share/examples/bhyve/vmrun.sh Wed Oct 30 20:42:09 2013 (r257396) @@ -157,7 +157,7 @@ while [ 1 ]; do exit 1 fi BOOTDISK=${isofile} - installer_opt="-s 3:0,virtio-blk,${BOOTDISK}" + installer_opt="-s 31:0,virtio-blk,${BOOTDISK}" else BOOTDISK=${virtio_diskdev} installer_opt="" @@ -171,10 +171,11 @@ while [ 1 ]; do ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -AI -H -P \ -g ${gdbport} \ -s 0:0,hostbridge \ - -s 1:0,virtio-net,${tapdev} \ - -s 2:0,virtio-blk,${virtio_diskdev} \ + -s 1:0,lpc \ + -s 2:0,virtio-net,${tapdev} \ + -s 3:0,virtio-blk,${virtio_diskdev} \ + -l com1,stdio \ ${installer_opt} \ - -S 31,uart,stdio \ ${vmname} if [ $? -ne 0 ]; then break Modified: stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- stable/10/usr.sbin/bhyve/Makefile Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/usr.sbin/bhyve/Makefile Wed Oct 30 20:42:09 2013 (r257396) @@ -7,10 +7,10 @@ PROG= bhyve DEBUG_FLAGS= -g -O0 SRCS= acpi.c atpic.c bhyverun.c block_if.c consport.c dbgport.c elcr.c -SRCS+= inout.c ioapic.c mem.c mevent.c mptbl.c pci_ahci.c -SRCS+= pci_emul.c pci_hostbridge.c pci_passthru.c pci_virtio_block.c +SRCS+= inout.c ioapic.c legacy_irq.c mem.c mevent.c mptbl.c pci_ahci.c +SRCS+= pci_emul.c pci_hostbridge.c pci_lpc.c pci_passthru.c pci_virtio_block.c SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c pmtmr.c post.c rtc.c -SRCS+= virtio.c xmsr.c spinup_ap.c +SRCS+= uart_emul.c virtio.c xmsr.c spinup_ap.c .PATH: ${.CURDIR}/../../sys/amd64/vmm SRCS+= vmm_instruction_emul.c Modified: stable/10/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/10/usr.sbin/bhyve/bhyverun.c Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/usr.sbin/bhyve/bhyverun.c Wed Oct 30 20:42:09 2013 (r257396) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -53,10 +54,12 @@ __FBSDID("$FreeBSD$"); #include "acpi.h" #include "inout.h" #include "dbgport.h" +#include "legacy_irq.h" #include "mem.h" #include "mevent.h" #include "mptbl.h" #include "pci_emul.h" +#include "pci_lpc.h" #include "xmsr.h" #include "ioapic.h" #include "spinup_ap.h" @@ -121,9 +124,8 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-aehAHIPW][-g ][-s ][-S ]" - "[-c vcpus][-p pincpu][-m mem]" - " \n" + "Usage: %s [-aehAHIPW] [-g ] [-s ] [-S ]\n" + " %*s [-c vcpus] [-p pincpu] [-m mem] [-l ] \n" " -a: local apic is in XAPIC mode (default is X2APIC)\n" " -A: create an ACPI table\n" " -g: gdb port\n" @@ -132,13 +134,14 @@ usage(int code) " -H: vmexit from the guest on hlt\n" " -I: present an ioapic to the guest\n" " -P: vmexit from the guest on pause\n" - " -W: force virtio to use single-vector MSI\n" - " -e: exit on unhandled i/o access\n" + " -W: force virtio to use single-vector MSI\n" + " -e: exit on unhandled I/O access\n" " -h: help\n" " -s: PCI slot config\n" " -S: legacy PCI slot config\n" + " -l: LPC device configuration\n" " -m: memory size in MB\n", - progname); + progname, (int)strlen(progname), ""); exit(code); } @@ -553,7 +556,7 @@ main(int argc, char *argv[]) ioapic = 0; memsize = 256 * MB; - while ((c = getopt(argc, argv, "abehAHIPWp:g:c:s:S:m:")) != -1) { + while ((c = getopt(argc, argv, "abehAHIPWp:g:c:s:S:m:l:")) != -1) { switch (c) { case 'a': disable_x2apic = 1; @@ -573,6 +576,12 @@ main(int argc, char *argv[]) case 'g': gdb_port = atoi(optarg); break; + case 'l': + if (lpc_device_parse(optarg) != 0) { + errx(EX_USAGE, "invalid lpc device " + "configuration '%s'", optarg); + } + break; case 's': if (pci_parse_slot(optarg, 0) != 0) exit(1); @@ -640,6 +649,7 @@ main(int argc, char *argv[]) init_mem(); init_inout(); + legacy_irq_init(); rtc_init(ctx); Modified: stable/10/usr.sbin/bhyve/inout.c ============================================================================== --- stable/10/usr.sbin/bhyve/inout.c Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/usr.sbin/bhyve/inout.c Wed Oct 30 20:42:09 2013 (r257396) @@ -84,7 +84,7 @@ register_default_iohandler(int start, in iop.name = "default"; iop.port = start; iop.size = size; - iop.flags = IOPORT_F_INOUT; + iop.flags = IOPORT_F_INOUT | IOPORT_F_DEFAULT; iop.handler = default_inout; register_inout(&iop); @@ -159,7 +159,18 @@ register_inout(struct inout_port *iop) int i; VERIFY_IOPORT(iop->port, iop->size); - + + /* + * Verify that the new registration is not overwriting an already + * allocated i/o range. + */ + if ((iop->flags & IOPORT_F_DEFAULT) == 0) { + for (i = iop->port; i < iop->port + iop->size; i++) { + if ((inout_handlers[i].flags & IOPORT_F_DEFAULT) == 0) + return (-1); + } + } + for (i = iop->port; i < iop->port + iop->size; i++) { inout_handlers[i].name = iop->name; inout_handlers[i].flags = iop->flags; Modified: stable/10/usr.sbin/bhyve/inout.h ============================================================================== --- stable/10/usr.sbin/bhyve/inout.h Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/usr.sbin/bhyve/inout.h Wed Oct 30 20:42:09 2013 (r257396) @@ -46,7 +46,13 @@ struct inout_port { }; #define IOPORT_F_IN 0x1 #define IOPORT_F_OUT 0x2 -#define IOPORT_F_INOUT 0x3 +#define IOPORT_F_INOUT (IOPORT_F_IN | IOPORT_F_OUT) + +/* + * The following flags are used internally and must not be used by + * device models. + */ +#define IOPORT_F_DEFAULT 0x80000000 /* claimed by default handler */ #define INOUT_PORT(name, port, flags, handler) \ static struct inout_port __CONCAT(__inout_port, __LINE__) = { \ Copied: stable/10/usr.sbin/bhyve/legacy_irq.c (from r257293, head/usr.sbin/bhyve/legacy_irq.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/bhyve/legacy_irq.c Wed Oct 30 20:42:09 2013 (r257396, copy of r257293, head/usr.sbin/bhyve/legacy_irq.c) @@ -0,0 +1,80 @@ +/*- + * Copyright (c) 2013 Neel Natu + * 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 NETAPP, INC ``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 NETAPP, INC 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 + +/* + * Used to keep track of legacy interrupt owners/requestors + */ +#define NLIRQ 16 + +static struct lirqinfo { + bool li_generic; + bool li_allocated; +} lirq[NLIRQ]; + +void +legacy_irq_init(void) +{ + + /* + * Allow ISA IRQs 5,10,11,12, and 15 to be available for generic use. + */ + lirq[5].li_generic = true; + lirq[10].li_generic = true; + lirq[11].li_generic = true; + lirq[12].li_generic = true; + lirq[15].li_generic = true; +} + +int +legacy_irq_alloc(int irq) +{ + int i; + + assert(irq < NLIRQ); + + if (irq < 0) { + for (i = 0; i < NLIRQ; i++) { + if (lirq[i].li_generic && !lirq[i].li_allocated) { + irq = i; + break; + } + } + } else { + if (lirq[irq].li_allocated) + irq = -1; + } + + if (irq >= 0) { + lirq[irq].li_allocated = true; + return (irq); + } else + return (-1); +} Copied: stable/10/usr.sbin/bhyve/legacy_irq.h (from r257293, head/usr.sbin/bhyve/legacy_irq.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/bhyve/legacy_irq.h Wed Oct 30 20:42:09 2013 (r257396, copy of r257293, head/usr.sbin/bhyve/legacy_irq.h) @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2013 Neel Natu + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#ifndef _LEGACY_IRQ_H_ +#define _LEGACY_IRQ_H_ + +/* + * Allocate a legacy irq. The argument 'irq' can be set to -1 to allocate any + * available irq. + * + * Returns -1 on failure or the allocated irq number on success. + */ +int legacy_irq_alloc(int irq); +void legacy_irq_init(void); + +#endif Modified: stable/10/usr.sbin/bhyve/pci_emul.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_emul.c Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/usr.sbin/bhyve/pci_emul.c Wed Oct 30 20:42:09 2013 (r257396) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include "bhyverun.h" #include "inout.h" +#include "legacy_irq.h" #include "mem.h" #include "pci_emul.h" #include "ioapic.h" @@ -76,17 +77,6 @@ static struct slotinfo { int si_legacy; } pci_slotinfo[MAXSLOTS][MAXFUNCS]; -/* - * Used to keep track of legacy interrupt owners/requestors - */ -#define NLIRQ 16 - -static struct lirqinfo { - int li_generic; - int li_acount; - struct pci_devinst *li_owner; /* XXX should be a list */ -} lirq[NLIRQ]; - SET_DECLARE(pci_devemu_set, struct pci_devemu); static uint64_t pci_emul_iobase; @@ -682,6 +672,7 @@ pci_emul_init(struct vmctx *ctx, struct pdi->pi_bus = 0; pdi->pi_slot = slot; pdi->pi_func = func; + pdi->pi_lintr_pin = -1; pdi->pi_d = pde; snprintf(pdi->pi_name, PI_NAMESZ, "%s-pci-%d", pde->pe_emu, slot); @@ -1023,16 +1014,6 @@ init_pci(struct vmctx *ctx) pci_emul_membase32 = vm_get_lowmem_limit(ctx); pci_emul_membase64 = PCI_EMUL_MEMBASE64; - /* - * Allow ISA IRQs 5,10,11,12, and 15 to be available for - * generic use - */ - lirq[5].li_generic = 1; - lirq[10].li_generic = 1; - lirq[11].li_generic = 1; - lirq[12].li_generic = 1; - lirq[15].li_generic = 1; - for (slot = 0; slot < MAXSLOTS; slot++) { for (func = 0; func < MAXFUNCS; func++) { si = &pci_slotinfo[slot][func]; @@ -1135,40 +1116,17 @@ pci_is_legacy(struct pci_devinst *pi) return (pci_slotinfo[pi->pi_slot][pi->pi_func].si_legacy); } -static int -pci_lintr_alloc(struct pci_devinst *pi, int vec) -{ - int i; - - assert(vec < NLIRQ); - - if (vec == -1) { - for (i = 0; i < NLIRQ; i++) { - if (lirq[i].li_generic && - lirq[i].li_owner == NULL) { - vec = i; - break; - } - } - } else { - if (lirq[vec].li_owner != NULL) { - vec = -1; - } - } - assert(vec != -1); - - lirq[vec].li_owner = pi; - pi->pi_lintr_pin = vec; - - return (vec); -} - int -pci_lintr_request(struct pci_devinst *pi, int vec) +pci_lintr_request(struct pci_devinst *pi, int req) { + int irq; + + irq = legacy_irq_alloc(req); + if (irq < 0) + return (-1); - vec = pci_lintr_alloc(pi, vec); - pci_set_cfgdata8(pi, PCIR_INTLINE, vec); + pi->pi_lintr_pin = irq; + pci_set_cfgdata8(pi, PCIR_INTLINE, irq); pci_set_cfgdata8(pi, PCIR_INTPIN, 1); return (0); } @@ -1177,7 +1135,7 @@ void pci_lintr_assert(struct pci_devinst *pi) { - assert(pi->pi_lintr_pin); + assert(pi->pi_lintr_pin >= 0); ioapic_assert_pin(pi->pi_vmctx, pi->pi_lintr_pin); } @@ -1185,7 +1143,7 @@ void pci_lintr_deassert(struct pci_devinst *pi) { - assert(pi->pi_lintr_pin); + assert(pi->pi_lintr_pin >= 0); ioapic_deassert_pin(pi->pi_vmctx, pi->pi_lintr_pin); } Modified: stable/10/usr.sbin/bhyve/pci_emul.h ============================================================================== --- stable/10/usr.sbin/bhyve/pci_emul.h Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/usr.sbin/bhyve/pci_emul.h Wed Oct 30 20:42:09 2013 (r257396) @@ -103,7 +103,7 @@ struct pci_devinst { struct pci_devemu *pi_d; struct vmctx *pi_vmctx; uint8_t pi_bus, pi_slot, pi_func; - uint8_t pi_lintr_pin; + int8_t pi_lintr_pin; char pi_name[PI_NAMESZ]; int pi_bar_getsize; Copied and modified: stable/10/usr.sbin/bhyve/pci_lpc.c (from r257293, head/usr.sbin/bhyve/pci_lpc.c) ============================================================================== --- head/usr.sbin/bhyve/pci_lpc.c Tue Oct 29 00:18:11 2013 (r257293, copy source) +++ stable/10/usr.sbin/bhyve/pci_lpc.c Wed Oct 30 20:42:09 2013 (r257396) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2013 Neel Natu + * Copyright (c) 2013 Tycho Nightingale * All rights reserved. * * Redistribution and use in source and binary forms, with or without Copied: stable/10/usr.sbin/bhyve/pci_lpc.h (from r257293, head/usr.sbin/bhyve/pci_lpc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/bhyve/pci_lpc.h Wed Oct 30 20:42:09 2013 (r257396, copy of r257293, head/usr.sbin/bhyve/pci_lpc.h) @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2013 Neel Natu + * 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 NETAPP, INC ``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 NETAPP, INC 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$ + */ + +#ifndef _LPC_H_ +#define _LPC_H_ + +int lpc_device_parse(const char *opt); + +#endif Modified: stable/10/usr.sbin/bhyve/pci_uart.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_uart.c Wed Oct 30 18:40:55 2013 (r257395) +++ stable/10/usr.sbin/bhyve/pci_uart.c Wed Oct 30 20:42:09 2013 (r257396) @@ -30,42 +30,12 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include "bhyverun.h" #include "pci_emul.h" -#include "mevent.h" - -#define COM1_BASE 0x3F8 -#define COM1_IRQ 4 -#define COM2_BASE 0x2F8 -#define COM2_IRQ 3 - -#define DEFAULT_RCLK 1843200 -#define DEFAULT_BAUD 9600 - -#define FCR_RX_MASK 0xC0 - -#define MCR_OUT1 0x04 -#define MCR_OUT2 0x08 - -#define MSR_DELTA_MASK 0x0f - -#ifndef REG_SCR -#define REG_SCR com_scr -#endif - -#define FIFOSZ 16 +#include "uart_emul.h" /* * Pick a PCI vid/did of a chip with a single uart at @@ -75,544 +45,82 @@ __FBSDID("$FreeBSD$"); #define COM_VENDOR 0x131f #define COM_DEV 0x2000 -static int pci_uart_stdio; /* stdio in use for i/o */ - -static int pci_uart_nldevs; /* number of legacy devices - 2 max */ - -static struct { - uint64_t baddr; - int vector; -} pci_uart_lres[] = { - { COM1_BASE, COM1_IRQ}, - { COM2_BASE, COM2_IRQ}, - { 0, 0 } -}; - -struct fifo { - uint8_t buf[FIFOSZ]; - int rindex; /* index to read from */ - int windex; /* index to write to */ - int num; /* number of characters in the fifo */ - int size; /* size of the fifo */ -}; - -struct pci_uart_softc { - struct pci_devinst *pi; - pthread_mutex_t mtx; /* protects all softc elements */ - uint8_t data; /* Data register (R/W) */ - uint8_t ier; /* Interrupt enable register (R/W) */ - uint8_t lcr; /* Line control register (R/W) */ - uint8_t mcr; /* Modem control register (R/W) */ - uint8_t lsr; /* Line status register (R/W) */ - uint8_t msr; /* Modem status register (R/W) */ - uint8_t fcr; /* FIFO control register (W) */ - uint8_t scr; /* Scratch register (R/W) */ - - uint8_t dll; /* Baudrate divisor latch LSB */ - uint8_t dlh; /* Baudrate divisor latch MSB */ - - struct fifo rxfifo; - - int opened; - int stdio; - bool thre_int_pending; /* THRE interrupt pending */ -}; - -static void pci_uart_drain(int fd, enum ev_type ev, void *arg); - -static struct termios tio_orig, tio_new; /* I/O Terminals */ - -static void -ttyclose(void) -{ - tcsetattr(STDIN_FILENO, TCSANOW, &tio_orig); -} - -static void -ttyopen(void) -{ - tcgetattr(STDIN_FILENO, &tio_orig); - - cfmakeraw(&tio_new); - tcsetattr(STDIN_FILENO, TCSANOW, &tio_new); - - atexit(ttyclose); -} - -static bool -tty_char_available(void) -{ - fd_set rfds; - struct timeval tv; - - FD_ZERO(&rfds); - FD_SET(STDIN_FILENO, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - if (select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv) > 0 ) { - return (true); - } else { - return (false); - } -} - -static int -ttyread(void) -{ - char rb; - - if (tty_char_available()) { - read(STDIN_FILENO, &rb, 1); - return (rb & 0xff); - } else { - return (-1); - } -} - -static void -ttywrite(unsigned char wb) -{ - (void) write(STDIN_FILENO, &wb, 1); -} - -static void -fifo_reset(struct fifo *fifo, int size) -{ - bzero(fifo, sizeof(struct fifo)); - fifo->size = size; -} - -static int -fifo_putchar(struct fifo *fifo, uint8_t ch) -{ - - if (fifo->num < fifo->size) { - fifo->buf[fifo->windex] = ch; - fifo->windex = (fifo->windex + 1) % fifo->size; - fifo->num++; - return (0); - } else - return (-1); -} - -static int -fifo_getchar(struct fifo *fifo) -{ - int c; - - if (fifo->num > 0) { - c = fifo->buf[fifo->rindex]; - fifo->rindex = (fifo->rindex + 1) % fifo->size; - fifo->num--; - return (c); - } else - return (-1); -} - -static int -fifo_numchars(struct fifo *fifo) -{ - - return (fifo->num); -} - -static int -fifo_available(struct fifo *fifo) -{ - - return (fifo->num < fifo->size); -} - -static void -pci_uart_opentty(struct pci_uart_softc *sc) -{ - struct mevent *mev; - - assert(sc->opened == 0); - assert(sc->stdio); - - ttyopen(); - mev = mevent_add(STDIN_FILENO, EVF_READ, pci_uart_drain, sc); - assert(mev); -} - static void -pci_uart_legacy_res(uint64_t *bar, int *ivec) +pci_uart_intr_assert(void *arg) { - if (pci_uart_lres[pci_uart_nldevs].baddr != 0) { - *bar = pci_uart_lres[pci_uart_nldevs].baddr; - *ivec = pci_uart_lres[pci_uart_nldevs].vector; - pci_uart_nldevs++; - } else { - /* TODO: print warning ? */ - *bar = 0; - *ivec= -1; - } -} + struct pci_devinst *pi = arg; -/* - * The IIR returns a prioritized interrupt reason: - * - receive data available - * - transmit holding register empty - * - modem status change - * - * Return an interrupt reason if one is available. - */ -static int -pci_uart_intr_reason(struct pci_uart_softc *sc) -{ - - if ((sc->lsr & LSR_OE) != 0 && (sc->ier & IER_ERLS) != 0) - return (IIR_RLS); - else if (fifo_numchars(&sc->rxfifo) > 0 && (sc->ier & IER_ERXRDY) != 0) - return (IIR_RXTOUT); - else if (sc->thre_int_pending && (sc->ier & IER_ETXRDY) != 0) - return (IIR_TXRDY); - else if ((sc->msr & MSR_DELTA_MASK) != 0 && (sc->ier & IER_EMSC) != 0) - return (IIR_MLSC); - else - return (IIR_NOPEND); + pci_lintr_assert(pi); } static void -pci_uart_reset(struct pci_uart_softc *sc) +pci_uart_intr_deassert(void *arg) { - uint16_t divisor; + struct pci_devinst *pi = arg; - divisor = DEFAULT_RCLK / DEFAULT_BAUD / 16; - sc->dll = divisor; - sc->dlh = divisor >> 16; - - fifo_reset(&sc->rxfifo, 1); /* no fifo until enabled by software */ -} - -/* - * Toggle the COM port's intr pin depending on whether or not we have an - * interrupt condition to report to the processor. - */ -static void -pci_uart_toggle_intr(struct pci_uart_softc *sc) -{ - uint8_t intr_reason; - - intr_reason = pci_uart_intr_reason(sc); - - if (intr_reason == IIR_NOPEND) - pci_lintr_deassert(sc->pi); - else - pci_lintr_assert(sc->pi); -} - -static void -pci_uart_drain(int fd, enum ev_type ev, void *arg) -{ - struct pci_uart_softc *sc; - int ch; - - sc = arg; - - assert(fd == STDIN_FILENO); - assert(ev == EVF_READ); - - /* - * This routine is called in the context of the mevent thread - * to take out the softc lock to protect against concurrent - * access from a vCPU i/o exit - */ - pthread_mutex_lock(&sc->mtx); - - if ((sc->mcr & MCR_LOOPBACK) != 0) { - (void) ttyread(); - } else { - while (fifo_available(&sc->rxfifo) && - ((ch = ttyread()) != -1)) { - fifo_putchar(&sc->rxfifo, ch); - } - pci_uart_toggle_intr(sc); - } - - pthread_mutex_unlock(&sc->mtx); + pci_lintr_deassert(pi); } static void pci_uart_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { - struct pci_uart_softc *sc; - int fifosz; - uint8_t msr; - - sc = pi->pi_arg; assert(baridx == 0); assert(size == 1); - /* Open terminal */ - if (!sc->opened && sc->stdio) { - pci_uart_opentty(sc); - sc->opened = 1; - } - - pthread_mutex_lock(&sc->mtx); - - /* - * Take care of the special case DLAB accesses first - */ - if ((sc->lcr & LCR_DLAB) != 0) { - if (offset == REG_DLL) { - sc->dll = value; - goto done; - } - - if (offset == REG_DLH) { - sc->dlh = value; - goto done; - } - } - - switch (offset) { - case REG_DATA: - if (sc->mcr & MCR_LOOPBACK) { - if (fifo_putchar(&sc->rxfifo, value) != 0) - sc->lsr |= LSR_OE; - } else if (sc->stdio) { - ttywrite(value); - } /* else drop on floor */ - sc->thre_int_pending = true; - break; - case REG_IER: - /* - * Apply mask so that bits 4-7 are 0 - * Also enables bits 0-3 only if they're 1 - */ - sc->ier = value & 0x0F; - break; - case REG_FCR: - /* - * When moving from FIFO and 16450 mode and vice versa, - * the FIFO contents are reset. - */ - if ((sc->fcr & FCR_ENABLE) ^ (value & FCR_ENABLE)) { - fifosz = (value & FCR_ENABLE) ? FIFOSZ : 1; - fifo_reset(&sc->rxfifo, fifosz); - } - - /* - * The FCR_ENABLE bit must be '1' for the programming - * of other FCR bits to be effective. - */ - if ((value & FCR_ENABLE) == 0) { - sc->fcr = 0; - } else { - if ((value & FCR_RCV_RST) != 0) - fifo_reset(&sc->rxfifo, FIFOSZ); - - sc->fcr = value & - (FCR_ENABLE | FCR_DMA | FCR_RX_MASK); - } - break; - case REG_LCR: - sc->lcr = value; - break; - case REG_MCR: - /* Apply mask so that bits 5-7 are 0 */ - sc->mcr = value & 0x1F; - - msr = 0; - if (sc->mcr & MCR_LOOPBACK) { - /* - * In the loopback mode certain bits from the - * MCR are reflected back into MSR - */ - if (sc->mcr & MCR_RTS) - msr |= MSR_CTS; - if (sc->mcr & MCR_DTR) - msr |= MSR_DSR; - if (sc->mcr & MCR_OUT1) - msr |= MSR_RI; - if (sc->mcr & MCR_OUT2) - msr |= MSR_DCD; - } - - /* - * Detect if there has been any change between the - * previous and the new value of MSR. If there is - * then assert the appropriate MSR delta bit. - */ - if ((msr & MSR_CTS) ^ (sc->msr & MSR_CTS)) - sc->msr |= MSR_DCTS; - if ((msr & MSR_DSR) ^ (sc->msr & MSR_DSR)) - sc->msr |= MSR_DDSR; - if ((msr & MSR_DCD) ^ (sc->msr & MSR_DCD)) - sc->msr |= MSR_DDCD; - if ((sc->msr & MSR_RI) != 0 && (msr & MSR_RI) == 0) - sc->msr |= MSR_TERI; - - /* - * Update the value of MSR while retaining the delta - * bits. - */ - sc->msr &= MSR_DELTA_MASK; - sc->msr |= msr; - break; - case REG_LSR: - /* - * Line status register is not meant to be written to - * during normal operation. - */ - break; - case REG_MSR: - /* - * As far as I can tell MSR is a read-only register. - */ - break; - case REG_SCR: - sc->scr = value; - break; - default: - break; - } - -done: - pci_uart_toggle_intr(sc); - pthread_mutex_unlock(&sc->mtx); + uart_write(pi->pi_arg, offset, value); } uint64_t pci_uart_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { - struct pci_uart_softc *sc; - uint8_t iir, intr_reason; - uint64_t reg; - - sc = pi->pi_arg; + uint8_t val; assert(baridx == 0); assert(size == 1); - /* Open terminal */ - if (!sc->opened && sc->stdio) { - pci_uart_opentty(sc); - sc->opened = 1; - } - - pthread_mutex_lock(&sc->mtx); - - /* - * Take care of the special case DLAB accesses first - */ - if ((sc->lcr & LCR_DLAB) != 0) { - if (offset == REG_DLL) { - reg = sc->dll; - goto done; - } - - if (offset == REG_DLH) { - reg = sc->dlh; - goto done; - } - } - - switch (offset) { - case REG_DATA: - reg = fifo_getchar(&sc->rxfifo); - break; - case REG_IER: - reg = sc->ier; - break; - case REG_IIR: - iir = (sc->fcr & FCR_ENABLE) ? IIR_FIFO_MASK : 0; - - intr_reason = pci_uart_intr_reason(sc); - - /* - * Deal with side effects of reading the IIR register - */ - if (intr_reason == IIR_TXRDY) - sc->thre_int_pending = false; - - iir |= intr_reason; - - reg = iir; - break; - case REG_LCR: - reg = sc->lcr; - break; - case REG_MCR: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Wed Oct 30 21:12:28 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0CAC2BEC; Wed, 30 Oct 2013 21:12:28 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DF1F62411; Wed, 30 Oct 2013 21:12:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9ULCR5l050644; Wed, 30 Oct 2013 21:12:27 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9ULCRLi050643; Wed, 30 Oct 2013 21:12:27 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201310302112.r9ULCRLi050643@svn.freebsd.org> From: Peter Grehan Date: Wed, 30 Oct 2013 21:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257397 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 21:12:28 -0000 Author: grehan Date: Wed Oct 30 21:12:27 2013 New Revision: 257397 URL: http://svnweb.freebsd.org/changeset/base/257397 Log: MFC r257092 Fix bug in the ioapic emulation for level-triggered interrupts, where a pin assertion while a source was masked would result in the interrupt being lost, with the symptom being a console hang. The condition is now recorded, and the interrupt generated when the source is unmasked. Approved by: re (glebius) Modified: stable/10/usr.sbin/bhyve/ioapic.c Directory Properties: stable/10/usr.sbin/bhyve/ (props changed) Modified: stable/10/usr.sbin/bhyve/ioapic.c ============================================================================== --- stable/10/usr.sbin/bhyve/ioapic.c Wed Oct 30 20:42:09 2013 (r257396) +++ stable/10/usr.sbin/bhyve/ioapic.c Wed Oct 30 21:12:27 2013 (r257397) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -46,34 +47,40 @@ __FBSDID("$FreeBSD$"); #include +static uint64_t ioapic_clearpend, ioapic_togglepend, ioapic_setpend; + #define IOAPIC_PADDR 0xFEC00000 #define IOREGSEL 0x00 #define IOWIN 0x10 #define REDIR_ENTRIES 16 -#define INTR_ASSERTED(ioapic, pin) ((ioapic)->pinstate[(pin)] == true) +#define INTR_ASSERTED(ioapic, pin) \ + ((ioapic)->rtbl[(pin)].pinstate == true) struct ioapic { int inited; uint32_t id; - uint64_t redtbl[REDIR_ENTRIES]; - bool pinstate[REDIR_ENTRIES]; + struct { + uint64_t reg; + bool pinstate; + bool pending; + } rtbl[REDIR_ENTRIES]; uintptr_t paddr; /* gpa where the ioapic is mapped */ uint32_t ioregsel; struct memory_region *region; + pthread_mutex_t mtx; }; static struct ioapic ioapics[1]; /* only a single ioapic for now */ -static int ioapic_region_read(struct ioapic *ioapic, uintptr_t paddr, - int size, uint64_t *data); -static int ioapic_region_write(struct ioapic *ioapic, uintptr_t paddr, - int size, uint64_t data); +static int ioapic_region_read(struct vmctx *vm, struct ioapic *ioapic, + uintptr_t paddr, int size, uint64_t *data); +static int ioapic_region_write(struct vmctx *vm, struct ioapic *ioapic, + uintptr_t paddr, int size, uint64_t data); static int ioapic_region_handler(struct vmctx *vm, int vcpu, int dir, - uintptr_t paddr, int size, uint64_t *val, - void *arg1, long arg2); + uintptr_t paddr, int size, uint64_t *val, void *arg1, long arg2); static void ioapic_set_pinstate(struct vmctx *ctx, int pin, bool newstate) @@ -84,14 +91,11 @@ ioapic_set_pinstate(struct vmctx *ctx, i ioapic = &ioapics[0]; /* assume a single ioapic */ - if (pin < 0 || pin >= REDIR_ENTRIES) - return; - /* Nothing to do if interrupt pin has not changed state */ - if (ioapic->pinstate[pin] == newstate) + if (ioapic->rtbl[pin].pinstate == newstate) return; - ioapic->pinstate[pin] = newstate; /* record it */ + ioapic->rtbl[pin].pinstate = newstate; /* record it */ /* Nothing to do if interrupt pin is deasserted */ if (!INTR_ASSERTED(ioapic, pin)) @@ -105,8 +109,8 @@ ioapic_set_pinstate(struct vmctx *ctx, i * Level-triggered sources will work so long as there is * no sharing. */ - low = ioapic->redtbl[pin]; - high = ioapic->redtbl[pin] >> 32; + low = ioapic->rtbl[pin].reg; + high = ioapic->rtbl[pin].reg >> 32; if ((low & IOART_INTMASK) == IOART_INTMCLR && (low & IOART_DESTMOD) == IOART_DESTPHY && (low & IOART_DELMOD) == IOART_DELFIXED) { @@ -124,19 +128,47 @@ ioapic_set_pinstate(struct vmctx *ctx, i vcpu++; } } + } else if ((low & IOART_INTMASK) != IOART_INTMCLR && + low & IOART_TRGRLVL) { + /* + * For level-triggered interrupts that have been + * masked, set the pending bit so that an interrupt + * will be generated on unmask and if the level is + * still asserted + */ + ioapic_setpend++; + ioapic->rtbl[pin].pending = true; } } +static void +ioapic_set_pinstate_locked(struct vmctx *ctx, int pin, bool newstate) +{ + struct ioapic *ioapic; + + if (pin < 0 || pin >= REDIR_ENTRIES) + return; + + ioapic = &ioapics[0]; + + pthread_mutex_lock(&ioapic->mtx); + ioapic_set_pinstate(ctx, pin, newstate); + pthread_mutex_unlock(&ioapic->mtx); +} + +/* + * External entry points require locking + */ void ioapic_deassert_pin(struct vmctx *ctx, int pin) { - ioapic_set_pinstate(ctx, pin, false); + ioapic_set_pinstate_locked(ctx, pin, false); } void ioapic_assert_pin(struct vmctx *ctx, int pin) { - ioapic_set_pinstate(ctx, pin, true); + ioapic_set_pinstate_locked(ctx, pin, true); } void @@ -154,9 +186,11 @@ ioapic_init(int which) bzero(ioapic, sizeof(struct ioapic)); + pthread_mutex_init(&ioapic->mtx, NULL); + /* Initialize all redirection entries to mask all interrupts */ for (i = 0; i < REDIR_ENTRIES; i++) - ioapic->redtbl[i] = 0x0001000000010000UL; + ioapic->rtbl[i].reg = 0x0001000000010000UL; ioapic->paddr = IOAPIC_PADDR; @@ -206,14 +240,15 @@ ioapic_read(struct ioapic *ioapic, uint3 else rshift = 0; - return (ioapic->redtbl[pin] >> rshift); + return (ioapic->rtbl[pin].reg >> rshift); } return (0); } static void -ioapic_write(struct ioapic *ioapic, uint32_t addr, uint32_t data) +ioapic_write(struct vmctx *vm, struct ioapic *ioapic, uint32_t addr, + uint32_t data) { int regnum, pin, lshift; @@ -241,14 +276,31 @@ ioapic_write(struct ioapic *ioapic, uint else lshift = 0; - ioapic->redtbl[pin] &= ~((uint64_t)0xffffffff << lshift); - ioapic->redtbl[pin] |= ((uint64_t)data << lshift); + ioapic->rtbl[pin].reg &= ~((uint64_t)0xffffffff << lshift); + ioapic->rtbl[pin].reg |= ((uint64_t)data << lshift); + + if (ioapic->rtbl[pin].pending && + ((ioapic->rtbl[pin].reg & IOART_INTMASK) == + IOART_INTMCLR)) { + ioapic->rtbl[pin].pending = false; + ioapic_clearpend++; + /* + * Inject the deferred level-triggered int if it is + * still asserted. Simulate by toggling the pin + * off and then on. + */ + if (ioapic->rtbl[pin].pinstate == true) { + ioapic_togglepend++; + ioapic_set_pinstate(vm, pin, false); + ioapic_set_pinstate(vm, pin, true); + } + } } } static int -ioapic_region_read(struct ioapic *ioapic, uintptr_t paddr, int size, - uint64_t *data) +ioapic_region_read(struct vmctx *vm, struct ioapic *ioapic, uintptr_t paddr, + int size, uint64_t *data) { int offset; @@ -276,8 +328,8 @@ ioapic_region_read(struct ioapic *ioapic } static int -ioapic_region_write(struct ioapic *ioapic, uintptr_t paddr, int size, - uint64_t data) +ioapic_region_write(struct vmctx *vm, struct ioapic *ioapic, uintptr_t paddr, + int size, uint64_t data) { int offset; @@ -298,14 +350,14 @@ ioapic_region_write(struct ioapic *ioapi if (offset == IOREGSEL) ioapic->ioregsel = data; else - ioapic_write(ioapic, ioapic->ioregsel, data); + ioapic_write(vm, ioapic, ioapic->ioregsel, data); return (0); } static int ioapic_region_handler(struct vmctx *vm, int vcpu, int dir, uintptr_t paddr, - int size, uint64_t *val, void *arg1, long arg2) + int size, uint64_t *val, void *arg1, long arg2) { struct ioapic *ioapic; int which; @@ -315,10 +367,12 @@ ioapic_region_handler(struct vmctx *vm, assert(ioapic == &ioapics[which]); + pthread_mutex_lock(&ioapic->mtx); if (dir == MEM_F_READ) - ioapic_region_read(ioapic, paddr, size, val); + ioapic_region_read(vm, ioapic, paddr, size, val); else - ioapic_region_write(ioapic, paddr, size, *val); + ioapic_region_write(vm, ioapic, paddr, size, *val); + pthread_mutex_unlock(&ioapic->mtx); return (0); } From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 10:12:26 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 855EFB36; Thu, 31 Oct 2013 10:12:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 726432F62; Thu, 31 Oct 2013 10:12:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VACQEF031965; Thu, 31 Oct 2013 10:12:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VACQe8031964; Thu, 31 Oct 2013 10:12:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310311012.r9VACQe8031964@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 31 Oct 2013 10:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257432 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 10:12:26 -0000 Author: kib Date: Thu Oct 31 10:12:25 2013 New Revision: 257432 URL: http://svnweb.freebsd.org/changeset/base/257432 Log: MFC r257221: Fix typo. Approved by: re (glebius) Modified: stable/10/sys/kern/subr_param.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/kern/subr_param.c ============================================================================== --- stable/10/sys/kern/subr_param.c Thu Oct 31 09:44:48 2013 (r257431) +++ stable/10/sys/kern/subr_param.c Thu Oct 31 10:12:25 2013 (r257432) @@ -344,7 +344,7 @@ init_param2(long physpages) } /* - * Sysctl stringiying handler for kern.vm_guest. + * Sysctl stringifying handler for kern.vm_guest. */ static int sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS) From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 13:47:40 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C77A1680; Thu, 31 Oct 2013 13:47:40 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B45F42ECB; Thu, 31 Oct 2013 13:47:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VDle4r005669; Thu, 31 Oct 2013 13:47:40 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VDle2r005666; Thu, 31 Oct 2013 13:47:40 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311347.r9VDle2r005666@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 13:47:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257445 - in stable/10/sys: conf dev/altera/sdcard X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 13:47:41 -0000 Author: brooks Date: Thu Oct 31 13:47:39 2013 New Revision: 257445 URL: http://svnweb.freebsd.org/changeset/base/257445 Log: MFC: r256743, r256744 MFP4: Change 227594 by brooks@brooks_zenith on 2013/04/11 17:10:14 When we fail, print the error that occurred if we are giving up or if bootverbose is set. MFP4 (driver change only): Change 231100 by brooks@brooks_zenith on 2013/07/12 21:01:31 Add a new option ALTERA_SDCARD_FAST_SIM which checks immediately for success of I/O operations rather than queuing a task. Sponsored by: DARPA/AFRL Approved by: re (glebius) Modified: stable/10/sys/conf/options stable/10/sys/dev/altera/sdcard/altera_sdcard.c stable/10/sys/dev/altera/sdcard/altera_sdcard_io.c Directory Properties: stable/10/sys/ (props changed) stable/10/sys/conf/ (props changed) Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Thu Oct 31 13:00:35 2013 (r257444) +++ stable/10/sys/conf/options Thu Oct 31 13:47:39 2013 (r257445) @@ -68,6 +68,7 @@ TEXTDUMP_VERBOSE opt_ddb.h # Miscellaneous options. ADAPTIVE_LOCKMGRS ALQ +ALTERA_SDCARD_FAST_SIM opt_altera_sdcard.h AUDIT opt_global.h BOOTHOWTO opt_global.h BOOTVERBOSE opt_global.h Modified: stable/10/sys/dev/altera/sdcard/altera_sdcard.c ============================================================================== --- stable/10/sys/dev/altera/sdcard/altera_sdcard.c Thu Oct 31 13:00:35 2013 (r257444) +++ stable/10/sys/dev/altera/sdcard/altera_sdcard.c Thu Oct 31 13:47:39 2013 (r257445) @@ -31,6 +31,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_altera_sdcard.h" + #include #include #include @@ -258,6 +260,9 @@ altera_sdcard_task_io(struct altera_sdca ALTERA_SDCARD_LOCK_ASSERT(sc); KASSERT(sc->as_currentbio != NULL, ("%s: no current I/O", __func__)); +#ifdef ALTERA_SDCARD_FAST_SIM +recheck: +#endif asr = altera_sdcard_read_asr(sc); /* @@ -299,9 +304,12 @@ altera_sdcard_task_io(struct altera_sdca /* * Finally, either start the next I/O or transition to the IDLE state. */ - if (bioq_first(&sc->as_bioq) != NULL) + if (bioq_first(&sc->as_bioq) != NULL) { altera_sdcard_nextio(sc); - else +#ifdef ALTERA_SDCARD_FAST_SIM + goto recheck; +#endif + } else sc->as_state = ALTERA_SDCARD_STATE_IDLE; } @@ -398,6 +406,8 @@ altera_sdcard_start(struct altera_sdcard taskqueue_cancel_timeout(sc->as_taskqueue, &sc->as_task, NULL); altera_sdcard_nextio(sc); - taskqueue_enqueue_timeout(sc->as_taskqueue, &sc->as_task, - ALTERA_SDCARD_TIMEOUT_IO); +#ifdef ALTERA_SDCARD_FAST_SIM + altera_sdcard_task_io(sc); +#endif + altera_sdcard_task_rechedule(sc); } Modified: stable/10/sys/dev/altera/sdcard/altera_sdcard_io.c ============================================================================== --- stable/10/sys/dev/altera/sdcard/altera_sdcard_io.c Thu Oct 31 13:00:35 2013 (r257444) +++ stable/10/sys/dev/altera/sdcard/altera_sdcard_io.c Thu Oct 31 13:47:39 2013 (r257445) @@ -390,20 +390,23 @@ altera_sdcard_io_complete(struct altera_ break; } if (error) { + sc->as_retriesleft--; + if (sc->as_retriesleft == 0 || bootverbose) + device_printf(sc->as_dev, "%s: %s operation block %ju " + "length %ju failed; asr 0x%08x (rr1: 0x%04x)%s\n", + __func__, bp->bio_cmd == BIO_READ ? "BIO_READ" : + (bp->bio_cmd == BIO_WRITE ? "BIO_WRITE" : + "unknown"), + bp->bio_pblkno, bp->bio_bcount, asr, rr1, + sc->as_retriesleft != 0 ? " retrying" : ""); /* * This attempt experienced an error; possibly retry. */ - sc->as_retriesleft--; if (sc->as_retriesleft != 0) { sc->as_flags |= ALTERA_SDCARD_FLAG_IOERROR; altera_sdcard_io_start_internal(sc, bp); return (0); } - device_printf(sc->as_dev, "%s: %s operation block %ju length " - "%ju failed; asr 0x%08x (rr1: 0x%04x)\n", __func__, - bp->bio_cmd == BIO_READ ? "BIO_READ" : - (bp->bio_cmd == BIO_WRITE ? "BIO_WRITE" : "unknown"), - bp->bio_pblkno, bp->bio_bcount, asr, rr1); sc->as_flags &= ~ALTERA_SDCARD_FLAG_IOERROR; } else { /* From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 13:54:55 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D1CD8C57; Thu, 31 Oct 2013 13:54:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A46A72F62; Thu, 31 Oct 2013 13:54:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VDstsb008670; Thu, 31 Oct 2013 13:54:55 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VDstuJ008669; Thu, 31 Oct 2013 13:54:55 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311354.r9VDstuJ008669@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 13:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257447 - in stable/10/sys: dev/altera/atse mips/beri X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 13:54:55 -0000 Author: brooks Date: Thu Oct 31 13:54:55 2013 New Revision: 257447 URL: http://svnweb.freebsd.org/changeset/base/257447 Log: MFC r256752, r256946 MFP4: 221483, 221567, 221568, 221670, 221677, 221678, 221800, 221801, 221804, 221805, 222004, 222006, 222055, 222820, 1135077, 1135118, 1136259 Add atse(4), a driver for the Altera Triple Speed Ethernet MegaCore. The current driver support gigabit Ethernet speeds only and works with the MegaCore only in the internal FIFO configuration in the soon to be open sourced BERI CPU configuration. MFP4: 1187103, 222076, 222057, 222051, 221799 Add atsectl, a simple utility to read and update MAC addresses stored in the default flash location on Altera DE4 boards. Typically used once when setting up a board so leaving in tools rather than inflicting on all users. To build with world add LOCAL_DIRS=tools/tools/atsectl to the make command line. Submitted by: bz Sponsored by: DARPA/AFRL Approved by: re (glebius) Added: stable/10/sys/dev/altera/atse/ - copied from r256752, head/sys/dev/altera/atse/ - copied from r257399, head/tools/tools/atsectl/ Directory Properties: stable/10/tools/tools/atsectl/ (props changed) Modified: stable/10/sys/mips/beri/files.beri Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/mips/beri/files.beri ============================================================================== --- stable/10/sys/mips/beri/files.beri Thu Oct 31 13:54:51 2013 (r257446) +++ stable/10/sys/mips/beri/files.beri Thu Oct 31 13:54:55 2013 (r257447) @@ -1,4 +1,7 @@ # $FreeBSD$ +dev/altera/atse/if_atse.c optional altera_atse +dev/altera/atse/if_atse_fdt.c optional altera_atse fdt +dev/altera/atse/if_atse_nexus.c optional altera_atse dev/altera/jtag_uart/altera_jtag_uart_cons.c optional altera_jtag_uart dev/altera/jtag_uart/altera_jtag_uart_tty.c optional altera_jtag_uart dev/altera/jtag_uart/altera_jtag_uart_fdt.c optional altera_jtag_uart fdt From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 14:07:01 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1447A95E; Thu, 31 Oct 2013 14:07:01 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DA4CE20D0; Thu, 31 Oct 2013 14:07:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VE70cT012643; Thu, 31 Oct 2013 14:07:00 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VE70QB012640; Thu, 31 Oct 2013 14:07:00 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311407.r9VE70QB012640@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 14:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257449 - in stable/10: . share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 14:07:01 -0000 Author: brooks Date: Thu Oct 31 14:07:00 2013 New Revision: 257449 URL: http://svnweb.freebsd.org/changeset/base/257449 Log: MFC r256915 Stop conflating WITHOUT_CLANG with WITHOUT_CLANG_IS_CC. This allows bootstrapping a copy of clang without building clang for the base system which is useful for nanobsd and similar setups. It's still probably wrong to conflate what is installed as /usr/bin/cc with the selection of a bootstrap compiler under WITH*_CLANG_IS_CC, but that's for another day. Sponsored by: DARPA/AFRL Approved by: re (gjb) Modified: stable/10/Makefile.inc1 (contents, props changed) stable/10/share/mk/bsd.own.mk Directory Properties: stable/10/share/mk/ (props changed) stable/10/tools/build/options/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Thu Oct 31 13:57:11 2013 (r257448) +++ stable/10/Makefile.inc1 Thu Oct 31 14:07:00 2013 (r257449) @@ -1381,12 +1381,10 @@ _binutils= gnu/usr.bin/binutils # If an full path to an external cross compiler is given, don't build # a cross compiler. .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no" -.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") +.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && ${TARGET} != "pc98" _clang= usr.bin/clang _clang_libs= lib/clang -.endif - -.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98") +.else _cc= gnu/usr.bin/cc .endif .endif Modified: stable/10/share/mk/bsd.own.mk ============================================================================== --- stable/10/share/mk/bsd.own.mk Thu Oct 31 13:57:11 2013 (r257448) +++ stable/10/share/mk/bsd.own.mk Thu Oct 31 14:07:00 2013 (r257449) @@ -554,7 +554,6 @@ MK_GDB:= no .if ${MK_CLANG} == "no" MK_CLANG_EXTRAS:= no MK_CLANG_FULL:= no -MK_CLANG_IS_CC:= no .endif .if ${MK_CLANG_IS_CC} == "no" From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 14:11:15 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 947CCB71; Thu, 31 Oct 2013 14:11:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 68101212E; Thu, 31 Oct 2013 14:11:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VEBF4K015499; Thu, 31 Oct 2013 14:11:15 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VEBFFF015498; Thu, 31 Oct 2013 14:11:15 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311411.r9VEBFFF015498@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 14:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257450 - stable/10/share/man/man5 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 14:11:15 -0000 Author: brooks Date: Thu Oct 31 14:11:14 2013 New Revision: 257450 URL: http://svnweb.freebsd.org/changeset/base/257450 Log: Notional MFC of r257057: Regen documentation post r257449: Stop conflating WITHOUT_CLANG with WITHOUT_CLANG_IS_CC. This allows bootstrapping a copy of clang without building clang for the base system which is useful for nanobsd and similar setups. It's still probably wrong to conflate what is installed as /usr/bin/cc with the selection of a bootstrap compiler under WITH*_CLANG_IS_CC, but that's for another day. Sponsored by: DARPA/AFRL Approved by: re (gjb) Modified: stable/10/share/man/man5/src.conf.5 Directory Properties: stable/10/share/man/man5/ (props changed) Modified: stable/10/share/man/man5/src.conf.5 ============================================================================== --- stable/10/share/man/man5/src.conf.5 Thu Oct 31 14:07:00 2013 (r257449) +++ stable/10/share/man/man5/src.conf.5 Thu Oct 31 14:11:14 2013 (r257450) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des .\" $FreeBSD$ -.Dd October 6, 2013 +.Dd October 31, 2013 .Dt SRC.CONF 5 .Os .Sh NAME @@ -208,10 +208,6 @@ When set, it also enforces the following .Va WITHOUT_CLANG_EXTRAS .It .Va WITHOUT_CLANG_FULL -.It -.Va WITHOUT_CLANG_IS_CC -.It -.Va WITHOUT_LLDB .El .It Va WITH_CLANG .\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru @@ -323,11 +319,7 @@ When set, it also enforces the following .It .Va WITHOUT_CLANG_FULL .It -.Va WITHOUT_CLANG_IS_CC -.It .Va WITHOUT_GROFF -.It -.Va WITHOUT_LLDB .El .It Va WITH_DEBUG_FILES .\" from FreeBSD: head/tools/build/options/WITH_DEBUG_FILES 251512 2013-06-07 21:40:02Z emaste @@ -910,7 +902,7 @@ This includes .Xr rsh 1 , etc. .It Va WITHOUT_RCS -.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 156932 2006-03-21 07:50:50Z ru +.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 256198 2013-10-09 17:07:20Z gjb Set to not build .Xr rcs 1 and related utilities. @@ -1030,13 +1022,9 @@ When set, it also enforces the following .It .Va WITHOUT_CLANG_FULL .It -.Va WITHOUT_CLANG_IS_CC -.It .Va WITHOUT_GCC .It .Va WITHOUT_GDB -.It -.Va WITHOUT_LLDB .El .It Va WITHOUT_UNBOUND .\" from FreeBSD: head/tools/build/options/WITHOUT_UNBOUND 255597 2013-09-15 14:51:23Z des From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 16:16:54 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7AF00100; Thu, 31 Oct 2013 16:16:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6618D2BD9; Thu, 31 Oct 2013 16:16:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VGGsjj060673; Thu, 31 Oct 2013 16:16:54 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VGGrmm060666; Thu, 31 Oct 2013 16:16:53 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311616.r9VGGrmm060666@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 16:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257456 - in stable/10: share/man/man4 sys/conf sys/dev/isf sys/mips/conf usr.sbin usr.sbin/isfctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 16:16:54 -0000 Author: brooks Date: Thu Oct 31 16:16:52 2013 New Revision: 257456 URL: http://svnweb.freebsd.org/changeset/base/257456 Log: MFC r256865 Remove the isf(4) driver. It was created by accident and is subset of the cfi(4) driver. It remained in the tree longer than would be ideal due to the time required to bring cfi(4) to feature parity. Sponsored by: DARPA/AFRL Approved by: re (gjb) Deleted: stable/10/share/man/man4/isf.4 stable/10/sys/dev/isf/ stable/10/usr.sbin/isfctl/ Modified: stable/10/share/man/man4/Makefile stable/10/sys/conf/files stable/10/sys/mips/conf/BERI_DE4.hints stable/10/sys/mips/conf/BERI_DE4_MDROOT stable/10/sys/mips/conf/BERI_DE4_SDROOT stable/10/usr.sbin/Makefile Directory Properties: stable/10/share/man/man4/ (props changed) stable/10/sys/ (props changed) stable/10/sys/conf/ (props changed) stable/10/usr.sbin/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Thu Oct 31 15:46:10 2013 (r257455) +++ stable/10/share/man/man4/Makefile Thu Oct 31 16:16:52 2013 (r257456) @@ -195,7 +195,6 @@ MAN= aac.4 \ ipwfw.4 \ isci.4 \ iscsi_initiator.4 \ - isf.4 \ isp.4 \ ispfw.4 \ iwi.4 \ Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Oct 31 15:46:10 2013 (r257455) +++ stable/10/sys/conf/files Thu Oct 31 16:16:52 2013 (r257456) @@ -1539,9 +1539,6 @@ dev/iscsi_initiator/isc_cam.c optional i dev/iscsi_initiator/isc_soc.c optional iscsi_initiator scbus dev/iscsi_initiator/isc_sm.c optional iscsi_initiator scbus dev/iscsi_initiator/isc_subr.c optional iscsi_initiator scbus -dev/isf/isf.c optional isf -dev/isf/isf_fdt.c optional isf fdt -dev/isf/isf_nexus.c optional isf dev/isp/isp.c optional isp dev/isp/isp_freebsd.c optional isp dev/isp/isp_library.c optional isp Modified: stable/10/sys/mips/conf/BERI_DE4.hints ============================================================================== --- stable/10/sys/mips/conf/BERI_DE4.hints Thu Oct 31 15:46:10 2013 (r257455) +++ stable/10/sys/mips/conf/BERI_DE4.hints Thu Oct 31 16:16:52 2013 (r257456) @@ -55,7 +55,6 @@ hint.altera_avgen.0.devname="berirom" # # Expose the DE4 flash via an Avalon "generic" device. -# This is incompatible with the isf(4) driver. # #hint.altera_avgen.0.at="nexus0" #hint.altera_avgen.0.maddr=0x74000000 @@ -74,38 +73,3 @@ hint.altera_avgen.0.msize=2 hint.altera_avgen.0.width=1 hint.altera_avgen.0.fileio="r" hint.altera_avgen.0.devname="de4bsw" - -# -# General Intel StrataFlash driver -# -hint.isf.0.at="nexus0" -hint.isf.0.maddr=0x74000000 -hint.isf.0.msize=0x2000000 -hint.isf.1.at="nexus0" -hint.isf.1.maddr=0x76000000 -hint.isf.1.msize=0x2000000 - -# Reserved configuration blocks. Don't touch. -hint.map.0.at="isf0" -hint.map.0.start=0x00000000 -hint.map.0.end=0x00020000 -hint.map.0.name="config" -hint.map.0.readonly=1 - -# Hardwired location of bitfile -hint.map.1.at="isf0" -hint.map.1.start=0x00020000 -hint.map.1.end=0x01820000 -hint.map.1.name="fpga" - -# Kernel on first chip -hint.map.2.at="isf0" -hint.map.2.start=0x01820000 -hint.map.2.end=0x02000000 -hint.map.2.name="reserved" - -# The second chip -hint.map.3.at="isf1" -hint.map.3.start=0x00000000 -hint.map.3.end=0x02000000 -hint.map.3.name="kernel" Modified: stable/10/sys/mips/conf/BERI_DE4_MDROOT ============================================================================== --- stable/10/sys/mips/conf/BERI_DE4_MDROOT Thu Oct 31 15:46:10 2013 (r257455) +++ stable/10/sys/mips/conf/BERI_DE4_MDROOT Thu Oct 31 16:16:52 2013 (r257456) @@ -26,5 +26,4 @@ device altera_sdcard device terasic_de4led device terasic_mtl -device isf device sc Modified: stable/10/sys/mips/conf/BERI_DE4_SDROOT ============================================================================== --- stable/10/sys/mips/conf/BERI_DE4_SDROOT Thu Oct 31 15:46:10 2013 (r257455) +++ stable/10/sys/mips/conf/BERI_DE4_SDROOT Thu Oct 31 16:16:52 2013 (r257456) @@ -20,5 +20,4 @@ device altera_sdcard device terasic_de4led device terasic_mtl -device isf device sc Modified: stable/10/usr.sbin/Makefile ============================================================================== --- stable/10/usr.sbin/Makefile Thu Oct 31 15:46:10 2013 (r257455) +++ stable/10/usr.sbin/Makefile Thu Oct 31 16:16:52 2013 (r257456) @@ -37,7 +37,6 @@ SUBDIR= adduser \ inetd \ iostat \ iscsid \ - isfctl \ kldxref \ mailwrapper \ makefs \ From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 16:18:38 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 467222C4; Thu, 31 Oct 2013 16:18:38 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 24A3B2BF8; Thu, 31 Oct 2013 16:18:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VGIcEp060910; Thu, 31 Oct 2013 16:18:38 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VGIbNa060905; Thu, 31 Oct 2013 16:18:37 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311618.r9VGIbNa060905@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 16:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257457 - in stable/10/sys: conf dev/fdt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 16:18:38 -0000 Author: brooks Date: Thu Oct 31 16:18:36 2013 New Revision: 257457 URL: http://svnweb.freebsd.org/changeset/base/257457 Log: MFC r256861: MFP4: 223121 (FDT infrastructure portion) Implement support for interrupt-parent nodes in simplebus. The current implementation requires that device declarations have an interrupt-parent node and that it point to a device that has registered itself as a interrupt controller in fdt_ic_list_head and implements the fdt_ic interface. Sponsored by: DARPA/AFRL Approved by: re (gjb) Added: - copied unchanged from r256861, head/sys/dev/fdt/fdt_ic_if.m Directory Properties: stable/10/sys/dev/fdt/fdt_ic_if.m (props changed) Modified: stable/10/sys/conf/files stable/10/sys/dev/fdt/fdt_common.c stable/10/sys/dev/fdt/fdt_common.h stable/10/sys/dev/fdt/simplebus.c Directory Properties: stable/10/sys/ (props changed) stable/10/sys/conf/ (props changed) Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Oct 31 16:16:52 2013 (r257456) +++ stable/10/sys/conf/files Thu Oct 31 16:18:36 2013 (r257457) @@ -1400,6 +1400,7 @@ dev/exca/exca.c optional cbb dev/fatm/if_fatm.c optional fatm pci dev/fb/splash.c optional splash dev/fdt/fdt_common.c optional fdt +dev/fdt/fdt_ic_if.m optional fdt dev/fdt/fdt_pci.c optional fdt pci dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \ Modified: stable/10/sys/dev/fdt/fdt_common.c ============================================================================== --- stable/10/sys/dev/fdt/fdt_common.c Thu Oct 31 16:16:52 2013 (r257456) +++ stable/10/sys/dev/fdt/fdt_common.c Thu Oct 31 16:18:36 2013 (r257457) @@ -63,6 +63,8 @@ vm_paddr_t fdt_immr_pa; vm_offset_t fdt_immr_va; vm_offset_t fdt_immr_size; +struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head); + int fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size) { Modified: stable/10/sys/dev/fdt/fdt_common.h ============================================================================== --- stable/10/sys/dev/fdt/fdt_common.h Thu Oct 31 16:16:52 2013 (r257456) +++ stable/10/sys/dev/fdt/fdt_common.h Thu Oct 31 16:18:36 2013 (r257457) @@ -70,6 +70,13 @@ struct fdt_fixup_entry { }; extern struct fdt_fixup_entry fdt_fixup_table[]; +extern SLIST_HEAD(fdt_ic_list, fdt_ic) fdt_ic_list_head; +struct fdt_ic { + SLIST_ENTRY(fdt_ic) fdt_ics; + ihandle_t iph; + device_t dev; +}; + extern vm_paddr_t fdt_immr_pa; extern vm_offset_t fdt_immr_va; extern vm_offset_t fdt_immr_size; Copied: stable/10/sys/dev/fdt/fdt_ic_if.m (from r256861, head/sys/dev/fdt/fdt_ic_if.m) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/fdt/fdt_ic_if.m Thu Oct 31 16:18:36 2013 (r257457, copy of r256861, head/sys/dev/fdt/fdt_ic_if.m) @@ -0,0 +1,266 @@ +#- +# Copyright (c) 2013 SRI International +# Copyright (c) 1998-2004 Doug Rabson +# 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 + +/** + * @defgroup FST_IC fdt_ic - KObj methods for interrupt controllers + * @brief A set of methods required device drivers that are interrupt + * controllers. Derived from sys/kern/bus_if.m. + * @{ + */ +INTERFACE fdt_ic; + +/** + * @brief Allocate an interrupt resource + * + * This method is called by child devices of an interrupt controller to + * allocate an interrup. The meaning of the resource-ID field varies + * from bus to bus and is opaque to the interrupt controller. If a + * resource was allocated and the caller did not use the RF_ACTIVE + * to specify that it should be activated immediately, the caller is + * responsible for calling FDT_IC_ACTIVATE_INTR() when it actually uses + * the interupt. + * + * @param _dev the interrupt-parent device of @p _child + * @param _child the device which is requesting an allocation + * @param _rid a pointer to the resource identifier + * @param _irq interrupt source to allocate + * @param _flags any extra flags to control the resource + * allocation - see @c RF_XXX flags in + * for details + * + * @returns the interrupt which was allocated or @c NULL if no + * resource could be allocated + */ +METHOD struct resource * alloc_intr { + device_t _dev; + device_t _child; + int *_rid; + u_long _irq; + u_int _flags; +}; + +/** + * @brief Activate an interrupt + * + * Activate an interrupt previously allocated with FDT_IC_ALLOC_INTR(). + * + * @param _dev the parent device of @p _child + * @param _r interrupt to activate + */ +METHOD int activate_intr { + device_t _dev; + struct resource *_r; +}; + +/** + * @brief Deactivate an interrupt + * + * Deactivate a resource previously allocated with FDT_IC_ALLOC_INTR(). + * + * @param _dev the parent device of @p _child + * @param _r the interrupt to deactivate + */ +METHOD int deactivate_intr { + device_t _dev; + struct resource *_r; +}; + +/** + * @brief Release an interrupt + * + * Free an interupt allocated by the FDT_IC_ALLOC_INTR. + * + * @param _dev the parent device of @p _child + * @param _r the resource to release + */ +METHOD int release_intr { + device_t _dev; + struct resource *_res; +}; + +/** + * @brief Install an interrupt handler + * + * This method is used to associate an interrupt handler function with + * an irq resource. When the interrupt triggers, the function @p _intr + * will be called with the value of @p _arg as its single + * argument. The value returned in @p *_cookiep is used to cancel the + * interrupt handler - the caller should save this value to use in a + * future call to FDT_IC_TEARDOWN_INTR(). + * + * @param _dev the interrupt-parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + * @param _flags a set of bits from enum intr_type specifying + * the class of interrupt + * @param _intr the function to call when the interrupt + * triggers + * @param _arg a value to use as the single argument in calls + * to @p _intr + * @param _cookiep a pointer to a location to recieve a cookie + * value that may be used to remove the interrupt + * handler + */ +METHOD int setup_intr { + device_t _dev; + device_t _child; + struct resource *_irq; + int _flags; + driver_filter_t *_filter; + driver_intr_t *_intr; + void *_arg; + void **_cookiep; +}; + +/** + * @brief Uninstall an interrupt handler + * + * This method is used to disassociate an interrupt handler function + * with an irq resource. The value of @p _cookie must be the value + * returned from a previous call to FDT_IC_SETUP_INTR(). + * + * @param _dev the interrupt-parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + * @param _cookie the cookie value returned when the interrupt + * was originally registered + */ +METHOD int teardown_intr { + device_t _dev; + device_t _child; + struct resource *_irq; + void *_cookie; +}; + +/** + * @brief Allow drivers to request that an interrupt be bound to a specific + * CPU. + * + * @param _dev the interrupt-parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + * @param _cpu the CPU to bind the interrupt to + */ +METHOD int bind_intr { + device_t _dev; + device_t _child; + struct resource *_irq; + int _cpu; +}; + +/** + * @brief Allow drivers to specify the trigger mode and polarity + * of the specified interrupt. + * + * @param _dev the interrupt-parent device + * @param _irq the interrupt number to modify + * @param _trig the trigger mode required + * @param _pol the interrupt polarity required + */ +METHOD int config_intr { + device_t _dev; + int _irq; + enum intr_trigger _trig; + enum intr_polarity _pol; +}; + +/** + * @brief Allow drivers to associate a description with an active + * interrupt handler. + * + * @param _dev the interrupt-parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + * @param _cookie the cookie value returned when the interrupt + * was originally registered + * @param _descr the description to associate with the interrupt + */ +METHOD int describe_intr { + device_t _dev; + device_t _child; + struct resource *_irq; + void *_cookie; + const char *_descr; +}; + +/** + * @brief Notify an ic that specified child's IRQ should be remapped. + * + * @param _dev the interrupt-parent device + * @param _child the child device + * @param _irq the irq number + */ +METHOD int remap_intr { + device_t _dev; + device_t _child; + u_int _irq; +}; + +/** + * @brief Enable an IPI source. + * + * @param _dev the interrupt controller + * @param _tid the thread ID (relative to the interrupt controller) + * to enable IPIs for + * @param _ipi_irq hardware IRQ to send IPIs to + */ +METHOD void setup_ipi { + device_t _dev; + u_int _tid; + u_int _irq; +}; + +/** + * @brief Send an IPI to the specified thread. + * + * @param _dev the interrupt controller + * @param _tid the thread ID (relative to the interrupt controller) + * to send IPIs to + */ +METHOD void send_ipi { + device_t _dev; + u_int _tid; +}; + +/** + * @brief Clear the IPI on the specfied thread. Only call with the + * local hardware thread or interrupts may be lost! + * + * @param _dev the interrupt controller + * @param _tid the thread ID (relative to the interrupt controller) + * to clear the IPI on + */ +METHOD void clear_ipi { + device_t _dev; + u_int _tid; +}; Modified: stable/10/sys/dev/fdt/simplebus.c ============================================================================== --- stable/10/sys/dev/fdt/simplebus.c Thu Oct 31 16:16:52 2013 (r257456) +++ stable/10/sys/dev/fdt/simplebus.c Thu Oct 31 16:18:36 2013 (r257457) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include "fdt_common.h" +#include "fdt_ic_if.h" #include "ofw_bus_if.h" #ifdef DEBUG @@ -80,9 +81,18 @@ static int simplebus_attach(device_t); static int simplebus_print_child(device_t, device_t); static int simplebus_setup_intr(device_t, device_t, struct resource *, int, driver_filter_t *, driver_intr_t *, void *, void **); +static int simplebus_teardown_intr(device_t, device_t, struct resource *, + void *); +static int simplebus_activate_resource(device_t, device_t, int, int, + struct resource *); static struct resource *simplebus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); +static int simplebus_deactivate_resource(device_t, device_t, int, int, + struct resource *); +static int simplebus_release_resource(device_t, device_t, int, int, + struct resource *); +static device_t simplebus_get_interrupt_parent(device_t); static struct resource_list *simplebus_get_resource_list(device_t, device_t); static ofw_bus_get_devinfo_t simplebus_get_devinfo; @@ -102,11 +112,11 @@ static device_method_t simplebus_methods /* Bus interface */ DEVMETHOD(bus_print_child, simplebus_print_child), DEVMETHOD(bus_alloc_resource, simplebus_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_release_resource, simplebus_release_resource), + DEVMETHOD(bus_activate_resource, simplebus_activate_resource), + DEVMETHOD(bus_deactivate_resource, simplebus_deactivate_resource), DEVMETHOD(bus_setup_intr, simplebus_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_teardown_intr, simplebus_teardown_intr), DEVMETHOD(bus_get_resource_list, simplebus_get_resource_list), /* OFW bus interface */ @@ -217,6 +227,7 @@ simplebus_attach(device_t dev) static int simplebus_print_child(device_t dev, device_t child) { + device_t ip; struct simplebus_devinfo *di; struct resource_list *rl; int rv; @@ -228,6 +239,8 @@ simplebus_print_child(device_t dev, devi rv += bus_print_child_header(dev, child); rv += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx"); rv += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); + if ((ip = simplebus_get_interrupt_parent(child)) != NULL) + rv += printf(" (%s)", device_get_nameunit(ip)); rv += bus_print_child_footer(dev, child); return (rv); @@ -237,6 +250,7 @@ static struct resource * simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { + device_t ic; struct simplebus_devinfo *di; struct resource_list_entry *rle; @@ -263,10 +277,53 @@ simplebus_alloc_resource(device_t bus, d count = rle->count; } + if (type == SYS_RES_IRQ && + (ic = simplebus_get_interrupt_parent(child)) != NULL) + return(FDT_IC_ALLOC_INTR(ic, child, rid, start, flags)); + return (bus_generic_alloc_resource(bus, child, type, rid, start, end, count, flags)); } +static int +simplebus_activate_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + device_t ic; + + if (type == SYS_RES_IRQ && + (ic = simplebus_get_interrupt_parent(child)) != NULL) + return (FDT_IC_ACTIVATE_INTR(ic, r)); + + return (bus_generic_activate_resource(dev, child, type, rid, r)); +} + +static int +simplebus_deactivate_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + device_t ic; + + if (type == SYS_RES_IRQ && + (ic = simplebus_get_interrupt_parent(child)) != NULL) + return (FDT_IC_DEACTIVATE_INTR(ic, r)); + + return (bus_generic_deactivate_resource(dev, child, type, rid, r)); +} + +static int +simplebus_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + device_t ic; + + if (type == SYS_RES_IRQ && + (ic = simplebus_get_interrupt_parent(child)) != NULL) + return (FDT_IC_RELEASE_INTR(ic, r)); + + return (bus_generic_release_resource(dev, child, type, rid, r)); +} + static struct resource_list * simplebus_get_resource_list(device_t bus, device_t child) { @@ -276,15 +333,45 @@ simplebus_get_resource_list(device_t bus return (&di->di_res); } +static device_t +simplebus_get_interrupt_parent(device_t dev) +{ + struct simplebus_devinfo *di; + struct fdt_ic *ic; + device_t ip; + ihandle_t iph; + phandle_t ph; + + ip = NULL; + + di = device_get_ivars(dev); + if (di == NULL) + return (NULL); + + if (OF_getprop(di->di_ofw.obd_node, "interrupt-parent", &iph, + sizeof(iph)) > 0) { + iph = fdt32_to_cpu(iph); + ph = OF_instance_to_package(iph); + SLIST_FOREACH(ic, &fdt_ic_list_head, fdt_ics) { + if (ic->iph == ph) { + ip = ic->dev; + break; + } + } + } + return (ip); +} + static int simplebus_setup_intr(device_t bus, device_t child, struct resource *res, int flags, driver_filter_t *filter, driver_intr_t *ihand, void *arg, void **cookiep) { struct simplebus_devinfo *di; + device_t ic; enum intr_trigger trig; enum intr_polarity pol; - int error, rid; + int error, irq, rid; di = device_get_ivars(child); if (di == NULL) @@ -297,20 +384,41 @@ simplebus_setup_intr(device_t bus, devic if (rid >= DI_MAX_INTR_NUM) return (ENOENT); + ic = simplebus_get_interrupt_parent(child); + trig = di->di_intr_sl[rid].trig; pol = di->di_intr_sl[rid].pol; if (trig != INTR_TRIGGER_CONFORM || pol != INTR_POLARITY_CONFORM) { - error = bus_generic_config_intr(bus, rman_get_start(res), - trig, pol); + irq = rman_get_start(res); + if (ic != NULL) + error = FDT_IC_CONFIG_INTR(ic, irq, trig, pol); + else + error = bus_generic_config_intr(bus, irq, trig, pol); if (error) return (error); } - error = bus_generic_setup_intr(bus, child, res, flags, filter, ihand, - arg, cookiep); + if (ic != NULL) + error = FDT_IC_SETUP_INTR(ic, child, res, flags, filter, + ihand, arg, cookiep); + else + error = bus_generic_setup_intr(bus, child, res, flags, filter, + ihand, arg, cookiep); return (error); } +static int +simplebus_teardown_intr(device_t bus, device_t child, struct resource *res, + void *cookie) +{ + device_t ic; + + if ((ic = simplebus_get_interrupt_parent(child)) != NULL) + return (FDT_IC_TEARDOWN_INTR(ic, child, res, cookie)); + + return (bus_generic_teardown_intr(bus, child, res, cookie)); +} + static const struct ofw_bus_devinfo * simplebus_get_devinfo(device_t bus, device_t child) { From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 17:56:27 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BE0FF69C; Thu, 31 Oct 2013 17:56:27 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AB35923FF; Thu, 31 Oct 2013 17:56:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VHuRvW093774; Thu, 31 Oct 2013 17:56:27 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VHuRbV093773; Thu, 31 Oct 2013 17:56:27 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311756.r9VHuRbV093773@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 17:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257459 - stable/10/gnu/usr.bin/binutils/ld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 17:56:27 -0000 Author: brooks Date: Thu Oct 31 17:56:27 2013 New Revision: 257459 URL: http://svnweb.freebsd.org/changeset/base/257459 Log: MFC r257268: Enable the --sysroot=/foo option in ld by always building with a sysroot defined. When not building as a cross linker, the sysroot is set to "/". Exp-run by: bdrewery (ports/183206) Approved by: re (gjb) Modified: stable/10/gnu/usr.bin/binutils/ld/Makefile Directory Properties: stable/10/gnu/usr.bin/binutils/ (props changed) Modified: stable/10/gnu/usr.bin/binutils/ld/Makefile ============================================================================== --- stable/10/gnu/usr.bin/binutils/ld/Makefile Thu Oct 31 17:33:29 2013 (r257458) +++ stable/10/gnu/usr.bin/binutils/ld/Makefile Thu Oct 31 17:56:27 2013 (r257459) @@ -31,7 +31,7 @@ CFLAGS+= -DTARGET=\"${TARGET_TUPLE}\" CFLAGS+= -DDEFAULT_EMULATION=\"${NATIVE_EMULATION}\" CFLAGS+= -DSCRIPTDIR=\"${TOOLS_PREFIX}/usr/libdata\" CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\" -CFLAGS+= -DBINDIR=\"${BINDIR}\" -DTARGET_SYSTEM_ROOT=\"${TOOLS_PREFIX}\" +CFLAGS+= -DBINDIR=\"${BINDIR}\" -DTARGET_SYSTEM_ROOT=\"${TOOLS_PREFIX:U/}\" CFLAGS+= -DTOOLBINDIR=\"${TOOLS_PREFIX}/${BINDIR}/libexec\" CFLAGS+= -D_GNU_SOURCE CFLAGS+= -I${SRCDIR}/ld -I${SRCDIR}/bfd From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 18:06:33 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C8A80E39; Thu, 31 Oct 2013 18:06:33 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9B9C624EB; Thu, 31 Oct 2013 18:06:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VI6XSh097347; Thu, 31 Oct 2013 18:06:33 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VI6XKS097343; Thu, 31 Oct 2013 18:06:33 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311806.r9VI6XKS097343@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 18:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257460 - in stable/10: . share/mk tools/build/options X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 18:06:33 -0000 Author: brooks Date: Thu Oct 31 18:06:32 2013 New Revision: 257460 URL: http://svnweb.freebsd.org/changeset/base/257460 Log: MFC r257138: Switch the default mtree to nmtree our new NetBSD derived mtree. Exp-runs by: bdrewery (ports/182438) Sponsored by: DARPA/AFRL Approved by: re (gjb) Added: stable/10/tools/build/options/WITHOUT_NMTREE - copied unchanged from r257138, head/tools/build/options/WITHOUT_NMTREE Deleted: stable/10/tools/build/options/WITH_NMTREE Modified: stable/10/UPDATING (contents, props changed) stable/10/share/mk/bsd.own.mk Directory Properties: stable/10/share/mk/ (props changed) stable/10/tools/build/options/ (props changed) Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Thu Oct 31 17:56:27 2013 (r257459) +++ stable/10/UPDATING Thu Oct 31 18:06:32 2013 (r257460) @@ -16,6 +16,13 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20131031: + The default version of mtree is nmtree which is obtained from + NetBSD. The output is generally the same, but may vary + slightly. If you found you need identical output adding + "-F freebsd9" to the command line should do the trick. For the + time being, the old mtree is available as fmtree. + 20131014: libbsdyml has been renamed to libyaml and moved to /usr/lib/private. This will break ports-mgmt/pkg. Rebuild the port, or upgrade to pkg Modified: stable/10/share/mk/bsd.own.mk ============================================================================== --- stable/10/share/mk/bsd.own.mk Thu Oct 31 17:56:27 2013 (r257459) +++ stable/10/share/mk/bsd.own.mk Thu Oct 31 18:06:32 2013 (r257460) @@ -320,6 +320,7 @@ __DEFAULT_YES_OPTIONS = \ NIS \ NLS \ NLS_CATALOGS \ + NMTREE \ NS_CACHING \ NTP \ OPENSSH \ @@ -370,7 +371,6 @@ __DEFAULT_NO_OPTIONS = \ LIBICONV_COMPAT \ INSTALL_AS_USER \ LLDB \ - NMTREE \ NAND \ OFED \ OPENSSH_NONE_CIPHER \ Copied: stable/10/tools/build/options/WITHOUT_NMTREE (from r257138, head/tools/build/options/WITHOUT_NMTREE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/build/options/WITHOUT_NMTREE Thu Oct 31 18:06:32 2013 (r257460, copy of r257138, head/tools/build/options/WITHOUT_NMTREE) @@ -0,0 +1,9 @@ +.\" $FreeBSD$ +Set to install +.Xr fmtree 8 +as +.Xr mtree 8 . +By default +.Xr nmtree 8 +is installed as +.Xr mtree 8 . From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 18:11:51 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 56995394; Thu, 31 Oct 2013 18:11:51 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 440E02597; Thu, 31 Oct 2013 18:11:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VIBp5G000348; Thu, 31 Oct 2013 18:11:51 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VIBpUb000347; Thu, 31 Oct 2013 18:11:51 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201310311811.r9VIBpUb000347@svn.freebsd.org> From: Brooks Davis Date: Thu, 31 Oct 2013 18:11:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257461 - stable/10/share/man/man5 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 18:11:51 -0000 Author: brooks Date: Thu Oct 31 18:11:50 2013 New Revision: 257461 URL: http://svnweb.freebsd.org/changeset/base/257461 Log: Notional MFC of r257139: Regerate after r257460 swapped the default to WITH_NMTREE. Approved by: re (gjb) Modified: stable/10/share/man/man5/src.conf.5 Directory Properties: stable/10/share/man/man5/ (props changed) Modified: stable/10/share/man/man5/src.conf.5 ============================================================================== --- stable/10/share/man/man5/src.conf.5 Thu Oct 31 18:06:32 2013 (r257460) +++ stable/10/share/man/man5/src.conf.5 Thu Oct 31 18:11:50 2013 (r257461) @@ -764,14 +764,14 @@ Set to not build NLS catalogs. .\" from FreeBSD: head/tools/build/options/WITHOUT_NLS_CATALOGS 156932 2006-03-21 07:50:50Z ru Set to not build NLS catalog support for .Xr csh 1 . -.It Va WITH_NMTREE -.\" from FreeBSD: head/tools/build/options/WITH_NMTREE 245435 2013-01-14 20:38:32Z brooks +.It Va WITHOUT_NMTREE +.\" from FreeBSD: stable/10/tools/build/options/WITHOUT_NMTREE 257460 2013-10-31 18:06:32Z brooks Set to install -.Xr nmtree 8 +.Xr fmtree 8 as .Xr mtree 8 . By default -.Xr fmtree 8 +.Xr nmtree 8 is installed as .Xr mtree 8 . .It Va WITHOUT_NS_CACHING From owner-svn-src-stable-10@FreeBSD.ORG Thu Oct 31 20:30:27 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 844EA209; Thu, 31 Oct 2013 20:30:27 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 70FB5200E; Thu, 31 Oct 2013 20:30:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9VKURuj047823; Thu, 31 Oct 2013 20:30:27 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9VKURdB047822; Thu, 31 Oct 2013 20:30:27 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201310312030.r9VKURdB047822@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 31 Oct 2013 20:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257468 - stable/10/sbin/hastd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Oct 2013 20:30:27 -0000 Author: trociny Date: Thu Oct 31 20:30:26 2013 New Revision: 257468 URL: http://svnweb.freebsd.org/changeset/base/257468 Log: MFC r257154: Merging local and remote bitmaps must be protected by hr_amp lock. This is believed to fix hastd crashes, which might occur during synchronization, triggered by the failed assertion: Assertion failed: (amp->am_memtab[ext] > 0), function activemap_write_complete, file activemap.c, line 351. Approved by: re (glebius) Modified: stable/10/sbin/hastd/primary.c Directory Properties: stable/10/sbin/hastd/ (props changed) Modified: stable/10/sbin/hastd/primary.c ============================================================================== --- stable/10/sbin/hastd/primary.c Thu Oct 31 20:12:37 2013 (r257467) +++ stable/10/sbin/hastd/primary.c Thu Oct 31 20:30:26 2013 (r257468) @@ -781,6 +781,7 @@ init_remote(struct hast_resource *res, s free(map); goto close; } + mtx_lock(&res->hr_amp_lock); /* * Merge local and remote bitmaps. */ @@ -790,7 +791,6 @@ init_remote(struct hast_resource *res, s * Now that we merged bitmaps from both nodes, flush it to the * disk before we start to synchronize. */ - mtx_lock(&res->hr_amp_lock); (void)hast_activemap_flush(res); } nv_free(nvin); From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 06:26:38 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 37B74DF6; Fri, 1 Nov 2013 06:26:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 171662184; Fri, 1 Nov 2013 06:26:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA16QbEZ053224; Fri, 1 Nov 2013 06:26:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA16QbJQ053223; Fri, 1 Nov 2013 06:26:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311010626.rA16QbJQ053223@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Nov 2013 06:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257491 - stable/10/sys/dev/random X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 06:26:38 -0000 Author: kib Date: Fri Nov 1 06:26:37 2013 New Revision: 257491 URL: http://svnweb.freebsd.org/changeset/base/257491 Log: MFC r256670: Rewrite RDRAND support: Remove the excessive memory accesses to temporary buffer. Streamline the assembly and unify it between i386 and amd64. Approved by: re (glebius) Modified: stable/10/sys/dev/random/ivy.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/random/ivy.c ============================================================================== --- stable/10/sys/dev/random/ivy.c Fri Nov 1 05:03:47 2013 (r257490) +++ stable/10/sys/dev/random/ivy.c Fri Nov 1 06:26:37 2013 (r257491) @@ -1,8 +1,12 @@ /*- + * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2013 David E. O'Brien * Copyright (c) 2012 Konstantin Belousov * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -58,26 +62,25 @@ static struct random_hardware_source ran }; static inline int -ivy_rng_store(uint64_t *tmp) +ivy_rng_store(long *buf) { #ifdef __GNUCLIKE_ASM - uint32_t count; + long tmp; + int retry; + retry = RETRY_COUNT; __asm __volatile( -#ifdef __amd64__ - "rdrand\t%%rax\n\t" - "jnc\t1f\n\t" - "movq\t%%rax,%1\n\t" - "movl\t$8,%%eax\n" -#else /* i386 */ - "rdrand\t%%eax\n\t" - "jnc\t1f\n\t" - "movl\t%%eax,%1\n\t" - "movl\t$4,%%eax\n" -#endif - "1:\n" /* %eax is cleared by processor on failure */ - : "=a" (count), "=g" (*tmp) : "a" (0) : "cc"); - return (count); + "1:\n\t" + "rdrand %2\n\t" /* read randomness into tmp */ + "jb 2f\n\t" /* CF is set on success, exit retry loop */ + "dec %0\n\t" /* otherwise, retry-- */ + "jne 1b\n\t" /* and loop if retries are not exhausted */ + "jmp 3f\n" /* failure, retry is 0, used as return value */ + "2:\n\t" + "mov %2,%1\n\t" /* *buf = tmp */ + "3:" + : "+q" (retry), "=m" (*buf), "=q" (tmp) : : "cc"); + return (retry); #else /* __GNUCLIKE_ASM */ return (0); #endif @@ -86,23 +89,13 @@ ivy_rng_store(uint64_t *tmp) static int random_ivy_read(void *buf, int c) { - uint8_t *b; - int count, ret, retry; - uint64_t tmp; - - b = buf; - for (count = c; count > 0; count -= ret) { - for (retry = 0; retry < RETRY_COUNT; retry++) { - ret = ivy_rng_store(&tmp); - if (ret != 0) - break; - } - if (ret == 0) + long *b; + int count; + + KASSERT(c % sizeof(long) == 0, ("partial read %d", c)); + for (b = buf, count = c; count > 0; count -= sizeof(long), b++) { + if (ivy_rng_store(b) == 0) break; - if (ret > count) - ret = count; - memcpy(b, &tmp, ret); - b += ret; } return (c - count); } From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 06:29:39 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 66776F8A; Fri, 1 Nov 2013 06:29:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 455A32198; Fri, 1 Nov 2013 06:29:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA16Tdux053574; Fri, 1 Nov 2013 06:29:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA16TdOI053573; Fri, 1 Nov 2013 06:29:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311010629.rA16TdOI053573@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Nov 2013 06:29:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257492 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 06:29:39 -0000 Author: kib Date: Fri Nov 1 06:29:38 2013 New Revision: 257492 URL: http://svnweb.freebsd.org/changeset/base/257492 Log: MFC r257069: Add ddb 'show ioapic' and 'show all ioapics' commands. Approved by: re (glebius) Modified: stable/10/sys/x86/x86/io_apic.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/x86/x86/io_apic.c ============================================================================== --- stable/10/sys/x86/x86/io_apic.c Fri Nov 1 06:26:37 2013 (r257491) +++ stable/10/sys/x86/x86/io_apic.c Fri Nov 1 06:29:38 2013 (r257492) @@ -922,3 +922,99 @@ DEFINE_CLASS_0(apic, apic_driver, apic_m static devclass_t apic_devclass; DRIVER_MODULE(apic, nexus, apic_driver, apic_devclass, 0, 0); + +#include "opt_ddb.h" + +#ifdef DDB +#include + +static const char * +ioapic_delivery_mode(uint32_t mode) +{ + + switch (mode) { + case IOART_DELFIXED: + return ("fixed"); + case IOART_DELLOPRI: + return ("lowestpri"); + case IOART_DELSMI: + return ("SMI"); + case IOART_DELRSV1: + return ("rsrvd1"); + case IOART_DELNMI: + return ("NMI"); + case IOART_DELINIT: + return ("INIT"); + case IOART_DELRSV2: + return ("rsrvd2"); + case IOART_DELEXINT: + return ("ExtINT"); + default: + return (""); + } +} + +static u_int +db_ioapic_read(volatile ioapic_t *apic, int reg) +{ + + apic->ioregsel = reg; + return (apic->iowin); +} + +static void +db_show_ioapic_one(volatile ioapic_t *io_addr) +{ + uint32_t r, lo, hi; + int mre, i; + + r = db_ioapic_read(io_addr, IOAPIC_VER); + mre = (r & IOART_VER_MAXREDIR) >> MAXREDIRSHIFT; + db_printf("Id 0x%08x Ver 0x%02x MRE %d\n", + db_ioapic_read(io_addr, IOAPIC_ID), r & IOART_VER_VERSION, mre); + for (i = 0; i < mre; i++) { + lo = db_ioapic_read(io_addr, IOAPIC_REDTBL_LO(i)); + hi = db_ioapic_read(io_addr, IOAPIC_REDTBL_HI(i)); + db_printf(" pin %d Dest %s/%x %smasked Trig %s RemoteIRR %d " + "Polarity %s Status %s DeliveryMode %s Vec %d\n", i, + (lo & IOART_DESTMOD) == IOART_DESTLOG ? "log" : "phy", + (hi & IOART_DEST) >> 24, + (lo & IOART_INTMASK) == IOART_INTMSET ? "" : "not", + (lo & IOART_TRGRMOD) == IOART_TRGRLVL ? "lvl" : "edge", + (lo & IOART_REM_IRR) == IOART_REM_IRR ? 1 : 0, + (lo & IOART_INTPOL) == IOART_INTALO ? "low" : "high", + (lo & IOART_DELIVS) == IOART_DELIVS ? "pend" : "idle", + ioapic_delivery_mode(lo & IOART_DELMOD), + (lo & IOART_INTVEC)); + } +} + +DB_SHOW_COMMAND(ioapic, db_show_ioapic) +{ + struct ioapic *ioapic; + int idx, i; + + if (!have_addr) { + db_printf("usage: show ioapic index\n"); + return; + } + + idx = (int)addr; + i = 0; + STAILQ_FOREACH(ioapic, &ioapic_list, io_next) { + if (idx == i) { + db_show_ioapic_one(ioapic->io_addr); + break; + } + i++; + } +} + +DB_SHOW_ALL_COMMAND(ioapics, db_show_all_ioapics) +{ + struct ioapic *ioapic; + + STAILQ_FOREACH(ioapic, &ioapic_list, io_next) + db_show_ioapic_one(ioapic->io_addr); +} +#endif From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 06:31:02 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D5D70319; Fri, 1 Nov 2013 06:31:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C35F821D2; Fri, 1 Nov 2013 06:31:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA16V2GV055922; Fri, 1 Nov 2013 06:31:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA16V2e2055917; Fri, 1 Nov 2013 06:31:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311010631.rA16V2e2055917@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Nov 2013 06:31:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257493 - stable/10/sys/dev/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 06:31:02 -0000 Author: kib Date: Fri Nov 1 06:31:02 2013 New Revision: 257493 URL: http://svnweb.freebsd.org/changeset/base/257493 Log: MFC r257070: Move the PCI_DMA_BOUNDARY definition into the pcivar.h. Approved by: re (glebius) Modified: stable/10/sys/dev/pci/pci.c stable/10/sys/dev/pci/pcivar.h Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/pci/pci.c ============================================================================== --- stable/10/sys/dev/pci/pci.c Fri Nov 1 06:29:38 2013 (r257492) +++ stable/10/sys/dev/pci/pci.c Fri Nov 1 06:31:02 2013 (r257493) @@ -70,10 +70,6 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" #include "pci_if.h" -#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) -#define PCI_DMA_BOUNDARY 0x100000000 -#endif - #define PCIR_IS_BIOS(cfg, reg) \ (((cfg)->hdrtype == PCIM_HDRTYPE_NORMAL && reg == PCIR_BIOS) || \ ((cfg)->hdrtype == PCIM_HDRTYPE_BRIDGE && reg == PCIR_BIOS_1)) Modified: stable/10/sys/dev/pci/pcivar.h ============================================================================== --- stable/10/sys/dev/pci/pcivar.h Fri Nov 1 06:29:38 2013 (r257492) +++ stable/10/sys/dev/pci/pcivar.h Fri Nov 1 06:31:02 2013 (r257493) @@ -499,6 +499,15 @@ void pci_restore_state(device_t dev); void pci_save_state(device_t dev); int pci_set_max_read_req(device_t dev, int size); + +#ifdef BUS_SPACE_MAXADDR +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#define PCI_DMA_BOUNDARY 0x100000000 +#else +#define PCI_DMA_BOUNDARY 0 +#endif +#endif + #endif /* _SYS_BUS_H_ */ /* From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 06:32:17 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0CECA452; Fri, 1 Nov 2013 06:32:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EF1B121DF; Fri, 1 Nov 2013 06:32:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA16WGx9056095; Fri, 1 Nov 2013 06:32:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA16WGRS056094; Fri, 1 Nov 2013 06:32:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311010632.rA16WGRS056094@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Nov 2013 06:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257494 - stable/10/sys/dev/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 06:32:17 -0000 Author: kib Date: Fri Nov 1 06:32:16 2013 New Revision: 257494 URL: http://svnweb.freebsd.org/changeset/base/257494 Log: MFC r257071: Add some definitions for the bits in root control and status PCIe cap registers. Approved by: re (glebius) Modified: stable/10/sys/dev/pci/pcireg.h Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/pci/pcireg.h ============================================================================== --- stable/10/sys/dev/pci/pcireg.h Fri Nov 1 06:31:02 2013 (r257493) +++ stable/10/sys/dev/pci/pcireg.h Fri Nov 1 06:32:16 2013 (r257494) @@ -762,8 +762,17 @@ #define PCIEM_SLOT_STA_EIS 0x0080 #define PCIEM_SLOT_STA_DLLSC 0x0100 #define PCIER_ROOT_CTL 0x1c +#define PCIEM_ROOT_CTL_SERR_CORR 0x0001 +#define PCIEM_ROOT_CTL_SERR_NONFATAL 0x0002 +#define PCIEM_ROOT_CTL_SERR_FATAL 0x0004 +#define PCIEM_ROOT_CTL_PME 0x0008 +#define PCIEM_ROOT_CTL_CRS_VIS 0x0010 #define PCIER_ROOT_CAP 0x1e +#define PCIEM_ROOT_CAP_CRS_VIS 0x0001 #define PCIER_ROOT_STA 0x20 +#define PCIEM_ROOT_STA_PME_REQID_MASK 0x0000ffff +#define PCIEM_ROOT_STA_PME_STATUS 0x00010000 +#define PCIEM_ROOT_STA_PME_PEND 0x00020000 #define PCIER_DEVICE_CAP2 0x24 #define PCIER_DEVICE_CTL2 0x28 #define PCIEM_CTL2_COMP_TIMEOUT_VAL 0x000f From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 06:33:18 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 580C3581; Fri, 1 Nov 2013 06:33:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 469C021E8; Fri, 1 Nov 2013 06:33:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA16XItL056298; Fri, 1 Nov 2013 06:33:18 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA16XHud056296; Fri, 1 Nov 2013 06:33:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311010633.rA16XHud056296@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Nov 2013 06:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257495 - stable/10/sys/dev/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 06:33:18 -0000 Author: kib Date: Fri Nov 1 06:33:17 2013 New Revision: 257495 URL: http://svnweb.freebsd.org/changeset/base/257495 Log: MFC r257072: Make pci_get_dma_tag() non-static. Approved by: re (glebius) Modified: stable/10/sys/dev/pci/pci.c stable/10/sys/dev/pci/pci_private.h Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/pci/pci.c ============================================================================== --- stable/10/sys/dev/pci/pci.c Fri Nov 1 06:32:16 2013 (r257494) +++ stable/10/sys/dev/pci/pci.c Fri Nov 1 06:33:17 2013 (r257495) @@ -96,7 +96,6 @@ static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); static char *pci_describe_device(device_t dev); -static bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev); static int pci_modevent(module_t mod, int what, void *arg); static void pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg); Modified: stable/10/sys/dev/pci/pci_private.h ============================================================================== --- stable/10/sys/dev/pci/pci_private.h Fri Nov 1 06:32:16 2013 (r257494) +++ stable/10/sys/dev/pci/pci_private.h Fri Nov 1 06:33:17 2013 (r257495) @@ -116,6 +116,7 @@ int pci_child_pnpinfo_str_method(device int pci_assign_interrupt_method(device_t dev, device_t child); int pci_resume(device_t dev); int pci_suspend(device_t dev); +bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev); /** Restore the config register state. The state must be previously * saved with pci_cfg_save. However, the pci bus driver takes care of From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 15:54:58 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1564FF3B; Fri, 1 Nov 2013 15:54:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 00BAE25F3; Fri, 1 Nov 2013 15:54:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1Fsv8h046945; Fri, 1 Nov 2013 15:54:57 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1FsvcC046944; Fri, 1 Nov 2013 15:54:57 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201311011554.rA1FsvcC046944@svn.freebsd.org> From: Glen Barber Date: Fri, 1 Nov 2013 15:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257507 - stable/10/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 15:54:58 -0000 Author: gjb Date: Fri Nov 1 15:54:57 2013 New Revision: 257507 URL: http://svnweb.freebsd.org/changeset/base/257507 Log: MFC r256540, r256544: r256540 (dteske): Add loader.conf(5) entries to import bootpool after boot when using full-disk encryption and ZFS. r256544 (dteske): Fix loader.conf(5) entries from r256540. Approved by: re (hrs) Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/bsdinstall/scripts/zfsboot Directory Properties: stable/10/usr.sbin/bsdinstall/ (props changed) Modified: stable/10/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/zfsboot Fri Nov 1 13:57:30 2013 (r257506) +++ stable/10/usr.sbin/bsdinstall/scripts/zfsboot Fri Nov 1 15:54:57 2013 (r257507) @@ -802,7 +802,7 @@ zfs_create_boot() zpool set cachefile=$BSDINSTALL_CHROOT/boot/zfs/zpool.cache \ "$poolname" || return $FAILURE - # Last, but not least... add required lines to rc.conf(5) + # Last, but not least... required lines for rc.conf(5)/loader.conf(5) # NOTE: We later concatenate these into their destination echo 'zfs_enable="YES"' > $BSDINSTALL_TMPETC/rc.conf.zfs || return $FAILURE @@ -812,6 +812,14 @@ zfs_create_boot() # We're all done unless we should go on to do encryption [ "$ZFSBOOT_GELI_ENCRYPTION" ] || return $SUCCESS + # Some additional GELI requirements for loader.conf(5) + echo 'zpool_cache_load="YES"' \ + >> $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + echo 'zpool_cache_type="/boot/zfs/zpool.cache"' \ + >> $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + echo 'zpool_cache_name="/boot/zfs/zpool.cache"' \ + >> $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE + # # Configure geli(8)-based encryption # From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 16:03:38 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B58554AE; Fri, 1 Nov 2013 16:03:38 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A2A87268A; Fri, 1 Nov 2013 16:03:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1G3ccg050420; Fri, 1 Nov 2013 16:03:38 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1G3cIm050419; Fri, 1 Nov 2013 16:03:38 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201311011603.rA1G3cIm050419@svn.freebsd.org> From: Jeremie Le Hen Date: Fri, 1 Nov 2013 16:03:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257508 - stable/10/etc/defaults X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 16:03:38 -0000 Author: jlh Date: Fri Nov 1 16:03:38 2013 New Revision: 257508 URL: http://svnweb.freebsd.org/changeset/base/257508 Log: MFC r257361: Fix compatibility function for old daily_status_security_${name}_enable variables. PR: conf/183137 MFC r257364: Fix indentation. Approved by: re (gjb) Modified: stable/10/etc/defaults/periodic.conf Directory Properties: stable/10/etc/ (props changed) Modified: stable/10/etc/defaults/periodic.conf ============================================================================== --- stable/10/etc/defaults/periodic.conf Fri Nov 1 15:54:57 2013 (r257507) +++ stable/10/etc/defaults/periodic.conf Fri Nov 1 16:03:38 2013 (r257508) @@ -319,7 +319,7 @@ if [ -z "${source_periodic_confs_defined security_daily_compat_var() { local var=$1 dailyvar value - dailyvar=daily_status_security${#status_security} + dailyvar=daily_status_security${var#security_status} periodvar=${var%enable}period eval value=\"\$$dailyvar\" [ -z "$value" ] && return @@ -331,7 +331,7 @@ if [ -z "${source_periodic_confs_defined $periodvar=daily ;; *) - $var="$value" + eval $var=\"$value\" ;; esac } From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 16:48:31 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8AD29860; Fri, 1 Nov 2013 16:48:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 77EF929A4; Fri, 1 Nov 2013 16:48:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1GmVUh064253; Fri, 1 Nov 2013 16:48:31 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1GmV4j064252; Fri, 1 Nov 2013 16:48:31 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201311011648.rA1GmV4j064252@svn.freebsd.org> From: Glen Barber Date: Fri, 1 Nov 2013 16:48:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257509 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 16:48:31 -0000 Author: gjb Date: Fri Nov 1 16:48:30 2013 New Revision: 257509 URL: http://svnweb.freebsd.org/changeset/base/257509 Log: MFC r257329 (nyan): Fix build, both clang and gcc are required on pc98. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: stable/10/Makefile.inc1 (contents, props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Fri Nov 1 16:03:38 2013 (r257508) +++ stable/10/Makefile.inc1 Fri Nov 1 16:48:30 2013 (r257509) @@ -1381,12 +1381,17 @@ _binutils= gnu/usr.bin/binutils # If an full path to an external cross compiler is given, don't build # a cross compiler. .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no" -.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && ${TARGET} != "pc98" +.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" _clang= usr.bin/clang _clang_libs= lib/clang .else _cc= gnu/usr.bin/cc .endif + +# The boot2 for pc98 requires gcc. +.if ${TARGET} == "pc98" +_cc= gnu/usr.bin/cc +.endif .endif cross-tools: .MAKE From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 17:39:59 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B0C15106; Fri, 1 Nov 2013 17:39:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9CAB02C94; Fri, 1 Nov 2013 17:39:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1HdxRk081476; Fri, 1 Nov 2013 17:39:59 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1Hdxuw081475; Fri, 1 Nov 2013 17:39:59 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201311011739.rA1Hdxuw081475@svn.freebsd.org> From: Xin LI Date: Fri, 1 Nov 2013 17:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257513 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 17:39:59 -0000 Author: delphij Date: Fri Nov 1 17:39:59 2013 New Revision: 257513 URL: http://svnweb.freebsd.org/changeset/base/257513 Log: MFC r257369: Don't reference pointer before testing whether it is NULL. Submitted by: Clement Lecigne Reviewed by: grehan Approved by: re (kib) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/sys/ (props changed) stable/10/sys/dev/hyperv/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 1 17:38:52 2013 (r257512) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 1 17:39:59 2013 (r257513) @@ -621,13 +621,15 @@ netvsc_recv(struct hv_device *device_ctx { hn_softc_t *sc = (hn_softc_t *)device_get_softc(device_ctx->device); struct mbuf *m_new; - struct ifnet *ifp = sc->hn_ifp; + struct ifnet *ifp; int size; int i; if (sc == NULL) { return (0); /* TODO: KYS how can this be! */ } + + ifp = sc->hn_ifp; ifp = sc->arpcom.ac_ifp; From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 20:28:15 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F005BA0A; Fri, 1 Nov 2013 20:28:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CC8B9266D; Fri, 1 Nov 2013 20:28:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1KSEB4038640; Fri, 1 Nov 2013 20:28:14 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1KSEwR038637; Fri, 1 Nov 2013 20:28:14 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201311012028.rA1KSEwR038637@svn.freebsd.org> From: Brooks Davis Date: Fri, 1 Nov 2013 20:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257522 - in stable/10/sys: dev/fdt mips/beri X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 20:28:15 -0000 Author: brooks Date: Fri Nov 1 20:28:13 2013 New Revision: 257522 URL: http://svnweb.freebsd.org/changeset/base/257522 Log: MFC r256911, r256936 MFP4: 223121 (PIC portion), 225861, 227822, 229692 (PIC only), 229693, 230523, 1123614 Implement a driver for Robert Norton's PIC as an FDT interrupt controller. Devices whose interrupt-parent property points to a beripic device will have their interrupt allocation, activation, and setup operations routed through the IC rather than down the traditional bus hierarchy. This driver largely abstracts the underlying CPU away allowing the PIC to be implemented on CPU's other than BERI. Due to insufficient abstractions a small amount of MIPS specific code is currently required in fdt_mips.c and to implement counters. Sponsored by: DARPA/AFRL Approved by: re (gjb) Added: stable/10/sys/mips/beri/beri_pic.c - copied, changed from r256911, head/sys/mips/beri/beri_pic.c Modified: stable/10/sys/dev/fdt/fdt_mips.c stable/10/sys/mips/beri/files.beri Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/dev/fdt/fdt_mips.c ============================================================================== --- stable/10/sys/dev/fdt/fdt_mips.c Fri Nov 1 19:50:30 2013 (r257521) +++ stable/10/sys/dev/fdt/fdt_mips.c Fri Nov 1 20:28:13 2013 (r257522) @@ -68,7 +68,26 @@ fdt_pic_decode_mips4k_cp0(phandle_t node return (0); } +/* + * CHERI PIC decoder. + */ +static int +fdt_pic_decode_beri(phandle_t node, pcell_t *intr, int *interrupt, + int *trig, int *pol) +{ + + if (!fdt_is_compatible(node, "sri-cambridge,beri-pic")) + return (ENXIO); + + *interrupt = fdt32_to_cpu(intr[0]); + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + + return (0); +} + fdt_pic_decode_t fdt_pic_table[] = { &fdt_pic_decode_mips4k_cp0, + &fdt_pic_decode_beri, NULL }; Copied and modified: stable/10/sys/mips/beri/beri_pic.c (from r256911, head/sys/mips/beri/beri_pic.c) ============================================================================== --- head/sys/mips/beri/beri_pic.c Tue Oct 22 15:29:59 2013 (r256911, copy source) +++ stable/10/sys/mips/beri/beri_pic.c Fri Nov 1 20:28:13 2013 (r257522) @@ -646,15 +646,9 @@ beripic_send_ipi(device_t ic, u_int tid) KASSERT(tid < sc->bp_nsoft, ("tid (%d) too large\n", tid)); - printf("sending ipi to %d soft intrs %jx\n", tid, - bus_space_read_8(sc->bp_read_bst, sc->bp_read_bsh, 8)); - bit = 1ULL << (tid % 64); bus_space_write_8(sc->bp_set_bst, sc->bp_set_bsh, (BP_FIRST_SOFT / 8) + (tid / 64), bit); - - printf("sent ipi to %d soft intrs %jx\n", tid, - bus_space_read_8(sc->bp_read_bst, sc->bp_read_bsh, 8)); } static void Modified: stable/10/sys/mips/beri/files.beri ============================================================================== --- stable/10/sys/mips/beri/files.beri Fri Nov 1 19:50:30 2013 (r257521) +++ stable/10/sys/mips/beri/files.beri Fri Nov 1 20:28:13 2013 (r257522) @@ -17,5 +17,6 @@ dev/terasic/mtl/terasic_mtl_reg.c option dev/terasic/mtl/terasic_mtl_syscons.c optional terasic_mtl dev/terasic/mtl/terasic_mtl_text.c optional terasic_mtl mips/beri/beri_machdep.c standard +mips/beri/beri_pic.c optional fdt mips/mips/intr_machdep.c standard mips/mips/tick.c standard From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 20:30:20 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 272AEB52; Fri, 1 Nov 2013 20:30:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1231226A1; Fri, 1 Nov 2013 20:30:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1KUJhx038986; Fri, 1 Nov 2013 20:30:19 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1KUJme038985; Fri, 1 Nov 2013 20:30:19 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201311012030.rA1KUJme038985@svn.freebsd.org> From: Brooks Davis Date: Fri, 1 Nov 2013 20:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257523 - stable/10/sys/mips/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 20:30:20 -0000 Author: brooks Date: Fri Nov 1 20:30:19 2013 New Revision: 257523 URL: http://svnweb.freebsd.org/changeset/base/257523 Log: MFC r256934, r256963, r256972, r257017 MFP4: Change 221534 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/01/27 16:05:30 FreeBSD/mips stores page-table entries in a near-identical format to MIPS TLB entries -- only it overrides certain "reserved" bits in the MIPS-defined EntryLo register to hold software-defined bits (swbits) to avoid significantly increasing the page table memory footprint. On n32 and n64, these bits were (a) colliding with MIPS64r2 physical memory extensions and (b) being improperly cleared. Attempt to fix both of these problems by pushing swbits further along 64-bit EntryLo registers into the reserved space, and improving consistency between C-based and assembly-based clearing of swbits -- in particular, to use the same definition. This should stop swbits from leaking into TLB entries -- while ignored by most current MIPS hardware, this would cause a problem with (much) larger physical memory sizes, and also leads to confusing hardware-level tracing as physical addresses contain unexpected (and inconsistent) higher bits. Discussed with: imp, jmallett Change 1187301 by brooks@brooks_zenith on 2013/10/23 14:40:10 Loop back the initial commit of 221534 to HEAD. Correct its implementation for mips32. Sponsored by: DARPA/AFRL Approved by: re (gjb) Modified: stable/10/sys/mips/include/pte.h Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/mips/include/pte.h ============================================================================== --- stable/10/sys/mips/include/pte.h Fri Nov 1 20:28:13 2013 (r257522) +++ stable/10/sys/mips/include/pte.h Fri Nov 1 20:30:19 2013 (r257523) @@ -56,19 +56,30 @@ typedef pt_entry_t *pd_entry_t; #define TLBMASK_MASK ((PAGE_MASK >> TLBMASK_SHIFT) << TLBMASK_SHIFT) /* - * PFN for EntryLo register. Upper bits are 0, which is to say that - * bit 28 is the last hardware bit; Bits 29 and upwards (EntryLo is - * 64 bit though it can be referred to in 32-bits providing 3 software - * bits safely. We use it as 64 bits to get many software bits, and - * god knows what else.) are unacknowledged by hardware. They may be - * written as anything, but otherwise they have as much meaning as - * other 0 fields. + * FreeBSD/mips page-table entries take a near-identical format to MIPS TLB + * entries, each consisting of two 32-bit or 64-bit values ("EntryHi" and + * "EntryLo"). MIPS4k and MIPS64 both define certain bits in TLB entries as + * reserved, and these must be zero-filled by software. We overload these + * bits in PTE entries to hold PTE_ flags such as RO, W, and MANAGED. + * However, we must mask these out when writing to TLB entries to ensure that + * they do not become visible to hardware -- especially on MIPS64r2 which has + * an extended physical memory space. + * + * When using n64 and n32, shift software-defined bits into the MIPS64r2 + * reserved range, which runs from bit 55 ... 63. In other configurations + * (32-bit MIPS4k and compatible), shift them out to bits 29 ... 31. + * + * NOTE: This means that for 32-bit use of CP0, we aren't able to set the top + * bit of PFN to a non-zero value, as software is using it! This physical + * memory size limit may not be sufficiently enforced elsewhere. */ #if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */ -#define TLBLO_SWBITS_SHIFT (34) +#define TLBLO_SWBITS_SHIFT (55) +#define TLBLO_SWBITS_CLEAR_SHIFT (9) #define TLBLO_PFN_MASK 0x3FFFFFFC0ULL #else #define TLBLO_SWBITS_SHIFT (29) +#define TLBLO_SWBITS_CLEAR_SHIFT (3) #define TLBLO_PFN_MASK (0x1FFFFFC0) #endif #define TLBLO_PFN_SHIFT (6) @@ -133,6 +144,9 @@ typedef pt_entry_t *pd_entry_t; * listen to requests to write to it. * W: Wired. ??? * MANAGED:Managed. This PTE maps a managed page. + * + * These bits should not be written into the TLB, so must first be masked out + * explicitly in C, or using CLEAR_PTE_SWBITS() in assembly. */ #define PTE_RO ((pt_entry_t)0x01 << TLBLO_SWBITS_SHIFT) #define PTE_W ((pt_entry_t)0x02 << TLBLO_SWBITS_SHIFT) @@ -162,7 +176,7 @@ typedef pt_entry_t *pd_entry_t; #define PTESIZE 4 #define PTE_L lw #define PTE_MTC0 mtc0 -#define CLEAR_PTE_SWBITS(r) sll r, 3; srl r, 3 /* remove 3 high bits */ +#define CLEAR_PTE_SWBITS(r) LONG_SLL r, TLBLO_SWBITS_CLEAR_SHIFT; LONG_SRL r, TLBLO_SWBITS_CLEAR_SHIFT /* remove swbits */ #endif /* defined(__mips_n64) || defined(__mips_n32) */ #if defined(__mips_n64) From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 20:33:31 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 15D70D7D; Fri, 1 Nov 2013 20:33:31 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 01E7E26BC; Fri, 1 Nov 2013 20:33:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1KXUJm041494; Fri, 1 Nov 2013 20:33:30 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1KXU4C041492; Fri, 1 Nov 2013 20:33:30 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201311012033.rA1KXU4C041492@svn.freebsd.org> From: Brooks Davis Date: Fri, 1 Nov 2013 20:33:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257524 - in stable/10/sys: conf dev/cfi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 20:33:31 -0000 Author: brooks Date: Fri Nov 1 20:33:30 2013 New Revision: 257524 URL: http://svnweb.freebsd.org/changeset/base/257524 Log: MFC r256753 MFP4: 1136252 Add an option ATSE_CFI_HACK to allow memory mapped CFI devices to have their address range allocated sharable so that atse(4) can find it's Ethernet address in the expected location. We intend to remove this hack once the BERI platform has a loader. Sponsored by: DARPA/AFRL Approved by: re (gjb) Modified: stable/10/sys/conf/options stable/10/sys/dev/cfi/cfi_core.c Directory Properties: stable/10/sys/ (props changed) stable/10/sys/conf/ (props changed) Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Fri Nov 1 20:30:19 2013 (r257523) +++ stable/10/sys/conf/options Fri Nov 1 20:33:30 2013 (r257524) @@ -69,6 +69,7 @@ TEXTDUMP_VERBOSE opt_ddb.h ADAPTIVE_LOCKMGRS ALQ ALTERA_SDCARD_FAST_SIM opt_altera_sdcard.h +ATSE_CFI_HACK opt_cfi.h AUDIT opt_global.h BOOTHOWTO opt_global.h BOOTVERBOSE opt_global.h Modified: stable/10/sys/dev/cfi/cfi_core.c ============================================================================== --- stable/10/sys/dev/cfi/cfi_core.c Fri Nov 1 20:30:19 2013 (r257523) +++ stable/10/sys/dev/cfi/cfi_core.c Fri Nov 1 20:33:30 2013 (r257524) @@ -281,7 +281,11 @@ cfi_attach(device_t dev) sc->sc_rid = 0; sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rid, +#ifndef ATSE_CFI_HACK RF_ACTIVE); +#else + RF_ACTIVE | RF_SHAREABLE); +#endif if (sc->sc_res == NULL) return (ENXIO); From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 21:15:42 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 340FE952; Fri, 1 Nov 2013 21:15:42 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 11A4328D5; Fri, 1 Nov 2013 21:15:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1LFg87055436; Fri, 1 Nov 2013 21:15:42 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1LFeVd055423; Fri, 1 Nov 2013 21:15:40 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201311012115.rA1LFeVd055423@svn.freebsd.org> From: Brooks Davis Date: Fri, 1 Nov 2013 21:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257527 - in stable/10/sys: boot/fdt/dts mips/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 21:15:42 -0000 Author: brooks Date: Fri Nov 1 21:15:39 2013 New Revision: 257527 URL: http://svnweb.freebsd.org/changeset/base/257527 Log: MFC r256912, r256931, r256977 Sync BERI kernel configs with P4: Switch the majority of device configuration to FDT from hints. Add BERI_*_BASE configs to reduce duplication in the MDROOT and SDROOT kernels. Add NFS and GSSAPI support by default. Enable ATSE_CFI_HACK in BERI configs, stable MAC addresses are useful. BERI_SIM.hint is no longer used, remove it. Sponsored by: DARPA/AFRL Approved by: re (delphij) Added: stable/10/sys/boot/fdt/dts/beri-sim.dts - copied unchanged from r256912, head/sys/boot/fdt/dts/beri-sim.dts stable/10/sys/boot/fdt/dts/beripad-de4.dts - copied unchanged from r256912, head/sys/boot/fdt/dts/beripad-de4.dts stable/10/sys/mips/conf/BERI_DE4_BASE - copied, changed from r256912, head/sys/mips/conf/BERI_DE4_BASE stable/10/sys/mips/conf/BERI_SIM_BASE - copied unchanged from r256912, head/sys/mips/conf/BERI_SIM_BASE stable/10/sys/mips/conf/BERI_SIM_SDROOT - copied unchanged from r256912, head/sys/mips/conf/BERI_SIM_SDROOT Deleted: stable/10/sys/mips/conf/BERI_SIM.hints Modified: stable/10/sys/mips/conf/BERI_DE4.hints stable/10/sys/mips/conf/BERI_DE4_MDROOT stable/10/sys/mips/conf/BERI_DE4_SDROOT stable/10/sys/mips/conf/BERI_SIM_MDROOT stable/10/sys/mips/conf/BERI_TEMPLATE Directory Properties: stable/10/sys/ (props changed) stable/10/sys/boot/ (props changed) Copied: stable/10/sys/boot/fdt/dts/beri-sim.dts (from r256912, head/sys/boot/fdt/dts/beri-sim.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/boot/fdt/dts/beri-sim.dts Fri Nov 1 21:15:39 2013 (r257527, copy of r256912, head/sys/boot/fdt/dts/beri-sim.dts) @@ -0,0 +1,144 @@ +/*- + * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2013 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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$ + */ + +/dts-v1/; + +/* + * Device names here have been largely made up on the spot, especially for the + * "compatible" strings, and might want to be revised. + * + * For now, use 32-bit addressing as our Avalon bus is 32-bit. However, in + * the future, we should likely change to 64-bit. + */ + +/ { + model = "SRI/Cambridge BERI simulation"; + compatible = "sri-cambridge,beri-sim"; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <1>; + + /* + * Secondary CPUs all start disabled and use the + * spin-table enable method. cpu-release-addr must be + * specified for each cpu other than cpu@0. Values of + * cpu-release-addr grow down from 0x100000 (kernel). + */ + status = "disabled"; + enable-method = "spin-table"; + + cpu@0 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <0>; + status = "okay"; + }; + +/* + cpu@1 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <1>; + // XXX: should we need cached prefix? + cpu-release-addr = <0xffffffff 0x800fffe0>; + }; +*/ + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + #interrupt-cells = <1>; + + /* + * Declare mips,mips4k since BERI doesn't (yet) have a PIC, so + * we use mips4k coprocessor 0 interrupt management directly. + */ + compatible = "simple-bus", "mips,mips4k"; + ranges = <>; + + memory { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + beripic: beripic@7f804000 { + compatible = "sri-cambridge,beri-pic"; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x7f804000 0x400 + 0x7f806000 0x10 + 0x7f806080 0x10 + 0x7f806100 0x10>; + interrupts = <0 1 2 3 4>; + hard-interrupt-sources = <64>; + soft-interrupt-sources = <64>; + }; + + serial@7f000000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f000000 0x40>; + interrupts = <0>; + interrupt-parent = <&beripic>; + }; + + serial@7f001000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f001000 0x40>; + }; + + serial@7f002000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f002000 0x40>; + }; + + sdcard@7f008000 { + compatible = "altera,sdcard_11_2011"; + reg = <0x7f008000 0x400>; + }; + + avgen@0x7f00a000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f00a000 0x14>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "rw"; + sri-cambridge,devname = "berirom"; + }; + }; +}; Copied: stable/10/sys/boot/fdt/dts/beripad-de4.dts (from r256912, head/sys/boot/fdt/dts/beripad-de4.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/boot/fdt/dts/beripad-de4.dts Fri Nov 1 21:15:39 2013 (r257527, copy of r256912, head/sys/boot/fdt/dts/beripad-de4.dts) @@ -0,0 +1,266 @@ +/*- + * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2013 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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$ + */ + +/dts-v1/; + +/* + * Device names here have been largely made up on the spot, especially for the + * "compatible" strings, and might want to be revised. + * + * For now, use 32-bit addressing as our Avalon bus is 32-bit. However, in + * the future, we should likely change to 64-bit. + */ + +/ { + model = "SRI/Cambridge BeriPad (DE4)"; + compatible = "sri-cambridge,beripad-de4"; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <1>; + + /* + * Secondary CPUs all start disabled and use the + * spin-table enable method. cpu-release-addr must be + * specified for each cpu other than cpu@0. Values of + * cpu-release-addr grow down from 0x100000 (kernel). + */ + status = "disabled"; + enable-method = "spin-table"; + + cpu@0 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <0>; + status = "okay"; + }; + +/* + cpu@1 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <1>; + // XXX: should we need cached prefix? + cpu-release-addr = <0xffffffff 0x800fffe0>; + }; +*/ + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + #interrupt-cells = <1>; + + /* + * Declare mips,mips4k since BERI doesn't (yet) have a PIC, so + * we use mips4k coprocessor 0 interrupt management directly. + */ + compatible = "simple-bus", "mips,mips4k"; + ranges = <>; + + memory { + device_type = "memory"; + reg = <0x0 0x40000000>; // 1G at 0x0 + }; + + beripic: beripic@7f804000 { + compatible = "sri-cambridge,beri-pic"; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x7f804000 0x400 + 0x7f806000 0x10 + 0x7f806080 0x10 + 0x7f806100 0x10>; + interrupts = <0 1 2 3 4>; + hard-interrupt-sources = <64>; + soft-interrupt-sources = <64>; + }; + + serial@7f002100 { + compatible = "ns16550"; + reg = <0x7f002100 0x20>; + reg-shift = <2>; + clock-frequency = <50000000>; + interrupts = <6>; + interrupt-parent = <&beripic>; + }; + + serial@7f000000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f000000 0x40>; + interrupts = <0>; + interrupt-parent = <&beripic>; + }; + + serial@7f001000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f001000 0x40>; + }; + + serial@7f002000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f002000 0x40>; + }; + + sdcard@7f008000 { + compatible = "altera,sdcard_11_2011"; + reg = <0x7f008000 0x400>; + }; + + led@7f006000 { + compatible = "sri-cambridge,de4led"; + reg = <0x7f006000 0x1>; + }; + + /* + * XXX-BZ keep flash before ethernet so that atse can read the + * Ethernet addresses for now. + */ + flash@74000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x74000000 0x4000000>; + + /* Board configuration */ + partition@0 { + reg = <0x0 0x20000>; + label = "config"; + }; + + /* Power up FPGA image */ + partition@20000 { + reg = <0x20000 0xc00000>; + label = "fpga0"; + }; + + /* Secondary FPGA image (on RE_CONFIGn button) */ + partition@C20000 { + reg = <0xc20000 0xc00000>; + label = "fpga1"; + }; + + /* Space for operating system use */ + partition@1820000 { + reg = <0x1820000 0x027c0000>; + label = "os"; + }; + + /* Second stage bootloader */ + parition@3fe0000 { + reg = <0x3fe0000 0x20000>; + label = "boot"; + }; + }; + + ethernet@7f007000 { + compatible = "altera,atse"; + // MAC, RX+RXC, TX+TXC. + reg = <0x7f007000 0x400 + 0x7f007500 0x8 + 0x7f007520 0x20 + 0x7f007400 0x8 + 0x7f007420 0x20>; + // RX, TX + interrupts = <1 2>; + interrupt-parent = <&beripic>; + }; + + ethernet@7f005000 { + compatible = "altera,atse"; + // MAC, RX+RXC, TX+TXC. + reg = <0x7f005000 0x400 + 0x7f005500 0x8 + 0x7f005520 0x20 + 0x7f005400 0x8 + 0x7f005420 0x20>; + // RX, TX + interrupts = <11 12>; + interrupt-parent = <&beripic>; + }; + + touchscreen@70400000 { + compatible = "sri-cambridge,mtl"; + reg = <0x70400000 0x1000 + 0x70000000 0x177000 + 0x70177000 0x2000>; + }; + + usb@0x7f100000 { + compatible = "philips,isp1761"; + reg = <0x7f100000 0x40000 + 0x7f140000 0x4>; + // IRQ 4 is DC, IRQ 5 is HC. + interrupts = <4 5>; + interrupt-parent = <&beripic>; + }; + + avgen@0x7f009000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f009000 0x2>; + sri-cambridge,width = <1>; + sri-cambridge,fileio = "r"; + sri-cambridge,devname = "de4bsw"; + }; + + avgen@0x7f00a000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f00a000 0x14>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "rw"; + sri-cambridge,devname = "berirom"; + }; + + avgen@0x7f00c000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f00c000 0x8>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "rw"; + sri-cambridge,devname = "de4tempfan"; + }; + + avgen@0x7f100000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f100000 0x40000>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "r"; + sri-cambridge,devname = "usbmem"; + }; + + }; +}; Modified: stable/10/sys/mips/conf/BERI_DE4.hints ============================================================================== --- stable/10/sys/mips/conf/BERI_DE4.hints Fri Nov 1 21:10:44 2013 (r257526) +++ stable/10/sys/mips/conf/BERI_DE4.hints Fri Nov 1 21:15:39 2013 (r257527) @@ -1,75 +1,26 @@ # $FreeBSD$ -# -# Altera JTAG UARTs configured for console, debugging, and data putput on the -# Terasic DE-4. -# -hint.altera_jtag_uart.0.at="nexus0" -hint.altera_jtag_uart.0.maddr=0x7f000000 -hint.altera_jtag_uart.0.msize=0x40 -hint.altera_jtag_uart.0.irq=0 +# Hardwired location of bitfile +hint.map.0.at="cfid0s.fpga0" +hint.map.0.start=0x00000000 +hint.map.0.end=0x00c00000 +hint.map.0.name="fpga" + +# Kernel on the second chip +hint.map.1.at="cfid0s.os" +hint.map.1.start=0x007e0000 +hint.map.1.end=0x01fe0000 +hint.map.1.name="kernel" + +# Altera Triple-Speed Ethernet Mac, present in tPad and DE-4 configurations +# configured from fdt(4) but PHYs are still described in here. +# Currently configured for individual tse_mac cores. +hint.e1000phy.0.at="miibus0" +hint.e1000phy.0.phyno=0 +hint.e1000phy.1.at="miibus0" +hint.e1000phy.1.phyno=0 +hint.e1000phy.2.at="miibus0" +hint.e1000phy.2.phyno=0 +hint.e1000phy.3.at="miibus0" +hint.e1000phy.3.phyno=0 -hint.altera_jtag_uart.1.at="nexus0" -hint.altera_jtag_uart.1.maddr=0x7f001000 -hint.altera_jtag_uart.1.msize=0x40 - -hint.altera_jtag_uart.2.at="nexus0" -hint.altera_jtag_uart.2.maddr=0x7f002000 -hint.altera_jtag_uart.2.msize=0x40 - -# -# On-board DE4 and tPad SD Card IP core -# -hint.altera_sdcardc.0.at="nexus0" -hint.altera_sdcardc.0.maddr=0x7f008000 -hint.altera_sdcardc.0.msize=0x400 - -# -# On-board DE4 8-element LED -# -hint.terasic_de4led.0.at="nexus0" -hint.terasic_de4led.0.maddr=0x7f006000 -hint.terasic_de4led.0.msize=1 -hint.terasic_de4led.0.de4led_0_cmd="f9" - -# -# Terasic Multi-touch LCD (MTL), an optional feature in DE-4 configurations. -# -hint.terasic_mtl.0.at="nexus0" -hint.terasic_mtl.0.reg_maddr=0x70400000 -hint.terasic_mtl.0.reg_msize=0x1000 -hint.terasic_mtl.0.pixel_maddr=0x70000000 -hint.terasic_mtl.0.pixel_msize=0x177000 -hint.terasic_mtl.0.text_maddr=0x70177000 -hint.terasic_mtl.0.text_msize=0x2000 - -# -# BERI Hardware Version ROM -# -hint.altera_avgen.0.at="nexus0" -hint.altera_avgen.0.maddr=0x7F00A000 -hint.altera_avgen.0.msize=20 -hint.altera_avgen.0.width=4 -hint.altera_avgen.0.fileio="rw" -hint.altera_avgen.0.devname="berirom" - -# -# Expose the DE4 flash via an Avalon "generic" device. -# -#hint.altera_avgen.0.at="nexus0" -#hint.altera_avgen.0.maddr=0x74000000 -#hint.altera_avgen.0.msize=0x4000000 -#hint.altera_avgen.0.width=2 -#hint.altera_avgen.0.fileio="rw" -#hint.altera_avgen.0.mmapio="rwx" -#hint.altera_avgen.0.devname="de4flash" - -# -# Expose the DE4 buttons and switches via an Avalon "generic" device. -# -hint.altera_avgen.0.at="nexus0" -hint.altera_avgen.0.maddr=0x7f009000 -hint.altera_avgen.0.msize=2 -hint.altera_avgen.0.width=1 -hint.altera_avgen.0.fileio="r" -hint.altera_avgen.0.devname="de4bsw" Copied and modified: stable/10/sys/mips/conf/BERI_DE4_BASE (from r256912, head/sys/mips/conf/BERI_DE4_BASE) ============================================================================== --- head/sys/mips/conf/BERI_DE4_BASE Tue Oct 22 15:45:31 2013 (r256912, copy source) +++ stable/10/sys/mips/conf/BERI_DE4_BASE Fri Nov 1 21:15:39 2013 (r257527) @@ -32,6 +32,7 @@ device bpf device cfi device cfid options CFI_SUPPORT_STRATAFLASH +options ATSE_CFI_HACK device sc device uart Modified: stable/10/sys/mips/conf/BERI_DE4_MDROOT ============================================================================== --- stable/10/sys/mips/conf/BERI_DE4_MDROOT Fri Nov 1 21:10:44 2013 (r257526) +++ stable/10/sys/mips/conf/BERI_DE4_MDROOT Fri Nov 1 21:15:39 2013 (r257527) @@ -1,29 +1,19 @@ # -# BERI_DE4 -- Kernel for the SRI/Cambridge "BERI" (Bluespec Extensible RISC -# Implementation) FPGA soft core, as configured in its Terasic DE-4 reference -# configuration. +# BERI_DE4_MDROOT -- Kernel for the SRI/Cambridge "BERI" (Bluespec Extensible +# RISC # Implementation) FPGA soft core, as configured in its Terasic DE-4 +# reference configuration. # # $FreeBSD$ # -include "BERI_TEMPLATE" +include "BERI_DE4_BASE" ident BERI_DE4_MDROOT -hints "BERI_DE4.hints" #Default places to look for devices. - # # This kernel configuration uses an embedded 8MB memory root file system. # Adjust the following path based on local requirements. # options MD_ROOT # MD is a potential root device -options MD_ROOT_SIZE=8192 +options MD_ROOT_SIZE=26112 # 25.5MB options ROOTDEVNAME=\"ufs:md0\" - -device altera_avgen -device altera_jtag_uart -device altera_sdcard -device terasic_de4led -device terasic_mtl - -device sc Modified: stable/10/sys/mips/conf/BERI_DE4_SDROOT ============================================================================== --- stable/10/sys/mips/conf/BERI_DE4_SDROOT Fri Nov 1 21:10:44 2013 (r257526) +++ stable/10/sys/mips/conf/BERI_DE4_SDROOT Fri Nov 1 21:15:39 2013 (r257527) @@ -1,23 +1,16 @@ # -# BERI_DE4 -- Kernel for the SRI/Cambridge "BERI" (Bluespec Extensible RISC -# Implementation) FPGA soft core, as configured in its Terasic DE-4 reference -# configuration. +# BERI_DE4_SDROOT -- Kernel for the SRI/Cambridge "BERI" (Bluespec Extensible +# RISC Implementation) FPGA soft core, as configured in its Terasic DE-4 +# reference configuration. # # $FreeBSD$ # -include "BERI_TEMPLATE" +include "BERI_DE4_BASE" ident BERI_DE4_SDROOT -hints "BERI_DE4.hints" #Default places to look for devices. - -options ROOTDEVNAME=\"ufs:altera_sdcard0\" - -device altera_avgen -device altera_jtag_uart -device altera_sdcard -device terasic_de4led -device terasic_mtl - -device sc +# +# This kernel expects to find its root filesystem on the SD Card. +# +options ROOTDEVNAME=\"ufs:/dev/altera_sdcard0\" Copied: stable/10/sys/mips/conf/BERI_SIM_BASE (from r256912, head/sys/mips/conf/BERI_SIM_BASE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/mips/conf/BERI_SIM_BASE Fri Nov 1 21:15:39 2013 (r257527, copy of r256912, head/sys/mips/conf/BERI_SIM_BASE) @@ -0,0 +1,19 @@ +# +# BERI_SIM_BASE -- Base kernel for the SRI/Cambridge "BERI" (Bluespec +# Extensible RISC Implementation) FPGA soft core, as configured for +# simulation. +# +# $FreeBSD$ +# + +include "BERI_TEMPLATE" + +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=beri-sim.dts + +options ALTERA_SDCARD_FAST_SIM + +device altera_avgen +device altera_jtag_uart +device altera_sdcard Modified: stable/10/sys/mips/conf/BERI_SIM_MDROOT ============================================================================== --- stable/10/sys/mips/conf/BERI_SIM_MDROOT Fri Nov 1 21:10:44 2013 (r257526) +++ stable/10/sys/mips/conf/BERI_SIM_MDROOT Fri Nov 1 21:15:39 2013 (r257527) @@ -1,24 +1,18 @@ # -# BERI_SIM -- Kernel for the SRI/Cambridge "BERI" (Bluespec Extensible RISC -# Implementation) FPGA soft core, as configured for simulation. +# BERI_SIM_MDROOT -- Kernel for the SRI/Cambridge "BERI" (Bluespec Extensible +# RISC Implementation) FPGA soft core, as configured for simulation. # # $FreeBSD$ # -include "BERI_TEMPLATE" +include "BERI_SIM_BASE" ident BERI_SIM_MDROOT -hints "BERI_SIM.hints" #Default places to look for devices. - # -# This kernel configuration uses an embedded 8MB memory root file system. +# This kernel configuration uses an embedded memory root file system. # Adjust the following path based on local requirements. # options MD_ROOT # MD is a potential root device -options MD_ROOT_SIZE=8192 +options MD_ROOT_SIZE=26112 # 25.5MB options ROOTDEVNAME=\"ufs:md0\" - -device altera_avgen -device altera_jtag_uart -device altera_sdcard Copied: stable/10/sys/mips/conf/BERI_SIM_SDROOT (from r256912, head/sys/mips/conf/BERI_SIM_SDROOT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/mips/conf/BERI_SIM_SDROOT Fri Nov 1 21:15:39 2013 (r257527, copy of r256912, head/sys/mips/conf/BERI_SIM_SDROOT) @@ -0,0 +1,15 @@ +# +# BERI_SIM_SDROOT -- Kernel for the SRI/Cambridge "BERI" (Bluespec Extensible +# RISC Implementation) FPGA soft core, as configured for simulation. +# +# $FreeBSD$ +# + +include "BERI_SIM_BASE" + +ident BERI_SIM_SDROOT + +# +# This kernel expects to find its root filesystem on the SD Card. +# +options ROOTDEVNAME=\"ufs:/dev/altera_sdcard0\" Modified: stable/10/sys/mips/conf/BERI_TEMPLATE ============================================================================== --- stable/10/sys/mips/conf/BERI_TEMPLATE Fri Nov 1 21:10:44 2013 (r257526) +++ stable/10/sys/mips/conf/BERI_TEMPLATE Fri Nov 1 21:15:39 2013 (r257527) @@ -39,7 +39,9 @@ options FFS #Berkeley Fast Filesystem options INET options INET6 +options KGSSAPI options NFSCL +options NFSLOCKD options NFS_ROOT # Debugging for use in -current @@ -49,10 +51,11 @@ options INVARIANT_SUPPORT #Extra sanity #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -device geom_map - -device md +device crypto +device cryptodev device ether +device geom_map device loop +device md device random device snp From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 1 21:17:47 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E09A7A94; Fri, 1 Nov 2013 21:17:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CC52928E5; Fri, 1 Nov 2013 21:17:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1LHkA3055692; Fri, 1 Nov 2013 21:17:46 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA1LHkG9055688; Fri, 1 Nov 2013 21:17:46 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201311012117.rA1LHkG9055688@svn.freebsd.org> From: Brooks Davis Date: Fri, 1 Nov 2013 21:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257528 - in stable/10/sys: conf mips/beri mips/include mips/mips X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 21:17:47 -0000 Author: brooks Date: Fri Nov 1 21:17:45 2013 New Revision: 257528 URL: http://svnweb.freebsd.org/changeset/base/257528 Log: MFC r256935 MFP4: Change 228019 by bz@bz_zenith on 2013/04/23 13:55:30 Add kernel side support for large TLB on BERI/CHERI. Modelled similar to NLM Sponsored by: DAPRA/AFRL Approved by: re (delphij) Modified: stable/10/sys/conf/options.mips stable/10/sys/mips/beri/std.beri stable/10/sys/mips/include/cpufunc.h stable/10/sys/mips/mips/cpu.c Directory Properties: stable/10/sys/ (props changed) stable/10/sys/conf/ (props changed) Modified: stable/10/sys/conf/options.mips ============================================================================== --- stable/10/sys/conf/options.mips Fri Nov 1 21:15:39 2013 (r257527) +++ stable/10/sys/conf/options.mips Fri Nov 1 21:17:45 2013 (r257528) @@ -81,6 +81,11 @@ OCTEON_VENDOR_GEFES opt_cvmx.h OCTEON_BOARD_CAPK_0100ND opt_cvmx.h # +# Options specific to the BERI platform. +# +BERI_LARGE_TLB opt_global.h + +# # Options that control the Atheros SoC peripherals # ARGE_DEBUG opt_arge.h Modified: stable/10/sys/mips/beri/std.beri ============================================================================== --- stable/10/sys/mips/beri/std.beri Fri Nov 1 21:15:39 2013 (r257527) +++ stable/10/sys/mips/beri/std.beri Fri Nov 1 21:17:45 2013 (r257528) @@ -2,3 +2,5 @@ files "../beri/files.beri" cpu CPU_MIPS4KC + +options BERI_LARGE_TLB Modified: stable/10/sys/mips/include/cpufunc.h ============================================================================== --- stable/10/sys/mips/include/cpufunc.h Fri Nov 1 21:15:39 2013 (r257527) +++ stable/10/sys/mips/include/cpufunc.h Fri Nov 1 21:17:45 2013 (r257528) @@ -242,8 +242,13 @@ MIPS_RW32_COP0_SEL(config3, MIPS_COP_0_C #ifdef CPU_CNMIPS MIPS_RW32_COP0_SEL(config4, MIPS_COP_0_CONFIG, 4); #endif -#ifdef CPU_NLM +#ifdef BERI_LARGE_TLB +MIPS_RW32_COP0_SEL(config5, MIPS_COP_0_CONFIG, 5); +#endif +#if defined(CPU_NLM) || defined(BERI_LARGE_TLB) MIPS_RW32_COP0_SEL(config6, MIPS_COP_0_CONFIG, 6); +#endif +#ifdef CPU_NLM MIPS_RW32_COP0_SEL(config7, MIPS_COP_0_CONFIG, 7); #endif MIPS_RW32_COP0(count, MIPS_COP_0_COUNT); Modified: stable/10/sys/mips/mips/cpu.c ============================================================================== --- stable/10/sys/mips/mips/cpu.c Fri Nov 1 21:15:39 2013 (r257527) +++ stable/10/sys/mips/mips/cpu.c Fri Nov 1 21:17:45 2013 (r257528) @@ -99,17 +99,29 @@ mips_get_identity(struct mips_cpuinfo *c /* Learn TLB size and L1 cache geometry. */ cfg1 = mips_rd_config1(); -#ifndef CPU_NLM - cpuinfo->tlb_nentries = - ((cfg1 & MIPS_CONFIG1_TLBSZ_MASK) >> MIPS_CONFIG1_TLBSZ_SHIFT) + 1; -#else + +#if defined(CPU_NLM) /* Account for Extended TLB entries in XLP */ tmp = mips_rd_config6(); cpuinfo->tlb_nentries = ((tmp >> 16) & 0xffff) + 1; +#elif defined(BERI_LARGE_TLB) + /* Check if we support extended TLB entries and if so activate. */ + tmp = mips_rd_config5(); +#define BERI_CP5_LTLB_SUPPORTED 0x1 + if (tmp & BERI_CP5_LTLB_SUPPORTED) { + /* See how many extra TLB entries we have. */ + tmp = mips_rd_config6(); + cpuinfo->tlb_nentries = (tmp >> 16) + 1; + /* Activate the extended entries. */ + mips_wr_config6(tmp|0x4); + } else +#endif +#if !defined(CPU_NLM) + cpuinfo->tlb_nentries = + ((cfg1 & MIPS_CONFIG1_TLBSZ_MASK) >> MIPS_CONFIG1_TLBSZ_SHIFT) + 1; #endif - - /* Add extended TLB size information from config4. */ #if defined(CPU_CNMIPS) + /* Add extended TLB size information from config4. */ cfg4 = mips_rd_config4(); if ((cfg4 & MIPS_CONFIG4_MMUEXTDEF) == MIPS_CONFIG4_MMUEXTDEF_MMUSIZEEXT) cpuinfo->tlb_nentries += (cfg4 & MIPS_CONFIG4_MMUSIZEEXT) * 0x40; @@ -124,8 +136,8 @@ mips_get_identity(struct mips_cpuinfo *c 1 << (((cfg1 & MIPS_CONFIG1_IS_MASK) >> MIPS_CONFIG1_IS_SHIFT) + 6); } -#ifndef CPU_CNMIPS /* L1 data cache. */ +#ifndef CPU_CNMIPS tmp = (cfg1 & MIPS_CONFIG1_DL_MASK) >> MIPS_CONFIG1_DL_SHIFT; if (tmp != 0) { cpuinfo->l1.dc_linesize = 1 << (tmp + 1); From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 2 02:38:33 2013 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 29D46868; Sat, 2 Nov 2013 02:38:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 149DF2964; Sat, 2 Nov 2013 02:38:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA22cXui067709; Sat, 2 Nov 2013 02:38:33 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA22cWpv067702; Sat, 2 Nov 2013 02:38:32 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201311020238.rA22cWpv067702@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 2 Nov 2013 02:38:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r257540 - in stable/10: usr.bin/iscsictl usr.sbin/ctladm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2013 02:38:33 -0000 Author: trasz Date: Sat Nov 2 02:38:32 2013 New Revision: 257540 URL: http://svnweb.freebsd.org/changeset/base/257540 Log: MFC r257379: Rename '-h' option to '-p', and use "portal" instead of "host" or "address", in order to be consistent with iSCSI terminology. Besides, calling the option '-h' was just wrong. This changes usage for newly added iscsictl(8), and two newly added subcommands to ctladm(8). This breaks POLA between CURRENT and 10, but since 10.0 has not been released yet, it's still ok to do. MFC r257380: Bump .Dd after r257379. Approved by: re (glebius) Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.bin/iscsictl/iscsictl.8 stable/10/usr.bin/iscsictl/iscsictl.c stable/10/usr.sbin/ctladm/ctladm.8 stable/10/usr.sbin/ctladm/ctladm.c Directory Properties: stable/10/usr.bin/iscsictl/ (props changed) stable/10/usr.sbin/ctladm/ (props changed) Modified: stable/10/usr.bin/iscsictl/iscsictl.8 ============================================================================== --- stable/10/usr.bin/iscsictl/iscsictl.8 Sat Nov 2 01:16:10 2013 (r257539) +++ stable/10/usr.bin/iscsictl/iscsictl.8 Sat Nov 2 02:38:32 2013 (r257540) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 20, 2012 +.Dd October 30, 2013 .Dt ISCSICTL 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Sh SYNOPSIS .Nm .Fl A -.Fl h Ar host Fl t Ar target Op Fl u Ar user Fl s Ar secret +.Fl p Ar portal Fl t Ar target Op Fl u Ar user Fl s Ar secret .Nm .Fl A .Fl d Ar discovery-host Op Fl u Ar user Fl s Ar secret @@ -48,7 +48,7 @@ .Fl n Ar nickname Op Fl c Ar path .Nm .Fl R -.Op Fl h Ar host +.Op Fl p Ar portal .Op Fl t Ar target .Nm .Fl R @@ -84,10 +84,10 @@ Target host name or address used for Sen When used, it will add a temporary discovery session. After discovery is done, sessions will be added for each discovered target, and the temporary discovery sesion will be removed. -.It Fl h -Target host name or address for statically defined targets. .It Fl n The "nickname" of session defined in the configuration file. +.It Fl p +Target portal - host name or address - for statically defined targets. .It Fl t Target name. .It Fl v @@ -133,7 +133,7 @@ The utility exits 0 on success, and >0 if an error occurs. .Sh EXAMPLES Attach to target qn.2012-06.com.example:target0, served by 192.168.1.1: -.Dl Nm Fl A Fl t Ar qn.2012-06.com.example:target0 Fl h Ar 192.168.1.1 +.Dl Nm Fl A Fl t Ar qn.2012-06.com.example:target0 Fl p Ar 192.168.1.1 .Pp Disconnect all iSCSI sessions: .Dl Nm Fl Ra Modified: stable/10/usr.bin/iscsictl/iscsictl.c ============================================================================== --- stable/10/usr.bin/iscsictl/iscsictl.c Sat Nov 2 01:16:10 2013 (r257539) +++ stable/10/usr.bin/iscsictl/iscsictl.c Sat Nov 2 02:38:32 2013 (r257540) @@ -410,48 +410,48 @@ kernel_list(int iscsi_fd, const struct t state = &states[i]; conf = &state->iss_conf; - printf("Session ID: %d\n", state->iss_id); - printf("Initiator name: %s\n", conf->isc_initiator); - printf("Initiator addr: %s\n", + printf("Session ID: %d\n", state->iss_id); + printf("Initiator name: %s\n", conf->isc_initiator); + printf("Initiator portal: %s\n", conf->isc_initiator_addr); - printf("Initiator alias: %s\n", + printf("Initiator alias: %s\n", conf->isc_initiator_alias); - printf("Target name: %s\n", conf->isc_target); - printf("Target addr: %s\n", + printf("Target name: %s\n", conf->isc_target); + printf("Target portal: %s\n", conf->isc_target_addr); - printf("Target alias: %s\n", + printf("Target alias: %s\n", state->iss_target_alias); - printf("User: %s\n", conf->isc_user); - printf("Secret: %s\n", conf->isc_secret); - printf("Mutual user: %s\n", + printf("User: %s\n", conf->isc_user); + printf("Secret: %s\n", conf->isc_secret); + printf("Mutual user: %s\n", conf->isc_mutual_user); - printf("Mutual secret: %s\n", + printf("Mutual secret : %s\n", conf->isc_mutual_secret); - printf("Session type: %s\n", + printf("Session type: %s\n", conf->isc_discovery ? "Discovery" : "Normal"); - printf("Session state: %s\n", + printf("Session state: %s\n", state->iss_connected ? "Connected" : "Disconnected"); - printf("Failure reason: %s\n", state->iss_reason); - printf("Header digest: %s\n", + printf("Failure reason: %s\n", state->iss_reason); + printf("Header digest: %s\n", state->iss_header_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - printf("Data digest: %s\n", + printf("Data digest: %s\n", state->iss_data_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - printf("DataSegmentLen: %d\n", + printf("DataSegmentLen: %d\n", state->iss_max_data_segment_length); - printf("ImmediateData: %s\n", + printf("ImmediateData: %s\n", state->iss_immediate_data ? "Yes" : "No"); - printf("iSER (RDMA): %s\n", + printf("iSER (RDMA): %s\n", conf->isc_iser ? "Yes" : "No"); - printf("Device nodes: "); + printf("Device nodes: "); print_periphs(state->iss_id); printf("\n\n"); } } else { printf("%-36s %-16s %s\n", - "Target name", "Target addr", "State"); + "Target name", "Target portal", "State"); for (i = 0; i < isl.isl_nentries; i++) { state = &states[i]; conf = &state->iss_conf; @@ -483,13 +483,13 @@ static void usage(void) { - fprintf(stderr, "usage: iscsictl -A -h host -t target " + fprintf(stderr, "usage: iscsictl -A -p portal -t target " "[-u user -s secret]\n"); fprintf(stderr, " iscsictl -A -d discovery-host " "[-u user -s secret]\n"); fprintf(stderr, " iscsictl -A -a [-c path]\n"); fprintf(stderr, " iscsictl -A -n nickname [-c path]\n"); - fprintf(stderr, " iscsictl -R [-h host] [-t target]\n"); + fprintf(stderr, " iscsictl -R [-p portal] [-t target]\n"); fprintf(stderr, " iscsictl -R -a\n"); fprintf(stderr, " iscsictl -R -n nickname [-c path]\n"); fprintf(stderr, " iscsictl -L [-v]\n"); @@ -519,7 +519,7 @@ main(int argc, char **argv) struct conf *conf; struct target *targ; - while ((ch = getopt(argc, argv, "ARLac:d:n:h:t:u:s:v")) != -1) { + while ((ch = getopt(argc, argv, "ARLac:d:n:p:t:u:s:v")) != -1) { switch (ch) { case 'A': Aflag = 1; @@ -542,7 +542,7 @@ main(int argc, char **argv) case 'n': nickname = optarg; break; - case 'h': + case 'p': host = optarg; break; case 't': @@ -579,7 +579,7 @@ main(int argc, char **argv) if (Aflag != 0) { if (aflag != 0) { if (host != NULL) - errx(1, "-a and -h and mutually exclusive"); + errx(1, "-a and -p and mutually exclusive"); if (target != NULL) errx(1, "-a and -t and mutually exclusive"); if (user != NULL) @@ -592,7 +592,7 @@ main(int argc, char **argv) errx(1, "-a and -d and mutually exclusive"); } else if (nickname != NULL) { if (host != NULL) - errx(1, "-n and -h and mutually exclusive"); + errx(1, "-n and -p and mutually exclusive"); if (target != NULL) errx(1, "-n and -t and mutually exclusive"); if (user != NULL) @@ -603,17 +603,17 @@ main(int argc, char **argv) errx(1, "-n and -d and mutually exclusive"); } else if (discovery_host != NULL) { if (host != NULL) - errx(1, "-d and -h and mutually exclusive"); + errx(1, "-d and -p and mutually exclusive"); if (target != NULL) errx(1, "-d and -t and mutually exclusive"); } else { if (target == NULL && host == NULL) - errx(1, "must specify -a, -n or -t/-h"); + errx(1, "must specify -a, -n or -t/-p"); if (target != NULL && host == NULL) - errx(1, "-t must always be used with -h"); + errx(1, "-t must always be used with -p"); if (host != NULL && target == NULL) - errx(1, "-h must always be used with -t"); + errx(1, "-p must always be used with -t"); } if (user != NULL && secret == NULL) @@ -634,24 +634,24 @@ main(int argc, char **argv) if (aflag != 0) { if (host != NULL) - errx(1, "-a and -h and mutually exclusive"); + errx(1, "-a and -p and mutually exclusive"); if (target != NULL) errx(1, "-a and -t and mutually exclusive"); if (nickname != NULL) errx(1, "-a and -n and mutually exclusive"); } else if (nickname != NULL) { if (host != NULL) - errx(1, "-n and -h and mutually exclusive"); + errx(1, "-n and -p and mutually exclusive"); if (target != NULL) errx(1, "-n and -t and mutually exclusive"); } else if (host != NULL) { if (target != NULL) - errx(1, "-h and -t and mutually exclusive"); + errx(1, "-p and -t and mutually exclusive"); } else if (target != NULL) { if (host != NULL) - errx(1, "-t and -h and mutually exclusive"); + errx(1, "-t and -p and mutually exclusive"); } else - errx(1, "must specify either-a, -n, -t, or -h"); + errx(1, "must specify either -a, -n, -t, or -p"); if (vflag != 0) errx(1, "-v cannot be used with -R"); @@ -660,7 +660,7 @@ main(int argc, char **argv) assert(Lflag != 0); if (host != NULL) - errx(1, "-L and -h and mutually exclusive"); + errx(1, "-L and -p and mutually exclusive"); if (target != NULL) errx(1, "-L and -t and mutually exclusive"); if (user != NULL) Modified: stable/10/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.8 Sat Nov 2 01:16:10 2013 (r257539) +++ stable/10/usr.sbin/ctladm/ctladm.8 Sat Nov 2 02:38:32 2013 (r257540) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd April 2, 2013 +.Dd October 30, 2013 .Dt CTLADM 8 .Os .Sh NAME @@ -202,10 +202,10 @@ .Op Fl x .Nm .Ic islogout -.Aq Fl a | Fl h Ar host | Fl c Ar connection-id | Fl i Ar name +.Aq Fl a | Fl c Ar connection-id | Fl i Ar name | Fl p Ar portal .Nm .Ic isterminate -.Aq Fl a | Fl h Ar host | Fl c Ar connection-id | Fl i Ar name +.Aq Fl a | Fl c Ar connection-id | Fl i Ar name | Fl p Ar portal .Nm .Ic help .Sh DESCRIPTION @@ -909,24 +909,24 @@ Ask the initiator to log out iSCSI conne .Bl -tag -width 11n .It Fl a Log out all connections. -.It Fl h -Specify initiator IP address. .It Fl c Specify connection ID. .It Fl i Specify initiator name. +.It Fl p +Specify initiator portal (hostname or IP address). .El .It Ic isterminate Forcibly terminate iSCSI connections matching criteria. .Bl -tag -width 11n .It Fl a Terminate all connections. -.It Fl h -Specify initiator IP address. .It Fl c Specify connection ID. .It Fl i Specify initiator name. +.It Fl p +Specify initiator portal (hostname or IP address). .El .It Ic help Display Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Sat Nov 2 01:16:10 2013 (r257539) +++ stable/10/usr.sbin/ctladm/ctladm.c Sat Nov 2 02:38:32 2013 (r257540) @@ -184,8 +184,8 @@ static struct ctladm_opts option_table[] {"inject", CTLADM_CMD_ERR_INJECT, CTLADM_ARG_NEED_TL, "cd:i:p:r:s:"}, {"inquiry", CTLADM_CMD_INQUIRY, CTLADM_ARG_NEED_TL, NULL}, {"islist", CTLADM_CMD_ISLIST, CTLADM_ARG_NONE, "vx"}, - {"islogout", CTLADM_CMD_ISLOGOUT, CTLADM_ARG_NONE, "ah:c:i:"}, - {"isterminate", CTLADM_CMD_ISTERMINATE, CTLADM_ARG_NONE, "ah:c:i:"}, + {"islogout", CTLADM_CMD_ISLOGOUT, CTLADM_ARG_NONE, "ac:i:p:"}, + {"isterminate", CTLADM_CMD_ISTERMINATE, CTLADM_ARG_NONE, "ac:i:p:"}, {"lunlist", CTLADM_CMD_LUNLIST, CTLADM_ARG_NONE, NULL}, {"modesense", CTLADM_CMD_MODESENSE, CTLADM_ARG_NEED_TL, "P:S:dlm:c:"}, {"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:s:"}, @@ -3633,21 +3633,21 @@ retry: if (verbose != 0) { STAILQ_FOREACH(conn, &islist.conn_list, links) { - printf("Session ID: %d\n", conn->connection_id); - printf("Initiator name: %s\n", conn->initiator); - printf("Initiator addr: %s\n", conn->initiator_addr); - printf("Initiator alias: %s\n", conn->initiator_alias); - printf("Target name: %s\n", conn->target); - printf("Target alias: %s\n", conn->target_alias); - printf("Header digest: %s\n", conn->header_digest); - printf("Data digest: %s\n", conn->data_digest); - printf("DataSegmentLen: %s\n", conn->max_data_segment_length); - printf("ImmediateData: %s\n", conn->immediate_data ? "Yes" : "No"); - printf("iSER (RDMA): %s\n", conn->iser ? "Yes" : "No"); + printf("Session ID: %d\n", conn->connection_id); + printf("Initiator name: %s\n", conn->initiator); + printf("Initiator portal: %s\n", conn->initiator_addr); + printf("Initiator alias: %s\n", conn->initiator_alias); + printf("Target name: %s\n", conn->target); + printf("Target alias: %s\n", conn->target_alias); + printf("Header digest: %s\n", conn->header_digest); + printf("Data digest: %s\n", conn->data_digest); + printf("DataSegmentLen: %s\n", conn->max_data_segment_length); + printf("ImmediateData: %s\n", conn->immediate_data ? "Yes" : "No"); + printf("iSER (RDMA): %s\n", conn->iser ? "Yes" : "No"); printf("\n"); } } else { - printf("%4s %-16s %-36s %-36s\n", "ID", "Address", "Initiator name", + printf("%4s %-16s %-36s %-36s\n", "ID", "Portal", "Initiator name", "Target name"); STAILQ_FOREACH(conn, &islist.conn_list, links) { printf("%4u %-16s %-36s %-36s\n", @@ -3675,12 +3675,6 @@ cctl_islogout(int fd, int argc, char **a all = 1; nargs++; break; - case 'h': - initiator_addr = strdup(optarg); - if (initiator_addr == NULL) - err(1, "%s: strdup", __func__); - nargs++; - break; case 'c': connection_id = strtoul(optarg, NULL, 0); nargs++; @@ -3691,16 +3685,22 @@ cctl_islogout(int fd, int argc, char **a err(1, "%s: strdup", __func__); nargs++; break; + case 'p': + initiator_addr = strdup(optarg); + if (initiator_addr == NULL) + err(1, "%s: strdup", __func__); + nargs++; + break; default: break; } } if (nargs == 0) - errx(1, "%s: either -a, -h, -c, or -i must be specified", + errx(1, "%s: either -a, -c, -i, or -p must be specified", __func__); if (nargs > 1) - errx(1, "%s: only one of -a, -h, -c, or -i may be specified", + errx(1, "%s: only one of -a, -c, -i, or -p may be specified", __func__); bzero(&req, sizeof(req)); @@ -3748,12 +3748,6 @@ cctl_isterminate(int fd, int argc, char all = 1; nargs++; break; - case 'h': - initiator_addr = strdup(optarg); - if (initiator_addr == NULL) - err(1, "%s: strdup", __func__); - nargs++; - break; case 'c': connection_id = strtoul(optarg, NULL, 0); nargs++; @@ -3764,16 +3758,22 @@ cctl_isterminate(int fd, int argc, char err(1, "%s: strdup", __func__); nargs++; break; + case 'p': + initiator_addr = strdup(optarg); + if (initiator_addr == NULL) + err(1, "%s: strdup", __func__); + nargs++; + break; default: break; } } if (nargs == 0) - errx(1, "%s: either -a, -h, -c, or -i must be specified", + errx(1, "%s: either -a, -c, -i, or -p must be specified", __func__); if (nargs > 1) - errx(1, "%s: only one of -a, -h, -c, or -i may be specified", + errx(1, "%s: only one of -a, -c, -i, or -p may be specified", __func__); bzero(&req, sizeof(req)); @@ -4121,8 +4121,8 @@ usage(int error) " ctladm port <-l | -o | [-w wwnn][-W wwpn]>\n" " [-p targ_port] [-t port_type] [-q] [-x]\n" " ctladm islist [-v | -x]\n" -" ctladm islogout <-A | -a addr | -c connection-id | -n name>\n" -" ctladm isterminate <-A | -a addr | -c connection-id | -n name>\n" +" ctladm islogout <-a | -c connection-id | -i name | -p portal>\n" +" ctladm isterminate <-a | -c connection-id | -i name | -p portal>\n" " ctladm dumpooa\n" " ctladm dumpstructs\n" " ctladm help\n"