ACPICA: Divergences: reduce access size definitions
authorLv Zheng <lv.zheng@intel.com>
Thu, 3 Aug 2017 06:26:19 +0000 (14:26 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Aug 2017 21:34:15 +0000 (23:34 +0200)
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>
drivers/acpi/acpica/hwregs.c
drivers/acpi/spcr.c
include/acpi/acrestyp.h
include/acpi/actypes.h

index de74a4c25085b63b1b0fa8d0d29e8ac1a0b93521..acb417b58bbb388f1f53325e154ade65cde131b9 100644 (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 +
index 4ac3e06b41d846440d35079dfa54885111eec0df..1230f969256bfb25793caeeb8f4da832dc75674b 100644 (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;
                }
index 4f7f39a02820b98ef4cf5bc408fee8593bbc9707..343dbdcef20c66b6a1833d03f23028a625a7bb67 100644 (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;
index 2fcbaec8b3687a6319b80b16e27a886262d6eb0b..0260be595d40cfed28cb1a2738fc0f2aadabea3b 100644 (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