From patchwork Tue Nov 29 18:43:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9452983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 132356071C for ; Tue, 29 Nov 2016 18:45:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0404A283E6 for ; Tue, 29 Nov 2016 18:45:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC436283F8; Tue, 29 Nov 2016 18:45:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_MED,SUSPICIOUS_RECIPS autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A3529283F1 for ; Tue, 29 Nov 2016 18:45:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBnOI-0003Cn-Bo; Tue, 29 Nov 2016 18:44:30 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBnNh-0002dI-IS for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2016 18:43:54 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F02420204; Tue, 29 Nov 2016 18:43:36 +0000 (UTC) Received: from localhost (unknown [69.55.156.165]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 35D4020142; Tue, 29 Nov 2016 18:43:35 +0000 (UTC) Subject: [PATCH 2/2] ACPI: Ignore Consumer/Producer for QWord/DWord/Word Address Space From: Bjorn Helgaas To: linux-pci@vger.kernel.org Date: Tue, 29 Nov 2016 12:43:34 -0600 Message-ID: <20161129184334.7618.5495.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <20161129182415.7618.99129.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <20161129182415.7618.99129.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161129_104353_684813_2E4FFA39 X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-acpi@lists.linaro.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Per ACPI spec r6.0, sec 6.4.3.5.1, 2, 3, Bit [0] of General Flags (the Consumer/Producer bit) should be ignored for QWord/DWord/Word Address Space descriptors. The Consumer/Producer bit is defined only for the Extended Address Space descriptor. Ignore Consumer/Producer except for Extended Address Space descriptors. Note that for QWord/DWord/Word descriptors, we previously applied the translation offset (_TRA) only when the Consumer/Producer bit was set. This patch changes that: for those descriptors, we ignore Consumer/Producer and always apply the translation offset. Signed-off-by: Bjorn Helgaas --- drivers/acpi/resource.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 2732d39e..b45cd8f 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -261,11 +261,16 @@ bool acpi_dev_resource_address_space(struct acpi_resource *ares, * primary side. Non-bridge devices must list 0 for all Address * Translation offset bits. */ - if (addr->producer_consumer == ACPI_PRODUCER) + if (ares->type == ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64) { + if (addr->producer_consumer == ACPI_PRODUCER) + offset = attr->translation_offset; + else if (attr->translation_offset) + pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n", + attr->translation_offset); + } else { offset = attr->translation_offset; - else if (attr->translation_offset) - pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n", - attr->translation_offset); + } + start = attr->minimum + offset; end = attr->maximum + offset; @@ -294,7 +299,8 @@ bool acpi_dev_resource_address_space(struct acpi_resource *ares, return false; } - if (addr->producer_consumer == ACPI_PRODUCER) + if (ares->type == ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 && + addr->producer_consumer == ACPI_PRODUCER) res->flags |= IORESOURCE_WINDOW; if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)