diff --git a/source/components/hardware/hwregs.c b/source/components/hardware/hwregs.c index e90fd1482..b5b23831f 100644 --- a/source/components/hardware/hwregs.c +++ b/source/components/hardware/hwregs.c @@ -228,7 +228,7 @@ AcpiHwGetAccessBitWidth ( } else if (Reg->AccessWidth) { - AccessBitWidth = (1 << (Reg->AccessWidth + 2)); + AccessBitWidth = ACPI_ACCESS_BIT_WIDTH (Reg->AccessWidth); } else { diff --git a/source/include/actypes.h b/source/include/actypes.h index 843adec7f..da3288a9c 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -675,6 +675,13 @@ typedef UINT64 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 AccessWidth of ACPI_GENERIC_ADDRESS and AccessSize of + * ACPI_RESOURCE_GENERIC_REGISTER. + */ +#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) + /******************************************************************************* *