All of lore.kernel.org
 help / color / mirror / Atom feed
* [Devel] [PATCH v2 0/2] ACPI: SPCR: Use access width to determine mmio usage
@ 2017-07-03 21:33 ` Loc Ho
  0 siblings, 0 replies; 11+ messages in thread
From: Loc Ho @ 2017-07-03 21:33 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

v2:
* Merged Jon Mason patch with APM X-Gene patch

Loc Ho (2):
  ACPI: SPCR: Use access width to determine mmio usage
  ACPI: SPCR: Workaround for APM X-Gene 8250 UART 32-alignment errata

 drivers/acpi/spcr.c     | 40 ++++++++++++++++++++++++++++++++++++++--
 include/acpi/acrestyp.h |  7 +++++++
 2 files changed, 45 insertions(+), 2 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Devel] [PATCH v2 2/2] ACPI: SPCR: Workaround for APM X-Gene 8250 UART 32-alignment errata
  2017-07-03 21:33 ` Loc Ho
@ 2017-07-03 21:33 ` Loc Ho
  -1 siblings, 0 replies; 11+ messages in thread
From: Loc Ho @ 2017-07-03 21:33 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1735 bytes --]

APM X-Gene verion 1 and 2 have an 8250 UART with its register
aligned to 32-bit. In addition, the latest released BIOS
encodes the access field as 8-bit access instead 32-bit access.
This causes no console with ACPI boot as the console
will not match X-Gene UART port due to the lack of mmio32
option.

Signed-off-by: Loc Ho <lho(a)apm.com>
---
 drivers/acpi/spcr.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 2905063..4ac3e06 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -36,6 +36,26 @@ static bool qdf2400_erratum_44_present(struct acpi_table_header *h)
 	return false;
 }
 
+/*
+ * APM X-Gene v1 and v2 UART hardware is an 16550 like device but has its
+ * register aligned to 32-bit. In addition, the BIOS also encoded the
+ * access width to be 8 bits. This function detects this errata condition.
+ */
+static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
+{
+	if (tb->interface_type != ACPI_DBG2_16550_COMPATIBLE)
+		return false;
+
+	if (memcmp(tb->header.oem_id, "APMC0D", ACPI_OEM_ID_SIZE))
+		return false;
+
+	if (!memcmp(tb->header.oem_table_id, "XGENESPC",
+	    ACPI_OEM_TABLE_ID_SIZE) && tb->header.oem_revision == 0)
+		return true;
+
+	return false;
+}
+
 /**
  * parse_spcr() - parse ACPI SPCR table and add preferred console
  *
@@ -129,6 +149,8 @@ int __init parse_spcr(bool earlycon)
 
 	if (qdf2400_erratum_44_present(&table->header))
 		uart = "qdf2400_e44";
+	if (xgene_8250_erratum_present(table))
+		iotype = "mmio32";
 
 	snprintf(opts, sizeof(opts), "%s,%s,0x%llx,%d", uart, iotype,
 		 table->serial_port.address, baud_rate);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread
* Re: [Devel] [PATCH v2 2/2] ACPI: SPCR: Workaround for APM X-Gene 8250 UART 32-alignment errata
  2017-07-03 21:33 ` Loc Ho
@ 2017-07-03 21:45 ` Rafael J. Wysocki
  -1 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2017-07-03 21:45 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]

On Mon, Jul 3, 2017 at 11:33 PM, Loc Ho <lho(a)apm.com> wrote:
> APM X-Gene verion 1 and 2 have an 8250 UART with its register
> aligned to 32-bit. In addition, the latest released BIOS
> encodes the access field as 8-bit access instead 32-bit access.
> This causes no console with ACPI boot as the console
> will not match X-Gene UART port due to the lack of mmio32
> option.
>
> Signed-off-by: Loc Ho <lho(a)apm.com>

Greg, Aleksey, any objections?

If not, I'll route this through the ACPI tree.

> ---
>  drivers/acpi/spcr.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
> index 2905063..4ac3e06 100644
> --- a/drivers/acpi/spcr.c
> +++ b/drivers/acpi/spcr.c
> @@ -36,6 +36,26 @@ static bool qdf2400_erratum_44_present(struct acpi_table_header *h)
>         return false;
>  }
>
> +/*
> + * APM X-Gene v1 and v2 UART hardware is an 16550 like device but has its
> + * register aligned to 32-bit. In addition, the BIOS also encoded the
> + * access width to be 8 bits. This function detects this errata condition.
> + */
> +static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
> +{
> +       if (tb->interface_type != ACPI_DBG2_16550_COMPATIBLE)
> +               return false;
> +
> +       if (memcmp(tb->header.oem_id, "APMC0D", ACPI_OEM_ID_SIZE))
> +               return false;
> +
> +       if (!memcmp(tb->header.oem_table_id, "XGENESPC",
> +           ACPI_OEM_TABLE_ID_SIZE) && tb->header.oem_revision == 0)
> +               return true;
> +
> +       return false;
> +}
> +
>  /**
>   * parse_spcr() - parse ACPI SPCR table and add preferred console
>   *
> @@ -129,6 +149,8 @@ int __init parse_spcr(bool earlycon)
>
>         if (qdf2400_erratum_44_present(&table->header))
>                 uart = "qdf2400_e44";
> +       if (xgene_8250_erratum_present(table))
> +               iotype = "mmio32";
>
>         snprintf(opts, sizeof(opts), "%s,%s,0x%llx,%d", uart, iotype,
>                  table->serial_port.address, baud_rate);
> --
> 1.8.3.1
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-07-04  7:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03 21:33 [Devel] [PATCH v2 0/2] ACPI: SPCR: Use access width to determine mmio usage Loc Ho
2017-07-03 21:33 ` Loc Ho
2017-07-03 21:33 ` [Devel] [PATCH v2 1/2] " Loc Ho
2017-07-03 21:33   ` Loc Ho
2017-07-03 21:44   ` [Devel] " Rafael J. Wysocki
2017-07-03 21:44     ` Rafael J. Wysocki
2017-07-04  7:22     ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2017-07-03 21:33 [Devel] [PATCH v2 2/2] ACPI: SPCR: Workaround for APM X-Gene 8250 UART 32-alignment errata Loc Ho
2017-07-03 21:33 ` Loc Ho
2017-07-03 21:45 [Devel] " Rafael J. Wysocki
2017-07-03 21:45 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.