aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/tbutils.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2009-06-23 23:38:46 -0400
committerLen Brown <len.brown@intel.com>2009-08-27 10:17:19 -0400
commitcf02cd47d4747abf8ff0617e15fc05a00202e6d5 (patch)
treee01bdd006845f8db2fda259f594f826e35f13ac4 /drivers/acpi/acpica/tbutils.c
parent8e4319c425077c4cc540696a5bb6c4d12f017dcd (diff)
ACPICA: Dump table header - suppress output of non-printable characters
Function acpi_tb_print_table_header. Some ACPI tables contain non-printable characters in one of the string fields of the the header - Signature, OemId, OemTableId, or CompilerId. Invalid characters are replaced by '?'. ACPICA BZ 788. http://acpica.org/bugzilla/show_bug.cgi?id=788 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/tbutils.c')
-rw-r--r--drivers/acpi/acpica/tbutils.c82
1 files changed, 75 insertions, 7 deletions
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index ef7d2c2d8f0b..1f15497f00d1 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -49,6 +49,12 @@
49ACPI_MODULE_NAME("tbutils") 49ACPI_MODULE_NAME("tbutils")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static void acpi_tb_fix_string(char *string, acpi_size length);
53
54static void
55acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
56 struct acpi_table_header *header);
57
52static acpi_physical_address 58static acpi_physical_address
53acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); 59acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
54 60
@@ -161,6 +167,59 @@ u8 acpi_tb_tables_loaded(void)
161 167
162/******************************************************************************* 168/*******************************************************************************
163 * 169 *
170 * FUNCTION: acpi_tb_fix_string
171 *
172 * PARAMETERS: String - String to be repaired
173 * Length - Maximum length
174 *
175 * RETURN: None
176 *
177 * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
178 * with a question mark '?'.
179 *
180 ******************************************************************************/
181
182static void acpi_tb_fix_string(char *string, acpi_size length)
183{
184
185 while (length && *string) {
186 if (!ACPI_IS_PRINT(*string)) {
187 *string = '?';
188 }
189 string++;
190 length--;
191 }
192}
193
194/*******************************************************************************
195 *
196 * FUNCTION: acpi_tb_cleanup_table_header
197 *
198 * PARAMETERS: out_header - Where the cleaned header is returned
199 * Header - Input ACPI table header
200 *
201 * RETURN: Returns the cleaned header in out_header
202 *
203 * DESCRIPTION: Copy the table header and ensure that all "string" fields in
204 * the header consist of printable characters.
205 *
206 ******************************************************************************/
207
208static void
209acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
210 struct acpi_table_header *header)
211{
212
213 ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
214
215 acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
216 acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
217 acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
218 acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
219}
220
221/*******************************************************************************
222 *
164 * FUNCTION: acpi_tb_print_table_header 223 * FUNCTION: acpi_tb_print_table_header
165 * 224 *
166 * PARAMETERS: Address - Table physical address 225 * PARAMETERS: Address - Table physical address
@@ -176,6 +235,7 @@ void
176acpi_tb_print_table_header(acpi_physical_address address, 235acpi_tb_print_table_header(acpi_physical_address address,
177 struct acpi_table_header *header) 236 struct acpi_table_header *header)
178{ 237{
238 struct acpi_table_header local_header;
179 239
180 /* 240 /*
181 * The reason that the Address is cast to a void pointer is so that we 241 * The reason that the Address is cast to a void pointer is so that we
@@ -192,6 +252,11 @@ acpi_tb_print_table_header(acpi_physical_address address,
192 252
193 /* RSDP has no common fields */ 253 /* RSDP has no common fields */
194 254
255 ACPI_MEMCPY(local_header.oem_id,
256 ACPI_CAST_PTR(struct acpi_table_rsdp,
257 header)->oem_id, ACPI_OEM_ID_SIZE);
258 acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
259
195 ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", 260 ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
196 ACPI_CAST_PTR (void, address), 261 ACPI_CAST_PTR (void, address),
197 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> 262 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
@@ -200,18 +265,21 @@ acpi_tb_print_table_header(acpi_physical_address address,
200 header)->length : 20, 265 header)->length : 20,
201 ACPI_CAST_PTR(struct acpi_table_rsdp, 266 ACPI_CAST_PTR(struct acpi_table_rsdp,
202 header)->revision, 267 header)->revision,
203 ACPI_CAST_PTR(struct acpi_table_rsdp, 268 local_header.oem_id));
204 header)->oem_id));
205 } else { 269 } else {
206 /* Standard ACPI table with full common header */ 270 /* Standard ACPI table with full common header */
207 271
272 acpi_tb_cleanup_table_header(&local_header, header);
273
208 ACPI_INFO((AE_INFO, 274 ACPI_INFO((AE_INFO,
209 "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", 275 "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
210 header->signature, ACPI_CAST_PTR (void, address), 276 local_header.signature, ACPI_CAST_PTR(void, address),
211 header->length, header->revision, header->oem_id, 277 local_header.length, local_header.revision,
212 header->oem_table_id, header->oem_revision, 278 local_header.oem_id, local_header.oem_table_id,
213 header->asl_compiler_id, 279 local_header.oem_revision,
214 header->asl_compiler_revision)); 280 local_header.asl_compiler_id,
281 local_header.asl_compiler_revision));
282
215 } 283 }
216} 284}
217 285