ACPI: SPCR: Use access width to determine mmio usage

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: Jon Mason <[email protected]>
Signed-off-by: Loc Ho <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
This commit is contained in:
Loc Ho 2017-07-03 14:33:08 -07:00 • committed by Rafael J. Wysocki
commit 2bece49394
2 changed files with 23 additions and 2 deletions

View file

@ -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: