Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Aug 2020 19:33:55 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
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
Message-ID:  <202008071933.077JXt7r056577@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008071933.077JXt7r056577>