提交 50eca3eb 编写于 作者: B Bob Moore 提交者: Len Brown

[ACPI] ACPICA 20050930

Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)

All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".

The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available.  Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)

Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.

acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: NBob Moore <robert.moore@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 3d5271f9
...@@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context) ...@@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
struct acpi_resource_vendor *vendor; struct acpi_resource_vendor *vendor;
struct acpi_vendor_descriptor *descriptor; struct acpi_vendor_descriptor *descriptor;
u32 length; u32 byte_length;
if (resource->type != ACPI_RSTYPE_VENDOR) if (resource->type != ACPI_RESOURCE_TYPE_VENDOR)
return AE_OK; return AE_OK;
vendor = (struct acpi_resource_vendor *)&resource->data; vendor = (struct acpi_resource_vendor *)&resource->data;
descriptor = (struct acpi_vendor_descriptor *)vendor->reserved; descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data;
if (vendor->length <= sizeof(*info->descriptor) || if (vendor->byte_length <= sizeof(*info->descriptor) ||
descriptor->guid_id != info->descriptor->guid_id || descriptor->guid_id != info->descriptor->guid_id ||
efi_guidcmp(descriptor->guid, info->descriptor->guid)) efi_guidcmp(descriptor->guid, info->descriptor->guid))
return AE_OK; return AE_OK;
length = vendor->length - sizeof(struct acpi_vendor_descriptor); byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor);
info->data = acpi_os_allocate(length); info->data = acpi_os_allocate(byte_length);
if (!info->data) if (!info->data)
return AE_NO_MEMORY; return AE_NO_MEMORY;
memcpy(info->data, memcpy(info->data,
vendor->reserved + sizeof(struct acpi_vendor_descriptor), vendor->byte_data + sizeof(struct acpi_vendor_descriptor),
length); byte_length);
info->length = length; info->length = byte_length;
return AE_CTRL_TERMINATE; return AE_CTRL_TERMINATE;
} }
acpi_status acpi_status
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
u8 ** data, u32 * length) u8 ** data, u32 * byte_length)
{ {
struct acpi_vendor_info info; struct acpi_vendor_info info;
...@@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, ...@@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
return AE_NOT_FOUND; return AE_NOT_FOUND;
*data = info.data; *data = info.data;
*length = info.length; *byte_length = info.length;
return AE_OK; return AE_OK;
} }
......
...@@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr) ...@@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
goto free_resource; goto free_resource;
} }
min = addr->min_address_range; min = addr->minimum;
max = min + addr->address_length - 1; max = min + addr->address_length - 1;
if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION)
sparse = 1; sparse = 1;
space_nr = new_space(addr->address_translation_offset, sparse); space_nr = new_space(addr->translation_offset, sparse);
if (space_nr == ~0) if (space_nr == ~0)
goto free_name; goto free_name;
...@@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) ...@@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
if (addr.resource_type == ACPI_MEMORY_RANGE) { if (addr.resource_type == ACPI_MEMORY_RANGE) {
flags = IORESOURCE_MEM; flags = IORESOURCE_MEM;
root = &iomem_resource; root = &iomem_resource;
offset = addr.address_translation_offset; offset = addr.translation_offset;
} else if (addr.resource_type == ACPI_IO_RANGE) { } else if (addr.resource_type == ACPI_IO_RANGE) {
flags = IORESOURCE_IO; flags = IORESOURCE_IO;
root = &ioport_resource; root = &ioport_resource;
...@@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) ...@@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
window = &info->controller->window[info->controller->windows++]; window = &info->controller->window[info->controller->windows++];
window->resource.name = info->name; window->resource.name = info->name;
window->resource.flags = flags; window->resource.flags = flags;
window->resource.start = addr.min_address_range + offset; window->resource.start = addr.minimum + offset;
window->resource.end = window->resource.start + addr.address_length - 1; window->resource.end = window->resource.start + addr.address_length - 1;
window->resource.child = NULL; window->resource.child = NULL;
window->offset = offset; window->offset = offset;
......
...@@ -1956,7 +1956,7 @@ int __init io_apic_get_redir_entries (int ioapic) ...@@ -1956,7 +1956,7 @@ int __init io_apic_get_redir_entries (int ioapic)
} }
int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
{ {
struct IO_APIC_route_entry entry; struct IO_APIC_route_entry entry;
unsigned long flags; unsigned long flags;
...@@ -1978,8 +1978,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a ...@@ -1978,8 +1978,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
entry.delivery_mode = INT_DELIVERY_MODE; entry.delivery_mode = INT_DELIVERY_MODE;
entry.dest_mode = INT_DEST_MODE; entry.dest_mode = INT_DEST_MODE;
entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
entry.trigger = edge_level; entry.trigger = triggering;
entry.polarity = active_high_low; entry.polarity = polarity;
entry.mask = 1; /* Disabled (masked) */ entry.mask = 1; /* Disabled (masked) */
irq = gsi_irq_sharing(irq); irq = gsi_irq_sharing(irq);
...@@ -1994,9 +1994,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a ...@@ -1994,9 +1994,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
"IRQ %d Mode:%i Active:%i)\n", ioapic, "IRQ %d Mode:%i Active:%i)\n", ioapic,
mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
edge_level, active_high_low); triggering, polarity);
ioapic_register_intr(irq, entry.vector, edge_level); ioapic_register_intr(irq, entry.vector, triggering);
if (!ioapic && (irq < 16)) if (!ioapic && (irq < 16))
disable_8259A_irq(irq); disable_8259A_irq(irq);
......
...@@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void) ...@@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void)
#define MAX_GSI_NUM 4096 #define MAX_GSI_NUM 4096
int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) int mp_register_gsi(u32 gsi, int triggering, int polarity)
{ {
int ioapic = -1; int ioapic = -1;
int ioapic_pin = 0; int ioapic_pin = 0;
...@@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) ...@@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
if (edge_level) { if (triggering) {
/* /*
* For PCI devices assign IRQs in order, avoiding gaps * For PCI devices assign IRQs in order, avoiding gaps
* due to unused I/O APIC pins. * due to unused I/O APIC pins.
...@@ -986,8 +986,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) ...@@ -986,8 +986,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
} }
io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
return gsi; return gsi;
} }
......
...@@ -101,8 +101,8 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) ...@@ -101,8 +101,8 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
address64.attribute.memory.cache_attribute; address64.attribute.memory.cache_attribute;
mem_device->read_write_attribute = mem_device->read_write_attribute =
address64.attribute.memory.read_write_attribute; address64.attribute.memory.read_write_attribute;
mem_device->start_addr = address64.min_address_range; mem_device->start_addr = address64.minimum;
mem_device->end_addr = address64.max_address_range; mem_device->end_addr = address64.maximum;
} }
} }
......
...@@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
if (!op) { if (!op) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); 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, ...@@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
"At Method level, result of [%s] not used\n", "At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name(op->common. acpi_ps_get_opcode_name(op->common.
aml_opcode))); aml_opcode)));
return_VALUE(FALSE); return_UINT8(FALSE);
} }
/* Get info on the parent. The root_op is AML_SCOPE */ /* 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, ...@@ -218,7 +218,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
if (parent_info->class == AML_CLASS_UNKNOWN) { if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown parent opcode. Op=%p\n", op)); "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, ...@@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common. acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op)); aml_opcode), op));
return_VALUE(TRUE); return_UINT8(TRUE);
result_not_used: result_not_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
...@@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common. acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op)); aml_opcode), op));
return_VALUE(FALSE); return_UINT8(FALSE);
} }
/******************************************************************************* /*******************************************************************************
...@@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, ...@@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
if (op_info->flags & AML_HAS_RETVAL) { if (op_info->flags & AML_HAS_RETVAL) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 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 ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
(walk_state-> (walk_state->
......
...@@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) ...@@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
union acpi_ec *ec = (union acpi_ec *)context; union acpi_ec *ec = (union acpi_ec *)context;
struct acpi_generic_address *addr; struct acpi_generic_address *addr;
if (resource->type != ACPI_RSTYPE_IO) { if (resource->type != ACPI_RESOURCE_TYPE_IO) {
return AE_OK; return AE_OK;
} }
...@@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) ...@@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
addr->register_bit_width = 8; addr->register_bit_width = 8;
addr->register_bit_offset = 0; addr->register_bit_offset = 0;
addr->address = resource->data.io.min_base_address; addr->address = resource->data.io.minimum;
return AE_OK; return AE_OK;
} }
......
...@@ -600,7 +600,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ...@@ -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); status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); 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) ...@@ -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); status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); 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; break;
...@@ -652,7 +652,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ...@@ -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); status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); 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) ...@@ -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); status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); 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; break;
} }
return_VALUE(ACPI_INTERRUPT_HANDLED); return_UINT32(ACPI_INTERRUPT_HANDLED);
} }
#ifdef ACPI_GPE_NOTIFY_CHECK #ifdef ACPI_GPE_NOTIFY_CHECK
......
...@@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) ...@@ -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); 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) ...@@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
*/ */
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
return_VALUE(interrupt_handled); return_UINT32(interrupt_handled);
} }
/****************************************************************************** /******************************************************************************
......
...@@ -214,7 +214,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -214,7 +214,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_BUFFER: 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.length,
obj_desc->buffer.pointer); obj_desc->buffer.pointer);
...@@ -320,17 +320,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -320,17 +320,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_BUFFER_FIELD: 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.bit_length,
obj_desc->buffer_field.base_byte_offset, obj_desc->buffer_field.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset); obj_desc->buffer_field.start_field_bit_offset);
if (!obj_desc->buffer_field.buffer_obj) { if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n")); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
} else } else
if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
!= ACPI_TYPE_BUFFER) { != ACPI_TYPE_BUFFER) {
acpi_os_printf("*not a Buffer* \n"); acpi_os_printf("*not a Buffer*\n");
} else { } else {
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
depth + 1); depth + 1);
...@@ -618,7 +618,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) ...@@ -618,7 +618,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
acpi_os_printf("[Package] Contains %d Elements: \n", acpi_os_printf("[Package] Contains %d Elements:\n",
obj_desc->package.count); obj_desc->package.count);
for (i = 0; i < obj_desc->package.count; i++) { for (i = 0; i < obj_desc->package.count; i++) {
......
...@@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) ...@@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
if (name_string) { if (name_string) {
ACPI_STRCAT(name_string, char_buf); ACPI_STRCAT(name_string, char_buf);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Appended to - %s \n", name_string)); "Appended to - %s\n", name_string));
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"No Name string - %s \n", char_buf)); "No Name string - %s\n", char_buf));
} }
} else if (index == 0) { } else if (index == 0) {
/* /*
......
...@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, ...@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown field access type %X\n", access)); "Unknown field access type %X\n", access));
return_VALUE(0); return_UINT32(0);
} }
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { 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, ...@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
} }
*return_byte_alignment = byte_alignment; *return_byte_alignment = byte_alignment;
return_VALUE(bit_length); return_UINT32(bit_length);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode,
} }
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 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)); opcode, op_info->name, arg_types));
/* /*
......
...@@ -206,7 +206,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) ...@@ -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) ...@@ -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 */ /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
if (value == 0) { if (value == 0) {
return_VALUE(1); return_UINT32(1);
} }
current_value = value; current_value = value;
...@@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) ...@@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
num_digits++; num_digits++;
} }
return_VALUE(num_digits); return_UINT32(num_digits);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -99,15 +99,15 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) ...@@ -99,15 +99,15 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
unsigned long *busnr = (unsigned long *)data; unsigned long *busnr = (unsigned long *)data;
struct acpi_resource_address64 address; struct acpi_resource_address64 address;
if (resource->type != ACPI_RSTYPE_ADDRESS16 && if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
resource->type != ACPI_RSTYPE_ADDRESS32 && resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
resource->type != ACPI_RSTYPE_ADDRESS64) resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
return AE_OK; return AE_OK;
acpi_resource_to_address64(resource, &address); acpi_resource_to_address64(resource, &address);
if ((address.address_length > 0) && if ((address.address_length > 0) &&
(address.resource_type == ACPI_BUS_NUMBER_RANGE)) (address.resource_type == ACPI_BUS_NUMBER_RANGE))
*busnr = address.min_address_range; *busnr = address.minimum;
return AE_OK; return AE_OK;
} }
......
...@@ -204,18 +204,18 @@ u32 acpi_hw_get_mode(void) ...@@ -204,18 +204,18 @@ u32 acpi_hw_get_mode(void)
* system does not support mode transition. * system does not support mode transition.
*/ */
if (!acpi_gbl_FADT->smi_cmd) { if (!acpi_gbl_FADT->smi_cmd) {
return_VALUE(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} }
status = status =
acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_VALUE(ACPI_SYS_MODE_LEGACY); return_UINT32(ACPI_SYS_MODE_LEGACY);
} }
if (value) { if (value) {
return_VALUE(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} else { } else {
return_VALUE(ACPI_SYS_MODE_LEGACY); return_UINT32(ACPI_SYS_MODE_LEGACY);
} }
} }
...@@ -54,36 +54,36 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ...@@ -54,36 +54,36 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); 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; 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); return_VALUE(AE_OK);
if (IS_RESERVED_ADDR 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, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n", "Motherboard resources 0x%08x - 0x%08x\n",
io_res->min_base_address, io_res->minimum,
io_res->min_base_address + io_res->minimum +
io_res->range_length)); io_res->address_length));
requested_res = requested_res =
request_region(io_res->min_base_address, request_region(io_res->minimum,
io_res->range_length, "motherboard"); 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 = struct acpi_resource_fixed_io *fixed_io_res =
&res->data.fixed_io; &res->data.fixed_io;
if (IS_RESERVED_ADDR 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, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n", "Motherboard resources 0x%08x - 0x%08x\n",
fixed_io_res->base_address, fixed_io_res->address,
fixed_io_res->base_address + fixed_io_res->address +
fixed_io_res->range_length)); fixed_io_res->address_length));
requested_res = requested_res =
request_region(fixed_io_res->base_address, request_region(fixed_io_res->address,
fixed_io_res->range_length, fixed_io_res->address_length,
"motherboard"); "motherboard");
} }
} else { } else {
......
...@@ -498,7 +498,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -498,7 +498,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
path++; path++;
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Multi Pathname (%d Segments, Flags=%X) \n", "Multi Pathname (%d Segments, Flags=%X)\n",
num_segments, flags)); num_segments, flags));
break; break;
......
...@@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, ...@@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
acpi_ns_build_external_path(node, required_size, buffer->pointer); 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)); (char *)buffer->pointer, (u32) required_size));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
...@@ -249,10 +249,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) ...@@ -249,10 +249,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
if (!node) { if (!node) {
ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); 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) ...@@ -276,10 +276,10 @@ u32 acpi_ns_local(acpi_object_type type)
/* Type code out of range */ /* Type code out of range */
ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); 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) ...@@ -805,10 +805,10 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
type)); 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);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -116,7 +116,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) ...@@ -116,7 +116,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
break; break;
} }
return_VALUE(length); return_UINT32(length);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -50,11 +50,145 @@ ...@@ -50,11 +50,145 @@
ACPI_MODULE_NAME("psxface") ACPI_MODULE_NAME("psxface")
/* Local Prototypes */ /* 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 acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
static void static void
acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); 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 * FUNCTION: acpi_ps_execute_method
...@@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) ...@@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
*/ */
acpi_ps_update_parameter_list(info, REF_INCREMENT); 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 * 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace * named objects that it creates into the namespace
...@@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) ...@@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
status = acpi_ps_execute_pass(info); status = acpi_ps_execute_pass(info);
cleanup: cleanup:
/* End optional tracing */
acpi_ps_stop_trace(info);
/* Take away the extra reference that we gave the parameters above */ /* Take away the extra reference that we gave the parameters above */
acpi_ps_update_parameter_list(info, REF_DECREMENT); acpi_ps_update_parameter_list(info, REF_DECREMENT);
......
...@@ -258,7 +258,7 @@ typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **); ...@@ -258,7 +258,7 @@ typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
static int static int
acpi_pci_allocate_irq(struct acpi_prt_entry *entry, 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; int irq;
...@@ -266,8 +266,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, ...@@ -266,8 +266,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
if (entry->link.handle) { if (entry->link.handle) {
irq = acpi_pci_link_allocate_irq(entry->link.handle, irq = acpi_pci_link_allocate_irq(entry->link.handle,
entry->link.index, edge_level, entry->link.index, triggering,
active_high_low, link); polarity, link);
if (irq < 0) { if (irq < 0) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Invalid IRQ link routing entry\n")); "Invalid IRQ link routing entry\n"));
...@@ -275,8 +275,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, ...@@ -275,8 +275,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
} }
} else { } else {
irq = entry->link.index; irq = entry->link.index;
*edge_level = ACPI_LEVEL_SENSITIVE; *triggering = ACPI_LEVEL_SENSITIVE;
*active_high_low = ACPI_ACTIVE_LOW; *polarity = ACPI_ACTIVE_LOW;
} }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
...@@ -285,7 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, ...@@ -285,7 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
static int static int
acpi_pci_free_irq(struct acpi_prt_entry *entry, 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; int irq;
...@@ -307,8 +307,8 @@ static int ...@@ -307,8 +307,8 @@ static int
acpi_pci_irq_lookup(struct pci_bus *bus, acpi_pci_irq_lookup(struct pci_bus *bus,
int device, int device,
int pin, int pin,
int *edge_level, int *triggering,
int *active_high_low, char **link, irq_lookup_func func) int *polarity, char **link, irq_lookup_func func)
{ {
struct acpi_prt_entry *entry = NULL; struct acpi_prt_entry *entry = NULL;
int segment = pci_domain_nr(bus); int segment = pci_domain_nr(bus);
...@@ -327,7 +327,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus, ...@@ -327,7 +327,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
return_VALUE(-1); return_VALUE(-1);
} }
ret = func(entry, edge_level, active_high_low, link); ret = func(entry, triggering, polarity, link);
return_VALUE(ret); return_VALUE(ret);
} }
...@@ -339,8 +339,8 @@ acpi_pci_irq_lookup(struct pci_bus *bus, ...@@ -339,8 +339,8 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
static int static int
acpi_pci_irq_derive(struct pci_dev *dev, acpi_pci_irq_derive(struct pci_dev *dev,
int pin, int pin,
int *edge_level, int *triggering,
int *active_high_low, char **link, irq_lookup_func func) int *polarity, char **link, irq_lookup_func func)
{ {
struct pci_dev *bridge = dev; struct pci_dev *bridge = dev;
int irq = -1; int irq = -1;
...@@ -375,7 +375,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, ...@@ -375,7 +375,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
} }
irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
pin, edge_level, active_high_low, pin, triggering, polarity,
link, func); link, func);
} }
...@@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
{ {
int irq = 0; int irq = 0;
u8 pin = 0; u8 pin = 0;
int edge_level = ACPI_LEVEL_SENSITIVE; int triggering = ACPI_LEVEL_SENSITIVE;
int active_high_low = ACPI_ACTIVE_LOW; int polarity = ACPI_ACTIVE_LOW;
char *link = NULL; char *link = NULL;
int rc; int rc;
...@@ -432,7 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -432,7 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
* values override any BIOS-assigned IRQs set during boot. * values override any BIOS-assigned IRQs set during boot.
*/ */
irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, 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); acpi_pci_allocate_irq);
/* /*
...@@ -440,8 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -440,8 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
* device's parent bridge. * device's parent bridge.
*/ */
if (irq < 0) if (irq < 0)
irq = acpi_pci_irq_derive(dev, pin, &edge_level, irq = acpi_pci_irq_derive(dev, pin, &triggering,
&active_high_low, &link, &polarity, &link,
acpi_pci_allocate_irq); acpi_pci_allocate_irq);
/* /*
...@@ -463,7 +463,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -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) { if (rc < 0) {
printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
"to register GSI\n", pci_name(dev), ('A' + pin)); "to register GSI\n", pci_name(dev), ('A' + pin));
...@@ -478,8 +478,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -478,8 +478,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
printk("Link [%s] -> ", link); printk("Link [%s] -> ", link);
printk("GSI %u (%s, %s) -> IRQ %d\n", irq, printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
(edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
(active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
return_VALUE(0); return_VALUE(0);
} }
...@@ -495,8 +495,8 @@ void acpi_pci_irq_disable(struct pci_dev *dev) ...@@ -495,8 +495,8 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
{ {
int gsi = 0; int gsi = 0;
u8 pin = 0; u8 pin = 0;
int edge_level = ACPI_LEVEL_SENSITIVE; int triggering = ACPI_LEVEL_SENSITIVE;
int active_high_low = ACPI_ACTIVE_LOW; int polarity = ACPI_ACTIVE_LOW;
ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
...@@ -512,7 +512,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) ...@@ -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. * First we check the PCI IRQ routing table (PRT) for an IRQ.
*/ */
gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, 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); acpi_pci_free_irq);
/* /*
* If no PRT entry was found, we'll try to derive an IRQ from the * 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) ...@@ -520,7 +520,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
*/ */
if (gsi < 0) if (gsi < 0)
gsi = acpi_pci_irq_derive(dev, pin, gsi = acpi_pci_irq_derive(dev, pin,
&edge_level, &active_high_low, NULL, &triggering, &polarity, NULL,
acpi_pci_free_irq); acpi_pci_free_irq);
if (gsi < 0) if (gsi < 0)
return_VOID; return_VOID;
......
...@@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = { ...@@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = {
*/ */
struct acpi_pci_link_irq { struct acpi_pci_link_irq {
u8 active; /* Current IRQ */ u8 active; /* Current IRQ */
u8 edge_level; /* All IRQs */ u8 triggering; /* All IRQs */
u8 active_high_low; /* All IRQs */ u8 polarity; /* All IRQs */
u8 resource_type; u8 resource_type;
u8 possible_count; u8 possible_count;
u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
...@@ -109,18 +109,18 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ...@@ -109,18 +109,18 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible");
switch (resource->type) { switch (resource->type) {
case ACPI_RSTYPE_START_DPF: case ACPI_RESOURCE_TYPE_START_DEPENDENT:
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
case ACPI_RSTYPE_IRQ: case ACPI_RESOURCE_TYPE_IRQ:
{ {
struct acpi_resource_irq *p = &resource->data.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, ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Blank IRQ resource\n")); "Blank IRQ resource\n"));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
for (i = 0; for (i = 0;
(i < p->number_of_interrupts (i < p->interrupt_count
&& i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
if (!p->interrupts[i]) { if (!p->interrupts[i]) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_DEBUG_PRINT((ACPI_DB_WARN,
...@@ -131,22 +131,22 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ...@@ -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[i] = p->interrupts[i];
link->irq.possible_count++; link->irq.possible_count++;
} }
link->irq.edge_level = p->edge_level; link->irq.triggering = p->triggering;
link->irq.active_high_low = p->active_high_low; link->irq.polarity = p->polarity;
link->irq.resource_type = ACPI_RSTYPE_IRQ; link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ;
break; 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; &resource->data.extended_irq;
if (!p || !p->number_of_interrupts) { if (!p || !p->interrupt_count) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Blank EXT IRQ resource\n")); "Blank EXT IRQ resource\n"));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
for (i = 0; for (i = 0;
(i < p->number_of_interrupts (i < p->interrupt_count
&& i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
if (!p->interrupts[i]) { if (!p->interrupts[i]) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_DEBUG_PRINT((ACPI_DB_WARN,
...@@ -157,9 +157,9 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ...@@ -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[i] = p->interrupts[i];
link->irq.possible_count++; link->irq.possible_count++;
} }
link->irq.edge_level = p->edge_level; link->irq.triggering = p->triggering;
link->irq.active_high_low = p->active_high_low; link->irq.polarity = p->polarity;
link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
break; break;
} }
default: default:
...@@ -202,10 +202,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ...@@ -202,10 +202,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); ACPI_FUNCTION_TRACE("acpi_pci_link_check_current");
switch (resource->type) { switch (resource->type) {
case ACPI_RSTYPE_IRQ: case ACPI_RESOURCE_TYPE_IRQ:
{ {
struct acpi_resource_irq *p = &resource->data.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, * IRQ descriptors may have no IRQ# bits set,
* particularly those those w/ _STA disabled * particularly those those w/ _STA disabled
...@@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ...@@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
*irq = p->interrupts[0]; *irq = p->interrupts[0];
break; 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; &resource->data.extended_irq;
if (!p || !p->number_of_interrupts) { if (!p || !p->interrupt_count) {
/* /*
* extended IRQ descriptors must * extended IRQ descriptors must
* return at least 1 IRQ * return at least 1 IRQ
...@@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) ...@@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
buffer.pointer = resource; buffer.pointer = resource;
switch (link->irq.resource_type) { switch (link->irq.resource_type) {
case ACPI_RSTYPE_IRQ: case ACPI_RESOURCE_TYPE_IRQ:
resource->res.type = ACPI_RSTYPE_IRQ; resource->res.type = ACPI_RESOURCE_TYPE_IRQ;
resource->res.length = sizeof(struct acpi_resource); resource->res.length = sizeof(struct acpi_resource);
resource->res.data.irq.edge_level = link->irq.edge_level; resource->res.data.irq.triggering = link->irq.triggering;
resource->res.data.irq.active_high_low = resource->res.data.irq.polarity =
link->irq.active_high_low; link->irq.polarity;
if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
resource->res.data.irq.shared_exclusive = resource->res.data.irq.sharable =
ACPI_EXCLUSIVE; ACPI_EXCLUSIVE;
else else
resource->res.data.irq.shared_exclusive = ACPI_SHARED; resource->res.data.irq.sharable = ACPI_SHARED;
resource->res.data.irq.number_of_interrupts = 1; resource->res.data.irq.interrupt_count = 1;
resource->res.data.irq.interrupts[0] = irq; resource->res.data.irq.interrupts[0] = irq;
break; break;
case ACPI_RSTYPE_EXT_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
resource->res.type = ACPI_RSTYPE_EXT_IRQ; resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
resource->res.length = sizeof(struct acpi_resource); resource->res.length = sizeof(struct acpi_resource);
resource->res.data.extended_irq.producer_consumer = resource->res.data.extended_irq.producer_consumer =
ACPI_CONSUMER; ACPI_CONSUMER;
resource->res.data.extended_irq.edge_level = resource->res.data.extended_irq.triggering =
link->irq.edge_level; link->irq.triggering;
resource->res.data.extended_irq.active_high_low = resource->res.data.extended_irq.polarity =
link->irq.active_high_low; link->irq.polarity;
if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
resource->res.data.irq.shared_exclusive = resource->res.data.irq.sharable =
ACPI_EXCLUSIVE; ACPI_EXCLUSIVE;
else else
resource->res.data.irq.shared_exclusive = ACPI_SHARED; resource->res.data.irq.sharable = ACPI_SHARED;
resource->res.data.extended_irq.number_of_interrupts = 1; resource->res.data.extended_irq.interrupt_count = 1;
resource->res.data.extended_irq.interrupts[0] = irq; resource->res.data.extended_irq.interrupts[0] = irq;
/* ignore resource_source, it's optional */ /* ignore resource_source, it's optional */
break; break;
...@@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) ...@@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
goto end; goto end;
} }
resource->end.type = ACPI_RSTYPE_END_TAG; resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
/* Attempt to set the resource */ /* Attempt to set the resource */
status = acpi_set_current_resources(link->handle, &buffer); status = acpi_set_current_resources(link->handle, &buffer);
...@@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) ...@@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
int int
acpi_pci_link_allocate_irq(acpi_handle handle, acpi_pci_link_allocate_irq(acpi_handle handle,
int index, int index,
int *edge_level, int *active_high_low, char **name) int *triggering, int *polarity, char **name)
{ {
int result = 0; int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
...@@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle, ...@@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
link->refcnt++; link->refcnt++;
up(&acpi_link_lock); up(&acpi_link_lock);
if (edge_level) if (triggering)
*edge_level = link->irq.edge_level; *triggering = link->irq.triggering;
if (active_high_low) if (polarity)
*active_high_low = link->irq.active_high_low; *polarity = link->irq.polarity;
if (name) if (name)
*name = acpi_device_bid(link->device); *name = acpi_device_bid(link->device);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
......
...@@ -122,15 +122,15 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) ...@@ -122,15 +122,15 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
int *busnr = (int *)data; int *busnr = (int *)data;
struct acpi_resource_address64 address; struct acpi_resource_address64 address;
if (resource->type != ACPI_RSTYPE_ADDRESS16 && if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
resource->type != ACPI_RSTYPE_ADDRESS32 && resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
resource->type != ACPI_RSTYPE_ADDRESS64) resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
return AE_OK; return AE_OK;
acpi_resource_to_address64(resource, &address); acpi_resource_to_address64(resource, &address);
if ((address.address_length > 0) && if ((address.address_length > 0) &&
(address.resource_type == ACPI_BUS_NUMBER_RANGE)) (address.resource_type == ACPI_BUS_NUMBER_RANGE))
*busnr = address.min_address_range; *busnr = address.minimum;
return AE_OK; return AE_OK;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for all Linux ACPI interpreter subdirectories # 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 rscalc.o rsirq.o rsmemory.o rsutils.o
obj-$(ACPI_FUTURE_USAGE) += rsdump.o obj-$(ACPI_FUTURE_USAGE) += rsdump.o
......
此差异已折叠。
...@@ -44,87 +44,14 @@ ...@@ -44,87 +44,14 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acresrc.h> #include <acpi/acresrc.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/amlresrc.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#define _COMPONENT ACPI_RESOURCES #define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rscalc") 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 */ /* Local prototypes */
static u8 acpi_rs_count_set_bits(u16 bit_field); 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 static acpi_size
acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); acpi_rs_struct_option_length(struct acpi_resource_source *resource_source);
...@@ -159,90 +86,6 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) ...@@ -159,90 +86,6 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
return (bits_set); return (bits_set);
} }
/*******************************************************************************
*
* 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 * FUNCTION: acpi_rs_struct_option_length
...@@ -291,10 +134,10 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) ...@@ -291,10 +134,10 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
******************************************************************************/ ******************************************************************************/
static u32 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 string_length = 0;
u32 minimum_resource_length;
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
...@@ -303,11 +146,6 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) ...@@ -303,11 +146,6 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
* Large-type resource descriptors. * 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 * 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 * 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) ...@@ -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 * (including the null terminator) is the resource length minus the minimum
* length, minus one byte for the resource_source_index itself. * 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 */ /* 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 */ /* 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) ...@@ -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 * PARAMETERS: Resource - Pointer to the resource linked list
* size_needed - Where the required size is returned * size_needed - Where the required size is returned
...@@ -342,62 +181,62 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) ...@@ -342,62 +181,62 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_get_byte_stream_length(struct acpi_resource * resource, acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
acpi_size * size_needed)
{ {
acpi_size byte_stream_size_needed = 0; acpi_size aml_size_needed = 0;
acpi_size segment_size; 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 */ /* Traverse entire list of internal resource descriptors */
while (resource) { while (resource) {
/* Validate the descriptor type */ /* 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); return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
} }
/* Get the base size of the (external stream) resource descriptor */ /* 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 * Augment the base size for descriptors with optional and/or
* variable-length fields * variable-length fields
*/ */
switch (resource->type) { switch (resource->type) {
case ACPI_RSTYPE_VENDOR: case ACPI_RESOURCE_TYPE_VENDOR:
/* /*
* Vendor Defined Resource: * Vendor Defined Resource:
* For a Vendor Specific resource, if the Length is between 1 and 7 * 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 * it will be created as a Small Resource data type, otherwise it
* is a Large Resource data type. * 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 */ /* 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 */ /* Add the size of the vendor-specific data */
segment_size += resource->data.vendor_specific.length; segment_size += resource->data.vendor.byte_length;
break; break;
case ACPI_RSTYPE_END_TAG: case ACPI_RESOURCE_TYPE_END_TAG:
/* /*
* End Tag: * End Tag:
* We are done -- return the accumulated total size. * 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 */ /* Normal exit */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
case ACPI_RSTYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS16:
/* /*
* 16-Bit Address Resource: * 16-Bit Address Resource:
* Add the size of the optional resource_source info * Add the size of the optional resource_source info
...@@ -408,7 +247,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ...@@ -408,7 +247,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
resource_source); resource_source);
break; break;
case ACPI_RSTYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS32:
/* /*
* 32-Bit Address Resource: * 32-Bit Address Resource:
* Add the size of the optional resource_source info * Add the size of the optional resource_source info
...@@ -419,7 +258,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ...@@ -419,7 +258,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
resource_source); resource_source);
break; break;
case ACPI_RSTYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_ADDRESS64:
/* /*
* 64-Bit Address Resource: * 64-Bit Address Resource:
* Add the size of the optional resource_source info * Add the size of the optional resource_source info
...@@ -430,7 +269,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ...@@ -430,7 +269,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
resource_source); resource_source);
break; break;
case ACPI_RSTYPE_EXT_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
/* /*
* Extended IRQ Resource: * Extended IRQ Resource:
* Add the size of each additional optional interrupt beyond the * Add the size of each additional optional interrupt beyond the
...@@ -438,7 +277,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ...@@ -438,7 +277,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
*/ */
segment_size += (((acpi_size) segment_size += (((acpi_size)
resource->data.extended_irq. resource->data.extended_irq.
number_of_interrupts - 1) * 4); interrupt_count - 1) * 4);
/* Add the size of the optional resource_source info */ /* Add the size of the optional resource_source info */
...@@ -454,7 +293,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ...@@ -454,7 +293,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
/* Update the total */ /* Update the total */
byte_stream_size_needed += segment_size; aml_size_needed += segment_size;
/* Point to the next object */ /* Point to the next object */
...@@ -471,9 +310,9 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ...@@ -471,9 +310,9 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
* *
* FUNCTION: acpi_rs_get_list_length * FUNCTION: acpi_rs_get_list_length
* *
* PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream * PARAMETERS: aml_buffer - Pointer to the resource byte stream
* byte_stream_buffer_length - Size of byte_stream_buffer * aml_buffer_length - Size of aml_buffer
* size_needed - Where the size needed is returned * size_needed - Where the size needed is returned
* *
* RETURN: Status * RETURN: Status
* *
...@@ -484,11 +323,11 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ...@@ -484,11 +323,11 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_get_list_length(u8 * byte_stream_buffer, acpi_rs_get_list_length(u8 * aml_buffer,
u32 byte_stream_buffer_length, acpi_size * size_needed) u32 aml_buffer_length, acpi_size * size_needed)
{ {
u8 *buffer; u8 *buffer;
struct acpi_resource_sizes *resource_info; struct acpi_resource_info *resource_info;
u32 buffer_size = 0; u32 buffer_size = 0;
u32 bytes_parsed = 0; u32 bytes_parsed = 0;
u8 resource_type; u8 resource_type;
...@@ -499,14 +338,14 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -499,14 +338,14 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_FUNCTION_TRACE("rs_get_list_length"); 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 */ /* 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 */ /* 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) { if (!resource_info) {
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
} }
...@@ -514,43 +353,46 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -514,43 +353,46 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
/* Get the Length field from the input resource descriptor */ /* Get the Length field from the input resource descriptor */
resource_length = 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 */ /* Augment the size for descriptors with optional fields */
extra_struct_bytes = 0; extra_struct_bytes = 0;
if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) { if (!(resource_type & ACPI_RESOURCE_NAME_LARGE)) {
/* /*
* Small resource descriptors * Small resource descriptors
*/ */
header_length = 1; header_length =
buffer = byte_stream_buffer + header_length; sizeof(struct aml_resource_small_header);
buffer = aml_buffer + header_length;
switch (resource_type) { switch (resource_type) {
case ACPI_RDESC_TYPE_IRQ_FORMAT: case ACPI_RESOURCE_NAME_IRQ:
/* /*
* IRQ Resource: * IRQ Resource:
* Get the number of bits set in the IRQ word * Get the number of bits set in the IRQ word
*/ */
ACPI_MOVE_16_TO_16(&temp16, buffer); ACPI_MOVE_16_TO_16(&temp16, buffer);
extra_struct_bytes = extra_struct_bytes =
(acpi_rs_count_set_bits(temp16) * (acpi_rs_count_set_bits(temp16) *
sizeof(u32)); sizeof(u32));
break; break;
case ACPI_RDESC_TYPE_DMA_FORMAT: case ACPI_RESOURCE_NAME_DMA:
/* /*
* DMA Resource: * DMA Resource:
* Get the number of bits set in the DMA channels byte * Get the number of bits set in the DMA channels byte
*/ */
ACPI_MOVE_16_TO_16(&temp16, buffer);
extra_struct_bytes = extra_struct_bytes =
(acpi_rs_count_set_bits((u16) * buffer) * (acpi_rs_count_set_bits(temp16) *
sizeof(u32)); sizeof(u32));
break; break;
case ACPI_RDESC_TYPE_SMALL_VENDOR: case ACPI_RESOURCE_NAME_VENDOR_SMALL:
/* /*
* Vendor Specific Resource: * Vendor Specific Resource:
* Ensure a 32-bit boundary for the structure * Ensure a 32-bit boundary for the structure
...@@ -559,12 +401,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -559,12 +401,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_ROUND_UP_to_32_bITS(resource_length); ACPI_ROUND_UP_to_32_bITS(resource_length);
break; break;
case ACPI_RDESC_TYPE_END_TAG: case ACPI_RESOURCE_NAME_END_TAG:
/* /*
* End Tag: * End Tag:
* Terminate the loop now * Terminate the loop now
*/ */
byte_stream_buffer_length = bytes_parsed; aml_buffer_length = bytes_parsed;
break; break;
default: default:
...@@ -574,11 +416,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -574,11 +416,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
/* /*
* Large resource descriptors * Large resource descriptors
*/ */
header_length = sizeof(struct asl_large_header); header_length =
buffer = byte_stream_buffer + header_length; sizeof(struct aml_resource_large_header);
buffer = aml_buffer + header_length;
switch (resource_type) { switch (resource_type) {
case ACPI_RDESC_TYPE_LARGE_VENDOR: case ACPI_RESOURCE_NAME_VENDOR_LARGE:
/* /*
* Vendor Defined Resource: * Vendor Defined Resource:
* Add vendor data and ensure a 32-bit boundary for the structure * 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, ...@@ -587,8 +430,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_ROUND_UP_to_32_bITS(resource_length); ACPI_ROUND_UP_to_32_bITS(resource_length);
break; break;
case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: case ACPI_RESOURCE_NAME_ADDRESS32:
case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: case ACPI_RESOURCE_NAME_ADDRESS16:
/* /*
* 32-Bit or 16-bit Address Resource: * 32-Bit or 16-bit Address Resource:
* Add the size of any optional data (resource_source) * Add the size of any optional data (resource_source)
...@@ -596,10 +439,11 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -596,10 +439,11 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
extra_struct_bytes = extra_struct_bytes =
acpi_rs_stream_option_length acpi_rs_stream_option_length
(resource_length, (resource_length,
resource_info->minimum_stream_size); resource_info->
minimum_aml_resource_length);
break; break;
case ACPI_RDESC_TYPE_EXTENDED_XRUPT: case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
/* /*
* Extended IRQ: * Extended IRQ:
* Point past the interrupt_vector_flags to get the * Point past the interrupt_vector_flags to get the
...@@ -622,10 +466,10 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -622,10 +466,10 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
- -
extra_struct_bytes, extra_struct_bytes,
resource_info-> resource_info->
minimum_stream_size); minimum_aml_resource_length);
break; break;
case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: case ACPI_RESOURCE_NAME_ADDRESS64:
/* /*
* 64-Bit Address Resource: * 64-Bit Address Resource:
* Add the size of any optional data (resource_source) * Add the size of any optional data (resource_source)
...@@ -635,7 +479,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -635,7 +479,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
ACPI_ROUND_UP_to_64_bITS ACPI_ROUND_UP_to_64_bITS
(acpi_rs_stream_option_length (acpi_rs_stream_option_length
(resource_length, (resource_length,
resource_info->minimum_stream_size)); resource_info->
minimum_aml_resource_length));
break; break;
default: default:
...@@ -646,7 +491,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -646,7 +491,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
/* Update the required buffer size for the internal descriptor structs */ /* Update the required buffer size for the internal descriptor structs */
temp16 = temp16 =
(u16) (resource_info->minimum_struct_size + (u16) (resource_info->minimum_internal_struct_length +
extra_struct_bytes); extra_struct_bytes);
buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16);
...@@ -656,7 +501,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ...@@ -656,7 +501,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer,
*/ */
temp16 = (u16) (header_length + resource_length); temp16 = (u16) (header_length + resource_length);
bytes_parsed += temp16; bytes_parsed += temp16;
byte_stream_buffer += temp16; aml_buffer += temp16;
} }
/* This is the data the caller needs */ /* This is the data the caller needs */
...@@ -758,8 +603,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, ...@@ -758,8 +603,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
(*sub_object_list)->string. (*sub_object_list)->string.
length + 1); length + 1);
} else { } else {
temp_size_needed += temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
} }
} else { } else {
/* /*
......
...@@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate") ...@@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate")
* *
* FUNCTION: acpi_rs_create_resource_list * FUNCTION: acpi_rs_create_resource_list
* *
* PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream * PARAMETERS: aml_buffer - Pointer to the resource byte stream
* output_buffer - Pointer to the user's buffer * 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 * If output_buffer is not large enough, output_buffer_length
* indicates how large output_buffer should be, else it * indicates how large output_buffer should be, else it
* indicates how may u8 elements of output_buffer are valid. * indicates how may u8 elements of output_buffer are valid.
...@@ -67,33 +67,30 @@ ACPI_MODULE_NAME("rscreate") ...@@ -67,33 +67,30 @@ ACPI_MODULE_NAME("rscreate")
* *
******************************************************************************/ ******************************************************************************/
acpi_status 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) struct acpi_buffer *output_buffer)
{ {
acpi_status status; acpi_status status;
u8 *byte_stream_start; u8 *aml_start;
acpi_size list_size_needed = 0; acpi_size list_size_needed = 0;
u32 byte_stream_buffer_length; u32 aml_buffer_length;
ACPI_FUNCTION_TRACE("rs_create_resource_list"); ACPI_FUNCTION_TRACE("rs_create_resource_list");
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer));
byte_stream_buffer));
/* Params already validated, so we don't re-validate here */ /* Params already validated, so we don't re-validate here */
byte_stream_buffer_length = byte_stream_buffer->buffer.length; aml_buffer_length = aml_buffer->buffer.length;
byte_stream_start = byte_stream_buffer->buffer.pointer; 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 * the buffer size needed for the linked list
*/ */
status = status = acpi_rs_get_list_length(aml_start, aml_buffer_length,
acpi_rs_get_list_length(byte_stream_start, &list_size_needed);
byte_stream_buffer_length,
&list_size_needed);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n",
status, (u32) list_size_needed)); status, (u32) list_size_needed));
...@@ -110,10 +107,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, ...@@ -110,10 +107,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
/* Do the conversion */ /* Do the conversion */
status = status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length,
acpi_rs_byte_stream_to_list(byte_stream_start, output_buffer->pointer);
byte_stream_buffer_length,
output_buffer->pointer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -360,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -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 * PARAMETERS: linked_list_buffer - Pointer to the resource linked list
* output_buffer - Pointer to the user's buffer * output_buffer - Pointer to the user's buffer
...@@ -377,13 +372,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -377,13 +372,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
struct acpi_buffer *output_buffer) struct acpi_buffer *output_buffer)
{ {
acpi_status status; 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", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n",
linked_list_buffer)); linked_list_buffer));
...@@ -394,11 +389,10 @@ acpi_rs_create_byte_stream(struct acpi_resource *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 * Pass the linked_list_buffer into a module that calculates
* the buffer size needed for the byte stream. * the buffer size needed for the byte stream.
*/ */
status = acpi_rs_get_byte_stream_length(linked_list_buffer, status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed);
&byte_stream_size_needed);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n",
(u32) byte_stream_size_needed, (u32) aml_size_needed,
acpi_format_exception(status))); acpi_format_exception(status)));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -406,8 +400,7 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, ...@@ -406,8 +400,7 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
/* Validate/Allocate/Clear caller buffer */ /* Validate/Allocate/Clear caller buffer */
status = status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed);
acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -415,9 +408,9 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, ...@@ -415,9 +408,9 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
/* Do the conversion */ /* Do the conversion */
status = status =
acpi_rs_list_to_byte_stream(linked_list_buffer, acpi_rs_convert_resources_to_aml(linked_list_buffer,
byte_stream_size_needed, aml_size_needed,
output_buffer->pointer); output_buffer->pointer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
......
此差异已折叠。
...@@ -207,7 +207,7 @@ struct acpi_resource_info acpi_gbl_lg_resource_info[] = { ...@@ -207,7 +207,7 @@ struct acpi_resource_info acpi_gbl_lg_resource_info[] = {
{0, ACPI_RLARGE(struct aml_resource_memory24), {0, ACPI_RLARGE(struct aml_resource_memory24),
ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)}, ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)},
{0, ACPI_RLARGE(struct aml_resource_generic_register), {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}, {0, 0, 0},
{1, ACPI_RLARGE(struct aml_resource_vendor_large), {1, ACPI_RLARGE(struct aml_resource_vendor_large),
ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)},
......
...@@ -49,426 +49,269 @@ ACPI_MODULE_NAME("rsio") ...@@ -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 * PARAMETERS: Aml - Pointer to the AML resource descriptor
* stream * aml_resource_length - Length of the resource from the AML header
* bytes_consumed - Pointer to where the number of bytes * Resource - Where the internal resource is returned
* 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
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Take the resource byte stream and fill out the appropriate * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
* structure pointed to by the output_buffer. Return the * internal resource descriptor, simplifying bitflags and handling
* number of bytes consumed from the byte stream. * alignment and endian issues if necessary.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_io_resource(u8 * byte_stream_buffer, acpi_rs_get_io(union aml_resource *aml,
acpi_size * bytes_consumed, u16 aml_resource_length, struct acpi_resource *resource)
u8 ** output_buffer, acpi_size * structure_size)
{ {
u8 *buffer = byte_stream_buffer; ACPI_FUNCTION_TRACE("rs_get_io");
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_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 */ resource->type = ACPI_RESOURCE_TYPE_IO;
resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
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;
return_ACPI_STATUS(AE_OK); 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 * PARAMETERS: Resource - Pointer to the resource descriptor
* stream * Aml - Where the AML descriptor is returned
* 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
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Take the resource byte stream and fill out the appropriate * DESCRIPTION: Convert an internal resource descriptor to the corresponding
* structure pointed to by the output_buffer. Return the * external AML resource descriptor.
* number of bytes consumed from the byte stream.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml)
acpi_size * bytes_consumed,
u8 ** output_buffer, acpi_size * structure_size)
{ {
u8 *buffer = byte_stream_buffer; ACPI_FUNCTION_TRACE("rs_set_io");
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");
/* 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_rs_set_resource_header(ACPI_RESOURCE_NAME_IO,
ACPI_MOVE_16_TO_16(&temp16, buffer); sizeof(struct aml_resource_io), aml);
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;
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_rs_io_stream * FUNCTION: acpi_rs_get_fixed_io
* *
* PARAMETERS: Resource - Pointer to the resource linked list * PARAMETERS: Aml - Pointer to the AML resource descriptor
* output_buffer - Pointer to the user's return buffer * aml_resource_length - Length of the resource from the AML header
* bytes_consumed - Pointer to where the number of bytes * Resource - Where the internal resource is returned
* used in the output_buffer is returned
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Take the linked list resource structure and fills in the * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
* the appropriate bytes in a byte stream * internal resource descriptor, simplifying bitflags and handling
* alignment and endian issues if necessary.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_io_stream(struct acpi_resource *resource, acpi_rs_get_fixed_io(union aml_resource *aml,
u8 ** output_buffer, acpi_size * bytes_consumed) u16 aml_resource_length, struct acpi_resource *resource)
{ {
u8 *buffer = *output_buffer; ACPI_FUNCTION_TRACE("rs_get_fixed_io");
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 */
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); /* Complete the resource header */
buffer += 2;
/* Set the base alignment */ resource->type = ACPI_RESOURCE_TYPE_FIXED_IO;
resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
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);
return_ACPI_STATUS(AE_OK); 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 * PARAMETERS: Resource - Pointer to the resource descriptor
* output_buffer - Pointer to the user's return buffer * Aml - Where the AML descriptor is returned
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Take the linked list resource structure and fills in the * DESCRIPTION: Convert an internal resource descriptor to the corresponding
* the appropriate bytes in a byte stream * external AML resource descriptor.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_fixed_io_stream(struct acpi_resource *resource, acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml)
u8 ** output_buffer, acpi_size * bytes_consumed)
{ {
u8 *buffer = *output_buffer; ACPI_FUNCTION_TRACE("rs_set_fixed_io");
u16 temp16 = 0;
u8 temp8 = 0; /*
* Set the following contiguous fields in the AML descriptor:
ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); * Base Address
* Length
/* The Descriptor Type field is static */ */
ACPI_MOVE_32_TO_16(&aml->fixed_io.address,
*buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03; &resource->data.fixed_io.address);
buffer += 1; aml->fixed_io.address_length =
(u8) resource->data.fixed_io.address_length;
/* Set the Range base address */
/* Complete the AML descriptor header */
temp16 = (u16) resource->data.fixed_io.base_address;
acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO,
ACPI_MOVE_16_TO_16(buffer, &temp16); sizeof(struct aml_resource_fixed_io), aml);
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);
return_ACPI_STATUS(AE_OK); 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 * PARAMETERS: Aml - Pointer to the AML resource descriptor
* stream * aml_resource_length - Length of the resource from the AML header
* bytes_consumed - Pointer to where the number of bytes * Resource - Where the internal resource is returned
* 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
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Take the resource byte stream and fill out the appropriate * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
* structure pointed to by the output_buffer. Return the * internal resource descriptor, simplifying bitflags and handling
* number of bytes consumed from the byte stream. * alignment and endian issues if necessary.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_dma_resource(u8 * byte_stream_buffer, acpi_rs_get_dma(union aml_resource *aml,
acpi_size * bytes_consumed, u16 aml_resource_length, struct acpi_resource *resource)
u8 ** output_buffer, acpi_size * structure_size)
{ {
u8 *buffer = byte_stream_buffer; u32 channel_count = 0;
struct acpi_resource *output_struct = (void *)*output_buffer; u32 i;
u8 temp8 = 0; u8 temp8;
u8 index;
u8 i;
acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
ACPI_FUNCTION_TRACE("rs_dma_resource"); ACPI_FUNCTION_TRACE("rs_get_dma");
/* 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;
/* Decode the DMA channel bits */ /* Decode the DMA channel bits */
for (i = 0, index = 0; index < 8; index++) { for (i = 0; i < 8; i++) {
if ((temp8 >> index) & 0x01) { if ((aml->dma.dma_channel_mask >> i) & 0x01) {
output_struct->data.dma.channels[i] = index; resource->data.dma.channels[channel_count] = i;
i++; channel_count++;
} }
} }
/* Zero DMA channels is valid */ resource->length = 0;
resource->data.dma.channel_count = channel_count;
output_struct->data.dma.number_of_channels = i;
if (i > 0) {
/* Calculate the structure size based upon the number of interrupts */
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 = aml->dma.flags;
temp8 = *buffer; 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]) */ if (resource->data.dma.transfer == 0x03) {
output_struct->data.dma.transfer = temp8 & 0x03;
if (0x03 == output_struct->data.dma.transfer) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid DMA.Transfer preference (3)\n")); "Invalid DMA.Transfer preference (3)\n"));
return_ACPI_STATUS(AE_BAD_DATA); return_ACPI_STATUS(AE_BAD_DATA);
} }
/* Get bus master preference (Bit[2]) */ /* Complete the resource header */
output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01;
/* Get channel speed support (Bits[6:5]) */
output_struct->data.dma.type = (temp8 >> 5) & 0x03; resource->type = ACPI_RESOURCE_TYPE_DMA;
resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
/* Set the Length parameter */
output_struct->length = (u32) struct_size;
/* Return the final size of the structure */
*structure_size = struct_size;
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_rs_dma_stream * FUNCTION: acpi_rs_set_dma
* *
* PARAMETERS: Resource - Pointer to the resource linked list * PARAMETERS: Resource - Pointer to the resource descriptor
* output_buffer - Pointer to the user's return buffer * Aml - Where the AML descriptor is returned
* bytes_consumed - Pointer to where the number of bytes
* used in the output_buffer is returned
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Take the linked list resource structure and fills in the * DESCRIPTION: Convert an internal resource descriptor to the corresponding
* the appropriate bytes in a byte stream * external AML resource descriptor.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_rs_dma_stream(struct acpi_resource *resource, acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml)
u8 ** output_buffer, acpi_size * bytes_consumed)
{ {
u8 *buffer = *output_buffer; u8 i;
u16 temp16 = 0;
u8 temp8 = 0;
u8 index;
ACPI_FUNCTION_TRACE("rs_dma_stream");
/* The Descriptor Type field is static */
*buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02; ACPI_FUNCTION_TRACE("rs_set_dma");
buffer += 1;
temp8 = 0;
/* 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++) { aml->dma.dma_channel_mask = 0;
temp16 = (u16) resource->data.dma.channels[index]; for (i = 0; i < resource->data.dma.channel_count; i++) {
temp8 |= 0x1 << temp16; aml->dma.dma_channel_mask |=
(1 << resource->data.dma.channels[i]);
} }
*buffer = temp8; /* Set the DMA Flag bits */
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);
*buffer = temp8; aml->dma.flags = (u8)
buffer += 1; (((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); return_ACPI_STATUS(AE_OK);
} }
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -59,9 +59,9 @@ ACPI_MODULE_NAME("rsxface") ...@@ -59,9 +59,9 @@ ACPI_MODULE_NAME("rsxface")
ACPI_COPY_FIELD(out, in, max_address_fixed); \ ACPI_COPY_FIELD(out, in, max_address_fixed); \
ACPI_COPY_FIELD(out, in, attribute); \ ACPI_COPY_FIELD(out, in, attribute); \
ACPI_COPY_FIELD(out, in, granularity); \ ACPI_COPY_FIELD(out, in, granularity); \
ACPI_COPY_FIELD(out, in, min_address_range); \ ACPI_COPY_FIELD(out, in, minimum); \
ACPI_COPY_FIELD(out, in, max_address_range); \ ACPI_COPY_FIELD(out, in, maximum); \
ACPI_COPY_FIELD(out, in, address_translation_offset); \ ACPI_COPY_FIELD(out, in, translation_offset); \
ACPI_COPY_FIELD(out, in, address_length); \ ACPI_COPY_FIELD(out, in, address_length); \
ACPI_COPY_FIELD(out, in, resource_source); ACPI_COPY_FIELD(out, in, resource_source);
/******************************************************************************* /*******************************************************************************
...@@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle, ...@@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle,
/* Walk the resource list */ /* Walk the resource list */
for (;;) { for (;;) {
if (!resource || resource->type == ACPI_RSTYPE_END_TAG) { if (!resource || resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
break; break;
} }
...@@ -382,19 +382,19 @@ acpi_resource_to_address64(struct acpi_resource *resource, ...@@ -382,19 +382,19 @@ acpi_resource_to_address64(struct acpi_resource *resource,
struct acpi_resource_address32 *address32; struct acpi_resource_address32 *address32;
switch (resource->type) { switch (resource->type) {
case ACPI_RSTYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS16:
address16 = (struct acpi_resource_address16 *)&resource->data; address16 = (struct acpi_resource_address16 *)&resource->data;
ACPI_COPY_ADDRESS(out, address16); ACPI_COPY_ADDRESS(out, address16);
break; break;
case ACPI_RSTYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS32:
address32 = (struct acpi_resource_address32 *)&resource->data; address32 = (struct acpi_resource_address32 *)&resource->data;
ACPI_COPY_ADDRESS(out, address32); ACPI_COPY_ADDRESS(out, address32);
break; break;
case ACPI_RSTYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_ADDRESS64:
/* Simple copy for 64 bit source */ /* Simple copy for 64 bit source */
......
...@@ -251,7 +251,7 @@ acpi_status acpi_tb_get_table_rsdt(void) ...@@ -251,7 +251,7 @@ acpi_status acpi_tb_get_table_rsdt(void)
} }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, 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_gbl_RSDP,
ACPI_FORMAT_UINT64(address.pointer.value))); ACPI_FORMAT_UINT64(address.pointer.value)));
......
...@@ -251,7 +251,7 @@ acpi_get_firmware_table(acpi_string signature, ...@@ -251,7 +251,7 @@ acpi_get_firmware_table(acpi_string signature,
acpi_tb_get_rsdt_address(&address); acpi_tb_get_rsdt_address(&address);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, 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_gbl_RSDP,
ACPI_FORMAT_UINT64(address.pointer.value))); ACPI_FORMAT_UINT64(address.pointer.value)));
......
...@@ -304,7 +304,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) ...@@ -304,7 +304,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
if (!size) { if (!size) {
_ACPI_REPORT_ERROR(module, line, component, _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; size = 1;
} }
...@@ -347,8 +347,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) ...@@ -347,8 +347,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
if (!size) { if (!size) {
_ACPI_REPORT_ERROR(module, line, component, _ACPI_REPORT_ERROR(module, line, component,
("ut_callocate: Attempt to allocate zero bytes\n")); ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
return_PTR(NULL); size = 1;
} }
allocation = acpi_os_allocate(size); allocation = acpi_os_allocate(size);
......
...@@ -825,6 +825,9 @@ void acpi_ut_init_globals(void) ...@@ -825,6 +825,9 @@ void acpi_ut_init_globals(void)
acpi_gbl_ps_find_count = 0; acpi_gbl_ps_find_count = 0;
acpi_gbl_acpi_hardware_present = TRUE; acpi_gbl_acpi_hardware_present = TRUE;
acpi_gbl_owner_id_mask = 0; 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_debugger_configuration = DEBUGGER_THREADING;
acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20050916 #define ACPI_CA_VERSION 0x20050930
/* /*
* OS name, used for the _OS object. The _OS object is essentially obsolete, * OS name, used for the _OS object. The _OS object is essentially obsolete,
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册