From owner-svn-src-all@freebsd.org Tue Apr 9 21:18:04 2019 Return-Path: Delivered-To: svn-src-all@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 E4F8B156E058; Tue, 9 Apr 2019 21:18:03 +0000 (UTC) (envelope-from jhb@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) server-signature RSA-PSS (4096 bits) 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 89FE68273E; Tue, 9 Apr 2019 21:18:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6489F18C05; Tue, 9 Apr 2019 21:18:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x39LI32c011410; Tue, 9 Apr 2019 21:18:03 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x39LI3Xm011409; Tue, 9 Apr 2019 21:18:03 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201904092118.x39LI3Xm011409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 9 Apr 2019 21:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346066 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 346066 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 89FE68273E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2019 21:18:04 -0000 Author: jhb Date: Tue Apr 9 21:18:02 2019 New Revision: 346066 URL: https://svnweb.freebsd.org/changeset/base/346066 Log: Refine r330113 to honor the ProducerConsumer flag most of the time. While it is true that the ACPI spec says that the flag is only valid on Extended Address Space Descriptors, examples of other descriptors in the spec use the ProducerConsumer flag explicitly, and real hardware uses it as well. In fact, even in the ASL of the Thunder X2 for which r330113 was a workaround, some devices use this flag on non-Extended Address Space Descriptors correctly. Instead, only ignore the flag for resources associated with the UART devices on the Thunder X2 using the "ARMH0011" HID to identify these devices. This should fix regressions from ignoring this flag in other contexts such as Hyper-V. PR: 235876 Reported by: Wei Hu Tested by: emaste (Thunder X2) MFC after: 2 weeks Modified: head/sys/dev/acpica/acpi_resource.c Modified: head/sys/dev/acpica/acpi_resource.c ============================================================================== --- head/sys/dev/acpica/acpi_resource.c Tue Apr 9 20:20:04 2019 (r346065) +++ head/sys/dev/acpica/acpi_resource.c Tue Apr 9 21:18:02 2019 (r346066) @@ -202,6 +202,7 @@ struct acpi_resource_context { struct acpi_parse_resource_set *set; device_t dev; void *context; + bool ignore_producer_flag; }; #ifdef ACPI_DEBUG_OUTPUT @@ -385,7 +386,7 @@ acpi_parse_resource(ACPI_RESOURCE *res, void *context) } if (length <= 0) break; - if (res->Type == ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 && + if (!arc->ignore_producer_flag && res->Data.Address.ProducerConsumer != ACPI_CONSUMER) { ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "ignored %s %s producer\n", name, @@ -474,6 +475,12 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, set->set_init(dev, arg, &arc.context); arc.set = set; arc.dev = dev; + arc.ignore_producer_flag = false; + + /* UARTs on ThunderX2 set ResourceProducer on memory resources. */ + if (acpi_MatchHid(handle, "ARMH0011") != ACPI_MATCHHID_NOMATCH) + arc.ignore_producer_flag = true; + status = AcpiWalkResources(handle, "_CRS", acpi_parse_resource, &arc); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { printf("can't fetch resources for %s - %s\n",