Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: ACPICA 20060707

Added the ACPI_PACKED_POINTERS_NOT_SUPPORTED macro to
support C compilers that do not allow the initialization
of address pointers within packed structures - even though
the hardware itself may support misaligned transfers. Some
of the debug data structures are packed by default to
minimize size.

Added an error message for the case where
acpi_os_get_thread_id() returns zero. A non-zero value is
required by the core ACPICA code to ensure the proper
operation of AML mutexes and recursive control methods.

The DSDT is now the only ACPI table that determines whether
the AML interpreter is in 32-bit or 64-bit mode. Not really
a functional change, but the hooks for per-table 32/64
switching have been removed from the code. A clarification
to the ACPI specification is forthcoming in ACPI 3.0B.

Fixed a possible leak of an Owner ID in the error
path of tbinstal.c acpi_tb_init_table_descriptor() and
migrated all table OwnerID deletion to a single place in
acpi_tb_uninstall_table() to correct possible leaks when using
the acpi_tb_delete_tables_by_type() interface (with assistance
from Lance Ortiz.)

Fixed a problem with Serialized control methods where the
semaphore associated with the method could be over-signaled
after multiple method invocations.

Fixed two issues with the locking of the internal
namespace data structure. Both the Unload() operator and
acpi_unload_table() interface now lock the namespace during
the namespace deletion associated with the table unload
(with assistance from Linn Crosetto.)

Fixed problem reports (Valery Podrezov) integrated: -
Eliminate unnecessary memory allocation for CreateXxxxField
http://bugzilla.kernel.org/show_bug.cgi?id=5426

Fixed problem reports (Fiodor Suietov) integrated: -
Incomplete cleanup branches in AcpiTbGetTableRsdt (BZ 369)
- On Address Space handler deletion, needless deactivation
call (BZ 374) - AcpiRemoveAddressSpaceHandler: validate
Device handle parameter (BZ 375) - Possible memory leak,
Notify sub-objects of Processor, Power, ThermalZone (BZ
376) - AcpiRemoveAddressSpaceHandler: validate Handler
parameter (BZ 378) - Minimum Length of RSDT should be
validated (BZ 379) - AcpiRemoveNotifyHandler: return
AE_NOT_EXIST if Processor Obj has no Handler (BZ (380)
- AcpiUnloadTable: return AE_NOT_EXIST if no table of
specified type loaded (BZ 381)

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Bob Moore and committed by
Len Brown
f6dd9221 120bda20

+209 -113
-10
drivers/acpi/dispatcher/dsinit.c
··· 116 116 117 117 case ACPI_TYPE_METHOD: 118 118 119 - /* 120 - * Set the execution data width (32 or 64) based upon the 121 - * revision number of the parent ACPI table. 122 - * TBD: This is really for possible future support of integer width 123 - * on a per-table basis. Currently, we just use a global for the width. 124 - */ 125 - if (info->table_desc->pointer->revision == 1) { 126 - node->flags |= ANOBJ_DATA_WIDTH_32; 127 - } 128 - 129 119 info->method_count++; 130 120 break; 131 121
+4 -19
drivers/acpi/dispatcher/dsmethod.c
··· 134 134 union acpi_operand_object *mutex_desc; 135 135 acpi_status status; 136 136 137 - ACPI_FUNCTION_NAME(ds_create_method_mutex); 137 + ACPI_FUNCTION_TRACE(ds_create_method_mutex); 138 138 139 139 /* Create the new mutex object */ 140 140 ··· 493 493 494 494 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 495 495 "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", 496 - (char *)&walk_state->method_node->name, 496 + acpi_ut_get_node_name(walk_state->method_node), 497 497 walk_state->method_call_op, return_desc)); 498 498 499 499 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ··· 610 610 611 611 acpi_os_release_mutex(method_desc->method.mutex->mutex. 612 612 os_mutex); 613 + method_desc->method.mutex->mutex.owner_thread = NULL; 613 614 } 614 615 } 615 616 ··· 621 620 */ 622 621 method_node = walk_state->method_node; 623 622 624 - /* Lock namespace for possible update */ 625 - 626 - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 627 - if (ACPI_FAILURE(status)) { 628 - return_VOID; 629 - } 630 - 631 623 /* 632 - * Delete any namespace entries created immediately underneath 633 - * the method 634 - */ 635 - if (method_node && method_node->child) { 636 - acpi_ns_delete_namespace_subtree(method_node); 637 - } 638 - 639 - /* 640 - * Delete any namespace entries created anywhere else within 624 + * Delete any namespace objects created anywhere within 641 625 * the namespace by the execution of this method 642 626 */ 643 627 acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); 644 - status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 645 628 } 646 629 647 630 /* Decrement the thread count on the method */
+2 -2
drivers/acpi/dispatcher/dswexec.c
··· 313 313 case AML_CLASS_EXECUTE: 314 314 case AML_CLASS_CREATE: 315 315 /* 316 - * Most operators with arguments. 316 + * Most operators with arguments (except create_xxx_field operators) 317 317 * Start a new result/operand state 318 318 */ 319 - if (walk_state->opcode != AML_CREATE_FIELD_OP) { 319 + if (walk_state->op_info->object_type != ACPI_TYPE_BUFFER_FIELD) { 320 320 status = acpi_ds_result_stack_push(walk_state); 321 321 } 322 322 break;
+25 -19
drivers/acpi/events/evregion.c
··· 528 528 } 529 529 } 530 530 531 - /* Call the setup handler with the deactivate notification */ 531 + /* 532 + * If the region has been activated, call the setup handler 533 + * with the deactivate notification 534 + */ 535 + if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { 536 + region_setup = handler_obj->address_space.setup; 537 + status = 538 + region_setup(region_obj, 539 + ACPI_REGION_DEACTIVATE, 540 + handler_obj->address_space. 541 + context, region_context); 532 542 533 - region_setup = handler_obj->address_space.setup; 534 - status = 535 - region_setup(region_obj, ACPI_REGION_DEACTIVATE, 536 - handler_obj->address_space.context, 537 - region_context); 543 + /* Init routine may fail, Just ignore errors */ 538 544 539 - /* Init routine may fail, Just ignore errors */ 545 + if (ACPI_FAILURE(status)) { 546 + ACPI_EXCEPTION((AE_INFO, status, 547 + "from region handler - deactivate, [%s]", 548 + acpi_ut_get_region_name 549 + (region_obj->region. 550 + space_id))); 551 + } 540 552 541 - if (ACPI_FAILURE(status)) { 542 - ACPI_EXCEPTION((AE_INFO, status, 543 - "from region init, [%s]", 544 - acpi_ut_get_region_name 545 - (region_obj->region.space_id))); 553 + region_obj->region.flags &= 554 + ~(AOPOBJ_SETUP_COMPLETE); 546 555 } 547 - 548 - region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); 549 556 550 557 /* 551 558 * Remove handler reference in the region 552 559 * 553 - * NOTE: this doesn't mean that the region goes away 554 - * The region is just inaccessible as indicated to 555 - * the _REG method 560 + * NOTE: this doesn't mean that the region goes away, the region 561 + * is just inaccessible as indicated to the _REG method 556 562 * 557 - * If the region is on the handler's list 558 - * this better be the region's handler 563 + * If the region is on the handler's list, this must be the 564 + * region's handler 559 565 */ 560 566 region_obj->region.handler = NULL; 561 567 acpi_ut_remove_reference(handler_obj);
+26 -18
drivers/acpi/events/evxface.c
··· 428 428 node = acpi_ns_map_handle_to_node(device); 429 429 if (!node) { 430 430 status = AE_BAD_PARAMETER; 431 - goto unlock; 431 + goto unlock_and_exit; 432 432 } 433 433 434 434 /* Root Object */ ··· 442 442 ((handler_type & ACPI_DEVICE_NOTIFY) && 443 443 !acpi_gbl_device_notify.handler)) { 444 444 status = AE_NOT_EXIST; 445 - goto unlock; 445 + goto unlock_and_exit; 446 446 } 447 447 448 448 /* Make sure all deferred tasks are completed */ ··· 474 474 475 475 if (!acpi_ev_is_notify_object(node)) { 476 476 status = AE_TYPE; 477 - goto unlock; 477 + goto unlock_and_exit; 478 478 } 479 479 480 480 /* Check for an existing internal object */ ··· 482 482 obj_desc = acpi_ns_get_attached_object(node); 483 483 if (!obj_desc) { 484 484 status = AE_NOT_EXIST; 485 - goto unlock; 485 + goto unlock_and_exit; 486 486 } 487 487 488 488 /* Object exists - make sure there's an existing handler */ 489 489 490 490 if (handler_type & ACPI_SYSTEM_NOTIFY) { 491 491 notify_obj = obj_desc->common_notify.system_notify; 492 - if ((!notify_obj) || 493 - (notify_obj->notify.handler != handler)) { 492 + if (!notify_obj) { 493 + status = AE_NOT_EXIST; 494 + goto unlock_and_exit; 495 + } 496 + 497 + if (notify_obj->notify.handler != handler) { 494 498 status = AE_BAD_PARAMETER; 495 - goto unlock; 499 + goto unlock_and_exit; 496 500 } 497 501 /* Make sure all deferred tasks are completed */ 498 502 ··· 514 510 515 511 if (handler_type & ACPI_DEVICE_NOTIFY) { 516 512 notify_obj = obj_desc->common_notify.device_notify; 517 - if ((!notify_obj) || 518 - (notify_obj->notify.handler != handler)) { 513 + if (!notify_obj) { 514 + status = AE_NOT_EXIST; 515 + goto unlock_and_exit; 516 + } 517 + 518 + if (notify_obj->notify.handler != handler) { 519 519 status = AE_BAD_PARAMETER; 520 - goto unlock; 520 + goto unlock_and_exit; 521 521 } 522 522 /* Make sure all deferred tasks are completed */ 523 523 ··· 538 530 } 539 531 } 540 532 541 - unlock: 533 + unlock_and_exit: 542 534 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 543 - exit: 535 + exit: 544 536 if (ACPI_FAILURE(status)) 545 537 ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); 546 538 return_ACPI_STATUS(status); ··· 594 586 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 595 587 if (!gpe_event_info) { 596 588 status = AE_BAD_PARAMETER; 597 - goto unlock; 589 + goto unlock_and_exit; 598 590 } 599 591 600 592 /* Make sure that there isn't a handler there already */ ··· 602 594 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 603 595 ACPI_GPE_DISPATCH_HANDLER) { 604 596 status = AE_ALREADY_EXISTS; 605 - goto unlock; 597 + goto unlock_and_exit; 606 598 } 607 599 608 600 /* Allocate and init handler object */ ··· 610 602 handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); 611 603 if (!handler) { 612 604 status = AE_NO_MEMORY; 613 - goto unlock; 605 + goto unlock_and_exit; 614 606 } 615 607 616 608 handler->address = address; ··· 621 613 622 614 status = acpi_ev_disable_gpe(gpe_event_info); 623 615 if (ACPI_FAILURE(status)) { 624 - goto unlock; 616 + goto unlock_and_exit; 625 617 } 626 618 627 619 /* Install the handler */ ··· 636 628 637 629 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 638 630 639 - unlock: 631 + unlock_and_exit: 640 632 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 641 - exit: 633 + exit: 642 634 if (ACPI_FAILURE(status)) 643 635 ACPI_EXCEPTION((AE_INFO, status, 644 636 "Installing notify handler failed"));
+12 -1
drivers/acpi/events/evxfregn.c
··· 155 155 /* Convert and validate the device handle */ 156 156 157 157 node = acpi_ns_map_handle_to_node(device); 158 - if (!node) { 158 + if (!node || 159 + ((node->type != ACPI_TYPE_DEVICE) && 160 + (node->type != ACPI_TYPE_PROCESSOR) && 161 + (node->type != ACPI_TYPE_THERMAL) && 162 + (node != acpi_gbl_root_node))) { 159 163 status = AE_BAD_PARAMETER; 160 164 goto unlock_and_exit; 161 165 } ··· 181 177 /* We have a handler, see if user requested this one */ 182 178 183 179 if (handler_obj->address_space.space_id == space_id) { 180 + 181 + /* Handler must be the same as the installed handler */ 182 + 183 + if (handler_obj->address_space.handler != handler) { 184 + status = AE_BAD_PARAMETER; 185 + goto unlock_and_exit; 186 + } 184 187 185 188 /* Matched space_id, first dereference this in the Regions */ 186 189
-1
drivers/acpi/executer/exconfig.c
··· 502 502 * (Offset contains the table_id) 503 503 */ 504 504 acpi_ns_delete_namespace_by_owner(table_info->owner_id); 505 - acpi_ut_release_owner_id(&table_info->owner_id); 506 505 507 506 /* Delete the table itself */ 508 507
+3
drivers/acpi/executer/exconvrt.c
··· 170 170 return_ACPI_STATUS(AE_NO_MEMORY); 171 171 } 172 172 173 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", 174 + ACPI_FORMAT_UINT64(result))); 175 + 173 176 /* Save the Result */ 174 177 175 178 return_desc->integer.value = result;
+4 -4
drivers/acpi/executer/exsystem.c
··· 60 60 * 61 61 * DESCRIPTION: Implements a semaphore wait with a check to see if the 62 62 * semaphore is available immediately. If it is not, the 63 - * interpreter is released. 63 + * interpreter is released before waiting. 64 64 * 65 65 ******************************************************************************/ 66 66 acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) ··· 110 110 * 111 111 * RETURN: Status 112 112 * 113 - * DESCRIPTION: Implements a semaphore wait with a check to see if the 114 - * semaphore is available immediately. If it is not, the 115 - * interpreter is released. 113 + * DESCRIPTION: Implements a mutex wait with a check to see if the 114 + * mutex is available immediately. If it is not, the 115 + * interpreter is released before waiting. 116 116 * 117 117 ******************************************************************************/ 118 118
+12 -1
drivers/acpi/namespace/nsalloc.c
··· 386 386 * specific ID. Used to delete entire ACPI tables. All 387 387 * reference counts are updated. 388 388 * 389 + * MUTEX: Locks namespace during deletion walk. 390 + * 389 391 ******************************************************************************/ 390 392 391 393 void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) 392 394 { 393 395 struct acpi_namespace_node *child_node; 394 396 struct acpi_namespace_node *deletion_node; 395 - u32 level; 396 397 struct acpi_namespace_node *parent_node; 398 + u32 level; 399 + acpi_status status; 397 400 398 401 ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); 399 402 400 403 if (owner_id == 0) { 404 + return_VOID; 405 + } 406 + 407 + /* Lock namespace for possible update */ 408 + 409 + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 410 + if (ACPI_FAILURE(status)) { 401 411 return_VOID; 402 412 } 403 413 ··· 479 469 } 480 470 } 481 471 472 + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 482 473 return_VOID; 483 474 }
+11 -1
drivers/acpi/tables/tbget.c
··· 320 320 321 321 ACPI_FUNCTION_TRACE(tb_get_this_table); 322 322 323 + /* Validate minimum length */ 324 + 325 + if (header->length < sizeof(struct acpi_table_header)) { 326 + ACPI_ERROR((AE_INFO, 327 + "Table length (%X) is smaller than minimum (%X)", 328 + header->length, sizeof(struct acpi_table_header))); 329 + 330 + return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); 331 + } 332 + 323 333 /* 324 334 * Flags contains the current processor mode (Virtual or Physical 325 335 * addressing) The pointer_type is either Logical or Physical ··· 366 356 */ 367 357 status = acpi_os_map_memory(address->pointer.physical, 368 358 (acpi_size) header->length, 369 - (void *)&full_table); 359 + ACPI_CAST_PTR(void, &full_table)); 370 360 if (ACPI_FAILURE(status)) { 371 361 ACPI_ERROR((AE_INFO, 372 362 "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X",
+18 -3
drivers/acpi/tables/tbinstal.c
··· 256 256 257 257 status = acpi_ut_allocate_owner_id(&table_desc->owner_id); 258 258 if (ACPI_FAILURE(status)) { 259 - return_ACPI_STATUS(status); 259 + goto error_exit1; 260 260 } 261 261 262 262 /* Install the table into the global data structure */ ··· 274 274 * at this location, so return an error. 275 275 */ 276 276 if (list_head->next) { 277 - ACPI_FREE(table_desc); 278 - return_ACPI_STATUS(AE_ALREADY_EXISTS); 277 + status = AE_ALREADY_EXISTS; 278 + goto error_exit2; 279 279 } 280 280 281 281 table_desc->next = list_head->next; ··· 335 335 table_info->owner_id = table_desc->owner_id; 336 336 table_info->installed_desc = table_desc; 337 337 return_ACPI_STATUS(AE_OK); 338 + 339 + /* Error exit with cleanup */ 340 + 341 + error_exit2: 342 + 343 + acpi_ut_release_owner_id(&table_desc->owner_id); 344 + 345 + error_exit1: 346 + 347 + ACPI_FREE(table_desc); 348 + return_ACPI_STATUS(status); 338 349 } 339 350 340 351 /******************************************************************************* ··· 535 524 /* Free the memory allocated for the table itself */ 536 525 537 526 acpi_tb_delete_single_table(table_desc); 527 + 528 + /* Free the owner ID associated with this table */ 529 + 530 + acpi_ut_release_owner_id(&table_desc->owner_id); 538 531 539 532 /* Free the table descriptor */ 540 533
+23 -4
drivers/acpi/tables/tbrsdt.c
··· 183 183 184 184 ACPI_FUNCTION_ENTRY(); 185 185 186 + /* Validate minimum length */ 187 + 188 + if (table_ptr->length < sizeof(struct acpi_table_header)) { 189 + ACPI_ERROR((AE_INFO, 190 + "RSDT/XSDT length (%X) is smaller than minimum (%X)", 191 + table_ptr->length, 192 + sizeof(struct acpi_table_header))); 193 + 194 + return (AE_INVALID_TABLE_LENGTH); 195 + } 196 + 186 197 /* Search for appropriate signature, RSDT or XSDT */ 187 198 188 199 if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { ··· 221 210 ACPI_ERROR((AE_INFO, "Looking for XSDT")); 222 211 } 223 212 224 - ACPI_DUMP_BUFFER((char *)table_ptr, 48); 213 + ACPI_DUMP_BUFFER(ACPI_CAST_PTR(char, table_ptr), 48); 225 214 return (AE_BAD_SIGNATURE); 226 215 } 227 216 ··· 269 258 270 259 status = acpi_tb_validate_rsdt(table_info.pointer); 271 260 if (ACPI_FAILURE(status)) { 272 - return_ACPI_STATUS(status); 261 + goto error_cleanup; 273 262 } 274 263 275 264 /* Get the number of tables defined in the RSDT or XSDT */ ··· 281 270 282 271 status = acpi_tb_convert_to_xsdt(&table_info); 283 272 if (ACPI_FAILURE(status)) { 284 - return_ACPI_STATUS(status); 273 + goto error_cleanup; 285 274 } 286 275 287 276 /* Save the table pointers and allocation info */ 288 277 289 278 status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); 290 279 if (ACPI_FAILURE(status)) { 291 - return_ACPI_STATUS(status); 280 + goto error_cleanup; 292 281 } 293 282 294 283 acpi_gbl_XSDT = 295 284 ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer); 296 285 297 286 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); 287 + return_ACPI_STATUS(status); 288 + 289 + error_cleanup: 290 + 291 + /* Free table allocated by acpi_tb_get_table */ 292 + 293 + acpi_tb_delete_single_table(&table_info); 294 + 298 295 return_ACPI_STATUS(status); 299 296 }
+19 -13
drivers/acpi/tables/tbxface.c
··· 134 134 * RETURN: Status 135 135 * 136 136 * DESCRIPTION: This function is called to load a table from the caller's 137 - * buffer. The buffer must contain an entire ACPI Table including 138 - * a valid header. The header fields will be verified, and if it 137 + * buffer. The buffer must contain an entire ACPI Table including 138 + * a valid header. The header fields will be verified, and if it 139 139 * is determined that the table is invalid, the call will fail. 140 140 * 141 141 ******************************************************************************/ ··· 245 245 /* Find all tables of the requested type */ 246 246 247 247 table_desc = acpi_gbl_table_lists[table_type].next; 248 + if (!table_desc) { 249 + return_ACPI_STATUS(AE_NOT_EXIST); 250 + } 251 + 248 252 while (table_desc) { 249 253 /* 250 - * Delete all namespace entries owned by this table. Note that these 251 - * entries can appear anywhere in the namespace by virtue of the AML 252 - * "Scope" operator. Thus, we need to track ownership by an ID, not 254 + * Delete all namespace objects owned by this table. Note that these 255 + * objects can appear anywhere in the namespace by virtue of the AML 256 + * "Scope" operator. Thus, we need to track ownership by an ID, not 253 257 * simply a position within the hierarchy 254 258 */ 255 259 acpi_ns_delete_namespace_by_owner(table_desc->owner_id); 256 - acpi_ut_release_owner_id(&table_desc->owner_id); 257 260 table_desc = table_desc->next; 258 261 } 259 262 ··· 278 275 * see acpi_gbl_acpi_table_flag 279 276 * out_table_header - pointer to the struct acpi_table_header if successful 280 277 * 281 - * DESCRIPTION: This function is called to get an ACPI table header. The caller 278 + * DESCRIPTION: This function is called to get an ACPI table header. The caller 282 279 * supplies an pointer to a data area sufficient to contain an ACPI 283 280 * struct acpi_table_header structure. 284 281 * 285 282 * The header contains a length field that can be used to determine 286 - * the size of the buffer needed to contain the entire table. This 283 + * the size of the buffer needed to contain the entire table. This 287 284 * function is not valid for the RSD PTR table since it does not 288 285 * have a standard header and is fixed length. 289 286 * ··· 325 322 326 323 /* Copy the header to the caller's buffer */ 327 324 328 - ACPI_MEMCPY((void *)out_table_header, (void *)tbl_ptr, 325 + ACPI_MEMCPY(ACPI_CAST_PTR(void, out_table_header), 326 + ACPI_CAST_PTR(void, tbl_ptr), 329 327 sizeof(struct acpi_table_header)); 330 328 331 329 return_ACPI_STATUS(status); ··· 348 344 * 349 345 * RETURN: Status 350 346 * 351 - * DESCRIPTION: This function is called to get an ACPI table. The caller 347 + * DESCRIPTION: This function is called to get an ACPI table. The caller 352 348 * supplies an out_buffer large enough to contain the entire ACPI 353 - * table. The caller should call the acpi_get_table_header function 354 - * first to determine the buffer size needed. Upon completion 349 + * table. The caller should call the acpi_get_table_header function 350 + * first to determine the buffer size needed. Upon completion 355 351 * the out_buffer->Length field will indicate the number of bytes 356 352 * copied into the out_buffer->buf_ptr buffer. This table will be 357 353 * a complete table including the header. ··· 421 417 422 418 /* Copy the table to the buffer */ 423 419 424 - ACPI_MEMCPY((void *)ret_buffer->pointer, (void *)tbl_ptr, table_length); 420 + ACPI_MEMCPY(ACPI_CAST_PTR(void, ret_buffer->pointer), 421 + ACPI_CAST_PTR(void, tbl_ptr), table_length); 422 + 425 423 return_ACPI_STATUS(AE_OK); 426 424 } 427 425
+9 -4
drivers/acpi/utilities/utdelete.c
··· 447 447 */ 448 448 switch (ACPI_GET_OBJECT_TYPE(object)) { 449 449 case ACPI_TYPE_DEVICE: 450 + case ACPI_TYPE_PROCESSOR: 451 + case ACPI_TYPE_POWER: 452 + case ACPI_TYPE_THERMAL: 450 453 451 - acpi_ut_update_ref_count(object->device.system_notify, 452 - action); 453 - acpi_ut_update_ref_count(object->device.device_notify, 454 - action); 454 + /* Update the notify objects for these types (if present) */ 455 + 456 + acpi_ut_update_ref_count(object->common_notify. 457 + system_notify, action); 458 + acpi_ut_update_ref_count(object->common_notify. 459 + device_notify, action); 455 460 break; 456 461 457 462 case ACPI_TYPE_PACKAGE:
+19 -6
drivers/acpi/utilities/utmisc.c
··· 65 65 u8 acpi_ut_is_aml_table(struct acpi_table_header *table) 66 66 { 67 67 68 - /* Ignore tables that contain AML */ 68 + /* These are the only tables that contain executable AML */ 69 69 70 70 if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || 71 71 ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || ··· 419 419 { 420 420 421 421 if (revision <= 1) { 422 + 423 + /* 32-bit case */ 424 + 422 425 acpi_gbl_integer_bit_width = 32; 423 426 acpi_gbl_integer_nybble_width = 8; 424 427 acpi_gbl_integer_byte_width = 4; 425 428 } else { 429 + /* 64-bit case (ACPI 2.0+) */ 430 + 426 431 acpi_gbl_integer_bit_width = 64; 427 432 acpi_gbl_integer_nybble_width = 16; 428 433 acpi_gbl_integer_byte_width = 8; ··· 507 502 * FUNCTION: acpi_ut_valid_acpi_char 508 503 * 509 504 * PARAMETERS: Char - The character to be examined 505 + * Position - Byte position (0-3) 510 506 * 511 507 * RETURN: TRUE if the character is valid, FALSE otherwise 512 508 * ··· 615 609 * 616 610 * RETURN: Status and Converted value 617 611 * 618 - * DESCRIPTION: Convert a string into an unsigned value. 612 + * DESCRIPTION: Convert a string into an unsigned value. Performs either a 613 + * 32-bit or 64-bit conversion, depending on the current mode 614 + * of the interpreter. 619 615 * NOTE: Does not support Octal strings, not needed. 620 616 * 621 617 ******************************************************************************/ ··· 635 627 u8 sign_of0x = 0; 636 628 u8 term = 0; 637 629 638 - ACPI_FUNCTION_TRACE(ut_stroul64); 630 + ACPI_FUNCTION_TRACE_STR(ut_stroul64, string); 639 631 640 632 switch (base) { 641 633 case ACPI_ANY_BASE: ··· 683 675 } 684 676 } 685 677 678 + /* 679 + * Perform a 32-bit or 64-bit conversion, depending upon the current 680 + * execution mode of the interpreter 681 + */ 686 682 dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; 687 683 688 - /* At least one character in the string here */ 689 - 690 - /* Main loop: convert the string to a 64-bit integer */ 684 + /* Main loop: convert the string to a 32- or 64-bit integer */ 691 685 692 686 while (*string) { 693 687 if (ACPI_IS_DIGIT(*string)) { ··· 763 753 /* All done, normal exit */ 764 754 765 755 all_done: 756 + 757 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", 758 + ACPI_FORMAT_UINT64(return_value))); 766 759 767 760 *ret_integer = return_value; 768 761 return_ACPI_STATUS(AE_OK);
+7
drivers/acpi/utilities/utstate.c
··· 199 199 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; 200 200 state->thread.thread_id = acpi_os_get_thread_id(); 201 201 202 + /* Check for invalid thread ID - zero is very bad, it will break things */ 203 + 204 + if (!state->thread.thread_id) { 205 + ACPI_ERROR((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId")); 206 + state->thread.thread_id = (acpi_thread_id) 1; 207 + } 208 + 202 209 return_PTR((struct acpi_thread_state *)state); 203 210 } 204 211
+1 -1
include/acpi/acconfig.h
··· 63 63 64 64 /* Current ACPICA subsystem version in YYYYMMDD format */ 65 65 66 - #define ACPI_CA_VERSION 0x20060623 66 + #define ACPI_CA_VERSION 0x20060707 67 67 68 68 /* 69 69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
+7 -3
include/acpi/acinterp.h
··· 53 53 #define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info)) 54 54 55 55 /* 56 - * If possible, pack the following structure to byte alignment, since we 57 - * don't care about performance for debug output 56 + * If possible, pack the following structures to byte alignment, since we 57 + * don't care about performance for debug output. Two cases where we cannot 58 + * pack the structures: 59 + * 60 + * 1) Hardware does not support misaligned memory transfers 61 + * 2) Compiler does not support pointers within packed structures 58 62 */ 59 - #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 63 + #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED)) 60 64 #pragma pack(1) 61 65 #endif 62 66
+1 -1
include/acpi/aclocal.h
··· 204 204 /* Namespace Node flags */ 205 205 206 206 #define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ 207 - #define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */ 207 + #define ANOBJ_RESERVED 0x02 /* Available for future use */ 208 208 #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ 209 209 #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ 210 210 #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
+6 -2
include/acpi/acresrc.h
··· 50 50 51 51 /* 52 52 * If possible, pack the following structures to byte alignment, since we 53 - * don't care about performance for debug output 53 + * don't care about performance for debug output. Two cases where we cannot 54 + * pack the structures: 55 + * 56 + * 1) Hardware does not support misaligned memory transfers 57 + * 2) Compiler does not support pointers within packed structures 54 58 */ 55 - #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 59 + #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED)) 56 60 #pragma pack(1) 57 61 #endif 58 62