diff options
Diffstat (limited to 'drivers/acpi/acpica/tbutils.c')
-rw-r--r-- | drivers/acpi/acpica/tbutils.c | 82 |
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 @@ | |||
49 | ACPI_MODULE_NAME("tbutils") | 49 | ACPI_MODULE_NAME("tbutils") |
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static void acpi_tb_fix_string(char *string, acpi_size length); | ||
53 | |||
54 | static void | ||
55 | acpi_tb_cleanup_table_header(struct acpi_table_header *out_header, | ||
56 | struct acpi_table_header *header); | ||
57 | |||
52 | static acpi_physical_address | 58 | static acpi_physical_address |
53 | acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); | 59 | acpi_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 | |||
182 | static 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 | |||
208 | static void | ||
209 | acpi_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 | |||
176 | acpi_tb_print_table_header(acpi_physical_address address, | 235 | acpi_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 | ||