From: Loc Ho <lho@apm.com>
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 <lho@apm.com>
Subject: [PATCH v2 1/2] ACPI: SPCR: Use access width to determine mmio usage
Date: Mon, 3 Jul 2017 14:33:08 -0700 [thread overview]
Message-ID: <1499117589-4829-2-git-send-email-lho@apm.com> (raw)
In-Reply-To: <1499117589-4829-1-git-send-email-lho@apm.com>
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 <lho@apm.com>
[Re-send as single patch set]
Signed-off-by: Jon Mason <jon.mason@broadcom.com>
---
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;
--
1.8.3.1
next prev parent reply other threads:[~2017-07-03 21:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 21:33 [PATCH v2 0/2] " Loc Ho
2017-07-03 21:33 ` Loc Ho [this message]
2017-07-03 21:44 ` [PATCH v2 1/2] " Rafael J. Wysocki
2017-07-04 7:22 ` Greg Kroah-Hartman
2017-07-03 21:33 ` [PATCH v2 2/2] ACPI: SPCR: Workaround for APM X-Gene 8250 UART 32-alignment errata Loc Ho
2017-07-03 21:45 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499117589-4829-2-git-send-email-lho@apm.com \
--to=lho@apm.com \
--cc=aleksey.makarov@linaro.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devel@acpica.org \
--cc=gregkh@linuxfoundation.org \
--cc=jcm@redhat.com \
--cc=jon.mason@broadcom.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=patches@apm.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome