From owner-svn-src-stable-10@freebsd.org Tue Sep 18 20:46:57 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 576C810A8962; Tue, 18 Sep 2018 20:46:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DFDC82ADC; Tue, 18 Sep 2018 20:46:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08D622513F; Tue, 18 Sep 2018 20:46:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8IKku5G055612; Tue, 18 Sep 2018 20:46:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8IKkuk1055611; Tue, 18 Sep 2018 20:46:56 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201809182046.w8IKkuk1055611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 18 Sep 2018 20:46:56 +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: r338756 - in stable: 10/sys/amd64/amd64 11/sys/amd64/amd64 8/sys/amd64/amd64 9/sys/amd64/amd64 X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/sys/amd64/amd64 11/sys/amd64/amd64 8/sys/amd64/amd64 9/sys/amd64/amd64 X-SVN-Commit-Revision: 338756 X-SVN-Commit-Repository: base 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.27 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, 18 Sep 2018 20:46:57 -0000 Author: dim Date: Tue Sep 18 20:46:55 2018 New Revision: 338756 URL: https://svnweb.freebsd.org/changeset/base/338756 Log: MFC r309748 (by glebius): Treat R_X86_64_PLT32 relocs as R_X86_64_PC32. If we load a binary that is designed to be a library, it produces relocatable code via assembler directives in the assembly itself (rather than compiler options). This emits R_X86_64_PLT32 relocations, which are not handled by the kernel linker. Submitted by: gallatin Reviewed by: kib PR: 231451 Modified: stable/10/sys/amd64/amd64/elf_machdep.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/amd64/elf_machdep.c stable/8/sys/amd64/amd64/elf_machdep.c stable/9/sys/amd64/amd64/elf_machdep.c Directory Properties: stable/11/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/10/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/elf_machdep.c Tue Sep 18 17:51:45 2018 (r338755) +++ stable/10/sys/amd64/amd64/elf_machdep.c Tue Sep 18 20:46:55 2018 (r338756) @@ -181,6 +181,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas switch (rtype) { case R_X86_64_PC32: case R_X86_64_32S: + case R_X86_64_PLT32: addend = *(Elf32_Addr *)where; break; default: @@ -214,6 +215,8 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas break; case R_X86_64_PC32: /* S + A - P */ + case R_X86_64_PLT32: /* L + A - P, L is PLT location for + the symbol, which we treat as S */ error = lookup(lf, symidx, 1, &addr); where32 = (Elf32_Addr *)where; val32 = (Elf32_Addr)(addr + addend - (Elf_Addr)where); From owner-svn-src-stable-10@freebsd.org Wed Sep 19 07:57:32 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E36661092961; Wed, 19 Sep 2018 07:57:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9391075F0E; Wed, 19 Sep 2018 07:57:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D13E4382; Wed, 19 Sep 2018 07:57:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8J7vV1f097392; Wed, 19 Sep 2018 07:57:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8J7vVZ2097390; Wed, 19 Sep 2018 07:57:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809190757.w8J7vVZ2097390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Sep 2018 07:57: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: r338789 - stable/10/lib/libusb X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/lib/libusb X-SVN-Commit-Revision: 338789 X-SVN-Commit-Repository: base 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.27 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, 19 Sep 2018 07:57:32 -0000 Author: hselasky Date: Wed Sep 19 07:57:30 2018 New Revision: 338789 URL: https://svnweb.freebsd.org/changeset/base/338789 Log: MFC r338616: Fix issues about cancelling USB transfers in LibUSB when the USB device has been detached. When a USB device has been detached the kernel file handle stops responding to commands. USB applications which continue to run after the USB device has been detached, depend on LibUSB generated events to tear down its pending USB transfers. Add code to handle the needed cleanup when processing the USB transfer(s) fails and prevent new USB transfer(s) from being submitted. Found by: Ludovic Rousseau PR: 231076 Sponsored by: Mellanox Technologies Modified: stable/10/lib/libusb/libusb10.c stable/10/lib/libusb/libusb10.h stable/10/lib/libusb/libusb10_io.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libusb/libusb10.c ============================================================================== --- stable/10/lib/libusb/libusb10.c Wed Sep 19 07:56:19 2018 (r338788) +++ stable/10/lib/libusb/libusb10.c Wed Sep 19 07:57:30 2018 (r338789) @@ -112,6 +112,19 @@ libusb_set_nonblocking(int f) fcntl(f, F_SETFL, flags); } +static void +libusb10_wakeup_event_loop(libusb_context *ctx) +{ + uint8_t dummy = 0; + int err; + + err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); + if (err < (int)sizeof(dummy)) { + /* ignore error, if any */ + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "Waking up event loop failed!"); + } +} + int libusb_init(libusb_context **context) { @@ -482,7 +495,6 @@ libusb_open(libusb_device *dev, libusb_device_handle * { libusb_context *ctx = dev->ctx; struct libusb20_device *pdev = dev->os_priv; - uint8_t dummy; int err; if (devh == NULL) @@ -504,12 +516,8 @@ libusb_open(libusb_device *dev, libusb_device_handle * POLLOUT | POLLRDNORM | POLLWRNORM); /* make sure our event loop detects the new device */ - dummy = 0; - err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); - if (err < (int)sizeof(dummy)) { - /* ignore error, if any */ - DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open write failed!"); - } + libusb10_wakeup_event_loop(ctx); + *devh = pdev; return (0); @@ -562,8 +570,6 @@ libusb_close(struct libusb20_device *pdev) { libusb_context *ctx; struct libusb_device *dev; - uint8_t dummy; - int err; if (pdev == NULL) return; /* be NULL safe */ @@ -579,12 +585,7 @@ libusb_close(struct libusb20_device *pdev) libusb_unref_device(dev); /* make sure our event loop detects the closed device */ - dummy = 0; - err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); - if (err < (int)sizeof(dummy)) { - /* ignore error, if any */ - DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close write failed!"); - } + libusb10_wakeup_event_loop(ctx); } libusb_device * @@ -1319,7 +1320,6 @@ libusb10_submit_transfer_sub(struct libusb20_device *p int buffsize; int maxframe; int temp; - uint8_t dummy; dev = libusb_get_device(pdev); @@ -1420,10 +1420,8 @@ found: failure: libusb10_complete_transfer(pxfer0, sxfer, LIBUSB_TRANSFER_ERROR); - /* make sure our event loop spins the done handler */ - dummy = 0; - err = write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); + libusb10_wakeup_event_loop(dev->ctx); } /* The following function must be called unlocked */ @@ -1464,6 +1462,8 @@ libusb_submit_transfer(struct libusb_transfer *uxfer) (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) || (libusb20_tr_get_priv_sc1(pxfer1) == sxfer)) { err = LIBUSB_ERROR_BUSY; + } else if (dev->device_is_gone != 0) { + err = LIBUSB_ERROR_NO_DEVICE; } else { /* set pending state */ @@ -1495,6 +1495,7 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer) struct libusb20_transfer *pxfer1; struct libusb_super_transfer *sxfer; struct libusb_device *dev; + struct libusb_device_handle *devh; uint8_t endpoint; int retval; @@ -1502,12 +1503,12 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer) return (LIBUSB_ERROR_INVALID_PARAM); /* check if not initialised */ - if (uxfer->dev_handle == NULL) + if ((devh = uxfer->dev_handle) == NULL) return (LIBUSB_ERROR_NOT_FOUND); endpoint = uxfer->endpoint; - dev = libusb_get_device(uxfer->dev_handle); + dev = libusb_get_device(devh); DPRINTF(dev->ctx, LIBUSB_DEBUG_FUNCTION, "libusb_cancel_transfer enter"); @@ -1518,8 +1519,8 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer) CTX_LOCK(dev->ctx); - pxfer0 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 0); - pxfer1 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 1); + pxfer0 = libusb10_get_transfer(devh, endpoint, 0); + pxfer1 = libusb10_get_transfer(devh, endpoint, 1); if (sxfer->state != LIBUSB_SUPER_XFER_ST_PEND) { /* only update the transfer status */ @@ -1531,23 +1532,38 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer) sxfer->entry.tqe_prev = NULL; libusb10_complete_transfer(NULL, sxfer, LIBUSB_TRANSFER_CANCELLED); + /* make sure our event loop spins the done handler */ + libusb10_wakeup_event_loop(dev->ctx); } else if (pxfer0 == NULL || pxfer1 == NULL) { /* not started */ retval = LIBUSB_ERROR_NOT_FOUND; } else if (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) { libusb10_complete_transfer(pxfer0, sxfer, LIBUSB_TRANSFER_CANCELLED); - libusb20_tr_stop(pxfer0); - /* make sure the queue doesn't stall */ - libusb10_submit_transfer_sub( - uxfer->dev_handle, endpoint); + if (dev->device_is_gone != 0) { + /* clear transfer pointer */ + libusb20_tr_set_priv_sc1(pxfer0, NULL); + /* make sure our event loop spins the done handler */ + libusb10_wakeup_event_loop(dev->ctx); + } else { + libusb20_tr_stop(pxfer0); + /* make sure the queue doesn't stall */ + libusb10_submit_transfer_sub(devh, endpoint); + } } else if (libusb20_tr_get_priv_sc1(pxfer1) == sxfer) { libusb10_complete_transfer(pxfer1, sxfer, LIBUSB_TRANSFER_CANCELLED); - libusb20_tr_stop(pxfer1); - /* make sure the queue doesn't stall */ - libusb10_submit_transfer_sub( - uxfer->dev_handle, endpoint); + /* check if handle is still active */ + if (dev->device_is_gone != 0) { + /* clear transfer pointer */ + libusb20_tr_set_priv_sc1(pxfer1, NULL); + /* make sure our event loop spins the done handler */ + libusb10_wakeup_event_loop(dev->ctx); + } else { + libusb20_tr_stop(pxfer1); + /* make sure the queue doesn't stall */ + libusb10_submit_transfer_sub(devh, endpoint); + } } else { /* not started */ retval = LIBUSB_ERROR_NOT_FOUND; @@ -1573,6 +1589,35 @@ libusb10_cancel_all_transfer(libusb_device *dev) if (xfer == NULL) continue; libusb20_tr_close(xfer); + } +} + +UNEXPORTED void +libusb10_cancel_all_transfer_locked(struct libusb20_device *pdev, struct libusb_device *dev) +{ + struct libusb_super_transfer *sxfer; + unsigned x; + + for (x = 0; x != LIBUSB_NUM_SW_ENDPOINTS; x++) { + struct libusb20_transfer *xfer; + + xfer = libusb20_tr_get_pointer(pdev, x); + if (xfer == NULL) + continue; + if (libusb20_tr_pending(xfer) == 0) + continue; + sxfer = libusb20_tr_get_priv_sc1(xfer); + if (sxfer == NULL) + continue; + /* complete pending transfer */ + libusb10_complete_transfer(xfer, sxfer, LIBUSB_TRANSFER_ERROR); + } + + while ((sxfer = TAILQ_FIRST(&dev->tr_head))) { + TAILQ_REMOVE(&dev->tr_head, sxfer, entry); + + /* complete pending transfer */ + libusb10_complete_transfer(NULL, sxfer, LIBUSB_TRANSFER_ERROR); } } Modified: stable/10/lib/libusb/libusb10.h ============================================================================== --- stable/10/lib/libusb/libusb10.h Wed Sep 19 07:56:19 2018 (r338788) +++ stable/10/lib/libusb/libusb10.h Wed Sep 19 07:57:30 2018 (r338789) @@ -114,6 +114,8 @@ struct libusb_context { struct libusb_device { int refcnt; + int device_is_gone; + uint32_t claimed_interfaces; struct libusb_super_pollfd dev_poll; @@ -132,5 +134,6 @@ extern struct libusb_context *usbi_default_context; void libusb10_add_pollfd(libusb_context *ctx, struct libusb_super_pollfd *pollfd, struct libusb20_device *pdev, int fd, short events); void libusb10_remove_pollfd(libusb_context *ctx, struct libusb_super_pollfd *pollfd); void libusb10_cancel_all_transfer(libusb_device *dev); +void libusb10_cancel_all_transfer_locked(struct libusb20_device *pdev, struct libusb_device *dev); #endif /* __LIBUSB10_H__ */ Modified: stable/10/lib/libusb/libusb10_io.c ============================================================================== --- stable/10/lib/libusb/libusb10_io.c Wed Sep 19 07:56:19 2018 (r338788) +++ stable/10/lib/libusb/libusb10_io.c Wed Sep 19 07:57:30 2018 (r338789) @@ -159,17 +159,19 @@ libusb10_handle_events_sub(struct libusb_context *ctx, if (ppdev[i] != NULL) { dev = libusb_get_device(ppdev[i]); - if (fds[i].revents == 0) - err = 0; /* nothing to do */ - else + if (fds[i].revents != 0) { err = libusb20_dev_process(ppdev[i]); - if (err) { - /* cancel all transfers - device is gone */ - libusb10_cancel_all_transfer(dev); + if (err) { + /* set device is gone */ + dev->device_is_gone = 1; - /* remove USB device from polling loop */ - libusb10_remove_pollfd(dev->ctx, &dev->dev_poll); + /* remove USB device from polling loop */ + libusb10_remove_pollfd(dev->ctx, &dev->dev_poll); + + /* cancel all pending transfers */ + libusb10_cancel_all_transfer_locked(ppdev[i], dev); + } } CTX_UNLOCK(ctx); libusb_unref_device(dev); @@ -178,10 +180,8 @@ libusb10_handle_events_sub(struct libusb_context *ctx, } else { uint8_t dummy; - while (1) { - if (read(fds[i].fd, &dummy, 1) != 1) - break; - } + while (read(fds[i].fd, &dummy, 1) == 1) + ; } } From owner-svn-src-stable-10@freebsd.org Wed Sep 19 08:12:42 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A8EF10933B1; Wed, 19 Sep 2018 08:12:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C0B0C76A7B; Wed, 19 Sep 2018 08:12:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB63246BF; Wed, 19 Sep 2018 08:12:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8J8Cfiw007909; Wed, 19 Sep 2018 08:12:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8J8CfT6007908; Wed, 19 Sep 2018 08:12:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809190812.w8J8CfT6007908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Sep 2018 08:12: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: r338792 - stable/10/lib/libusb X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/lib/libusb X-SVN-Commit-Revision: 338792 X-SVN-Commit-Repository: base 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.27 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, 19 Sep 2018 08:12:42 -0000 Author: hselasky Date: Wed Sep 19 08:12:41 2018 New Revision: 338792 URL: https://svnweb.freebsd.org/changeset/base/338792 Log: MFC r338679: Improve LibUSB debugging by simultaneously allowing both function and transfer prints. Make sure the debug level comes from the correct USB context. Found by: Ludovic Rousseau PR: 231264 Sponsored by: Mellanox Technologies Modified: stable/10/lib/libusb/libusb10.h stable/10/lib/libusb/libusb10_io.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libusb/libusb10.h ============================================================================== --- stable/10/lib/libusb/libusb10.h Wed Sep 19 08:11:44 2018 (r338791) +++ stable/10/lib/libusb/libusb10.h Wed Sep 19 08:12:41 2018 (r338792) @@ -39,22 +39,24 @@ #define HOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock) #define HOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock) -#define DPRINTF(ctx, dbg, format, args...) do { \ - if ((ctx)->debug == dbg) { \ - switch (dbg) { \ - case LIBUSB_DEBUG_FUNCTION: \ - printf("LIBUSB_FUNCTION: " \ - format "\n", ## args); \ - break; \ - case LIBUSB_DEBUG_TRANSFER: \ - printf("LIBUSB_TRANSFER: " \ - format "\n", ## args); \ - break; \ - default: \ - break; \ - } \ - } \ -} while(0) +#define DPRINTF(ctx, dbg, format, ...) do { \ + switch (dbg) { \ + case LIBUSB_DEBUG_FUNCTION: \ + if ((ctx)->debug & LIBUSB_DEBUG_FUNCTION) { \ + printf("LIBUSB_FUNCTION: " \ + format "\n", ## __VA_ARGS__); \ + } \ + break; \ + case LIBUSB_DEBUG_TRANSFER: \ + if ((ctx)->debug & LIBUSB_DEBUG_TRANSFER) { \ + printf("LIBUSB_TRANSFER: " \ + format "\n", ## __VA_ARGS__); \ + } \ + break; \ + default: \ + break; \ + } \ +} while (0) /* internal structures */ Modified: stable/10/lib/libusb/libusb10_io.c ============================================================================== --- stable/10/lib/libusb/libusb10_io.c Wed Sep 19 08:11:44 2018 (r338791) +++ stable/10/lib/libusb/libusb10_io.c Wed Sep 19 08:12:41 2018 (r338792) @@ -487,13 +487,26 @@ libusb_control_transfer(libusb_device_handle *devh, return (actlen); } +static libusb_context * +libusb10_get_context_by_device_handle(libusb_device_handle *devh) +{ + libusb_context *ctx; + + if (devh != NULL) + ctx = libusb_get_device(devh)->ctx; + else + ctx = NULL; + + return (GET_CONTEXT(ctx)); +} + static void libusb10_do_transfer_cb(struct libusb_transfer *transfer) { libusb_context *ctx; int *pdone; - ctx = GET_CONTEXT(NULL); + ctx = libusb10_get_context_by_device_handle(transfer->dev_handle); DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); @@ -583,7 +596,8 @@ libusb_bulk_transfer(libusb_device_handle *devh, libusb_context *ctx; int ret; - ctx = GET_CONTEXT(NULL); + ctx = libusb10_get_context_by_device_handle(devh); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_bulk_transfer enter"); ret = libusb10_do_transfer(devh, endpoint, data, length, transferred, @@ -601,7 +615,8 @@ libusb_interrupt_transfer(libusb_device_handle *devh, libusb_context *ctx; int ret; - ctx = GET_CONTEXT(NULL); + ctx = libusb10_get_context_by_device_handle(devh); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_interrupt_transfer enter"); ret = libusb10_do_transfer(devh, endpoint, data, length, transferred, From owner-svn-src-stable-10@freebsd.org Wed Sep 19 09:41:47 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DD8F1095462; Wed, 19 Sep 2018 09:41:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C91C79C83; Wed, 19 Sep 2018 09:41:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17839550D; Wed, 19 Sep 2018 09:41:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8J9fkia052069; Wed, 19 Sep 2018 09:41:46 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8J9fiY6052055; Wed, 19 Sep 2018 09:41:44 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201809190941.w8J9fiY6052055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 19 Sep 2018 09:41: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: r338796 - in stable/10: contrib/libarchive contrib/libarchive/cpio/test contrib/libarchive/libarchive usr.bin/bsdcat usr.bin/cpio usr.bin/tar X-SVN-Group: stable-10 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/10: contrib/libarchive contrib/libarchive/cpio/test contrib/libarchive/libarchive usr.bin/bsdcat usr.bin/cpio usr.bin/tar X-SVN-Commit-Revision: 338796 X-SVN-Commit-Repository: base 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.27 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, 19 Sep 2018 09:41:47 -0000 Author: mm Date: Wed Sep 19 09:41:44 2018 New Revision: 338796 URL: https://svnweb.freebsd.org/changeset/base/338796 Log: MFC r338600: Update libarchive to 3.3.3 As all important changes have already been merged from libarchive git this is just a version number bump, documentation update and some polishing for cpio tests. Other source code changes are not relevant to FreeBSD. Relnotes: yes Modified: stable/10/contrib/libarchive/NEWS stable/10/contrib/libarchive/README.md stable/10/contrib/libarchive/cpio/test/test_basic.c stable/10/contrib/libarchive/cpio/test/test_format_newc.c stable/10/contrib/libarchive/libarchive/archive.h stable/10/contrib/libarchive/libarchive/archive_cryptor.c stable/10/contrib/libarchive/libarchive/archive_entry.h stable/10/contrib/libarchive/libarchive/archive_pack_dev.c stable/10/usr.bin/bsdcat/Makefile stable/10/usr.bin/cpio/Makefile stable/10/usr.bin/tar/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/NEWS ============================================================================== --- stable/10/contrib/libarchive/NEWS Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/NEWS Wed Sep 19 09:41:44 2018 (r338796) @@ -1,3 +1,13 @@ +Sep 03, 2018: libarchive 3.3.3 released + +Jul 19, 2018: Avoid super-linear slowdown on malformed mtree files + +Jan 27, 2018: Many fixes for building with Visual Studio + +Oct 19, 2017: NO_OVERWRITE doesn't change existing directory attributes + +Aug 12, 2017: New support for Zstandard read and write filters + Jul 09, 2017: libarchive 3.3.2 released Mar 16, 2017: NFSv4 ACL support for Linux (librichacl) Modified: stable/10/contrib/libarchive/README.md ============================================================================== --- stable/10/contrib/libarchive/README.md Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/README.md Wed Sep 19 09:41:44 2018 (r338796) @@ -99,6 +99,7 @@ The library also detects and handles any of the follow * lzma, lzip, and xz compression * lz4 compression * lzop compression + * zstandard compression The library can create archives in any of the following formats: * POSIX ustar @@ -125,6 +126,7 @@ When creating archives, the result can be filtered wit * lzma, lzip, and xz compression * lz4 compression * lzop compression + * zstandard compression ## Notes about the Library Design @@ -159,7 +161,7 @@ questions we are asked about libarchive: * On read, compression and format are always detected automatically. -* The same API is used for all formats; in particular, it's very +* The same API is used for all formats; it should be very easy for software using libarchive to transparently handle any of libarchive's archiving formats. Modified: stable/10/contrib/libarchive/cpio/test/test_basic.c ============================================================================== --- stable/10/contrib/libarchive/cpio/test/test_basic.c Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/cpio/test/test_basic.c Wed Sep 19 09:41:44 2018 (r338796) @@ -144,49 +144,79 @@ DEFINE_TEST(test_basic) /* File with 10 bytes content. */ assertMakeFile("file", 0644, "1234567890"); fprintf(filelist, "file\n"); - if (is_LargeInode("file")) + if (is_LargeInode("file")) { strncat(result, - "bsdcpio: file: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: file: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } /* hardlink to above file. */ assertMakeHardlink("linkfile", "file"); fprintf(filelist, "linkfile\n"); - if (is_LargeInode("linkfile")) + if (is_LargeInode("linkfile")) { strncat(result, - "bsdcpio: linkfile: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: linkfile: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } /* Symlink to above file. */ if (canSymlink()) { assertMakeSymlink("symlink", "file"); fprintf(filelist, "symlink\n"); - if (is_LargeInode("symlink")) + if (is_LargeInode("symlink")) { strncat(result, - "bsdcpio: symlink: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: symlink: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } } /* Another file with different permissions. */ assertMakeFile("file2", 0777, "1234567890"); fprintf(filelist, "file2\n"); - if (is_LargeInode("file2")) + if (is_LargeInode("file2")) { strncat(result, - "bsdcpio: file2: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: file2: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } /* Directory. */ assertMakeDir("dir", 0775); fprintf(filelist, "dir\n"); - if (is_LargeInode("dir")) + if (is_LargeInode("dir")) { strncat(result, - "bsdcpio: dir: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: dir: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } strncat(result, "2 blocks\n", sizeof(result) - strlen(result) -1); /* All done. */ Modified: stable/10/contrib/libarchive/cpio/test/test_format_newc.c ============================================================================== --- stable/10/contrib/libarchive/cpio/test/test_format_newc.c Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/cpio/test/test_format_newc.c Wed Sep 19 09:41:44 2018 (r338796) @@ -124,26 +124,42 @@ DEFINE_TEST(test_format_newc) /* Setup result message. */ memset(result, 0, sizeof(result)); - if (is_LargeInode("file1")) + if (is_LargeInode("file1")) { strncat(result, - "bsdcpio: file1: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: file1: large inode number truncated: ", sizeof(result) - strlen(result) -1); - if (canSymlink() && is_LargeInode("symlink")) + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } + if (canSymlink() && is_LargeInode("symlink")) { strncat(result, - "bsdcpio: symlink: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: symlink: large inode number truncated: ", sizeof(result) - strlen(result) -1); - if (is_LargeInode("dir")) + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } + if (is_LargeInode("dir")) { strncat(result, - "bsdcpio: dir: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: dir: large inode number truncated: ", sizeof(result) - strlen(result) -1); - if (is_LargeInode("hardlink")) + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } + if (is_LargeInode("hardlink")) { strncat(result, - "bsdcpio: hardlink: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: hardlink: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } /* Record some facts about what we just created: */ now = time(NULL); /* They were all created w/in last two seconds. */ Modified: stable/10/contrib/libarchive/libarchive/archive.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive.h Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/libarchive/archive.h Wed Sep 19 09:41:44 2018 (r338796) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3003002 +#define ARCHIVE_VERSION_NUMBER 3003003 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.3.2" +#define ARCHIVE_VERSION_ONLY_STRING "3.3.3" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: stable/10/contrib/libarchive/libarchive/archive_cryptor.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_cryptor.c Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/libarchive/archive_cryptor.c Wed Sep 19 09:41:44 2018 (r338796) @@ -153,7 +153,7 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) CCCryptorStatus r; r = CCCryptorReset(ref, NULL); - if (r != kCCSuccess) + if (r != kCCSuccess && r != kCCUnimplemented) return -1; r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf, AES_BLOCK_SIZE, NULL); Modified: stable/10/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_entry.h Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/libarchive/archive_entry.h Wed Sep 19 09:41:44 2018 (r338796) @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3003002 +#define ARCHIVE_VERSION_NUMBER 3003003 /* * Note: archive_entry.h is for use outside of libarchive; the Modified: stable/10/contrib/libarchive/libarchive/archive_pack_dev.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_pack_dev.c Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/contrib/libarchive/libarchive/archive_pack_dev.c Wed Sep 19 09:41:44 2018 (r338796) @@ -57,6 +57,9 @@ __RCSID("$NetBSD$"); #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_SYS_SYSMACROS_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif Modified: stable/10/usr.bin/bsdcat/Makefile ============================================================================== --- stable/10/usr.bin/bsdcat/Makefile Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/usr.bin/bsdcat/Makefile Wed Sep 19 09:41:44 2018 (r338796) @@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive _LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive PROG= bsdcat -BSDCAT_VERSION_STRING= 3.3.2 +BSDCAT_VERSION_STRING= 3.3.3 .PATH: ${_LIBARCHIVEDIR}/cat SRCS= bsdcat.c cmdline.c Modified: stable/10/usr.bin/cpio/Makefile ============================================================================== --- stable/10/usr.bin/cpio/Makefile Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/usr.bin/cpio/Makefile Wed Sep 19 09:41:44 2018 (r338796) @@ -6,7 +6,7 @@ LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive PROG= bsdcpio -BSDCPIO_VERSION_STRING= 3.3.2 +BSDCPIO_VERSION_STRING= 3.3.3 .PATH: ${LIBARCHIVEDIR}/cpio SRCS= cpio.c cmdline.c Modified: stable/10/usr.bin/tar/Makefile ============================================================================== --- stable/10/usr.bin/tar/Makefile Wed Sep 19 09:41:33 2018 (r338795) +++ stable/10/usr.bin/tar/Makefile Wed Sep 19 09:41:44 2018 (r338796) @@ -4,7 +4,7 @@ LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive PROG= bsdtar -BSDTAR_VERSION_STRING= 3.3.2 +BSDTAR_VERSION_STRING= 3.3.3 .PATH: ${LIBARCHIVEDIR}/tar SRCS= bsdtar.c \ From owner-svn-src-stable-10@freebsd.org Wed Sep 19 19:52:54 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A80C10A51E6; Wed, 19 Sep 2018 19:52:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFA688F920; Wed, 19 Sep 2018 19:52:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E959A1397A; Wed, 19 Sep 2018 19:52:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8JJqrNw064695; Wed, 19 Sep 2018 19:52:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8JJqrQd064694; Wed, 19 Sep 2018 19:52:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201809191952.w8JJqrQd064694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 19 Sep 2018 19:52: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: r338808 - in stable/10/sys/dev: ic uart X-SVN-Group: stable-10 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/10/sys/dev: ic uart X-SVN-Commit-Revision: 338808 X-SVN-Commit-Repository: base 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.27 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, 19 Sep 2018 19:52:54 -0000 Author: mav Date: Wed Sep 19 19:52:53 2018 New Revision: 338808 URL: https://svnweb.freebsd.org/changeset/base/338808 Log: MFC r308750: Add support for UART found in the Ingenic XBurst system on chips. These CPUs has non-standard UART enable bit hidden in the UART FIFO Control Register. Modified: stable/10/sys/dev/ic/ns16550.h stable/10/sys/dev/uart/uart_dev_ns8250.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ic/ns16550.h ============================================================================== --- stable/10/sys/dev/ic/ns16550.h Wed Sep 19 19:35:02 2018 (r338807) +++ stable/10/sys/dev/ic/ns16550.h Wed Sep 19 19:52:53 2018 (r338808) @@ -156,6 +156,9 @@ #define FIFO_XMT_RST FCR_XMT_RST #define FCR_DMA 0x08 #define FIFO_DMA_MODE FCR_DMA +#ifdef CPU_XBURST +#define FCR_UART_ON 0x10 +#endif #define FCR_RX_LOW 0x00 #define FIFO_RX_LOW FCR_RX_LOW #define FCR_RX_MEDL 0x40 Modified: stable/10/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_ns8250.c Wed Sep 19 19:35:02 2018 (r338807) +++ stable/10/sys/dev/uart/uart_dev_ns8250.c Wed Sep 19 19:52:53 2018 (r338808) @@ -188,6 +188,9 @@ ns8250_flush(struct uart_bas *bas, int what) uint8_t fcr; fcr = FCR_ENABLE; +#ifdef CPU_XBURST + fcr |= FCR_UART_ON; +#endif if (what & UART_FLUSH_TRANSMITTER) fcr |= FCR_XMT_RST; if (what & UART_FLUSH_RECEIVER) @@ -258,6 +261,10 @@ ns8250_probe(struct uart_bas *bas) { u_char val; +#ifdef CPU_XBURST + uart_setreg(bas, REG_FCR, FCR_UART_ON); +#endif + /* Check known 0 bits that don't depend on DLAB. */ val = uart_getreg(bas, REG_IIR); if (val & 0x30) @@ -279,7 +286,7 @@ static void ns8250_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, int parity) { - u_char ier; + u_char ier, val; if (bas->rclk == 0) bas->rclk = DEFAULT_RCLK; @@ -296,7 +303,11 @@ ns8250_init(struct uart_bas *bas, int baudrate, int da uart_barrier(bas); /* Disable the FIFO (if present). */ - uart_setreg(bas, REG_FCR, 0); + val = 0; +#ifdef CPU_XBURST + val = FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); /* Set RTS & DTR. */ @@ -456,6 +467,9 @@ ns8250_bus_attach(struct uart_softc *sc) ns8250->mcr = uart_getreg(bas, REG_MCR); ns8250->fcr = FCR_ENABLE; +#ifdef CPU_XBURST + ns8250->fcr |= FCR_UART_ON; +#endif if (!resource_int_value("uart", device_get_unit(sc->sc_dev), "flags", &ivar)) { if (UART_FLAGS_FCR_RX_LOW(ivar)) @@ -747,6 +761,7 @@ ns8250_bus_probe(struct uart_softc *sc) struct uart_bas *bas; int count, delay, error, limit; uint8_t lsr, mcr, ier; + uint8_t val; ns8250 = (struct ns8250_softc *)sc; bas = &sc->sc_bas; @@ -780,7 +795,11 @@ ns8250_bus_probe(struct uart_softc *sc) * done. Since this is the first time we enable the FIFOs, we reset * them. */ - uart_setreg(bas, REG_FCR, FCR_ENABLE); + val = FCR_ENABLE; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); if (!(uart_getreg(bas, REG_IIR) & IIR_FIFO_MASK)) { /* @@ -794,7 +813,11 @@ ns8250_bus_probe(struct uart_softc *sc) return (0); } - uart_setreg(bas, REG_FCR, FCR_ENABLE | FCR_XMT_RST | FCR_RCV_RST); + val = FCR_ENABLE | FCR_XMT_RST | FCR_RCV_RST; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); count = 0; @@ -804,7 +827,11 @@ ns8250_bus_probe(struct uart_softc *sc) error = ns8250_drain(bas, UART_DRAIN_RECEIVER|UART_DRAIN_TRANSMITTER); if (error) { uart_setreg(bas, REG_MCR, mcr); - uart_setreg(bas, REG_FCR, 0); + val = 0; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); goto describe; } @@ -834,7 +861,11 @@ ns8250_bus_probe(struct uart_softc *sc) ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask; uart_setreg(bas, REG_IER, ier); uart_setreg(bas, REG_MCR, mcr); - uart_setreg(bas, REG_FCR, 0); + val = 0; +#ifdef CPU_XBURST + val |= FCR_UART_ON; +#endif + uart_setreg(bas, REG_FCR, val); uart_barrier(bas); count = 0; goto describe; From owner-svn-src-stable-10@freebsd.org Wed Sep 19 19:54:15 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1B3810A5287; Wed, 19 Sep 2018 19:54:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7898C8FA76; Wed, 19 Sep 2018 19:54:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53E731397D; Wed, 19 Sep 2018 19:54:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8JJsEW2064820; Wed, 19 Sep 2018 19:54:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8JJsDh0064819; Wed, 19 Sep 2018 19:54:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201809191954.w8JJsDh0064819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 19 Sep 2018 19:54:13 +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: r338809 - stable/10/sys/dev/uart X-SVN-Group: stable-10 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/10/sys/dev/uart X-SVN-Commit-Revision: 338809 X-SVN-Commit-Repository: base 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.27 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, 19 Sep 2018 19:54:15 -0000 Author: mav Date: Wed Sep 19 19:54:13 2018 New Revision: 338809 URL: https://svnweb.freebsd.org/changeset/base/338809 Log: MFC r317659, r317752: Make some UART consoles to not spin wait for data to be sent. At least with Tx FIFO enabled it shows me ~10% reduction of verbose boot time with serial console at 115200 baud. Modified: stable/10/sys/dev/uart/uart_dev_lpc.c stable/10/sys/dev/uart/uart_dev_ns8250.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart_dev_lpc.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_lpc.c Wed Sep 19 19:52:53 2018 (r338808) +++ stable/10/sys/dev/uart/uart_dev_lpc.c Wed Sep 19 19:54:13 2018 (r338809) @@ -346,9 +346,6 @@ lpc_ns8250_putc(struct uart_bas *bas, int c) DELAY(4); uart_setreg(bas, REG_DATA, c); uart_barrier(bas); - limit = 250000; - while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit) - DELAY(4); } static int @@ -889,8 +886,13 @@ lpc_ns8250_bus_transmit(struct uart_softc *sc) bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); - while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) - ; + if (sc->sc_txdatasz > 1) { + if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) + lpc_ns8250_drain(bas, UART_DRAIN_TRANSMITTER); + } else { + while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) + DELAY(4); + } uart_setreg(bas, REG_IER, lpc_ns8250->ier | IER_ETXRDY); uart_barrier(bas); for (i = 0; i < sc->sc_txdatasz; i++) { Modified: stable/10/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- stable/10/sys/dev/uart/uart_dev_ns8250.c Wed Sep 19 19:52:53 2018 (r338808) +++ stable/10/sys/dev/uart/uart_dev_ns8250.c Wed Sep 19 19:54:13 2018 (r338809) @@ -305,7 +305,7 @@ ns8250_init(struct uart_bas *bas, int baudrate, int da /* Disable the FIFO (if present). */ val = 0; #ifdef CPU_XBURST - val = FCR_UART_ON; + val |= FCR_UART_ON; #endif uart_setreg(bas, REG_FCR, val); uart_barrier(bas); @@ -336,9 +336,6 @@ ns8250_putc(struct uart_bas *bas, int c) DELAY(4); uart_setreg(bas, REG_DATA, c); uart_barrier(bas); - limit = 250000; - while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit) - DELAY(4); } static int @@ -993,8 +990,13 @@ ns8250_bus_transmit(struct uart_softc *sc) bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); - while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) - ; + if (sc->sc_txdatasz > 1) { + if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) + ns8250_drain(bas, UART_DRAIN_TRANSMITTER); + } else { + while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) + DELAY(4); + } uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY); uart_barrier(bas); for (i = 0; i < sc->sc_txdatasz; i++) { From owner-svn-src-stable-10@freebsd.org Fri Sep 21 15:58:09 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58D41109D70C; Fri, 21 Sep 2018 15:58:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0328C84768; Fri, 21 Sep 2018 15:58:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED9D27253; Fri, 21 Sep 2018 15:58:08 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8LFw8ZM034783; Fri, 21 Sep 2018 15:58:08 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8LFw85E034782; Fri, 21 Sep 2018 15:58:08 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201809211558.w8LFw85E034782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 21 Sep 2018 15:58:08 +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: r338859 - in stable: 10/release/scripts 11/release/scripts X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/scripts 11/release/scripts X-SVN-Commit-Revision: 338859 X-SVN-Commit-Repository: base 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.27 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, 21 Sep 2018 15:58:09 -0000 Author: gjb Date: Fri Sep 21 15:58:08 2018 New Revision: 338859 URL: https://svnweb.freebsd.org/changeset/base/338859 Log: MFC r338754: Update the pkg-stage.sh script used to populate packages on the dvd1.iso installation medium from including KDE4 to KDE5, as the KDE4-based ports have been marked as deprecated in the Ports Collection. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/scripts/pkg-stage.sh Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/scripts/pkg-stage.sh Directory Properties: stable/11/ (props changed) Modified: stable/10/release/scripts/pkg-stage.sh ============================================================================== --- stable/10/release/scripts/pkg-stage.sh Fri Sep 21 15:00:46 2018 (r338858) +++ stable/10/release/scripts/pkg-stage.sh Fri Sep 21 15:58:08 2018 (r338859) @@ -29,7 +29,7 @@ www/firefox www/links x11-drivers/xf86-video-vmware x11/gnome3 -x11/kde4 +x11/kde5 x11/xorg" # If NOPORTS is set for the release, do not attempt to build pkg(8).