aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbget.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/tables/tbget.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables/tbget.c')
-rw-r--r--drivers/acpi/tables/tbget.c275
1 files changed, 119 insertions, 156 deletions
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c
index 4ab2aadc6133..6acd5aeb093e 100644
--- a/drivers/acpi/tables/tbget.c
+++ b/drivers/acpi/tables/tbget.c
@@ -41,27 +41,21 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/actables.h> 45#include <acpi/actables.h>
47 46
48
49#define _COMPONENT ACPI_TABLES 47#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbget") 48ACPI_MODULE_NAME("tbget")
51 49
52/* Local prototypes */ 50/* Local prototypes */
53
54static acpi_status 51static acpi_status
55acpi_tb_get_this_table ( 52acpi_tb_get_this_table(struct acpi_pointer *address,
56 struct acpi_pointer *address, 53 struct acpi_table_header *header,
57 struct acpi_table_header *header, 54 struct acpi_table_desc *table_info);
58 struct acpi_table_desc *table_info);
59 55
60static acpi_status 56static acpi_status
61acpi_tb_table_override ( 57acpi_tb_table_override(struct acpi_table_header *header,
62 struct acpi_table_header *header, 58 struct acpi_table_desc *table_info);
63 struct acpi_table_desc *table_info);
64
65 59
66/******************************************************************************* 60/*******************************************************************************
67 * 61 *
@@ -78,37 +72,34 @@ acpi_tb_table_override (
78 ******************************************************************************/ 72 ******************************************************************************/
79 73
80acpi_status 74acpi_status
81acpi_tb_get_table ( 75acpi_tb_get_table(struct acpi_pointer *address,
82 struct acpi_pointer *address, 76 struct acpi_table_desc *table_info)
83 struct acpi_table_desc *table_info)
84{ 77{
85 acpi_status status; 78 acpi_status status;
86 struct acpi_table_header header; 79 struct acpi_table_header header;
87
88
89 ACPI_FUNCTION_TRACE ("tb_get_table");
90 80
81 ACPI_FUNCTION_TRACE("tb_get_table");
91 82
92 /* Get the header in order to get signature and table size */ 83 /* Get the header in order to get signature and table size */
93 84
94 status = acpi_tb_get_table_header (address, &header); 85 status = acpi_tb_get_table_header(address, &header);
95 if (ACPI_FAILURE (status)) { 86 if (ACPI_FAILURE(status)) {
96 return_ACPI_STATUS (status); 87 return_ACPI_STATUS(status);
97 } 88 }
98 89
99 /* Get the entire table */ 90 /* Get the entire table */
100 91
101 status = acpi_tb_get_table_body (address, &header, table_info); 92 status = acpi_tb_get_table_body(address, &header, table_info);
102 if (ACPI_FAILURE (status)) { 93 if (ACPI_FAILURE(status)) {
103 ACPI_REPORT_ERROR (("Could not get ACPI table (size %X), %s\n", 94 ACPI_REPORT_ERROR(("Could not get ACPI table (size %X), %s\n",
104 header.length, acpi_format_exception (status))); 95 header.length,
105 return_ACPI_STATUS (status); 96 acpi_format_exception(status)));
97 return_ACPI_STATUS(status);
106 } 98 }
107 99
108 return_ACPI_STATUS (AE_OK); 100 return_ACPI_STATUS(AE_OK);
109} 101}
110 102
111
112/******************************************************************************* 103/*******************************************************************************
113 * 104 *
114 * FUNCTION: acpi_tb_get_table_header 105 * FUNCTION: acpi_tb_get_table_header
@@ -127,16 +118,13 @@ acpi_tb_get_table (
127 ******************************************************************************/ 118 ******************************************************************************/
128 119
129acpi_status 120acpi_status
130acpi_tb_get_table_header ( 121acpi_tb_get_table_header(struct acpi_pointer *address,
131 struct acpi_pointer *address, 122 struct acpi_table_header *return_header)
132 struct acpi_table_header *return_header)
133{ 123{
134 acpi_status status = AE_OK; 124 acpi_status status = AE_OK;
135 struct acpi_table_header *header = NULL; 125 struct acpi_table_header *header = NULL;
136
137
138 ACPI_FUNCTION_TRACE ("tb_get_table_header");
139 126
127 ACPI_FUNCTION_TRACE("tb_get_table_header");
140 128
141 /* 129 /*
142 * Flags contains the current processor mode (Virtual or Physical 130 * Flags contains the current processor mode (Virtual or Physical
@@ -148,46 +136,42 @@ acpi_tb_get_table_header (
148 136
149 /* Pointer matches processor mode, copy the header */ 137 /* Pointer matches processor mode, copy the header */
150 138
151 ACPI_MEMCPY (return_header, address->pointer.logical, 139 ACPI_MEMCPY(return_header, address->pointer.logical,
152 sizeof (struct acpi_table_header)); 140 sizeof(struct acpi_table_header));
153 break; 141 break;
154 142
155
156 case ACPI_LOGMODE_PHYSPTR: 143 case ACPI_LOGMODE_PHYSPTR:
157 144
158 /* Create a logical address for the physical pointer*/ 145 /* Create a logical address for the physical pointer */
159 146
160 status = acpi_os_map_memory (address->pointer.physical, 147 status = acpi_os_map_memory(address->pointer.physical,
161 sizeof (struct acpi_table_header), (void *) &header); 148 sizeof(struct acpi_table_header),
162 if (ACPI_FAILURE (status)) { 149 (void *)&header);
163 ACPI_REPORT_ERROR (( 150 if (ACPI_FAILURE(status)) {
164 "Could not map memory at %8.8X%8.8X for length %X\n", 151 ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X for length %X\n", ACPI_FORMAT_UINT64(address->pointer.physical), sizeof(struct acpi_table_header)));
165 ACPI_FORMAT_UINT64 (address->pointer.physical), 152 return_ACPI_STATUS(status);
166 sizeof (struct acpi_table_header)));
167 return_ACPI_STATUS (status);
168 } 153 }
169 154
170 /* Copy header and delete mapping */ 155 /* Copy header and delete mapping */
171 156
172 ACPI_MEMCPY (return_header, header, sizeof (struct acpi_table_header)); 157 ACPI_MEMCPY(return_header, header,
173 acpi_os_unmap_memory (header, sizeof (struct acpi_table_header)); 158 sizeof(struct acpi_table_header));
159 acpi_os_unmap_memory(header, sizeof(struct acpi_table_header));
174 break; 160 break;
175 161
176
177 default: 162 default:
178 163
179 ACPI_REPORT_ERROR (("Invalid address flags %X\n", 164 ACPI_REPORT_ERROR(("Invalid address flags %X\n",
180 address->pointer_type)); 165 address->pointer_type));
181 return_ACPI_STATUS (AE_BAD_PARAMETER); 166 return_ACPI_STATUS(AE_BAD_PARAMETER);
182 } 167 }
183 168
184 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n", 169 ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n",
185 return_header->signature)); 170 return_header->signature));
186 171
187 return_ACPI_STATUS (AE_OK); 172 return_ACPI_STATUS(AE_OK);
188} 173}
189 174
190
191/******************************************************************************* 175/*******************************************************************************
192 * 176 *
193 * FUNCTION: acpi_tb_get_table_body 177 * FUNCTION: acpi_tb_get_table_body
@@ -209,37 +193,33 @@ acpi_tb_get_table_header (
209 ******************************************************************************/ 193 ******************************************************************************/
210 194
211acpi_status 195acpi_status
212acpi_tb_get_table_body ( 196acpi_tb_get_table_body(struct acpi_pointer *address,
213 struct acpi_pointer *address, 197 struct acpi_table_header *header,
214 struct acpi_table_header *header, 198 struct acpi_table_desc *table_info)
215 struct acpi_table_desc *table_info)
216{ 199{
217 acpi_status status; 200 acpi_status status;
218
219
220 ACPI_FUNCTION_TRACE ("tb_get_table_body");
221 201
202 ACPI_FUNCTION_TRACE("tb_get_table_body");
222 203
223 if (!table_info || !address) { 204 if (!table_info || !address) {
224 return_ACPI_STATUS (AE_BAD_PARAMETER); 205 return_ACPI_STATUS(AE_BAD_PARAMETER);
225 } 206 }
226 207
227 /* Attempt table override. */ 208 /* Attempt table override. */
228 209
229 status = acpi_tb_table_override (header, table_info); 210 status = acpi_tb_table_override(header, table_info);
230 if (ACPI_SUCCESS (status)) { 211 if (ACPI_SUCCESS(status)) {
231 /* Table was overridden by the host OS */ 212 /* Table was overridden by the host OS */
232 213
233 return_ACPI_STATUS (status); 214 return_ACPI_STATUS(status);
234 } 215 }
235 216
236 /* No override, get the original table */ 217 /* No override, get the original table */
237 218
238 status = acpi_tb_get_this_table (address, header, table_info); 219 status = acpi_tb_get_this_table(address, header, table_info);
239 return_ACPI_STATUS (status); 220 return_ACPI_STATUS(status);
240} 221}
241 222
242
243/******************************************************************************* 223/*******************************************************************************
244 * 224 *
245 * FUNCTION: acpi_tb_table_override 225 * FUNCTION: acpi_tb_table_override
@@ -255,61 +235,57 @@ acpi_tb_get_table_body (
255 ******************************************************************************/ 235 ******************************************************************************/
256 236
257static acpi_status 237static acpi_status
258acpi_tb_table_override ( 238acpi_tb_table_override(struct acpi_table_header *header,
259 struct acpi_table_header *header, 239 struct acpi_table_desc *table_info)
260 struct acpi_table_desc *table_info)
261{ 240{
262 struct acpi_table_header *new_table; 241 struct acpi_table_header *new_table;
263 acpi_status status; 242 acpi_status status;
264 struct acpi_pointer address; 243 struct acpi_pointer address;
265
266
267 ACPI_FUNCTION_TRACE ("tb_table_override");
268 244
245 ACPI_FUNCTION_TRACE("tb_table_override");
269 246
270 /* 247 /*
271 * The OSL will examine the header and decide whether to override this 248 * The OSL will examine the header and decide whether to override this
272 * table. If it decides to override, a table will be returned in new_table, 249 * table. If it decides to override, a table will be returned in new_table,
273 * which we will then copy. 250 * which we will then copy.
274 */ 251 */
275 status = acpi_os_table_override (header, &new_table); 252 status = acpi_os_table_override(header, &new_table);
276 if (ACPI_FAILURE (status)) { 253 if (ACPI_FAILURE(status)) {
277 /* Some severe error from the OSL, but we basically ignore it */ 254 /* Some severe error from the OSL, but we basically ignore it */
278 255
279 ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n", 256 ACPI_REPORT_ERROR(("Could not override ACPI table, %s\n",
280 acpi_format_exception (status))); 257 acpi_format_exception(status)));
281 return_ACPI_STATUS (status); 258 return_ACPI_STATUS(status);
282 } 259 }
283 260
284 if (!new_table) { 261 if (!new_table) {
285 /* No table override */ 262 /* No table override */
286 263
287 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 264 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
288 } 265 }
289 266
290 /* 267 /*
291 * We have a new table to override the old one. Get a copy of 268 * We have a new table to override the old one. Get a copy of
292 * the new one. We know that the new table has a logical pointer. 269 * the new one. We know that the new table has a logical pointer.
293 */ 270 */
294 address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; 271 address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
295 address.pointer.logical = new_table; 272 address.pointer.logical = new_table;
296 273
297 status = acpi_tb_get_this_table (&address, new_table, table_info); 274 status = acpi_tb_get_this_table(&address, new_table, table_info);
298 if (ACPI_FAILURE (status)) { 275 if (ACPI_FAILURE(status)) {
299 ACPI_REPORT_ERROR (("Could not copy override ACPI table, %s\n", 276 ACPI_REPORT_ERROR(("Could not copy override ACPI table, %s\n",
300 acpi_format_exception (status))); 277 acpi_format_exception(status)));
301 return_ACPI_STATUS (status); 278 return_ACPI_STATUS(status);
302 } 279 }
303 280
304 /* Copy the table info */ 281 /* Copy the table info */
305 282
306 ACPI_REPORT_INFO (("Table [%4.4s] replaced by host OS\n", 283 ACPI_REPORT_INFO(("Table [%4.4s] replaced by host OS\n",
307 table_info->pointer->signature)); 284 table_info->pointer->signature));
308 285
309 return_ACPI_STATUS (AE_OK); 286 return_ACPI_STATUS(AE_OK);
310} 287}
311 288
312
313/******************************************************************************* 289/*******************************************************************************
314 * 290 *
315 * FUNCTION: acpi_tb_get_this_table 291 * FUNCTION: acpi_tb_get_this_table
@@ -329,18 +305,15 @@ acpi_tb_table_override (
329 ******************************************************************************/ 305 ******************************************************************************/
330 306
331static acpi_status 307static acpi_status
332acpi_tb_get_this_table ( 308acpi_tb_get_this_table(struct acpi_pointer *address,
333 struct acpi_pointer *address, 309 struct acpi_table_header *header,
334 struct acpi_table_header *header, 310 struct acpi_table_desc *table_info)
335 struct acpi_table_desc *table_info)
336{ 311{
337 struct acpi_table_header *full_table = NULL; 312 struct acpi_table_header *full_table = NULL;
338 u8 allocation; 313 u8 allocation;
339 acpi_status status = AE_OK; 314 acpi_status status = AE_OK;
340
341
342 ACPI_FUNCTION_TRACE ("tb_get_this_table");
343 315
316 ACPI_FUNCTION_TRACE("tb_get_this_table");
344 317
345 /* 318 /*
346 * Flags contains the current processor mode (Virtual or Physical 319 * Flags contains the current processor mode (Virtual or Physical
@@ -352,38 +325,33 @@ acpi_tb_get_this_table (
352 325
353 /* Pointer matches processor mode, copy the table to a new buffer */ 326 /* Pointer matches processor mode, copy the table to a new buffer */
354 327
355 full_table = ACPI_MEM_ALLOCATE (header->length); 328 full_table = ACPI_MEM_ALLOCATE(header->length);
356 if (!full_table) { 329 if (!full_table) {
357 ACPI_REPORT_ERROR (( 330 ACPI_REPORT_ERROR(("Could not allocate table memory for [%4.4s] length %X\n", header->signature, header->length));
358 "Could not allocate table memory for [%4.4s] length %X\n", 331 return_ACPI_STATUS(AE_NO_MEMORY);
359 header->signature, header->length));
360 return_ACPI_STATUS (AE_NO_MEMORY);
361 } 332 }
362 333
363 /* Copy the entire table (including header) to the local buffer */ 334 /* Copy the entire table (including header) to the local buffer */
364 335
365 ACPI_MEMCPY (full_table, address->pointer.logical, header->length); 336 ACPI_MEMCPY(full_table, address->pointer.logical,
337 header->length);
366 338
367 /* Save allocation type */ 339 /* Save allocation type */
368 340
369 allocation = ACPI_MEM_ALLOCATED; 341 allocation = ACPI_MEM_ALLOCATED;
370 break; 342 break;
371 343
372
373 case ACPI_LOGMODE_PHYSPTR: 344 case ACPI_LOGMODE_PHYSPTR:
374 345
375 /* 346 /*
376 * Just map the table's physical memory 347 * Just map the table's physical memory
377 * into our address space. 348 * into our address space.
378 */ 349 */
379 status = acpi_os_map_memory (address->pointer.physical, 350 status = acpi_os_map_memory(address->pointer.physical,
380 (acpi_size) header->length, (void *) &full_table); 351 (acpi_size) header->length,
381 if (ACPI_FAILURE (status)) { 352 (void *)&full_table);
382 ACPI_REPORT_ERROR (( 353 if (ACPI_FAILURE(status)) {
383 "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", 354 ACPI_REPORT_ERROR(("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", header->signature, ACPI_FORMAT_UINT64(address->pointer.physical), header->length));
384 header->signature,
385 ACPI_FORMAT_UINT64 (address->pointer.physical),
386 header->length));
387 return (status); 355 return (status);
388 } 356 }
389 357
@@ -392,12 +360,11 @@ acpi_tb_get_this_table (
392 allocation = ACPI_MEM_MAPPED; 360 allocation = ACPI_MEM_MAPPED;
393 break; 361 break;
394 362
395
396 default: 363 default:
397 364
398 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid address flags %X\n", 365 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid address flags %X\n",
399 address->pointer_type)); 366 address->pointer_type));
400 return_ACPI_STATUS (AE_BAD_PARAMETER); 367 return_ACPI_STATUS(AE_BAD_PARAMETER);
401 } 368 }
402 369
403 /* 370 /*
@@ -405,10 +372,10 @@ acpi_tb_get_this_table (
405 * even the ones whose signature we don't recognize 372 * even the ones whose signature we don't recognize
406 */ 373 */
407 if (table_info->type != ACPI_TABLE_FACS) { 374 if (table_info->type != ACPI_TABLE_FACS) {
408 status = acpi_tb_verify_table_checksum (full_table); 375 status = acpi_tb_verify_table_checksum(full_table);
409 376
410#if (!ACPI_CHECKSUM_ABORT) 377#if (!ACPI_CHECKSUM_ABORT)
411 if (ACPI_FAILURE (status)) { 378 if (ACPI_FAILURE(status)) {
412 /* Ignore the error if configuration says so */ 379 /* Ignore the error if configuration says so */
413 380
414 status = AE_OK; 381 status = AE_OK;
@@ -418,19 +385,19 @@ acpi_tb_get_this_table (
418 385
419 /* Return values */ 386 /* Return values */
420 387
421 table_info->pointer = full_table; 388 table_info->pointer = full_table;
422 table_info->length = (acpi_size) header->length; 389 table_info->length = (acpi_size) header->length;
423 table_info->allocation = allocation; 390 table_info->allocation = allocation;
424 391
425 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 392 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
426 "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n", 393 "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
427 full_table->signature, 394 full_table->signature,
428 ACPI_FORMAT_UINT64 (address->pointer.physical), full_table)); 395 ACPI_FORMAT_UINT64(address->pointer.physical),
396 full_table));
429 397
430 return_ACPI_STATUS (status); 398 return_ACPI_STATUS(status);
431} 399}
432 400
433
434/******************************************************************************* 401/*******************************************************************************
435 * 402 *
436 * FUNCTION: acpi_tb_get_table_ptr 403 * FUNCTION: acpi_tb_get_table_ptr
@@ -447,24 +414,20 @@ acpi_tb_get_this_table (
447 ******************************************************************************/ 414 ******************************************************************************/
448 415
449acpi_status 416acpi_status
450acpi_tb_get_table_ptr ( 417acpi_tb_get_table_ptr(acpi_table_type table_type,
451 acpi_table_type table_type, 418 u32 instance, struct acpi_table_header **table_ptr_loc)
452 u32 instance,
453 struct acpi_table_header **table_ptr_loc)
454{ 419{
455 struct acpi_table_desc *table_desc; 420 struct acpi_table_desc *table_desc;
456 u32 i; 421 u32 i;
457
458
459 ACPI_FUNCTION_TRACE ("tb_get_table_ptr");
460 422
423 ACPI_FUNCTION_TRACE("tb_get_table_ptr");
461 424
462 if (!acpi_gbl_DSDT) { 425 if (!acpi_gbl_DSDT) {
463 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 426 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
464 } 427 }
465 428
466 if (table_type > ACPI_TABLE_MAX) { 429 if (table_type > ACPI_TABLE_MAX) {
467 return_ACPI_STATUS (AE_BAD_PARAMETER); 430 return_ACPI_STATUS(AE_BAD_PARAMETER);
468 } 431 }
469 432
470 /* 433 /*
@@ -476,15 +439,16 @@ acpi_tb_get_table_ptr (
476 439
477 *table_ptr_loc = NULL; 440 *table_ptr_loc = NULL;
478 if (acpi_gbl_table_lists[table_type].next) { 441 if (acpi_gbl_table_lists[table_type].next) {
479 *table_ptr_loc = acpi_gbl_table_lists[table_type].next->pointer; 442 *table_ptr_loc =
443 acpi_gbl_table_lists[table_type].next->pointer;
480 } 444 }
481 return_ACPI_STATUS (AE_OK); 445 return_ACPI_STATUS(AE_OK);
482 } 446 }
483 447
484 /* Check for instance out of range */ 448 /* Check for instance out of range */
485 449
486 if (instance > acpi_gbl_table_lists[table_type].count) { 450 if (instance > acpi_gbl_table_lists[table_type].count) {
487 return_ACPI_STATUS (AE_NOT_EXIST); 451 return_ACPI_STATUS(AE_NOT_EXIST);
488 } 452 }
489 453
490 /* Walk the list to get the desired table 454 /* Walk the list to get the desired table
@@ -503,6 +467,5 @@ acpi_tb_get_table_ptr (
503 467
504 *table_ptr_loc = table_desc->pointer; 468 *table_ptr_loc = table_desc->pointer;
505 469
506 return_ACPI_STATUS (AE_OK); 470 return_ACPI_STATUS(AE_OK);
507} 471}
508