From owner-svn-src-projects@freebsd.org Fri Aug 7 19:33:56 2020 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B502372F1A for ; Fri, 7 Aug 2020 19:33:56 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BNbBr37GPz3Zvt; Fri, 7 Aug 2020 19:33:56 +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 4E0411CB61; Fri, 7 Aug 2020 19:33:56 +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 077JXu3h056581; Fri, 7 Aug 2020 19:33:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077JXt7r056577; Fri, 7 Aug 2020 19:33:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008071933.077JXt7r056577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 7 Aug 2020 19:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r364041 - in projects/clang1100-import: sys/dev/acpica sys/dev/pci sys/kern sys/powerpc/aim usr.bin/script X-SVN-Group: projects X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in projects/clang1100-import: sys/dev/acpica sys/dev/pci sys/kern sys/powerpc/aim usr.bin/script X-SVN-Commit-Revision: 364041 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 19:33:56 -0000 Author: dim Date: Fri Aug 7 19:33:54 2020 New Revision: 364041 URL: https://svnweb.freebsd.org/changeset/base/364041 Log: Merge ^/head r363583 through r364040. Modified: projects/clang1100-import/sys/dev/acpica/acpi_apei.c projects/clang1100-import/sys/dev/pci/pci.c projects/clang1100-import/sys/kern/subr_bus.c projects/clang1100-import/sys/powerpc/aim/mmu_radix.c projects/clang1100-import/usr.bin/script/script.c Directory Properties: projects/clang1100-import/ (props changed) Modified: projects/clang1100-import/sys/dev/acpica/acpi_apei.c ============================================================================== --- projects/clang1100-import/sys/dev/acpica/acpi_apei.c Fri Aug 7 19:32:54 2020 (r364040) +++ projects/clang1100-import/sys/dev/acpica/acpi_apei.c Fri Aug 7 19:33:54 2020 (r364041) @@ -348,7 +348,7 @@ apei_ge_handler(struct apei_ge *ge, bool copy) uint32_t sev; int i, c, off; - if (ges->BlockStatus == 0) + if (ges == NULL || ges->BlockStatus == 0) return (0); c = (ges->BlockStatus >> 4) & 0x3ff; @@ -363,7 +363,8 @@ apei_ge_handler(struct apei_ge *ge, bool copy) /* Acknowledge the error has been processed. */ ges->BlockStatus = 0; - if (!copy && ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { + if (!copy && ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && + ge->res2) { uint64_t val = READ8(ge->res2, 0); val &= ge->v2.ReadAckPreserve; val |= ge->v2.ReadAckWrite; @@ -395,7 +396,7 @@ apei_nmi_handler(void) return (0); ges = (ACPI_HEST_GENERIC_STATUS *)ge->buf; - if (ges->BlockStatus == 0) + if (ges == NULL || ges->BlockStatus == 0) return (0); /* If ACPI told the error is fatal -- make it so. */ @@ -409,7 +410,8 @@ apei_nmi_handler(void) /* Acknowledge the error has been processed. */ ges->BlockStatus = 0; - if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { + if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && + ge->res2) { uint64_t val = READ8(ge->res2, 0); val &= ge->v2.ReadAckPreserve; val |= ge->v2.ReadAckWrite; @@ -608,13 +610,19 @@ apei_attach(device_t dev) ge->res_rid = rid++; acpi_bus_alloc_gas(dev, &ge->res_type, &ge->res_rid, &ge->v1.ErrorStatusAddress, &ge->res, 0); + if (ge->res) { + ge->buf = pmap_mapdev_attr(READ8(ge->res, 0), + ge->v1.ErrorBlockLength, VM_MEMATTR_WRITE_COMBINING); + } else { + device_printf(dev, "Can't allocate status resource.\n"); + } if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { ge->res2_rid = rid++; acpi_bus_alloc_gas(dev, &ge->res2_type, &ge->res2_rid, &ge->v2.ReadAckRegister, &ge->res2, 0); + if (ge->res2 == NULL) + device_printf(dev, "Can't allocate ack resource.\n"); } - ge->buf = pmap_mapdev_attr(READ8(ge->res, 0), - ge->v1.ErrorBlockLength, VM_MEMATTR_WRITE_COMBINING); if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_POLLED) { callout_init(&ge->poll, 1); callout_reset(&ge->poll, @@ -652,7 +660,10 @@ apei_detach(device_t dev) while ((ge = TAILQ_FIRST(&sc->ges)) != NULL) { TAILQ_REMOVE(&sc->ges, ge, link); - bus_release_resource(dev, ge->res_type, ge->res_rid, ge->res); + if (ge->res) { + bus_release_resource(dev, ge->res_type, + ge->res_rid, ge->res); + } if (ge->res2) { bus_release_resource(dev, ge->res2_type, ge->res2_rid, ge->res2); @@ -663,7 +674,10 @@ apei_detach(device_t dev) swi_remove(&ge->swi_ih); free(ge->copybuf, M_DEVBUF); } - pmap_unmapdev((vm_offset_t)ge->buf, ge->v1.ErrorBlockLength); + if (ge->buf) { + pmap_unmapdev((vm_offset_t)ge->buf, + ge->v1.ErrorBlockLength); + } free(ge, M_DEVBUF); } return (0); Modified: projects/clang1100-import/sys/dev/pci/pci.c ============================================================================== --- projects/clang1100-import/sys/dev/pci/pci.c Fri Aug 7 19:32:54 2020 (r364040) +++ projects/clang1100-import/sys/dev/pci/pci.c Fri Aug 7 19:33:54 2020 (r364041) @@ -408,7 +408,7 @@ static int pci_enable_ari = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, &pci_enable_ari, 0, "Enable support for PCIe Alternative RID Interpretation"); -int pci_enable_aspm; +int pci_enable_aspm = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_aspm, CTLFLAG_RDTUN, &pci_enable_aspm, 0, "Enable support for PCIe Active State Power Management"); Modified: projects/clang1100-import/sys/kern/subr_bus.c ============================================================================== --- projects/clang1100-import/sys/kern/subr_bus.c Fri Aug 7 19:32:54 2020 (r364040) +++ projects/clang1100-import/sys/kern/subr_bus.c Fri Aug 7 19:33:54 2020 (r364041) @@ -860,8 +860,6 @@ sysctl_devctl_queue(SYSCTL_HANDLER_ARGS) * The devctl protocol relies on quoted strings having matching quotes. * This routine quotes any internal quotes so the resulting string * is safe to pass to snprintf to construct, for example pnp info strings. - * Strings are always terminated with a NUL, but may be truncated if longer - * than @p len bytes after quotes. * * @param sb sbuf to place the characters into * @param src Original buffer. Modified: projects/clang1100-import/sys/powerpc/aim/mmu_radix.c ============================================================================== --- projects/clang1100-import/sys/powerpc/aim/mmu_radix.c Fri Aug 7 19:32:54 2020 (r364040) +++ projects/clang1100-import/sys/powerpc/aim/mmu_radix.c Fri Aug 7 19:33:54 2020 (r364041) @@ -183,7 +183,7 @@ ttusync(void) * Invalidate a range of translations */ -static __inline void +static __always_inline void radix_tlbie(uint8_t ric, uint8_t prs, uint16_t is, uint32_t pid, uint32_t lpid, vm_offset_t va, uint16_t ap) { @@ -715,7 +715,7 @@ static struct md_page pv_dummy; static int powernv_enabled = 1; -static inline void +static __always_inline void tlbiel_radix_set_isa300(uint32_t set, uint32_t is, uint32_t pid, uint32_t ric, uint32_t prs) { Modified: projects/clang1100-import/usr.bin/script/script.c ============================================================================== --- projects/clang1100-import/usr.bin/script/script.c Fri Aug 7 19:32:54 2020 (r364040) +++ projects/clang1100-import/usr.bin/script/script.c Fri Aug 7 19:33:54 2020 (r364041) @@ -428,6 +428,33 @@ consume(FILE *fp, off_t len, char *buf, int reg) } while (0/*CONSTCOND*/) static void +termset(void) +{ + struct termios traw; + + if (tcgetattr(STDOUT_FILENO, &tt) == -1) { + if (errno == EBADF) + err(1, "%d not valid fd", STDOUT_FILENO); + /* errno == ENOTTY */ + return; + } + ttyflg = 1; + traw = tt; + cfmakeraw(&traw); + traw.c_lflag |= ISIG; + (void)tcsetattr(STDOUT_FILENO, TCSANOW, &traw); +} + +static void +termreset(void) +{ + if (ttyflg) { + tcsetattr(STDOUT_FILENO, TCSADRAIN, &tt); + ttyflg = 0; + } +} + +static void playback(FILE *fp) { struct timespec tsi, tso; @@ -470,8 +497,11 @@ playback(FILE *fp) ctime(&tclock)); tsi = tso; (void)consume(fp, stamp.scr_len, buf, reg); + termset(); + atexit(termreset); break; case 'e': + termreset(); if (!qflg) (void)printf("\nScript done on %s", ctime(&tclock));