diff options
author | Bob Moore <robert.moore@intel.com> | 2014-02-07 20:42:01 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-10 18:30:23 -0500 |
commit | c03775c0827f4d10fcb360c9b8af9a922aedaf4b (patch) | |
tree | 3498aa7535f2a94c5e12bc87150dd66c1d7d6bd4 /drivers/acpi | |
parent | b28a960c42fcd9cfc987441fa6d1c1a471f0f9ed (diff) |
ACPICA: Improve support for 32/64 bit physical addresses in printf().
This change improves the support for physical addresses in printf
debug statements and other output on both 32-bit and 64-bit hosts.
It consistently outputs the appropriate number of bytes for each
host. The %p specifier is unsatisfactory since it does not emit
uniform output on all hosts/clib implementations (on some, leading
zeros are not supported, leading to difficult-to-read output).
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 14 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbprint.c | 20 |
2 files changed, 21 insertions, 13 deletions
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 2a86c65d873b..25467828e864 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -63,17 +63,21 @@ | |||
63 | #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) | 63 | #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) |
64 | 64 | ||
65 | /* | 65 | /* |
66 | * printf() format helpers | 66 | * printf() format helpers. These macros are workarounds for the difficulties |
67 | * with emitting 64-bit integers and 64-bit pointers with the same code | ||
68 | * for both 32-bit and 64-bit hosts. | ||
67 | */ | 69 | */ |
68 | |||
69 | /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ | ||
70 | |||
71 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) | 70 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) |
72 | 71 | ||
73 | #if ACPI_MACHINE_WIDTH == 64 | 72 | #if ACPI_MACHINE_WIDTH == 64 |
74 | #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) | 73 | #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) |
74 | #define ACPI_FORMAT_TO_UINT(i) ACPI_FORMAT_UINT64(i) | ||
75 | #define ACPI_PRINTF_UINT "0x%8.8X%8.8X" | ||
76 | |||
75 | #else | 77 | #else |
76 | #define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) | 78 | #define ACPI_FORMAT_NATIVE_UINT(i) 0, (u32) (i) |
79 | #define ACPI_FORMAT_TO_UINT(i) (u32) (i) | ||
80 | #define ACPI_PRINTF_UINT "0x%8.8X" | ||
77 | #endif | 81 | #endif |
78 | 82 | ||
79 | /* | 83 | /* |
diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c index 6866e767ba90..05ded33b48fd 100644 --- a/drivers/acpi/acpica/tbprint.c +++ b/drivers/acpi/acpica/tbprint.c | |||
@@ -128,15 +128,17 @@ acpi_tb_print_table_header(acpi_physical_address address, | |||
128 | struct acpi_table_header local_header; | 128 | struct acpi_table_header local_header; |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * The reason that the Address is cast to a void pointer is so that we | 131 | * The reason that we use ACPI_PRINTF_UINT and ACPI_FORMAT_TO_UINT is to |
132 | * can use %p which will work properly on both 32-bit and 64-bit hosts. | 132 | * support both 32-bit and 64-bit hosts/addresses in a consistent manner. |
133 | * The %p specifier does not emit uniform output on all hosts. On some, | ||
134 | * leading zeros are not supported. | ||
133 | */ | 135 | */ |
134 | if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { | 136 | if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { |
135 | 137 | ||
136 | /* FACS only has signature and length fields */ | 138 | /* FACS only has signature and length fields */ |
137 | 139 | ||
138 | ACPI_INFO((AE_INFO, "%4.4s %p %06X", | 140 | ACPI_INFO((AE_INFO, "%-4.4s " ACPI_PRINTF_UINT " %06X", |
139 | header->signature, ACPI_CAST_PTR(void, address), | 141 | header->signature, ACPI_FORMAT_TO_UINT(address), |
140 | header->length)); | 142 | header->length)); |
141 | } else if (ACPI_VALIDATE_RSDP_SIG(header->signature)) { | 143 | } else if (ACPI_VALIDATE_RSDP_SIG(header->signature)) { |
142 | 144 | ||
@@ -147,8 +149,9 @@ acpi_tb_print_table_header(acpi_physical_address address, | |||
147 | header)->oem_id, ACPI_OEM_ID_SIZE); | 149 | header)->oem_id, ACPI_OEM_ID_SIZE); |
148 | acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); | 150 | acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); |
149 | 151 | ||
150 | ACPI_INFO((AE_INFO, "RSDP %p %06X (v%.2d %6.6s)", | 152 | ACPI_INFO((AE_INFO, |
151 | ACPI_CAST_PTR(void, address), | 153 | "RSDP " ACPI_PRINTF_UINT " %06X (v%.2d %-6.6s)", |
154 | ACPI_FORMAT_TO_UINT(address), | ||
152 | (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> | 155 | (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> |
153 | revision > | 156 | revision > |
154 | 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, | 157 | 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, |
@@ -162,8 +165,9 @@ acpi_tb_print_table_header(acpi_physical_address address, | |||
162 | acpi_tb_cleanup_table_header(&local_header, header); | 165 | acpi_tb_cleanup_table_header(&local_header, header); |
163 | 166 | ||
164 | ACPI_INFO((AE_INFO, | 167 | ACPI_INFO((AE_INFO, |
165 | "%4.4s %p %06X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", | 168 | "%-4.4s " ACPI_PRINTF_UINT |
166 | local_header.signature, ACPI_CAST_PTR(void, address), | 169 | " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", |
170 | local_header.signature, ACPI_FORMAT_TO_UINT(address), | ||
167 | local_header.length, local_header.revision, | 171 | local_header.length, local_header.revision, |
168 | local_header.oem_id, local_header.oem_table_id, | 172 | local_header.oem_id, local_header.oem_table_id, |
169 | local_header.oem_revision, | 173 | local_header.oem_revision, |