Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286462
b: refs/heads/master
c: 9ce8178
h: refs/heads/master
v: v3
  • Loading branch information
Bob Moore authored and Len Brown committed Jan 17, 2012
1 parent 92255b9 commit d452ac4
Show file tree
Hide file tree
Showing 16 changed files with 309 additions and 46 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ffef68273b6278e98a99dd4051671d4854b20fe0
refs/heads/master: 9ce81784c9c0396a6a6be05248928a71134fe60b
1 change: 1 addition & 0 deletions trunk/drivers/acpi/acpica/acevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ acpi_status acpi_ev_initialize_op_regions(void);

acpi_status
acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
union acpi_operand_object *field_obj,
u32 function,
u32 region_offset, u32 bit_width, u64 *value);

Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/acpi/acpica/aclocal.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef u32 acpi_mutex_handle;

/* Total number of aml opcodes defined */

#define AML_NUM_OPCODES 0x7F
#define AML_NUM_OPCODES 0x81

/* Forward declarations */

Expand Down Expand Up @@ -249,12 +249,16 @@ struct acpi_create_field_info {
struct acpi_namespace_node *field_node;
struct acpi_namespace_node *register_node;
struct acpi_namespace_node *data_register_node;
struct acpi_namespace_node *connection_node;
u8 *resource_buffer;
u32 bank_value;
u32 field_bit_position;
u32 field_bit_length;
u16 resource_length;
u8 field_flags;
u8 attribute;
u8 field_type;
u8 access_length;
};

typedef
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/acpi/acpica/acobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,17 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
u32 base_byte_offset; /* Byte offset within containing object */\
u32 value; /* Value to store into the Bank or Index register */\
u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
u8 access_length; /* For serial regions/fields */


struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
};

struct acpi_object_region_field {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length;
union acpi_operand_object *region_obj; /* Containing op_region object */
u8 *resource_buffer; /* resource_template for serial regions/fields */
};

struct acpi_object_bank_field {
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/acpi/acpica/acopcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
#define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_CONTINUE_OP ARG_NONE
#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
Expand Down Expand Up @@ -164,6 +165,7 @@
#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_REVISION_OP ARG_NONE
#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
#define ARGP_SERIALFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
Expand Down Expand Up @@ -223,6 +225,7 @@
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
#define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
Expand Down Expand Up @@ -294,6 +297,7 @@
#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
#define ARGI_REVISION_OP ARG_NONE
#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
#define ARGI_SERIALFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
Expand Down
10 changes: 10 additions & 0 deletions trunk/drivers/acpi/acpica/amlcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@
#define AML_LLESSEQUAL_OP (u16) 0x9294
#define AML_LNOTEQUAL_OP (u16) 0x9293

/*
* Opcodes for "Field" operators
*/
#define AML_FIELD_OFFSET_OP (u8) 0x00
#define AML_FIELD_ACCESS_OP (u8) 0x01
#define AML_FIELD_CONNECTION_OP (u8) 0x02 /* ACPI 5.0 */
#define AML_FIELD_EXT_ACCESS_OP (u8) 0x03 /* ACPI 5.0 */

/*
* Internal opcodes
* Use only "Unknown" AML opcodes, don't attempt to use
Expand All @@ -202,6 +210,8 @@
#define AML_INT_METHODCALL_OP (u16) 0x0035
#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
#define AML_INT_CONNECTION_OP (u16) 0x0038
#define AML_INT_EXTACCESSFIELD_OP (u16) 0x0039

#define ARG_NONE 0x0

Expand Down
81 changes: 66 additions & 15 deletions trunk/drivers/acpi/acpica/dsfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
{
acpi_status status;
u64 position;
union acpi_parse_object *child;

ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);

Expand All @@ -232,10 +233,11 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,

while (arg) {
/*
* Three types of field elements are handled:
* 1) Offset - specifies a bit offset
* 2) access_as - changes the access mode
* 3) Name - Enters a new named field into the namespace
* Four types of field elements are handled:
* 1) Name - Enters a new named field into the namespace
* 2) Offset - specifies a bit offset
* 3) access_as - changes the access mode/attributes
* 4) Connection - Associate a resource template with the field
*/
switch (arg->common.aml_opcode) {
case AML_INT_RESERVEDFIELD_OP:
Expand All @@ -253,21 +255,70 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
break;

case AML_INT_ACCESSFIELD_OP:

case AML_INT_EXTACCESSFIELD_OP:
/*
* Get a new access_type and access_attribute -- to be used for all
* field units that follow, until field end or another access_as
* keyword.
* Get new access_type, access_attribute, and access_length fields
* -- to be used for all field units that follow, until the
* end-of-field or another access_as keyword is encountered.
* NOTE. These three bytes are encoded in the integer value
* of the parseop for convenience.
*
* In field_flags, preserve the flag bits other than the
* ACCESS_TYPE bits
* ACCESS_TYPE bits.
*/

/* access_type (byte_acc, word_acc, etc.) */

info->field_flags = (u8)
((info->
field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((u8) ((u32) arg->common.value.integer >> 8)));
((u8)((u32)(arg->common.value.integer & 0x07))));

/* access_attribute (attrib_quick, attrib_byte, etc.) */

info->attribute =
(u8)((arg->common.value.integer >> 8) & 0xFF);

/* access_length (for serial/buffer protocols) */

info->access_length =
(u8)((arg->common.value.integer >> 16) & 0xFF);
break;

case AML_INT_CONNECTION_OP:
/*
* Clear any previous connection. New connection is used for all
* fields that follow, similar to access_as
*/
info->resource_buffer = NULL;
info->connection_node = NULL;

info->attribute = (u8) (arg->common.value.integer);
/*
* A Connection() is either an actual resource descriptor (buffer)
* or a named reference to a resource template
*/
child = arg->common.value.arg;
if (child->common.aml_opcode == AML_INT_BYTELIST_OP) {
info->resource_buffer = child->named.data;
info->resource_length =
(u16)child->named.value.integer;
} else {
/* Lookup the Connection() namepath, it should already exist */

status = acpi_ns_lookup(walk_state->scope_info,
child->common.value.
name, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE,
walk_state,
&info->connection_node);
if (ACPI_FAILURE(status)) {
ACPI_ERROR_NAMESPACE(child->common.
value.name,
status);
return_ACPI_STATUS(status);
}
}
break;

case AML_INT_NAMEDFIELD_OP:
Expand Down Expand Up @@ -374,6 +425,8 @@ acpi_ds_create_field(union acpi_parse_object *op,
}
}

ACPI_MEMSET(&info, 0, sizeof(struct acpi_create_field_info));

/* Second arg is the field flags */

arg = arg->common.next;
Expand All @@ -386,7 +439,6 @@ acpi_ds_create_field(union acpi_parse_object *op,
info.region_node = region_node;

status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);

return_ACPI_STATUS(status);
}

Expand Down Expand Up @@ -474,8 +526,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
*/
while (arg) {
/*
* Ignore OFFSET and ACCESSAS terms here; we are only interested in the
* field names in order to enter them into the namespace.
* Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
* in the field names in order to enter them into the namespace.
*/
if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
status = acpi_ns_lookup(walk_state->scope_info,
Expand Down Expand Up @@ -651,6 +703,5 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
info.region_node = region_node;

status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);

return_ACPI_STATUS(status);
}
29 changes: 26 additions & 3 deletions trunk/drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
* FUNCTION: acpi_ev_address_space_dispatch
*
* PARAMETERS: region_obj - Internal region object
* field_obj - Corresponding field. Can be NULL.
* Function - Read or Write operation
* region_offset - Where in the region to read or write
* bit_width - Field width in bits (8, 16, 32, or 64)
Expand All @@ -344,6 +345,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)

acpi_status
acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
union acpi_operand_object *field_obj,
u32 function,
u32 region_offset, u32 bit_width, u64 *value)
{
Expand All @@ -353,6 +355,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
union acpi_operand_object *handler_desc;
union acpi_operand_object *region_obj2;
void *region_context = NULL;
struct acpi_connection_info *context;

ACPI_FUNCTION_TRACE(ev_address_space_dispatch);

Expand All @@ -375,6 +378,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
return_ACPI_STATUS(AE_NOT_EXIST);
}

context = handler_desc->address_space.context;

/*
* It may be the case that the region has never been initialized.
* Some types of regions require special init code
Expand Down Expand Up @@ -404,8 +409,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
acpi_ex_exit_interpreter();

status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
handler_desc->address_space.context,
&region_context);
context, &region_context);

/* Re-enter the interpreter */

Expand Down Expand Up @@ -455,6 +459,25 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
acpi_ut_get_region_name(region_obj->region.
space_id)));

/*
* Special handling for generic_serial_bus and general_purpose_io:
* There are three extra parameters that must be passed to the
* handler via the context:
* 1) Connection buffer, a resource template from Connection() op.
* 2) Length of the above buffer.
* 3) Actual access length from the access_as() op.
*/
if (((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) ||
(region_obj->region.space_id == ACPI_ADR_SPACE_GPIO)) &&
context && field_obj) {

/* Get the Connection (resource_template) buffer */

context->connection = field_obj->field.resource_buffer;
context->length = field_obj->field.resource_length;
context->access_length = field_obj->field.access_length;
}

if (!(handler_desc->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
/*
Expand All @@ -469,7 +492,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,

status = handler(function,
(region_obj->region.address + region_offset),
bit_width, value, handler_desc->address_space.context,
bit_width, value, context,
region_obj2->extra.region_context);

if (ACPI_FAILURE(status)) {
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/acpi/acpica/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
/* Bytewise reads */

for (i = 0; i < length; i++) {
status = acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
region_offset, 8,
&value);
status =
acpi_ev_address_space_dispatch(obj_desc, NULL, ACPI_READ,
region_offset, 8, &value);
if (ACPI_FAILURE(status)) {
return status;
}
Expand Down
7 changes: 5 additions & 2 deletions trunk/drivers/acpi/acpica/exdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,13 @@ static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = {
"Buffer Object"}
};

static struct acpi_exdump_info acpi_ex_dump_region_field[3] = {
static struct acpi_exdump_info acpi_ex_dump_region_field[5] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL},
{ACPI_EXD_FIELD, 0, NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"}
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(field.access_length), "AccessLength"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.resource_buffer),
"ResourceBuffer"}
};

static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = {
Expand Down
11 changes: 6 additions & 5 deletions trunk/drivers/acpi/acpica/exfldio.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,12 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,

/* Invoke the appropriate address_space/op_region handler */

status =
acpi_ev_address_space_dispatch(rgn_desc, function, region_offset,
ACPI_MUL_8(obj_desc->common_field.
access_byte_width),
value);
status = acpi_ev_address_space_dispatch(rgn_desc, obj_desc,
function, region_offset,
ACPI_MUL_8(obj_desc->
common_field.
access_byte_width),
value);

if (ACPI_FAILURE(status)) {
if (status == AE_NOT_IMPLEMENTED) {
Expand Down
Loading

0 comments on commit d452ac4

Please sign in to comment.