Commit 30aa7c7d authored by Lv Zheng's avatar Lv Zheng Committed by Luis Henriques

ACPICA: Utilities: Cleanup to enforce ACPI_PHYSADDR_TO_PTR()/ACPI_PTR_TO_PHYSADDR().

commit 6d3fd3cc upstream.

ACPICA commit 154f6d074dd38d6ebc0467ad454454e6c5c9ecdf

There are code pieces converting pointers using "(acpi_physical_address) x"
or "ACPI_CAST_PTR (t, x)" formats, this patch cleans up them.

Known issues:
1. Cleanup of "(ACPI_PHYSICAL_ADDRRESS) x" for a table field
   For the conversions around the table fields, it is better to fix it with
   alignment also fixed. So this patch doesn't modify such code. There
   should be no functional problem by leaving them unchanged.

Link: https://github.com/acpica/acpica/commit/154f6d07Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: George G. Davis <ggdavisiv@gmail.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 6e322a55
...@@ -539,8 +539,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, ...@@ -539,8 +539,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST);
} }
obj_desc->region.address = obj_desc->region.address = ACPI_PTR_TO_PHYSADDR(table);
(acpi_physical_address) ACPI_TO_INTEGER(table);
obj_desc->region.length = table->length; obj_desc->region.length = table->length;
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
......
...@@ -113,9 +113,9 @@ acpi_tb_acquire_table(struct acpi_table_desc *table_desc, ...@@ -113,9 +113,9 @@ acpi_tb_acquire_table(struct acpi_table_desc *table_desc,
case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
table = table = ACPI_CAST_PTR(struct acpi_table_header,
ACPI_CAST_PTR(struct acpi_table_header, ACPI_PHYSADDR_TO_PTR(table_desc->
table_desc->address); address));
break; break;
default: default:
...@@ -214,7 +214,8 @@ acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc, ...@@ -214,7 +214,8 @@ acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc,
case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
table_header = ACPI_CAST_PTR(struct acpi_table_header, address); table_header = ACPI_CAST_PTR(struct acpi_table_header,
ACPI_PHYSADDR_TO_PTR(address));
if (!table_header) { if (!table_header) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
......
...@@ -188,7 +188,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address, ...@@ -188,7 +188,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address,
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Could not acquire table length at %p", ACPI_ERROR((AE_INFO, "Could not acquire table length at %p",
ACPI_CAST_PTR(void, address))); ACPI_PHYSADDR_TO_PTR(address)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -247,7 +247,7 @@ acpi_tb_install_standard_table(acpi_physical_address address, ...@@ -247,7 +247,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,
status = acpi_tb_acquire_temp_table(&new_table_desc, address, flags); status = acpi_tb_acquire_temp_table(&new_table_desc, address, flags);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Could not acquire table length at %p", ACPI_ERROR((AE_INFO, "Could not acquire table length at %p",
ACPI_CAST_PTR(void, address))); ACPI_PHYSADDR_TO_PTR(address)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -259,8 +259,8 @@ acpi_tb_install_standard_table(acpi_physical_address address, ...@@ -259,8 +259,8 @@ acpi_tb_install_standard_table(acpi_physical_address address,
acpi_gbl_disable_ssdt_table_install && acpi_gbl_disable_ssdt_table_install &&
ACPI_COMPARE_NAME(&new_table_desc.signature, ACPI_SIG_SSDT)) { ACPI_COMPARE_NAME(&new_table_desc.signature, ACPI_SIG_SSDT)) {
ACPI_INFO((AE_INFO, "Ignoring installation of %4.4s at %p", ACPI_INFO((AE_INFO, "Ignoring installation of %4.4s at %p",
new_table_desc.signature.ascii, ACPI_CAST_PTR(void, new_table_desc.signature.ascii,
address))); ACPI_PHYSADDR_TO_PTR(address)));
goto release_and_exit; goto release_and_exit;
} }
...@@ -516,7 +516,7 @@ void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc) ...@@ -516,7 +516,7 @@ void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc)
if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) == if ((table_desc->flags & ACPI_TABLE_ORIGIN_MASK) ==
ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) { ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) {
ACPI_FREE(ACPI_CAST_PTR(void, table_desc->address)); ACPI_FREE(ACPI_PHYSADDR_TO_PTR(table_desc->address));
} }
table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL); table_desc->address = ACPI_PTR_TO_PHYSADDR(NULL);
......
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