diff options
Diffstat (limited to 'drivers/acpi/tables/tbget.c')
-rw-r--r-- | drivers/acpi/tables/tbget.c | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 896f3ddda62e..4ab2aadc6133 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
@@ -49,6 +49,19 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbget") | 50 | ACPI_MODULE_NAME ("tbget") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_tb_get_this_table ( | ||
56 | struct acpi_pointer *address, | ||
57 | struct acpi_table_header *header, | ||
58 | struct acpi_table_desc *table_info); | ||
59 | |||
60 | static acpi_status | ||
61 | acpi_tb_table_override ( | ||
62 | struct acpi_table_header *header, | ||
63 | struct acpi_table_desc *table_info); | ||
64 | |||
52 | 65 | ||
53 | /******************************************************************************* | 66 | /******************************************************************************* |
54 | * | 67 | * |
@@ -76,9 +89,8 @@ acpi_tb_get_table ( | |||
76 | ACPI_FUNCTION_TRACE ("tb_get_table"); | 89 | ACPI_FUNCTION_TRACE ("tb_get_table"); |
77 | 90 | ||
78 | 91 | ||
79 | /* | 92 | /* Get the header in order to get signature and table size */ |
80 | * Get the header in order to get signature and table size | 93 | |
81 | */ | ||
82 | status = acpi_tb_get_table_header (address, &header); | 94 | status = acpi_tb_get_table_header (address, &header); |
83 | if (ACPI_FAILURE (status)) { | 95 | if (ACPI_FAILURE (status)) { |
84 | return_ACPI_STATUS (status); | 96 | return_ACPI_STATUS (status); |
@@ -127,8 +139,8 @@ acpi_tb_get_table_header ( | |||
127 | 139 | ||
128 | 140 | ||
129 | /* | 141 | /* |
130 | * Flags contains the current processor mode (Virtual or Physical addressing) | 142 | * Flags contains the current processor mode (Virtual or Physical |
131 | * The pointer_type is either Logical or Physical | 143 | * addressing) The pointer_type is either Logical or Physical |
132 | */ | 144 | */ |
133 | switch (address->pointer_type) { | 145 | switch (address->pointer_type) { |
134 | case ACPI_PHYSMODE_PHYSPTR: | 146 | case ACPI_PHYSMODE_PHYSPTR: |
@@ -136,7 +148,8 @@ acpi_tb_get_table_header ( | |||
136 | 148 | ||
137 | /* Pointer matches processor mode, copy the header */ | 149 | /* Pointer matches processor mode, copy the header */ |
138 | 150 | ||
139 | ACPI_MEMCPY (return_header, address->pointer.logical, sizeof (struct acpi_table_header)); | 151 | ACPI_MEMCPY (return_header, address->pointer.logical, |
152 | sizeof (struct acpi_table_header)); | ||
140 | break; | 153 | break; |
141 | 154 | ||
142 | 155 | ||
@@ -144,10 +157,11 @@ acpi_tb_get_table_header ( | |||
144 | 157 | ||
145 | /* Create a logical address for the physical pointer*/ | 158 | /* Create a logical address for the physical pointer*/ |
146 | 159 | ||
147 | status = acpi_os_map_memory (address->pointer.physical, sizeof (struct acpi_table_header), | 160 | status = acpi_os_map_memory (address->pointer.physical, |
148 | (void *) &header); | 161 | sizeof (struct acpi_table_header), (void *) &header); |
149 | if (ACPI_FAILURE (status)) { | 162 | if (ACPI_FAILURE (status)) { |
150 | ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", | 163 | ACPI_REPORT_ERROR (( |
164 | "Could not map memory at %8.8X%8.8X for length %X\n", | ||
151 | ACPI_FORMAT_UINT64 (address->pointer.physical), | 165 | ACPI_FORMAT_UINT64 (address->pointer.physical), |
152 | sizeof (struct acpi_table_header))); | 166 | sizeof (struct acpi_table_header))); |
153 | return_ACPI_STATUS (status); | 167 | return_ACPI_STATUS (status); |
@@ -210,9 +224,8 @@ acpi_tb_get_table_body ( | |||
210 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 224 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
211 | } | 225 | } |
212 | 226 | ||
213 | /* | 227 | /* Attempt table override. */ |
214 | * Attempt table override. | 228 | |
215 | */ | ||
216 | status = acpi_tb_table_override (header, table_info); | 229 | status = acpi_tb_table_override (header, table_info); |
217 | if (ACPI_SUCCESS (status)) { | 230 | if (ACPI_SUCCESS (status)) { |
218 | /* Table was overridden by the host OS */ | 231 | /* Table was overridden by the host OS */ |
@@ -241,7 +254,7 @@ acpi_tb_get_table_body ( | |||
241 | * | 254 | * |
242 | ******************************************************************************/ | 255 | ******************************************************************************/ |
243 | 256 | ||
244 | acpi_status | 257 | static acpi_status |
245 | acpi_tb_table_override ( | 258 | acpi_tb_table_override ( |
246 | struct acpi_table_header *header, | 259 | struct acpi_table_header *header, |
247 | struct acpi_table_desc *table_info) | 260 | struct acpi_table_desc *table_info) |
@@ -315,7 +328,7 @@ acpi_tb_table_override ( | |||
315 | * | 328 | * |
316 | ******************************************************************************/ | 329 | ******************************************************************************/ |
317 | 330 | ||
318 | acpi_status | 331 | static acpi_status |
319 | acpi_tb_get_this_table ( | 332 | acpi_tb_get_this_table ( |
320 | struct acpi_pointer *address, | 333 | struct acpi_pointer *address, |
321 | struct acpi_table_header *header, | 334 | struct acpi_table_header *header, |
@@ -330,8 +343,8 @@ acpi_tb_get_this_table ( | |||
330 | 343 | ||
331 | 344 | ||
332 | /* | 345 | /* |
333 | * Flags contains the current processor mode (Virtual or Physical addressing) | 346 | * Flags contains the current processor mode (Virtual or Physical |
334 | * The pointer_type is either Logical or Physical | 347 | * addressing) The pointer_type is either Logical or Physical |
335 | */ | 348 | */ |
336 | switch (address->pointer_type) { | 349 | switch (address->pointer_type) { |
337 | case ACPI_PHYSMODE_PHYSPTR: | 350 | case ACPI_PHYSMODE_PHYSPTR: |
@@ -341,7 +354,8 @@ acpi_tb_get_this_table ( | |||
341 | 354 | ||
342 | full_table = ACPI_MEM_ALLOCATE (header->length); | 355 | full_table = ACPI_MEM_ALLOCATE (header->length); |
343 | if (!full_table) { | 356 | if (!full_table) { |
344 | ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n", | 357 | ACPI_REPORT_ERROR (( |
358 | "Could not allocate table memory for [%4.4s] length %X\n", | ||
345 | header->signature, header->length)); | 359 | header->signature, header->length)); |
346 | return_ACPI_STATUS (AE_NO_MEMORY); | 360 | return_ACPI_STATUS (AE_NO_MEMORY); |
347 | } | 361 | } |
@@ -362,12 +376,14 @@ acpi_tb_get_this_table ( | |||
362 | * Just map the table's physical memory | 376 | * Just map the table's physical memory |
363 | * into our address space. | 377 | * into our address space. |
364 | */ | 378 | */ |
365 | status = acpi_os_map_memory (address->pointer.physical, (acpi_size) header->length, | 379 | status = acpi_os_map_memory (address->pointer.physical, |
366 | (void *) &full_table); | 380 | (acpi_size) header->length, (void *) &full_table); |
367 | if (ACPI_FAILURE (status)) { | 381 | if (ACPI_FAILURE (status)) { |
368 | ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", | 382 | ACPI_REPORT_ERROR (( |
383 | "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", | ||
369 | header->signature, | 384 | header->signature, |
370 | ACPI_FORMAT_UINT64 (address->pointer.physical), header->length)); | 385 | ACPI_FORMAT_UINT64 (address->pointer.physical), |
386 | header->length)); | ||
371 | return (status); | 387 | return (status); |
372 | } | 388 | } |
373 | 389 | ||
@@ -465,9 +481,8 @@ acpi_tb_get_table_ptr ( | |||
465 | return_ACPI_STATUS (AE_OK); | 481 | return_ACPI_STATUS (AE_OK); |
466 | } | 482 | } |
467 | 483 | ||
468 | /* | 484 | /* Check for instance out of range */ |
469 | * Check for instance out of range | 485 | |
470 | */ | ||
471 | if (instance > acpi_gbl_table_lists[table_type].count) { | 486 | if (instance > acpi_gbl_table_lists[table_type].count) { |
472 | return_ACPI_STATUS (AE_NOT_EXIST); | 487 | return_ACPI_STATUS (AE_NOT_EXIST); |
473 | } | 488 | } |