Commit 5f51c7ce authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI: CPPC: Fix up I/O port access in cpc_read()

The code as currently implemented does not work on big endian systems,
so fix it up.

Fixes: a2c8f92b ("ACPI: CPPC: Implement support for SystemIO registers")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/linux-acpi/20220111092928.GA24968@kili/Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarHuang Rui <ray.huang@amd.com>
parent b35b6d4d
...@@ -929,16 +929,18 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) ...@@ -929,16 +929,18 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val)
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
u32 width = 8 << (reg->access_width - 1); u32 width = 8 << (reg->access_width - 1);
u32 val_u32;
acpi_status status; acpi_status status;
status = acpi_os_read_port((acpi_io_address)reg->address, status = acpi_os_read_port((acpi_io_address)reg->address,
(u32 *)val, width); &val_u32, width);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
pr_debug("Error: Failed to read SystemIO port %llx\n", pr_debug("Error: Failed to read SystemIO port %llx\n",
reg->address); reg->address);
return -EFAULT; return -EFAULT;
} }
*val = val_u32;
return 0; return 0;
} else if (reg->space_id == ACPI_ADR_SPACE_PLATFORM_COMM && pcc_ss_id >= 0) } else if (reg->space_id == ACPI_ADR_SPACE_PLATFORM_COMM && pcc_ss_id >= 0)
vaddr = GET_PCC_VADDR(reg->address, pcc_ss_id); vaddr = GET_PCC_VADDR(reg->address, pcc_ss_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment