ACPICA: Divergences: reduce access size definitions

ACPICA commit cf27b3c98883d2a15d932016792fcb8272ace96d

The following commit introduces definition of access width to ACPICA.
  Commit: 2bece49394
  Subject: ACPI: SPCR: Use access width to determine mmio usage

Actually the access bit width can be calculated via access width. It
would be better to define a macro calculating bit width rather than
defining fixed values. This patch thus cleans up the definitions to
reduce divergences.

Link: https://github.com/acpica/acpica/commit/cf27b3c9
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Lv Zheng 2017-08-03 14:26:19 +08:00 committed by Rafael J. Wysocki
parent ab539eaa50
commit 4eebedd8f1
4 changed files with 13 additions and 12 deletions

View File

@ -107,7 +107,7 @@ acpi_hw_get_access_bit_width(u64 address,
ACPI_IS_ALIGNED(reg->bit_width, 8)) {
access_bit_width = reg->bit_width;
} else if (reg->access_width) {
access_bit_width = (1 << (reg->access_width + 2));
access_bit_width = ACPI_ACCESS_BIT_WIDTH(reg->access_width);
} else {
access_bit_width =
ACPI_ROUND_UP_POWER_OF_TWO_8(reg->bit_offset +

View File

@ -95,16 +95,17 @@ int __init parse_spcr(bool earlycon)
}
if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
switch (table->serial_port.access_width) {
switch (ACPI_ACCESS_BIT_WIDTH((
table->serial_port.access_width))) {
default:
pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n");
case ACPI_ACCESS_SIZE_BYTE:
case 8:
iotype = "mmio";
break;
case ACPI_ACCESS_SIZE_WORD:
case 16:
iotype = "mmio16";
break;
case ACPI_ACCESS_SIZE_DWORD:
case 32:
iotype = "mmio32";
break;
}

View File

@ -377,13 +377,6 @@ 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;

View File

@ -554,6 +554,13 @@ typedef u64 acpi_integer;
#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
/*
* Algorithm to obtain access bit width.
* Can be used with access_width of struct acpi_generic_address and access_size of
* struct acpi_resource_generic_register.
*/
#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2))
/*******************************************************************************
*
* Miscellaneous constants