summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_memhotplug.c4
-rw-r--r--drivers/acpi/dispatcher/dsutils.c12
-rw-r--r--drivers/acpi/ec.c4
-rw-r--r--drivers/acpi/events/evgpe.c10
-rw-r--r--drivers/acpi/events/evsci.c4
-rw-r--r--drivers/acpi/executer/exdump.c10
-rw-r--r--drivers/acpi/executer/exnames.c4
-rw-r--r--drivers/acpi/executer/exprep.c4
-rw-r--r--drivers/acpi/executer/exresop.c2
-rw-r--r--drivers/acpi/executer/exutils.c6
-rw-r--r--drivers/acpi/glue.c8
-rw-r--r--drivers/acpi/hardware/hwacpi.c8
-rw-r--r--drivers/acpi/motherboard.c30
-rw-r--r--drivers/acpi/namespace/nsaccess.c2
-rw-r--r--drivers/acpi/namespace/nsnames.c2
-rw-r--r--drivers/acpi/namespace/nsutils.c12
-rw-r--r--drivers/acpi/parser/psargs.c2
-rw-r--r--drivers/acpi/parser/psxface.c142
-rw-r--r--drivers/acpi/pci_irq.c48
-rw-r--r--drivers/acpi/pci_link.c92
-rw-r--r--drivers/acpi/pci_root.c8
-rw-r--r--drivers/acpi/resources/Makefile2
-rw-r--r--drivers/acpi/resources/rsaddr.c1132
-rw-r--r--drivers/acpi/resources/rscalc.c282
-rw-r--r--drivers/acpi/resources/rscreate.c59
-rw-r--r--drivers/acpi/resources/rsdump.c313
-rw-r--r--drivers/acpi/resources/rsinfo.c2
-rw-r--r--drivers/acpi/resources/rsio.c451
-rw-r--r--drivers/acpi/resources/rsirq.c494
-rw-r--r--drivers/acpi/resources/rslist.c290
-rw-r--r--drivers/acpi/resources/rsmemory.c472
-rw-r--r--drivers/acpi/resources/rsmisc.c711
-rw-r--r--drivers/acpi/resources/rsutils.c437
-rw-r--r--drivers/acpi/resources/rsxface.c14
-rw-r--r--drivers/acpi/tables/tbrsdt.c2
-rw-r--r--drivers/acpi/tables/tbxfroot.c2
-rw-r--r--drivers/acpi/utilities/utalloc.c6
-rw-r--r--drivers/acpi/utilities/utglobal.c3
-rw-r--r--drivers/acpi/utilities/utmisc.c6
-rw-r--r--drivers/char/hpet.c26
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c364
-rw-r--r--drivers/serial/8250_acpi.c22
42 files changed, 2388 insertions, 3116 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 2143609d293..b12946ccd13 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -101,8 +101,8 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
address64.attribute.memory.cache_attribute;
mem_device->read_write_attribute =
address64.attribute.memory.read_write_attribute;
- mem_device->start_addr = address64.min_address_range;
- mem_device->end_addr = address64.max_address_range;
+ mem_device->start_addr = address64.minimum;
+ mem_device->end_addr = address64.maximum;
}
}
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c
index 83ae1c1aa28..2cc53da5c0b 100644
--- a/drivers/acpi/dispatcher/dsutils.c
+++ b/drivers/acpi/dispatcher/dsutils.c
@@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
if (!op) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
- return_VALUE(TRUE);
+ return_UINT8(TRUE);
}
/*
@@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
"At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name(op->common.
aml_opcode)));
- return_VALUE(FALSE);
+ return_UINT8(FALSE);
}
/* Get info on the parent. The root_op is AML_SCOPE */
@@ -218,7 +218,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown parent opcode. Op=%p\n", op));
- return_VALUE(FALSE);
+ return_UINT8(FALSE);
}
/*
@@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));
- return_VALUE(TRUE);
+ return_UINT8(TRUE);
result_not_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));
- return_VALUE(FALSE);
+ return_UINT8(FALSE);
}
/*******************************************************************************
@@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
if (op_info->flags & AML_HAS_RETVAL) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
- "Argument previously created, already stacked \n"));
+ "Argument previously created, already stacked\n"));
ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
(walk_state->
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index c33bfba5df8..0ecbfa5db1b 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
union acpi_ec *ec = (union acpi_ec *)context;
struct acpi_generic_address *addr;
- if (resource->type != ACPI_RSTYPE_IO) {
+ if (resource->type != ACPI_RESOURCE_TYPE_IO) {
return AE_OK;
}
@@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
addr->register_bit_width = 8;
addr->register_bit_offset = 0;
- addr->address = resource->data.io.min_base_address;
+ addr->address = resource->data.io.minimum;
return AE_OK;
}
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index b2f232df13d..f51c3b16c60 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -600,7 +600,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
- return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+ return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}
@@ -638,7 +638,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
- return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+ return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}
break;
@@ -652,7 +652,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
- return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+ return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
/*
@@ -680,12 +680,12 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
- return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+ return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
break;
}
- return_VALUE(ACPI_INTERRUPT_HANDLED);
+ return_UINT32(ACPI_INTERRUPT_HANDLED);
}
#ifdef ACPI_GPE_NOTIFY_CHECK
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c
index 14183597700..e2c0b48a7e9 100644
--- a/drivers/acpi/events/evsci.c
+++ b/drivers/acpi/events/evsci.c
@@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
*/
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
- return_VALUE(interrupt_handled);
+ return_UINT32(interrupt_handled);
}
/*******************************************************************************
@@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
*/
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
- return_VALUE(interrupt_handled);
+ return_UINT32(interrupt_handled);
}
/******************************************************************************
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index bc2fa996047..4477a62fed5 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -214,7 +214,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_BUFFER:
- acpi_os_printf("Buffer len %X @ %p \n",
+ acpi_os_printf("Buffer len %X @ %p\n",
obj_desc->buffer.length,
obj_desc->buffer.pointer);
@@ -320,17 +320,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_BUFFER_FIELD:
- acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n",
+ acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n",
obj_desc->buffer_field.bit_length,
obj_desc->buffer_field.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset);
if (!obj_desc->buffer_field.buffer_obj) {
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
} else
if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
!= ACPI_TYPE_BUFFER) {
- acpi_os_printf("*not a Buffer* \n");
+ acpi_os_printf("*not a Buffer*\n");
} else {
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
depth + 1);
@@ -618,7 +618,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
case ACPI_TYPE_PACKAGE:
- acpi_os_printf("[Package] Contains %d Elements: \n",
+ acpi_os_printf("[Package] Contains %d Elements:\n",
obj_desc->package.count);
for (i = 0; i < obj_desc->package.count; i++) {
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 239d8473e9a..dff41121a30 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
if (name_string) {
ACPI_STRCAT(name_string, char_buf);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
- "Appended to - %s \n", name_string));
+ "Appended to - %s\n", name_string));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
- "No Name string - %s \n", char_buf));
+ "No Name string - %s\n", char_buf));
}
} else if (index == 0) {
/*
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
index 7476c363e40..88ccbf3b29d 100644
--- a/drivers/acpi/executer/exprep.c
+++ b/drivers/acpi/executer/exprep.c
@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown field access type %X\n", access));
- return_VALUE(0);
+ return_UINT32(0);
}
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
}
*return_byte_alignment = byte_alignment;
- return_VALUE(bit_length);
+ return_UINT32(bit_length);
}
/*******************************************************************************
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index ff064e79ab9..b04e4a3707a 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode,
}
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
- "Opcode %X [%s] required_operand_types=%8.8X \n",
+ "Opcode %X [%s] required_operand_types=%8.8X\n",
opcode, op_info->name, arg_types));
/*
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 1ee79d8c8f8..9f4e547d773 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -206,7 +206,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
}
}
- return_VALUE(locked);
+ return_UINT8(locked);
}
/*******************************************************************************
@@ -268,7 +268,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
/* acpi_integer is unsigned, so we don't worry about a '-' prefix */
if (value == 0) {
- return_VALUE(1);
+ return_UINT32(1);
}
current_value = value;
@@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
num_digits++;
}
- return_VALUE(num_digits);
+ return_UINT32(num_digits);
}
/*******************************************************************************
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index fcb881db5b0..8daef57b994 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -99,15 +99,15 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
unsigned long *busnr = (unsigned long *)data;
struct acpi_resource_address64 address;
- if (resource->type != ACPI_RSTYPE_ADDRESS16 &&
- resource->type != ACPI_RSTYPE_ADDRESS32 &&
- resource->type != ACPI_RSTYPE_ADDRESS64)
+ if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
+ resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
+ resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
return AE_OK;
acpi_resource_to_address64(resource, &address);
if ((address.address_length > 0) &&
(address.resource_type == ACPI_BUS_NUMBER_RANGE))
- *busnr = address.min_address_range;
+ *busnr = address.minimum;
return AE_OK;
}
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c
index 1bb3463d704..20a335cc9be 100644
--- a/drivers/acpi/hardware/hwacpi.c
+++ b/drivers/acpi/hardware/hwacpi.c
@@ -204,18 +204,18 @@ u32 acpi_hw_get_mode(void)
* system does not support mode transition.
*/
if (!acpi_gbl_FADT->smi_cmd) {
- return_VALUE(ACPI_SYS_MODE_ACPI);
+ return_UINT32(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);
+ return_UINT32(ACPI_SYS_MODE_LEGACY);
}
if (value) {
- return_VALUE(ACPI_SYS_MODE_ACPI);
+ return_UINT32(ACPI_SYS_MODE_ACPI);
} else {
- return_VALUE(ACPI_SYS_MODE_LEGACY);
+ return_UINT32(ACPI_SYS_MODE_LEGACY);
}
}
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
index 85c1fb5c9a5..468244147ec 100644
--- a/drivers/acpi/motherboard.c
+++ b/drivers/acpi/motherboard.c
@@ -54,36 +54,36 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
- if (res->type == ACPI_RSTYPE_IO) {
+ if (res->type == ACPI_RESOURCE_TYPE_IO) {
struct acpi_resource_io *io_res = &res->data.io;
- if (io_res->min_base_address != io_res->max_base_address)
+ if (io_res->minimum != io_res->maximum)
return_VALUE(AE_OK);
if (IS_RESERVED_ADDR
- (io_res->min_base_address, io_res->range_length)) {
+ (io_res->minimum, io_res->address_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n",
- io_res->min_base_address,
- io_res->min_base_address +
- io_res->range_length));
+ io_res->minimum,
+ io_res->minimum +
+ io_res->address_length));
requested_res =
- request_region(io_res->min_base_address,
- io_res->range_length, "motherboard");
+ request_region(io_res->minimum,
+ io_res->address_length, "motherboard");
}
- } else if (res->type == ACPI_RSTYPE_FIXED_IO) {
+ } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) {
struct acpi_resource_fixed_io *fixed_io_res =
&res->data.fixed_io;
if (IS_RESERVED_ADDR
- (fixed_io_res->base_address, fixed_io_res->range_length)) {
+ (fixed_io_res->address, fixed_io_res->address_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n",
- fixed_io_res->base_address,
- fixed_io_res->base_address +
- fixed_io_res->range_length));
+ fixed_io_res->address,
+ fixed_io_res->address +
+ fixed_io_res->address_length));
requested_res =
- request_region(fixed_io_res->base_address,
- fixed_io_res->range_length,
+ request_region(fixed_io_res->address,
+ fixed_io_res->address_length,
"motherboard");
}
} else {
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index edfbe34600f..6923059ba3c 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -498,7 +498,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
path++;
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
- "Multi Pathname (%d Segments, Flags=%X) \n",
+ "Multi Pathname (%d Segments, Flags=%X)\n",
num_segments, flags));
break;
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c
index d5e8dea61c2..5400728eb79 100644
--- a/drivers/acpi/namespace/nsnames.c
+++ b/drivers/acpi/namespace/nsnames.c
@@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
acpi_ns_build_external_path(node, required_size, buffer->pointer);
- ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n",
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n",
(char *)buffer->pointer, (u32) required_size));
return_ACPI_STATUS(AE_OK);
}
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
index ebec036423c..549075fb9f8 100644
--- a/drivers/acpi/namespace/nsutils.c
+++ b/drivers/acpi/namespace/nsutils.c
@@ -249,10 +249,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
if (!node) {
ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n"));
- return_VALUE(ACPI_TYPE_ANY);
+ return_UINT32(ACPI_TYPE_ANY);
}
- return_VALUE((acpi_object_type) node->type);
+ return_UINT32((acpi_object_type) node->type);
}
/*******************************************************************************
@@ -276,10 +276,10 @@ u32 acpi_ns_local(acpi_object_type type)
/* Type code out of range */
ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n"));
- return_VALUE(ACPI_NS_NORMAL);
+ return_UINT32(ACPI_NS_NORMAL);
}
- return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
+ return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
}
/*******************************************************************************
@@ -805,10 +805,10 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
type));
- return_VALUE(ACPI_NS_NORMAL);
+ return_UINT32(ACPI_NS_NORMAL);
}
- return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
+ return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
}
/*******************************************************************************
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index 5858188f94a..562d0f822ab 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -116,7 +116,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
break;
}
- return_VALUE(length);
+ return_UINT32(length);
}
/*******************************************************************************
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index 4dcbd443160..4c426f4c6af 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -50,6 +50,10 @@
ACPI_MODULE_NAME("psxface")
/* Local Prototypes */
+static void acpi_ps_start_trace(struct acpi_parameter_info *info);
+
+static void acpi_ps_stop_trace(struct acpi_parameter_info *info);
+
static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
static void
@@ -57,6 +61,136 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
/*******************************************************************************
*
+ * FUNCTION: acpi_debug_trace
+ *
+ * PARAMETERS: method_name - Valid ACPI name string
+ * debug_level - Optional level mask. 0 to use default
+ * debug_layer - Optional layer mask. 0 to use default
+ * Flags - bit 1: one shot(1) or persistent(0)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: External interface to enable debug tracing during control
+ * method execution
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags)
+{
+ acpi_status status;
+
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return (status);
+ }
+
+ /* TBDs: Validate name, allow full path or just nameseg */
+
+ acpi_gbl_trace_method_name = *(u32 *) name;
+ acpi_gbl_trace_flags = flags;
+
+ if (debug_level) {
+ acpi_gbl_trace_dbg_level = debug_level;
+ }
+ if (debug_layer) {
+ acpi_gbl_trace_dbg_layer = debug_layer;
+ }
+
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ps_start_trace
+ *
+ * PARAMETERS: Info - Method info struct
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Start control method execution trace
+ *
+ ******************************************************************************/
+
+static void acpi_ps_start_trace(struct acpi_parameter_info *info)
+{
+ acpi_status status;
+
+ ACPI_FUNCTION_ENTRY();
+
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return;
+ }
+
+ if ((!acpi_gbl_trace_method_name) ||
+ (acpi_gbl_trace_method_name != info->node->name.integer)) {
+ goto exit;
+ }
+
+ acpi_gbl_original_dbg_level = acpi_dbg_level;
+ acpi_gbl_original_dbg_layer = acpi_dbg_layer;
+
+ acpi_dbg_level = 0x00FFFFFF;
+ acpi_dbg_layer = ACPI_UINT32_MAX;
+
+ if (acpi_gbl_trace_dbg_level) {
+ acpi_dbg_level = acpi_gbl_trace_dbg_level;
+ }
+ if (acpi_gbl_trace_dbg_layer) {
+ acpi_dbg_layer = acpi_gbl_trace_dbg_layer;
+ }
+
+ exit:
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ps_stop_trace
+ *
+ * PARAMETERS: Info - Method info struct
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Stop control method execution trace
+ *
+ ******************************************************************************/
+
+static void acpi_ps_stop_trace(struct acpi_parameter_info *info)
+{
+ acpi_status status;
+
+ ACPI_FUNCTION_ENTRY();
+
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return;
+ }
+
+ if ((!acpi_gbl_trace_method_name) ||
+ (acpi_gbl_trace_method_name != info->node->name.integer)) {
+ goto exit;
+ }
+
+ /* Disable further tracing if type is one-shot */
+
+ if (acpi_gbl_trace_flags & 1) {
+ acpi_gbl_trace_method_name = 0;
+ acpi_gbl_trace_dbg_level = 0;
+ acpi_gbl_trace_dbg_layer = 0;
+ }
+
+ acpi_dbg_level = acpi_gbl_original_dbg_level;
+ acpi_dbg_layer = acpi_gbl_original_dbg_layer;
+
+ exit:
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+}
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_ps_execute_method
*
* PARAMETERS: Info - Method info block, contains:
@@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
*/
acpi_ps_update_parameter_list(info, REF_INCREMENT);
+ /* Begin tracing if requested */
+
+ acpi_ps_start_trace(info);
+
/*
* 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace
@@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
status = acpi_ps_execute_pass(info);
cleanup:
+ /* End optional tracing */
+
+ acpi_ps_stop_trace(info);
+
/* Take away the extra reference that we gave the parameters above */
acpi_ps_update_parameter_list(info, REF_DECREMENT);
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 09567c2edcf..726dda1fce1 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -258,7 +258,7 @@ typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
static int
acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
- int *edge_level, int *active_high_low, char **link)
+ int *triggering, int *polarity, char **link)
{
int irq;
@@ -266,8 +266,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
if (entry->link.handle) {
irq = acpi_pci_link_allocate_irq(entry->link.handle,
- entry->link.index, edge_level,
- active_high_low, link);
+ entry->link.index, triggering,
+ polarity, link);
if (irq < 0) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Invalid IRQ link routing entry\n"));
@@ -275,8 +275,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
}
} else {
irq = entry->link.index;
- *edge_level = ACPI_LEVEL_SENSITIVE;
- *active_high_low = ACPI_ACTIVE_LOW;
+ *triggering = ACPI_LEVEL_SENSITIVE;
+ *polarity = ACPI_ACTIVE_LOW;
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
@@ -285,7 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
static int
acpi_pci_free_irq(struct acpi_prt_entry *entry,
- int *edge_level, int *active_high_low, char **link)
+ int *triggering, int *polarity, char **link)
{
int irq;
@@ -307,8 +307,8 @@ static int
acpi_pci_irq_lookup(struct pci_bus *bus,
int device,
int pin,
- int *edge_level,
- int *active_high_low, char **link, irq_lookup_func func)
+ int *triggering,
+ int *polarity, char **link, irq_lookup_func func)
{
struct acpi_prt_entry *entry = NULL;
int segment = pci_domain_nr(bus);
@@ -327,7 +327,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
return_VALUE(-1);
}
- ret = func(entry, edge_level, active_high_low, link);
+ ret = func(entry, triggering, polarity, link);
return_VALUE(ret);
}
@@ -339,8 +339,8 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
static int
acpi_pci_irq_derive(struct pci_dev *dev,
int pin,
- int *edge_level,
- int *active_high_low, char **link, irq_lookup_func func)
+ int *triggering,
+ int *polarity, char **link, irq_lookup_func func)
{
struct pci_dev *bridge = dev;
int irq = -1;
@@ -375,7 +375,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
}
irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
- pin, edge_level, active_high_low,
+ pin, triggering, polarity,
link, func);
}
@@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
{
int irq = 0;
u8 pin = 0;
- int edge_level = ACPI_LEVEL_SENSITIVE;
- int active_high_low = ACPI_ACTIVE_LOW;
+ int triggering = ACPI_LEVEL_SENSITIVE;
+ int polarity = ACPI_ACTIVE_LOW;
char *link = NULL;
int rc;
@@ -432,7 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
* values override any BIOS-assigned IRQs set during boot.
*/
irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
- &edge_level, &active_high_low, &link,
+ &triggering, &polarity, &link,
acpi_pci_allocate_irq);
/*
@@ -440,8 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
* device's parent bridge.
*/
if (irq < 0)
- irq = acpi_pci_irq_derive(dev, pin, &edge_level,
- &active_high_low, &link,
+ irq = acpi_pci_irq_derive(dev, pin, &triggering,
+ &polarity, &link,
acpi_pci_allocate_irq);
/*
@@ -463,7 +463,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
}
}
- rc = acpi_register_gsi(irq, edge_level, active_high_low);
+ rc = acpi_register_gsi(irq, triggering, polarity);
if (rc < 0) {
printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
"to register GSI\n", pci_name(dev), ('A' + pin));
@@ -478,8 +478,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
printk("Link [%s] -> ", link);
printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
- (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
- (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
+ (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
+ (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
return_VALUE(0);
}
@@ -495,8 +495,8 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
{
int gsi = 0;
u8 pin = 0;
- int edge_level = ACPI_LEVEL_SENSITIVE;
- int active_high_low = ACPI_ACTIVE_LOW;
+ int triggering = ACPI_LEVEL_SENSITIVE;
+ int polarity = ACPI_ACTIVE_LOW;
ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
@@ -512,7 +512,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
* First we check the PCI IRQ routing table (PRT) for an IRQ.
*/
gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
- &edge_level, &active_high_low, NULL,
+ &triggering, &polarity, NULL,
acpi_pci_free_irq);
/*
* If no PRT entry was found, we'll try to derive an IRQ from the
@@ -520,7 +520,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
*/
if (gsi < 0)
gsi = acpi_pci_irq_derive(dev, pin,
- &edge_level, &active_high_low, NULL,
+ &triggering, &polarity, NULL,
acpi_pci_free_irq);
if (gsi < 0)
return_VOID;
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index d8956c0bf14..49217037349 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = {
*/
struct acpi_pci_link_irq {
u8 active; /* Current IRQ */
- u8 edge_level; /* All IRQs */
- u8 active_high_low; /* All IRQs */
+ u8 triggering; /* All IRQs */
+ u8 polarity; /* All IRQs */
u8 resource_type;
u8 possible_count;
u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
@@ -109,18 +109,18 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible");
switch (resource->type) {
- case ACPI_RSTYPE_START_DPF:
+ case ACPI_RESOURCE_TYPE_START_DEPENDENT:
return_ACPI_STATUS(AE_OK);
- case ACPI_RSTYPE_IRQ:
+ case ACPI_RESOURCE_TYPE_IRQ:
{
struct acpi_resource_irq *p = &resource->data.irq;
- if (!p || !p->number_of_interrupts) {
+ if (!p || !p->interrupt_count) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Blank IRQ resource\n"));
return_ACPI_STATUS(AE_OK);
}
for (i = 0;
- (i < p->number_of_interrupts
+ (i < p->interrupt_count
&& i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
if (!p->interrupts[i]) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -131,22 +131,22 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
link->irq.possible[i] = p->interrupts[i];
link->irq.possible_count++;
}
- link->irq.edge_level = p->edge_level;
- link->irq.active_high_low = p->active_high_low;
- link->irq.resource_type = ACPI_RSTYPE_IRQ;
+ link->irq.triggering = p->triggering;
+ link->irq.polarity = p->polarity;
+ link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ;
break;
}
- case ACPI_RSTYPE_EXT_IRQ:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
{
- struct acpi_resource_ext_irq *p =
+ struct acpi_resource_extended_irq *p =
&resource->data.extended_irq;
- if (!p || !p->number_of_interrupts) {
+ if (!p || !p->interrupt_count) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Blank EXT IRQ resource\n"));
return_ACPI_STATUS(AE_OK);
}
for (i = 0;
- (i < p->number_of_interrupts
+ (i < p->interrupt_count
&& i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
if (!p->interrupts[i]) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -157,9 +157,9 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
link->irq.possible[i] = p->interrupts[i];
link->irq.possible_count++;
}
- link->irq.edge_level = p->edge_level;
- link->irq.active_high_low = p->active_high_low;
- link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ;
+ link->irq.triggering = p->triggering;
+ link->irq.polarity = p->polarity;
+ link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
break;
}
default:
@@ -202,10 +202,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
ACPI_FUNCTION_TRACE("acpi_pci_link_check_current");
switch (resource->type) {
- case ACPI_RSTYPE_IRQ:
+ case ACPI_RESOURCE_TYPE_IRQ:
{
struct acpi_resource_irq *p = &resource->data.irq;
- if (!p || !p->number_of_interrupts) {
+ if (!p || !p->interrupt_count) {
/*
* IRQ descriptors may have no IRQ# bits set,
* particularly those those w/ _STA disabled
@@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
*irq = p->interrupts[0];
break;
}
- case ACPI_RSTYPE_EXT_IRQ:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
{
- struct acpi_resource_ext_irq *p =
+ struct acpi_resource_extended_irq *p =
&resource->data.extended_irq;
- if (!p || !p->number_of_interrupts) {
+ if (!p || !p->interrupt_count) {
/*
* extended IRQ descriptors must
* return at least 1 IRQ
@@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
buffer.pointer = resource;
switch (link->irq.resource_type) {
- case ACPI_RSTYPE_IRQ:
- resource->res.type = ACPI_RSTYPE_IRQ;
+ case ACPI_RESOURCE_TYPE_IRQ:
+ resource->res.type = ACPI_RESOURCE_TYPE_IRQ;
resource->res.length = sizeof(struct acpi_resource);
- resource->res.data.irq.edge_level = link->irq.edge_level;
- resource->res.data.irq.active_high_low =
- link->irq.active_high_low;
- if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
- resource->res.data.irq.shared_exclusive =
+ resource->res.data.irq.triggering = link->irq.triggering;
+ resource->res.data.irq.polarity =
+ link->irq.polarity;
+ if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
+ resource->res.data.irq.sharable =
ACPI_EXCLUSIVE;
else
- resource->res.data.irq.shared_exclusive = ACPI_SHARED;
- resource->res.data.irq.number_of_interrupts = 1;
+ resource->res.data.irq.sharable = ACPI_SHARED;
+ resource->res.data.irq.interrupt_count = 1;
resource->res.data.irq.interrupts[0] = irq;
break;
- case ACPI_RSTYPE_EXT_IRQ:
- resource->res.type = ACPI_RSTYPE_EXT_IRQ;
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+ resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
resource->res.length = sizeof(struct acpi_resource);
resource->res.data.extended_irq.producer_consumer =
ACPI_CONSUMER;
- resource->res.data.extended_irq.edge_level =
- link->irq.edge_level;
- resource->res.data.extended_irq.active_high_low =
- link->irq.active_high_low;
- if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
- resource->res.data.irq.shared_exclusive =
+ resource->res.data.extended_irq.triggering =
+ link->irq.triggering;
+ resource->res.data.extended_irq.polarity =
+ link->irq.polarity;
+ if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
+ resource->res.data.irq.sharable =
ACPI_EXCLUSIVE;
else
- resource->res.data.irq.shared_exclusive = ACPI_SHARED;
- resource->res.data.extended_irq.number_of_interrupts = 1;
+ resource->res.data.irq.sharable = ACPI_SHARED;
+ resource->res.data.extended_irq.interrupt_count = 1;
resource->res.data.extended_irq.interrupts[0] = irq;
/* ignore resource_source, it's optional */
break;
@@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
goto end;
}
- resource->end.type = ACPI_RSTYPE_END_TAG;
+ resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
/* Attempt to set the resource */
status = acpi_set_current_resources(link->handle, &buffer);
@@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
int
acpi_pci_link_allocate_irq(acpi_handle handle,
int index,
- int *edge_level, int *active_high_low, char **name)
+ int *triggering, int *polarity, char **name)
{
int result = 0;
struct acpi_device *device = NULL;
@@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
link->refcnt++;
up(&acpi_link_lock);
- if (edge_level)
- *edge_level = link->irq.edge_level;
- if (active_high_low)
- *active_high_low = link->irq.active_high_low;
+ if (triggering)
+ *triggering = link->irq.triggering;
+ if (polarity)
+ *polarity = link->irq.polarity;
if (name)
*name = acpi_device_bid(link->device);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 5d6bc815fe7..4c313eab631 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -122,15 +122,15 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
int *busnr = (int *)data;
struct acpi_resource_address64 address;
- if (resource->type != ACPI_RSTYPE_ADDRESS16 &&
- resource->type != ACPI_RSTYPE_ADDRESS32 &&
- resource->type != ACPI_RSTYPE_ADDRESS64)
+ if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
+ resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
+ resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
return AE_OK;
acpi_resource_to_address64(resource, &address);
if ((address.address_length > 0) &&
(address.resource_type == ACPI_BUS_NUMBER_RANGE))
- *busnr = address.min_address_range;
+ *busnr = address.minimum;
return AE_OK;
}
diff --git a/drivers/acpi/resources/Makefile b/drivers/acpi/resources/Makefile
index 2130b74170c..8de4f69dfa0 100644
--- a/drivers/acpi/resources/Makefile
+++ b/drivers/acpi/resources/Makefile
@@ -2,7 +2,7 @@
# Makefile for all Linux ACPI interpreter subdirectories
#
-obj-y := rsaddr.o rscreate.o rsio.o rslist.o rsmisc.o rsxface.o \
+obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \
rscalc.o rsirq.o rsmemory.o rsutils.o
obj-$(ACPI_FUTURE_USAGE) += rsdump.o
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
index 798778261fb..6f48ebf3304 100644
--- a/drivers/acpi/resources/rsaddr.c
+++ b/drivers/acpi/resources/rsaddr.c
@@ -58,12 +58,20 @@ acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags);
static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource);
+static void
+acpi_rs_set_address_common(union aml_resource *aml,
+ struct acpi_resource *resource);
+
+static u8
+acpi_rs_get_address_common(struct acpi_resource *resource,
+ union aml_resource *aml);
+
/*******************************************************************************
*
* FUNCTION: acpi_rs_decode_general_flags
*
* PARAMETERS: Resource - Address resource data struct
- * Flags - Actual flag byte
+ * Flags - Raw AML flag byte
*
* RETURN: Decoded flag bits in resource struct
*
@@ -107,27 +115,19 @@ acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags)
static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource)
{
- u8 flags;
-
ACPI_FUNCTION_ENTRY();
- /* Producer / Consumer - flag bit[0] */
-
- flags = (u8) (resource->address.producer_consumer & 0x01);
-
- /* Decode (_DEC) - flag bit[1] */
-
- flags |= (u8) ((resource->address.decode & 0x01) << 1);
-
- /* Min Address Fixed (_MIF) - flag bit[2] */
-
- flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2);
-
- /* Max Address Fixed (_MAF) - flag bit[3] */
-
- flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3);
-
- return (flags);
+ return ((u8)
+
+ /* Producer / Consumer - flag bit[0] */
+ ((resource->address.producer_consumer & 0x01) |
+ /* Decode (_DEC) - flag bit[1] */
+ ((resource->address.decode & 0x01) << 1) |
+ /* Min Address Fixed (_MIF) - flag bit[2] */
+ ((resource->address.min_address_fixed & 0x01) << 2) |
+ /* Max Address Fixed (_MAF) - flag bit[3] */
+ ((resource->address.max_address_fixed & 0x01) << 3))
+ );
}
/*******************************************************************************
@@ -135,7 +135,7 @@ static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource)
* FUNCTION: acpi_rs_decode_specific_flags
*
* PARAMETERS: Resource - Address resource data struct
- * Flags - Actual flag byte
+ * Flags - Raw AML flag byte
*
* RETURN: Decoded flag bits in attribute struct
*
@@ -189,921 +189,541 @@ acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags)
static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource)
{
- u8 flags = 0;
-
ACPI_FUNCTION_ENTRY();
if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
- /* Write Status (_RW) - flag bit[0] */
-
- flags = (u8)
- (resource->address.attribute.memory.
- read_write_attribute & 0x01);
-
- /* Memory Attributes (_MEM) - flag bits[2:1] */
-
- flags |= (u8)
- ((resource->address.attribute.memory.
- cache_attribute & 0x03) << 1);
+ return ((u8)
+
+ /* Write Status (_RW) - flag bit[0] */
+ ((resource->address.attribute.memory.
+ read_write_attribute & 0x01) |
+ /* Memory Attributes (_MEM) - flag bits[2:1] */
+ ((resource->address.attribute.memory.
+ cache_attribute & 0x03) << 1)));
} else if (resource->address.resource_type == ACPI_IO_RANGE) {
- /* Ranges (_RNG) - flag bits[1:0] */
-
- flags = (u8)
- (resource->address.attribute.io.range_attribute & 0x03);
-
- /* Translations (_TTP and _TRS) - flag bits[5:4] */
-
- flags |= (u8)
- ((resource->address.attribute.io.
- translation_attribute & 0x03) << 4);
+ return ((u8)
+
+ /* Ranges (_RNG) - flag bits[1:0] */
+ ((resource->address.attribute.io.
+ range_attribute & 0x03) |
+ /* Translations (_TTP and _TRS) - flag bits[5:4] */
+ ((resource->address.attribute.io.
+ translation_attribute & 0x03) << 4)));
}
- return (flags);
+ return (0);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_address16_resource
+ * FUNCTION: acpi_rs_set_address_common
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * Resource - Pointer to the internal resource struct
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert common flag fields from a resource descriptor to an
+ * AML descriptor
*
******************************************************************************/
-acpi_status
-acpi_rs_address16_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+static void
+acpi_rs_set_address_common(union aml_resource *aml,
+ struct acpi_resource *resource)
{
- u32 index;
- u16 temp16;
- u8 temp8;
- u8 *temp_ptr;
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16);
+ ACPI_FUNCTION_ENTRY();
- ACPI_FUNCTION_TRACE("rs_address16_resource");
+ /* Set the Resource Type (Memory, Io, bus_number, etc.) */
- /* Get the Descriptor Length field */
+ aml->address.resource_type = (u8) resource->data.address.resource_type;
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ /* Set the general flags */
- /* Validate minimum descriptor length */
+ aml->address.flags = acpi_rs_encode_general_flags(&resource->data);
- if (temp16 < 13) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
- }
+ /* Set the type-specific flags */
- *bytes_consumed = temp16 + 3;
- output_struct->type = ACPI_RSTYPE_ADDRESS16;
+ aml->address.specific_flags =
+ acpi_rs_encode_specific_flags(&resource->data);
+}
- /* Get the Resource Type (Byte3) */
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_address_common
+ *
+ * PARAMETERS: Resource - Pointer to the internal resource struct
+ * Aml - Pointer to the AML resource descriptor
+ *
+ * RETURN: TRUE if the resource_type field is OK, FALSE otherwise
+ *
+ * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
+ * to an internal resource descriptor
+ *
+ ******************************************************************************/
- buffer += 2;
- temp8 = *buffer;
+static u8
+acpi_rs_get_address_common(struct acpi_resource *resource,
+ union aml_resource *aml)
+{
+ ACPI_FUNCTION_ENTRY();
- /* Values 0-2 and 0xC0-0xFF are valid */
+ /* Validate resource type */
- if ((temp8 > 2) && (temp8 < 0xC0)) {
- return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+ if ((aml->address.resource_type > 2)
+ && (aml->address.resource_type < 0xC0)) {
+ return (FALSE);
}
- output_struct->data.address16.resource_type = temp8;
-
- /* Get the General Flags (Byte4) */
-
- buffer += 1;
- acpi_rs_decode_general_flags(&output_struct->data, *buffer);
-
- /* Get the Type Specific Flags (Byte5) */
-
- buffer += 1;
- acpi_rs_decode_specific_flags(&output_struct->data, *buffer);
-
- /* Get Granularity (Bytes 6-7) */
-
- buffer += 1;
- ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer);
+ /* Get the Resource Type (Memory, Io, bus_number, etc.) */
- /* Get min_address_range (Bytes 8-9) */
+ resource->data.address.resource_type = aml->address.resource_type;
- buffer += 2;
- ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range,
- buffer);
+ /* Get the General Flags */
- /* Get max_address_range (Bytes 10-11) */
+ acpi_rs_decode_general_flags(&resource->data, aml->address.flags);
- buffer += 2;
- ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range,
- buffer);
+ /* Get the Type-Specific Flags */
- /* Get address_translation_offset (Bytes 12-13) */
-
- buffer += 2;
- ACPI_MOVE_16_TO_32(&output_struct->data.address16.
- address_translation_offset, buffer);
+ acpi_rs_decode_specific_flags(&resource->data,
+ aml->address.specific_flags);
+ return (TRUE);
+}
- /* Get address_length (Bytes 14-15) */
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_address16
+ *
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
+ *
+ ******************************************************************************/
- buffer += 2;
- ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length,
- buffer);
+acpi_status
+acpi_rs_get_address16(union aml_resource * aml,
+ u16 aml_resource_length, struct acpi_resource * resource)
+{
+ ACPI_FUNCTION_TRACE("rs_get_address16");
- /* Resource Source Index (if present) */
+ /* Get the Resource Type, general flags, and type-specific flags */
- buffer += 2;
+ if (!acpi_rs_get_address_common(resource, aml)) {
+ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+ }
/*
- * 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:
- * 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.
+ * Get the following contiguous fields from the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
*/
- if (*bytes_consumed > (16 + 1)) {
- /* Dereference the Index */
-
- output_struct->data.address16.resource_source.index =
- (u32) * buffer;
-
- /* Point to the String */
+ acpi_rs_move_data(&resource->data.address16.granularity,
+ &aml->address16.granularity, 5,
+ ACPI_MOVE_TYPE_16_TO_32);
- buffer += 1;
+ /* Get the optional resource_source (index and string) */
- /* Point the String pointer to the end of this structure */
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) +
+ acpi_rs_get_resource_source(aml_resource_length,
+ sizeof(struct aml_resource_address16),
+ &resource->data.address16.
+ resource_source, aml, NULL);
- output_struct->data.address16.resource_source.string_ptr =
- (char *)((u8 *) output_struct + struct_size);
+ /* Complete the resource header */
- temp_ptr = (u8 *)
- output_struct->data.address16.resource_source.string_ptr;
-
- /* Copy the resource_source string into the buffer */
-
- index = 0;
- while (*buffer) {
- *temp_ptr = *buffer;
-
- temp_ptr++;
- buffer++;
- index++;
- }
-
- /* Add the terminating null and set the string length */
-
- *temp_ptr = 0;
- output_struct->data.address16.resource_source.string_length =
- index + 1;
-
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * struct_size to the next 32-bit boundary.
- */
- temp8 = (u8) (index + 1);
- struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
- } else {
- output_struct->data.address16.resource_source.index = 0;
- output_struct->data.address16.resource_source.string_length = 0;
- output_struct->data.address16.resource_source.string_ptr = NULL;
- }
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_ADDRESS16;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_address16_stream
+ * FUNCTION: acpi_rs_set_address16
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_address16_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u8 *length_field;
- acpi_size actual_bytes;
-
- ACPI_FUNCTION_TRACE("rs_address16_stream");
-
- /* Set the Descriptor Type field */
+ acpi_size descriptor_length;
- *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
- buffer += 1;
+ ACPI_FUNCTION_TRACE("rs_set_address16");
- /* Save a pointer to the Length field - to be filled in later */
+ /* Set the Resource Type, General Flags, and Type-Specific Flags */
- length_field = buffer;
- buffer += 2;
-
- /* Set the Resource Type (Memory, Io, bus_number) */
-
- *buffer = (u8) (resource->data.address16.resource_type & 0x03);
- buffer += 1;
-
- /* Set the general flags */
+ acpi_rs_set_address_common(aml, resource);
- *buffer = acpi_rs_encode_general_flags(&resource->data);
- buffer += 1;
-
- /* Set the type specific flags */
-
- *buffer = acpi_rs_encode_specific_flags(&resource->data);
- buffer += 1;
-
- /* Set the address space granularity */
-
- ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.granularity);
- buffer += 2;
-
- /* Set the address range minimum */
-
- ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.min_address_range);
- buffer += 2;
-
- /* Set the address range maximum */
-
- ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.max_address_range);
- buffer += 2;
-
- /* Set the address translation offset */
-
- ACPI_MOVE_32_TO_16(buffer,
- &resource->data.address16.
- address_translation_offset);
- buffer += 2;
-
- /* Set the address length */
-
- ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.address_length);
- buffer += 2;
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
+ */
+ acpi_rs_move_data(&aml->address16.granularity,
+ &resource->data.address16.granularity, 5,
+ ACPI_MOVE_TYPE_32_TO_16);
/* Resource Source Index and Resource Source are optional */
- if (resource->data.address16.resource_source.string_length) {
- *buffer = (u8) resource->data.address16.resource_source.index;
- buffer += 1;
+ descriptor_length = acpi_rs_set_resource_source(aml,
+ sizeof(struct
+ aml_resource_address16),
+ &resource->data.
+ address16.
+ resource_source);
- /* Copy the resource_source string */
+ /* Complete the AML descriptor header */
- ACPI_STRCPY((char *)buffer,
- resource->data.address16.resource_source.
- string_ptr);
-
- /*
- * Buffer needs to be set to the length of the string + one for the
- * terminating null
- */
- buffer +=
- (acpi_size) (ACPI_STRLEN
- (resource->data.address16.resource_source.
- string_ptr) + 1);
- }
-
- /* Return the number of bytes consumed in this operation */
-
- actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer);
- *bytes_consumed = actual_bytes;
-
- /*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
- */
- actual_bytes -= 3;
- ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16,
+ descriptor_length, aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_address32_resource
+ * FUNCTION: acpi_rs_get_address32
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_address32_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_address32(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u16 temp16;
- u8 temp8;
- u8 *temp_ptr;
- u32 index;
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32);
-
- ACPI_FUNCTION_TRACE("rs_address32_resource");
-
- /* Get the Descriptor Length field */
-
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
- /* Validate minimum descriptor length */
+ ACPI_FUNCTION_TRACE("rs_get_address32");
- if (temp16 < 23) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
- }
-
- *bytes_consumed = temp16 + 3;
- output_struct->type = ACPI_RSTYPE_ADDRESS32;
-
- /* Get the Resource Type (Byte3) */
-
- buffer += 2;
- temp8 = *buffer;
+ /* Get the Resource Type, general flags, and type-specific flags */
- /* Values 0-2 and 0xC0-0xFF are valid */
-
- if ((temp8 > 2) && (temp8 < 0xC0)) {
+ if (!acpi_rs_get_address_common(resource, (void *)aml)) {
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
}
- output_struct->data.address32.resource_type = temp8;
-
- /* Get the General Flags (Byte4) */
-
- buffer += 1;
- acpi_rs_decode_general_flags(&output_struct->data, *buffer);
-
- /* Get the Type Specific Flags (Byte5) */
-
- buffer += 1;
- acpi_rs_decode_specific_flags(&output_struct->data, *buffer);
-
- /* Get Granularity (Bytes 6-9) */
-
- buffer += 1;
- ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer);
-
- /* Get min_address_range (Bytes 10-13) */
-
- buffer += 4;
- ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range,
- buffer);
-
- /* Get max_address_range (Bytes 14-17) */
-
- buffer += 4;
- ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range,
- buffer);
-
- /* Get address_translation_offset (Bytes 18-21) */
-
- buffer += 4;
- ACPI_MOVE_32_TO_32(&output_struct->data.address32.
- address_translation_offset, buffer);
-
- /* Get address_length (Bytes 22-25) */
-
- buffer += 4;
- ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length,
- buffer);
-
- /* Resource Source Index (if present) */
-
- buffer += 4;
-
/*
- * 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.
+ * Get the following contiguous fields from the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
*/
- if (*bytes_consumed > (26 + 1)) {
- /* Dereference the Index */
-
- output_struct->data.address32.resource_source.index =
- (u32) * buffer;
-
- /* Point to the String */
+ acpi_rs_move_data(&resource->data.address32.granularity,
+ &aml->address32.granularity, 5,
+ ACPI_MOVE_TYPE_32_TO_32);
- buffer += 1;
+ /* Get the optional resource_source (index and string) */
- /* Point the String pointer to the end of this structure */
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) +
+ acpi_rs_get_resource_source(aml_resource_length,
+ sizeof(struct aml_resource_address32),
+ &resource->data.address32.
+ resource_source, aml, NULL);
- output_struct->data.address32.resource_source.string_ptr =
- (char *)((u8 *) output_struct + struct_size);
+ /* Complete the resource header */
- temp_ptr = (u8 *)
- output_struct->data.address32.resource_source.string_ptr;
-
- /* Copy the resource_source string into the buffer */
-
- index = 0;
- while (*buffer) {
- *temp_ptr = *buffer;
-
- temp_ptr++;
- buffer++;
- index++;
- }
-
- /* Add the terminating null and set the string length */
-
- *temp_ptr = 0;
- output_struct->data.address32.resource_source.string_length =
- index + 1;
-
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * struct_size to the next 32-bit boundary.
- */
- temp8 = (u8) (index + 1);
- struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
- } else {
- output_struct->data.address32.resource_source.index = 0;
- output_struct->data.address32.resource_source.string_length = 0;
- output_struct->data.address32.resource_source.string_ptr = NULL;
- }
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_ADDRESS32;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_address32_stream
+ * FUNCTION: acpi_rs_set_address32
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_address32_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer;
- u16 *length_field;
-
- ACPI_FUNCTION_TRACE("rs_address32_stream");
-
- buffer = *output_buffer;
+ acpi_size descriptor_length;
- /* Set the Descriptor Type field */
+ ACPI_FUNCTION_TRACE("rs_set_address32");
- *buffer = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
- buffer += 1;
+ /* Set the Resource Type, General Flags, and Type-Specific Flags */
- /* Save a pointer to the Length field - to be filled in later */
+ acpi_rs_set_address_common(aml, resource);
- length_field = ACPI_CAST_PTR(u16, buffer);
- buffer += 2;
-
- /* Set the Resource Type (Memory, Io, bus_number) */
-
- *buffer = (u8) (resource->data.address32.resource_type & 0x03);
- buffer += 1;
-
- /* Set the general flags */
-
- *buffer = acpi_rs_encode_general_flags(&resource->data);
- buffer += 1;
-
- /* Set the type specific flags */
-
- *buffer = acpi_rs_encode_specific_flags(&resource->data);
- buffer += 1;
-
- /* Set the address space granularity */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.granularity);
- buffer += 4;
-
- /* Set the address range minimum */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.min_address_range);
- buffer += 4;
-
- /* Set the address range maximum */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.max_address_range);
- buffer += 4;
-
- /* Set the address translation offset */
-
- ACPI_MOVE_32_TO_32(buffer,
- &resource->data.address32.
- address_translation_offset);
- buffer += 4;
-
- /* Set the address length */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.address_length);
- buffer += 4;
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
+ */
+ acpi_rs_move_data(&aml->address32.granularity,
+ &resource->data.address32.granularity, 5,
+ ACPI_MOVE_TYPE_32_TO_32);
/* Resource Source Index and Resource Source are optional */
- if (resource->data.address32.resource_source.string_length) {
- *buffer = (u8) resource->data.address32.resource_source.index;
- buffer += 1;
-
- /* Copy the resource_source string */
+ descriptor_length = acpi_rs_set_resource_source(aml,
+ sizeof(struct
+ aml_resource_address32),
+ &resource->data.
+ address32.
+ resource_source);
- ACPI_STRCPY((char *)buffer,
- resource->data.address32.resource_source.
- string_ptr);
+ /* Complete the AML descriptor header */
- /*
- * Buffer needs to be set to the length of the string + one for the
- * terminating null
- */
- buffer +=
- (acpi_size) (ACPI_STRLEN
- (resource->data.address32.resource_source.
- string_ptr) + 1);
- }
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
-
- /*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
- */
- *length_field = (u16) (*bytes_consumed - 3);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32,
+ descriptor_length, aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_address64_resource
+ * FUNCTION: acpi_rs_get_address64
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_address64_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_address64(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u16 temp16;
- u8 temp8;
- u8 resource_type;
- u8 *temp_ptr;
- u32 index;
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64);
-
- ACPI_FUNCTION_TRACE("rs_address64_resource");
-
- /* Get the Descriptor Type */
-
- resource_type = *buffer;
-
- /* Get the Descriptor Length field */
-
- 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->type = ACPI_RSTYPE_ADDRESS64;
-
- /* Get the Resource Type (Byte3) */
+ ACPI_FUNCTION_TRACE("rs_get_address64");
- buffer += 2;
- temp8 = *buffer;
+ /* Get the Resource Type, general Flags, and type-specific Flags */
- /* Values 0-2 and 0xC0-0xFF are valid */
-
- if ((temp8 > 2) && (temp8 < 0xC0)) {
+ if (!acpi_rs_get_address_common(resource, aml)) {
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
}
- output_struct->data.address64.resource_type = temp8;
-
- /* Get the General Flags (Byte4) */
-
- buffer += 1;
- acpi_rs_decode_general_flags(&output_struct->data, *buffer);
-
- /* Get the Type Specific Flags (Byte5) */
-
- buffer += 1;
- acpi_rs_decode_specific_flags(&output_struct->data, *buffer);
-
- if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) {
- /* Move past revision_id and Reserved byte */
-
- buffer += 2;
- }
-
- /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */
-
- buffer += 1;
- ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer);
-
- /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */
-
- buffer += 8;
- ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range,
- buffer);
-
- /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */
-
- buffer += 8;
- ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range,
- buffer);
-
- /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */
-
- buffer += 8;
- ACPI_MOVE_64_TO_64(&output_struct->data.address64.
- address_translation_offset, buffer);
+ /*
+ * Get the following contiguous fields from the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
+ */
+ acpi_rs_move_data(&resource->data.address64.granularity,
+ &aml->address64.granularity, 5,
+ ACPI_MOVE_TYPE_64_TO_64);
- /* Get address_length (Bytes 38-45) or (Bytes 40-47) */
+ /* Get the optional resource_source (index and string) */
- buffer += 8;
- ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length,
- buffer);
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) +
+ acpi_rs_get_resource_source(aml_resource_length,
+ sizeof(struct aml_resource_address64),
+ &resource->data.address64.
+ resource_source, aml, NULL);
- output_struct->data.address64.resource_source.index = 0;
- output_struct->data.address64.resource_source.string_length = 0;
- output_struct->data.address64.resource_source.string_ptr = NULL;
+ /* Complete the resource header */
- if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) {
- /* Get type_specific_attribute (Bytes 48-55) */
+ resource->type = ACPI_RESOURCE_TYPE_ADDRESS64;
+ return_ACPI_STATUS(AE_OK);
+}
- buffer += 8;
- ACPI_MOVE_64_TO_64(&output_struct->data.address64.
- type_specific_attributes, buffer);
- } else {
- output_struct->data.address64.type_specific_attributes = 0;
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_set_address64
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
+ *
+ ******************************************************************************/
- /* Resource Source Index (if present) */
+acpi_status
+acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml)
+{
+ acpi_size descriptor_length;
- buffer += 8;
+ ACPI_FUNCTION_TRACE("rs_set_address64");
- /*
- * 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:
- * 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 + 1)) {
- /* Dereference the Index */
+ /* Set the Resource Type, General Flags, and Type-Specific Flags */
- output_struct->data.address64.resource_source.index =
- (u32) * buffer;
+ acpi_rs_set_address_common(aml, resource);
- /* Point to the String */
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
+ */
+ acpi_rs_move_data(&aml->address64.granularity,
+ &resource->data.address64.granularity, 5,
+ ACPI_MOVE_TYPE_64_TO_64);
- buffer += 1;
+ /* Resource Source Index and Resource Source are optional */
- /* Point the String pointer to the end of this structure */
+ descriptor_length = acpi_rs_set_resource_source(aml,
+ sizeof(struct
+ aml_resource_address64),
+ &resource->data.
+ address64.
+ resource_source);
- output_struct->data.address64.resource_source.
- string_ptr =
- (char *)((u8 *) output_struct + struct_size);
+ /* Complete the AML descriptor header */
- temp_ptr = (u8 *)
- output_struct->data.address64.resource_source.
- string_ptr;
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64,
+ descriptor_length, aml);
+ return_ACPI_STATUS(AE_OK);
+}
- /* Copy the resource_source string into the buffer */
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_ext_address64
+ *
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
+ *
+ ******************************************************************************/
- index = 0;
- while (*buffer) {
- *temp_ptr = *buffer;
+acpi_status
+acpi_rs_get_ext_address64(union aml_resource *aml,
+ u16 aml_resource_length,
+ struct acpi_resource *resource)
+{
- temp_ptr++;
- buffer++;
- index++;
- }
+ ACPI_FUNCTION_TRACE("rs_get_ext_address64");
- /*
- * Add the terminating null and set the string length
- */
- *temp_ptr = 0;
- output_struct->data.address64.resource_source.
- string_length = index + 1;
+ /* Get the Resource Type, general flags, and type-specific flags */
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * struct_size to the next 32-bit boundary.
- */
- temp8 = (u8) (index + 1);
- struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
- }
+ if (!acpi_rs_get_address_common(resource, aml)) {
+ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
}
- /* Set the Length parameter */
+ /*
+ * Get and validate the Revision ID
+ * Note: Only one revision ID is currently supported
+ */
+ resource->data.ext_address64.revision_iD =
+ aml->ext_address64.revision_iD;
+ if (aml->ext_address64.revision_iD !=
+ AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
+ return_ACPI_STATUS(AE_SUPPORT);
+ }
- output_struct->length = (u32) struct_size;
+ /*
+ * Get the following contiguous fields from the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
+ * Type-Specific Attribute
+ */
+ acpi_rs_move_data(&resource->data.ext_address64.granularity,
+ &aml->ext_address64.granularity, 6,
+ ACPI_MOVE_TYPE_64_TO_64);
- /* Return the final size of the structure */
+ /* Complete the resource header */
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64;
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_address64_stream
+ * FUNCTION: acpi_rs_set_ext_address64
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_address64_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_ext_address64(struct acpi_resource *resource,
+ union aml_resource *aml)
{
- u8 *buffer;
- u16 *length_field;
-
- ACPI_FUNCTION_TRACE("rs_address64_stream");
-
- buffer = *output_buffer;
-
- /* Set the Descriptor Type field */
-
- *buffer = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
- buffer += 1;
-
- /* Save a pointer to the Length field - to be filled in later */
-
- length_field = ACPI_CAST_PTR(u16, buffer);
- buffer += 2;
-
- /* Set the Resource Type (Memory, Io, bus_number) */
-
- *buffer = (u8) (resource->data.address64.resource_type & 0x03);
- buffer += 1;
-
- /* Set the general flags */
-
- *buffer = acpi_rs_encode_general_flags(&resource->data);
- buffer += 1;
-
- /* Set the type specific flags */
-
- *buffer = acpi_rs_encode_specific_flags(&resource->data);
- buffer += 1;
-
- /* Set the address space granularity */
+ ACPI_FUNCTION_TRACE("rs_set_ext_address64");
- ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.granularity);
- buffer += 8;
+ /* Set the Resource Type, General Flags, and Type-Specific Flags */
- /* Set the address range minimum */
+ acpi_rs_set_address_common(aml, resource);
- ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.min_address_range);
- buffer += 8;
+ /* Only one Revision ID is currently supported */
- /* Set the address range maximum */
-
- ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.max_address_range);
- buffer += 8;
-
- /* Set the address translation offset */
-
- ACPI_MOVE_64_TO_64(buffer,
- &resource->data.address64.
- address_translation_offset);
- buffer += 8;
-
- /* Set the address length */
-
- ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.address_length);
- buffer += 8;
-
- /* Resource Source Index and Resource Source are optional */
-
- if (resource->data.address64.resource_source.string_length) {
- *buffer = (u8) resource->data.address64.resource_source.index;
- buffer += 1;
-
- /* Copy the resource_source string */
-
- ACPI_STRCPY((char *)buffer,
- resource->data.address64.resource_source.
- string_ptr);
-
- /*
- * Buffer needs to be set to the length of the string + one for the
- * terminating null
- */
- buffer +=
- (acpi_size) (ACPI_STRLEN
- (resource->data.address64.resource_source.
- string_ptr) + 1);
- }
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
+ aml->ext_address64.reserved = 0;
/*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
+ * Set the following contiguous fields in the AML descriptor:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
+ * Type-Specific Attribute
*/
- *length_field = (u16) (*bytes_consumed - 3);
+ acpi_rs_move_data(&aml->ext_address64.granularity,
+ &resource->data.address64.granularity, 6,
+ ACPI_MOVE_TYPE_64_TO_64);
+
+ /* Complete the AML descriptor header */
+
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
+ sizeof(struct
+ aml_resource_extended_address64),
+ aml);
return_ACPI_STATUS(AE_OK);
}
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 2da7c6a8182..d170dee07ce 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -44,87 +44,14 @@
#include <acpi/acpi.h>
#include <acpi/acresrc.h>
#include <acpi/amlcode.h>
-#include <acpi/amlresrc.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rscalc")
-/*
- * Base sizes for external resource descriptors, indexed by internal type.
- * Includes size of the descriptor header (1 byte for small descriptors,
- * 3 bytes for large descriptors)
- */
-static u8 acpi_gbl_stream_sizes[] = {
- 4, /* ACPI_RSTYPE_IRQ (Byte 3 is optional, but always created) */
- 3, /* ACPI_RSTYPE_DMA */
- 2, /* ACPI_RSTYPE_START_DPF (Byte 1 is optional, but always created) */
- 1, /* ACPI_RSTYPE_END_DPF */
- 8, /* ACPI_RSTYPE_IO */
- 4, /* ACPI_RSTYPE_FIXED_IO */
- 1, /* ACPI_RSTYPE_VENDOR */
- 2, /* ACPI_RSTYPE_END_TAG */
- 12, /* ACPI_RSTYPE_MEM24 */
- 20, /* ACPI_RSTYPE_MEM32 */
- 12, /* ACPI_RSTYPE_FIXED_MEM32 */
- 16, /* ACPI_RSTYPE_ADDRESS16 */
- 26, /* ACPI_RSTYPE_ADDRESS32 */
- 46, /* ACPI_RSTYPE_ADDRESS64 */
- 9, /* ACPI_RSTYPE_EXT_IRQ */
- 15 /* ACPI_RSTYPE_GENERIC_REG */
-};
-
-/*
- * Base sizes of resource descriptors, both the actual AML stream length and
- * size of the internal struct representation.
- */
-struct acpi_resource_sizes {
- u8 minimum_stream_size;
- u8 minimum_struct_size;
-};
-
-static struct acpi_resource_sizes acpi_gbl_sm_resource_sizes[] = {
- {0, 0}, /* 0x00, Reserved */
- {0, 0}, /* 0x01, Reserved */
- {0, 0}, /* 0x02, Reserved */
- {0, 0}, /* 0x03, Reserved */
- {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, /* ACPI_RDESC_TYPE_IRQ_FORMAT */
- {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, /* ACPI_RDESC_TYPE_DMA_FORMAT */
- {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf)}, /* ACPI_RDESC_TYPE_START_DEPENDENT */
- {1, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_DEPENDENT */
- {8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, /* ACPI_RDESC_TYPE_IO_PORT */
- {4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
- {0, 0}, /* 0x0A, Reserved */
- {0, 0}, /* 0x0B, Reserved */
- {0, 0}, /* 0x0C, Reserved */
- {0, 0}, /* 0x0D, Reserved */
- {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_SMALL_VENDOR */
- {2, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_TAG */
-};
-
-static struct acpi_resource_sizes acpi_gbl_lg_resource_sizes[] = {
- {0, 0}, /* 0x00, Reserved */
- {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24)}, /* ACPI_RDESC_TYPE_MEMORY_24 */
- {15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg)}, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
- {0, 0}, /* 0x03, Reserved */
- {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_LARGE_VENDOR */
- {20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32)}, /* ACPI_RDESC_TYPE_MEMORY_32 */
- {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32)}, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
- {26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
- {16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
- {9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq)}, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
- {46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
- {56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
-};
-
/* Local prototypes */
-
static u8 acpi_rs_count_set_bits(u16 bit_field);
-static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type);
-
-static u16 acpi_rs_get_resource_length(u8 * resource);
-
static acpi_size
acpi_rs_struct_option_length(struct acpi_resource_source *resource_source);
@@ -161,90 +88,6 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_resource_sizes
- *
- * PARAMETERS: resource_type - Byte 0 of a resource descriptor
- *
- * RETURN: Pointer to the resource conversion handler
- *
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
- *
- ******************************************************************************/
-
-static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type)
-{
- struct acpi_resource_sizes *size_info;
-
- ACPI_FUNCTION_ENTRY();
-
- /* Determine if this is a small or large resource */
-
- if (resource_type & ACPI_RDESC_TYPE_LARGE) {
- /* Large Resource Type -- bits 6:0 contain the name */
-
- if (resource_type > ACPI_RDESC_LARGE_MAX) {
- return (NULL);
- }
-
- size_info = &acpi_gbl_lg_resource_sizes[(resource_type &
- ACPI_RDESC_LARGE_MASK)];
- } else {
- /* Small Resource Type -- bits 6:3 contain the name */
-
- size_info = &acpi_gbl_sm_resource_sizes[((resource_type &
- ACPI_RDESC_SMALL_MASK)
- >> 3)];
- }
-
- /* Zero entry indicates an invalid resource type */
-
- if (!size_info->minimum_stream_size) {
- return (NULL);
- }
-
- return (size_info);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_rs_get_resource_length
- *
- * PARAMETERS: Resource - Pointer to the resource descriptor
- *
- * RETURN: Byte length of the (AML byte stream) descriptor. By definition,
- * this does not include the size of the descriptor header and the
- * length field itself.
- *
- * DESCRIPTION: Extract the length of a resource descriptor.
- *
- ******************************************************************************/
-
-static u16 acpi_rs_get_resource_length(u8 * resource)
-{
- u16 resource_length;
-
- ACPI_FUNCTION_ENTRY();
-
- /* Determine if this is a small or large resource */
-
- if (*resource & ACPI_RDESC_TYPE_LARGE) {
- /* Large Resource type -- length is in bytes 1-2 */
-
- ACPI_MOVE_16_TO_16(&resource_length, (resource + 1));
-
- } else {
- /* Small Resource Type -- bits 2:0 of byte 0 contain the length */
-
- resource_length =
- (u16) (*resource & ACPI_RDESC_SMALL_LENGTH_MASK);
- }
-
- return (resource_length);
-}
-
-/*******************************************************************************
- *
* FUNCTION: acpi_rs_struct_option_length
*
* PARAMETERS: resource_source - Pointer to optional descriptor field
@@ -291,10 +134,10 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
******************************************************************************/
static u32
-acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
+acpi_rs_stream_option_length(u32 resource_length,
+ u32 minimum_aml_resource_length)
{
u32 string_length = 0;
- u32 minimum_resource_length;
ACPI_FUNCTION_ENTRY();
@@ -303,11 +146,6 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
* Large-type resource descriptors.
*/
- /* Compute minimum size of the data part of the resource descriptor */
-
- minimum_resource_length =
- minimum_total_length - sizeof(struct asl_large_header);
-
/*
* If the length of the actual resource descriptor is greater than the ACPI
* spec-defined minimum length, it means that a resource_source_index exists
@@ -315,10 +153,11 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
* (including the null terminator) is the resource length minus the minimum
* length, minus one byte for the resource_source_index itself.
*/
- if (resource_length > minimum_resource_length) {
+ if (resource_length > minimum_aml_resource_length) {
/* Compute the length of the optional string */
- string_length = resource_length - minimum_resource_length - 1;
+ string_length =
+ resource_length - minimum_aml_resource_length - 1;
}
/* Round up length to 32 bits for internal structure alignment */
@@ -328,7 +167,7 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_byte_stream_length
+ * FUNCTION: acpi_rs_get_aml_length
*
* PARAMETERS: Resource - Pointer to the resource linked list
* size_needed - Where the required size is returned
@@ -342,62 +181,62 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
******************************************************************************/
acpi_status
-acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
- acpi_size * size_needed)
+acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
{
- acpi_size byte_stream_size_needed = 0;
+ acpi_size aml_size_needed = 0;
acpi_size segment_size;
- ACPI_FUNCTION_TRACE("rs_get_byte_stream_length");
+ ACPI_FUNCTION_TRACE("rs_get_aml_length");
/* Traverse entire list of internal resource descriptors */
while (resource) {
/* Validate the descriptor type */
- if (resource->type > ACPI_RSTYPE_MAX) {
+ if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
}
/* Get the base size of the (external stream) resource descriptor */
- segment_size = acpi_gbl_stream_sizes[resource->type];
+ segment_size = acpi_gbl_aml_resource_sizes[resource->type];
/*
* Augment the base size for descriptors with optional and/or
* variable-length fields
*/
switch (resource->type) {
- case ACPI_RSTYPE_VENDOR:
+ case ACPI_RESOURCE_TYPE_VENDOR:
/*
* Vendor Defined Resource:
* For a Vendor Specific resource, if the Length is between 1 and 7
* it will be created as a Small Resource data type, otherwise it
* is a Large Resource data type.
*/
- if (resource->data.vendor_specific.length > 7) {
+ if (resource->data.vendor.byte_length > 7) {
/* Base size of a Large resource descriptor */
- segment_size = 3;
+ segment_size =
+ sizeof(struct aml_resource_large_header);
}
/* Add the size of the vendor-specific data */
- segment_size += resource->data.vendor_specific.length;
+ segment_size += resource->data.vendor.byte_length;
break;
- case ACPI_RSTYPE_END_TAG:
+ case ACPI_RESOURCE_TYPE_END_TAG:
/*
* End Tag:
* We are done -- return the accumulated total size.
*/
- *size_needed = byte_stream_size_needed + segment_size;
+ *size_needed = aml_size_needed + segment_size;
/* Normal exit */
return_ACPI_STATUS(AE_OK);
- case ACPI_RSTYPE_ADDRESS16:
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
/*
* 16-Bit Address Resource:
* Add the size of the optional resource_source info
@@ -408,7 +247,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
resource_source);
break;
- case ACPI_RSTYPE_ADDRESS32:
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
/*
* 32-Bit Address Resource:
* Add the size of the optional resource_source info
@@ -419,7 +258,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
resource_source);
break;
- case ACPI_RSTYPE_ADDRESS64:
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
/*
* 64-Bit Address Resource:
* Add the size of the optional resource_source info
@@ -430,7 +269,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
resource_source);
break;
- case ACPI_RSTYPE_EXT_IRQ:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
/*
* Extended IRQ Resource:
* Add the size of each additional optional interrupt beyond the
@@ -438,7 +277,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
*/
segment_size += (((acpi_size)
resource->data.extended_irq.
- number_of_interrupts - 1) * 4);
+ interrupt_count - 1) * 4);
/* Add the size of the optional resource_source info */
@@ -454,7 +293,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
/* Update the total */
- byte_stream_size_needed += segment_size;
+ aml_size_needed += segment_size;
/* Point to the next object */
@@ -471,9 +310,9 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
*
* FUNCTION: acpi_rs_get_list_length
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream
- * byte_stream_buffer_length - Size of byte_stream_buffer
- * size_needed - Where the size needed is returned
+ * PARAMETERS: aml_buffer - Pointer to the resource byte stream
+ * aml_buffer_length - Size of aml_buffer
+ * size_needed - Where the size needed is returned
*
* RETURN: Status
*
@@ -484,11 +323,11 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
******************************************************************************/
acpi_status
-acpi_rs_get_list_length(u8 * byte_stream_buffer,
- u32 byte_stream_buffer_length, acpi_size * size_needed)
+acpi_rs_get_list_length(u8 * aml_buffer,
+ u32 aml_buffer_length, acpi_size * size_needed)
{
u8 *buffer;
- struct acpi_resource_sizes *resource_info;
+ struct acpi_resource_info *resource_info;
u32 buffer_size = 0;
u32 bytes_parsed = 0;
u8 resource_type;
@@ -499,14 +338,14 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_FUNCTION_TRACE("rs_get_list_length");
- while (bytes_parsed < byte_stream_buffer_length) {
+ while (bytes_parsed < aml_buffer_length) {
/* The next byte in the stream is the resource descriptor type */
- resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
+ resource_type = acpi_rs_get_resource_type(*aml_buffer);
/* Get the base stream size and structure sizes for the descriptor */
- resource_info = acpi_rs_get_resource_sizes(resource_type);
+ resource_info = acpi_rs_get_resource_info(resource_type);
if (!resource_info) {
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
}
@@ -514,43 +353,46 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
/* Get the Length field from the input resource descriptor */
resource_length =
- acpi_rs_get_resource_length(byte_stream_buffer);
+ acpi_rs_get_resource_length(ACPI_CAST_PTR
+ (union aml_resource,
+ aml_buffer));
/* Augment the size for descriptors with optional fields */
extra_struct_bytes = 0;
- if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) {
+ if (!(resource_type & ACPI_RESOURCE_NAME_LARGE)) {
/*
* Small resource descriptors
*/
- header_length = 1;
- buffer = byte_stream_buffer + header_length;
+ header_length =
+ sizeof(struct aml_resource_small_header);
+ buffer = aml_buffer + header_length;
switch (resource_type) {
- case ACPI_RDESC_TYPE_IRQ_FORMAT:
+ case ACPI_RESOURCE_NAME_IRQ:
/*
* IRQ Resource:
* Get the number of bits set in the IRQ word
*/
ACPI_MOVE_16_TO_16(&temp16, buffer);
-
extra_struct_bytes =
(acpi_rs_count_set_bits(temp16) *
sizeof(u32));
break;
- case ACPI_RDESC_TYPE_DMA_FORMAT:
+ case ACPI_RESOURCE_NAME_DMA:
/*
* DMA Resource:
* Get the number of bits set in the DMA channels byte
*/
+ ACPI_MOVE_16_TO_16(&temp16, buffer);
extra_struct_bytes =
- (acpi_rs_count_set_bits((u16) * buffer) *
+ (acpi_rs_count_set_bits(temp16) *
sizeof(u32));
break;
- case ACPI_RDESC_TYPE_SMALL_VENDOR:
+ case ACPI_RESOURCE_NAME_VENDOR_SMALL:
/*
* Vendor Specific Resource:
* Ensure a 32-bit boundary for the structure
@@ -559,12 +401,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_ROUND_UP_to_32_bITS(resource_length);
break;
- case ACPI_RDESC_TYPE_END_TAG:
+ case ACPI_RESOURCE_NAME_END_TAG:
/*
* End Tag:
* Terminate the loop now
*/
- byte_stream_buffer_length = bytes_parsed;
+ aml_buffer_length = bytes_parsed;
break;
default:
@@ -574,11 +416,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
/*
* Large resource descriptors
*/
- header_length = sizeof(struct asl_large_header);
- buffer = byte_stream_buffer + header_length;
+ header_length =
+ sizeof(struct aml_resource_large_header);
+ buffer = aml_buffer + header_length;
switch (resource_type) {
- case ACPI_RDESC_TYPE_LARGE_VENDOR:
+ case ACPI_RESOURCE_NAME_VENDOR_LARGE:
/*
* Vendor Defined Resource:
* Add vendor data and ensure a 32-bit boundary for the structure
@@ -587,8 +430,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_ROUND_UP_to_32_bITS(resource_length);
break;
- case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
- case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+ case ACPI_RESOURCE_NAME_ADDRESS32:
+ case ACPI_RESOURCE_NAME_ADDRESS16:
/*
* 32-Bit or 16-bit Address Resource:
* Add the size of any optional data (resource_source)
@@ -596,10 +439,11 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
extra_struct_bytes =
acpi_rs_stream_option_length
(resource_length,
- resource_info->minimum_stream_size);
+ resource_info->
+ minimum_aml_resource_length);
break;
- case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
+ case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
/*
* Extended IRQ:
* Point past the interrupt_vector_flags to get the
@@ -622,10 +466,10 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
-
extra_struct_bytes,
resource_info->
- minimum_stream_size);
+ minimum_aml_resource_length);
break;
- case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+ case ACPI_RESOURCE_NAME_ADDRESS64:
/*
* 64-Bit Address Resource:
* Add the size of any optional data (resource_source)
@@ -635,7 +479,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_ROUND_UP_to_64_bITS
(acpi_rs_stream_option_length
(resource_length,
- resource_info->minimum_stream_size));
+ resource_info->
+ minimum_aml_resource_length));
break;
default:
@@ -646,7 +491,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
/* Update the required buffer size for the internal descriptor structs */
temp16 =
- (u16) (resource_info->minimum_struct_size +
+ (u16) (resource_info->minimum_internal_struct_length +
extra_struct_bytes);
buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16);
@@ -656,7 +501,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
*/
temp16 = (u16) (header_length + resource_length);
bytes_parsed += temp16;
- byte_stream_buffer += temp16;
+ aml_buffer += temp16;
}
/* This is the data the caller needs */
@@ -758,8 +603,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
(*sub_object_list)->string.
length + 1);
} else {
- temp_size_needed +=
- acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
+ temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
}
} else {
/*
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 0911526b7ad..6c7c6c56063 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate")
*
* FUNCTION: acpi_rs_create_resource_list
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream
- * output_buffer - Pointer to the user's buffer
+ * PARAMETERS: aml_buffer - Pointer to the resource byte stream
+ * output_buffer - Pointer to the user's buffer
*
- * RETURN: Status - AE_OK if okay, else a valid acpi_status code
+ * RETURN: Status: AE_OK if okay, else a valid acpi_status code
* If output_buffer is not large enough, output_buffer_length
* indicates how large output_buffer should be, else it
* indicates how may u8 elements of output_buffer are valid.
@@ -67,33 +67,30 @@ ACPI_MODULE_NAME("rscreate")
*
******************************************************************************/
acpi_status
-acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
+acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
struct acpi_buffer *output_buffer)
{
acpi_status status;
- u8 *byte_stream_start;
+ u8 *aml_start;
acpi_size list_size_needed = 0;
- u32 byte_stream_buffer_length;
+ u32 aml_buffer_length;
ACPI_FUNCTION_TRACE("rs_create_resource_list");
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
- byte_stream_buffer));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer));
/* Params already validated, so we don't re-validate here */
- byte_stream_buffer_length = byte_stream_buffer->buffer.length;
- byte_stream_start = byte_stream_buffer->buffer.pointer;
+ aml_buffer_length = aml_buffer->buffer.length;
+ aml_start = aml_buffer->buffer.pointer;
/*
- * Pass the byte_stream_buffer into a module that can calculate
+ * Pass the aml_buffer into a module that can calculate
* the buffer size needed for the linked list
*/
- status =
- acpi_rs_get_list_length(byte_stream_start,
- byte_stream_buffer_length,
- &list_size_needed);
+ status = acpi_rs_get_list_length(aml_start, aml_buffer_length,
+ &list_size_needed);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n",
status, (u32) list_size_needed));
@@ -110,10 +107,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
/* Do the conversion */
- status =
- acpi_rs_byte_stream_to_list(byte_stream_start,
- byte_stream_buffer_length,
- output_buffer->pointer);
+ status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length,
+ output_buffer->pointer);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -360,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
/*******************************************************************************
*
- * FUNCTION: acpi_rs_create_byte_stream
+ * FUNCTION: acpi_rs_create_aml_resources
*
* PARAMETERS: linked_list_buffer - Pointer to the resource linked list
* output_buffer - Pointer to the user's buffer
@@ -377,13 +372,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
******************************************************************************/
acpi_status
-acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
- struct acpi_buffer *output_buffer)
+acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
+ struct acpi_buffer *output_buffer)
{
acpi_status status;
- acpi_size byte_stream_size_needed = 0;
+ acpi_size aml_size_needed = 0;
- ACPI_FUNCTION_TRACE("rs_create_byte_stream");
+ ACPI_FUNCTION_TRACE("rs_create_aml_resources");
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n",
linked_list_buffer));
@@ -394,11 +389,10 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
* Pass the linked_list_buffer into a module that calculates
* the buffer size needed for the byte stream.
*/
- status = acpi_rs_get_byte_stream_length(linked_list_buffer,
- &byte_stream_size_needed);
+ status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed);
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n",
- (u32) byte_stream_size_needed,
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n",
+ (u32) aml_size_needed,
acpi_format_exception(status)));
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -406,8 +400,7 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
/* Validate/Allocate/Clear caller buffer */
- status =
- acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed);
+ status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -415,9 +408,9 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
/* Do the conversion */
status =
- acpi_rs_list_to_byte_stream(linked_list_buffer,
- byte_stream_size_needed,
- output_buffer->pointer);
+ acpi_rs_convert_resources_to_aml(linked_list_buffer,
+ aml_size_needed,
+ output_buffer->pointer);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index 9d93ee5f006..2f8990845b2 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -49,38 +49,6 @@ ACPI_MODULE_NAME("rsdump")
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */
-static void acpi_rs_dump_irq(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_address16(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_address32(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_address64(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_dma(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_io(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_memory24(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_memory32(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource);
-
-static void acpi_rs_dump_end_tag(union acpi_resource_data *resource);
-
static void acpi_rs_out_string(char *title, char *value);
static void acpi_rs_out_integer8(char *title, u8 value);
@@ -104,30 +72,6 @@ acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
-/* Dispatch table for resource dump functions */
-
-typedef
-void (*ACPI_DUMP_RESOURCE) (union acpi_resource_data * data);
-
-static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = {
- acpi_rs_dump_irq, /* ACPI_RSTYPE_IRQ */
- acpi_rs_dump_dma, /* ACPI_RSTYPE_DMA */
- acpi_rs_dump_start_depend_fns, /* ACPI_RSTYPE_START_DPF */
- acpi_rs_dump_end_depend_fns, /* ACPI_RSTYPE_END_DPF */
- acpi_rs_dump_io, /* ACPI_RSTYPE_IO */
- acpi_rs_dump_fixed_io, /* ACPI_RSTYPE_FIXED_IO */
- acpi_rs_dump_vendor_specific, /* ACPI_RSTYPE_VENDOR */
- acpi_rs_dump_end_tag, /* ACPI_RSTYPE_END_TAG */
- acpi_rs_dump_memory24, /* ACPI_RSTYPE_MEM24 */
- acpi_rs_dump_memory32, /* ACPI_RSTYPE_MEM32 */
- acpi_rs_dump_fixed_memory32, /* ACPI_RSTYPE_FIXED_MEM32 */
- acpi_rs_dump_address16, /* ACPI_RSTYPE_ADDRESS16 */
- acpi_rs_dump_address32, /* ACPI_RSTYPE_ADDRESS32 */
- acpi_rs_dump_address64, /* ACPI_RSTYPE_ADDRESS64 */
- acpi_rs_dump_extended_irq, /* ACPI_RSTYPE_EXT_IRQ */
- acpi_rs_dump_generic_reg /* ACPI_RSTYPE_GENERIC_REG */
-};
-
/*******************************************************************************
*
* FUNCTION: acpi_rs_out*
@@ -144,32 +88,32 @@ static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = {
static void acpi_rs_out_string(char *title, char *value)
{
- acpi_os_printf("%30s : %s\n", title, value);
+ acpi_os_printf("%27s : %s\n", title, value);
}
static void acpi_rs_out_integer8(char *title, u8 value)
{
- acpi_os_printf("%30s : %2.2X\n", title, value);
+ acpi_os_printf("%27s : %2.2X\n", title, value);
}
static void acpi_rs_out_integer16(char *title, u16 value)
{
- acpi_os_printf("%30s : %4.4X\n", title, value);
+ acpi_os_printf("%27s : %4.4X\n", title, value);
}
static void acpi_rs_out_integer32(char *title, u32 value)
{
- acpi_os_printf("%30s : %8.8X\n", title, value);
+ acpi_os_printf("%27s : %8.8X\n", title, value);
}
static void acpi_rs_out_integer64(char *title, u64 value)
{
- acpi_os_printf("%30s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
+ acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
}
static void acpi_rs_out_title(char *title)
{
- acpi_os_printf("%30s : ", title);
+ acpi_os_printf("%27s : ", title);
}
/*******************************************************************************
@@ -190,7 +134,7 @@ static void acpi_rs_dump_byte_list(u32 length, u8 * data)
u32 i;
for (i = 0; i < length; i++) {
- acpi_os_printf("%28s%2.2X : %2.2X\n", "Byte", i, data[i]);
+ acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
}
}
@@ -199,7 +143,7 @@ static void acpi_rs_dump_dword_list(u32 length, u32 * data)
u32 i;
for (i = 0; i < length; i++) {
- acpi_os_printf("%28s%2.2X : %8.8X\n", "Dword", i, data[i]);
+ acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
}
}
@@ -213,6 +157,14 @@ static void acpi_rs_dump_short_byte_list(u32 length, u32 * data)
acpi_os_printf("\n");
}
+static void acpi_rs_dump_memory_attribute(u32 read_write_attribute)
+{
+
+ acpi_rs_out_string("Read/Write Attribute",
+ ACPI_READ_WRITE_MEMORY == read_write_attribute ?
+ "Read/Write" : "Read-Only");
+}
+
/*******************************************************************************
*
* FUNCTION: acpi_rs_dump_resource_source
@@ -229,6 +181,7 @@ static void acpi_rs_dump_short_byte_list(u32 length, u32 * data)
static void
acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
{
+ ACPI_FUNCTION_ENTRY();
if (resource_source->index == 0xFF) {
return;
@@ -290,11 +243,8 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
break;
}
- acpi_rs_out_string("Read/Write Attribute",
- ACPI_READ_WRITE_MEMORY ==
- resource->address.attribute.memory.
- read_write_attribute ? "Read/Write" :
- "Read Only");
+ acpi_rs_dump_memory_attribute(resource->address.attribute.
+ memory.read_write_attribute);
break;
case ACPI_IO_RANGE:
@@ -392,7 +342,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
/* Validate Type before dispatch */
- if (resource_list->type > ACPI_RSTYPE_MAX) {
+ if (resource_list->type > ACPI_RESOURCE_TYPE_MAX) {
acpi_os_printf
("Invalid descriptor type (%X) in resource list\n",
resource_list->type);
@@ -406,7 +356,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
/* Exit on end tag */
- if (resource_list->type == ACPI_RSTYPE_END_TAG) {
+ if (resource_list->type == ACPI_RESOURCE_TYPE_END_TAG) {
return;
}
@@ -431,7 +381,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
*
******************************************************************************/
-static void acpi_rs_dump_irq(union acpi_resource_data *resource)
+void acpi_rs_dump_irq(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
@@ -439,22 +389,21 @@ static void acpi_rs_dump_irq(union acpi_resource_data *resource)
acpi_rs_out_string("Triggering",
ACPI_LEVEL_SENSITIVE ==
- resource->irq.edge_level ? "Level" : "Edge");
+ resource->irq.triggering ? "Level" : "Edge");
acpi_rs_out_string("Active",
ACPI_ACTIVE_LOW ==
- resource->irq.active_high_low ? "Low" : "High");
+ resource->irq.polarity ? "Low" : "High");
acpi_rs_out_string("Sharing",
ACPI_SHARED ==
- resource->irq.
- shared_exclusive ? "Shared" : "Exclusive");
+ resource->irq.sharable ? "Shared" : "Exclusive");
acpi_rs_out_integer8("Interrupt Count",
- (u8) resource->irq.number_of_interrupts);
+ (u8) resource->irq.interrupt_count);
acpi_rs_out_title("Interrupt List");
- acpi_rs_dump_short_byte_list(resource->irq.number_of_interrupts,
+ acpi_rs_dump_short_byte_list(resource->irq.interrupt_count,
resource->irq.interrupts);
}
@@ -470,7 +419,7 @@ static void acpi_rs_dump_irq(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_dma(union acpi_resource_data *resource)
+void acpi_rs_dump_dma(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
@@ -523,16 +472,16 @@ static void acpi_rs_dump_dma(union acpi_resource_data *resource)
}
acpi_rs_out_integer8("DMA Channel Count",
- (u8) resource->dma.number_of_channels);
+ (u8) resource->dma.channel_count);
acpi_rs_out_title("Channel List");
- acpi_rs_dump_short_byte_list(resource->dma.number_of_channels,
+ acpi_rs_dump_short_byte_list(resource->dma.channel_count,
resource->dma.channels);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_start_depend_fns
+ * FUNCTION: acpi_rs_dump_start_dpf
*
* PARAMETERS: Resource - Pointer to an internal resource descriptor
*
@@ -542,7 +491,7 @@ static void acpi_rs_dump_dma(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource)
+void acpi_rs_dump_start_dpf(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
@@ -600,7 +549,7 @@ static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_io(union acpi_resource_data *resource)
+void acpi_rs_dump_io(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
@@ -610,15 +559,13 @@ static void acpi_rs_dump_io(union acpi_resource_data *resource)
ACPI_DECODE_16 ==
resource->io.io_decode ? "16-bit" : "10-bit");
- acpi_rs_out_integer32("Range Minimum Base",
- resource->io.min_base_address);
+ acpi_rs_out_integer32("Address Minimum", resource->io.minimum);
- acpi_rs_out_integer32("Range Maximum Base",
- resource->io.max_base_address);
+ acpi_rs_out_integer32("Address Maximum", resource->io.maximum);
acpi_rs_out_integer32("Alignment", resource->io.alignment);
- acpi_rs_out_integer32("Range Length", resource->io.range_length);
+ acpi_rs_out_integer32("Address Length", resource->io.address_length);
}
/*******************************************************************************
@@ -633,21 +580,21 @@ static void acpi_rs_dump_io(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource)
+void acpi_rs_dump_fixed_io(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
acpi_os_printf("Fixed I/O Resource\n");
- acpi_rs_out_integer32("Range Base Address",
- resource->fixed_io.base_address);
+ acpi_rs_out_integer32("Address", resource->fixed_io.address);
- acpi_rs_out_integer32("Range Length", resource->fixed_io.range_length);
+ acpi_rs_out_integer32("Address Length",
+ resource->fixed_io.address_length);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_vendor_specific
+ * FUNCTION: acpi_rs_dump_vendor
*
* PARAMETERS: Resource - Pointer to an internal resource descriptor
*
@@ -657,16 +604,16 @@ static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource)
+void acpi_rs_dump_vendor(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
acpi_os_printf("Vendor Specific Resource\n");
- acpi_rs_out_integer16("Length", (u16) resource->vendor_specific.length);
+ acpi_rs_out_integer16("Length", (u16) resource->vendor.byte_length);
- acpi_rs_dump_byte_list(resource->vendor_specific.length,
- resource->vendor_specific.reserved);
+ acpi_rs_dump_byte_list(resource->vendor.byte_length,
+ resource->vendor.byte_data);
}
/*******************************************************************************
@@ -681,27 +628,24 @@ static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_memory24(union acpi_resource_data *resource)
+void acpi_rs_dump_memory24(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
acpi_os_printf("24-Bit Memory Range Resource\n");
- acpi_rs_out_string("Attribute",
- ACPI_READ_WRITE_MEMORY ==
- resource->memory24.read_write_attribute ?
- "Read/Write" : "Read Only");
+ acpi_rs_dump_memory_attribute(resource->memory24.read_write_attribute);
- acpi_rs_out_integer16("Range Minimum Base",
- (u16) resource->memory24.min_base_address);
+ acpi_rs_out_integer16("Address Minimum",
+ (u16) resource->memory24.minimum);
- acpi_rs_out_integer16("Range Maximum Base",
- (u16) resource->memory24.max_base_address);
+ acpi_rs_out_integer16("Address Maximum",
+ (u16) resource->memory24.maximum);
acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment);
- acpi_rs_out_integer16("Range Length",
- (u16) resource->memory24.range_length);
+ acpi_rs_out_integer16("Address Length",
+ (u16) resource->memory24.address_length);
}
/*******************************************************************************
@@ -716,26 +660,22 @@ static void acpi_rs_dump_memory24(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_memory32(union acpi_resource_data *resource)
+void acpi_rs_dump_memory32(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
acpi_os_printf("32-Bit Memory Range Resource\n");
- acpi_rs_out_string("Attribute",
- ACPI_READ_WRITE_MEMORY ==
- resource->memory32.read_write_attribute ?
- "Read/Write" : "Read Only");
+ acpi_rs_dump_memory_attribute(resource->memory32.read_write_attribute);
- acpi_rs_out_integer32("Range Minimum Base",
- resource->memory32.min_base_address);
+ acpi_rs_out_integer32("Address Minimum", resource->memory32.minimum);
- acpi_rs_out_integer32("Range Maximum Base",
- resource->memory32.max_base_address);
+ acpi_rs_out_integer32("Address Maximum", resource->memory32.maximum);
acpi_rs_out_integer32("Alignment", resource->memory32.alignment);
- acpi_rs_out_integer32("Range Length", resource->memory32.range_length);
+ acpi_rs_out_integer32("Address Length",
+ resource->memory32.address_length);
}
/*******************************************************************************
@@ -750,22 +690,19 @@ static void acpi_rs_dump_memory32(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource)
+void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n");
- acpi_rs_out_string("Attribute",
- ACPI_READ_WRITE_MEMORY ==
- resource->fixed_memory32.read_write_attribute ?
- "Read/Write" : "Read Only");
+ acpi_rs_dump_memory_attribute(resource->fixed_memory32.
+ read_write_attribute);
- acpi_rs_out_integer32("Range Base Address",
- resource->fixed_memory32.range_base_address);
+ acpi_rs_out_integer32("Address", resource->fixed_memory32.address);
- acpi_rs_out_integer32("Range Length",
- resource->fixed_memory32.range_length);
+ acpi_rs_out_integer32("Address Length",
+ resource->fixed_memory32.address_length);
}
/*******************************************************************************
@@ -780,26 +717,25 @@ static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_address16(union acpi_resource_data *resource)
+void acpi_rs_dump_address16(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
- acpi_os_printf("16-Bit Address Space Resource\n");
+ acpi_os_printf("16-Bit WORD Address Space Resource\n");
acpi_rs_dump_address_common(resource);
acpi_rs_out_integer16("Granularity",
(u16) resource->address16.granularity);
- acpi_rs_out_integer16("Address Range Min",
- (u16) resource->address16.min_address_range);
+ acpi_rs_out_integer16("Address Minimum",
+ (u16) resource->address16.minimum);
- acpi_rs_out_integer16("Address Range Max",
- (u16) resource->address16.max_address_range);
+ acpi_rs_out_integer16("Address Maximum",
+ (u16) resource->address16.maximum);
- acpi_rs_out_integer16("Address Translation Offset",
- (u16) resource->address16.
- address_translation_offset);
+ acpi_rs_out_integer16("Translation Offset",
+ (u16) resource->address16.translation_offset);
acpi_rs_out_integer16("Address Length",
(u16) resource->address16.address_length);
@@ -819,24 +755,22 @@ static void acpi_rs_dump_address16(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_address32(union acpi_resource_data *resource)
+void acpi_rs_dump_address32(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
- acpi_os_printf("32-Bit Address Space Resource\n");
+ acpi_os_printf("32-Bit DWORD Address Space Resource\n");
acpi_rs_dump_address_common(resource);
acpi_rs_out_integer32("Granularity", resource->address32.granularity);
- acpi_rs_out_integer32("Address Range Min",
- resource->address32.min_address_range);
+ acpi_rs_out_integer32("Address Minimum", resource->address32.minimum);
- acpi_rs_out_integer32("Address Range Max",
- resource->address32.max_address_range);
+ acpi_rs_out_integer32("Address Maximum", resource->address32.maximum);
- acpi_rs_out_integer32("Address Translation Offset",
- resource->address32.address_translation_offset);
+ acpi_rs_out_integer32("Translation Offset",
+ resource->address32.translation_offset);
acpi_rs_out_integer32("Address Length",
resource->address32.address_length);
@@ -856,37 +790,32 @@ static void acpi_rs_dump_address32(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_address64(union acpi_resource_data *resource)
+void acpi_rs_dump_address64(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
- acpi_os_printf("64-Bit Address Space Resource\n");
+ acpi_os_printf("64-Bit QWORD Address Space Resource\n");
acpi_rs_dump_address_common(resource);
acpi_rs_out_integer64("Granularity", resource->address64.granularity);
- acpi_rs_out_integer64("Address Range Min",
- resource->address64.min_address_range);
+ acpi_rs_out_integer64("Address Minimum", resource->address64.minimum);
- acpi_rs_out_integer64("Address Range Max",
- resource->address64.max_address_range);
+ acpi_rs_out_integer64("Address Maximum", resource->address64.maximum);
- acpi_rs_out_integer64("Address Translation Offset",
- resource->address64.address_translation_offset);
+ acpi_rs_out_integer64("Translation Offset",
+ resource->address64.translation_offset);
acpi_rs_out_integer64("Address Length",
resource->address64.address_length);
- acpi_rs_out_integer64("Type Specific Attributes",
- resource->address64.type_specific_attributes);
-
acpi_rs_dump_resource_source(&resource->address64.resource_source);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_extended_irq
+ * FUNCTION: acpi_rs_dump_ext_address64
*
* PARAMETERS: Resource - Pointer to an internal resource descriptor
*
@@ -896,7 +825,46 @@ static void acpi_rs_dump_address64(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource)
+void acpi_rs_dump_ext_address64(union acpi_resource_data *resource)
+{
+ ACPI_FUNCTION_ENTRY();
+
+ acpi_os_printf("64-Bit Extended Address Space Resource\n");
+
+ acpi_rs_dump_address_common(resource);
+
+ acpi_rs_out_integer64("Granularity",
+ resource->ext_address64.granularity);
+
+ acpi_rs_out_integer64("Address Minimum",
+ resource->ext_address64.minimum);
+
+ acpi_rs_out_integer64("Address Maximum",
+ resource->ext_address64.maximum);
+
+ acpi_rs_out_integer64("Translation Offset",
+ resource->ext_address64.translation_offset);
+
+ acpi_rs_out_integer64("Address Length",
+ resource->ext_address64.address_length);
+
+ acpi_rs_out_integer64("Type-Specific Attribute",
+ resource->ext_address64.type_specific_attributes);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_dump_ext_irq
+ *
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the field names and values of the resource descriptor
+ *
+ ******************************************************************************/
+
+void acpi_rs_dump_ext_irq(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
@@ -910,24 +878,22 @@ static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource)
acpi_rs_out_string("Triggering",
ACPI_LEVEL_SENSITIVE ==
resource->extended_irq.
- edge_level ? "Level" : "Edge");
+ triggering ? "Level" : "Edge");
acpi_rs_out_string("Active",
- ACPI_ACTIVE_LOW ==
- resource->extended_irq.
- active_high_low ? "Low" : "High");
+ ACPI_ACTIVE_LOW == resource->extended_irq.polarity ?
+ "Low" : "High");
acpi_rs_out_string("Sharing",
- ACPI_SHARED ==
- resource->extended_irq.
- shared_exclusive ? "Shared" : "Exclusive");
+ ACPI_SHARED == resource->extended_irq.sharable ?
+ "Shared" : "Exclusive");
acpi_rs_dump_resource_source(&resource->extended_irq.resource_source);
acpi_rs_out_integer8("Interrupts",
- (u8) resource->extended_irq.number_of_interrupts);
+ (u8) resource->extended_irq.interrupt_count);
- acpi_rs_dump_dword_list(resource->extended_irq.number_of_interrupts,
+ acpi_rs_dump_dword_list(resource->extended_irq.interrupt_count,
resource->extended_irq.interrupts);
}
@@ -943,9 +909,8 @@ static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource)
+void acpi_rs_dump_generic_reg(union acpi_resource_data *resource)
{
-
ACPI_FUNCTION_ENTRY();
acpi_os_printf("Generic Register Resource\n");
@@ -957,15 +922,15 @@ static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource)
acpi_rs_out_integer8("Bit Offset",
(u8) resource->generic_reg.bit_offset);
- acpi_rs_out_integer8("Address Size",
- (u8) resource->generic_reg.address_size);
+ acpi_rs_out_integer8("Access Size",
+ (u8) resource->generic_reg.access_size);
acpi_rs_out_integer64("Address", resource->generic_reg.address);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dump_end_depend_fns
+ * FUNCTION: acpi_rs_dump_end_dpf
*
* PARAMETERS: Resource - Pointer to an internal resource descriptor
*
@@ -975,7 +940,7 @@ static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource)
+void acpi_rs_dump_end_dpf(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
@@ -994,7 +959,7 @@ static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource)
*
******************************************************************************/
-static void acpi_rs_dump_end_tag(union acpi_resource_data *resource)
+void acpi_rs_dump_end_tag(union acpi_resource_data *resource)
{
ACPI_FUNCTION_ENTRY();
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c
index 49a5f81c727..b31cb33ec56 100644
--- a/drivers/acpi/resources/rsinfo.c
+++ b/drivers/acpi/resources/rsinfo.c
@@ -207,7 +207,7 @@ struct acpi_resource_info acpi_gbl_lg_resource_info[] = {
{0, ACPI_RLARGE(struct aml_resource_memory24),
ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)},
{0, ACPI_RLARGE(struct aml_resource_generic_register),
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_registerister)},
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register)},
{0, 0, 0},
{1, ACPI_RLARGE(struct aml_resource_vendor_large),
ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)},
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index 6574e2ae2e5..0dab8cdfa80 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -49,426 +49,269 @@ ACPI_MODULE_NAME("rsio")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_io_resource
+ * FUNCTION: acpi_rs_get_io
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_io_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_io(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
+ ACPI_FUNCTION_TRACE("rs_get_io");
- ACPI_FUNCTION_TRACE("rs_io_resource");
+ /* Get the Decode flag */
- /* The number of bytes consumed are Constant */
+ resource->data.io.io_decode = aml->io.information & 0x01;
- *bytes_consumed = 8;
+ /*
+ * Get the following contiguous fields from the AML descriptor:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Alignment
+ * Length
+ */
+ ACPI_MOVE_16_TO_32(&resource->data.io.minimum, &aml->io.minimum);
+ ACPI_MOVE_16_TO_32(&resource->data.io.maximum, &aml->io.maximum);
+ resource->data.io.alignment = aml->io.alignment;
+ resource->data.io.address_length = aml->io.address_length;
- output_struct->type = ACPI_RSTYPE_IO;
+ /* Complete the resource header */
- /* Check Decode */
-
- buffer += 1;
- temp8 = *buffer;
-
- output_struct->data.io.io_decode = temp8 & 0x01;
-
- /* Check min_base Address */
-
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- output_struct->data.io.min_base_address = temp16;
-
- /* Check max_base Address */
-
- buffer += 2;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- output_struct->data.io.max_base_address = temp16;
-
- /* Check Base alignment */
-
- buffer += 2;
- temp8 = *buffer;
-
- output_struct->data.io.alignment = temp8;
-
- /* Check range_length */
-
- buffer += 1;
- temp8 = *buffer;
-
- output_struct->data.io.range_length = temp8;
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_IO;
+ resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_fixed_io_resource
+ * FUNCTION: acpi_rs_set_io
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
-
- ACPI_FUNCTION_TRACE("rs_fixed_io_resource");
+ ACPI_FUNCTION_TRACE("rs_set_io");
- /* The number of bytes consumed are Constant */
+ /* I/O Information Byte */
- *bytes_consumed = 4;
+ aml->io.information = (u8) (resource->data.io.io_decode & 0x01);
- output_struct->type = ACPI_RSTYPE_FIXED_IO;
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Alignment
+ * Length
+ */
+ ACPI_MOVE_32_TO_16(&aml->io.minimum, &resource->data.io.minimum);
+ ACPI_MOVE_32_TO_16(&aml->io.maximum, &resource->data.io.maximum);
+ aml->io.alignment = (u8) resource->data.io.alignment;
+ aml->io.address_length = (u8) resource->data.io.address_length;
- /* Check Range Base Address */
+ /* Complete the AML descriptor header */
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- output_struct->data.fixed_io.base_address = temp16;
-
- /* Check range_length */
-
- buffer += 2;
- temp8 = *buffer;
-
- output_struct->data.fixed_io.range_length = temp8;
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IO,
+ sizeof(struct aml_resource_io), aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_io_stream
+ * FUNCTION: acpi_rs_get_fixed_io
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_io_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_get_fixed_io(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
-
- ACPI_FUNCTION_TRACE("rs_io_stream");
-
- /* The Descriptor Type field is static */
-
- *buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07;
- buffer += 1;
-
- /* Io Information Byte */
-
- temp8 = (u8) (resource->data.io.io_decode & 0x01);
-
- *buffer = temp8;
- buffer += 1;
-
- /* Set the Range minimum base address */
-
- temp16 = (u16) resource->data.io.min_base_address;
-
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
-
- /* Set the Range maximum base address */
+ ACPI_FUNCTION_TRACE("rs_get_fixed_io");
- temp16 = (u16) resource->data.io.max_base_address;
+ /*
+ * Get the following contiguous fields from the AML descriptor:
+ * Base Address
+ * Length
+ */
+ ACPI_MOVE_16_TO_32(&resource->data.fixed_io.address,
+ &aml->fixed_io.address);
+ resource->data.fixed_io.address_length = aml->fixed_io.address_length;
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
+ /* Complete the resource header */
- /* Set the base alignment */
-
- temp8 = (u8) resource->data.io.alignment;
-
- *buffer = temp8;
- buffer += 1;
-
- /* Set the range length */
-
- temp8 = (u8) resource->data.io.range_length;
-
- *buffer = temp8;
- buffer += 1;
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ resource->type = ACPI_RESOURCE_TYPE_FIXED_IO;
+ resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_fixed_io_stream
+ * FUNCTION: acpi_rs_set_fixed_io
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_fixed_io_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
-
- ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
-
- /* The Descriptor Type field is static */
-
- *buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03;
- buffer += 1;
-
- /* Set the Range base address */
-
- temp16 = (u16) resource->data.fixed_io.base_address;
-
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
-
- /* Set the range length */
-
- temp8 = (u8) resource->data.fixed_io.range_length;
-
- *buffer = temp8;
- buffer += 1;
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ ACPI_FUNCTION_TRACE("rs_set_fixed_io");
+
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Base Address
+ * Length
+ */
+ ACPI_MOVE_32_TO_16(&aml->fixed_io.address,
+ &resource->data.fixed_io.address);
+ aml->fixed_io.address_length =
+ (u8) resource->data.fixed_io.address_length;
+
+ /* Complete the AML descriptor header */
+
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO,
+ sizeof(struct aml_resource_fixed_io), aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dma_resource
+ * FUNCTION: acpi_rs_get_dma
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_dma_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_dma(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u8 temp8 = 0;
- u8 index;
- u8 i;
- acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
+ u32 channel_count = 0;
+ u32 i;
+ u8 temp8;
- ACPI_FUNCTION_TRACE("rs_dma_resource");
-
- /* The number of bytes consumed are Constant */
-
- *bytes_consumed = 3;
- output_struct->type = ACPI_RSTYPE_DMA;
-
- /* Point to the 8-bits of Byte 1 */
-
- buffer += 1;
- temp8 = *buffer;
+ ACPI_FUNCTION_TRACE("rs_get_dma");
/* Decode the DMA channel bits */
- for (i = 0, index = 0; index < 8; index++) {
- if ((temp8 >> index) & 0x01) {
- output_struct->data.dma.channels[i] = index;
- i++;
+ for (i = 0; i < 8; i++) {
+ if ((aml->dma.dma_channel_mask >> i) & 0x01) {
+ resource->data.dma.channels[channel_count] = i;
+ channel_count++;
}
}
- /* Zero DMA channels is valid */
-
- output_struct->data.dma.number_of_channels = i;
- if (i > 0) {
- /* Calculate the structure size based upon the number of interrupts */
+ resource->length = 0;
+ resource->data.dma.channel_count = channel_count;
- struct_size += ((acpi_size) i - 1) * 4;
+ /*
+ * Calculate the structure size based upon the number of channels
+ * Note: Zero DMA channels is valid
+ */
+ if (channel_count > 0) {
+ resource->length = (u32) (channel_count - 1) * 4;
}
- /* Point to Byte 2 */
+ /* Get the flags: transfer preference, bus mastering, channel speed */
- buffer += 1;
- temp8 = *buffer;
+ temp8 = aml->dma.flags;
+ resource->data.dma.transfer = temp8 & 0x03;
+ resource->data.dma.bus_master = (temp8 >> 2) & 0x01;
+ resource->data.dma.type = (temp8 >> 5) & 0x03;
- /* Check for transfer preference (Bits[1:0]) */
-
- output_struct->data.dma.transfer = temp8 & 0x03;
-
- if (0x03 == output_struct->data.dma.transfer) {
+ if (resource->data.dma.transfer == 0x03) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid DMA.Transfer preference (3)\n"));
return_ACPI_STATUS(AE_BAD_DATA);
}
- /* Get bus master preference (Bit[2]) */
-
- output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01;
-
- /* Get channel speed support (Bits[6:5]) */
+ /* Complete the resource header */
- output_struct->data.dma.type = (temp8 >> 5) & 0x03;
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_DMA;
+ resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_dma_stream
+ * FUNCTION: acpi_rs_set_dma
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_dma_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- u8 index;
-
- ACPI_FUNCTION_TRACE("rs_dma_stream");
-
- /* The Descriptor Type field is static */
+ u8 i;
- *buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02;
- buffer += 1;
- temp8 = 0;
+ ACPI_FUNCTION_TRACE("rs_set_dma");
- /* Loop through all of the Channels and set the mask bits */
+ /* Convert channel list to 8-bit DMA channel bitmask */
- for (index = 0; index < resource->data.dma.number_of_channels; index++) {
- temp16 = (u16) resource->data.dma.channels[index];
- temp8 |= 0x1 << temp16;
+ aml->dma.dma_channel_mask = 0;
+ for (i = 0; i < resource->data.dma.channel_count; i++) {
+ aml->dma.dma_channel_mask |=
+ (1 << resource->data.dma.channels[i]);
}
- *buffer = temp8;
- buffer += 1;
-
- /* Set the DMA Info */
-
- temp8 = (u8) ((resource->data.dma.type & 0x03) << 5);
- temp8 |= ((resource->data.dma.bus_master & 0x01) << 2);
- temp8 |= (resource->data.dma.transfer & 0x03);
+ /* Set the DMA Flag bits */
- *buffer = temp8;
- buffer += 1;
+ aml->dma.flags = (u8)
+ (((resource->data.dma.type & 0x03) << 5) |
+ ((resource->data.dma.bus_master & 0x01) << 2) |
+ (resource->data.dma.transfer & 0x03));
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_DMA,
+ sizeof(struct aml_resource_dma), aml);
return_ACPI_STATUS(AE_OK);
}
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
index 75df962115c..4e854ba7081 100644
--- a/drivers/acpi/resources/rsirq.c
+++ b/drivers/acpi/resources/rsirq.c
@@ -49,93 +49,67 @@ ACPI_MODULE_NAME("rsirq")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_irq_resource
+ * FUNCTION: acpi_rs_get_irq
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_irq_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_irq(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
u16 temp16 = 0;
- u8 temp8 = 0;
- u8 index;
- u8 i;
- acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq);
-
- ACPI_FUNCTION_TRACE("rs_irq_resource");
-
- /*
- * The number of bytes consumed are contained in the descriptor
- * (Bits:0-1)
- */
- temp8 = *buffer;
- *bytes_consumed = (temp8 & 0x03) + 1;
- output_struct->type = ACPI_RSTYPE_IRQ;
+ u32 interrupt_count = 0;
+ u32 i;
+ u32 resource_length;
- /* Point to the 16-bits of Bytes 1 and 2 */
+ ACPI_FUNCTION_TRACE("rs_get_irq");
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ /* Get the IRQ mask (bytes 1:2) */
- output_struct->data.irq.number_of_interrupts = 0;
+ ACPI_MOVE_16_TO_16(&temp16, &aml->irq.irq_mask);
- /* Decode the IRQ bits */
+ /* Decode the IRQ bits (up to 16 possible) */
- for (i = 0, index = 0; index < 16; index++) {
- if ((temp16 >> index) & 0x01) {
- output_struct->data.irq.interrupts[i] = index;
- i++;
+ for (i = 0; i < 16; i++) {
+ if ((temp16 >> i) & 0x01) {
+ resource->data.irq.interrupts[interrupt_count] = i;
+ interrupt_count++;
}
}
/* Zero interrupts is valid */
- output_struct->data.irq.number_of_interrupts = i;
- if (i > 0) {
+ resource_length = 0;
+ resource->data.irq.interrupt_count = interrupt_count;
+ if (interrupt_count > 0) {
/* Calculate the structure size based upon the number of interrupts */
- struct_size += ((acpi_size) i - 1) * 4;
+ resource_length = (u32) (interrupt_count - 1) * 4;
}
- /* Point to Byte 3 if it is used */
-
- if (4 == *bytes_consumed) {
- buffer += 2;
- temp8 = *buffer;
+ /* Get Flags (Byte 3) if it is used */
+ if (aml_resource_length == 3) {
/* Check for HE, LL interrupts */
- switch (temp8 & 0x09) {
+ switch (aml->irq.flags & 0x09) {
case 0x01: /* HE */
- output_struct->data.irq.edge_level =
- ACPI_EDGE_SENSITIVE;
- output_struct->data.irq.active_high_low =
- ACPI_ACTIVE_HIGH;
+ resource->data.irq.triggering = ACPI_EDGE_SENSITIVE;
+ resource->data.irq.polarity = ACPI_ACTIVE_HIGH;
break;
case 0x08: /* LL */
- output_struct->data.irq.edge_level =
- ACPI_LEVEL_SENSITIVE;
- output_struct->data.irq.active_high_low =
- ACPI_ACTIVE_LOW;
+ resource->data.irq.triggering = ACPI_LEVEL_SENSITIVE;
+ resource->data.irq.polarity = ACPI_ACTIVE_LOW;
break;
default:
@@ -146,170 +120,131 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer,
*/
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid interrupt polarity/trigger in resource list, %X\n",
- temp8));
+ aml->irq.flags));
return_ACPI_STATUS(AE_BAD_DATA);
}
- /* Check for sharable */
+ /* Get Sharing flag */
- output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01;
+ resource->data.irq.sharable = (aml->irq.flags >> 3) & 0x01;
} else {
/*
- * Assume Edge Sensitive, Active High, Non-Sharable
- * per ACPI Specification
+ * Default configuration: assume Edge Sensitive, Active High,
+ * Non-Sharable as per the ACPI Specification
*/
- output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE;
- output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH;
- output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE;
+ resource->data.irq.triggering = ACPI_EDGE_SENSITIVE;
+ resource->data.irq.polarity = ACPI_ACTIVE_HIGH;
+ resource->data.irq.sharable = ACPI_EXCLUSIVE;
}
- /* Set the Length parameter */
+ /* Complete the resource header */
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_IRQ;
+ resource->length =
+ resource_length + ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_irq_stream
+ * FUNCTION: acpi_rs_set_irq
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_irq_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- u8 index;
- u8 IRqinfo_byte_needed;
+ acpi_size descriptor_length;
+ u16 irq_mask;
+ u8 i;
+
+ ACPI_FUNCTION_TRACE("rs_set_irq");
- ACPI_FUNCTION_TRACE("rs_irq_stream");
+ /* Convert interrupt list to 16-bit IRQ bitmask */
+
+ irq_mask = 0;
+ for (i = 0; i < resource->data.irq.interrupt_count; i++) {
+ irq_mask |= (1 << resource->data.irq.interrupts[i]);
+ }
+
+ /* Set the interrupt mask */
+
+ ACPI_MOVE_16_TO_16(&aml->irq.irq_mask, &irq_mask);
/*
* The descriptor field is set based upon whether a third byte is
* needed to contain the IRQ Information.
*/
- if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level &&
- ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low &&
- ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) {
- *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02;
- IRqinfo_byte_needed = FALSE;
- } else {
- *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03;
- IRqinfo_byte_needed = TRUE;
- }
-
- buffer += 1;
- temp16 = 0;
-
- /* Loop through all of the interrupts and set the mask bits */
+ if ((resource->data.irq.triggering == ACPI_EDGE_SENSITIVE) &&
+ (resource->data.irq.polarity == ACPI_ACTIVE_HIGH) &&
+ (resource->data.irq.sharable == ACPI_EXCLUSIVE)) {
+ /* irq_no_flags() descriptor can be used */
- for (index = 0;
- index < resource->data.irq.number_of_interrupts; index++) {
- temp8 = (u8) resource->data.irq.interrupts[index];
- temp16 |= 0x1 << temp8;
- }
+ descriptor_length = sizeof(struct aml_resource_irq_noflags);
+ } else {
+ /* Irq() descriptor must be used */
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
+ descriptor_length = sizeof(struct aml_resource_irq);
- /* Set the IRQ Info byte if needed. */
+ /* Set the IRQ Info byte */
- if (IRqinfo_byte_needed) {
- temp8 = 0;
- temp8 = (u8) ((resource->data.irq.shared_exclusive &
- 0x01) << 4);
+ aml->irq.flags = (u8)
+ ((resource->data.irq.sharable & 0x01) << 4);
- if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level &&
- ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) {
- temp8 |= 0x08;
+ if (ACPI_LEVEL_SENSITIVE == resource->data.irq.triggering &&
+ ACPI_ACTIVE_LOW == resource->data.irq.polarity) {
+ aml->irq.flags |= 0x08;
} else {
- temp8 |= 0x01;
+ aml->irq.flags |= 0x01;
}
-
- *buffer = temp8;
- buffer += 1;
}
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IRQ, descriptor_length,
+ aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_extended_irq_resource
+ * FUNCTION: acpi_rs_get_ext_irq
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_ext_irq(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- u8 *temp_ptr;
- u8 index;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq);
-
- ACPI_FUNCTION_TRACE("rs_extended_irq_resource");
+ char *out_resource_string;
+ u8 temp8;
- /* Get the Descriptor Length field */
+ ACPI_FUNCTION_TRACE("rs_get_ext_irq");
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
+ /* Get the flag bits */
- /* Validate minimum descriptor length */
-
- if (temp16 < 6) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
- }
-
- *bytes_consumed = temp16 + 3;
- output_struct->type = ACPI_RSTYPE_EXT_IRQ;
-
- /* Point to the Byte3 */
-
- buffer += 2;
- temp8 = *buffer;
-
- output_struct->data.extended_irq.producer_consumer = temp8 & 0x01;
+ temp8 = aml->extended_irq.flags;
+ resource->data.extended_irq.producer_consumer = temp8 & 0x01;
+ resource->data.extended_irq.polarity = (temp8 >> 2) & 0x01;
+ resource->data.extended_irq.sharable = (temp8 >> 3) & 0x01;
/*
* Check for Interrupt Mode
@@ -319,165 +254,80 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
*
* - Edge/Level are defined opposite in the table vs the headers
*/
- output_struct->data.extended_irq.edge_level =
+ resource->data.extended_irq.triggering =
(temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
- /* Check Interrupt Polarity */
-
- output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1;
-
- /* Check for sharable */
-
- output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01;
-
- /* Point to Byte4 (IRQ Table length) */
-
- buffer += 1;
- temp8 = *buffer;
-
- /* Must have at least one IRQ */
+ /* Get the IRQ Table length (Byte4) */
+ temp8 = aml->extended_irq.table_length;
+ resource->data.extended_irq.interrupt_count = temp8;
if (temp8 < 1) {
+ /* Must have at least one IRQ */
+
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
}
- output_struct->data.extended_irq.number_of_interrupts = temp8;
-
/*
* Add any additional structure size to properly calculate
* the next pointer at the end of this function
*/
- struct_size += (temp8 - 1) * 4;
+ resource->length = (temp8 - 1) * 4;
+ out_resource_string = ACPI_CAST_PTR(char,
+ (&resource->data.extended_irq.
+ interrupts[0] + temp8));
- /* Point to Byte5 (First IRQ Number) */
+ /* Get every IRQ in the table, each is 32 bits */
- buffer += 1;
+ acpi_rs_move_data(resource->data.extended_irq.interrupts,
+ aml->extended_irq.interrupt_number,
+ (u16) temp8, ACPI_MOVE_TYPE_32_TO_32);
- /* Cycle through every IRQ in the table */
+ /* Get the optional resource_source (index and string) */
- for (index = 0; index < temp8; index++) {
- ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq.
- interrupts[index], buffer);
+ resource->length +=
+ acpi_rs_get_resource_source(aml_resource_length,
+ (acpi_size) resource->length +
+ sizeof(struct
+ aml_resource_extended_irq),
+ &resource->data.extended_irq.
+ resource_source, aml,
+ out_resource_string);
- /* Point to the next IRQ */
+ /* Complete the resource header */
- buffer += 4;
- }
-
- /*
- * 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:
- * 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 + 1)) {
- /* Dereference the Index */
-
- temp8 = *buffer;
- output_struct->data.extended_irq.resource_source.index =
- (u32) temp8;
-
- /* Point to the String */
-
- buffer += 1;
-
- /* Point the String pointer to the end of this structure. */
-
- output_struct->data.extended_irq.resource_source.string_ptr =
- (char *)((char *)output_struct + struct_size);
-
- temp_ptr = (u8 *)
- output_struct->data.extended_irq.resource_source.string_ptr;
-
- /* Copy the string into the buffer */
-
- index = 0;
- while (*buffer) {
- *temp_ptr = *buffer;
-
- temp_ptr += 1;
- buffer += 1;
- index += 1;
- }
-
- /* Add the terminating null */
-
- *temp_ptr = 0;
- output_struct->data.extended_irq.resource_source.string_length =
- index + 1;
-
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * struct_size to the next 32-bit boundary.
- */
- temp8 = (u8) (index + 1);
- struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
- } else {
- output_struct->data.extended_irq.resource_source.index = 0;
- output_struct->data.extended_irq.resource_source.string_length =
- 0;
- output_struct->data.extended_irq.resource_source.string_ptr =
- NULL;
- }
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
+ resource->length +=
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_extended_irq_stream
+ * FUNCTION: acpi_rs_set_ext_irq
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_extended_irq_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 *length_field;
- u8 temp8 = 0;
- u8 index;
-
- ACPI_FUNCTION_TRACE("rs_extended_irq_stream");
-
- /* Set the Descriptor Type field */
-
- *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT;
- buffer += 1;
+ acpi_size descriptor_length;
- /* Save a pointer to the Length field - to be filled in later */
-
- length_field = ACPI_CAST_PTR(u16, buffer);
- buffer += 2;
+ ACPI_FUNCTION_TRACE("rs_set_ext_irq");
/* Set the Interrupt vector flags */
- temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01);
- temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3);
+ aml->extended_irq.flags = (u8)
+ ((resource->data.extended_irq.producer_consumer & 0x01) |
+ ((resource->data.extended_irq.sharable & 0x01) << 3) |
+ ((resource->data.extended_irq.polarity & 0x1) << 2));
/*
* Set the Interrupt Mode
@@ -488,64 +338,36 @@ acpi_rs_extended_irq_stream(struct acpi_resource *resource,
*
* - Edge/Level are defined opposite in the table vs the headers
*/
- if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) {
- temp8 |= 0x2;
+ if (resource->data.extended_irq.triggering == ACPI_EDGE_SENSITIVE) {
+ aml->extended_irq.flags |= 0x02;
}
- /* Set the Interrupt Polarity */
-
- temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2);
-
- *buffer = temp8;
- buffer += 1;
-
/* Set the Interrupt table length */
- temp8 = (u8) resource->data.extended_irq.number_of_interrupts;
-
- *buffer = temp8;
- buffer += 1;
+ aml->extended_irq.table_length = (u8)
+ resource->data.extended_irq.interrupt_count;
- for (index = 0;
- index < resource->data.extended_irq.number_of_interrupts;
- index++) {
- ACPI_MOVE_32_TO_32(buffer,
- &resource->data.extended_irq.
- interrupts[index]);
- buffer += 4;
- }
-
- /* Resource Source Index and Resource Source are optional */
+ descriptor_length = (sizeof(struct aml_resource_extended_irq) - 4) +
+ ((acpi_size) resource->data.extended_irq.interrupt_count *
+ sizeof(u32));
- if (0 != resource->data.extended_irq.resource_source.string_length) {
- *buffer =
- (u8) resource->data.extended_irq.resource_source.index;
- buffer += 1;
+ /* Set each interrupt value */
- /* Copy the string */
+ acpi_rs_move_data(aml->extended_irq.interrupt_number,
+ resource->data.extended_irq.interrupts,
+ (u16) resource->data.extended_irq.interrupt_count,
+ ACPI_MOVE_TYPE_32_TO_32);
- ACPI_STRCPY((char *)buffer,
- resource->data.extended_irq.resource_source.
- string_ptr);
-
- /*
- * Buffer needs to be set to the length of the string + one for the
- * terminating null
- */
- buffer +=
- (acpi_size) (ACPI_STRLEN
- (resource->data.extended_irq.resource_source.
- string_ptr) + 1);
- }
+ /* Resource Source Index and Resource Source are optional */
- /* Return the number of bytes consumed in this operation */
+ descriptor_length = acpi_rs_set_resource_source(aml, descriptor_length,
+ &resource->data.
+ extended_irq.
+ resource_source);
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ /* Complete the AML descriptor header */
- /*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
- */
- *length_field = (u16) (*bytes_consumed - 3);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_IRQ,
+ descriptor_length, aml);
return_ACPI_STATUS(AE_OK);
}
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index 87e75349dd0..f72d42e0927 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -47,106 +47,70 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rslist")
-/* Dispatch table for convert-to-stream functions */
-typedef
-acpi_status(*ACPI_STREAM_HANDLER) (struct acpi_resource * resource,
- u8 ** output_buffer,
- acpi_size * bytes_consumed);
-
-static ACPI_STREAM_HANDLER acpi_gbl_stream_dispatch[] = {
- acpi_rs_irq_stream, /* ACPI_RSTYPE_IRQ */
- acpi_rs_dma_stream, /* ACPI_RSTYPE_DMA */
- acpi_rs_start_depend_fns_stream, /* ACPI_RSTYPE_START_DPF */
- acpi_rs_end_depend_fns_stream, /* ACPI_RSTYPE_END_DPF */
- acpi_rs_io_stream, /* ACPI_RSTYPE_IO */
- acpi_rs_fixed_io_stream, /* ACPI_RSTYPE_FIXED_IO */
- acpi_rs_vendor_stream, /* ACPI_RSTYPE_VENDOR */
- acpi_rs_end_tag_stream, /* ACPI_RSTYPE_END_TAG */
- acpi_rs_memory24_stream, /* ACPI_RSTYPE_MEM24 */
- acpi_rs_memory32_range_stream, /* ACPI_RSTYPE_MEM32 */
- acpi_rs_fixed_memory32_stream, /* ACPI_RSTYPE_FIXED_MEM32 */
- acpi_rs_address16_stream, /* ACPI_RSTYPE_ADDRESS16 */
- acpi_rs_address32_stream, /* ACPI_RSTYPE_ADDRESS32 */
- acpi_rs_address64_stream, /* ACPI_RSTYPE_ADDRESS64 */
- acpi_rs_extended_irq_stream, /* ACPI_RSTYPE_EXT_IRQ */
- acpi_rs_generic_register_stream /* ACPI_RSTYPE_GENERIC_REG */
-};
-
-/* Dispatch tables for convert-to-resource functions */
-
-typedef
-acpi_status(*ACPI_RESOURCE_HANDLER) (u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer,
- acpi_size * structure_size);
-
-static ACPI_RESOURCE_HANDLER acpi_gbl_sm_resource_dispatch[] = {
- NULL, /* 0x00, Reserved */
- NULL, /* 0x01, Reserved */
- NULL, /* 0x02, Reserved */
- NULL, /* 0x03, Reserved */
- acpi_rs_irq_resource, /* ACPI_RDESC_TYPE_IRQ_FORMAT */
- acpi_rs_dma_resource, /* ACPI_RDESC_TYPE_DMA_FORMAT */
- acpi_rs_start_depend_fns_resource, /* ACPI_RDESC_TYPE_START_DEPENDENT */
- acpi_rs_end_depend_fns_resource, /* ACPI_RDESC_TYPE_END_DEPENDENT */
- acpi_rs_io_resource, /* ACPI_RDESC_TYPE_IO_PORT */
- acpi_rs_fixed_io_resource, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */
- NULL, /* 0x0A, Reserved */
- NULL, /* 0x0B, Reserved */
- NULL, /* 0x0C, Reserved */
- NULL, /* 0x0D, Reserved */
- acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_SMALL_VENDOR */
- acpi_rs_end_tag_resource /* ACPI_RDESC_TYPE_END_TAG */
-};
-
-static ACPI_RESOURCE_HANDLER acpi_gbl_lg_resource_dispatch[] = {
- NULL, /* 0x00, Reserved */
- acpi_rs_memory24_resource, /* ACPI_RDESC_TYPE_MEMORY_24 */
- acpi_rs_generic_register_resource, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */
- NULL, /* 0x03, Reserved */
- acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_LARGE_VENDOR */
- acpi_rs_memory32_range_resource, /* ACPI_RDESC_TYPE_MEMORY_32 */
- acpi_rs_fixed_memory32_resource, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */
- acpi_rs_address32_resource, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */
- acpi_rs_address16_resource, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */
- acpi_rs_extended_irq_resource, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */
- acpi_rs_address64_resource, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */
- acpi_rs_address64_resource /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */
-};
-
/* Local prototypes */
+static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type);
-static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type);
+static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml);
/*******************************************************************************
*
- * FUNCTION: acpi_rs_get_resource_type
+ * FUNCTION: acpi_rs_validate_resource_length
*
- * PARAMETERS: resource_type - Byte 0 of a resource descriptor
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
*
- * RETURN: The Resource Type with no extraneous bits (except the large/
- * small bit -- left alone)
+ * RETURN: Status - AE_OK if the resource length appears valid
*
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
+ * DESCRIPTION: Validate the resource_length. Fixed-length descriptors must
+ * have the exact length; variable-length descriptors must be
+ * at least as long as the minimum. Certain Small descriptors
+ * can vary in size by at most one byte.
*
******************************************************************************/
-u8 acpi_rs_get_resource_type(u8 resource_type)
+static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml)
{
+ struct acpi_resource_info *resource_info;
+ u16 minimum_aml_resource_length;
+ u16 resource_length;
+
ACPI_FUNCTION_ENTRY();
- /* Determine if this is a small or large resource */
+ /* Get the size and type info about this resource descriptor */
- if (resource_type & ACPI_RDESC_TYPE_LARGE) {
- /* Large Resource Type -- bits 6:0 contain the name */
+ resource_info =
+ acpi_rs_get_resource_info(aml->small_header.descriptor_type);
+ if (!resource_info) {
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ resource_length = acpi_rs_get_resource_length(aml);
+ minimum_aml_resource_length =
+ resource_info->minimum_aml_resource_length;
+
+ /* Validate based upon the type of resource, fixed length or variable */
+
+ if (resource_info->length_type == ACPI_FIXED_LENGTH) {
+ /* Fixed length resource, length must match exactly */
- return (resource_type);
+ if (resource_length != minimum_aml_resource_length) {
+ return (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+ } else if (resource_info->length_type == ACPI_VARIABLE_LENGTH) {
+ /* Variable length resource, must be at least the minimum */
+
+ if (resource_length < minimum_aml_resource_length) {
+ return (AE_AML_BAD_RESOURCE_LENGTH);
+ }
} else {
- /* Small Resource Type -- bits 6:3 contain the name */
+ /* Small variable length resource, allowed to be (Min) or (Min-1) */
- return ((u8) (resource_type & ACPI_RDESC_SMALL_MASK));
+ if ((resource_length > minimum_aml_resource_length) ||
+ (resource_length < (minimum_aml_resource_length - 1))) {
+ return (AE_AML_BAD_RESOURCE_LENGTH);
+ }
}
+
+ return (AE_OK);
}
/*******************************************************************************
@@ -162,38 +126,38 @@ u8 acpi_rs_get_resource_type(u8 resource_type)
*
******************************************************************************/
-static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type)
+static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type)
{
ACPI_FUNCTION_ENTRY();
/* Determine if this is a small or large resource */
- if (resource_type & ACPI_RDESC_TYPE_LARGE) {
+ if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
/* Large Resource Type -- bits 6:0 contain the name */
- if (resource_type > ACPI_RDESC_LARGE_MAX) {
+ if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
return (NULL);
}
- return (acpi_gbl_lg_resource_dispatch[(resource_type &
- ACPI_RDESC_LARGE_MASK)]);
+ return (acpi_gbl_lg_get_resource_dispatch[(resource_type &
+ ACPI_RESOURCE_NAME_LARGE_MASK)]);
} else {
/* Small Resource Type -- bits 6:3 contain the name */
- return (acpi_gbl_sm_resource_dispatch[((resource_type &
- ACPI_RDESC_SMALL_MASK)
- >> 3)]);
+ return (acpi_gbl_sm_get_resource_dispatch[((resource_type &
+ ACPI_RESOURCE_NAME_SMALL_MASK)
+ >> 3)]);
}
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_byte_stream_to_list
+ * FUNCTION: acpi_rs_convert_aml_to_resources
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream
- * byte_stream_buffer_length - Length of byte_stream_buffer
- * output_buffer - Pointer to the buffer that will
- * contain the output structures
+ * PARAMETERS: aml_buffer - Pointer to the resource byte stream
+ * aml_buffer_length - Length of aml_buffer
+ * output_buffer - Pointer to the buffer that will
+ * contain the output structures
*
* RETURN: Status
*
@@ -203,37 +167,60 @@ static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type)
******************************************************************************/
acpi_status
-acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
- u32 byte_stream_buffer_length, u8 * output_buffer)
+acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
+ u32 aml_buffer_length, u8 * output_buffer)
{
u8 *buffer = output_buffer;
acpi_status status;
acpi_size bytes_parsed = 0;
- acpi_size bytes_consumed = 0;
- acpi_size structure_size = 0;
struct acpi_resource *resource;
- ACPI_RESOURCE_HANDLER handler;
+ u16 resource_length;
+ u32 descriptor_length;
+ ACPI_GET_RESOURCE_HANDLER handler;
- ACPI_FUNCTION_TRACE("rs_byte_stream_to_list");
+ ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
/* Loop until end-of-buffer or an end_tag is found */
- while (bytes_parsed < byte_stream_buffer_length) {
+ while (bytes_parsed < aml_buffer_length) {
/* Get the handler associated with this Descriptor Type */
- handler = acpi_rs_get_resource_handler(*byte_stream_buffer);
- if (handler) {
- /* Convert a byte stream resource to local resource struct */
+ handler = acpi_rs_get_resource_handler(*aml_buffer);
+ if (!handler) {
+ /* No handler indicates invalid resource type */
- status = handler(byte_stream_buffer, &bytes_consumed,
- &buffer, &structure_size);
- } else {
- /* Invalid resource type */
+ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
+ }
- status = AE_AML_INVALID_RESOURCE_TYPE;
+ resource_length =
+ acpi_rs_get_resource_length(ACPI_CAST_PTR
+ (union aml_resource,
+ aml_buffer));
+
+ descriptor_length =
+ acpi_rs_get_descriptor_length(ACPI_CAST_PTR
+ (union aml_resource,
+ aml_buffer));
+
+ /*
+ * Perform limited validation of the resource length, based upon
+ * what we know about the resource type
+ */
+ status =
+ acpi_rs_validate_resource_length(ACPI_CAST_PTR
+ (union aml_resource,
+ aml_buffer));
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
+ /* Convert a byte stream resource to local resource struct */
+
+ status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer),
+ resource_length,
+ ACPI_CAST_PTR(struct acpi_resource, buffer));
if (ACPI_FAILURE(status)) {
+ ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status)));
return_ACPI_STATUS(status);
}
@@ -245,19 +232,19 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
/* Normal exit on completion of an end_tag resource descriptor */
- if (acpi_rs_get_resource_type(*byte_stream_buffer) ==
- ACPI_RDESC_TYPE_END_TAG) {
+ if (acpi_rs_get_resource_type(*aml_buffer) ==
+ ACPI_RESOURCE_NAME_END_TAG) {
return_ACPI_STATUS(AE_OK);
}
/* Update counter and point to the next input resource */
- bytes_parsed += bytes_consumed;
- byte_stream_buffer += bytes_consumed;
+ bytes_parsed += descriptor_length;
+ aml_buffer += descriptor_length;
/* Point to the next structure in the output buffer */
- buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
+ buffer += resource->length;
}
/* Completed buffer, but did not find an end_tag resource descriptor */
@@ -267,17 +254,15 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
/*******************************************************************************
*
- * FUNCTION: acpi_rs_list_to_byte_stream
+ * FUNCTION: acpi_rs_convert_resources_to_aml
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * byte_steam_size_needed - Calculated size of the byte stream
- * needed from calling
- * acpi_rs_get_byte_stream_length()
- * The size of the output_buffer is
- * guaranteed to be >=
- * byte_stream_size_needed
- * output_buffer - Pointer to the buffer that will
- * contain the byte stream
+ * PARAMETERS: Resource - Pointer to the resource linked list
+ * aml_size_needed - Calculated size of the byte stream
+ * needed from calling acpi_rs_get_aml_length()
+ * The size of the output_buffer is
+ * guaranteed to be >= aml_size_needed
+ * output_buffer - Pointer to the buffer that will
+ * contain the byte stream
*
* RETURN: Status
*
@@ -287,52 +272,69 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
******************************************************************************/
acpi_status
-acpi_rs_list_to_byte_stream(struct acpi_resource *resource,
- acpi_size byte_stream_size_needed,
- u8 * output_buffer)
+acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
+ acpi_size aml_size_needed, u8 * output_buffer)
{
- u8 *buffer = output_buffer;
- acpi_size bytes_consumed = 0;
+ u8 *aml_buffer = output_buffer;
acpi_status status;
- ACPI_FUNCTION_TRACE("rs_list_to_byte_stream");
+ ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml");
/* Convert each resource descriptor in the list */
while (1) {
- /* Validate Type before dispatch */
+ /* Validate Resource Descriptor Type before dispatch */
- if (resource->type > ACPI_RSTYPE_MAX) {
+ if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid descriptor type (%X) in resource list\n",
resource->type));
return_ACPI_STATUS(AE_BAD_DATA);
}
- /* Perform the conversion, per resource type */
+ /* Perform the conversion per resource type */
+
+ status =
+ acpi_gbl_set_resource_dispatch[resource->type] (resource,
+ ACPI_CAST_PTR
+ (union
+ aml_resource,
+ aml_buffer));
+ if (ACPI_FAILURE(status)) {
+ ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status)));
+ return_ACPI_STATUS(status);
+ }
+
+ /* Perform final sanity check on the new AML resource descriptor */
- status = acpi_gbl_stream_dispatch[resource->type] (resource,
- &buffer,
- &bytes_consumed);
+ status =
+ acpi_rs_validate_resource_length(ACPI_CAST_PTR
+ (union aml_resource,
+ aml_buffer));
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
- /* Check for end-of-list */
+ /* Check for end-of-list, normal exit */
- if (resource->type == ACPI_RSTYPE_END_TAG) {
- /* An End Tag indicates the end of the Resource Template */
+ if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
+ /* An End Tag indicates the end of the input Resource Template */
return_ACPI_STATUS(AE_OK);
}
- /* Set the Buffer to point to the next (output) resource descriptor */
+ /* Extract the total length of the new descriptor */
+ /* Set the aml_buffer to point to the next (output) resource descriptor */
- buffer += bytes_consumed;
+ aml_buffer +=
+ acpi_rs_get_descriptor_length(ACPI_CAST_PTR
+ (union aml_resource,
+ aml_buffer));
- /* Point to the next input resource object */
+ /* Point to the next input resource descriptor */
- resource = ACPI_PTR_ADD(struct acpi_resource,
- resource, resource->length);
+ resource =
+ ACPI_PTR_ADD(struct acpi_resource, resource,
+ resource->length);
}
}
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index 418f1afb10a..47e979e7ba3 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.c
@@ -49,446 +49,260 @@ ACPI_MODULE_NAME("rsmemory")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_memory24_resource
+ * FUNCTION: acpi_rs_get_memory24
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_memory24_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_memory24(union aml_resource * aml,
+ u16 aml_resource_length, struct acpi_resource * resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
+ ACPI_FUNCTION_TRACE("rs_get_memory24");
- ACPI_FUNCTION_TRACE("rs_memory24_resource");
+ /* Get the Read/Write bit */
- /* Point past the Descriptor to get the number of bytes consumed */
+ resource->data.memory24.read_write_attribute =
+ (aml->memory24.information & 0x01);
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- buffer += 2;
- *bytes_consumed = (acpi_size) temp16 + 3;
- output_struct->type = ACPI_RSTYPE_MEM24;
-
- /* Check Byte 3 the Read/Write bit */
-
- temp8 = *buffer;
- buffer += 1;
- output_struct->data.memory24.read_write_attribute = temp8 & 0x01;
-
- /* Get min_base_address (Bytes 4-5) */
-
- 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_16_TO_16(&temp16, buffer);
- buffer += 2;
- output_struct->data.memory24.max_base_address = temp16;
-
- /* Get Alignment (Bytes 8-9) */
-
- ACPI_MOVE_16_TO_16(&temp16, buffer);
- buffer += 2;
- output_struct->data.memory24.alignment = temp16;
-
- /* Get range_length (Bytes 10-11) */
-
- ACPI_MOVE_16_TO_16(&temp16, buffer);
- output_struct->data.memory24.range_length = temp16;
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
+ /*
+ * Get the following contiguous fields from the AML descriptor:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Base Alignment
+ * Range Length
+ */
+ acpi_rs_move_data(&resource->data.memory24.minimum,
+ &aml->memory24.minimum, 4, ACPI_MOVE_TYPE_16_TO_32);
- /* Return the final size of the structure */
+ /* Complete the resource header */
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_MEMORY24;
+ resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_memory24_stream
+ * FUNCTION: acpi_rs_set_memory24
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_memory24_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
-
- ACPI_FUNCTION_TRACE("rs_memory24_stream");
-
- /* The Descriptor Type field is static */
-
- *buffer = ACPI_RDESC_TYPE_MEMORY_24;
- buffer += 1;
-
- /* The length field is static */
-
- temp16 = 0x09;
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
+ ACPI_FUNCTION_TRACE("rs_set_memory24");
/* Set the Information Byte */
- temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01);
- *buffer = temp8;
- buffer += 1;
-
- /* Set the Range minimum base address */
+ aml->memory24.information = (u8)
+ (resource->data.memory24.read_write_attribute & 0x01);
- ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address);
- buffer += 2;
-
- /* Set the Range maximum base address */
-
- ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address);
- buffer += 2;
-
- /* Set the base alignment */
-
- ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment);
- buffer += 2;
-
- /* Set the range length */
-
- ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length);
- buffer += 2;
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Base Alignment
+ * Range Length
+ */
+ acpi_rs_move_data(&aml->memory24.minimum,
+ &resource->data.memory24.minimum, 4,
+ ACPI_MOVE_TYPE_32_TO_16);
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY24,
+ sizeof(struct aml_resource_memory24), aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_memory32_range_resource
+ * FUNCTION: acpi_rs_get_memory32
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_memory32(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
-
- ACPI_FUNCTION_TRACE("rs_memory32_range_resource");
+ ACPI_FUNCTION_TRACE("rs_get_memory32");
- /* Point past the Descriptor to get the number of bytes consumed */
+ /* Get the Read/Write bit */
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- buffer += 2;
- *bytes_consumed = (acpi_size) temp16 + 3;
- output_struct->type = ACPI_RSTYPE_MEM32;
+ resource->data.memory32.read_write_attribute =
+ (aml->memory32.information & 0x01);
/*
- * Point to the place in the output buffer where the data portion will
- * begin.
- * 1. Set the RESOURCE_DATA * Data to point to its own address, then
- * 2. Set the pointer to the next address.
- *
- * NOTE: output_struct->Data is cast to u8, otherwise, this addition adds
- * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8)
+ * Get the following contiguous fields from the AML descriptor:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Base Alignment
+ * Range Length
*/
+ acpi_rs_move_data(&resource->data.memory32.minimum,
+ &aml->memory32.minimum, 4, ACPI_MOVE_TYPE_32_TO_32);
- /* Check Byte 3 the Read/Write bit */
-
- temp8 = *buffer;
- buffer += 1;
-
- output_struct->data.memory32.read_write_attribute = temp8 & 0x01;
-
- /* Get min_base_address (Bytes 4-7) */
-
- ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address,
- buffer);
- buffer += 4;
-
- /* Get max_base_address (Bytes 8-11) */
-
- ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address,
- buffer);
- buffer += 4;
-
- /* Get Alignment (Bytes 12-15) */
-
- ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer);
- buffer += 4;
-
- /* Get range_length (Bytes 16-19) */
-
- ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer);
-
- /* Set the Length parameter */
+ /* Complete the resource header */
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_MEMORY32;
+ resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_fixed_memory32_resource
+ * FUNCTION: acpi_rs_set_memory32
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32);
-
- ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource");
-
- /* Point past the Descriptor to get the number of bytes consumed */
-
- buffer += 1;
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- buffer += 2;
- *bytes_consumed = (acpi_size) temp16 + 3;
- output_struct->type = ACPI_RSTYPE_FIXED_MEM32;
-
- /* Check Byte 3 the Read/Write bit */
-
- temp8 = *buffer;
- buffer += 1;
- output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01;
-
- /* Get range_base_address (Bytes 4-7) */
-
- ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.
- range_base_address, buffer);
- buffer += 4;
-
- /* Get range_length (Bytes 8-11) */
+ ACPI_FUNCTION_TRACE("rs_set_memory32");
- ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length,
- buffer);
+ /* Set the Information Byte */
- /* Set the Length parameter */
+ aml->memory32.information = (u8)
+ (resource->data.memory32.read_write_attribute & 0x01);
- output_struct->length = (u32) struct_size;
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Base Alignment
+ * Range Length
+ */
+ acpi_rs_move_data(&aml->memory32.minimum,
+ &resource->data.memory32.minimum, 4,
+ ACPI_MOVE_TYPE_32_TO_32);
- /* Return the final size of the structure */
+ /* Complete the AML descriptor header */
- *structure_size = struct_size;
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY32,
+ sizeof(struct aml_resource_memory32), aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_memory32_range_stream
+ * FUNCTION: acpi_rs_get_fixed_memory32
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_memory32_range_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_get_fixed_memory32(union aml_resource *aml,
+ u16 aml_resource_length,
+ struct acpi_resource *resource)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
-
- ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
-
- /* The Descriptor Type field is static */
+ ACPI_FUNCTION_TRACE("rs_get_fixed_memory32");
- *buffer = ACPI_RDESC_TYPE_MEMORY_32;
- buffer += 1;
-
- /* The length field is static */
-
- temp16 = 0x11;
-
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
-
- /* Set the Information Byte */
+ /* Get the Read/Write bit */
- temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01);
- *buffer = temp8;
- buffer += 1;
+ resource->data.fixed_memory32.read_write_attribute =
+ (aml->fixed_memory32.information & 0x01);
- /* Set the Range minimum base address */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address);
- buffer += 4;
-
- /* Set the Range maximum base address */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address);
- buffer += 4;
-
- /* Set the base alignment */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment);
- buffer += 4;
-
- /* Set the range length */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length);
- buffer += 4;
+ /*
+ * Get the following contiguous fields from the AML descriptor:
+ * Base Address
+ * Range Length
+ */
+ ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address,
+ &aml->fixed_memory32.address);
+ ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address_length,
+ &aml->fixed_memory32.address_length);
- /* Return the number of bytes consumed in this operation */
+ /* Complete the resource header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32;
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_fixed_memory32_stream
+ * FUNCTION: acpi_rs_set_fixed_memory32
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_fixed_memory32_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_fixed_memory32(struct acpi_resource *resource,
+ union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
-
- ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
-
- /* The Descriptor Type field is static */
-
- *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
- buffer += 1;
-
- /* The length field is static */
-
- temp16 = 0x09;
-
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
+ ACPI_FUNCTION_TRACE("rs_set_fixed_memory32");
/* Set the Information Byte */
- temp8 =
- (u8) (resource->data.fixed_memory32.read_write_attribute & 0x01);
- *buffer = temp8;
- buffer += 1;
+ aml->fixed_memory32.information = (u8)
+ (resource->data.fixed_memory32.read_write_attribute & 0x01);
- /* Set the Range base address */
-
- ACPI_MOVE_32_TO_32(buffer,
- &resource->data.fixed_memory32.range_base_address);
- buffer += 4;
-
- /* Set the range length */
-
- ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length);
- buffer += 4;
+ /*
+ * Set the following contiguous fields in the AML descriptor:
+ * Base Address
+ * Range Length
+ */
+ ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address,
+ &resource->data.fixed_memory32.address);
+ ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address_length,
+ &resource->data.fixed_memory32.address_length);
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_MEMORY32,
+ sizeof(struct aml_resource_fixed_memory32),
+ aml);
return_ACPI_STATUS(AE_OK);
}
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index fa7f5a85b61..337a0f01cb2 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -49,641 +49,432 @@ ACPI_MODULE_NAME("rsmisc")
/*******************************************************************************
*
- * FUNCTION: acpi_rs_generic_register_resource
+ * FUNCTION: acpi_rs_get_generic_reg
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer,
- acpi_size * structure_size)
+acpi_rs_get_generic_reg(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16;
- u8 temp8;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg);
+ ACPI_FUNCTION_TRACE("rs_get_generic_reg");
- ACPI_FUNCTION_TRACE("rs_generic_register_resource");
-
- /* Byte 0 is the Descriptor Type */
-
- buffer += 1;
-
- /* Get the Descriptor Length field (Bytes 1-2) */
-
- ACPI_MOVE_16_TO_16(&temp16, buffer);
- buffer += 2;
-
- /* Validate the descriptor length */
-
- if (temp16 != 12) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
- }
-
- /* The number of bytes consumed is fixed (12 + 3) */
-
- *bytes_consumed = 15;
-
- /* Fill out the structure */
-
- output_struct->type = ACPI_RSTYPE_GENERIC_REG;
-
- /* Get space_id (Byte 3) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.space_id = temp8;
- buffer += 1;
-
- /* Get register_bit_width (Byte 4) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.bit_width = temp8;
- buffer += 1;
-
- /* Get register_bit_offset (Byte 5) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.bit_offset = temp8;
- buffer += 1;
-
- /* Get address_size (Byte 6) */
-
- temp8 = *buffer;
- output_struct->data.generic_reg.address_size = temp8;
- buffer += 1;
-
- /* Get register_address (Bytes 7-14) */
-
- ACPI_MOVE_64_TO_64(&output_struct->data.generic_reg.address, buffer);
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ /*
+ * Get the following fields from the AML descriptor:
+ * Address Space ID
+ * Register Bit Width
+ * Register Bit Offset
+ * Access Size
+ * Register Address
+ */
+ resource->data.generic_reg.space_id = aml->generic_reg.address_space_id;
+ resource->data.generic_reg.bit_width = aml->generic_reg.bit_width;
+ resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset;
+ resource->data.generic_reg.access_size = aml->generic_reg.access_size;
+ ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address,
+ &aml->generic_reg.address);
+
+ /* Complete the resource header */
+
+ resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER;
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_generic_register_stream
+ * FUNCTION: acpi_rs_set_generic_reg
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_generic_register_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16;
-
- ACPI_FUNCTION_TRACE("rs_generic_register_stream");
-
- /* Set the Descriptor Type (Byte 0) */
-
- *buffer = ACPI_RDESC_TYPE_GENERIC_REGISTER;
- buffer += 1;
-
- /* Set the Descriptor Length (Bytes 1-2) */
-
- temp16 = 12;
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
-
- /* Set space_id (Byte 3) */
-
- *buffer = (u8) resource->data.generic_reg.space_id;
- buffer += 1;
-
- /* Set register_bit_width (Byte 4) */
-
- *buffer = (u8) resource->data.generic_reg.bit_width;
- buffer += 1;
-
- /* Set register_bit_offset (Byte 5) */
-
- *buffer = (u8) resource->data.generic_reg.bit_offset;
- buffer += 1;
-
- /* Set address_size (Byte 6) */
-
- *buffer = (u8) resource->data.generic_reg.address_size;
- buffer += 1;
-
- /* Set register_address (Bytes 7-14) */
+ ACPI_FUNCTION_TRACE("rs_set_generic_reg");
- ACPI_MOVE_64_TO_64(buffer, &resource->data.generic_reg.address);
- buffer += 8;
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ /*
+ * Set the following fields in the AML descriptor:
+ * Address Space ID
+ * Register Bit Width
+ * Register Bit Offset
+ * Access Size
+ * Register Address
+ */
+ aml->generic_reg.address_space_id =
+ (u8) resource->data.generic_reg.space_id;
+ aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width;
+ aml->generic_reg.bit_offset =
+ (u8) resource->data.generic_reg.bit_offset;
+ aml->generic_reg.access_size =
+ (u8) resource->data.generic_reg.access_size;
+ ACPI_MOVE_64_TO_64(&aml->generic_reg.address,
+ &resource->data.generic_reg.address);
+
+ /* Complete the AML descriptor header */
+
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER,
+ sizeof(struct
+ aml_resource_generic_register), aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_tag_resource
+ * FUNCTION: acpi_rs_get_vendor
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_vendor(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- struct acpi_resource *output_struct = (void *)*output_buffer;
- acpi_size struct_size = ACPI_RESOURCE_LENGTH;
-
- ACPI_FUNCTION_TRACE("rs_end_tag_resource");
+ u8 *aml_byte_data;
- /* The number of bytes consumed is static */
+ ACPI_FUNCTION_TRACE("rs_get_vendor");
- *bytes_consumed = 2;
+ /* Determine if this is a large or small vendor specific item */
- /* Fill out the structure */
+ if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large item, Point to the first vendor byte */
- output_struct->type = ACPI_RSTYPE_END_TAG;
+ aml_byte_data =
+ ((u8 *) aml) + sizeof(struct aml_resource_large_header);
+ } else {
+ /* Small item, Point to the first vendor byte */
- /* Set the Length parameter */
+ aml_byte_data =
+ ((u8 *) aml) + sizeof(struct aml_resource_small_header);
+ }
- output_struct->length = 0;
+ /* Copy the vendor-specific bytes */
- /* Return the final size of the structure */
+ ACPI_MEMCPY(resource->data.vendor.byte_data,
+ aml_byte_data, aml_resource_length);
+ resource->data.vendor.byte_length = aml_resource_length;
- *structure_size = struct_size;
+ /*
+ * In order for the struct_size to fall on a 32-bit boundary,
+ * calculate the length of the vendor string and expand the
+ * struct_size to the next 32-bit boundary.
+ */
+ resource->type = ACPI_RESOURCE_TYPE_VENDOR;
+ resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
+ ACPI_ROUND_UP_to_32_bITS(aml_resource_length);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_tag_stream
+ * FUNCTION: acpi_rs_set_vendor
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_end_tag_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u8 temp8 = 0;
+ u32 resource_length;
+ u8 *source;
+ u8 *destination;
- ACPI_FUNCTION_TRACE("rs_end_tag_stream");
+ ACPI_FUNCTION_TRACE("rs_set_vendor");
- /* The Descriptor Type field is static */
+ resource_length = resource->data.vendor.byte_length;
+ source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data);
- *buffer = ACPI_RDESC_TYPE_END_TAG | 0x01;
- buffer += 1;
+ /* Length determines if this is a large or small resource */
- /*
- * Set the Checksum - zero means that the resource data is treated as if
- * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
- */
- temp8 = 0;
+ if (resource_length > 7) {
+ /* Large item, get pointer to the data part of the descriptor */
+
+ destination =
+ ((u8 *) aml) + sizeof(struct aml_resource_large_header);
+
+ /* Complete the AML descriptor header */
+
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE,
+ (u32) (resource_length +
+ sizeof(struct
+ aml_resource_large_header)),
+ aml);
+ } else {
+ /* Small item, get pointer to the data part of the descriptor */
- *buffer = temp8;
- buffer += 1;
+ destination =
+ ((u8 *) aml) + sizeof(struct aml_resource_small_header);
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL,
+ (u32) (resource_length +
+ sizeof(struct
+ aml_resource_small_header)),
+ aml);
+ }
+
+ /* Copy the vendor-specific bytes */
+
+ ACPI_MEMCPY(destination, source, resource_length);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_vendor_resource
+ * FUNCTION: acpi_rs_get_start_dpf
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_vendor_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_get_start_dpf(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- u8 index;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor);
-
- ACPI_FUNCTION_TRACE("rs_vendor_resource");
-
- /* Dereference the Descriptor to find if this is a large or small item. */
+ ACPI_FUNCTION_TRACE("rs_get_start_dpf");
- temp8 = *buffer;
+ /* Get the flags byte if present */
- if (temp8 & ACPI_RDESC_TYPE_LARGE) {
- /* Large Item, point to the length field */
+ if (aml_resource_length == 1) {
+ /* Get the Compatibility priority */
- buffer += 1;
+ resource->data.start_dpf.compatibility_priority =
+ (aml->start_dpf.flags & 0x03);
- /* Dereference */
-
- ACPI_MOVE_16_TO_16(&temp16, buffer);
-
- /* Calculate bytes consumed */
+ if (resource->data.start_dpf.compatibility_priority >= 3) {
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
+ }
- *bytes_consumed = (acpi_size) temp16 + 3;
+ /* Get the Performance/Robustness preference */
- /* Point to the first vendor byte */
+ resource->data.start_dpf.performance_robustness =
+ ((aml->start_dpf.flags >> 2) & 0x03);
- buffer += 2;
+ if (resource->data.start_dpf.performance_robustness >= 3) {
+ return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
+ }
} else {
- /* Small Item, dereference the size */
-
- temp16 = (u8) (*buffer & 0x07);
-
- /* Calculate bytes consumed */
+ /* start_dependent_no_pri(), no flags byte, set defaults */
- *bytes_consumed = (acpi_size) temp16 + 1;
-
- /* Point to the first vendor byte */
+ resource->data.start_dpf.compatibility_priority =
+ ACPI_ACCEPTABLE_CONFIGURATION;
- buffer += 1;
+ resource->data.start_dpf.performance_robustness =
+ ACPI_ACCEPTABLE_CONFIGURATION;
}
- output_struct->type = ACPI_RSTYPE_VENDOR;
- output_struct->data.vendor_specific.length = temp16;
-
- for (index = 0; index < temp16; index++) {
- output_struct->data.vendor_specific.reserved[index] = *buffer;
- buffer += 1;
- }
+ /* Complete the resource header */
- /*
- * In order for the struct_size to fall on a 32-bit boundary,
- * calculate the length of the vendor string and expand the
- * struct_size to the next 32-bit boundary.
- */
- struct_size += ACPI_ROUND_UP_to_32_bITS(temp16);
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT;
+ resource->length =
+ ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_vendor_stream
+ * FUNCTION: acpi_rs_set_start_dpf
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_vendor_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
- u16 temp16 = 0;
- u8 temp8 = 0;
- u8 index;
-
- ACPI_FUNCTION_TRACE("rs_vendor_stream");
-
- /* Dereference the length to find if this is a large or small item. */
-
- if (resource->data.vendor_specific.length > 7) {
- /* Large Item, Set the descriptor field and length bytes */
+ ACPI_FUNCTION_TRACE("rs_set_start_dpf");
- *buffer = ACPI_RDESC_TYPE_LARGE_VENDOR;
- buffer += 1;
-
- temp16 = (u16) resource->data.vendor_specific.length;
-
- ACPI_MOVE_16_TO_16(buffer, &temp16);
- buffer += 2;
+ /*
+ * The descriptor type field is set based upon whether a byte is needed
+ * to contain Priority data.
+ */
+ if (ACPI_ACCEPTABLE_CONFIGURATION ==
+ resource->data.start_dpf.compatibility_priority &&
+ ACPI_ACCEPTABLE_CONFIGURATION ==
+ resource->data.start_dpf.performance_robustness) {
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT,
+ sizeof(struct
+ aml_resource_start_dependent_noprio),
+ aml);
} else {
- /* Small Item, Set the descriptor field */
-
- temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR;
- temp8 |= (u8) resource->data.vendor_specific.length;
-
- *buffer = temp8;
- buffer += 1;
- }
-
- /* Loop through all of the Vendor Specific fields */
-
- for (index = 0; index < resource->data.vendor_specific.length; index++) {
- temp8 = resource->data.vendor_specific.reserved[index];
-
- *buffer = temp8;
- buffer += 1;
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT,
+ sizeof(struct
+ aml_resource_start_dependent),
+ aml);
+
+ /* Set the Flags byte */
+
+ aml->start_dpf.flags = (u8)
+ (((resource->data.start_dpf.
+ performance_robustness & 0x03) << 2) | (resource->data.
+ start_dpf.
+ compatibility_priority
+ & 0x03));
}
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_start_depend_fns_resource
+ * FUNCTION: acpi_rs_get_end_dpf
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer,
- acpi_size * structure_size)
+acpi_rs_get_end_dpf(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = byte_stream_buffer;
- struct acpi_resource *output_struct = (void *)*output_buffer;
- u8 temp8 = 0;
- acpi_size struct_size =
- ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf);
-
- ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource");
-
- /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
-
- temp8 = *buffer;
-
- *bytes_consumed = (temp8 & 0x01) + 1;
-
- output_struct->type = ACPI_RSTYPE_START_DPF;
-
- /* Point to Byte 1 if it is used */
-
- if (2 == *bytes_consumed) {
- buffer += 1;
- temp8 = *buffer;
-
- /* Check Compatibility priority */
-
- output_struct->data.start_dpf.compatibility_priority =
- temp8 & 0x03;
-
- if (3 == output_struct->data.start_dpf.compatibility_priority) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
- }
+ ACPI_FUNCTION_TRACE("rs_get_end_dpf");
- /* Check Performance/Robustness preference */
+ /* Complete the resource header */
- output_struct->data.start_dpf.performance_robustness =
- (temp8 >> 2) & 0x03;
-
- if (3 == output_struct->data.start_dpf.performance_robustness) {
- return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
- }
- } else {
- output_struct->data.start_dpf.compatibility_priority =
- ACPI_ACCEPTABLE_CONFIGURATION;
-
- output_struct->data.start_dpf.performance_robustness =
- ACPI_ACCEPTABLE_CONFIGURATION;
- }
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT;
+ resource->length = (u32) ACPI_RESOURCE_LENGTH;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_depend_fns_resource
+ * FUNCTION: acpi_rs_set_end_dpf
*
- * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
- * stream
- * bytes_consumed - Pointer to where the number of bytes
- * consumed the byte_stream_buffer is
- * returned
- * output_buffer - Pointer to the return data buffer
- * structure_size - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the output_buffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
- acpi_size * bytes_consumed,
- u8 ** output_buffer, acpi_size * structure_size)
+acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml)
{
- struct acpi_resource *output_struct = (void *)*output_buffer;
- acpi_size struct_size = ACPI_RESOURCE_LENGTH;
-
- ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource");
-
- /* The number of bytes consumed is static */
-
- *bytes_consumed = 1;
+ ACPI_FUNCTION_TRACE("rs_set_end_dpf");
- /* Fill out the structure */
+ /* Complete the AML descriptor header */
- output_struct->type = ACPI_RSTYPE_END_DPF;
-
- /* Set the Length parameter */
-
- output_struct->length = (u32) struct_size;
-
- /* Return the final size of the structure */
-
- *structure_size = struct_size;
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT,
+ sizeof(struct aml_resource_end_dependent),
+ aml);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_start_depend_fns_stream
+ * FUNCTION: acpi_rs_get_end_tag
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * output_buffer used
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * aml_resource_length - Length of the resource from the AML header
+ * Resource - Where the internal resource is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
+ * internal resource descriptor, simplifying bitflags and handling
+ * alignment and endian issues if necessary.
*
******************************************************************************/
acpi_status
-acpi_rs_start_depend_fns_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_get_end_tag(union aml_resource *aml,
+ u16 aml_resource_length, struct acpi_resource *resource)
{
- u8 *buffer = *output_buffer;
- u8 temp8 = 0;
-
- ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
+ ACPI_FUNCTION_TRACE("rs_get_end_tag");
- /*
- * The descriptor type field is set based upon whether a byte is needed
- * to contain Priority data.
- */
- if (ACPI_ACCEPTABLE_CONFIGURATION ==
- resource->data.start_dpf.compatibility_priority &&
- ACPI_ACCEPTABLE_CONFIGURATION ==
- resource->data.start_dpf.performance_robustness) {
- *buffer = ACPI_RDESC_TYPE_START_DEPENDENT;
- } else {
- *buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01;
- buffer += 1;
-
- /* Set the Priority Byte Definition */
+ /* Complete the resource header */
- temp8 = 0;
- temp8 = (u8) ((resource->data.start_dpf.performance_robustness &
- 0x03) << 2);
- temp8 |= (resource->data.start_dpf.compatibility_priority &
- 0x03);
- *buffer = temp8;
- }
-
- buffer += 1;
-
- /* Return the number of bytes consumed in this operation */
-
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ resource->type = ACPI_RESOURCE_TYPE_END_TAG;
+ resource->length = ACPI_RESOURCE_LENGTH;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: acpi_rs_end_depend_fns_stream
+ * FUNCTION: acpi_rs_set_end_tag
*
- * PARAMETERS: Resource - Pointer to the resource linked list
- * output_buffer - Pointer to the user's return buffer
- * bytes_consumed - Pointer to where the number of bytes
- * used in the output_buffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
acpi_status
-acpi_rs_end_depend_fns_stream(struct acpi_resource *resource,
- u8 ** output_buffer, acpi_size * bytes_consumed)
+acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml)
{
- u8 *buffer = *output_buffer;
-
- ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
+ ACPI_FUNCTION_TRACE("rs_set_end_tag");
- /* The Descriptor Type field is static */
-
- *buffer = ACPI_RDESC_TYPE_END_DEPENDENT;
- buffer += 1;
+ /*
+ * Set the Checksum - zero means that the resource data is treated as if
+ * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
+ */
+ aml->end_tag.checksum = 0;
- /* Return the number of bytes consumed in this operation */
+ /* Complete the AML descriptor header */
- *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+ acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG,
+ sizeof(struct aml_resource_end_tag), aml);
return_ACPI_STATUS(AE_OK);
}
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index 4446778eaf7..9d503de1a34 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -50,6 +50,438 @@ ACPI_MODULE_NAME("rsutils")
/*******************************************************************************
*
+ * FUNCTION: acpi_rs_move_data
+ *
+ * PARAMETERS: Destination - Pointer to the destination descriptor
+ * Source - Pointer to the source descriptor
+ * item_count - How many items to move
+ * move_type - Byte width
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Move multiple data items from one descriptor to another. Handles
+ * alignment issues and endian issues if necessary, as configured
+ * via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
+ *
+ ******************************************************************************/
+void
+acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
+{
+ acpi_native_uint i;
+
+ /* One move per item */
+
+ for (i = 0; i < item_count; i++) {
+ switch (move_type) {
+ case ACPI_MOVE_TYPE_16_TO_32:
+ ACPI_MOVE_16_TO_32(&((u32 *) destination)[i],
+ &((u16 *) source)[i]);
+ break;
+
+ case ACPI_MOVE_TYPE_32_TO_16:
+ ACPI_MOVE_32_TO_16(&((u16 *) destination)[i],
+ &((u32 *) source)[i]);
+ break;
+
+ case ACPI_MOVE_TYPE_32_TO_32:
+ ACPI_MOVE_32_TO_32(&((u32 *) destination)[i],
+ &((u32 *) source)[i]);
+ break;
+
+ case ACPI_MOVE_TYPE_64_TO_64:
+ ACPI_MOVE_64_TO_64(&((u64 *) destination)[i],
+ &((u64 *) source)[i]);
+ break;
+
+ default:
+ return;
+ }
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_resource_info
+ *
+ * PARAMETERS: resource_type - Byte 0 of a resource descriptor
+ *
+ * RETURN: Pointer to the resource conversion handler
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
+
+struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type)
+{
+ struct acpi_resource_info *size_info;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /* Determine if this is a small or large resource */
+
+ if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource Type -- bits 6:0 contain the name */
+
+ if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
+ return (NULL);
+ }
+
+ size_info = &acpi_gbl_lg_resource_info[(resource_type &
+ ACPI_RESOURCE_NAME_LARGE_MASK)];
+ } else {
+ /* Small Resource Type -- bits 6:3 contain the name */
+
+ size_info = &acpi_gbl_sm_resource_info[((resource_type &
+ ACPI_RESOURCE_NAME_SMALL_MASK)
+ >> 3)];
+ }
+
+ /* Zero entry indicates an invalid resource type */
+
+ if (!size_info->minimum_internal_struct_length) {
+ return (NULL);
+ }
+
+ return (size_info);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_resource_length
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte Length
+ *
+ * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
+ * definition, this does not include the size of the descriptor
+ * header or the length field itself.
+ *
+ ******************************************************************************/
+
+u16 acpi_rs_get_resource_length(union aml_resource * aml)
+{
+ u16 resource_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /* Determine if this is a small or large resource */
+
+ if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+
+ ACPI_MOVE_16_TO_16(&resource_length,
+ &aml->large_header.resource_length);
+
+ } else {
+ /* Small Resource type -- bits 2:0 of byte 0 contain the length */
+
+ resource_length = (u16) (aml->small_header.descriptor_type &
+ ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
+ }
+
+ return (resource_length);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_descriptor_length
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte length
+ *
+ * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
+ * length of the descriptor header and the length field itself.
+ * Used to walk descriptor lists.
+ *
+ ******************************************************************************/
+
+u32 acpi_rs_get_descriptor_length(union aml_resource * aml)
+{
+ u32 descriptor_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /* Determine if this is a small or large resource */
+
+ if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+
+ ACPI_MOVE_16_TO_32(&descriptor_length,
+ &aml->large_header.resource_length);
+ descriptor_length += sizeof(struct aml_resource_large_header);
+
+ } else {
+ /* Small Resource type -- bits 2:0 of byte 0 contain the length */
+
+ descriptor_length = (u32) (aml->small_header.descriptor_type &
+ ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
+ descriptor_length += sizeof(struct aml_resource_small_header);
+ }
+
+ return (descriptor_length);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_set_resource_header
+ *
+ * PARAMETERS: descriptor_type - Byte to be inserted as the type
+ * total_length - Length of the AML descriptor, including
+ * the header and length fields.
+ * Aml - Pointer to the raw AML descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set the descriptor_type and resource_length fields of an AML
+ * resource descriptor, both Large and Small descriptors are
+ * supported automatically
+ *
+ ******************************************************************************/
+
+void
+acpi_rs_set_resource_header(u8 descriptor_type,
+ acpi_size total_length, union aml_resource *aml)
+{
+ u16 resource_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ /* Set the descriptor type */
+
+ aml->small_header.descriptor_type = descriptor_type;
+
+ /* Determine if this is a small or large resource */
+
+ if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+
+ resource_length =
+ (u16) (total_length -
+ sizeof(struct aml_resource_large_header));
+
+ /* Insert length into the Large descriptor length field */
+
+ ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
+ &resource_length);
+ } else {
+ /* Small Resource type -- bits 2:0 of byte 0 contain the length */
+
+ resource_length =
+ (u16) (total_length -
+ sizeof(struct aml_resource_small_header));
+
+ /* Insert length into the descriptor type byte */
+
+ aml->small_header.descriptor_type |= (u8) resource_length;
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_resource_type
+ *
+ * PARAMETERS: resource_type - Byte 0 of a resource descriptor
+ *
+ * RETURN: The Resource Type with no extraneous bits (except the
+ * Large/Small descriptor bit -- this is left alone)
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
+
+u8 acpi_rs_get_resource_type(u8 resource_type)
+{
+ ACPI_FUNCTION_ENTRY();
+
+ /* Determine if this is a small or large resource */
+
+ if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
+ /* Large Resource Type -- bits 6:0 contain the name */
+
+ return (resource_type);
+ } else {
+ /* Small Resource Type -- bits 6:3 contain the name */
+
+ return ((u8) (resource_type & ACPI_RESOURCE_NAME_SMALL_MASK));
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_strcpy
+ *
+ * PARAMETERS: Destination - Pointer to the destination string
+ * Source - Pointer to the source string
+ *
+ * RETURN: String length, including NULL terminator
+ *
+ * DESCRIPTION: Local string copy that returns the string length, saving a
+ * strcpy followed by a strlen.
+ *
+ ******************************************************************************/
+
+static u16 acpi_rs_strcpy(char *destination, char *source)
+{
+ u16 i;
+
+ ACPI_FUNCTION_ENTRY();
+
+ for (i = 0; source[i]; i++) {
+ destination[i] = source[i];
+ }
+
+ destination[i] = 0;
+
+ /* Return string length including the NULL terminator */
+
+ return ((u16) (i + 1));
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_get_resource_source
+ *
+ * PARAMETERS: resource_length - Length field of the descriptor
+ * minimum_length - Minimum length of the descriptor (minus
+ * any optional fields)
+ * resource_source - Where the resource_source is returned
+ * Aml - Pointer to the raw AML descriptor
+ * string_ptr - (optional) where to store the actual
+ * resource_source string
+ *
+ * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit
+ *
+ * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor
+ * to an internal resource descriptor
+ *
+ ******************************************************************************/
+
+u16
+acpi_rs_get_resource_source(u16 resource_length,
+ acpi_size minimum_length,
+ struct acpi_resource_source * resource_source,
+ union aml_resource * aml, char *string_ptr)
+{
+ acpi_size total_length;
+ u8 *aml_resource_source;
+
+ ACPI_FUNCTION_ENTRY();
+
+ total_length =
+ resource_length + sizeof(struct aml_resource_large_header);
+ aml_resource_source = ((u8 *) aml) + minimum_length;
+
+ /*
+ * resource_source is present if the length of the descriptor is longer than
+ * the minimum length.
+ *
+ * Note: Some resource descriptors will have an additional null, so
+ * we add 1 to the minimum length.
+ */
+ if (total_length > (minimum_length + 1)) {
+ /* Get the resource_source_index */
+
+ resource_source->index = aml_resource_source[0];
+
+ resource_source->string_ptr = string_ptr;
+ if (!string_ptr) {
+ /*
+ * String destination pointer is not specified; Set the String
+ * pointer to the end of the current resource_source structure.
+ */
+ resource_source->string_ptr = (char *)
+ ((u8 *) resource_source) +
+ sizeof(struct acpi_resource_source);
+ }
+
+ /* Copy the resource_source string to the destination */
+
+ resource_source->string_length =
+ acpi_rs_strcpy(resource_source->string_ptr,
+ (char *)&aml_resource_source[1]);
+
+ /*
+ * In order for the struct_size to fall on a 32-bit boundary,
+ * calculate the length of the string and expand the
+ * struct_size to the next 32-bit boundary.
+ */
+ return ((u16)
+ ACPI_ROUND_UP_to_32_bITS(resource_source->
+ string_length));
+ } else {
+ /* resource_source is not present */
+
+ resource_source->index = 0;
+ resource_source->string_length = 0;
+ resource_source->string_ptr = NULL;
+ return (0);
+ }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_rs_set_resource_source
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML descriptor
+ * minimum_length - Minimum length of the descriptor (minus
+ * any optional fields)
+ * resource_source - Internal resource_source
+
+ *
+ * RETURN: Total length of the AML descriptor
+ *
+ * DESCRIPTION: Convert an optoinal resource_source from internal format to a
+ * raw AML resource descriptor
+ *
+ ******************************************************************************/
+
+acpi_size
+acpi_rs_set_resource_source(union aml_resource * aml,
+ acpi_size minimum_length,
+ struct acpi_resource_source * resource_source)
+{
+ u8 *aml_resource_source;
+ acpi_size descriptor_length;
+
+ ACPI_FUNCTION_ENTRY();
+
+ descriptor_length = minimum_length;
+
+ /* Non-zero string length indicates presence of a resource_source */
+
+ if (resource_source->string_length) {
+ /* Point to the end of the AML descriptor */
+
+ aml_resource_source = ((u8 *) aml) + minimum_length;
+
+ /* Copy the resource_source_index */
+
+ aml_resource_source[0] = (u8) resource_source->index;
+
+ /* Copy the resource_source string */
+
+ ACPI_STRCPY((char *)&aml_resource_source[1],
+ resource_source->string_ptr);
+
+ /*
+ * Add the length of the string (+ 1 for null terminator) to the
+ * final descriptor length
+ */
+ descriptor_length +=
+ ((acpi_size) resource_source->string_length + 1);
+ }
+
+ /* Return the new total length of the AML descriptor */
+
+ return (descriptor_length);
+}
+
+/*******************************************************************************
+ *
* FUNCTION: acpi_rs_get_prt_method_data
*
* PARAMETERS: Handle - a handle to the containing object
@@ -65,8 +497,9 @@ ACPI_MODULE_NAME("rsutils")
* and the contents of the callers buffer is undefined.
*
******************************************************************************/
+
acpi_status
-acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
+acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
{
union acpi_operand_object *obj_desc;
acpi_status status;
@@ -284,7 +717,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
* Convert the linked list into a byte stream
*/
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer);
+ status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index 1a87c4c7bd9..9d179beb17a 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -59,9 +59,9 @@ ACPI_MODULE_NAME("rsxface")
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, minimum); \
+ ACPI_COPY_FIELD(out, in, maximum); \
+ ACPI_COPY_FIELD(out, in, translation_offset); \
ACPI_COPY_FIELD(out, in, address_length); \
ACPI_COPY_FIELD(out, in, resource_source);
/*******************************************************************************
@@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle,
/* Walk the resource list */
for (;;) {
- if (!resource || resource->type == ACPI_RSTYPE_END_TAG) {
+ if (!resource || resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
break;
}
@@ -382,19 +382,19 @@ acpi_resource_to_address64(struct acpi_resource *resource,
struct acpi_resource_address32 *address32;
switch (resource->type) {
- case ACPI_RSTYPE_ADDRESS16:
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
address16 = (struct acpi_resource_address16 *)&resource->data;
ACPI_COPY_ADDRESS(out, address16);
break;
- case ACPI_RSTYPE_ADDRESS32:
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
address32 = (struct acpi_resource_address32 *)&resource->data;
ACPI_COPY_ADDRESS(out, address32);
break;
- case ACPI_RSTYPE_ADDRESS64:
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
/* Simple copy for 64 bit source */
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index ad0252c2f7d..3cee0cee4cc 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -251,7 +251,7 @@ acpi_status acpi_tb_get_table_rsdt(void)
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n",
+ "RSDP located at %p, points to RSDT physical=%8.8X%8.8X\n",
acpi_gbl_RSDP,
ACPI_FORMAT_UINT64(address.pointer.value)));
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index 3b8a7e063e8..b01a4b2ae7d 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -251,7 +251,7 @@ acpi_get_firmware_table(acpi_string signature,
acpi_tb_get_rsdt_address(&address);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
+ "RSDP located at %p, RSDT physical=%8.8X%8.8X\n",
acpi_gbl_RSDP,
ACPI_FORMAT_UINT64(address.pointer.value)));
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 068450b3647..dc7f24b3a1c 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -304,7 +304,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
if (!size) {
_ACPI_REPORT_ERROR(module, line, component,
- ("ut_allocate: Attempt to allocate zero bytes\n"));
+ ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
size = 1;
}
@@ -347,8 +347,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
if (!size) {
_ACPI_REPORT_ERROR(module, line, component,
- ("ut_callocate: Attempt to allocate zero bytes\n"));
- return_PTR(NULL);
+ ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
+ size = 1;
}
allocation = acpi_os_allocate(size);
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 399e64b5188..7f72839841c 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -825,6 +825,9 @@ void acpi_ut_init_globals(void)
acpi_gbl_ps_find_count = 0;
acpi_gbl_acpi_hardware_present = TRUE;
acpi_gbl_owner_id_mask = 0;
+ acpi_gbl_trace_method_name = 0;
+ acpi_gbl_trace_dbg_level = 0;
+ acpi_gbl_trace_dbg_layer = 0;
acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index aa1dcd851f8..b57afa7421e 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -811,15 +811,15 @@ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc)
while (buffer < end_buffer) {
buffer_byte = *buffer;
- if (buffer_byte & ACPI_RDESC_TYPE_LARGE) {
+ if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) {
/* Large Descriptor - Length is next 2 bytes */
buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3);
} else {
/* Small Descriptor. End Tag will be found here */
- if ((buffer_byte & ACPI_RDESC_SMALL_MASK) ==
- ACPI_RDESC_TYPE_END_TAG) {
+ if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) ==
+ ACPI_RESOURCE_NAME_END_TAG) {
/* Found the end tag descriptor, all done. */
return (buffer);
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 5172d4e1236..66a2fee06eb 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -927,9 +927,9 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
if (ACPI_SUCCESS(status)) {
unsigned long size;
- size = addr.max_address_range - addr.min_address_range + 1;
- hdp->hd_phys_address = addr.min_address_range;
- hdp->hd_address = ioremap(addr.min_address_range, size);
+ size = addr.maximum - addr.minimum + 1;
+ hdp->hd_phys_address = addr.minimum;
+ hdp->hd_address = ioremap(addr.minimum, size);
if (hpet_is_known(hdp)) {
printk(KERN_DEBUG "%s: 0x%lx is busy\n",
@@ -937,15 +937,15 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
iounmap(hdp->hd_address);
return -EBUSY;
}
- } else if (res->type == ACPI_RSTYPE_FIXED_MEM32) {
- struct acpi_resource_fixed_mem32 *fixmem32;
+ } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) {
+ struct acpi_resource_fixed_memory32 *fixmem32;
fixmem32 = &res->data.fixed_memory32;
if (!fixmem32)
return -EINVAL;
- hdp->hd_phys_address = fixmem32->range_base_address;
- hdp->hd_address = ioremap(fixmem32->range_base_address,
+ hdp->hd_phys_address = fixmem32->address;
+ hdp->hd_address = ioremap(fixmem32->address,
HPET_RANGE_SIZE);
if (hpet_is_known(hdp)) {
@@ -954,20 +954,20 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
iounmap(hdp->hd_address);
return -EBUSY;
}
- } else if (res->type == ACPI_RSTYPE_EXT_IRQ) {
- struct acpi_resource_ext_irq *irqp;
+ } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {
+ struct acpi_resource_extended_irq *irqp;
int i;
irqp = &res->data.extended_irq;
- if (irqp->number_of_interrupts > 0) {
- hdp->hd_nirqs = irqp->number_of_interrupts;
+ if (irqp->interrupt_count > 0) {
+ hdp->hd_nirqs = irqp->interrupt_count;
for (i = 0; i < hdp->hd_nirqs; i++) {
int rc =
acpi_register_gsi(irqp->interrupts[i],
- irqp->edge_level,
- irqp->active_high_low);
+ irqp->triggering,
+ irqp->polarity);
if (rc < 0)
return AE_ERROR;
hdp->hd_irq[i] = rc;
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 15ec05f69dd..f4adebde615 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2004 Matthieu Castet <castet.matthieu@free.fr>
* Copyright (c) 2004 Li Shaohua <shaohua.li@intel.com>
- *
+ *
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
@@ -32,17 +32,17 @@
/*
* Allocated Resources
*/
-static int irq_flags(int edge_level, int active_high_low)
+static int irq_flags(int triggering, int polarity)
{
int flag;
- if (edge_level == ACPI_LEVEL_SENSITIVE) {
- if(active_high_low == ACPI_ACTIVE_LOW)
+ if (triggering == ACPI_LEVEL_SENSITIVE) {
+ if(polarity == ACPI_ACTIVE_LOW)
flag = IORESOURCE_IRQ_LOWLEVEL;
else
flag = IORESOURCE_IRQ_HIGHLEVEL;
}
else {
- if(active_high_low == ACPI_ACTIVE_LOW)
+ if(polarity == ACPI_ACTIVE_LOW)
flag = IORESOURCE_IRQ_LOWEDGE;
else
flag = IORESOURCE_IRQ_HIGHEDGE;
@@ -50,31 +50,31 @@ static int irq_flags(int edge_level, int active_high_low)
return flag;
}
-static void decode_irq_flags(int flag, int *edge_level, int *active_high_low)
+static void decode_irq_flags(int flag, int *triggering, int *polarity)
{
switch (flag) {
case IORESOURCE_IRQ_LOWLEVEL:
- *edge_level = ACPI_LEVEL_SENSITIVE;
- *active_high_low = ACPI_ACTIVE_LOW;
+ *triggering = ACPI_LEVEL_SENSITIVE;
+ *polarity = ACPI_ACTIVE_LOW;
break;
case IORESOURCE_IRQ_HIGHLEVEL:
- *edge_level = ACPI_LEVEL_SENSITIVE;
- *active_high_low = ACPI_ACTIVE_HIGH;
+ *triggering = ACPI_LEVEL_SENSITIVE;
+ *polarity = ACPI_ACTIVE_HIGH;
break;
case IORESOURCE_IRQ_LOWEDGE:
- *edge_level = ACPI_EDGE_SENSITIVE;
- *active_high_low = ACPI_ACTIVE_LOW;
+ *triggering = ACPI_EDGE_SENSITIVE;
+ *polarity = ACPI_ACTIVE_LOW;
break;
case IORESOURCE_IRQ_HIGHEDGE:
- *edge_level = ACPI_EDGE_SENSITIVE;
- *active_high_low = ACPI_ACTIVE_HIGH;
+ *triggering = ACPI_EDGE_SENSITIVE;
+ *polarity = ACPI_ACTIVE_HIGH;
break;
}
}
static void
pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
- int edge_level, int active_high_low)
+ int triggering, int polarity)
{
int i = 0;
int irq;
@@ -89,7 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
return;
res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
- irq = acpi_register_gsi(gsi, edge_level, active_high_low);
+ irq = acpi_register_gsi(gsi, triggering, polarity);
if (irq < 0) {
res->irq_resource[i].flags |= IORESOURCE_DISABLED;
return;
@@ -164,73 +164,73 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
int i;
switch (res->type) {
- case ACPI_RSTYPE_IRQ:
+ case ACPI_RESOURCE_TYPE_IRQ:
/*
* Per spec, only one interrupt per descriptor is allowed in
* _CRS, but some firmware violates this, so parse them all.
*/
- for (i = 0; i < res->data.irq.number_of_interrupts; i++) {
+ for (i = 0; i < res->data.irq.interrupt_count; i++) {
pnpacpi_parse_allocated_irqresource(res_table,
res->data.irq.interrupts[i],
- res->data.irq.edge_level,
- res->data.irq.active_high_low);
+ res->data.irq.triggering,
+ res->data.irq.polarity);
}
break;
- case ACPI_RSTYPE_EXT_IRQ:
- for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) {
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+ for (i = 0; i < res->data.extended_irq.interrupt_count; i++) {
pnpacpi_parse_allocated_irqresource(res_table,
res->data.extended_irq.interrupts[i],
- res->data.extended_irq.edge_level,
- res->data.extended_irq.active_high_low);
+ res->data.extended_irq.triggering,
+ res->data.extended_irq.polarity);
}
break;
- case ACPI_RSTYPE_DMA:
- if (res->data.dma.number_of_channels > 0)
- pnpacpi_parse_allocated_dmaresource(res_table,
+ case ACPI_RESOURCE_TYPE_DMA:
+ if (res->data.dma.channel_count > 0)
+ pnpacpi_parse_allocated_dmaresource(res_table,
res->data.dma.channels[0]);
break;
- case ACPI_RSTYPE_IO:
- pnpacpi_parse_allocated_ioresource(res_table,
- res->data.io.min_base_address,
- res->data.io.range_length);
+ case ACPI_RESOURCE_TYPE_IO:
+ pnpacpi_parse_allocated_ioresource(res_table,
+ res->data.io.minimum,
+ res->data.io.address_length);
break;
- case ACPI_RSTYPE_FIXED_IO:
- pnpacpi_parse_allocated_ioresource(res_table,
- res->data.fixed_io.base_address,
- res->data.fixed_io.range_length);
+ case ACPI_RESOURCE_TYPE_FIXED_IO:
+ pnpacpi_parse_allocated_ioresource(res_table,
+ res->data.fixed_io.address,
+ res->data.fixed_io.address_length);
break;
- case ACPI_RSTYPE_MEM24:
- pnpacpi_parse_allocated_memresource(res_table,
- res->data.memory24.min_base_address,
- res->data.memory24.range_length);
+ case ACPI_RESOURCE_TYPE_MEMORY24:
+ pnpacpi_parse_allocated_memresource(res_table,
+ res->data.memory24.minimum,
+ res->data.memory24.address_length);
break;
- case ACPI_RSTYPE_MEM32:
- pnpacpi_parse_allocated_memresource(res_table,
- res->data.memory32.min_base_address,
- res->data.memory32.range_length);
+ case ACPI_RESOURCE_TYPE_MEMORY32:
+ pnpacpi_parse_allocated_memresource(res_table,
+ res->data.memory32.minimum,
+ res->data.memory32.address_length);
break;
- case ACPI_RSTYPE_FIXED_MEM32:
- pnpacpi_parse_allocated_memresource(res_table,
- res->data.fixed_memory32.range_base_address,
- res->data.fixed_memory32.range_length);
+ case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
+ pnpacpi_parse_allocated_memresource(res_table,
+ res->data.fixed_memory32.address,
+ res->data.fixed_memory32.address_length);
break;
- case ACPI_RSTYPE_ADDRESS16:
- pnpacpi_parse_allocated_memresource(res_table,
- res->data.address16.min_address_range,
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
+ pnpacpi_parse_allocated_memresource(res_table,
+ res->data.address16.minimum,
res->data.address16.address_length);
break;
- case ACPI_RSTYPE_ADDRESS32:
- pnpacpi_parse_allocated_memresource(res_table,
- res->data.address32.min_address_range,
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
+ pnpacpi_parse_allocated_memresource(res_table,
+ res->data.address32.minimum,
res->data.address32.address_length);
break;
- case ACPI_RSTYPE_ADDRESS64:
- pnpacpi_parse_allocated_memresource(res_table,
- res->data.address64.min_address_range,
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
+ pnpacpi_parse_allocated_memresource(res_table,
+ res->data.address64.minimum,
res->data.address64.address_length);
break;
- case ACPI_RSTYPE_VENDOR:
+ case ACPI_RESOURCE_TYPE_VENDOR:
break;
default:
pnp_warn("PnPACPI: unknown resource type %d", res->type);
@@ -253,13 +253,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
int i;
struct pnp_dma * dma;
- if (p->number_of_channels == 0)
+ if (p->channel_count == 0)
return;
dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL);
if (!dma)
return;
- for(i = 0; i < p->number_of_channels; i++)
+ for(i = 0; i < p->channel_count; i++)
dma->map |= 1 << p->channels[i];
dma->flags = 0;
if (p->bus_master)
@@ -309,37 +309,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option,
int i;
struct pnp_irq * irq;
- if (p->number_of_interrupts == 0)
+ if (p->interrupt_count == 0)
return;
irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
if (!irq)
return;
- for(i = 0; i < p->number_of_interrupts; i++)
+ for(i = 0; i < p->interrupt_count; i++)
if (p->interrupts[i])
__set_bit(p->interrupts[i], irq->map);
- irq->flags = irq_flags(p->edge_level, p->active_high_low);
+ irq->flags = irq_flags(p->triggering, p->polarity);
pnp_register_irq_resource(option, irq);
return;
}
static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
- struct acpi_resource_ext_irq *p)
+ struct acpi_resource_extended_irq *p)
{
int i;
struct pnp_irq * irq;
- if (p->number_of_interrupts == 0)
+ if (p->interrupt_count == 0)
return;
irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
if (!irq)
return;
- for(i = 0; i < p->number_of_interrupts; i++)
+ for(i = 0; i < p->interrupt_count; i++)
if (p->interrupts[i])
__set_bit(p->interrupts[i], irq->map);
- irq->flags = irq_flags(p->edge_level, p->active_high_low);
+ irq->flags = irq_flags(p->triggering, p->polarity);
pnp_register_irq_resource(option, irq);
return;
@@ -351,16 +351,16 @@ pnpacpi_parse_port_option(struct pnp_option *option,
{
struct pnp_port * port;
- if (io->range_length == 0)
+ if (io->address_length == 0)
return;
port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
if (!port)
return;
- port->min = io->min_base_address;
- port->max = io->max_base_address;
+ port->min = io->minimum;
+ port->max = io->maximum;
port->align = io->alignment;
- port->size = io->range_length;
- port->flags = ACPI_DECODE_16 == io->io_decode ?
+ port->size = io->address_length;
+ port->flags = ACPI_DECODE_16 == io->io_decode ?
PNP_PORT_FLAG_16BITADDR : 0;
pnp_register_port_resource(option,port);
return;
@@ -372,13 +372,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
{
struct pnp_port * port;
- if (io->range_length == 0)
+ if (io->address_length == 0)
return;
port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
if (!port)
return;
- port->min = port->max = io->base_address;
- port->size = io->range_length;
+ port->min = port->max = io->address;
+ port->size = io->address_length;
port->align = 0;
port->flags = PNP_PORT_FLAG_FIXED;
pnp_register_port_resource(option,port);
@@ -387,19 +387,19 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
static void
pnpacpi_parse_mem24_option(struct pnp_option *option,
- struct acpi_resource_mem24 *p)
+ struct acpi_resource_memory24 *p)
{
struct pnp_mem * mem;
- if (p->range_length == 0)
+ if (p->address_length == 0)
return;
mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
if (!mem)
return;
- mem->min = p->min_base_address;
- mem->max = p->max_base_address;
+ mem->min = p->minimum;
+ mem->max = p->maximum;
mem->align = p->alignment;
- mem->size = p->range_length;
+ mem->size = p->address_length;
mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
IORESOURCE_MEM_WRITEABLE : 0;
@@ -410,19 +410,19 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
static void
pnpacpi_parse_mem32_option(struct pnp_option *option,
- struct acpi_resource_mem32 *p)
+ struct acpi_resource_memory32 *p)
{
struct pnp_mem * mem;
- if (p->range_length == 0)
+ if (p->address_length == 0)
return;
mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
if (!mem)
return;
- mem->min = p->min_base_address;
- mem->max = p->max_base_address;
+ mem->min = p->minimum;
+ mem->max = p->maximum;
mem->align = p->alignment;
- mem->size = p->range_length;
+ mem->size = p->address_length;
mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
IORESOURCE_MEM_WRITEABLE : 0;
@@ -433,17 +433,17 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
static void
pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
- struct acpi_resource_fixed_mem32 *p)
+ struct acpi_resource_fixed_memory32 *p)
{
struct pnp_mem * mem;
- if (p->range_length == 0)
+ if (p->address_length == 0)
return;
mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
if (!mem)
return;
- mem->min = mem->max = p->range_base_address;
- mem->size = p->range_length;
+ mem->min = mem->max = p->address;
+ mem->size = p->address_length;
mem->align = 0;
mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
@@ -459,7 +459,7 @@ struct acpipnp_parse_option_s {
struct pnp_dev *dev;
};
-static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
+static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
void *data)
{
int priority = 0;
@@ -468,34 +468,34 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
struct pnp_option *option = parse_data->option;
switch (res->type) {
- case ACPI_RSTYPE_IRQ:
+ case ACPI_RESOURCE_TYPE_IRQ:
pnpacpi_parse_irq_option(option, &res->data.irq);
break;
- case ACPI_RSTYPE_EXT_IRQ:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
pnpacpi_parse_ext_irq_option(option,
&res->data.extended_irq);
break;
- case ACPI_RSTYPE_DMA:
+ case ACPI_RESOURCE_TYPE_DMA:
pnpacpi_parse_dma_option(option, &res->data.dma);
break;
- case ACPI_RSTYPE_IO:
+ case ACPI_RESOURCE_TYPE_IO:
pnpacpi_parse_port_option(option, &res->data.io);
break;
- case ACPI_RSTYPE_FIXED_IO:
+ case ACPI_RESOURCE_TYPE_FIXED_IO:
pnpacpi_parse_fixed_port_option(option,
&res->data.fixed_io);
break;
- case ACPI_RSTYPE_MEM24:
+ case ACPI_RESOURCE_TYPE_MEMORY24:
pnpacpi_parse_mem24_option(option, &res->data.memory24);
break;
- case ACPI_RSTYPE_MEM32:
+ case ACPI_RESOURCE_TYPE_MEMORY32:
pnpacpi_parse_mem32_option(option, &res->data.memory32);
break;
- case ACPI_RSTYPE_FIXED_MEM32:
+ case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
pnpacpi_parse_fixed_mem32_option(option,
&res->data.fixed_memory32);
break;
- case ACPI_RSTYPE_START_DPF:
+ case ACPI_RESOURCE_TYPE_START_DEPENDENT:
switch (res->data.start_dpf.compatibility_priority) {
case ACPI_GOOD_CONFIGURATION:
priority = PNP_RES_PRIORITY_PREFERRED;
@@ -518,7 +518,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
return AE_ERROR;
parse_data->option = option;
break;
- case ACPI_RSTYPE_END_DPF:
+ case ACPI_RESOURCE_TYPE_END_DEPENDENT:
/*only one EndDependentFn is allowed*/
if (!parse_data->option_independent) {
pnp_warn("PnPACPI: more than one EndDependentFn");
@@ -535,7 +535,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
return AE_OK;
}
-acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
+acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
struct pnp_dev *dev)
{
acpi_status status;
@@ -546,7 +546,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
return AE_ERROR;
parse_data.option_independent = parse_data.option;
parse_data.dev = dev;
- status = acpi_walk_resources(handle, METHOD_NAME__PRS,
+ status = acpi_walk_resources(handle, METHOD_NAME__PRS,
pnpacpi_option_resource, &parse_data);
return status;
@@ -560,18 +560,18 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
{
int *res_cnt = (int *)data;
switch (res->type) {
- case ACPI_RSTYPE_IRQ:
- case ACPI_RSTYPE_EXT_IRQ:
- case ACPI_RSTYPE_DMA:
- case ACPI_RSTYPE_IO:
- case ACPI_RSTYPE_FIXED_IO:
- case ACPI_RSTYPE_MEM24:
- case ACPI_RSTYPE_MEM32:
- case ACPI_RSTYPE_FIXED_MEM32:
+ case ACPI_RESOURCE_TYPE_IRQ:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+ case ACPI_RESOURCE_TYPE_DMA:
+ case ACPI_RESOURCE_TYPE_IO:
+ case ACPI_RESOURCE_TYPE_FIXED_IO:
+ case ACPI_RESOURCE_TYPE_MEMORY24:
+ case ACPI_RESOURCE_TYPE_MEMORY32:
+ case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
#if 0
- case ACPI_RSTYPE_ADDRESS16:
- case ACPI_RSTYPE_ADDRESS32:
- case ACPI_RSTYPE_ADDRESS64:
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
#endif
(*res_cnt) ++;
default:
@@ -585,18 +585,18 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
{
struct acpi_resource **resource = (struct acpi_resource **)data;
switch (res->type) {
- case ACPI_RSTYPE_IRQ:
- case ACPI_RSTYPE_EXT_IRQ:
- case ACPI_RSTYPE_DMA:
- case ACPI_RSTYPE_IO:
- case ACPI_RSTYPE_FIXED_IO:
- case ACPI_RSTYPE_MEM24:
- case ACPI_RSTYPE_MEM32:
- case ACPI_RSTYPE_FIXED_MEM32:
+ case ACPI_RESOURCE_TYPE_IRQ:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+ case ACPI_RESOURCE_TYPE_DMA:
+ case ACPI_RESOURCE_TYPE_IO:
+ case ACPI_RESOURCE_TYPE_FIXED_IO:
+ case ACPI_RESOURCE_TYPE_MEMORY24:
+ case ACPI_RESOURCE_TYPE_MEMORY32:
+ case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
#if 0
- case ACPI_RSTYPE_ADDRESS16:
- case ACPI_RSTYPE_ADDRESS32:
- case ACPI_RSTYPE_ADDRESS64:
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
#endif
(*resource)->type = res->type;
(*resource)++;
@@ -607,14 +607,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
return AE_OK;
}
-int pnpacpi_build_resource_template(acpi_handle handle,
+int pnpacpi_build_resource_template(acpi_handle handle,
struct acpi_buffer *buffer)
{
struct acpi_resource *resource;
int res_cnt = 0;
acpi_status status;
- status = acpi_walk_resources(handle, METHOD_NAME__CRS,
+ status = acpi_walk_resources(handle, METHOD_NAME__CRS,
pnpacpi_count_resources, &res_cnt);
if (ACPI_FAILURE(status)) {
pnp_err("Evaluate _CRS failed");
@@ -628,7 +628,7 @@ int pnpacpi_build_resource_template(acpi_handle handle,
return -ENOMEM;
pnp_dbg("Res cnt %d", res_cnt);
resource = (struct acpi_resource *)buffer->pointer;
- status = acpi_walk_resources(handle, METHOD_NAME__CRS,
+ status = acpi_walk_resources(handle, METHOD_NAME__CRS,
pnpacpi_type_resources, &resource);
if (ACPI_FAILURE(status)) {
kfree(buffer->pointer);
@@ -636,54 +636,54 @@ int pnpacpi_build_resource_template(acpi_handle handle,
return -EINVAL;
}
/* resource will pointer the end resource now */
- resource->type = ACPI_RSTYPE_END_TAG;
+ resource->type = ACPI_RESOURCE_TYPE_END_TAG;
return 0;
}
-static void pnpacpi_encode_irq(struct acpi_resource *resource,
+static void pnpacpi_encode_irq(struct acpi_resource *resource,
struct resource *p)
{
- int edge_level, active_high_low;
+ int triggering, polarity;
- decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level,
- &active_high_low);
- resource->type = ACPI_RSTYPE_IRQ;
+ decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
+ &polarity);
+ resource->type = ACPI_RESOURCE_TYPE_IRQ;
resource->length = sizeof(struct acpi_resource);
- resource->data.irq.edge_level = edge_level;
- resource->data.irq.active_high_low = active_high_low;
- if (edge_level == ACPI_EDGE_SENSITIVE)
- resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE;
+ resource->data.irq.triggering = triggering;
+ resource->data.irq.polarity = polarity;
+ if (triggering == ACPI_EDGE_SENSITIVE)
+ resource->data.irq.sharable = ACPI_EXCLUSIVE;
else
- resource->data.irq.shared_exclusive = ACPI_SHARED;
- resource->data.irq.number_of_interrupts = 1;
+ resource->data.irq.sharable = ACPI_SHARED;
+ resource->data.irq.interrupt_count = 1;
resource->data.irq.interrupts[0] = p->start;
}
static void pnpacpi_encode_ext_irq(struct acpi_resource *resource,
struct resource *p)
{
- int edge_level, active_high_low;
+ int triggering, polarity;
- decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level,
- &active_high_low);
- resource->type = ACPI_RSTYPE_EXT_IRQ;
+ decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
+ &polarity);
+ resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
resource->length = sizeof(struct acpi_resource);
resource->data.extended_irq.producer_consumer = ACPI_CONSUMER;
- resource->data.extended_irq.edge_level = edge_level;
- resource->data.extended_irq.active_high_low = active_high_low;
- if (edge_level == ACPI_EDGE_SENSITIVE)
- resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE;
+ resource->data.extended_irq.triggering = triggering;
+ resource->data.extended_irq.polarity = polarity;
+ if (triggering == ACPI_EDGE_SENSITIVE)
+ resource->data.irq.sharable = ACPI_EXCLUSIVE;
else
- resource->data.irq.shared_exclusive = ACPI_SHARED;
- resource->data.extended_irq.number_of_interrupts = 1;
+ resource->data.irq.sharable = ACPI_SHARED;
+ resource->data.extended_irq.interrupt_count = 1;
resource->data.extended_irq.interrupts[0] = p->start;
}
static void pnpacpi_encode_dma(struct acpi_resource *resource,
struct resource *p)
{
- resource->type = ACPI_RSTYPE_DMA;
+ resource->type = ACPI_RESOURCE_TYPE_DMA;
resource->length = sizeof(struct acpi_resource);
/* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
if (p->flags & IORESOURCE_DMA_COMPATIBLE)
@@ -701,75 +701,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource,
else if (p->flags & IORESOURCE_DMA_16BIT)
resource->data.dma.transfer = ACPI_TRANSFER_16;
resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER;
- resource->data.dma.number_of_channels = 1;
+ resource->data.dma.channel_count = 1;
resource->data.dma.channels[0] = p->start;
}
static void pnpacpi_encode_io(struct acpi_resource *resource,
struct resource *p)
{
- resource->type = ACPI_RSTYPE_IO;
+ resource->type = ACPI_RESOURCE_TYPE_IO;
resource->length = sizeof(struct acpi_resource);
/* Note: pnp_assign_port will copy pnp_port->flags into p->flags */
resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)?
- ACPI_DECODE_16 : ACPI_DECODE_10;
- resource->data.io.min_base_address = p->start;
- resource->data.io.max_base_address = p->end;
+ ACPI_DECODE_16 : ACPI_DECODE_10;
+ resource->data.io.minimum = p->start;
+ resource->data.io.maximum = p->end;
resource->data.io.alignment = 0; /* Correct? */
- resource->data.io.range_length = p->end - p->start + 1;
+ resource->data.io.address_length = p->end - p->start + 1;
}
static void pnpacpi_encode_fixed_io(struct acpi_resource *resource,
struct resource *p)
{
- resource->type = ACPI_RSTYPE_FIXED_IO;
+ resource->type = ACPI_RESOURCE_TYPE_FIXED_IO;
resource->length = sizeof(struct acpi_resource);
- resource->data.fixed_io.base_address = p->start;
- resource->data.fixed_io.range_length = p->end - p->start + 1;
+ resource->data.fixed_io.address = p->start;
+ resource->data.fixed_io.address_length = p->end - p->start + 1;
}
static void pnpacpi_encode_mem24(struct acpi_resource *resource,
struct resource *p)
{
- resource->type = ACPI_RSTYPE_MEM24;
+ resource->type = ACPI_RESOURCE_TYPE_MEMORY24;
resource->length = sizeof(struct acpi_resource);
/* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */
resource->data.memory24.read_write_attribute =
(p->flags & IORESOURCE_MEM_WRITEABLE) ?
ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
- resource->data.memory24.min_base_address = p->start;
- resource->data.memory24.max_base_address = p->end;
+ resource->data.memory24.minimum = p->start;
+ resource->data.memory24.maximum = p->end;
resource->data.memory24.alignment = 0;
- resource->data.memory24.range_length = p->end - p->start + 1;
+ resource->data.memory24.address_length = p->end - p->start + 1;
}
static void pnpacpi_encode_mem32(struct acpi_resource *resource,
struct resource *p)
{
- resource->type = ACPI_RSTYPE_MEM32;
+ resource->type = ACPI_RESOURCE_TYPE_MEMORY32;
resource->length = sizeof(struct acpi_resource);
resource->data.memory32.read_write_attribute =
(p->flags & IORESOURCE_MEM_WRITEABLE) ?
ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
- resource->data.memory32.min_base_address = p->start;
- resource->data.memory32.max_base_address = p->end;
+ resource->data.memory32.minimum = p->start;
+ resource->data.memory32.maximum = p->end;
resource->data.memory32.alignment = 0;
- resource->data.memory32.range_length = p->end - p->start + 1;
+ resource->data.memory32.address_length = p->end - p->start + 1;
}
static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource,
struct resource *p)
{
- resource->type = ACPI_RSTYPE_FIXED_MEM32;
+ resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32;
resource->length = sizeof(struct acpi_resource);
resource->data.fixed_memory32.read_write_attribute =
(p->flags & IORESOURCE_MEM_WRITEABLE) ?
ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
- resource->data.fixed_memory32.range_base_address = p->start;
- resource->data.fixed_memory32.range_length = p->end - p->start + 1;
+ resource->data.fixed_memory32.address = p->start;
+ resource->data.fixed_memory32.address_length = p->end - p->start + 1;
}
-int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
+int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
struct acpi_buffer *buffer)
{
int i = 0;
@@ -781,50 +781,50 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
pnp_dbg("res cnt %d", res_cnt);
while (i < res_cnt) {
switch(resource->type) {
- case ACPI_RSTYPE_IRQ:
+ case ACPI_RESOURCE_TYPE_IRQ:
pnp_dbg("Encode irq");
- pnpacpi_encode_irq(resource,
+ pnpacpi_encode_irq(resource,
&res_table->irq_resource[irq]);
irq++;
break;
- case ACPI_RSTYPE_EXT_IRQ:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
pnp_dbg("Encode ext irq");
- pnpacpi_encode_ext_irq(resource,
+ pnpacpi_encode_ext_irq(resource,
&res_table->irq_resource[irq]);
irq++;
break;
- case ACPI_RSTYPE_DMA:
+ case ACPI_RESOURCE_TYPE_DMA:
pnp_dbg("Encode dma");
- pnpacpi_encode_dma(resource,
+ pnpacpi_encode_dma(resource,
&res_table->dma_resource[dma]);
dma ++;
break;
- case ACPI_RSTYPE_IO:
+ case ACPI_RESOURCE_TYPE_IO:
pnp_dbg("Encode io");
- pnpacpi_encode_io(resource,
+ pnpacpi_encode_io(resource,
&res_table->port_resource[port]);
port ++;
break;
- case ACPI_RSTYPE_FIXED_IO:
+ case ACPI_RESOURCE_TYPE_FIXED_IO:
pnp_dbg("Encode fixed io");
pnpacpi_encode_fixed_io(resource,
&res_table->port_resource[port]);
port ++;
break;
- case ACPI_RSTYPE_MEM24:
+ case ACPI_RESOURCE_TYPE_MEMORY24:
pnp_dbg("Encode mem24");
pnpacpi_encode_mem24(resource,
&res_table->mem_resource[mem]);
mem ++;
break;
- case ACPI_RSTYPE_MEM32:
+ case ACPI_RESOURCE_TYPE_MEMORY32:
pnp_dbg("Encode mem32");
pnpacpi_encode_mem32(resource,
&res_table->mem_resource[mem]);
mem ++;
break;
- case ACPI_RSTYPE_FIXED_MEM32:
+ case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
pnp_dbg("Encode fixed mem32");
pnpacpi_encode_fixed_mem32(resource,
&res_table->mem_resource[mem]);
diff --git a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c
index 36681ba7b03..809f89ab965 100644
--- a/drivers/serial/8250_acpi.c
+++ b/drivers/serial/8250_acpi.c
@@ -27,7 +27,7 @@ struct serial_private {
static acpi_status acpi_serial_mmio(struct uart_port *port,
struct acpi_resource_address64 *addr)
{
- port->mapbase = addr->min_address_range;
+ port->mapbase = addr->minimum;
port->iotype = UPIO_MEM;
port->flags |= UPF_IOREMAP;
return AE_OK;
@@ -36,8 +36,8 @@ static acpi_status acpi_serial_mmio(struct uart_port *port,
static acpi_status acpi_serial_port(struct uart_port *port,
struct acpi_resource_io *io)
{
- if (io->range_length) {
- port->iobase = io->min_base_address;
+ if (io->address_length) {
+ port->iobase = io->minimum;
port->iotype = UPIO_PORT;
} else
printk(KERN_ERR "%s: zero-length IO port range?\n", __FUNCTION__);
@@ -45,13 +45,13 @@ static acpi_status acpi_serial_port(struct uart_port *port,
}
static acpi_status acpi_serial_ext_irq(struct uart_port *port,
- struct acpi_resource_ext_irq *ext_irq)
+ struct acpi_resource_extended_irq *ext_irq)
{
int rc;
- if (ext_irq->number_of_interrupts > 0) {
+ if (ext_irq->interrupt_count > 0) {
rc = acpi_register_gsi(ext_irq->interrupts[0],
- ext_irq->edge_level, ext_irq->active_high_low);
+ ext_irq->triggering, ext_irq->polarity);
if (rc < 0)
return AE_ERROR;
port->irq = rc;
@@ -64,9 +64,9 @@ static acpi_status acpi_serial_irq(struct uart_port *port,
{
int rc;
- if (irq->number_of_interrupts > 0) {
+ if (irq->interrupt_count > 0) {
rc = acpi_register_gsi(irq->interrupts[0],
- irq->edge_level, irq->active_high_low);
+ irq->triggering, irq->polarity);
if (rc < 0)
return AE_ERROR;
port->irq = rc;
@@ -83,11 +83,11 @@ static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data)
status = acpi_resource_to_address64(res, &addr);
if (ACPI_SUCCESS(status))
return acpi_serial_mmio(port, &addr);
- else if (res->type == ACPI_RSTYPE_IO)
+ else if (res->type == ACPI_RESOURCE_TYPE_IO)
return acpi_serial_port(port, &res->data.io);
- else if (res->type == ACPI_RSTYPE_EXT_IRQ)
+ else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ)
return acpi_serial_ext_irq(port, &res->data.extended_irq);
- else if (res->type == ACPI_RSTYPE_IRQ)
+ else if (res->type == ACPI_RESOURCE_TYPE_IRQ)
return acpi_serial_irq(port, &res->data.irq);
return AE_OK;
}