Commit 18a1b310 authored by Lv Zheng's avatar Lv Zheng Committed by Ben Hutchings

ACPICA: Utilities: Cleanup to remove useless ACPI_PRINTF/FORMAT_xxx helpers.

commit 1d0a0b2f upstream.

ACPICA commit b60612373a4ef63b64a57c124576d7ddb6d8efb6

For physical addresses, since the address may exceed 32-bit address range
after calculation, we should use 0x%8.8X%8.8X instead of ACPI_PRINTF_UINT
and ACPI_FORMAT_UINT64() instead of
ACPI_FORMAT_NATIVE_UINT()/ACPI_FORMAT_TO_UINT().

This patch also removes above replaced macros as there are no users.

This is a preparation to switch acpi_physical_address to 64-bit on 32-bit
kernel builds.

Link: https://github.com/acpica/acpica/commit/b6061237Signed-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>
Signed-off-by: default avatarDirk Behme <dirk.behme@gmail.com>
[gdavis: Move tbprint.c changes to tbutils.c due to lack of commit
	 "42f47869 ACPICA: Split table print utilities to a new a
	 separate file" in linux-3.10.y]
Signed-off-by: default avatarGeorge G. Davis <george_davis@mentor.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 4eba3fca
...@@ -59,19 +59,15 @@ ...@@ -59,19 +59,15 @@
#define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr)
/* /*
* printf() format helpers * printf() format helper. This macros is a workaround for the difficulties
* with emitting 64-bit integers and 64-bit pointers with the same code
* for both 32-bit and 64-bit hosts.
*/ */
/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ /* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i)
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i)
#else
#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i)
#endif
/* /*
* Macros for moving data around to/from buffers that are possibly unaligned. * Macros for moving data around to/from buffers that are possibly unaligned.
* If the hardware supports the transfer of unaligned data, just do the store. * If the hardware supports the transfer of unaligned data, just do the store.
......
...@@ -446,7 +446,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, ...@@ -446,7 +446,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
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",
obj_desc, obj_desc,
ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), ACPI_FORMAT_UINT64(obj_desc->region.address),
obj_desc->region.length)); obj_desc->region.length));
/* Now the address and length are valid for this opregion */ /* Now the address and length are valid for this opregion */
...@@ -545,7 +545,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, ...@@ -545,7 +545,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
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",
obj_desc, obj_desc,
ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), ACPI_FORMAT_UINT64(obj_desc->region.address),
obj_desc->region.length)); obj_desc->region.length));
/* Now the address and length are valid for this opregion */ /* Now the address and length are valid for this opregion */
......
...@@ -450,8 +450,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ...@@ -450,8 +450,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Handler %p (@%p) Address %8.8X%8.8X [%s]\n", "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
&region_obj->region.handler->address_space, handler, &region_obj->region.handler->address_space, handler,
ACPI_FORMAT_NATIVE_UINT(region_obj->region.address + ACPI_FORMAT_UINT64(region_obj->region.address +
region_offset), region_offset),
acpi_ut_get_region_name(region_obj->region. acpi_ut_get_region_name(region_obj->region.
space_id))); space_id)));
......
...@@ -613,8 +613,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -613,8 +613,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
acpi_os_printf("\n"); acpi_os_printf("\n");
} else { } else {
acpi_os_printf(" base %8.8X%8.8X Length %X\n", acpi_os_printf(" base %8.8X%8.8X Length %X\n",
ACPI_FORMAT_NATIVE_UINT(obj_desc->region. ACPI_FORMAT_UINT64(obj_desc->region.
address), address),
obj_desc->region.length); obj_desc->region.length);
} }
break; break;
......
...@@ -174,7 +174,7 @@ acpi_ex_system_memory_space_handler(u32 function, ...@@ -174,7 +174,7 @@ acpi_ex_system_memory_space_handler(u32 function,
if (!mem_info->mapped_logical_address) { if (!mem_info->mapped_logical_address) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Could not map memory at 0x%8.8X%8.8X, size %u", "Could not map memory at 0x%8.8X%8.8X, size %u",
ACPI_FORMAT_NATIVE_UINT(address), ACPI_FORMAT_UINT64(address),
(u32) map_length)); (u32) map_length));
mem_info->mapped_length = 0; mem_info->mapped_length = 0;
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
...@@ -195,8 +195,7 @@ acpi_ex_system_memory_space_handler(u32 function, ...@@ -195,8 +195,7 @@ acpi_ex_system_memory_space_handler(u32 function,
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
bit_width, function, bit_width, function, ACPI_FORMAT_UINT64(address)));
ACPI_FORMAT_NATIVE_UINT(address)));
/* /*
* Perform the memory read or write * Perform the memory read or write
...@@ -298,8 +297,7 @@ acpi_ex_system_io_space_handler(u32 function, ...@@ -298,8 +297,7 @@ acpi_ex_system_io_space_handler(u32 function,
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
bit_width, function, bit_width, function, ACPI_FORMAT_UINT64(address)));
ACPI_FORMAT_NATIVE_UINT(address)));
/* Decode the function parameter */ /* Decode the function parameter */
......
...@@ -326,8 +326,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -326,8 +326,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
space_id)); space_id));
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
ACPI_FORMAT_NATIVE_UINT ACPI_FORMAT_UINT64(obj_desc->
(obj_desc->region.address), region.
address),
obj_desc->region.length); obj_desc->region.length);
} else { } else {
acpi_os_printf acpi_os_printf
......
...@@ -237,16 +237,12 @@ acpi_tb_print_table_header(acpi_physical_address address, ...@@ -237,16 +237,12 @@ acpi_tb_print_table_header(acpi_physical_address address,
{ {
struct acpi_table_header local_header; struct acpi_table_header local_header;
/*
* The reason that the Address is cast to a void pointer is so that we
* can use %p which will work properly on both 32-bit and 64-bit hosts.
*/
if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
/* FACS only has signature and length fields */ /* FACS only has signature and length fields */
ACPI_INFO((AE_INFO, "%4.4s %p %05X", ACPI_INFO((AE_INFO, "%4.4s 0x%8.8X%8.8X %05X",
header->signature, ACPI_CAST_PTR(void, address), header->signature, ACPI_FORMAT_UINT64(address),
header->length)); header->length));
} else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) { } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
...@@ -257,8 +253,8 @@ acpi_tb_print_table_header(acpi_physical_address address, ...@@ -257,8 +253,8 @@ acpi_tb_print_table_header(acpi_physical_address address,
header)->oem_id, ACPI_OEM_ID_SIZE); header)->oem_id, ACPI_OEM_ID_SIZE);
acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %05X (v%.2d %6.6s)",
ACPI_CAST_PTR (void, address), ACPI_FORMAT_UINT64(address),
(ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
revision > revision >
0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
...@@ -272,8 +268,8 @@ acpi_tb_print_table_header(acpi_physical_address address, ...@@ -272,8 +268,8 @@ acpi_tb_print_table_header(acpi_physical_address address,
acpi_tb_cleanup_table_header(&local_header, header); acpi_tb_cleanup_table_header(&local_header, header);
ACPI_INFO((AE_INFO, ACPI_INFO((AE_INFO,
"%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", "%-4.4s 0x%8.8X%8.8X %05X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
local_header.signature, ACPI_CAST_PTR(void, address), local_header.signature, ACPI_FORMAT_UINT64(address),
local_header.length, local_header.revision, local_header.length, local_header.revision,
local_header.oem_id, local_header.oem_table_id, local_header.oem_id, local_header.oem_table_id,
local_header.oem_revision, local_header.oem_revision,
......
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