Commit 42af0cb8 authored by Andy Grover's avatar Andy Grover

ACPI: Interpreter update to 20030619

- Fix To/FromBCD, eliminating the need for an arch-specific #define
- Do not acquire a semaphore in the S5 shutdown path
- Fix ex_digits_needed for 0 (Takayoshi Kochi)
- Fix sleep/stall code reversal (Andi Kleen)
- Revert a change having to do with control method calling semantics
parent 6f982794
......@@ -306,7 +306,6 @@ acpi_ds_method_data_set_value (
{
acpi_status status;
struct acpi_namespace_node *node;
union acpi_operand_object *new_desc = object;
ACPI_FUNCTION_TRACE ("ds_method_data_set_value");
......@@ -325,28 +324,16 @@ acpi_ds_method_data_set_value (
}
/*
* If the object has just been created and is not attached to anything,
* (the reference count is 1), then we can just store it directly into
* the arg/local. Otherwise, we must copy it.
* Increment ref count so object can't be deleted while installed.
* NOTE: We do not copy the object in order to preserve the call by
* reference semantics of ACPI Control Method invocation.
* (See ACPI specification 2.0_c)
*/
if (object->common.reference_count > 1) {
status = acpi_ut_copy_iobject_to_iobject (object, &new_desc, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object Copied %p, new %p\n",
object, new_desc));
}
else {
/* Increment ref count so object can't be deleted while installed */
acpi_ut_add_reference (new_desc);
}
acpi_ut_add_reference (object);
/* Install the object */
node->object = new_desc;
node->object = object;
return_ACPI_STATUS (status);
}
......
......@@ -186,11 +186,13 @@ acpi_ev_gpe_detect (
}
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE block at %8.8X%8.8X - Values: Enable %02X Status %02X\n",
"GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n",
ACPI_HIDWORD (gpe_register_info->status_address.address),
ACPI_LODWORD (gpe_register_info->status_address.address),
gpe_register_info->status,
ACPI_HIDWORD (gpe_register_info->enable_address.address),
ACPI_LODWORD (gpe_register_info->enable_address.address),
gpe_register_info->enable,
gpe_register_info->status));
gpe_register_info->enable));
/* First check if there is anything active at all in this register */
......
......@@ -76,9 +76,14 @@ acpi_ev_valid_gpe_event (
/* No need for spin lock since we are not changing any list elements */
/* Walk the GPE interrupt levels */
gpe_xrupt_block = acpi_gbl_gpe_xrupt_list_head;
while (gpe_xrupt_block) {
gpe_block = gpe_xrupt_block->gpe_block_list_head;
/* Walk the GPE blocks on this interrupt level */
while (gpe_block) {
if ((&gpe_block->event_info[0] <= gpe_event_info) &&
(&gpe_block->event_info[((acpi_size) gpe_block->register_count) * 8] > gpe_event_info)) {
......@@ -155,7 +160,7 @@ acpi_ev_walk_gpe_list (
*
* PARAMETERS: Callback from walk_namespace
*
* RETURN: None
* RETURN: Status
*
* DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a
* control method under the _GPE portion of the namespace.
......@@ -196,7 +201,8 @@ acpi_ev_save_method_info (
name[ACPI_NAME_SIZE] = 0;
/*
* Edge/Level determination is based on the 2nd character of the method name
* Edge/Level determination is based on the 2nd character
* of the method name
*/
switch (name[1]) {
case 'L':
......@@ -249,15 +255,14 @@ acpi_ev_save_method_info (
gpe_event_info->flags = type;
gpe_event_info->method_node = (struct acpi_namespace_node *) obj_handle;
/*
* Enable the GPE (SCIs should be disabled at this point)
*/
/* Enable the GPE (SCIs should be disabled at this point) */
status = acpi_hw_enable_gpe (gpe_event_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Registered GPE method %s as GPE number 0x%.2X\n",
name, gpe_number));
return_ACPI_STATUS (AE_OK);
......@@ -867,8 +872,8 @@ acpi_ev_gpe_initialize (void)
}
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number space,
* But, GPE0 always starts at zero.
* GPE0 and GPE1 do not have to be contiguous in the GPE number
* space. However, GPE0 always starts at GPE number zero.
*/
gpe_number_max = acpi_gbl_FADT->gpe1_base +
((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
......
......@@ -222,7 +222,7 @@ acpi_ex_opcode_1A_1T_1R (
union acpi_operand_object *return_desc2 = NULL;
u32 temp32;
u32 i;
u32 j;
u32 power_of_ten;
acpi_integer digit;
......@@ -291,61 +291,70 @@ acpi_ex_opcode_1A_1T_1R (
case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
/*
* The 64-bit ACPI integer can hold 16 4-bit BCD integers
* The 64-bit ACPI integer can hold 16 4-bit BCD characters
* (if table is 32-bit, integer can hold 8 BCD characters)
* Convert each 4-bit BCD value
*/
power_of_ten = 1;
return_desc->integer.value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
/* Get one BCD digit */
digit = operand[0]->integer.value;
/* Convert each BCD digit (each is one nybble wide) */
digit = (acpi_integer) ((operand[0]->integer.value >> (i * 4)) & 0xF);
for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
/* Get the least significant 4-bit BCD digit */
temp32 = ((u32) digit) & 0xF;
/* Check the range of the digit */
if (digit > 9) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n",
(u32) digit));
if (temp32 > 9) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"BCD digit too large (not decimal): 0x%X\n",
temp32));
status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup;
}
if (digit > 0) {
/* Sum into the result with the appropriate power of 10 */
/* Sum the digit into the result with the current power of 10 */
for (j = 0; j < i; j++) {
digit *= 10;
}
return_desc->integer.value += (((acpi_integer) temp32) * power_of_ten);
return_desc->integer.value += digit;
}
/* Shift to next BCD digit */
digit >>= 4;
/* Next power of 10 */
power_of_ten *= 10;
}
break;
case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */
if (operand[0]->integer.value > ACPI_MAX_BCD_VALUE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
ACPI_HIDWORD(operand[0]->integer.value),
ACPI_LODWORD(operand[0]->integer.value)));
status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup;
}
return_desc->integer.value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) {
/* Divide by nth factor of 10 */
temp32 = 0;
digit = operand[0]->integer.value;
for (j = 0; j < i; j++) {
/* Each BCD digit is one nybble wide */
for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
(void) acpi_ut_short_divide (&digit, 10, &digit, &temp32);
/* Insert the BCD digit that resides in the remainder from above */
return_desc->integer.value |= (((acpi_integer) temp32) << (i * 4));
}
/* Create the BCD digit from the remainder above */
/* Overflow if there is any data left in Digit */
if (digit > 0) {
return_desc->integer.value += ((acpi_integer) temp32 << (i * 4));
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Integer too large to convert to BCD: %8.8X%8.8X\n",
ACPI_HIDWORD(operand[0]->integer.value),
ACPI_LODWORD(operand[0]->integer.value)));
status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup;
}
break;
......
......@@ -190,8 +190,8 @@ acpi_ex_store (
case ACPI_TYPE_INTEGER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
ACPI_HIWORD (source_desc->integer.value),
ACPI_LOWORD (source_desc->integer.value)));
ACPI_HIDWORD (source_desc->integer.value),
ACPI_LODWORD (source_desc->integer.value)));
break;
......
......@@ -134,7 +134,7 @@ acpi_ex_system_do_stall (
acpi_ex_exit_interpreter ();
acpi_os_stall (how_long);
acpi_os_sleep (0, (how_long / 1000) + 1);
/* And now we must get the interpreter again */
......@@ -142,7 +142,7 @@ acpi_ex_system_do_stall (
}
else {
acpi_os_sleep (0, (how_long / 1000) + 1);
acpi_os_stall (how_long);
}
return (status);
......
......@@ -289,7 +289,10 @@ acpi_ex_digits_needed (
/*
* acpi_integer is unsigned, so we don't worry about a '-'
*/
current_value = value;
if ((current_value = value) == 0) {
return_VALUE (1);
}
num_digits = 0;
while (current_value) {
......
......@@ -56,7 +56,7 @@
*
* FUNCTION: acpi_hw_clear_acpi_status
*
* PARAMETERS: none
* PARAMETERS: Flags - Lock the hardware or not
*
* RETURN: none
*
......@@ -65,7 +65,8 @@
******************************************************************************/
acpi_status
acpi_hw_clear_acpi_status (void)
acpi_hw_clear_acpi_status (
u32 flags)
{
acpi_status status;
......@@ -77,11 +78,12 @@ acpi_hw_clear_acpi_status (void)
ACPI_BITMASK_ALL_FIXED_STATUS,
(u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
if (flags & ACPI_MTX_LOCK) {
status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
ACPI_BITMASK_ALL_FIXED_STATUS);
......@@ -104,7 +106,9 @@ acpi_hw_clear_acpi_status (void)
status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
unlock_and_exit:
if (flags & ACPI_MTX_LOCK) {
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
}
return_ACPI_STATUS (status);
}
......@@ -237,8 +241,9 @@ acpi_hw_get_bit_register_info (
*
* FUNCTION: acpi_get_register
*
* PARAMETERS: register_id - Index of ACPI Register to access
* use_lock - Lock the hardware
* PARAMETERS: register_id - ID of ACPI bit_register to access
* return_value - Value that was read from the register
* Flags - Lock the hardware or not
*
* RETURN: Value is read from specified Register. Value returned is
* normalized to bit0 (is shifted all the way right)
......@@ -290,7 +295,8 @@ acpi_get_register (
*return_value = register_value;
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %X\n", register_value));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
register_value, bit_reg_info->parent_register));
}
return_ACPI_STATUS (status);
......@@ -443,7 +449,8 @@ acpi_set_register (
ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register Write actual %X\n", register_value));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
value, register_value, bit_reg_info->parent_register));
return_ACPI_STATUS (status);
}
......@@ -751,10 +758,15 @@ acpi_hw_low_level_read (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unsupported address space: %X\n", reg->address_space_id));
status = AE_BAD_PARAMETER;
break;
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_HIDWORD (reg->address),
ACPI_LODWORD (reg->address),
acpi_ut_get_region_name (reg->address_space_id)));
return (status);
}
......@@ -832,9 +844,14 @@ acpi_hw_low_level_write (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unsupported address space: %X\n", reg->address_space_id));
status = AE_BAD_PARAMETER;
break;
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_HIDWORD (reg->address),
ACPI_LODWORD (reg->address),
acpi_ut_get_region_name (reg->address_space_id)));
return (status);
}
......@@ -231,7 +231,7 @@ acpi_enter_sleep_state (
return_ACPI_STATUS (status);
}
status = acpi_hw_clear_acpi_status();
status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -355,7 +355,7 @@ acpi_enter_sleep_state_s4bios (
ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_s4bios");
acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
acpi_hw_clear_acpi_status();
acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
acpi_hw_disable_non_wakeup_gpes();
......
......@@ -287,10 +287,14 @@ acpi_tb_convert_fadt1 (
(acpi_physical_address) (local_fadt->xpm1a_evt_blk.address +
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
/* PM1B is optional; leave null if not present */
if (local_fadt->xpm1b_evt_blk.address) {
acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
(u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
(acpi_physical_address) (local_fadt->xpm1b_evt_blk.address +
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
}
}
......@@ -379,11 +383,15 @@ acpi_tb_convert_fadt2 (
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id;
/* PM1B is optional; leave null if not present */
if (local_fadt->xpm1b_evt_blk.address) {
acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
(u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
(acpi_physical_address) (local_fadt->xpm1b_evt_blk.address +
ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id;
}
}
......
......@@ -203,10 +203,12 @@ acpi_ut_set_integer_width (
if (revision <= 1) {
acpi_gbl_integer_bit_width = 32;
acpi_gbl_integer_nybble_width = 8;
acpi_gbl_integer_byte_width = 4;
}
else {
acpi_gbl_integer_bit_width = 64;
acpi_gbl_integer_nybble_width = 16;
acpi_gbl_integer_byte_width = 8;
}
}
......
......@@ -64,7 +64,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20030522
#define ACPI_CA_VERSION 0x20030619
/* Maximum objects in the various object caches */
......
......@@ -105,6 +105,7 @@ ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
*/
ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
......
......@@ -108,7 +108,7 @@ acpi_hw_low_level_write (
acpi_status
acpi_hw_clear_acpi_status (
void);
u32 flags);
/* GPE support */
......
......@@ -287,15 +287,15 @@ acpi_os_derive_pci_id(
* Miscellaneous
*/
BOOLEAN
u8
acpi_os_readable (
void *pointer,
u32 length);
acpi_size length);
BOOLEAN
u8
acpi_os_writable (
void *pointer,
u32 length);
acpi_size length);
u32
acpi_os_get_timer (
......
......@@ -50,11 +50,14 @@
/*
* Data type ranges
* Note: These macros are designed to be compiler independent as well as
* working around problems that some 32-bit compilers have with 64-bit
* constants.
*/
#define ACPI_UINT8_MAX (~((UINT8) 0))
#define ACPI_UINT16_MAX (~((UINT16) 0))
#define ACPI_UINT32_MAX (~((UINT32) 0))
#define ACPI_UINT64_MAX (~((UINT64) 0))
#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */
#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */
#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */
#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
#define ACPI_ASCII_MAX 0x7F
......@@ -299,8 +302,6 @@ struct uint32_struct
typedef u32 acpi_integer;
#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
#define ACPI_INTEGER_BIT_SIZE 32
#define ACPI_MAX_BCD_VALUE 99999999
#define ACPI_MAX_BCD_DIGITS 8
#define ACPI_MAX_DECIMAL_DIGITS 10
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
......@@ -313,12 +314,6 @@ typedef u32 acpi_integer;
typedef u64 acpi_integer;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_MAX_BCD_VALUE 9999999999999999UL
#else
#define ACPI_MAX_BCD_VALUE 9999999999999999ULL
#endif
#define ACPI_MAX_BCD_DIGITS 16
#define ACPI_MAX_DECIMAL_DIGITS 19
#if ACPI_MACHINE_WIDTH == 64
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment