diff options
| author | Andy Grover <agrover@groveronline.com> | 2003-04-18 02:28:03 -0700 |
|---|---|---|
| committer | Andy Grover <agrover@groveronline.com> | 2003-04-18 02:28:03 -0700 |
| commit | 4b83d8cbb2abe2097b49bfe0824a911fca549dd1 (patch) | |
| tree | 61df3775bd351d562da8c9c1cd422d4beded5693 | |
| parent | 8f44c5c2a379c847e823624f7c2da0039bbc0f2f (diff) | |
ACPI: interpreter update to 20030418
- Fix for big-endian arcitectures
37 files changed, 498 insertions, 409 deletions
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 787d4467169f..f50c8fcbaed0 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c @@ -249,9 +249,9 @@ acpi_ds_get_field_names ( * In field_flags, preserve the flag bits other than the ACCESS_TYPE bits */ info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | - ((u8) (arg->common.value.integer32 >> 8))); + ((u8) ((u32) arg->common.value.integer >> 8))); - info->attribute = (u8) (arg->common.value.integer32); + info->attribute = (u8) (arg->common.value.integer); break; @@ -356,7 +356,7 @@ acpi_ds_create_field ( /* Second arg is the field flags */ arg = arg->common.next; - info.field_flags = arg->common.value.integer8; + info.field_flags = (u8) arg->common.value.integer; info.attribute = 0; /* Each remaining arg is a Named Field */ @@ -509,12 +509,12 @@ acpi_ds_create_bank_field ( /* Third arg is the bank_value */ arg = arg->common.next; - info.bank_value = arg->common.value.integer32; + info.bank_value = (u32) arg->common.value.integer; /* Fourth arg is the field flags */ arg = arg->common.next; - info.field_flags = arg->common.value.integer8; + info.field_flags = (u8) arg->common.value.integer; /* Each remaining arg is a Named Field */ @@ -580,7 +580,7 @@ acpi_ds_create_index_field ( /* Next arg is the field flags */ arg = arg->common.next; - info.field_flags = arg->common.value.integer8; + info.field_flags = (u8) arg->common.value.integer; /* Each remaining arg is a Named Field */ diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index 02aef585b532..55495cc50518 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -87,8 +87,8 @@ acpi_ds_method_data_init ( /* Init the method arguments */ for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { - ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name, - NAMEOF_ARG_NTE); + ACPI_MOVE_32_TO_32 (&walk_state->arguments[i].name, + NAMEOF_ARG_NTE); walk_state->arguments[i].name.integer |= (i << 24); walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; walk_state->arguments[i].type = ACPI_TYPE_ANY; @@ -98,8 +98,8 @@ acpi_ds_method_data_init ( /* Init the method locals */ for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { - ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name, - NAMEOF_LOCAL_NTE); + ACPI_MOVE_32_TO_32 (&walk_state->local_variables[i].name, + NAMEOF_LOCAL_NTE); walk_state->local_variables[i].name.integer |= (i << 24); walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 388eeb9e1dcb..89f3b8e52558 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -187,7 +187,7 @@ acpi_ds_build_internal_buffer_obj ( return (AE_TYPE); } - byte_list_length = byte_list->common.value.integer32; + byte_list_length = (u32) byte_list->common.value.integer; } /* diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index c950018d5f62..0637567b4542 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -647,7 +647,7 @@ cleanup: acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state); } -#if _UNDER_DEVELOPMENT +#ifdef _UNDER_DEVELOPMENT if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) { acpi_db_method_end (walk_state); diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index d716979df4ab..2fc32e12c86f 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -76,7 +76,7 @@ acpi_ev_get_gpe_event_info ( acpi_native_uint i; - ACPI_FUNCTION_NAME ("ev_get_gpe_event_info"); + ACPI_FUNCTION_ENTRY (); /* A NULL gpe_block means use the FADT-defined GPE block(s) */ diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 06733397fc69..6592b2301cae 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -71,7 +71,7 @@ acpi_ev_valid_gpe_event ( struct acpi_gpe_block_info *gpe_block; - ACPI_FUNCTION_NAME ("ev_valid_gpe_event"); + ACPI_FUNCTION_ENTRY (); /* No need for spin lock since we are not changing any list elements */ @@ -81,7 +81,7 @@ acpi_ev_valid_gpe_event ( gpe_block = gpe_xrupt_block->gpe_block_list_head; while (gpe_block) { if ((&gpe_block->event_info[0] <= gpe_event_info) && - (&gpe_block->event_info[gpe_block->register_count * 8] > gpe_event_info)) { + (&gpe_block->event_info[((acpi_size) gpe_block->register_count) * 8] > gpe_event_info)) { return (TRUE); } @@ -186,13 +186,13 @@ acpi_ev_save_method_info ( acpi_status status; - ACPI_FUNCTION_NAME ("ev_save_method_info"); + ACPI_FUNCTION_TRACE ("ev_save_method_info"); /* Extract the name from the object and convert to a string */ - ACPI_MOVE_UNALIGNED32_TO_32 (name, - &((struct acpi_namespace_node *) obj_handle)->name.integer); + ACPI_MOVE_32_TO_32 (name, + &((struct acpi_namespace_node *) obj_handle)->name.integer); name[ACPI_NAME_SIZE] = 0; /* @@ -213,7 +213,7 @@ acpi_ev_save_method_info ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n", name)); - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Convert the last two characters of the name to the GPE Number */ @@ -225,7 +225,7 @@ acpi_ev_save_method_info ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not extract GPE number from name: %s (name is not of form _Lnn or _Enn)\n", name)); - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Ensure that we have a valid GPE number for this GPE block */ @@ -237,7 +237,7 @@ acpi_ev_save_method_info ( * However, it may be valid for a different GPE block, since GPE0 and GPE1 * methods both appear under \_GPE. */ - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -254,13 +254,13 @@ acpi_ev_save_method_info ( */ status = acpi_hw_enable_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - return (status); + return_ACPI_STATUS (status); } ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Registered GPE method %s as GPE number 0x%.2X\n", name, gpe_number)); - return (AE_OK); + return_ACPI_STATUS (AE_OK); } @@ -279,7 +279,7 @@ acpi_ev_save_method_info ( * ******************************************************************************/ -struct acpi_gpe_xrupt_info * +static struct acpi_gpe_xrupt_info * acpi_ev_get_gpe_xrupt_block ( u32 interrupt_level) { @@ -288,12 +288,15 @@ acpi_ev_get_gpe_xrupt_block ( acpi_status status; + ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); + + /* No need for spin lock since we are not changing any list elements here */ next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; while (next_gpe_xrupt) { if (next_gpe_xrupt->interrupt_level == interrupt_level) { - return (next_gpe_xrupt); + return_PTR (next_gpe_xrupt); } next_gpe_xrupt = next_gpe_xrupt->next; @@ -303,7 +306,7 @@ acpi_ev_get_gpe_xrupt_block ( gpe_xrupt = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_xrupt_info)); if (!gpe_xrupt) { - return (NULL); + return_PTR (NULL); } gpe_xrupt->interrupt_level = interrupt_level; @@ -330,9 +333,15 @@ acpi_ev_get_gpe_xrupt_block ( if (interrupt_level != acpi_gbl_FADT->sci_int) { status = acpi_os_install_interrupt_handler (interrupt_level, acpi_ev_gpe_xrupt_handler, gpe_xrupt); + if (ACPI_FAILURE (status)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Could not install GPE interrupt handler at level 0x%X\n", + interrupt_level)); + return_PTR (NULL); + } } - return (gpe_xrupt); + return_PTR (gpe_xrupt); } @@ -349,7 +358,7 @@ acpi_ev_get_gpe_xrupt_block ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_ev_delete_gpe_xrupt ( struct acpi_gpe_xrupt_info *gpe_xrupt) { @@ -406,7 +415,7 @@ acpi_ev_delete_gpe_xrupt ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_ev_install_gpe_block ( struct acpi_gpe_block_info *gpe_block, u32 interrupt_level) @@ -535,7 +544,7 @@ unlock_and_exit: * ******************************************************************************/ -acpi_status +static acpi_status acpi_ev_create_gpe_info_blocks ( struct acpi_gpe_block_info *gpe_block) { diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 57b7db37469b..de32b8f85604 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c @@ -315,9 +315,10 @@ acpi_ev_address_space_dispatch ( handler = handler_desc->addr_handler.handler; ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Addrhandler %p (%p), Address %8.8X%8.8X\n", + "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", ®ion_obj->region.addr_handler->addr_handler, handler, - ACPI_HIDWORD (address), ACPI_LODWORD (address))); + ACPI_HIDWORD (address), ACPI_LODWORD (address), + acpi_ut_get_region_name (region_obj->region.space_id))); if (!(handler_desc->addr_handler.flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { /* diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index 76a14f18fe6e..79d0c5a3fe33 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c @@ -159,16 +159,14 @@ acpi_install_address_space_handler ( } } - /* - * If the caller hasn't specified a setup routine, use the default - */ + /* If the caller hasn't specified a setup routine, use the default */ + if (!setup) { setup = acpi_ev_default_region_setup; } - /* - * Check for an existing internal object - */ + /* Check for an existing internal object */ + obj_desc = acpi_ns_get_attached_object (node); if (obj_desc) { /* @@ -181,7 +179,7 @@ acpi_install_address_space_handler ( handler_obj = obj_desc->device.addr_handler; while (handler_obj) { /* - * We have an Address handler, see if user requested this + * Found an Address handler, see if user requested this * address space. */ if(handler_obj->addr_handler.space_id == space_id) { @@ -189,9 +187,8 @@ acpi_install_address_space_handler ( goto unlock_and_exit; } - /* - * Move through the linked list of handlers - */ + /* Walk the linked list of handlers */ + handler_obj = handler_obj->addr_handler.next; } } @@ -232,10 +229,10 @@ acpi_install_address_space_handler ( acpi_ut_get_region_name (space_id), space_id, node->name.ascii, node, obj_desc)); /* - * Now we can install the handler + * Install the handler * - * At this point we know that there is no existing handler. - * So, we just allocate the object for the handler and link it + * At this point there is no existing handler. + * Just allocate the object for the handler and link it * into the list. */ handler_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_ADDRESS_HANDLER); @@ -254,15 +251,15 @@ acpi_install_address_space_handler ( handler_obj->addr_handler.setup = setup; /* - * Now walk the namespace finding all of the regions this + * Walk the namespace finding all of the regions this * handler will manage. * - * We start at the device and search the branch toward + * Start at the device and search the branch toward * the leaf nodes until either the leaf is encountered or * a device is detected that has an address handler of the * same type. * - * In either case we back up and search down the remainder + * In either case, back up and search down the remainder * of the branch */ status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, device, @@ -270,9 +267,8 @@ acpi_install_address_space_handler ( acpi_ev_addr_handler_helper, handler_obj, NULL); - /* - * Place this handler 1st on the list - */ + /* Place this handler 1st on the list */ + handler_obj->common.reference_count = (u16) (handler_obj->common.reference_count + obj_desc->common.reference_count - 1); @@ -289,12 +285,13 @@ unlock_and_exit: * * FUNCTION: acpi_remove_address_space_handler * - * PARAMETERS: space_id - The address space ID + * PARAMETERS: Device - Handle for the device + * space_id - The address space ID * Handler - Address of the handler * * RETURN: Status * - * DESCRIPTION: Install a handler for accesses on an Operation Region + * DESCRIPTION: Remove a previously installed handler. * ******************************************************************************/ @@ -342,19 +339,16 @@ acpi_remove_address_space_handler ( goto unlock_and_exit; } - /* - * find the address handler the user requested - */ + /* Find the address handler the user requested */ + handler_obj = obj_desc->device.addr_handler; last_obj_ptr = &obj_desc->device.addr_handler; while (handler_obj) { - /* - * We have a handler, see if user requested this one - */ + /* We have a handler, see if user requested this one */ + if (handler_obj->addr_handler.space_id == space_id) { - /* - * Got it, first dereference this in the Regions - */ + /* Matched space_id, first dereference this in the Regions */ + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Removing address handler %p(%p) for region %s on Device %p(%p)\n", handler_obj, handler, acpi_ut_get_region_name (space_id), @@ -375,46 +369,37 @@ acpi_remove_address_space_handler ( acpi_ev_detach_region (region_obj, TRUE); /* - * Walk the list, since we took the first region and it - * was removed from the list by the dissassociate call - * we just get the first item on the list again + * Walk the list: Just grab the head because the + * detach_region removed the previous head. */ region_obj = handler_obj->addr_handler.region_list; } - /* - * Remove this Handler object from the list - */ + /* Remove this Handler object from the list */ + *last_obj_ptr = handler_obj->addr_handler.next; - /* - * Now we can delete the handler object - */ - acpi_ut_remove_reference (handler_obj); - acpi_ut_remove_reference (handler_obj); + /* Now we can delete the handler object */ + acpi_ut_remove_reference (handler_obj); goto unlock_and_exit; } - /* - * Move through the linked list of handlers - */ + /* Walk the linked list of handlers */ + last_obj_ptr = &handler_obj->addr_handler.next; handler_obj = handler_obj->addr_handler.next; } + /* The handler does not exist */ - /* - * The handler does not exist - */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc)); status = AE_NOT_EXIST; - unlock_and_exit: (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (status); diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 8123433c048a..e3173033472e 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c @@ -568,9 +568,10 @@ acpi_ex_write_with_update_rule ( * * PARAMETERS: Datum - Where the Datum is returned * Buffer - Raw field buffer + * buffer_length - Entire length (used for big-endian only) * byte_granularity - 1/2/4/8 Granularity of the field * (aka Datum Size) - * Offset - Datum offset into the buffer + * buffer_offset - Datum offset into the buffer * * RETURN: none * @@ -580,35 +581,44 @@ acpi_ex_write_with_update_rule ( ******************************************************************************/ void -acpi_ex_get_buffer_datum( +acpi_ex_get_buffer_datum ( acpi_integer *datum, void *buffer, + u32 buffer_length, u32 byte_granularity, - u32 offset) + u32 buffer_offset) { + u32 index; + ACPI_FUNCTION_ENTRY (); + /* Get proper index into buffer (handles big/little endian) */ + + index = ACPI_BUFFER_INDEX (buffer_length, buffer_offset, byte_granularity); + + /* Move the requested number of bytes */ + switch (byte_granularity) { case ACPI_FIELD_BYTE_GRANULARITY: - *datum = ((u8 *) buffer) [offset]; + *datum = ((u8 *) buffer) [index]; break; case ACPI_FIELD_WORD_GRANULARITY: - ACPI_MOVE_UNALIGNED16_TO_32 (datum, &(((u16 *) buffer) [offset])); + ACPI_MOVE_16_TO_64 (datum, &(((u16 *) buffer) [index])); break; case ACPI_FIELD_DWORD_GRANULARITY: - ACPI_MOVE_UNALIGNED32_TO_32 (datum, &(((u32 *) buffer) [offset])); + ACPI_MOVE_32_TO_64 (datum, &(((u32 *) buffer) [index])); break; case ACPI_FIELD_QWORD_GRANULARITY: - ACPI_MOVE_UNALIGNED64_TO_64 (datum, &(((u64 *) buffer) [offset])); + ACPI_MOVE_64_TO_64 (datum, &(((u64 *) buffer) [index])); break; default: @@ -624,9 +634,10 @@ acpi_ex_get_buffer_datum( * * PARAMETERS: merged_datum - Value to store * Buffer - Receiving buffer + * buffer_length - Entire length (used for big-endian only) * byte_granularity - 1/2/4/8 Granularity of the field * (aka Datum Size) - * Offset - Datum offset into the buffer + * buffer_offset - Datum offset into the buffer * * RETURN: none * @@ -639,32 +650,40 @@ void acpi_ex_set_buffer_datum ( acpi_integer merged_datum, void *buffer, + u32 buffer_length, u32 byte_granularity, - u32 offset) + u32 buffer_offset) { + u32 index; ACPI_FUNCTION_ENTRY (); + /* Get proper index into buffer (handles big/little endian) */ + + index = ACPI_BUFFER_INDEX (buffer_length, buffer_offset, byte_granularity); + + /* Move the requested number of bytes */ + switch (byte_granularity) { case ACPI_FIELD_BYTE_GRANULARITY: - ((u8 *) buffer) [offset] = (u8) merged_datum; + ((u8 *) buffer) [index] = (u8) merged_datum; break; case ACPI_FIELD_WORD_GRANULARITY: - ACPI_MOVE_UNALIGNED16_TO_16 (&(((u16 *) buffer)[offset]), &merged_datum); + ACPI_MOVE_64_TO_16 (&(((u16 *) buffer)[index]), &merged_datum); break; case ACPI_FIELD_DWORD_GRANULARITY: - ACPI_MOVE_UNALIGNED32_TO_32 (&(((u32 *) buffer)[offset]), &merged_datum); + ACPI_MOVE_64_TO_32 (&(((u32 *) buffer)[index]), &merged_datum); break; case ACPI_FIELD_QWORD_GRANULARITY: - ACPI_MOVE_UNALIGNED64_TO_64 (&(((u64 *) buffer)[offset]), &merged_datum); + ACPI_MOVE_64_TO_64 (&(((u64 *) buffer)[index]), &merged_datum); break; default: @@ -762,8 +781,8 @@ acpi_ex_extract_from_field ( /* Store the datum to the caller buffer */ - acpi_ex_set_buffer_datum (merged_datum, buffer, obj_desc->common_field.access_byte_width, - datum_offset); + acpi_ex_set_buffer_datum (merged_datum, buffer, buffer_length, + obj_desc->common_field.access_byte_width, datum_offset); return_ACPI_STATUS (AE_OK); } @@ -835,7 +854,7 @@ acpi_ex_extract_from_field ( * Store the merged field datum in the caller's buffer, according to * the granularity of the field (size of each datum). */ - acpi_ex_set_buffer_datum (merged_datum, buffer, + acpi_ex_set_buffer_datum (merged_datum, buffer, buffer_length, obj_desc->common_field.access_byte_width, datum_offset); /* @@ -916,7 +935,7 @@ acpi_ex_insert_into_field ( /* Get a single datum from the caller's buffer */ - acpi_ex_get_buffer_datum (&previous_raw_datum, buffer, + acpi_ex_get_buffer_datum (&previous_raw_datum, buffer, buffer_length, obj_desc->common_field.access_byte_width, datum_offset); /* @@ -979,7 +998,7 @@ acpi_ex_insert_into_field ( * Get the next raw buffer datum. It may contain bits of the previous * field datum */ - acpi_ex_get_buffer_datum (&this_raw_datum, buffer, + acpi_ex_get_buffer_datum (&this_raw_datum, buffer, buffer_length, obj_desc->common_field.access_byte_width, datum_offset); /* Create the field datum based on the field alignment */ diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 33adf721dc9b..cea38f09ff7d 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -83,7 +83,7 @@ acpi_ex_system_memory_space_handler ( struct acpi_mem_space_context *mem_info = region_context; u32 length; acpi_size window_size; -#ifndef _HW_ALIGNMENT_SUPPORT +#ifndef ACPI_MISALIGNED_TRANSFERS u32 remainder; #endif @@ -116,7 +116,7 @@ acpi_ex_system_memory_space_handler ( } -#ifndef _HW_ALIGNMENT_SUPPORT +#ifndef ACPI_MISALIGNED_TRANSFERS /* * Hardware does not support non-aligned data transfers, we must verify * the request. @@ -283,6 +283,7 @@ acpi_ex_system_io_space_handler ( void *region_context) { acpi_status status = AE_OK; + u32 value32; ACPI_FUNCTION_TRACE ("ex_system_io_space_handler"); @@ -297,13 +298,13 @@ acpi_ex_system_io_space_handler ( switch (function) { case ACPI_READ: - *value = 0; - status = acpi_os_read_port ((acpi_io_address) address, value, bit_width); + status = acpi_os_read_port ((acpi_io_address) address, &value32, bit_width); + *value = value32; break; case ACPI_WRITE: - status = acpi_os_write_port ((acpi_io_address) address, *value, bit_width); + status = acpi_os_write_port ((acpi_io_address) address, (u32) *value, bit_width); break; default: diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index b1bea4332ce6..2d8ec3be45b1 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -141,7 +141,7 @@ acpi_hw_set_mode ( /* BIOS should have disabled ALL fixed and GP events */ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, - (acpi_integer) acpi_gbl_FADT->acpi_enable, 8); + (u32) acpi_gbl_FADT->acpi_enable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); break; @@ -152,7 +152,7 @@ acpi_hw_set_mode ( * enable bits to default */ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, - (acpi_integer) acpi_gbl_FADT->acpi_disable, 8); + (u32) acpi_gbl_FADT->acpi_disable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable Legacy (non-ACPI) mode\n")); break; diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 5d952f8af451..d7fa0b5d9881 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c @@ -424,7 +424,7 @@ acpi_hw_clear_gpe_block ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_hw_disable_non_wakeup_gpe_block ( struct acpi_gpe_xrupt_info *gpe_xrupt_info, struct acpi_gpe_block_info *gpe_block) @@ -515,7 +515,7 @@ acpi_hw_disable_non_wakeup_gpes ( * ******************************************************************************/ -acpi_status +static acpi_status acpi_hw_enable_non_wakeup_gpe_block ( struct acpi_gpe_xrupt_info *gpe_xrupt_info, struct acpi_gpe_block_info *gpe_block) diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index ae2a9e19f544..638c7323f119 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -654,7 +654,7 @@ acpi_hw_register_write ( /* SMI_CMD is currently always in IO space */ - status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (acpi_integer) value, 8); + status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8); break; @@ -812,7 +812,7 @@ acpi_hw_low_level_write ( mem_address = (reg->address + (acpi_physical_address) offset); - status = acpi_os_write_memory (mem_address, (acpi_integer) value, width); + status = acpi_os_write_memory (mem_address, value, width); break; @@ -821,7 +821,7 @@ acpi_hw_low_level_write ( io_address = (acpi_io_address) (reg->address + (acpi_physical_address) offset); - status = acpi_os_write_port (io_address, (acpi_integer) value, width); + status = acpi_os_write_port (io_address, value, width); break; diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 20e9fa08b10f..37dc30a49bde 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c @@ -226,7 +226,7 @@ acpi_enter_sleep_state ( /* Clear wake status */ - status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK); + status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -238,7 +238,7 @@ acpi_enter_sleep_state ( /* Disable BM arbitration */ - status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_LOCK); + status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -327,11 +327,6 @@ acpi_enter_sleep_state ( } while (!in_value); - status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - return_ACPI_STATUS (AE_OK); } @@ -366,7 +361,7 @@ acpi_enter_sleep_state_s4bios ( ACPI_FLUSH_CPU_CACHE(); - status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (acpi_integer) acpi_gbl_FADT->S4bios_req, 8); + status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (u32) acpi_gbl_FADT->S4bios_req, 8); do { acpi_os_stall(1000); diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 5ff0ecae02f4..6837d7b34bee 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -527,7 +527,7 @@ acpi_ns_lookup ( /* Extract one ACPI name from the front of the pathname */ - ACPI_MOVE_UNALIGNED32_TO_32 (&simple_name, path); + ACPI_MOVE_32_TO_32 (&simple_name, path); /* Try to find the single (4 character) ACPI name */ diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 257865453766..5acf7d27321c 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -98,7 +98,7 @@ acpi_ns_build_external_path ( /* Put the name into the buffer */ - ACPI_MOVE_UNALIGNED32_TO_32 ((name_buffer + index), &parent_node->name); + ACPI_MOVE_32_TO_32 ((name_buffer + index), &parent_node->name); parent_node = acpi_ns_get_parent_node (parent_node); /* Prefix name with the path separator */ diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index a9168b9f1c21..321dcbc0484f 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -76,31 +76,38 @@ acpi_ns_report_error ( acpi_status lookup_status) { acpi_status status; - char *name; + char *name = NULL; - /* Convert path to external format */ - - status = acpi_ns_externalize_name (ACPI_UINT32_MAX, internal_name, NULL, &name); - acpi_os_printf ("%8s-%04d: *** Error: Looking up ", module_name, line_number); - /* Print target name */ + if (lookup_status == AE_BAD_CHARACTER) { + /* There is a non-ascii character in the name */ - if (ACPI_SUCCESS (status)) { - acpi_os_printf ("[%s]", name); + acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n", *(ACPI_CAST_PTR (u32, internal_name))); } else { - acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]"); + /* Convert path to external format */ + + status = acpi_ns_externalize_name (ACPI_UINT32_MAX, internal_name, NULL, &name); + + /* Print target name */ + + if (ACPI_SUCCESS (status)) { + acpi_os_printf ("[%s]", name); + } + else { + acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]"); + } + + if (name) { + ACPI_MEM_FREE (name); + } } acpi_os_printf (" in namespace, %s\n", acpi_format_exception (lookup_status)); - - if (name) { - ACPI_MEM_FREE (name); - } } @@ -609,7 +616,7 @@ acpi_ns_externalize_name ( /* <count> 4-byte names */ names_index = prefix_length + 2; - num_segments = (u32) (u8) internal_name[(acpi_native_uint) (prefix_length + 1)]; + num_segments = (acpi_native_uint) (u8) internal_name[(acpi_native_uint) (prefix_length + 1)]; break; case AML_DUAL_NAME_PREFIX: diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index a80987103ce7..584c76aed523 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c @@ -524,8 +524,8 @@ acpi_ns_get_device_callback ( * * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, * starting (and ending) at the object specified by start_handle. - * The user_function is called whenever an object that matches - * the type parameter is found. If the user function returns + * The user_function is called whenever an object of type + * Device is found. If the user function returns * a non-zero value, the search is terminated immediately and this * value is returned to the caller. * diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index dab6100c2ae6..842560926639 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -303,7 +303,7 @@ acpi_os_stall(u32 us) acpi_status acpi_os_read_port( acpi_io_address port, - void *value, + u32 *value, u32 width) { u32 dummy; @@ -332,7 +332,7 @@ acpi_os_read_port( acpi_status acpi_os_write_port( acpi_io_address port, - acpi_integer value, + u32 value, u32 width) { switch (width) @@ -356,7 +356,7 @@ acpi_os_write_port( acpi_status acpi_os_read_memory( acpi_physical_address phys_addr, - void *value, + u32 *value, u32 width) { u32 dummy; @@ -402,7 +402,7 @@ acpi_os_read_memory( acpi_status acpi_os_write_memory( acpi_physical_address phys_addr, - acpi_integer value, + u32 value, u32 width) { void *virt_addr; diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 1bee8daf3c65..2f79d963eddb 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -412,7 +412,7 @@ acpi_ps_get_next_simple_arg ( /* Get 2 bytes from the AML stream */ - ACPI_MOVE_UNALIGNED16_TO_32 (&arg->common.value.integer, parser_state->aml); + ACPI_MOVE_16_TO_32 (&arg->common.value.integer, parser_state->aml); parser_state->aml += 2; break; @@ -423,7 +423,7 @@ acpi_ps_get_next_simple_arg ( /* Get 4 bytes from the AML stream */ - ACPI_MOVE_UNALIGNED32_TO_32 (&arg->common.value.integer, parser_state->aml); + ACPI_MOVE_32_TO_32 (&arg->common.value.integer, parser_state->aml); parser_state->aml += 4; break; @@ -434,7 +434,7 @@ acpi_ps_get_next_simple_arg ( /* Get 8 bytes from the AML stream */ - ACPI_MOVE_UNALIGNED64_TO_64 (&arg->common.value.integer, parser_state->aml); + ACPI_MOVE_64_TO_64 (&arg->common.value.integer, parser_state->aml); parser_state->aml += 8; break; @@ -533,7 +533,7 @@ acpi_ps_get_next_field ( /* Get the 4-character name */ - ACPI_MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml); + ACPI_MOVE_32_TO_32 (&name, parser_state->aml); acpi_ps_set_name (field, name); parser_state->aml += ACPI_NAME_SIZE; @@ -557,9 +557,9 @@ acpi_ps_get_next_field ( * Get access_type and access_attrib and merge into the field Op * access_type is first operand, access_attribute is second */ - field->common.value.integer32 = (ACPI_GET8 (parser_state->aml) << 8); + field->common.value.integer = (ACPI_GET8 (parser_state->aml) << 8); parser_state->aml++; - field->common.value.integer32 |= ACPI_GET8 (parser_state->aml); + field->common.value.integer |= ACPI_GET8 (parser_state->aml); parser_state->aml++; break; diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 14a3472d4ada..f0aaf6130138 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -92,7 +92,7 @@ acpi_rs_address16_resource ( * Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; output_struct->id = ACPI_RSTYPE_ADDRESS16; @@ -162,36 +162,31 @@ acpi_rs_address16_resource ( * Get Granularity (Bytes 6-7) */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.granularity, - buffer); + ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); /* * Get min_address_range (Bytes 8-9) */ buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.min_address_range, - buffer); + ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); /* * Get max_address_range (Bytes 10-11) */ buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.max_address_range, - buffer); + ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); /* * Get address_translation_offset (Bytes 12-13) */ buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_translation_offset, - buffer); + ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer); /* * Get address_length (Bytes 14-15) */ buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_length, - buffer); + ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); /* * Resource Source Index (if present) @@ -360,36 +355,31 @@ acpi_rs_address16_stream ( /* * Set the address space granularity */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, - &linked_list->data.address16.granularity); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); buffer += 2; /* * Set the address range minimum */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, - &linked_list->data.address16.min_address_range); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); buffer += 2; /* * Set the address range maximum */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, - &linked_list->data.address16.max_address_range); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); buffer += 2; /* * Set the address translation offset */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, - &linked_list->data.address16.address_translation_offset); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset); buffer += 2; /* * Set the address length */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, - &linked_list->data.address16.address_length); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); buffer += 2; /* @@ -413,7 +403,7 @@ acpi_rs_address16_stream ( * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1); + buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1); } /* @@ -427,7 +417,7 @@ acpi_rs_address16_stream ( * minus the header size (3 bytes) */ actual_bytes -= 3; - ACPI_MOVE_UNALIGNED16_TO_16 (length_field, &actual_bytes); + ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes); return_ACPI_STATUS (AE_OK); } @@ -479,7 +469,7 @@ acpi_rs_address32_resource ( * Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; output_struct->id = ACPI_RSTYPE_ADDRESS32; @@ -553,36 +543,31 @@ acpi_rs_address32_resource ( * Get Granularity (Bytes 6-9) */ buffer += 1; - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.granularity, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); /* * Get min_address_range (Bytes 10-13) */ buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.min_address_range, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); /* * Get max_address_range (Bytes 14-17) */ buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.max_address_range, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); /* * Get address_translation_offset (Bytes 18-21) */ buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_translation_offset, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer); /* * Get address_length (Bytes 22-25) */ buffer += 4; - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_length, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); /* * Resource Source Index (if present) @@ -749,36 +734,31 @@ acpi_rs_address32_stream ( /* * Set the address space granularity */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, - &linked_list->data.address32.granularity); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); buffer += 4; /* * Set the address range minimum */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, - &linked_list->data.address32.min_address_range); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); buffer += 4; /* * Set the address range maximum */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, - &linked_list->data.address32.max_address_range); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); buffer += 4; /* * Set the address translation offset */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, - &linked_list->data.address32.address_translation_offset); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset); buffer += 4; /* * Set the address length */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, - &linked_list->data.address32.address_length); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); buffer += 4; /* @@ -802,7 +782,7 @@ acpi_rs_address32_stream ( * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1); + buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1); } /* @@ -866,7 +846,7 @@ acpi_rs_address64_resource ( * Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; output_struct->id = ACPI_RSTYPE_ADDRESS64; @@ -941,36 +921,31 @@ acpi_rs_address64_resource ( * Get Granularity (Bytes 6-13) */ buffer += 1; - ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.granularity, - buffer); + ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); /* * Get min_address_range (Bytes 14-21) */ buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.min_address_range, - buffer); + ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); /* * Get max_address_range (Bytes 22-29) */ buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.max_address_range, - buffer); + ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); /* * Get address_translation_offset (Bytes 30-37) */ buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_translation_offset, - buffer); + ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer); /* * Get address_length (Bytes 38-45) */ buffer += 8; - ACPI_MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_length, - buffer); + ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); /* * Resource Source Index (if present) @@ -1141,36 +1116,31 @@ acpi_rs_address64_stream ( /* * Set the address space granularity */ - ACPI_MOVE_UNALIGNED64_TO_64 (buffer, - &linked_list->data.address64.granularity); + ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); buffer += 8; /* * Set the address range minimum */ - ACPI_MOVE_UNALIGNED64_TO_64 (buffer, - &linked_list->data.address64.min_address_range); + ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); buffer += 8; /* * Set the address range maximum */ - ACPI_MOVE_UNALIGNED64_TO_64 (buffer, - &linked_list->data.address64.max_address_range); + ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); buffer += 8; /* * Set the address translation offset */ - ACPI_MOVE_UNALIGNED64_TO_64 (buffer, - &linked_list->data.address64.address_translation_offset); + ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset); buffer += 8; /* * Set the address length */ - ACPI_MOVE_UNALIGNED64_TO_64 (buffer, - &linked_list->data.address64.address_length); + ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); buffer += 8; /* @@ -1193,7 +1163,7 @@ acpi_rs_address64_stream ( * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1); + buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1); } /* diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index d631953eb7cf..ad660786fe26 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -349,7 +349,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); bytes_consumed = temp16 + 3; /* @@ -390,7 +390,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); bytes_consumed = temp16 + 3; @@ -428,7 +428,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); bytes_consumed = temp16 + 3; @@ -466,7 +466,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); bytes_consumed = temp16 + 3; @@ -504,7 +504,7 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; ++buffer; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); bytes_consumed = temp16 + 3; @@ -573,7 +573,7 @@ acpi_rs_get_list_length ( /* * Look at the number of bits set */ - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); for (index = 0; index < 16; index++) { if (temp16 & 0x1) { diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 4ec559527c4b..0dad5d821bd1 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -106,7 +106,7 @@ acpi_rs_io_resource ( * Check min_base Address */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); output_struct->data.io.min_base_address = temp16; @@ -114,7 +114,7 @@ acpi_rs_io_resource ( * Check max_base Address */ buffer += 2; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); output_struct->data.io.max_base_address = temp16; @@ -196,7 +196,7 @@ acpi_rs_fixed_io_resource ( * Check Range Base Address */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); output_struct->data.fixed_io.base_address = temp16; @@ -270,7 +270,7 @@ acpi_rs_io_stream ( */ temp16 = (u16) linked_list->data.io.min_base_address; - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; /* @@ -278,7 +278,7 @@ acpi_rs_io_stream ( */ temp16 = (u16) linked_list->data.io.max_base_address; - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; /* @@ -347,7 +347,7 @@ acpi_rs_fixed_io_stream ( */ temp16 = (u16) linked_list->data.fixed_io.base_address; - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; /* diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 46f0e5e66c09..02efcffac0f2 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -101,7 +101,7 @@ acpi_rs_irq_resource ( * Point to the 16-bits of Bytes 1 and 2 */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); output_struct->data.irq.number_of_interrupts = 0; @@ -242,7 +242,7 @@ acpi_rs_irq_stream ( temp16 |= 0x1 << temp8; } - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; /* @@ -317,7 +317,7 @@ acpi_rs_extended_irq_resource ( * Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; output_struct->id = ACPI_RSTYPE_EXT_IRQ; @@ -374,7 +374,7 @@ acpi_rs_extended_irq_resource ( * Cycle through every IRQ in the table */ for (index = 0; index < temp8; index++) { - ACPI_MOVE_UNALIGNED32_TO_32 ( + ACPI_MOVE_32_TO_32 ( &output_struct->data.extended_irq.interrupts[index], buffer); /* Point to the next IRQ */ @@ -533,7 +533,7 @@ acpi_rs_extended_irq_stream ( for (index = 0; index < linked_list->data.extended_irq.number_of_interrupts; index++) { - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.extended_irq.interrupts[index]); buffer += 4; } @@ -557,7 +557,7 @@ acpi_rs_extended_irq_stream ( * Buffer needs to be set to the length of the sting + one for the * terminating null */ - buffer += (ACPI_STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1); + buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1); } /* diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index bde6f9904ab9..b291820b04dc 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -92,7 +92,7 @@ acpi_rs_memory24_resource ( */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; output_struct->id = ACPI_RSTYPE_MEM24; @@ -107,28 +107,28 @@ acpi_rs_memory24_resource ( /* * Get min_base_address (Bytes 4-5) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); buffer += 2; output_struct->data.memory24.min_base_address = temp16; /* * Get max_base_address (Bytes 6-7) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); buffer += 2; output_struct->data.memory24.max_base_address = temp16; /* * Get Alignment (Bytes 8-9) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); buffer += 2; output_struct->data.memory24.alignment = temp16; /* * Get range_length (Bytes 10-11) */ - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); output_struct->data.memory24.range_length = temp16; /* @@ -184,7 +184,7 @@ acpi_rs_memory24_stream ( * The length field is static */ temp16 = 0x09; - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; /* @@ -197,25 +197,25 @@ acpi_rs_memory24_stream ( /* * Set the Range minimum base address */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.min_base_address); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); buffer += 2; /* * Set the Range maximum base address */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.max_base_address); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); buffer += 2; /* * Set the base alignment */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.alignment); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); buffer += 2; /* * Set the range length */ - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &linked_list->data.memory24.range_length); + ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); buffer += 2; /* @@ -269,7 +269,7 @@ acpi_rs_memory32_range_resource ( */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; @@ -296,27 +296,25 @@ acpi_rs_memory32_range_resource ( /* * Get min_base_address (Bytes 4-7) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.min_base_address, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); buffer += 4; /* * Get max_base_address (Bytes 8-11) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.max_base_address, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); buffer += 4; /* * Get Alignment (Bytes 12-15) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.alignment, buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); buffer += 4; /* * Get range_length (Bytes 16-19) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.memory32.range_length, buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); /* * Set the Length parameter @@ -373,7 +371,7 @@ acpi_rs_fixed_memory32_resource ( * Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); buffer += 2; *bytes_consumed = (acpi_size) temp16 + 3; @@ -390,15 +388,13 @@ acpi_rs_fixed_memory32_resource ( /* * Get range_base_address (Bytes 4-7) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, buffer); buffer += 4; /* * Get range_length (Bytes 8-11) */ - ACPI_MOVE_UNALIGNED32_TO_32 (&output_struct->data.fixed_memory32.range_length, - buffer); + ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); /* * Set the Length parameter @@ -454,7 +450,7 @@ acpi_rs_memory32_range_stream ( */ temp16 = 0x11; - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; /* @@ -467,25 +463,25 @@ acpi_rs_memory32_range_stream ( /* * Set the Range minimum base address */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); buffer += 4; /* * Set the Range maximum base address */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); buffer += 4; /* * Set the base alignment */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.alignment); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); buffer += 4; /* * Set the range length */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, &linked_list->data.memory32.range_length); + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); buffer += 4; /* @@ -537,7 +533,7 @@ acpi_rs_fixed_memory32_stream ( */ temp16 = 0x09; - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; /* @@ -550,14 +546,14 @@ acpi_rs_fixed_memory32_stream ( /* * Set the Range base address */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.fixed_memory32.range_base_address); buffer += 4; /* * Set the range length */ - ACPI_MOVE_UNALIGNED32_TO_32 (buffer, + ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.fixed_memory32.range_length); buffer += 4; diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index d9f5a4d7cebf..6b2b15106e73 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -211,7 +211,7 @@ acpi_rs_vendor_resource ( /* Dereference */ - ACPI_MOVE_UNALIGNED16_TO_16 (&temp16, buffer); + ACPI_MOVE_16_TO_16 (&temp16, buffer); /* Calculate bytes consumed */ @@ -307,7 +307,7 @@ acpi_rs_vendor_stream ( temp16 = (u16) linked_list->data.vendor_specific.length; - ACPI_MOVE_UNALIGNED16_TO_16 (buffer, &temp16); + ACPI_MOVE_16_TO_16 (buffer, &temp16); buffer += 2; } else { diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index f4da5ff47a9b..63fd9ac1df7a 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -339,20 +339,20 @@ acpi_set_current_resources ( } -#define COPY_FIELD(out, in, field) out->field = in->field -#define COPY_ADDRESS(out, in) \ - COPY_FIELD(out, in, resource_type); \ - COPY_FIELD(out, in, producer_consumer); \ - COPY_FIELD(out, in, decode); \ - COPY_FIELD(out, in, min_address_fixed); \ - COPY_FIELD(out, in, max_address_fixed); \ - COPY_FIELD(out, in, attribute); \ - COPY_FIELD(out, in, granularity); \ - COPY_FIELD(out, in, min_address_range); \ - COPY_FIELD(out, in, max_address_range); \ - COPY_FIELD(out, in, address_translation_offset); \ - COPY_FIELD(out, in, address_length); \ - COPY_FIELD(out, in, resource_source); +#define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) +#define ACPI_COPY_ADDRESS(out, in) \ + ACPI_COPY_FIELD(out, in, resource_type); \ + ACPI_COPY_FIELD(out, in, producer_consumer); \ + ACPI_COPY_FIELD(out, in, decode); \ + ACPI_COPY_FIELD(out, in, min_address_fixed); \ + ACPI_COPY_FIELD(out, in, max_address_fixed); \ + ACPI_COPY_FIELD(out, in, attribute); \ + ACPI_COPY_FIELD(out, in, granularity); \ + ACPI_COPY_FIELD(out, in, min_address_range); \ + ACPI_COPY_FIELD(out, in, max_address_range); \ + ACPI_COPY_FIELD(out, in, address_translation_offset); \ + ACPI_COPY_FIELD(out, in, address_length); \ + ACPI_COPY_FIELD(out, in, resource_source); /****************************************************************************** * @@ -385,17 +385,17 @@ acpi_resource_to_address64 ( switch (resource->id) { case ACPI_RSTYPE_ADDRESS16: address16 = (struct acpi_resource_address16 *) &resource->data; - COPY_ADDRESS(out, address16); + ACPI_COPY_ADDRESS(out, address16); break; case ACPI_RSTYPE_ADDRESS32: address32 = (struct acpi_resource_address32 *) &resource->data; - COPY_ADDRESS(out, address32); + ACPI_COPY_ADDRESS(out, address32); break; case ACPI_RSTYPE_ADDRESS64: address64 = (struct acpi_resource_address64 *) &resource->data; - COPY_ADDRESS(out, address64); + ACPI_COPY_ADDRESS(out, address64); break; default: diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 3760fb9acddd..94a9f0014905 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -133,7 +133,7 @@ acpi_tb_validate_table_header ( /* Ensure that the signature is 4 ASCII characters */ - ACPI_MOVE_UNALIGNED32_TO_32 (&signature, table_header->signature); + ACPI_MOVE_32_TO_32 (&signature, table_header->signature); if (!acpi_ut_valid_acpi_name (signature)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Table signature at %p [%p] has invalid characters\n", diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 5ca9e4421962..db29d8934cd6 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -559,8 +559,7 @@ acpi_ut_dump_buffer ( case DB_WORD_DISPLAY: - ACPI_MOVE_UNALIGNED16_TO_32 (&temp32, - &buffer[i + j]); + ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); acpi_os_printf ("%04X ", temp32); j += 2; break; @@ -568,8 +567,7 @@ acpi_ut_dump_buffer ( case DB_DWORD_DISPLAY: - ACPI_MOVE_UNALIGNED32_TO_32 (&temp32, - &buffer[i + j]); + ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); acpi_os_printf ("%08X ", temp32); j += 4; break; @@ -577,12 +575,10 @@ acpi_ut_dump_buffer ( case DB_QWORD_DISPLAY: - ACPI_MOVE_UNALIGNED32_TO_32 (&temp32, - &buffer[i + j]); + ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); acpi_os_printf ("%08X", temp32); - ACPI_MOVE_UNALIGNED32_TO_32 (&temp32, - &buffer[i + j + 4]); + ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); acpi_os_printf ("%08X ", temp32); j += 8; break; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 23955a8855dc..6894c58aa201 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -592,7 +592,7 @@ acpi_ut_mutex_terminate ( (void) acpi_ut_delete_mutex (i); } - (void) acpi_os_delete_lock (acpi_gbl_gpe_lock); + acpi_os_delete_lock (acpi_gbl_gpe_lock); return_VOID; } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 2a8c7f85d2f7..f7532f979c7f 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -47,7 +47,7 @@ /****************************************************************************** * - * Compile-time options + * Configuration options * *****************************************************************************/ @@ -62,21 +62,9 @@ * */ - -/****************************************************************************** - * - * Subsystem Constants - * - *****************************************************************************/ - - /* Version string */ -#define ACPI_CA_VERSION 0x20030328 - -/* Version of ACPI supported */ - -#define ACPI_CA_SUPPORT_LEVEL 2 +#define ACPI_CA_VERSION 0x20030418 /* Maximum objects in the various object caches */ @@ -86,6 +74,23 @@ #define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ #define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ +/* + * Should the subystem abort the loading of an ACPI table if the + * table checksum is incorrect? + */ +#define ACPI_CHECKSUM_ABORT FALSE + + +/****************************************************************************** + * + * Subsystem Constants + * + *****************************************************************************/ + +/* Version of ACPI supported */ + +#define ACPI_CA_SUPPORT_LEVEL 2 + /* String size constants */ #define ACPI_MAX_STRING_LENGTH 512 @@ -106,20 +111,6 @@ /****************************************************************************** * - * Configuration of subsystem behavior - * - *****************************************************************************/ - - -/* - * Should the subystem abort the loading of an ACPI table if the - * table checksum is incorrect? - */ -#define ACPI_CHECKSUM_ABORT FALSE - - -/****************************************************************************** - * * ACPI Specification constants (Do not change unless the specification changes) * *****************************************************************************/ @@ -196,7 +187,6 @@ * *****************************************************************************/ - #define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ #define ACPI_DEBUGGER_COMMAND_PROMPT '-' diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 502bd03e2452..59ea7c88eb5d 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -164,15 +164,17 @@ void acpi_ex_get_buffer_datum( acpi_integer *datum, void *buffer, + u32 buffer_length, u32 byte_granularity, - u32 offset); + u32 buffer_offset); void acpi_ex_set_buffer_datum ( acpi_integer merged_datum, void *buffer, + u32 buffer_length, u32 byte_granularity, - u32 offset); + u32 buffer_offset); acpi_status acpi_ex_read_data_from_field ( diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 911283ffed90..fffbddc8f532 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -196,7 +196,7 @@ struct acpi_namespace_node union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ - struct acpi_namespace_node *child; /* first child */ + struct acpi_namespace_node *child; /* First child */ struct acpi_namespace_node *peer; /* Next peer*/ u16 reference_count; /* Current count of references and children */ u8 flags; @@ -476,10 +476,10 @@ struct acpi_scope_state struct acpi_pscope_state { ACPI_STATE_COMMON - union acpi_parse_object *op; /* current op being parsed */ - u8 *arg_end; /* current argument end */ - u8 *pkg_end; /* current package end */ - u32 arg_list; /* next argument to parse */ + union acpi_parse_object *op; /* Current op being parsed */ + u8 *arg_end; /* Current argument end */ + u8 *pkg_end; /* Current package end */ + u32 arg_list; /* Next argument to parse */ u32 arg_count; /* Number of fixed arguments */ }; @@ -585,11 +585,8 @@ struct acpi_opcode_info union acpi_parse_value { - acpi_integer integer; /* integer constant (Up to 64 bits) */ + acpi_integer integer; /* Integer constant (Up to 64 bits) */ struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ - u32 integer32; /* integer constant, 32 bits only */ - u16 integer16; /* integer constant, 16 bits only */ - u8 integer8; /* integer constant, 8 bits only */ u32 size; /* bytelist or field size */ char *string; /* NULL terminated string */ u8 *buffer; /* buffer or string */ @@ -602,15 +599,15 @@ union acpi_parse_value u8 data_type; /* To differentiate various internal objs */\ u8 flags; /* Type of Op */\ u16 aml_opcode; /* AML opcode */\ - u32 aml_offset; /* offset of declaration in AML */\ - union acpi_parse_object *parent; /* parent op */\ - union acpi_parse_object *next; /* next op */\ + u32 aml_offset; /* Offset of declaration in AML */\ + union acpi_parse_object *parent; /* Parent op */\ + union acpi_parse_object *next; /* Next op */\ ACPI_DISASM_ONLY_MEMBERS (\ u8 disasm_flags; /* Used during AML disassembly */\ u8 disasm_opcode; /* Subtype used for disassembly */\ - char aml_op_name[16]) /* op name (debug only) */\ + char aml_op_name[16]) /* Op name (debug only) */\ /* NON-DEBUG members below: */\ - struct acpi_namespace_node *node; /* for use by interpreter */\ + struct acpi_namespace_node *node; /* For use by interpreter */\ union acpi_parse_value value; /* Value or args associated with the opcode */\ @@ -691,14 +688,14 @@ union acpi_parse_object struct acpi_parse_state { u32 aml_size; - u8 *aml_start; /* first AML byte */ - u8 *aml; /* next AML byte */ + u8 *aml_start; /* First AML byte */ + u8 *aml; /* Next AML byte */ u8 *aml_end; /* (last + 1) AML byte */ - u8 *pkg_start; /* current package begin */ - u8 *pkg_end; /* current package end */ - union acpi_parse_object *start_op; /* root of parse tree */ + u8 *pkg_start; /* Current package begin */ + u8 *pkg_end; /* Current package end */ + union acpi_parse_object *start_op; /* Root of parse tree */ struct acpi_namespace_node *start_node; - union acpi_generic_state *scope; /* current scope */ + union acpi_generic_state *scope; /* Current scope */ union acpi_parse_object *start_scope; }; diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 09a34a479859..7b0f65b84394 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -116,7 +116,7 @@ #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) #if ACPI_MACHINE_WIDTH == 16 -#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_UNALIGNED32_TO_32(d,s) +#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) #define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i) #else @@ -130,41 +130,169 @@ * Otherwise, we have to move one byte at a time. */ -#ifdef _HW_ALIGNMENT_SUPPORT +#ifdef ACPI_BIG_ENDIAN +/* + * Macros for big-endian machines + */ + +/* This macro sets a buffer index, starting from the end of the buffer */ + +#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran))) + +/* These macros reverse the bytes during the move, converting little-endian to big endian */ + + /* Big Endian <== Little Endian */ + /* Hi...Lo Lo...Hi */ +/* 16-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} + +#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\ + ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ + ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} + +#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ + ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ + ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} + +/* 32-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ + +#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ + (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ + (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} + +#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ + ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ + ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ + ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ + ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} + +/* 64-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ + +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ + +#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ + (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\ + (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\ + (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ + (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ + (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ + (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} +#else +/* + * Macros for little-endian machines + */ + +/* This macro sets a buffer index, starting from the beginning of the buffer */ + +#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) + +#ifdef ACPI_MISALIGNED_TRANSFERS + +/* The hardware supports unaligned transfers, just do the little-endian move */ + +#if ACPI_MACHINE_WIDTH == 16 + +/* No 64-bit integers */ +/* 16-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) +#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) +#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s) + +/* 32-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) +#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) -/* The hardware supports unaligned transfers, just do the move */ +/* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) -#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) -#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) -#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) + +#else +/* 16-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) +#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) +#define ACPI_MOVE_16_TO_64(d,s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s) + +/* 32-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) +#define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) + +/* 64-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) +#endif #else /* * The hardware does not support unaligned transfers. We must move the * data one byte at a time. These macros work whether the source or - * the destination (or both) is/are unaligned. + * the destination (or both) is/are unaligned. (Little-endian move) */ -#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ - ((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];} +/* 16-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];} + +#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} +#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} + +/* 32-bit source, 16/32/64 destination */ + +#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ + +#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ + (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ + (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];} + +#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);} + +/* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ - ((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ - ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ - ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];} +#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ + (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ + (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\ + (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\ + (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\ + (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\ + (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];} +#endif +#endif + +/* Macros based on machine integer width */ + +#if ACPI_MACHINE_WIDTH == 16 +#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) -#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(void *)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);} +#elif ACPI_MACHINE_WIDTH == 32 +#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) -#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ - ((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ - ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ - ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\ - ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\ - ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\ - ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\ - ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];} +#elif ACPI_MACHINE_WIDTH == 64 +#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s) +#else +#error unknown ACPI_MACHINE_WIDTH #endif @@ -232,21 +360,6 @@ #if ACPI_MACHINE_WIDTH != 16 -#define ACPI_PCI_DEVICE_MASK (u64) 0x0000FFFF00000000 -#define ACPI_PCI_FUNCTION_MASK (u64) 0x00000000FFFF0000 -#define ACPI_PCI_REGISTER_MASK (u64) 0x000000000000FFFF - -/* - * Obsolete - */ - -/* -#define ACPI_PCI_FUNCTION(a) (u16) ((((u64)((u64)(a) & ACPI_PCI_FUNCTION_MASK)) >> 16)) -#define ACPI_PCI_DEVICE(a) (u16) ((((u64)((u64)(a) & ACPI_PCI_DEVICE_MASK)) >> 32)) -#define ACPI_PCI_REGISTER(a) (u16) (((u64)((u64)(a) & ACPI_PCI_REGISTER_MASK))) -*/ - - #define ACPI_PCI_DEVICE(a) (u16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF) #define ACPI_PCI_FUNCTION(a) (u16) ((ACPI_LODWORD ((a))) >> 16) #define ACPI_PCI_REGISTER(a) (u16) ((ACPI_LODWORD ((a))) & 0x0000FFFF) @@ -337,10 +450,10 @@ * 5) Expand address to 64 bits */ #define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) do {a.address_space_id = (u8) d;\ - a.register_bit_width = (u8) ACPI_MUL_8 (b);\ - a.register_bit_offset = 0;\ - a.reserved = 0;\ - ACPI_STORE_ADDRESS (a.address,(acpi_physical_address) c);} while (0) + a.register_bit_width = (u8) ACPI_MUL_8 (b);\ + a.register_bit_offset = 0;\ + a.reserved = 0;\ + ACPI_STORE_ADDRESS (a.address,(acpi_physical_address) c);} while (0) /* ACPI V1.0 entries -- address space is always I/O */ @@ -351,7 +464,7 @@ * Reporting macros that are never compiled out */ -#define ACPI_PARAM_LIST(pl) pl +#define ACPI_PARAM_LIST(pl) pl /* * Error reporting. These versions add callers module and line#. Since @@ -362,9 +475,9 @@ #ifdef ACPI_DEBUG_OUTPUT #define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} + acpi_os_printf ACPI_PARAM_LIST(fp);} #define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} + acpi_os_printf ACPI_PARAM_LIST(fp);} #define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ acpi_os_printf ACPI_PARAM_LIST(fp);} #define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); @@ -408,21 +521,21 @@ * as a local string ("_proc_name) so that it can be also used by the function exit macros below. */ -#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _dbg; \ - _dbg.component_id = _COMPONENT; \ - _dbg.proc_name = a; \ - _dbg.module_name = _THIS_MODULE; - -#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a)\ - acpi_ut_trace(__LINE__,&_dbg) -#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a)\ - acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b) -#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a)\ - acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b) -#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a)\ - acpi_ut_trace_str(__LINE__,&_dbg,(char *)b) - -#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() +#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _dbg; \ + _dbg.component_id = _COMPONENT; \ + _dbg.proc_name = a; \ + _dbg.module_name = _THIS_MODULE; + +#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace(__LINE__,&_dbg) +#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b) +#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b) +#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ + acpi_ut_trace_str(__LINE__,&_dbg,(char *)b) + +#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() /* * Function exit tracing. diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 58c6d1500417..928b5f49030a 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -229,13 +229,13 @@ acpi_os_stall ( acpi_status acpi_os_read_port ( acpi_io_address address, - void *value, + u32 *value, u32 width); acpi_status acpi_os_write_port ( acpi_io_address address, - acpi_integer value, + u32 value, u32 width); @@ -246,13 +246,13 @@ acpi_os_write_port ( acpi_status acpi_os_read_memory ( acpi_physical_address address, - void *value, + u32 *value, u32 width); acpi_status acpi_os_write_memory ( acpi_physical_address address, - acpi_integer value, + u32 value, u32 width); diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index 56282d0bf1fb..de509b9fd4ec 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -181,7 +181,15 @@ struct smart_battery_description_table u32 critical_level; }; - +struct hpet_description_table +{ + struct acpi_table_header header; + u32 hardware_id; + u32 base_address[3]; + u8 hpet_number; + u16 clock_tick; + u8 attributes; +}; #pragma pack() diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index d19ff567b92f..7ffa0b226c31 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -154,7 +154,7 @@ typedef char *acpi_physical_address; typedef u16 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 -#define _HW_ALIGNMENT_SUPPORT +#define ACPI_MISALIGNED_TRANSFERS #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX @@ -192,7 +192,7 @@ typedef u64 acpi_physical_address; typedef u32 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 -#define _HW_ALIGNMENT_SUPPORT +#define ACPI_MISALIGNED_TRANSFERS #define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX @@ -1194,7 +1194,7 @@ struct acpi_resource #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) -#ifdef _HW_ALIGNMENT_SUPPORT +#ifdef ACPI_MISALIGNED_TRANSFERS #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) #else #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) |
