Skip to content

Commit

Permalink
[ACPI] ACPICA 20050930
Browse files Browse the repository at this point in the history
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: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Bob Moore authored and Len Brown committed Dec 10, 2005
1 parent 3d5271f commit 50eca3e
Show file tree
Hide file tree
Showing 58 changed files with 2,949 additions and 3,509 deletions.
22 changes: 11 additions & 11 deletions arch/ia64/kernel/acpi-ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_resource_vendor *vendor;
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;

vendor = (struct acpi_resource_vendor *)&resource->data;
descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
if (vendor->length <= sizeof(*info->descriptor) ||
descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data;
if (vendor->byte_length <= sizeof(*info->descriptor) ||
descriptor->guid_id != info->descriptor->guid_id ||
efi_guidcmp(descriptor->guid, info->descriptor->guid))
return AE_OK;

length = vendor->length - sizeof(struct acpi_vendor_descriptor);
info->data = acpi_os_allocate(length);
byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor);
info->data = acpi_os_allocate(byte_length);
if (!info->data)
return AE_NO_MEMORY;

memcpy(info->data,
vendor->reserved + sizeof(struct acpi_vendor_descriptor),
length);
info->length = length;
vendor->byte_data + sizeof(struct acpi_vendor_descriptor),
byte_length);
info->length = byte_length;
return AE_CTRL_TERMINATE;
}

acpi_status
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;

Expand All @@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
return AE_NOT_FOUND;

*data = info.data;
*length = info.length;
*byte_length = info.length;
return AE_OK;
}

Expand Down
8 changes: 4 additions & 4 deletions arch/ia64/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
goto free_resource;
}

min = addr->min_address_range;
min = addr->minimum;
max = min + addr->address_length - 1;
if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION)
sparse = 1;

space_nr = new_space(addr->address_translation_offset, sparse);
space_nr = new_space(addr->translation_offset, sparse);
if (space_nr == ~0)
goto free_name;

Expand Down Expand Up @@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
if (addr.resource_type == ACPI_MEMORY_RANGE) {
flags = IORESOURCE_MEM;
root = &iomem_resource;
offset = addr.address_translation_offset;
offset = addr.translation_offset;
} else if (addr.resource_type == ACPI_IO_RANGE) {
flags = IORESOURCE_IO;
root = &ioport_resource;
Expand All @@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
window = &info->controller->window[info->controller->windows++];
window->resource.name = info->name;
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.child = NULL;
window->offset = offset;
Expand Down
10 changes: 5 additions & 5 deletions arch/x86_64/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
unsigned long flags;
Expand All @@ -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.dest_mode = INT_DEST_MODE;
entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
entry.trigger = edge_level;
entry.polarity = active_high_low;
entry.trigger = triggering;
entry.polarity = polarity;
entry.mask = 1; /* Disabled (masked) */

irq = gsi_irq_sharing(irq);
Expand All @@ -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 -> "
"IRQ %d Mode:%i Active:%i)\n", ioapic,
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))
disable_8259A_irq(irq);
Expand Down
8 changes: 4 additions & 4 deletions arch/x86_64/kernel/mpparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void)

#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_pin = 0;
Expand Down Expand Up @@ -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);

if (edge_level) {
if (triggering) {
/*
* For PCI devices assign IRQs in order, avoiding gaps
* due to unused I/O APIC pins.
Expand All @@ -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,
edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1,
active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1);
triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
return gsi;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
address64.attribute.memory.cache_attribute;
mem_device->read_write_attribute =
address64.attribute.memory.read_write_attribute;
mem_device->start_addr = address64.min_address_range;
mem_device->end_addr = address64.max_address_range;
mem_device->start_addr = address64.minimum;
mem_device->end_addr = address64.maximum;
}
}

Expand Down
12 changes: 6 additions & 6 deletions drivers/acpi/dispatcher/dsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,

if (!op) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
return_VALUE(TRUE);
return_UINT8(TRUE);
}

/*
Expand Down Expand Up @@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
"At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name(op->common.
aml_opcode)));
return_VALUE(FALSE);
return_UINT8(FALSE);
}

/* Get info on the parent. The root_op is AML_SCOPE */
Expand All @@ -218,7 +218,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown parent opcode. Op=%p\n", op));
return_VALUE(FALSE);
return_UINT8(FALSE);
}

/*
Expand Down Expand Up @@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));

return_VALUE(TRUE);
return_UINT8(TRUE);

result_not_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
Expand All @@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));

return_VALUE(FALSE);
return_UINT8(FALSE);
}

/*******************************************************************************
Expand Down Expand Up @@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,

if (op_info->flags & AML_HAS_RETVAL) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Argument previously created, already stacked \n"));
"Argument previously created, already stacked\n"));

ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
(walk_state->
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
union acpi_ec *ec = (union acpi_ec *)context;
struct acpi_generic_address *addr;

if (resource->type != ACPI_RSTYPE_IO) {
if (resource->type != ACPI_RESOURCE_TYPE_IO) {
return AE_OK;
}

Expand All @@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
addr->register_bit_width = 8;
addr->register_bit_offset = 0;
addr->address = resource->data.io.min_base_address;
addr->address = resource->data.io.minimum;

return AE_OK;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/acpi/events/evgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}

Expand Down Expand Up @@ -638,7 +638,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}
break;
Expand All @@ -652,7 +652,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}

/*
Expand Down Expand Up @@ -680,12 +680,12 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
break;
}

return_VALUE(ACPI_INTERRUPT_HANDLED);
return_UINT32(ACPI_INTERRUPT_HANDLED);
}

#ifdef ACPI_GPE_NOTIFY_CHECK
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/events/evsci.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
*/
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);

return_VALUE(interrupt_handled);
return_UINT32(interrupt_handled);
}

/*******************************************************************************
Expand Down Expand Up @@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
*/
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);

return_VALUE(interrupt_handled);
return_UINT32(interrupt_handled);
}

/******************************************************************************
Expand Down
10 changes: 5 additions & 5 deletions drivers/acpi/executer/exdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)

case ACPI_TYPE_BUFFER:

acpi_os_printf("Buffer len %X @ %p \n",
acpi_os_printf("Buffer len %X @ %p\n",
obj_desc->buffer.length,
obj_desc->buffer.pointer);

Expand Down Expand Up @@ -320,17 +320,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)

case ACPI_TYPE_BUFFER_FIELD:

acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n",
acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n",
obj_desc->buffer_field.bit_length,
obj_desc->buffer_field.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset);

if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n"));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
} else
if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
!= ACPI_TYPE_BUFFER) {
acpi_os_printf("*not a Buffer* \n");
acpi_os_printf("*not a Buffer*\n");
} else {
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
depth + 1);
Expand Down Expand Up @@ -618,7 +618,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)

case ACPI_TYPE_PACKAGE:

acpi_os_printf("[Package] Contains %d Elements: \n",
acpi_os_printf("[Package] Contains %d Elements:\n",
obj_desc->package.count);

for (i = 0; i < obj_desc->package.count; i++) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/executer/exnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
if (name_string) {
ACPI_STRCAT(name_string, char_buf);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Appended to - %s \n", name_string));
"Appended to - %s\n", name_string));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"No Name string - %s \n", char_buf));
"No Name string - %s\n", char_buf));
}
} else if (index == 0) {
/*
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/executer/exprep.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,

ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown field access type %X\n", access));
return_VALUE(0);
return_UINT32(0);
}

if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
Expand All @@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
}

*return_byte_alignment = byte_alignment;
return_VALUE(bit_length);
return_UINT32(bit_length);
}

/*******************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/executer/exresop.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode,
}

ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Opcode %X [%s] required_operand_types=%8.8X \n",
"Opcode %X [%s] required_operand_types=%8.8X\n",
opcode, op_info->name, arg_types));

/*
Expand Down
6 changes: 3 additions & 3 deletions drivers/acpi/executer/exutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
}
}

return_VALUE(locked);
return_UINT8(locked);
}

/*******************************************************************************
Expand Down Expand Up @@ -268,7 +268,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
/* acpi_integer is unsigned, so we don't worry about a '-' prefix */

if (value == 0) {
return_VALUE(1);
return_UINT32(1);
}

current_value = value;
Expand All @@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
num_digits++;
}

return_VALUE(num_digits);
return_UINT32(num_digits);
}

/*******************************************************************************
Expand Down
Loading

0 comments on commit 50eca3e

Please sign in to comment.