summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2017-08-03 02:26:19 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-03 17:34:15 -0400
commit4eebedd8f1a6609739c2e9a9b020791b23cbcceb (patch)
tree0f971e4f5bda4df87f5b2153d11b88b958ec8472
parentab539eaa50c6a97f1d6287c5ce3ee75155cb10b8 (diff)
ACPICA: Divergences: reduce access size definitions
ACPICA commit cf27b3c98883d2a15d932016792fcb8272ace96d The following commit introduces definition of access width to ACPICA. Commit: 2bece49394872d36bbc5767fd643deac05920c55 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>
-rw-r--r--drivers/acpi/acpica/hwregs.c2
-rw-r--r--drivers/acpi/spcr.c9
-rw-r--r--include/acpi/acrestyp.h7
-rw-r--r--include/acpi/actypes.h7
4 files changed, 13 insertions, 12 deletions
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index de74a4c25085..acb417b58bbb 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -107,7 +107,7 @@ acpi_hw_get_access_bit_width(u64 address,
107 ACPI_IS_ALIGNED(reg->bit_width, 8)) { 107 ACPI_IS_ALIGNED(reg->bit_width, 8)) {
108 access_bit_width = reg->bit_width; 108 access_bit_width = reg->bit_width;
109 } else if (reg->access_width) { 109 } else if (reg->access_width) {
110 access_bit_width = (1 << (reg->access_width + 2)); 110 access_bit_width = ACPI_ACCESS_BIT_WIDTH(reg->access_width);
111 } else { 111 } else {
112 access_bit_width = 112 access_bit_width =
113 ACPI_ROUND_UP_POWER_OF_TWO_8(reg->bit_offset + 113 ACPI_ROUND_UP_POWER_OF_TWO_8(reg->bit_offset +
diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 4ac3e06b41d8..1230f969256b 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -95,16 +95,17 @@ int __init parse_spcr(bool earlycon)
95 } 95 }
96 96
97 if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 97 if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
98 switch (table->serial_port.access_width) { 98 switch (ACPI_ACCESS_BIT_WIDTH((
99 table->serial_port.access_width))) {
99 default: 100 default:
100 pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); 101 pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n");
101 case ACPI_ACCESS_SIZE_BYTE: 102 case 8:
102 iotype = "mmio"; 103 iotype = "mmio";
103 break; 104 break;
104 case ACPI_ACCESS_SIZE_WORD: 105 case 16:
105 iotype = "mmio16"; 106 iotype = "mmio16";
106 break; 107 break;
107 case ACPI_ACCESS_SIZE_DWORD: 108 case 32:
108 iotype = "mmio32"; 109 iotype = "mmio32";
109 break; 110 break;
110 } 111 }
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 4f7f39a02820..343dbdcef20c 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -377,13 +377,6 @@ struct acpi_resource_generic_register {
377 u64 address; 377 u64 address;
378}; 378};
379 379
380/* Generic Address Space Access Sizes */
381#define ACPI_ACCESS_SIZE_UNDEFINED 0
382#define ACPI_ACCESS_SIZE_BYTE 1
383#define ACPI_ACCESS_SIZE_WORD 2
384#define ACPI_ACCESS_SIZE_DWORD 3
385#define ACPI_ACCESS_SIZE_QWORD 4
386
387struct acpi_resource_gpio { 380struct acpi_resource_gpio {
388 u8 revision_id; 381 u8 revision_id;
389 u8 connection_type; 382 u8 connection_type;
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 2fcbaec8b368..0260be595d40 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -554,6 +554,13 @@ typedef u64 acpi_integer;
554#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) 554#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
555#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) 555#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
556 556
557/*
558 * Algorithm to obtain access bit width.
559 * Can be used with access_width of struct acpi_generic_address and access_size of
560 * struct acpi_resource_generic_register.
561 */
562#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2))
563
557/******************************************************************************* 564/*******************************************************************************
558 * 565 *
559 * Miscellaneous constants 566 * Miscellaneous constants