Commit a4d5fc0a authored by Len Brown's avatar Len Brown

Merge intel.com:/home/lenb/bk/linux-2.6.0

into intel.com:/home/lenb/bk/linux-acpi-test-2.6.0
parents d0a2fba8 cb89f311
......@@ -33,7 +33,6 @@
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
......
......@@ -92,6 +92,9 @@ acpi_ex_add_table (
/* Install the new table into the local data structures */
ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
table_info.type = 5;
table_info.pointer = table;
table_info.length = (acpi_size) table->length;
table_info.allocation = ACPI_MEM_ALLOCATED;
......@@ -178,7 +181,7 @@ acpi_ex_load_table_op (
return_ACPI_STATUS (status);
}
/* Not found, return an Integer=0 and AE_OK */
/* Table not found, return an Integer=0 and AE_OK */
ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!ddb_handle) {
......@@ -248,9 +251,11 @@ acpi_ex_load_table_op (
walk_state);
if (ACPI_FAILURE (status)) {
(void) acpi_ex_unload_table (ddb_handle);
return_ACPI_STATUS (status);
}
}
*return_desc = ddb_handle;
return_ACPI_STATUS (status);
}
......@@ -417,7 +422,7 @@ acpi_status
acpi_ex_unload_table (
union acpi_operand_object *ddb_handle)
{
acpi_status status = AE_NOT_IMPLEMENTED;
acpi_status status = AE_OK;
union acpi_operand_object *table_desc = ddb_handle;
struct acpi_table_desc *table_info;
......
......@@ -160,10 +160,10 @@ acpi_ex_read_data_from_field (
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n",
"field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n",
obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"field_write: bit_len=%X bit_off=%X byte_off=%X\n",
"field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
obj_desc->common_field.bit_length,
obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.base_byte_offset));
......@@ -335,10 +335,13 @@ acpi_ex_write_data_to_field (
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n",
obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, length));
"field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"field_read: bit_len=%X bit_off=%X byte_off=%X\n",
"field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
ACPI_GET_OBJECT_TYPE (obj_desc),
obj_desc->common_field.bit_length,
obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.base_byte_offset));
......
......@@ -64,7 +64,8 @@
* RETURN: Status
*
* DESCRIPTION: Common processing for acpi_ex_extract_from_field and
* acpi_ex_insert_into_field. Initialize the
* acpi_ex_insert_into_field. Initialize the Region if necessary and
* validate the request.
*
******************************************************************************/
......@@ -96,7 +97,7 @@ acpi_ex_setup_region (
* If the Region Address and Length have not been previously evaluated,
* evaluate them now and save the results.
*/
if (!(rgn_desc->region.flags & AOPOBJ_DATA_VALID)) {
if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) {
status = acpi_ds_get_region_arguments (rgn_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
......@@ -109,6 +110,18 @@ acpi_ex_setup_region (
return_ACPI_STATUS (AE_OK);
}
#ifdef ACPI_UNDER_DEVELOPMENT
/*
* If the Field access is any_acc, we can now compute the optimal
* access (because we know know the length of the parent region)
*/
if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
#endif
/*
* Validate the request. The entire request from the byte offset for a
* length of one field datum (access width) must fit within the region.
......@@ -242,7 +255,7 @@ acpi_ex_access_region (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
" Region[%s-%X] Access %X Base:Off %X:%X at %8.8X%8.8X\n",
" Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
acpi_ut_get_region_name (rgn_desc->region.space_id),
rgn_desc->region.space_id,
obj_desc->common_field.access_byte_width,
......@@ -365,10 +378,10 @@ acpi_ex_field_datum_io (
/*
* The four types of fields are:
*
* buffer_fields - Read/write from/to a Buffer
* region_fields - Read/write from/to a Operation Region.
* bank_fields - Write to a Bank Register, then read/write from/to an op_region
* index_fields - Write to an Index Register, then read/write from/to a Data Register
* buffer_field - Read/write from/to a Buffer
* region_field - Read/write from/to a Operation Region.
* bank_field - Write to a Bank Register, then read/write from/to an op_region
* index_field - Write to an Index Register, then read/write from/to a Data Register
*/
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER_FIELD:
......@@ -458,24 +471,34 @@ acpi_ex_field_datum_io (
/* Write the index value to the index_register (itself a region_field) */
field_datum_byte_offset += obj_desc->index_field.value;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Write to Index Register: Value %8.8X\n",
field_datum_byte_offset));
status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
&obj_desc->index_field.value,
sizeof (obj_desc->index_field.value));
&field_datum_byte_offset,
sizeof (field_datum_byte_offset));
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"I/O to Data Register: value_ptr %p\n",
value));
if (read_write == ACPI_READ) {
/* Read the datum from the data_register */
status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj,
value, obj_desc->common_field.access_byte_width);
value, sizeof (acpi_integer));
}
else {
/* Write the datum to the Data register */
/* Write the datum to the data_register */
status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
value, obj_desc->common_field.access_byte_width);
value, sizeof (acpi_integer));
}
break;
......@@ -490,12 +513,14 @@ acpi_ex_field_datum_io (
if (ACPI_SUCCESS (status)) {
if (read_write == ACPI_READ) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n",
ACPI_HIDWORD (*value), ACPI_LODWORD (*value)));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n",
ACPI_HIDWORD (*value), ACPI_LODWORD (*value),
obj_desc->common_field.access_byte_width));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n",
ACPI_HIDWORD (*value), ACPI_LODWORD (*value)));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n",
ACPI_HIDWORD (*value), ACPI_LODWORD (*value),
obj_desc->common_field.access_byte_width));
}
}
......@@ -554,6 +579,10 @@ acpi_ex_write_with_update_rule (
*/
status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
&current_value, ACPI_READ);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
merged_value |= (current_value & ~mask);
}
break;
......@@ -573,6 +602,7 @@ acpi_ex_write_with_update_rule (
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"write_with_update_rule: Unknown update_rule setting: %X\n",
(obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK)));
......@@ -580,18 +610,19 @@ acpi_ex_write_with_update_rule (
}
}
/* Write the merged value */
status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
&merged_value, ACPI_WRITE);
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Mask %8.8X%8.8X datum_offset %X Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
"Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
ACPI_HIDWORD (mask), ACPI_LODWORD (mask),
field_datum_byte_offset,
obj_desc->common_field.access_byte_width,
ACPI_HIDWORD (field_value), ACPI_LODWORD (field_value),
ACPI_HIDWORD (merged_value),ACPI_LODWORD (merged_value)));
/* Write the merged value */
status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
&merged_value, ACPI_WRITE);
return_ACPI_STATUS (status);
}
......@@ -625,7 +656,7 @@ acpi_ex_get_buffer_datum (
u32 index;
ACPI_FUNCTION_ENTRY ();
ACPI_FUNCTION_TRACE_U32 ("ex_get_buffer_datum", byte_granularity);
/* Get proper index into buffer (handles big/little endian) */
......@@ -659,6 +690,8 @@ acpi_ex_get_buffer_datum (
/* Should not get here */
break;
}
return_VOID;
}
......@@ -690,7 +723,8 @@ acpi_ex_set_buffer_datum (
{
u32 index;
ACPI_FUNCTION_ENTRY ();
ACPI_FUNCTION_TRACE_U32 ("ex_set_buffer_datum", byte_granularity);
/* Get proper index into buffer (handles big/little endian) */
......@@ -724,6 +758,8 @@ acpi_ex_set_buffer_datum (
/* Should not get here */
break;
}
return_VOID;
}
......@@ -777,7 +813,7 @@ acpi_ex_extract_from_field (
obj_desc->common_field.access_byte_width);
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"byte_len=%X, datum_len=%X, byte_gran=%X\n",
"byte_len %X, datum_len %X, byte_gran %X\n",
byte_field_length, datum_count,obj_desc->common_field.access_byte_width));
/*
......@@ -942,20 +978,27 @@ acpi_ex_insert_into_field (
* larger than the field, this typically happens when an integer is
* written to a field that is actually smaller than an integer.
*/
byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (
obj_desc->common_field.bit_length);
if (buffer_length < byte_field_length) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Buffer length %X too small for field %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Buffer length %X too small for field %X\n",
buffer_length, byte_field_length));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (
obj_desc->common_field.start_field_bit_offset +
obj_desc->common_field.bit_length);
/* Convert byte count to datum count, round up if necessary */
datum_count = ACPI_ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
datum_count = ACPI_ROUND_UP_TO (byte_field_length,
obj_desc->common_field.access_byte_width);
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"byte_len=%X, datum_len=%X, byte_gran=%X\n",
"Bytes %X, Datums %X, byte_gran %X\n",
byte_field_length, datum_count, obj_desc->common_field.access_byte_width));
/*
......@@ -1006,6 +1049,10 @@ acpi_ex_insert_into_field (
return_ACPI_STATUS (status);
}
/* We just wrote the first datum */
datum_offset++;
/* If the entire field fits within one datum, we are done. */
if ((datum_count == 1) &&
......@@ -1025,7 +1072,6 @@ acpi_ex_insert_into_field (
* applied in Part3 below.
*/
while (datum_offset < datum_count) {
datum_offset++;
field_datum_byte_offset += obj_desc->common_field.access_byte_width;
/*
......@@ -1057,12 +1103,14 @@ acpi_ex_insert_into_field (
* a datum boundary. Update Rule must be applied to the bits outside
* the field.
*/
if (datum_offset == datum_count) {
datum_offset++;
if ((datum_offset == datum_count) &&
(obj_desc->common_field.end_field_valid_bits)) {
/*
* If there are dangling non-aligned bits, perform one more merged write
* Else - field is aligned at the end, no need for any more writes
*/
if (obj_desc->common_field.end_field_valid_bits) {
/*
* Part3:
* This is the last datum and the field does not end on a datum boundary.
......@@ -1081,9 +1129,8 @@ acpi_ex_insert_into_field (
return_ACPI_STATUS (status);
}
}
}
else {
/* Normal case -- write the completed datum */
/* Normal (aligned) case -- write the completed datum */
status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
&merged_datum, ACPI_WRITE);
......
......@@ -524,7 +524,7 @@ acpi_ex_opcode_1A_0T_1R (
acpi_integer value;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */
......
This diff is collapsed.
......@@ -47,6 +47,8 @@
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
......@@ -243,12 +245,26 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_LOCAL_REFERENCE:
switch (source_desc->reference.opcode) {
case AML_LOAD_OP:
/* This is a ddb_handle */
/* Return an additional reference to the object */
obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
break;
default:
/* No named references are allowed here */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X\n",
source_desc->reference.opcode));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n",
source_desc->reference.opcode,
acpi_ps_get_opcode_name (source_desc->reference.opcode)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
/* Default case is for unknown types */
......
......@@ -48,6 +48,7 @@
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_EXECUTER
......@@ -248,6 +249,7 @@ acpi_ex_resolve_object_to_value (
case AML_REF_OF_OP:
case AML_DEBUG_OP:
case AML_LOAD_OP:
/* Just leave the object as-is */
......@@ -256,8 +258,8 @@ acpi_ex_resolve_object_to_value (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X in %p\n",
opcode, stack_desc));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X (%s) in %p\n",
opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
status = AE_AML_INTERNAL;
break;
}
......
......@@ -224,6 +224,7 @@ acpi_ex_resolve_operands (
case AML_REF_OF_OP:
case AML_ARG_OP:
case AML_LOCAL_OP:
case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Reference Opcode: %s\n", op_info->name)));
......@@ -231,8 +232,9 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown Reference Opcode %X\n",
obj_desc->reference.opcode));
"Unknown Reference Opcode %X [%s]\n",
obj_desc->reference.opcode,
(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
......@@ -378,6 +380,13 @@ acpi_ex_resolve_operands (
type_needed = ACPI_TYPE_ANY;
break;
case ARGI_DDBHANDLE:
/* Need an operand of type ACPI_TYPE_DDB_HANDLE */
type_needed = ACPI_TYPE_LOCAL_REFERENCE;
break;
/*
* The more complex cases allow multiple resolved object types
......
......@@ -46,6 +46,7 @@
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
......@@ -116,7 +117,8 @@ acpi_ex_resolve_object (
*/
if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)) {
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) &&
!((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
/*
* Conversion successful but still not a valid type
*/
......
......@@ -129,18 +129,13 @@ acpi_ex_system_do_stall (
ACPI_FUNCTION_ENTRY ();
if (how_long > 1000) /* 1 millisecond */ {
/* Since this thread will sleep, we must release the interpreter */
acpi_ex_exit_interpreter ();
acpi_os_sleep (0, (how_long / 1000) + 1);
/* And now we must get the interpreter again */
status = acpi_ex_enter_interpreter ();
if (how_long > 100) /* 100 microseconds */ {
/*
* Longer than 100 usec, use sleep instead
* (according to ACPI specification)
*/
status = acpi_ex_system_do_suspend ((how_long / 1000) + 1);
}
else {
acpi_os_stall (how_long);
}
......
......@@ -208,6 +208,15 @@ acpi_hw_get_mode (void)
ACPI_FUNCTION_TRACE ("hw_get_mode");
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
if (!acpi_gbl_FADT->smi_cmd) {
return_VALUE (ACPI_SYS_MODE_ACPI);
}
status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) {
return_VALUE (ACPI_SYS_MODE_LEGACY);
......
......@@ -94,6 +94,12 @@ acpi_rs_address16_resource (
buffer += 1;
ACPI_MOVE_16_TO_16 (&temp16, buffer);
/* Validate minimum descriptor length */
if (temp16 < 13) {
return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
}
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS16;
......@@ -199,8 +205,11 @@ acpi_rs_address16_resource (
* pointer to where the null terminated string goes:
* Each Interrupt takes 32-bits + the 5 bytes of the
* stream that are default.
*
* Note: Some resource descriptors will have an additional null, so
* we add 1 to the length.
*/
if (*bytes_consumed > 16) {
if (*bytes_consumed > (16 + 1)) {
/* Dereference the Index */
temp8 = *buffer;
......@@ -470,8 +479,14 @@ acpi_rs_address32_resource (
*/
buffer += 1;
ACPI_MOVE_16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
/* Validate minimum descriptor length */
if (temp16 < 23) {
return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
}
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS32;
/*
......@@ -578,8 +593,11 @@ acpi_rs_address32_resource (
* This will leave us pointing to the Resource Source Index
* If it is present, then save it off and calculate the
* pointer to where the null terminated string goes:
*
* Note: Some resource descriptors will have an additional null, so
* we add 1 to the length.
*/
if (*bytes_consumed > 26) {
if (*bytes_consumed > (26 + 1)) {
/* Dereference the Index */
temp8 = *buffer;
......@@ -848,6 +866,12 @@ acpi_rs_address64_resource (
buffer += 1;
ACPI_MOVE_16_TO_16 (&temp16, buffer);
/* Validate minimum descriptor length */
if (temp16 < 43) {
return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
}
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS64;
......@@ -958,8 +982,11 @@ acpi_rs_address64_resource (
* pointer to where the null terminated string goes:
* Each Interrupt takes 32-bits + the 5 bytes of the
* stream that are default.
*
* Note: Some resource descriptors will have an additional null, so
* we add 1 to the length.
*/
if (*bytes_consumed > 46) {
if (*bytes_consumed > (46 + 1)) {
/* Dereference the Index */
temp8 = *buffer;
......@@ -992,7 +1019,6 @@ acpi_rs_address64_resource (
* Add the terminating null
*/
*temp_ptr = 0x00;
output_struct->data.address64.resource_source.string_length = index + 1;
/*
......@@ -1064,7 +1090,6 @@ acpi_rs_address64_stream (
/*
* Set a pointer to the Length field - to be filled in later
*/
length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2;
......
......@@ -319,6 +319,12 @@ acpi_rs_extended_irq_resource (
buffer += 1;
ACPI_MOVE_16_TO_16 (&temp16, buffer);
/* Validate minimum descriptor length */
if (temp16 < 6) {
return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
}
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_EXT_IRQ;
......@@ -357,6 +363,12 @@ acpi_rs_extended_irq_resource (
buffer += 1;
temp8 = *buffer;
/* Must have at least one IRQ */
if (temp8 < 1) {
return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
}
output_struct->data.extended_irq.number_of_interrupts = temp8;
/*
......@@ -388,9 +400,12 @@ acpi_rs_extended_irq_resource (
* pointer to where the null terminated string goes:
* Each Interrupt takes 32-bits + the 5 bytes of the
* stream that are default.
*
* Note: Some resource descriptors will have an additional null, so
* we add 1 to the length.
*/
if (*bytes_consumed >
((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + 5) {
((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + (5 + 1)) {
/* Dereference the Index */
temp8 = *buffer;
......
......@@ -131,7 +131,7 @@ acpi_tb_convert_to_xsdt (
/* Copy the header and set the length */
ACPI_MEMCPY (new_table, table_info->pointer, sizeof (struct acpi_table_header));
new_table->header.length = (u32) table_size;
new_table->length = (u32) table_size;
/* Copy the table pointers */
......@@ -430,17 +430,17 @@ acpi_tb_convert_table_fadt (void)
* FADT length and version validation. The table must be at least as
* long as the version 1.0 FADT
*/
if (acpi_gbl_FADT->header.length < sizeof (struct fadt_descriptor_rev1)) {
ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", acpi_gbl_FADT->header.length));
if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) {
ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", acpi_gbl_FADT->length));
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}
if (acpi_gbl_FADT->header.revision >= FADT2_REVISION_ID) {
if (acpi_gbl_FADT->header.length < sizeof (struct fadt_descriptor_rev2)) {
if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) {
/* Length is too short to be a V2.0 table */
ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.revision));
acpi_gbl_FADT->length, acpi_gbl_FADT->revision));
acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
}
......@@ -460,7 +460,7 @@ acpi_tb_convert_table_fadt (void)
* Global FADT pointer will point to the new common V2.0 FADT
*/
acpi_gbl_FADT = local_fadt;
acpi_gbl_FADT->header.length = sizeof (FADT_DESCRIPTOR);
acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR);
/* Free the original table */
......@@ -477,8 +477,8 @@ acpi_tb_convert_table_fadt (void)
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of common internal FADT, size %d (%X)\n",
acpi_gbl_FADT->header.length, acpi_gbl_FADT->header.length));
ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->header.length);
acpi_gbl_FADT->length, acpi_gbl_FADT->length));
ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length);
return_ACPI_STATUS (AE_OK);
}
......
......@@ -425,14 +425,15 @@ acpi_tb_delete_tables_by_type (
break;
}
/* Free the table */
/* Get the head of the list */
/*
* Free the table
* 1) Get the head of the list
*/
table_desc = acpi_gbl_table_lists[type].next;
count = acpi_gbl_table_lists[type].count;
/*
* Walk the entire list, deleting both the allocated tables
* 2) Walk the entire list, deleting both the allocated tables
* and the table descriptors
*/
for (i = 0; i < count; i++) {
......
......@@ -795,7 +795,7 @@ acpi_ut_remove_allocation (
ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size %X\n", allocation->size));
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", allocation->size));
status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
return_ACPI_STATUS (status);
......
......@@ -64,7 +64,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20030918
#define ACPI_CA_VERSION 0x20031002
/* Maximum objects in the various object caches */
......
......@@ -163,6 +163,7 @@
#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001E | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML)
#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML)
#define AE_CODE_AML_MAX 0x0020
......@@ -280,7 +281,8 @@ char const *acpi_gbl_exception_names_aml[] =
"AE_AML_ALIGNMENT",
"AE_AML_NO_RESOURCE_END_TAG",
"AE_AML_BAD_RESOURCE_VALUE",
"AE_AML_CIRCULAR_REFERENCE"
"AE_AML_CIRCULAR_REFERENCE",
"AE_AML_BAD_RESOURCE_LENGTH"
};
char const *acpi_gbl_exception_names_ctrl[] =
......
This diff is collapsed.
......@@ -51,7 +51,7 @@
*/
struct rsdt_descriptor_rev1
{
struct acpi_table_header header; /* ACPI Table header */
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u32 table_offset_entry [1]; /* Array of pointers to other */
/* ACPI tables */
};
......@@ -78,7 +78,7 @@ struct facs_descriptor_rev1
*/
struct fadt_descriptor_rev1
{
struct acpi_table_header header; /* ACPI Table header */
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u32 firmware_ctrl; /* Physical address of FACS */
u32 dsdt; /* Physical address of DSDT */
u8 model; /* System Interrupt Model */
......
......@@ -71,7 +71,7 @@
*/
struct rsdt_descriptor_rev2
{
struct acpi_table_header header; /* ACPI table header */
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u32 table_offset_entry [1]; /* Array of pointers to */
/* ACPI table headers */
};
......@@ -82,7 +82,7 @@ struct rsdt_descriptor_rev2
*/
struct xsdt_descriptor_rev2
{
struct acpi_table_header header; /* ACPI table header */
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u64 table_offset_entry [1]; /* Array of pointers to */
/* ACPI table headers */
};
......@@ -124,7 +124,7 @@ struct acpi_generic_address
*/
struct fadt_descriptor_rev2
{
struct acpi_table_header header; /* ACPI table header */
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */
u32 V1_dsdt; /* 32-bit physical address of DSDT */
u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/
......@@ -195,6 +195,19 @@ struct fadt_descriptor_rev2
};
/* Embedded Controller */
struct ec_boot_resources
{
ACPI_TABLE_HEADER_DEF
struct acpi_generic_address ec_control; /* Address of EC command/status register */
struct acpi_generic_address ec_data; /* Address of EC data register */
u32 uid; /* Unique ID - must be same as the EC _UID method */
u8 gpe_bit; /* The GPE for the EC */
u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */
};
#pragma pack()
#endif /* __ACTBL2_H__ */
......
......@@ -207,6 +207,7 @@ typedef u32 acpi_size;
/*
* Miscellaneous common types
*/
typedef u16 UINT16_BIT;
typedef u32 UINT32_BIT;
typedef acpi_native_uint ACPI_PTRDIFF;
......
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