From patchwork Mon Jul 3 21:33:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loc Ho X-Patchwork-Id: 9824025 X-Patchwork-Delegate: rjw@sisk.pl 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 39B3060353 for ; Mon, 3 Jul 2017 21:33:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24CAD26538 for ; Mon, 3 Jul 2017 21:33:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 195F226E5D; Mon, 3 Jul 2017 21:33:54 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A614526538 for ; Mon, 3 Jul 2017 21:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753245AbdGCVdl (ORCPT ); Mon, 3 Jul 2017 17:33:41 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:32896 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752791AbdGCVdN (ORCPT ); Mon, 3 Jul 2017 17:33:13 -0400 Received: by mail-pg0-f48.google.com with SMTP id k14so24510654pgr.0 for ; Mon, 03 Jul 2017 14:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MFn/hC8G60NDcCYYwObhNTu3xVviwJqXoUKPXobH+UU=; b=GhqCRS1PWshLc8rDeOYa0C1p7SWW/QaXtPyS0yxtzzi06gEaMyUypRccQvKc2FqDGL j8OgEc7iGOLaLEUPPmDAnbgKCqe0Kt5A3Tp0jF4HoQuBHb8RIl4KnSkooPtdMC0bCPFM rZBZAzYlBTr2u8JV0JCEBkRZfNEaBBNANQrIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MFn/hC8G60NDcCYYwObhNTu3xVviwJqXoUKPXobH+UU=; b=Y1tX1mzW4pfQ/Meg7qx5Qdvz2MIWYpze1C6b6iLDOO6lRrF8nHbOSoPgvULtTPkS34 Yl03Lud2ukIoBkEFM122vQro2yny1IMK0hqtO0115UtAlsVtgxX8mSgt59gqxdqU87KN uhhX4AD1CVxCr9KwyMh8LeodtQ+hSS85eqCixwq1fpxpvwnhF+hOBJYQP6HKzgCiKna9 kEBMgxOY0x01tMDEFkjegr3NmunbiJo3XSNFToWtMZw2OBuECXIOXEWqDKu3NV9PWlna FNU9DEQH8HS5BucQlr5+TIPaUJgH7BjCJxDx1QXzLChg/oLLJRyRTip0urUK7YMvUeLd +T7A== X-Gm-Message-State: AIVw113ih5SR3oQbNsxSA4POKzM4/oS0oktm7Op/JqXH+d9EBPK7jEM8 Kn6pPU9ghmz7oOhc X-Received: by 10.84.218.5 with SMTP id q5mr12776553pli.295.1499117592936; Mon, 03 Jul 2017 14:33:12 -0700 (PDT) Received: from softwaredev21.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id e124sm40672161pfc.76.2017.07.03.14.33.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jul 2017 14:33:12 -0700 (PDT) From: Loc Ho To: rafael@kernel.org, jon.mason@broadcom.com Cc: jcm@redhat.com, rjw@rjwysocki.net, lenb@kernel.org, robert.moore@intel.com, lv.zheng@intel.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org, bcm-kernel-feedback-list@broadcom.com, aleksey.makarov@linaro.org, gregkh@linuxfoundation.org, patches@apm.com, Loc Ho Subject: [PATCH v2 1/2] ACPI: SPCR: Use access width to determine mmio usage Date: Mon, 3 Jul 2017 14:33:08 -0700 Message-Id: <1499117589-4829-2-git-send-email-lho@apm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1499117589-4829-1-git-send-email-lho@apm.com> References: <1499117589-4829-1-git-send-email-lho@apm.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current SPCR code does not check the access width of the mmio, and uses a default of 8bit register accesses. This prevents devices that only do 16 or 32bit register accesses from working. By simply checking this field and setting the mmio string appropriately, this issue can be corrected. To prevent any legacy issues, the code will default to 8bit accesses if the value is anything but 16 or 32. Signed-off-by: Loc Ho [Re-send as single patch set] Signed-off-by: Jon Mason --- drivers/acpi/spcr.c | 18 ++++++++++++++++-- include/acpi/acrestyp.h | 7 +++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index 3afa8c1..2905063 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -74,8 +74,22 @@ int __init parse_spcr(bool earlycon) goto done; } - iotype = table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY ? - "mmio" : "io"; + if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { + switch (table->serial_port.access_width) { + default: + pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); + case ACPI_ACCESS_SIZE_BYTE: + iotype = "mmio"; + break; + case ACPI_ACCESS_SIZE_WORD: + iotype = "mmio16"; + break; + case ACPI_ACCESS_SIZE_DWORD: + iotype = "mmio32"; + break; + } + } else + iotype = "io"; switch (table->interface_type) { case ACPI_DBG2_ARM_SBSA_32BIT: diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h index f0f7403..781cb55 100644 --- a/include/acpi/acrestyp.h +++ b/include/acpi/acrestyp.h @@ -372,6 +372,13 @@ struct acpi_resource_generic_register { u64 address; }; +/* Generic Address Space Access Sizes */ +#define ACPI_ACCESS_SIZE_UNDEFINED 0 +#define ACPI_ACCESS_SIZE_BYTE 1 +#define ACPI_ACCESS_SIZE_WORD 2 +#define ACPI_ACCESS_SIZE_DWORD 3 +#define ACPI_ACCESS_SIZE_QWORD 4 + struct acpi_resource_gpio { u8 revision_id; u8 connection_type;