From 44f6c01242da4e162f28d8e1216a8c7a91174605 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Mon, 18 Apr 2005 22:49:35 -0400 Subject: ACPICA 20050408 from Bob Moore Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown --- drivers/acpi/hardware/hwregs.c | 114 ++++++++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 46 deletions(-) (limited to 'drivers/acpi/hardware/hwregs.c') diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 91af0c2ddcf..6d9e4eb8483 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -87,8 +87,9 @@ acpi_hw_clear_acpi_status ( } } - status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); + status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + ACPI_BITMASK_ALL_FIXED_STATUS); if (ACPI_FAILURE (status)) { goto unlock_and_exit; } @@ -138,28 +139,30 @@ acpi_get_sleep_type_data ( { acpi_status status = AE_OK; struct acpi_parameter_info info; + char *sleep_state_name; ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); - /* - * Validate parameters - */ + /* Validate parameters */ + if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * Evaluate the namespace object containing the values for this state - */ + /* Evaluate the namespace object containing the values for this state */ + info.parameters = NULL; - status = acpi_ns_evaluate_by_name ((char *) acpi_gbl_sleep_state_names[sleep_state], - &info); + info.return_object = NULL; + sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state]; + + status = acpi_ns_evaluate_by_name (sleep_state_name, &info); if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating sleep_state [%s]\n", - acpi_format_exception (status), acpi_gbl_sleep_state_names[sleep_state])); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "%s while evaluating sleep_state [%s]\n", + acpi_format_exception (status), sleep_state_name)); return_ACPI_STATUS (status); } @@ -167,45 +170,57 @@ acpi_get_sleep_type_data ( /* Must have a return object */ if (!info.return_object) { - ACPI_REPORT_ERROR (("Missing Sleep State object\n")); + ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n", + sleep_state_name)); status = AE_NOT_EXIST; } /* It must be of type Package */ else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { - ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); + ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n")); status = AE_AML_OPERAND_TYPE; } - /* The package must have at least two elements */ - + /* + * The package must have at least two elements. NOTE (March 2005): This + * goes against the current ACPI spec which defines this object as a + * package with one encoded DWORD element. However, existing practice + * by BIOS vendors seems to be to have 2 or more elements, at least + * one per sleep type (A/B). + */ else if (info.return_object->package.count < 2) { - ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); + ACPI_REPORT_ERROR (( + "Sleep State return package does not have at least two elements\n")); status = AE_AML_NO_OPERAND; } /* The first two elements must both be of type Integer */ - else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) != ACPI_TYPE_INTEGER) || - (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { - ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", + else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) + != ACPI_TYPE_INTEGER) || + (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) + != ACPI_TYPE_INTEGER)) { + ACPI_REPORT_ERROR (( + "Sleep State return package elements are not both Integers (%s, %s)\n", acpi_ut_get_object_type_name (info.return_object->package.elements[0]), acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); status = AE_AML_OPERAND_TYPE; } else { - /* - * Valid _Sx_ package size, type, and value - */ - *sleep_type_a = (u8) (info.return_object->package.elements[0])->integer.value; - *sleep_type_b = (u8) (info.return_object->package.elements[1])->integer.value; + /* Valid _Sx_ package size, type, and value */ + + *sleep_type_a = (u8) + (info.return_object->package.elements[0])->integer.value; + *sleep_type_b = (u8) + (info.return_object->package.elements[1])->integer.value; } if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "While evaluating sleep_state [%s], bad Sleep object %p type %s\n", - acpi_gbl_sleep_state_names[sleep_state], info.return_object, + "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", + acpi_format_exception (status), + sleep_state_name, info.return_object, acpi_ut_get_object_type_name (info.return_object))); } @@ -221,9 +236,9 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); * * PARAMETERS: register_id - Index of ACPI Register to access * - * RETURN: The bit mask to be used when accessing the register + * RETURN: The bitmask to be used when accessing the register * - * DESCRIPTION: Map register_id into a register bit mask. + * DESCRIPTION: Map register_id into a register bitmask. * ******************************************************************************/ @@ -359,7 +374,7 @@ acpi_set_register ( /* Always do a register read first so we can insert the new bits */ status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, - bit_reg_info->parent_register, ®ister_value); + bit_reg_info->parent_register, ®ister_value); if (ACPI_FAILURE (status)) { goto unlock_and_exit; } @@ -396,7 +411,7 @@ acpi_set_register ( bit_reg_info->access_bit_mask, value); status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_ENABLE, (u16) register_value); + ACPI_REGISTER_PM1_ENABLE, (u16) register_value); break; @@ -413,7 +428,7 @@ acpi_set_register ( bit_reg_info->access_bit_mask, value); status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, (u16) register_value); + ACPI_REGISTER_PM1_CONTROL, (u16) register_value); break; @@ -427,17 +442,19 @@ acpi_set_register ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", register_value, - ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); + ACPI_FORMAT_UINT64 ( + acpi_gbl_FADT->xpm2_cnt_blk.address))); ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, bit_reg_info->access_bit_mask, value); ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", register_value, - ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); + ACPI_FORMAT_UINT64 ( + acpi_gbl_FADT->xpm2_cnt_blk.address))); status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); + ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); break; @@ -454,7 +471,9 @@ unlock_and_exit: /* Normalize the value that was read */ - ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position)); + ACPI_DEBUG_EXEC (register_value = + ((register_value & bit_reg_info->access_bit_mask) >> + bit_reg_info->bit_position)); ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", value, register_value, bit_reg_info->parent_register)); @@ -469,7 +488,7 @@ EXPORT_SYMBOL(acpi_set_register); * * PARAMETERS: use_lock - Mutex hw access * register_id - register_iD + Offset - * return_value - Value that was read from the register + * return_value - Where the register value is returned * * RETURN: Status and the value read. * @@ -557,7 +576,8 @@ acpi_hw_register_read ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", register_id)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", + register_id)); status = AE_BAD_PARAMETER; break; } @@ -763,10 +783,11 @@ acpi_hw_low_level_read ( return (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *value, width, - ACPI_FORMAT_UINT64 (address), - acpi_ut_get_region_name (reg->address_space_id))); + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *value, width, + ACPI_FORMAT_UINT64 (address), + acpi_ut_get_region_name (reg->address_space_id))); return (status); } @@ -841,10 +862,11 @@ acpi_hw_low_level_write ( return (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - value, width, - ACPI_FORMAT_UINT64 (address), - acpi_ut_get_region_name (reg->address_space_id))); + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + value, width, + ACPI_FORMAT_UINT64 (address), + acpi_ut_get_region_name (reg->address_space_id))); return (status); } -- cgit v1.2.3