From bda663d36b94c723153246a4231bbc0f1cd1836e Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 16 Sep 2005 16:51:15 -0400 Subject: [ACPI] ACPICA 20050916 Fixed a problem within the Resource Manager where support for the Generic Register descriptor was not fully implemented. This descriptor is now fully recognized, parsed, disassembled, and displayed. Restructured the Resource Manager code to utilize table-driven dispatch and lookup, eliminating many of the large switch() statements. This reduces overall subsystem code size and code complexity. Affects the resource parsing and construction, disassembly, and debug dump output. Cleaned up and restructured the debug dump output for all resource descriptors. Improved readability of the output and reduced code size. Fixed a problem where changes to internal data structures caused the optional ACPI_MUTEX_DEBUG code to fail compilation if specified. Signed-off-by: Robert Moore Signed-off-by: Len Brown --- drivers/acpi/resources/rsirq.c | 57 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'drivers/acpi/resources/rsirq.c') diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 56043fee96cb..75df962115cc 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -88,7 +88,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, */ temp8 = *buffer; *bytes_consumed = (temp8 & 0x03) + 1; - output_struct->id = ACPI_RSTYPE_IRQ; + output_struct->type = ACPI_RSTYPE_IRQ; /* Point to the 16-bits of Bytes 1 and 2 */ @@ -177,7 +177,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_irq_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -190,7 +190,7 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_irq_stream(struct acpi_resource *linked_list, +acpi_rs_irq_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -205,13 +205,13 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list, * The descriptor field is set based upon whether a third byte is * needed to contain the IRQ Information. */ - if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level && - ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && - ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { - *buffer = 0x22; + if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level && + ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low && + ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) { + *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02; IRqinfo_byte_needed = FALSE; } else { - *buffer = 0x23; + *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03; IRqinfo_byte_needed = TRUE; } @@ -221,8 +221,8 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list, /* Loop through all of the interrupts and set the mask bits */ for (index = 0; - index < linked_list->data.irq.number_of_interrupts; index++) { - temp8 = (u8) linked_list->data.irq.interrupts[index]; + index < resource->data.irq.number_of_interrupts; index++) { + temp8 = (u8) resource->data.irq.interrupts[index]; temp16 |= 0x1 << temp8; } @@ -233,11 +233,11 @@ acpi_rs_irq_stream(struct acpi_resource *linked_list, if (IRqinfo_byte_needed) { temp8 = 0; - temp8 = (u8) ((linked_list->data.irq.shared_exclusive & + temp8 = (u8) ((resource->data.irq.shared_exclusive & 0x01) << 4); - if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && - ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { + if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level && + ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) { temp8 |= 0x08; } else { temp8 |= 0x01; @@ -302,7 +302,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, } *bytes_consumed = temp16 + 3; - output_struct->id = ACPI_RSTYPE_EXT_IRQ; + output_struct->type = ACPI_RSTYPE_EXT_IRQ; /* Point to the Byte3 */ @@ -441,7 +441,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, * * FUNCTION: acpi_rs_extended_irq_stream * - * PARAMETERS: linked_list - Pointer to the resource linked list + * PARAMETERS: Resource - Pointer to the resource linked list * output_buffer - Pointer to the user's return buffer * bytes_consumed - Pointer to where the number of bytes * used in the output_buffer is returned @@ -454,7 +454,7 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, +acpi_rs_extended_irq_stream(struct acpi_resource *resource, u8 ** output_buffer, acpi_size * bytes_consumed) { u8 *buffer = *output_buffer; @@ -476,9 +476,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, /* Set the Interrupt vector flags */ - temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01); - temp8 |= - ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); + temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01); + temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3); /* * Set the Interrupt Mode @@ -489,44 +488,44 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, * * - Edge/Level are defined opposite in the table vs the headers */ - if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) { + if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) { temp8 |= 0x2; } /* Set the Interrupt Polarity */ - temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); + temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2); *buffer = temp8; buffer += 1; /* Set the Interrupt table length */ - temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; + temp8 = (u8) resource->data.extended_irq.number_of_interrupts; *buffer = temp8; buffer += 1; for (index = 0; - index < linked_list->data.extended_irq.number_of_interrupts; + index < resource->data.extended_irq.number_of_interrupts; index++) { ACPI_MOVE_32_TO_32(buffer, - &linked_list->data.extended_irq. + &resource->data.extended_irq. interrupts[index]); buffer += 4; } /* Resource Source Index and Resource Source are optional */ - if (0 != linked_list->data.extended_irq.resource_source.string_length) { + if (0 != resource->data.extended_irq.resource_source.string_length) { *buffer = - (u8) linked_list->data.extended_irq.resource_source.index; + (u8) resource->data.extended_irq.resource_source.index; buffer += 1; /* Copy the string */ ACPI_STRCPY((char *)buffer, - linked_list->data.extended_irq.resource_source. + resource->data.extended_irq.resource_source. string_ptr); /* @@ -535,8 +534,8 @@ acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, */ buffer += (acpi_size) (ACPI_STRLEN - (linked_list->data.extended_irq. - resource_source.string_ptr) + 1); + (resource->data.extended_irq.resource_source. + string_ptr) + 1); } /* Return the number of bytes consumed in this operation */ -- cgit v1.2.3 From 50eca3eb89d73d9f0aa070b126c7ee6a616016ab Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 30 Sep 2005 19:03:00 -0400 Subject: [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: Bob Moore Signed-off-by: Len Brown --- arch/ia64/kernel/acpi-ext.c | 22 +- arch/ia64/pci/pci.c | 8 +- arch/x86_64/kernel/io_apic.c | 10 +- arch/x86_64/kernel/mpparse.c | 8 +- drivers/acpi/acpi_memhotplug.c | 4 +- drivers/acpi/dispatcher/dsutils.c | 12 +- drivers/acpi/ec.c | 4 +- drivers/acpi/events/evgpe.c | 10 +- drivers/acpi/events/evsci.c | 4 +- drivers/acpi/executer/exdump.c | 10 +- drivers/acpi/executer/exnames.c | 4 +- drivers/acpi/executer/exprep.c | 4 +- drivers/acpi/executer/exresop.c | 2 +- drivers/acpi/executer/exutils.c | 6 +- drivers/acpi/glue.c | 8 +- drivers/acpi/hardware/hwacpi.c | 8 +- drivers/acpi/motherboard.c | 30 +- drivers/acpi/namespace/nsaccess.c | 2 +- drivers/acpi/namespace/nsnames.c | 2 +- drivers/acpi/namespace/nsutils.c | 12 +- drivers/acpi/parser/psargs.c | 2 +- drivers/acpi/parser/psxface.c | 142 +++++ drivers/acpi/pci_irq.c | 48 +- drivers/acpi/pci_link.c | 92 +-- drivers/acpi/pci_root.c | 8 +- drivers/acpi/resources/Makefile | 2 +- drivers/acpi/resources/rsaddr.c | 1132 ++++++++++++------------------------- drivers/acpi/resources/rscalc.c | 282 +++------ drivers/acpi/resources/rscreate.c | 59 +- drivers/acpi/resources/rsdump.c | 313 +++++----- drivers/acpi/resources/rsinfo.c | 2 +- drivers/acpi/resources/rsio.c | 451 +++++---------- drivers/acpi/resources/rsirq.c | 494 ++++++---------- drivers/acpi/resources/rslist.c | 290 +++++----- drivers/acpi/resources/rsmemory.c | 472 +++++----------- drivers/acpi/resources/rsmisc.c | 711 ++++++++--------------- drivers/acpi/resources/rsutils.c | 437 +++++++++++++- drivers/acpi/resources/rsxface.c | 14 +- drivers/acpi/tables/tbrsdt.c | 2 +- drivers/acpi/tables/tbxfroot.c | 2 +- drivers/acpi/utilities/utalloc.c | 6 +- drivers/acpi/utilities/utglobal.c | 3 + drivers/acpi/utilities/utmisc.c | 6 +- drivers/char/hpet.c | 26 +- drivers/pnp/pnpacpi/rsparser.c | 364 ++++++------ drivers/serial/8250_acpi.c | 22 +- include/acpi/acconfig.h | 2 +- include/acpi/acdisasm.h | 40 +- include/acpi/acglobal.h | 9 + include/acpi/aclocal.h | 79 ++- include/acpi/acmacros.h | 58 +- include/acpi/acpi_drivers.h | 4 +- include/acpi/acpixf.h | 3 + include/acpi/acresrc.h | 313 ++++++---- include/acpi/actypes.h | 152 ++--- include/acpi/amlresrc.h | 242 ++++---- include/asm-x86_64/mpspec.h | 2 +- include/linux/acpi.h | 2 +- 58 files changed, 2949 insertions(+), 3509 deletions(-) (limited to 'drivers/acpi/resources/rsirq.c') diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c index a146016d7ad7..4a5574ff007b 100644 --- a/arch/ia64/kernel/acpi-ext.c +++ b/arch/ia64/kernel/acpi-ext.c @@ -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; @@ -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; } diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 20d76fae24e8..25f923d050e3 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -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; @@ -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; @@ -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; diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 97154ab058b4..619767d3ea2b 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c @@ -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; @@ -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); @@ -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); diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 1105250bf02c..ba817e7454b2 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c @@ -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; @@ -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<read_write_attribute = address64.attribute.memory.read_write_attribute; - mem_device->start_addr = address64.min_address_range; - mem_device->end_addr = address64.max_address_range; + mem_device->start_addr = address64.minimum; + mem_device->end_addr = address64.maximum; } } diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 83ae1c1aa286..2cc53da5c0bd 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, if (!op) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); - return_VALUE(TRUE); + return_UINT8(TRUE); } /* @@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, "At Method level, result of [%s] not used\n", acpi_ps_get_opcode_name(op->common. aml_opcode))); - return_VALUE(FALSE); + return_UINT8(FALSE); } /* Get info on the parent. The root_op is AML_SCOPE */ @@ -218,7 +218,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, if (parent_info->class == AML_CLASS_UNKNOWN) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); - return_VALUE(FALSE); + return_UINT8(FALSE); } /* @@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, acpi_ps_get_opcode_name(op->common.parent->common. aml_opcode), op)); - return_VALUE(TRUE); + return_UINT8(TRUE); result_not_used: ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, @@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, acpi_ps_get_opcode_name(op->common.parent->common. aml_opcode), op)); - return_VALUE(FALSE); + return_UINT8(FALSE); } /******************************************************************************* @@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, if (op_info->flags & AML_HAS_RETVAL) { ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "Argument previously created, already stacked \n")); + "Argument previously created, already stacked\n")); ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object (walk_state-> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index c33bfba5df8f..0ecbfa5db1ba 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) union acpi_ec *ec = (union acpi_ec *)context; struct acpi_generic_address *addr; - if (resource->type != ACPI_RSTYPE_IO) { + if (resource->type != ACPI_RESOURCE_TYPE_IO) { return AE_OK; } @@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; addr->register_bit_width = 8; addr->register_bit_offset = 0; - addr->address = resource->data.io.min_base_address; + addr->address = resource->data.io.minimum; return AE_OK; } diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index b2f232df13d8..f51c3b16c608 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -600,7 +600,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -638,7 +638,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } break; @@ -652,7 +652,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } /* @@ -680,12 +680,12 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } break; } - return_VALUE(ACPI_INTERRUPT_HANDLED); + return_UINT32(ACPI_INTERRUPT_HANDLED); } #ifdef ACPI_GPE_NOTIFY_CHECK diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 141835977002..e2c0b48a7e9f 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c @@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) */ interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); - return_VALUE(interrupt_handled); + return_UINT32(interrupt_handled); } /******************************************************************************* @@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) */ interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); - return_VALUE(interrupt_handled); + return_UINT32(interrupt_handled); } /****************************************************************************** diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index bc2fa996047e..4477a62fed56 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -214,7 +214,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case ACPI_TYPE_BUFFER: - acpi_os_printf("Buffer len %X @ %p \n", + acpi_os_printf("Buffer len %X @ %p\n", obj_desc->buffer.length, obj_desc->buffer.pointer); @@ -320,17 +320,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case ACPI_TYPE_BUFFER_FIELD: - acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n", + acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, obj_desc->buffer_field.start_field_bit_offset); if (!obj_desc->buffer_field.buffer_obj) { - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n")); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n")); } else if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { - acpi_os_printf("*not a Buffer* \n"); + acpi_os_printf("*not a Buffer*\n"); } else { acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, depth + 1); @@ -618,7 +618,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) case ACPI_TYPE_PACKAGE: - acpi_os_printf("[Package] Contains %d Elements: \n", + acpi_os_printf("[Package] Contains %d Elements:\n", obj_desc->package.count); for (i = 0; i < obj_desc->package.count; i++) { diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 239d8473e9a5..dff41121a304 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) if (name_string) { ACPI_STRCAT(name_string, char_buf); ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "Appended to - %s \n", name_string)); + "Appended to - %s\n", name_string)); } else { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "No Name string - %s \n", char_buf)); + "No Name string - %s\n", char_buf)); } } else if (index == 0) { /* diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 7476c363e407..88ccbf3b29d0 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c @@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown field access type %X\n", access)); - return_VALUE(0); + return_UINT32(0); } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { @@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, } *return_byte_alignment = byte_alignment; - return_VALUE(bit_length); + return_UINT32(bit_length); } /******************************************************************************* diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index ff064e79ab90..b04e4a3707a1 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode, } ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Opcode %X [%s] required_operand_types=%8.8X \n", + "Opcode %X [%s] required_operand_types=%8.8X\n", opcode, op_info->name, arg_types)); /* diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 1ee79d8c8f88..9f4e547d7734 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -206,7 +206,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) } } - return_VALUE(locked); + return_UINT8(locked); } /******************************************************************************* @@ -268,7 +268,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ if (value == 0) { - return_VALUE(1); + return_UINT32(1); } current_value = value; @@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) num_digits++; } - return_VALUE(num_digits); + return_UINT32(num_digits); } /******************************************************************************* diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index fcb881db5b0b..8daef57b994c 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -99,15 +99,15 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) unsigned long *busnr = (unsigned long *)data; struct acpi_resource_address64 address; - if (resource->type != ACPI_RSTYPE_ADDRESS16 && - resource->type != ACPI_RSTYPE_ADDRESS32 && - resource->type != ACPI_RSTYPE_ADDRESS64) + if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); if ((address.address_length > 0) && (address.resource_type == ACPI_BUS_NUMBER_RANGE)) - *busnr = address.min_address_range; + *busnr = address.minimum; return AE_OK; } diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 1bb3463d7040..20a335cc9bea 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -204,18 +204,18 @@ u32 acpi_hw_get_mode(void) * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - return_VALUE(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_ACPI); } status = acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); if (ACPI_FAILURE(status)) { - return_VALUE(ACPI_SYS_MODE_LEGACY); + return_UINT32(ACPI_SYS_MODE_LEGACY); } if (value) { - return_VALUE(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_ACPI); } else { - return_VALUE(ACPI_SYS_MODE_LEGACY); + return_UINT32(ACPI_SYS_MODE_LEGACY); } } diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index 85c1fb5c9a5a..468244147ec1 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c @@ -54,36 +54,36 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); - if (res->type == ACPI_RSTYPE_IO) { + if (res->type == ACPI_RESOURCE_TYPE_IO) { struct acpi_resource_io *io_res = &res->data.io; - if (io_res->min_base_address != io_res->max_base_address) + if (io_res->minimum != io_res->maximum) return_VALUE(AE_OK); if (IS_RESERVED_ADDR - (io_res->min_base_address, io_res->range_length)) { + (io_res->minimum, io_res->address_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - io_res->min_base_address, - io_res->min_base_address + - io_res->range_length)); + io_res->minimum, + io_res->minimum + + io_res->address_length)); requested_res = - request_region(io_res->min_base_address, - io_res->range_length, "motherboard"); + request_region(io_res->minimum, + io_res->address_length, "motherboard"); } - } else if (res->type == ACPI_RSTYPE_FIXED_IO) { + } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) { struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io; if (IS_RESERVED_ADDR - (fixed_io_res->base_address, fixed_io_res->range_length)) { + (fixed_io_res->address, fixed_io_res->address_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - fixed_io_res->base_address, - fixed_io_res->base_address + - fixed_io_res->range_length)); + fixed_io_res->address, + fixed_io_res->address + + fixed_io_res->address_length)); requested_res = - request_region(fixed_io_res->base_address, - fixed_io_res->range_length, + request_region(fixed_io_res->address, + fixed_io_res->address_length, "motherboard"); } } else { diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index edfbe34600f5..6923059ba3c7 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -498,7 +498,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, path++; ACPI_DEBUG_PRINT((ACPI_DB_NAMES, - "Multi Pathname (%d Segments, Flags=%X) \n", + "Multi Pathname (%d Segments, Flags=%X)\n", num_segments, flags)); break; diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index d5e8dea61c27..5400728eb791 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, acpi_ns_build_external_path(node, required_size, buffer->pointer); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n", (char *)buffer->pointer, (u32) required_size)); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index ebec036423c9..549075fb9f88 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -249,10 +249,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) if (!node) { ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); - return_VALUE(ACPI_TYPE_ANY); + return_UINT32(ACPI_TYPE_ANY); } - return_VALUE((acpi_object_type) node->type); + return_UINT32((acpi_object_type) node->type); } /******************************************************************************* @@ -276,10 +276,10 @@ u32 acpi_ns_local(acpi_object_type type) /* Type code out of range */ ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); - return_VALUE(ACPI_NS_NORMAL); + return_UINT32(ACPI_NS_NORMAL); } - return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); + return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); } /******************************************************************************* @@ -805,10 +805,10 @@ u32 acpi_ns_opens_scope(acpi_object_type type) ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", type)); - return_VALUE(ACPI_NS_NORMAL); + return_UINT32(ACPI_NS_NORMAL); } - return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); + return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); } /******************************************************************************* diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 5858188f94a6..562d0f822ab1 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -116,7 +116,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) break; } - return_VALUE(length); + return_UINT32(length); } /******************************************************************************* diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 4dcbd443160e..4c426f4c6af6 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -50,11 +50,145 @@ ACPI_MODULE_NAME("psxface") /* Local Prototypes */ +static void acpi_ps_start_trace(struct acpi_parameter_info *info); + +static void acpi_ps_stop_trace(struct acpi_parameter_info *info); + static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); static void 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 @@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) */ acpi_ps_update_parameter_list(info, REF_INCREMENT); + /* Begin tracing if requested */ + + acpi_ps_start_trace(info); + /* * 1) Perform the first pass parse of the method to enter any * named objects that it creates into the namespace @@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) status = acpi_ps_execute_pass(info); cleanup: + /* End optional tracing */ + + acpi_ps_stop_trace(info); + /* Take away the extra reference that we gave the parameters above */ acpi_ps_update_parameter_list(info, REF_DECREMENT); diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 09567c2edcfb..726dda1fce1c 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -258,7 +258,7 @@ typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **); static int acpi_pci_allocate_irq(struct acpi_prt_entry *entry, - int *edge_level, int *active_high_low, char **link) + int *triggering, int *polarity, char **link) { int irq; @@ -266,8 +266,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, if (entry->link.handle) { irq = acpi_pci_link_allocate_irq(entry->link.handle, - entry->link.index, edge_level, - active_high_low, link); + entry->link.index, triggering, + polarity, link); if (irq < 0) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); @@ -275,8 +275,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, } } else { irq = entry->link.index; - *edge_level = ACPI_LEVEL_SENSITIVE; - *active_high_low = ACPI_ACTIVE_LOW; + *triggering = ACPI_LEVEL_SENSITIVE; + *polarity = ACPI_ACTIVE_LOW; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); @@ -285,7 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, static int acpi_pci_free_irq(struct acpi_prt_entry *entry, - int *edge_level, int *active_high_low, char **link) + int *triggering, int *polarity, char **link) { int irq; @@ -307,8 +307,8 @@ static int acpi_pci_irq_lookup(struct pci_bus *bus, int device, int pin, - int *edge_level, - int *active_high_low, char **link, irq_lookup_func func) + int *triggering, + int *polarity, char **link, irq_lookup_func func) { struct acpi_prt_entry *entry = NULL; int segment = pci_domain_nr(bus); @@ -327,7 +327,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus, return_VALUE(-1); } - ret = func(entry, edge_level, active_high_low, link); + ret = func(entry, triggering, polarity, link); return_VALUE(ret); } @@ -339,8 +339,8 @@ acpi_pci_irq_lookup(struct pci_bus *bus, static int acpi_pci_irq_derive(struct pci_dev *dev, int pin, - int *edge_level, - int *active_high_low, char **link, irq_lookup_func func) + int *triggering, + int *polarity, char **link, irq_lookup_func func) { struct pci_dev *bridge = dev; int irq = -1; @@ -375,7 +375,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, } irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), - pin, edge_level, active_high_low, + pin, triggering, polarity, link, func); } @@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) { int irq = 0; u8 pin = 0; - int edge_level = ACPI_LEVEL_SENSITIVE; - int active_high_low = ACPI_ACTIVE_LOW; + int triggering = ACPI_LEVEL_SENSITIVE; + int polarity = ACPI_ACTIVE_LOW; char *link = NULL; int rc; @@ -432,7 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) * values override any BIOS-assigned IRQs set during boot. */ irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, &link, + &triggering, &polarity, &link, acpi_pci_allocate_irq); /* @@ -440,8 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) * device's parent bridge. */ if (irq < 0) - irq = acpi_pci_irq_derive(dev, pin, &edge_level, - &active_high_low, &link, + irq = acpi_pci_irq_derive(dev, pin, &triggering, + &polarity, &link, acpi_pci_allocate_irq); /* @@ -463,7 +463,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) } } - rc = acpi_register_gsi(irq, edge_level, active_high_low); + rc = acpi_register_gsi(irq, triggering, polarity); if (rc < 0) { printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " "to register GSI\n", pci_name(dev), ('A' + pin)); @@ -478,8 +478,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) printk("Link [%s] -> ", link); printk("GSI %u (%s, %s) -> IRQ %d\n", irq, - (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", - (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); + (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", + (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); return_VALUE(0); } @@ -495,8 +495,8 @@ void acpi_pci_irq_disable(struct pci_dev *dev) { int gsi = 0; u8 pin = 0; - int edge_level = ACPI_LEVEL_SENSITIVE; - int active_high_low = ACPI_ACTIVE_LOW; + int triggering = ACPI_LEVEL_SENSITIVE; + int polarity = ACPI_ACTIVE_LOW; ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); @@ -512,7 +512,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) * First we check the PCI IRQ routing table (PRT) for an IRQ. */ gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, NULL, + &triggering, &polarity, NULL, acpi_pci_free_irq); /* * If no PRT entry was found, we'll try to derive an IRQ from the @@ -520,7 +520,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) */ if (gsi < 0) gsi = acpi_pci_irq_derive(dev, pin, - &edge_level, &active_high_low, NULL, + &triggering, &polarity, NULL, acpi_pci_free_irq); if (gsi < 0) return_VOID; diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index d8956c0bf143..492170373494 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = { */ struct acpi_pci_link_irq { u8 active; /* Current IRQ */ - u8 edge_level; /* All IRQs */ - u8 active_high_low; /* All IRQs */ + u8 triggering; /* All IRQs */ + u8 polarity; /* All IRQs */ u8 resource_type; u8 possible_count; u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; @@ -109,18 +109,18 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); switch (resource->type) { - case ACPI_RSTYPE_START_DPF: + case ACPI_RESOURCE_TYPE_START_DEPENDENT: return_ACPI_STATUS(AE_OK); - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank IRQ resource\n")); return_ACPI_STATUS(AE_OK); } for (i = 0; - (i < p->number_of_interrupts + (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, @@ -131,22 +131,22 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) link->irq.possible[i] = p->interrupts[i]; link->irq.possible_count++; } - link->irq.edge_level = p->edge_level; - link->irq.active_high_low = p->active_high_low; - link->irq.resource_type = ACPI_RSTYPE_IRQ; + link->irq.triggering = p->triggering; + link->irq.polarity = p->polarity; + link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ; break; } - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: { - struct acpi_resource_ext_irq *p = + struct acpi_resource_extended_irq *p = &resource->data.extended_irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank EXT IRQ resource\n")); return_ACPI_STATUS(AE_OK); } for (i = 0; - (i < p->number_of_interrupts + (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, @@ -157,9 +157,9 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) link->irq.possible[i] = p->interrupts[i]; link->irq.possible_count++; } - link->irq.edge_level = p->edge_level; - link->irq.active_high_low = p->active_high_low; - link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; + link->irq.triggering = p->triggering; + link->irq.polarity = p->polarity; + link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; break; } default: @@ -202,10 +202,10 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); switch (resource->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { /* * IRQ descriptors may have no IRQ# bits set, * particularly those those w/ _STA disabled @@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) *irq = p->interrupts[0]; break; } - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: { - struct acpi_resource_ext_irq *p = + struct acpi_resource_extended_irq *p = &resource->data.extended_irq; - if (!p || !p->number_of_interrupts) { + if (!p || !p->interrupt_count) { /* * extended IRQ descriptors must * return at least 1 IRQ @@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) buffer.pointer = resource; switch (link->irq.resource_type) { - case ACPI_RSTYPE_IRQ: - resource->res.type = ACPI_RSTYPE_IRQ; + case ACPI_RESOURCE_TYPE_IRQ: + resource->res.type = ACPI_RESOURCE_TYPE_IRQ; resource->res.length = sizeof(struct acpi_resource); - resource->res.data.irq.edge_level = link->irq.edge_level; - resource->res.data.irq.active_high_low = - link->irq.active_high_low; - if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource->res.data.irq.shared_exclusive = + resource->res.data.irq.triggering = link->irq.triggering; + resource->res.data.irq.polarity = + link->irq.polarity; + if (link->irq.triggering == ACPI_EDGE_SENSITIVE) + resource->res.data.irq.sharable = ACPI_EXCLUSIVE; else - resource->res.data.irq.shared_exclusive = ACPI_SHARED; - resource->res.data.irq.number_of_interrupts = 1; + resource->res.data.irq.sharable = ACPI_SHARED; + resource->res.data.irq.interrupt_count = 1; resource->res.data.irq.interrupts[0] = irq; break; - case ACPI_RSTYPE_EXT_IRQ: - resource->res.type = ACPI_RSTYPE_EXT_IRQ; + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; resource->res.length = sizeof(struct acpi_resource); resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER; - resource->res.data.extended_irq.edge_level = - link->irq.edge_level; - resource->res.data.extended_irq.active_high_low = - link->irq.active_high_low; - if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) - resource->res.data.irq.shared_exclusive = + resource->res.data.extended_irq.triggering = + link->irq.triggering; + resource->res.data.extended_irq.polarity = + link->irq.polarity; + if (link->irq.triggering == ACPI_EDGE_SENSITIVE) + resource->res.data.irq.sharable = ACPI_EXCLUSIVE; else - resource->res.data.irq.shared_exclusive = ACPI_SHARED; - resource->res.data.extended_irq.number_of_interrupts = 1; + resource->res.data.irq.sharable = ACPI_SHARED; + resource->res.data.extended_irq.interrupt_count = 1; resource->res.data.extended_irq.interrupts[0] = irq; /* ignore resource_source, it's optional */ break; @@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) goto end; } - resource->end.type = ACPI_RSTYPE_END_TAG; + resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; /* Attempt to set the resource */ status = acpi_set_current_resources(link->handle, &buffer); @@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) int acpi_pci_link_allocate_irq(acpi_handle handle, int index, - int *edge_level, int *active_high_low, char **name) + int *triggering, int *polarity, char **name) { int result = 0; struct acpi_device *device = NULL; @@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle, link->refcnt++; up(&acpi_link_lock); - if (edge_level) - *edge_level = link->irq.edge_level; - if (active_high_low) - *active_high_low = link->irq.active_high_low; + if (triggering) + *triggering = link->irq.triggering; + if (polarity) + *polarity = link->irq.polarity; if (name) *name = acpi_device_bid(link->device); ACPI_DEBUG_PRINT((ACPI_DB_INFO, diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 5d6bc815fe72..4c313eab6313 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -122,15 +122,15 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) int *busnr = (int *)data; struct acpi_resource_address64 address; - if (resource->type != ACPI_RSTYPE_ADDRESS16 && - resource->type != ACPI_RSTYPE_ADDRESS32 && - resource->type != ACPI_RSTYPE_ADDRESS64) + if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && + resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); if ((address.address_length > 0) && (address.resource_type == ACPI_BUS_NUMBER_RANGE)) - *busnr = address.min_address_range; + *busnr = address.minimum; return AE_OK; } diff --git a/drivers/acpi/resources/Makefile b/drivers/acpi/resources/Makefile index 2130b74170c3..8de4f69dfa09 100644 --- a/drivers/acpi/resources/Makefile +++ b/drivers/acpi/resources/Makefile @@ -2,7 +2,7 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := rsaddr.o rscreate.o rsio.o rslist.o rsmisc.o rsxface.o \ +obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ rscalc.o rsirq.o rsmemory.o rsutils.o obj-$(ACPI_FUTURE_USAGE) += rsdump.o diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 798778261fb9..6f48ebf3304e 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -58,12 +58,20 @@ acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); +static void +acpi_rs_set_address_common(union aml_resource *aml, + struct acpi_resource *resource); + +static u8 +acpi_rs_get_address_common(struct acpi_resource *resource, + union aml_resource *aml); + /******************************************************************************* * * FUNCTION: acpi_rs_decode_general_flags * * PARAMETERS: Resource - Address resource data struct - * Flags - Actual flag byte + * Flags - Raw AML flag byte * * RETURN: Decoded flag bits in resource struct * @@ -107,27 +115,19 @@ acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) { - u8 flags; - ACPI_FUNCTION_ENTRY(); - /* Producer / Consumer - flag bit[0] */ - - flags = (u8) (resource->address.producer_consumer & 0x01); - - /* Decode (_DEC) - flag bit[1] */ - - flags |= (u8) ((resource->address.decode & 0x01) << 1); - - /* Min Address Fixed (_MIF) - flag bit[2] */ - - flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2); - - /* Max Address Fixed (_MAF) - flag bit[3] */ - - flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3); - - return (flags); + return ((u8) + + /* Producer / Consumer - flag bit[0] */ + ((resource->address.producer_consumer & 0x01) | + /* Decode (_DEC) - flag bit[1] */ + ((resource->address.decode & 0x01) << 1) | + /* Min Address Fixed (_MIF) - flag bit[2] */ + ((resource->address.min_address_fixed & 0x01) << 2) | + /* Max Address Fixed (_MAF) - flag bit[3] */ + ((resource->address.max_address_fixed & 0x01) << 3)) + ); } /******************************************************************************* @@ -135,7 +135,7 @@ static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) * FUNCTION: acpi_rs_decode_specific_flags * * PARAMETERS: Resource - Address resource data struct - * Flags - Actual flag byte + * Flags - Raw AML flag byte * * RETURN: Decoded flag bits in attribute struct * @@ -189,921 +189,541 @@ acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) { - u8 flags = 0; - ACPI_FUNCTION_ENTRY(); if (resource->address.resource_type == ACPI_MEMORY_RANGE) { - /* Write Status (_RW) - flag bit[0] */ - - flags = (u8) - (resource->address.attribute.memory. - read_write_attribute & 0x01); - - /* Memory Attributes (_MEM) - flag bits[2:1] */ - - flags |= (u8) - ((resource->address.attribute.memory. - cache_attribute & 0x03) << 1); + return ((u8) + + /* Write Status (_RW) - flag bit[0] */ + ((resource->address.attribute.memory. + read_write_attribute & 0x01) | + /* Memory Attributes (_MEM) - flag bits[2:1] */ + ((resource->address.attribute.memory. + cache_attribute & 0x03) << 1))); } else if (resource->address.resource_type == ACPI_IO_RANGE) { - /* Ranges (_RNG) - flag bits[1:0] */ - - flags = (u8) - (resource->address.attribute.io.range_attribute & 0x03); - - /* Translations (_TTP and _TRS) - flag bits[5:4] */ - - flags |= (u8) - ((resource->address.attribute.io. - translation_attribute & 0x03) << 4); + return ((u8) + + /* Ranges (_RNG) - flag bits[1:0] */ + ((resource->address.attribute.io. + range_attribute & 0x03) | + /* Translations (_TTP and _TRS) - flag bits[5:4] */ + ((resource->address.attribute.io. + translation_attribute & 0x03) << 4))); } - return (flags); + return (0); } /******************************************************************************* * - * FUNCTION: acpi_rs_address16_resource + * FUNCTION: acpi_rs_set_address_common * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * Resource - Pointer to the internal resource struct * - * RETURN: Status + * RETURN: None * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert common flag fields from a resource descriptor to an + * AML descriptor * ******************************************************************************/ -acpi_status -acpi_rs_address16_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +static void +acpi_rs_set_address_common(union aml_resource *aml, + struct acpi_resource *resource) { - u32 index; - u16 temp16; - u8 temp8; - u8 *temp_ptr; - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16); + ACPI_FUNCTION_ENTRY(); - ACPI_FUNCTION_TRACE("rs_address16_resource"); + /* Set the Resource Type (Memory, Io, bus_number, etc.) */ - /* Get the Descriptor Length field */ + aml->address.resource_type = (u8) resource->data.address.resource_type; - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + /* Set the general flags */ - /* Validate minimum descriptor length */ + aml->address.flags = acpi_rs_encode_general_flags(&resource->data); - if (temp16 < 13) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } + /* Set the type-specific flags */ - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_ADDRESS16; + aml->address.specific_flags = + acpi_rs_encode_specific_flags(&resource->data); +} - /* Get the Resource Type (Byte3) */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_address_common + * + * PARAMETERS: Resource - Pointer to the internal resource struct + * Aml - Pointer to the AML resource descriptor + * + * RETURN: TRUE if the resource_type field is OK, FALSE otherwise + * + * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor + * to an internal resource descriptor + * + ******************************************************************************/ - buffer += 2; - temp8 = *buffer; +static u8 +acpi_rs_get_address_common(struct acpi_resource *resource, + union aml_resource *aml) +{ + ACPI_FUNCTION_ENTRY(); - /* Values 0-2 and 0xC0-0xFF are valid */ + /* Validate resource type */ - if ((temp8 > 2) && (temp8 < 0xC0)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + if ((aml->address.resource_type > 2) + && (aml->address.resource_type < 0xC0)) { + return (FALSE); } - output_struct->data.address16.resource_type = temp8; - - /* Get the General Flags (Byte4) */ - - buffer += 1; - acpi_rs_decode_general_flags(&output_struct->data, *buffer); - - /* Get the Type Specific Flags (Byte5) */ - - buffer += 1; - acpi_rs_decode_specific_flags(&output_struct->data, *buffer); - - /* Get Granularity (Bytes 6-7) */ - - buffer += 1; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer); + /* Get the Resource Type (Memory, Io, bus_number, etc.) */ - /* Get min_address_range (Bytes 8-9) */ + resource->data.address.resource_type = aml->address.resource_type; - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range, - buffer); + /* Get the General Flags */ - /* Get max_address_range (Bytes 10-11) */ + acpi_rs_decode_general_flags(&resource->data, aml->address.flags); - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range, - buffer); + /* Get the Type-Specific Flags */ - /* Get address_translation_offset (Bytes 12-13) */ - - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16. - address_translation_offset, buffer); + acpi_rs_decode_specific_flags(&resource->data, + aml->address.specific_flags); + return (TRUE); +} - /* Get address_length (Bytes 14-15) */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_address16 + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. + * + ******************************************************************************/ - buffer += 2; - ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length, - buffer); +acpi_status +acpi_rs_get_address16(union aml_resource * aml, + u16 aml_resource_length, struct acpi_resource * resource) +{ + ACPI_FUNCTION_TRACE("rs_get_address16"); - /* Resource Source Index (if present) */ + /* Get the Resource Type, general flags, and type-specific flags */ - buffer += 2; + if (!acpi_rs_get_address_common(resource, aml)) { + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + } /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length */ - if (*bytes_consumed > (16 + 1)) { - /* Dereference the Index */ - - output_struct->data.address16.resource_source.index = - (u32) * buffer; - - /* Point to the String */ + acpi_rs_move_data(&resource->data.address16.granularity, + &aml->address16.granularity, 5, + ACPI_MOVE_TYPE_16_TO_32); - buffer += 1; + /* Get the optional resource_source (index and string) */ - /* Point the String pointer to the end of this structure */ + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + + acpi_rs_get_resource_source(aml_resource_length, + sizeof(struct aml_resource_address16), + &resource->data.address16. + resource_source, aml, NULL); - output_struct->data.address16.resource_source.string_ptr = - (char *)((u8 *) output_struct + struct_size); + /* Complete the resource header */ - temp_ptr = (u8 *) - output_struct->data.address16.resource_source.string_ptr; - - /* Copy the resource_source string into the buffer */ - - index = 0; - while (*buffer) { - *temp_ptr = *buffer; - - temp_ptr++; - buffer++; - index++; - } - - /* Add the terminating null and set the string length */ - - *temp_ptr = 0; - output_struct->data.address16.resource_source.string_length = - index + 1; - - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } else { - output_struct->data.address16.resource_source.index = 0; - output_struct->data.address16.resource_source.string_length = 0; - output_struct->data.address16.resource_source.string_ptr = NULL; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_ADDRESS16; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address16_stream + * FUNCTION: acpi_rs_set_address16 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_address16_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u8 *length_field; - acpi_size actual_bytes; - - ACPI_FUNCTION_TRACE("rs_address16_stream"); - - /* Set the Descriptor Type field */ + acpi_size descriptor_length; - *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; - buffer += 1; + ACPI_FUNCTION_TRACE("rs_set_address16"); - /* Save a pointer to the Length field - to be filled in later */ + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - length_field = buffer; - buffer += 2; - - /* Set the Resource Type (Memory, Io, bus_number) */ - - *buffer = (u8) (resource->data.address16.resource_type & 0x03); - buffer += 1; - - /* Set the general flags */ + acpi_rs_set_address_common(aml, resource); - *buffer = acpi_rs_encode_general_flags(&resource->data); - buffer += 1; - - /* Set the type specific flags */ - - *buffer = acpi_rs_encode_specific_flags(&resource->data); - buffer += 1; - - /* Set the address space granularity */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.granularity); - buffer += 2; - - /* Set the address range minimum */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.min_address_range); - buffer += 2; - - /* Set the address range maximum */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.max_address_range); - buffer += 2; - - /* Set the address translation offset */ - - ACPI_MOVE_32_TO_16(buffer, - &resource->data.address16. - address_translation_offset); - buffer += 2; - - /* Set the address length */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.address16.address_length); - buffer += 2; + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&aml->address16.granularity, + &resource->data.address16.granularity, 5, + ACPI_MOVE_TYPE_32_TO_16); /* Resource Source Index and Resource Source are optional */ - if (resource->data.address16.resource_source.string_length) { - *buffer = (u8) resource->data.address16.resource_source.index; - buffer += 1; + descriptor_length = acpi_rs_set_resource_source(aml, + sizeof(struct + aml_resource_address16), + &resource->data. + address16. + resource_source); - /* Copy the resource_source string */ + /* Complete the AML descriptor header */ - ACPI_STRCPY((char *)buffer, - resource->data.address16.resource_source. - string_ptr); - - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.address16.resource_source. - string_ptr) + 1); - } - - /* Return the number of bytes consumed in this operation */ - - actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer); - *bytes_consumed = actual_bytes; - - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - actual_bytes -= 3; - ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16, + descriptor_length, aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address32_resource + * FUNCTION: acpi_rs_get_address32 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_address32_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_address32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u16 temp16; - u8 temp8; - u8 *temp_ptr; - u32 index; - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); - - ACPI_FUNCTION_TRACE("rs_address32_resource"); - - /* Get the Descriptor Length field */ - - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - /* Validate minimum descriptor length */ + ACPI_FUNCTION_TRACE("rs_get_address32"); - if (temp16 < 23) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_ADDRESS32; - - /* Get the Resource Type (Byte3) */ - - buffer += 2; - temp8 = *buffer; + /* Get the Resource Type, general flags, and type-specific flags */ - /* Values 0-2 and 0xC0-0xFF are valid */ - - if ((temp8 > 2) && (temp8 < 0xC0)) { + if (!acpi_rs_get_address_common(resource, (void *)aml)) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - output_struct->data.address32.resource_type = temp8; - - /* Get the General Flags (Byte4) */ - - buffer += 1; - acpi_rs_decode_general_flags(&output_struct->data, *buffer); - - /* Get the Type Specific Flags (Byte5) */ - - buffer += 1; - acpi_rs_decode_specific_flags(&output_struct->data, *buffer); - - /* Get Granularity (Bytes 6-9) */ - - buffer += 1; - ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer); - - /* Get min_address_range (Bytes 10-13) */ - - buffer += 4; - ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range, - buffer); - - /* Get max_address_range (Bytes 14-17) */ - - buffer += 4; - ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range, - buffer); - - /* Get address_translation_offset (Bytes 18-21) */ - - buffer += 4; - ACPI_MOVE_32_TO_32(&output_struct->data.address32. - address_translation_offset, buffer); - - /* Get address_length (Bytes 22-25) */ - - buffer += 4; - ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length, - buffer); - - /* Resource Source Index (if present) */ - - buffer += 4; - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length */ - if (*bytes_consumed > (26 + 1)) { - /* Dereference the Index */ - - output_struct->data.address32.resource_source.index = - (u32) * buffer; - - /* Point to the String */ + acpi_rs_move_data(&resource->data.address32.granularity, + &aml->address32.granularity, 5, + ACPI_MOVE_TYPE_32_TO_32); - buffer += 1; + /* Get the optional resource_source (index and string) */ - /* Point the String pointer to the end of this structure */ + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + + acpi_rs_get_resource_source(aml_resource_length, + sizeof(struct aml_resource_address32), + &resource->data.address32. + resource_source, aml, NULL); - output_struct->data.address32.resource_source.string_ptr = - (char *)((u8 *) output_struct + struct_size); + /* Complete the resource header */ - temp_ptr = (u8 *) - output_struct->data.address32.resource_source.string_ptr; - - /* Copy the resource_source string into the buffer */ - - index = 0; - while (*buffer) { - *temp_ptr = *buffer; - - temp_ptr++; - buffer++; - index++; - } - - /* Add the terminating null and set the string length */ - - *temp_ptr = 0; - output_struct->data.address32.resource_source.string_length = - index + 1; - - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } else { - output_struct->data.address32.resource_source.index = 0; - output_struct->data.address32.resource_source.string_length = 0; - output_struct->data.address32.resource_source.string_ptr = NULL; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_ADDRESS32; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address32_stream + * FUNCTION: acpi_rs_set_address32 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_address32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer; - u16 *length_field; - - ACPI_FUNCTION_TRACE("rs_address32_stream"); - - buffer = *output_buffer; + acpi_size descriptor_length; - /* Set the Descriptor Type field */ + ACPI_FUNCTION_TRACE("rs_set_address32"); - *buffer = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE; - buffer += 1; + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - /* Save a pointer to the Length field - to be filled in later */ + acpi_rs_set_address_common(aml, resource); - length_field = ACPI_CAST_PTR(u16, buffer); - buffer += 2; - - /* Set the Resource Type (Memory, Io, bus_number) */ - - *buffer = (u8) (resource->data.address32.resource_type & 0x03); - buffer += 1; - - /* Set the general flags */ - - *buffer = acpi_rs_encode_general_flags(&resource->data); - buffer += 1; - - /* Set the type specific flags */ - - *buffer = acpi_rs_encode_specific_flags(&resource->data); - buffer += 1; - - /* Set the address space granularity */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.granularity); - buffer += 4; - - /* Set the address range minimum */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.min_address_range); - buffer += 4; - - /* Set the address range maximum */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.max_address_range); - buffer += 4; - - /* Set the address translation offset */ - - ACPI_MOVE_32_TO_32(buffer, - &resource->data.address32. - address_translation_offset); - buffer += 4; - - /* Set the address length */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.address32.address_length); - buffer += 4; + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&aml->address32.granularity, + &resource->data.address32.granularity, 5, + ACPI_MOVE_TYPE_32_TO_32); /* Resource Source Index and Resource Source are optional */ - if (resource->data.address32.resource_source.string_length) { - *buffer = (u8) resource->data.address32.resource_source.index; - buffer += 1; - - /* Copy the resource_source string */ + descriptor_length = acpi_rs_set_resource_source(aml, + sizeof(struct + aml_resource_address32), + &resource->data. + address32. + resource_source); - ACPI_STRCPY((char *)buffer, - resource->data.address32.resource_source. - string_ptr); + /* Complete the AML descriptor header */ - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.address32.resource_source. - string_ptr) + 1); - } - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); - - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - *length_field = (u16) (*bytes_consumed - 3); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32, + descriptor_length, aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address64_resource + * FUNCTION: acpi_rs_get_address64 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_address64_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_address64(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u16 temp16; - u8 temp8; - u8 resource_type; - u8 *temp_ptr; - u32 index; - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); - - ACPI_FUNCTION_TRACE("rs_address64_resource"); - - /* Get the Descriptor Type */ - - resource_type = *buffer; - - /* Get the Descriptor Length field */ - - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - /* Validate minimum descriptor length */ - - if (temp16 < 43) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_ADDRESS64; - - /* Get the Resource Type (Byte3) */ + ACPI_FUNCTION_TRACE("rs_get_address64"); - buffer += 2; - temp8 = *buffer; + /* Get the Resource Type, general Flags, and type-specific Flags */ - /* Values 0-2 and 0xC0-0xFF are valid */ - - if ((temp8 > 2) && (temp8 < 0xC0)) { + if (!acpi_rs_get_address_common(resource, aml)) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - output_struct->data.address64.resource_type = temp8; - - /* Get the General Flags (Byte4) */ - - buffer += 1; - acpi_rs_decode_general_flags(&output_struct->data, *buffer); - - /* Get the Type Specific Flags (Byte5) */ - - buffer += 1; - acpi_rs_decode_specific_flags(&output_struct->data, *buffer); - - if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { - /* Move past revision_id and Reserved byte */ - - buffer += 2; - } - - /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ - - buffer += 1; - ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer); - - /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ - - buffer += 8; - ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range, - buffer); - - /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ - - buffer += 8; - ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range, - buffer); - - /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ - - buffer += 8; - ACPI_MOVE_64_TO_64(&output_struct->data.address64. - address_translation_offset, buffer); + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&resource->data.address64.granularity, + &aml->address64.granularity, 5, + ACPI_MOVE_TYPE_64_TO_64); - /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ + /* Get the optional resource_source (index and string) */ - buffer += 8; - ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, - buffer); + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + + acpi_rs_get_resource_source(aml_resource_length, + sizeof(struct aml_resource_address64), + &resource->data.address64. + resource_source, aml, NULL); - output_struct->data.address64.resource_source.index = 0; - output_struct->data.address64.resource_source.string_length = 0; - output_struct->data.address64.resource_source.string_ptr = NULL; + /* Complete the resource header */ - if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { - /* Get type_specific_attribute (Bytes 48-55) */ + resource->type = ACPI_RESOURCE_TYPE_ADDRESS64; + return_ACPI_STATUS(AE_OK); +} - buffer += 8; - ACPI_MOVE_64_TO_64(&output_struct->data.address64. - type_specific_attributes, buffer); - } else { - output_struct->data.address64.type_specific_attributes = 0; +/******************************************************************************* + * + * FUNCTION: acpi_rs_set_address64 + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ - /* Resource Source Index (if present) */ +acpi_status +acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml) +{ + acpi_size descriptor_length; - buffer += 8; + ACPI_FUNCTION_TRACE("rs_set_address64"); - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. - */ - if (*bytes_consumed > (46 + 1)) { - /* Dereference the Index */ + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - output_struct->data.address64.resource_source.index = - (u32) * buffer; + acpi_rs_set_address_common(aml, resource); - /* Point to the String */ + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + acpi_rs_move_data(&aml->address64.granularity, + &resource->data.address64.granularity, 5, + ACPI_MOVE_TYPE_64_TO_64); - buffer += 1; + /* Resource Source Index and Resource Source are optional */ - /* Point the String pointer to the end of this structure */ + descriptor_length = acpi_rs_set_resource_source(aml, + sizeof(struct + aml_resource_address64), + &resource->data. + address64. + resource_source); - output_struct->data.address64.resource_source. - string_ptr = - (char *)((u8 *) output_struct + struct_size); + /* Complete the AML descriptor header */ - temp_ptr = (u8 *) - output_struct->data.address64.resource_source. - string_ptr; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64, + descriptor_length, aml); + return_ACPI_STATUS(AE_OK); +} - /* Copy the resource_source string into the buffer */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_ext_address64 + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. + * + ******************************************************************************/ - index = 0; - while (*buffer) { - *temp_ptr = *buffer; +acpi_status +acpi_rs_get_ext_address64(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource) +{ - temp_ptr++; - buffer++; - index++; - } + ACPI_FUNCTION_TRACE("rs_get_ext_address64"); - /* - * Add the terminating null and set the string length - */ - *temp_ptr = 0; - output_struct->data.address64.resource_source. - string_length = index + 1; + /* Get the Resource Type, general flags, and type-specific flags */ - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } + if (!acpi_rs_get_address_common(resource, aml)) { + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - /* Set the Length parameter */ + /* + * Get and validate the Revision ID + * Note: Only one revision ID is currently supported + */ + resource->data.ext_address64.revision_iD = + aml->ext_address64.revision_iD; + if (aml->ext_address64.revision_iD != + AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { + return_ACPI_STATUS(AE_SUPPORT); + } - output_struct->length = (u32) struct_size; + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + * Type-Specific Attribute + */ + acpi_rs_move_data(&resource->data.ext_address64.granularity, + &aml->ext_address64.granularity, 6, + ACPI_MOVE_TYPE_64_TO_64); - /* Return the final size of the structure */ + /* Complete the resource header */ - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_address64_stream + * FUNCTION: acpi_rs_set_ext_address64 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_address64_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_ext_address64(struct acpi_resource *resource, + union aml_resource *aml) { - u8 *buffer; - u16 *length_field; - - ACPI_FUNCTION_TRACE("rs_address64_stream"); - - buffer = *output_buffer; - - /* Set the Descriptor Type field */ - - *buffer = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE; - buffer += 1; - - /* Save a pointer to the Length field - to be filled in later */ - - length_field = ACPI_CAST_PTR(u16, buffer); - buffer += 2; - - /* Set the Resource Type (Memory, Io, bus_number) */ - - *buffer = (u8) (resource->data.address64.resource_type & 0x03); - buffer += 1; - - /* Set the general flags */ - - *buffer = acpi_rs_encode_general_flags(&resource->data); - buffer += 1; - - /* Set the type specific flags */ - - *buffer = acpi_rs_encode_specific_flags(&resource->data); - buffer += 1; - - /* Set the address space granularity */ + ACPI_FUNCTION_TRACE("rs_set_ext_address64"); - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.granularity); - buffer += 8; + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - /* Set the address range minimum */ + acpi_rs_set_address_common(aml, resource); - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.min_address_range); - buffer += 8; + /* Only one Revision ID is currently supported */ - /* Set the address range maximum */ - - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.max_address_range); - buffer += 8; - - /* Set the address translation offset */ - - ACPI_MOVE_64_TO_64(buffer, - &resource->data.address64. - address_translation_offset); - buffer += 8; - - /* Set the address length */ - - ACPI_MOVE_64_TO_64(buffer, &resource->data.address64.address_length); - buffer += 8; - - /* Resource Source Index and Resource Source are optional */ - - if (resource->data.address64.resource_source.string_length) { - *buffer = (u8) resource->data.address64.resource_source.index; - buffer += 1; - - /* Copy the resource_source string */ - - ACPI_STRCPY((char *)buffer, - resource->data.address64.resource_source. - string_ptr); - - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.address64.resource_source. - string_ptr) + 1); - } - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; + aml->ext_address64.reserved = 0; /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + * Type-Specific Attribute */ - *length_field = (u16) (*bytes_consumed - 3); + acpi_rs_move_data(&aml->ext_address64.granularity, + &resource->data.address64.granularity, 6, + ACPI_MOVE_TYPE_64_TO_64); + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, + sizeof(struct + aml_resource_extended_address64), + aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 2da7c6a8182e..d170dee07ce9 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -44,87 +44,14 @@ #include #include #include -#include #include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rscalc") -/* - * Base sizes for external resource descriptors, indexed by internal type. - * Includes size of the descriptor header (1 byte for small descriptors, - * 3 bytes for large descriptors) - */ -static u8 acpi_gbl_stream_sizes[] = { - 4, /* ACPI_RSTYPE_IRQ (Byte 3 is optional, but always created) */ - 3, /* ACPI_RSTYPE_DMA */ - 2, /* ACPI_RSTYPE_START_DPF (Byte 1 is optional, but always created) */ - 1, /* ACPI_RSTYPE_END_DPF */ - 8, /* ACPI_RSTYPE_IO */ - 4, /* ACPI_RSTYPE_FIXED_IO */ - 1, /* ACPI_RSTYPE_VENDOR */ - 2, /* ACPI_RSTYPE_END_TAG */ - 12, /* ACPI_RSTYPE_MEM24 */ - 20, /* ACPI_RSTYPE_MEM32 */ - 12, /* ACPI_RSTYPE_FIXED_MEM32 */ - 16, /* ACPI_RSTYPE_ADDRESS16 */ - 26, /* ACPI_RSTYPE_ADDRESS32 */ - 46, /* ACPI_RSTYPE_ADDRESS64 */ - 9, /* ACPI_RSTYPE_EXT_IRQ */ - 15 /* ACPI_RSTYPE_GENERIC_REG */ -}; - -/* - * Base sizes of resource descriptors, both the actual AML stream length and - * size of the internal struct representation. - */ -struct acpi_resource_sizes { - u8 minimum_stream_size; - u8 minimum_struct_size; -}; - -static struct acpi_resource_sizes acpi_gbl_sm_resource_sizes[] = { - {0, 0}, /* 0x00, Reserved */ - {0, 0}, /* 0x01, Reserved */ - {0, 0}, /* 0x02, Reserved */ - {0, 0}, /* 0x03, Reserved */ - {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, /* ACPI_RDESC_TYPE_IRQ_FORMAT */ - {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, /* ACPI_RDESC_TYPE_DMA_FORMAT */ - {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf)}, /* ACPI_RDESC_TYPE_START_DEPENDENT */ - {1, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_DEPENDENT */ - {8, ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, /* ACPI_RDESC_TYPE_IO_PORT */ - {4, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ - {0, 0}, /* 0x0A, Reserved */ - {0, 0}, /* 0x0B, Reserved */ - {0, 0}, /* 0x0C, Reserved */ - {0, 0}, /* 0x0D, Reserved */ - {1, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_SMALL_VENDOR */ - {2, ACPI_RESOURCE_LENGTH}, /* ACPI_RDESC_TYPE_END_TAG */ -}; - -static struct acpi_resource_sizes acpi_gbl_lg_resource_sizes[] = { - {0, 0}, /* 0x00, Reserved */ - {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24)}, /* ACPI_RDESC_TYPE_MEMORY_24 */ - {15, ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg)}, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ - {0, 0}, /* 0x03, Reserved */ - {3, ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, /* ACPI_RDESC_TYPE_LARGE_VENDOR */ - {20, ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32)}, /* ACPI_RDESC_TYPE_MEMORY_32 */ - {12, ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32)}, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ - {26, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ - {16, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ - {9, ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq)}, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ - {46, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ - {56, ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ -}; - /* Local prototypes */ - static u8 acpi_rs_count_set_bits(u16 bit_field); -static struct acpi_resource_sizes *acpi_rs_get_resource_sizes(u8 resource_type); - -static u16 acpi_rs_get_resource_length(u8 * resource); - static acpi_size acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); @@ -159,90 +86,6 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) 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 @@ -291,10 +134,10 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) ******************************************************************************/ static u32 -acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) +acpi_rs_stream_option_length(u32 resource_length, + u32 minimum_aml_resource_length) { u32 string_length = 0; - u32 minimum_resource_length; ACPI_FUNCTION_ENTRY(); @@ -303,11 +146,6 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) * Large-type resource descriptors. */ - /* Compute minimum size of the data part of the resource descriptor */ - - minimum_resource_length = - minimum_total_length - sizeof(struct asl_large_header); - /* * If the length of the actual resource descriptor is greater than the ACPI * spec-defined minimum length, it means that a resource_source_index exists @@ -315,10 +153,11 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) * (including the null terminator) is the resource length minus the minimum * length, minus one byte for the resource_source_index itself. */ - if (resource_length > minimum_resource_length) { + if (resource_length > minimum_aml_resource_length) { /* Compute the length of the optional string */ - string_length = resource_length - minimum_resource_length - 1; + string_length = + resource_length - minimum_aml_resource_length - 1; } /* Round up length to 32 bits for internal structure alignment */ @@ -328,7 +167,7 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) /******************************************************************************* * - * FUNCTION: acpi_rs_get_byte_stream_length + * FUNCTION: acpi_rs_get_aml_length * * PARAMETERS: Resource - Pointer to the resource linked list * size_needed - Where the required size is returned @@ -342,62 +181,62 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length) ******************************************************************************/ acpi_status -acpi_rs_get_byte_stream_length(struct acpi_resource * resource, - acpi_size * size_needed) +acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) { - acpi_size byte_stream_size_needed = 0; + acpi_size aml_size_needed = 0; acpi_size segment_size; - ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); + ACPI_FUNCTION_TRACE("rs_get_aml_length"); /* Traverse entire list of internal resource descriptors */ while (resource) { /* Validate the descriptor type */ - if (resource->type > ACPI_RSTYPE_MAX) { + if (resource->type > ACPI_RESOURCE_TYPE_MAX) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } /* Get the base size of the (external stream) resource descriptor */ - segment_size = acpi_gbl_stream_sizes[resource->type]; + segment_size = acpi_gbl_aml_resource_sizes[resource->type]; /* * Augment the base size for descriptors with optional and/or * variable-length fields */ switch (resource->type) { - case ACPI_RSTYPE_VENDOR: + case ACPI_RESOURCE_TYPE_VENDOR: /* * Vendor Defined Resource: * For a Vendor Specific resource, if the Length is between 1 and 7 * it will be created as a Small Resource data type, otherwise it * is a Large Resource data type. */ - if (resource->data.vendor_specific.length > 7) { + if (resource->data.vendor.byte_length > 7) { /* Base size of a Large resource descriptor */ - segment_size = 3; + segment_size = + sizeof(struct aml_resource_large_header); } /* Add the size of the vendor-specific data */ - segment_size += resource->data.vendor_specific.length; + segment_size += resource->data.vendor.byte_length; break; - case ACPI_RSTYPE_END_TAG: + case ACPI_RESOURCE_TYPE_END_TAG: /* * End Tag: * We are done -- return the accumulated total size. */ - *size_needed = byte_stream_size_needed + segment_size; + *size_needed = aml_size_needed + segment_size; /* Normal exit */ return_ACPI_STATUS(AE_OK); - case ACPI_RSTYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS16: /* * 16-Bit Address Resource: * Add the size of the optional resource_source info @@ -408,7 +247,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, resource_source); break; - case ACPI_RSTYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS32: /* * 32-Bit Address Resource: * Add the size of the optional resource_source info @@ -419,7 +258,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, resource_source); break; - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS64: /* * 64-Bit Address Resource: * Add the size of the optional resource_source info @@ -430,7 +269,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, resource_source); break; - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: /* * Extended IRQ Resource: * Add the size of each additional optional interrupt beyond the @@ -438,7 +277,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, */ segment_size += (((acpi_size) resource->data.extended_irq. - number_of_interrupts - 1) * 4); + interrupt_count - 1) * 4); /* Add the size of the optional resource_source info */ @@ -454,7 +293,7 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, /* Update the total */ - byte_stream_size_needed += segment_size; + aml_size_needed += segment_size; /* Point to the next object */ @@ -471,9 +310,9 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, * * FUNCTION: acpi_rs_get_list_length * - * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream - * byte_stream_buffer_length - Size of byte_stream_buffer - * size_needed - Where the size needed is returned + * PARAMETERS: aml_buffer - Pointer to the resource byte stream + * aml_buffer_length - Size of aml_buffer + * size_needed - Where the size needed is returned * * RETURN: Status * @@ -484,11 +323,11 @@ acpi_rs_get_byte_stream_length(struct acpi_resource * resource, ******************************************************************************/ acpi_status -acpi_rs_get_list_length(u8 * byte_stream_buffer, - u32 byte_stream_buffer_length, acpi_size * size_needed) +acpi_rs_get_list_length(u8 * aml_buffer, + u32 aml_buffer_length, acpi_size * size_needed) { u8 *buffer; - struct acpi_resource_sizes *resource_info; + struct acpi_resource_info *resource_info; u32 buffer_size = 0; u32 bytes_parsed = 0; u8 resource_type; @@ -499,14 +338,14 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_FUNCTION_TRACE("rs_get_list_length"); - while (bytes_parsed < byte_stream_buffer_length) { + while (bytes_parsed < aml_buffer_length) { /* The next byte in the stream is the resource descriptor type */ - resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); + resource_type = acpi_rs_get_resource_type(*aml_buffer); /* Get the base stream size and structure sizes for the descriptor */ - resource_info = acpi_rs_get_resource_sizes(resource_type); + resource_info = acpi_rs_get_resource_info(resource_type); if (!resource_info) { return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } @@ -514,43 +353,46 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, /* Get the Length field from the input resource descriptor */ resource_length = - acpi_rs_get_resource_length(byte_stream_buffer); + acpi_rs_get_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); /* Augment the size for descriptors with optional fields */ extra_struct_bytes = 0; - if (!(resource_type & ACPI_RDESC_TYPE_LARGE)) { + if (!(resource_type & ACPI_RESOURCE_NAME_LARGE)) { /* * Small resource descriptors */ - header_length = 1; - buffer = byte_stream_buffer + header_length; + header_length = + sizeof(struct aml_resource_small_header); + buffer = aml_buffer + header_length; switch (resource_type) { - case ACPI_RDESC_TYPE_IRQ_FORMAT: + case ACPI_RESOURCE_NAME_IRQ: /* * IRQ Resource: * Get the number of bits set in the IRQ word */ ACPI_MOVE_16_TO_16(&temp16, buffer); - extra_struct_bytes = (acpi_rs_count_set_bits(temp16) * sizeof(u32)); break; - case ACPI_RDESC_TYPE_DMA_FORMAT: + case ACPI_RESOURCE_NAME_DMA: /* * DMA Resource: * Get the number of bits set in the DMA channels byte */ + ACPI_MOVE_16_TO_16(&temp16, buffer); extra_struct_bytes = - (acpi_rs_count_set_bits((u16) * buffer) * + (acpi_rs_count_set_bits(temp16) * sizeof(u32)); break; - case ACPI_RDESC_TYPE_SMALL_VENDOR: + case ACPI_RESOURCE_NAME_VENDOR_SMALL: /* * Vendor Specific Resource: * Ensure a 32-bit boundary for the structure @@ -559,12 +401,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_ROUND_UP_to_32_bITS(resource_length); break; - case ACPI_RDESC_TYPE_END_TAG: + case ACPI_RESOURCE_NAME_END_TAG: /* * End Tag: * Terminate the loop now */ - byte_stream_buffer_length = bytes_parsed; + aml_buffer_length = bytes_parsed; break; default: @@ -574,11 +416,12 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, /* * Large resource descriptors */ - header_length = sizeof(struct asl_large_header); - buffer = byte_stream_buffer + header_length; + header_length = + sizeof(struct aml_resource_large_header); + buffer = aml_buffer + header_length; switch (resource_type) { - case ACPI_RDESC_TYPE_LARGE_VENDOR: + case ACPI_RESOURCE_NAME_VENDOR_LARGE: /* * Vendor Defined Resource: * Add vendor data and ensure a 32-bit boundary for the structure @@ -587,8 +430,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_ROUND_UP_to_32_bITS(resource_length); break; - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: + case ACPI_RESOURCE_NAME_ADDRESS32: + case ACPI_RESOURCE_NAME_ADDRESS16: /* * 32-Bit or 16-bit Address Resource: * Add the size of any optional data (resource_source) @@ -596,10 +439,11 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, extra_struct_bytes = acpi_rs_stream_option_length (resource_length, - resource_info->minimum_stream_size); + resource_info-> + minimum_aml_resource_length); break; - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: + case ACPI_RESOURCE_NAME_EXTENDED_IRQ: /* * Extended IRQ: * Point past the interrupt_vector_flags to get the @@ -622,10 +466,10 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, - extra_struct_bytes, resource_info-> - minimum_stream_size); + minimum_aml_resource_length); break; - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: + case ACPI_RESOURCE_NAME_ADDRESS64: /* * 64-Bit Address Resource: * Add the size of any optional data (resource_source) @@ -635,7 +479,8 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, ACPI_ROUND_UP_to_64_bITS (acpi_rs_stream_option_length (resource_length, - resource_info->minimum_stream_size)); + resource_info-> + minimum_aml_resource_length)); break; default: @@ -646,7 +491,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, /* Update the required buffer size for the internal descriptor structs */ temp16 = - (u16) (resource_info->minimum_struct_size + + (u16) (resource_info->minimum_internal_struct_length + extra_struct_bytes); buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(temp16); @@ -656,7 +501,7 @@ acpi_rs_get_list_length(u8 * byte_stream_buffer, */ temp16 = (u16) (header_length + resource_length); bytes_parsed += temp16; - byte_stream_buffer += temp16; + aml_buffer += temp16; } /* This is the data the caller needs */ @@ -758,8 +603,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, (*sub_object_list)->string. length + 1); } else { - temp_size_needed += - acpi_ns_get_pathname_length((*sub_object_list)->reference.node); + temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node); } } else { /* diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 0911526b7ad8..6c7c6c560635 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate") * * FUNCTION: acpi_rs_create_resource_list * - * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream - * output_buffer - Pointer to the user's buffer + * PARAMETERS: aml_buffer - Pointer to the resource byte stream + * output_buffer - Pointer to the user's buffer * - * RETURN: Status - AE_OK if okay, else a valid acpi_status code + * RETURN: Status: AE_OK if okay, else a valid acpi_status code * If output_buffer is not large enough, output_buffer_length * indicates how large output_buffer should be, else it * indicates how may u8 elements of output_buffer are valid. @@ -67,33 +67,30 @@ ACPI_MODULE_NAME("rscreate") * ******************************************************************************/ acpi_status -acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, +acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, struct acpi_buffer *output_buffer) { acpi_status status; - u8 *byte_stream_start; + u8 *aml_start; acpi_size list_size_needed = 0; - u32 byte_stream_buffer_length; + u32 aml_buffer_length; ACPI_FUNCTION_TRACE("rs_create_resource_list"); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", - byte_stream_buffer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer)); /* Params already validated, so we don't re-validate here */ - byte_stream_buffer_length = byte_stream_buffer->buffer.length; - byte_stream_start = byte_stream_buffer->buffer.pointer; + aml_buffer_length = aml_buffer->buffer.length; + aml_start = aml_buffer->buffer.pointer; /* - * Pass the byte_stream_buffer into a module that can calculate + * Pass the aml_buffer into a module that can calculate * the buffer size needed for the linked list */ - status = - acpi_rs_get_list_length(byte_stream_start, - byte_stream_buffer_length, - &list_size_needed); + status = acpi_rs_get_list_length(aml_start, aml_buffer_length, + &list_size_needed); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", status, (u32) list_size_needed)); @@ -110,10 +107,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, /* Do the conversion */ - status = - acpi_rs_byte_stream_to_list(byte_stream_start, - byte_stream_buffer_length, - output_buffer->pointer); + status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -360,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /******************************************************************************* * - * FUNCTION: acpi_rs_create_byte_stream + * FUNCTION: acpi_rs_create_aml_resources * * PARAMETERS: linked_list_buffer - Pointer to the resource linked list * output_buffer - Pointer to the user's buffer @@ -377,13 +372,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ******************************************************************************/ acpi_status -acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer) +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer) { acpi_status status; - acpi_size byte_stream_size_needed = 0; + acpi_size aml_size_needed = 0; - ACPI_FUNCTION_TRACE("rs_create_byte_stream"); + ACPI_FUNCTION_TRACE("rs_create_aml_resources"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", linked_list_buffer)); @@ -394,11 +389,10 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, * Pass the linked_list_buffer into a module that calculates * the buffer size needed for the byte stream. */ - status = acpi_rs_get_byte_stream_length(linked_list_buffer, - &byte_stream_size_needed); + status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", - (u32) byte_stream_size_needed, + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", + (u32) aml_size_needed, acpi_format_exception(status))); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -406,8 +400,7 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, /* Validate/Allocate/Clear caller buffer */ - status = - acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed); + status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -415,9 +408,9 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, /* Do the conversion */ status = - acpi_rs_list_to_byte_stream(linked_list_buffer, - byte_stream_size_needed, - output_buffer->pointer); + acpi_rs_convert_resources_to_aml(linked_list_buffer, + aml_size_needed, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 9d93ee5f0060..2f8990845b2d 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -49,38 +49,6 @@ ACPI_MODULE_NAME("rsdump") #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* Local prototypes */ -static void acpi_rs_dump_irq(union acpi_resource_data *resource); - -static void acpi_rs_dump_address16(union acpi_resource_data *resource); - -static void acpi_rs_dump_address32(union acpi_resource_data *resource); - -static void acpi_rs_dump_address64(union acpi_resource_data *resource); - -static void acpi_rs_dump_dma(union acpi_resource_data *resource); - -static void acpi_rs_dump_io(union acpi_resource_data *resource); - -static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource); - -static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); - -static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); - -static void acpi_rs_dump_memory24(union acpi_resource_data *resource); - -static void acpi_rs_dump_memory32(union acpi_resource_data *resource); - -static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource); - -static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource); - -static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); - -static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource); - -static void acpi_rs_dump_end_tag(union acpi_resource_data *resource); - static void acpi_rs_out_string(char *title, char *value); static void acpi_rs_out_integer8(char *title, u8 value); @@ -104,30 +72,6 @@ acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); static void acpi_rs_dump_address_common(union acpi_resource_data *resource); -/* Dispatch table for resource dump functions */ - -typedef -void (*ACPI_DUMP_RESOURCE) (union acpi_resource_data * data); - -static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = { - acpi_rs_dump_irq, /* ACPI_RSTYPE_IRQ */ - acpi_rs_dump_dma, /* ACPI_RSTYPE_DMA */ - acpi_rs_dump_start_depend_fns, /* ACPI_RSTYPE_START_DPF */ - acpi_rs_dump_end_depend_fns, /* ACPI_RSTYPE_END_DPF */ - acpi_rs_dump_io, /* ACPI_RSTYPE_IO */ - acpi_rs_dump_fixed_io, /* ACPI_RSTYPE_FIXED_IO */ - acpi_rs_dump_vendor_specific, /* ACPI_RSTYPE_VENDOR */ - acpi_rs_dump_end_tag, /* ACPI_RSTYPE_END_TAG */ - acpi_rs_dump_memory24, /* ACPI_RSTYPE_MEM24 */ - acpi_rs_dump_memory32, /* ACPI_RSTYPE_MEM32 */ - acpi_rs_dump_fixed_memory32, /* ACPI_RSTYPE_FIXED_MEM32 */ - acpi_rs_dump_address16, /* ACPI_RSTYPE_ADDRESS16 */ - acpi_rs_dump_address32, /* ACPI_RSTYPE_ADDRESS32 */ - acpi_rs_dump_address64, /* ACPI_RSTYPE_ADDRESS64 */ - acpi_rs_dump_extended_irq, /* ACPI_RSTYPE_EXT_IRQ */ - acpi_rs_dump_generic_reg /* ACPI_RSTYPE_GENERIC_REG */ -}; - /******************************************************************************* * * FUNCTION: acpi_rs_out* @@ -144,32 +88,32 @@ static ACPI_DUMP_RESOURCE acpi_gbl_dump_resource_dispatch[] = { static void acpi_rs_out_string(char *title, char *value) { - acpi_os_printf("%30s : %s\n", title, value); + acpi_os_printf("%27s : %s\n", title, value); } static void acpi_rs_out_integer8(char *title, u8 value) { - acpi_os_printf("%30s : %2.2X\n", title, value); + acpi_os_printf("%27s : %2.2X\n", title, value); } static void acpi_rs_out_integer16(char *title, u16 value) { - acpi_os_printf("%30s : %4.4X\n", title, value); + acpi_os_printf("%27s : %4.4X\n", title, value); } static void acpi_rs_out_integer32(char *title, u32 value) { - acpi_os_printf("%30s : %8.8X\n", title, value); + acpi_os_printf("%27s : %8.8X\n", title, value); } static void acpi_rs_out_integer64(char *title, u64 value) { - acpi_os_printf("%30s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); + acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); } static void acpi_rs_out_title(char *title) { - acpi_os_printf("%30s : ", title); + acpi_os_printf("%27s : ", title); } /******************************************************************************* @@ -190,7 +134,7 @@ static void acpi_rs_dump_byte_list(u32 length, u8 * data) u32 i; for (i = 0; i < length; i++) { - acpi_os_printf("%28s%2.2X : %2.2X\n", "Byte", i, data[i]); + acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); } } @@ -199,7 +143,7 @@ static void acpi_rs_dump_dword_list(u32 length, u32 * data) u32 i; for (i = 0; i < length; i++) { - acpi_os_printf("%28s%2.2X : %8.8X\n", "Dword", i, data[i]); + acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); } } @@ -213,6 +157,14 @@ static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) acpi_os_printf("\n"); } +static void acpi_rs_dump_memory_attribute(u32 read_write_attribute) +{ + + acpi_rs_out_string("Read/Write Attribute", + ACPI_READ_WRITE_MEMORY == read_write_attribute ? + "Read/Write" : "Read-Only"); +} + /******************************************************************************* * * FUNCTION: acpi_rs_dump_resource_source @@ -229,6 +181,7 @@ static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) static void acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) { + ACPI_FUNCTION_ENTRY(); if (resource_source->index == 0xFF) { return; @@ -290,11 +243,8 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) break; } - acpi_rs_out_string("Read/Write Attribute", - ACPI_READ_WRITE_MEMORY == - resource->address.attribute.memory. - read_write_attribute ? "Read/Write" : - "Read Only"); + acpi_rs_dump_memory_attribute(resource->address.attribute. + memory.read_write_attribute); break; case ACPI_IO_RANGE: @@ -392,7 +342,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) /* Validate Type before dispatch */ - if (resource_list->type > ACPI_RSTYPE_MAX) { + if (resource_list->type > ACPI_RESOURCE_TYPE_MAX) { acpi_os_printf ("Invalid descriptor type (%X) in resource list\n", resource_list->type); @@ -406,7 +356,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) /* Exit on end tag */ - if (resource_list->type == ACPI_RSTYPE_END_TAG) { + if (resource_list->type == ACPI_RESOURCE_TYPE_END_TAG) { return; } @@ -431,7 +381,7 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) * ******************************************************************************/ -static void acpi_rs_dump_irq(union acpi_resource_data *resource) +void acpi_rs_dump_irq(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -439,22 +389,21 @@ static void acpi_rs_dump_irq(union acpi_resource_data *resource) acpi_rs_out_string("Triggering", ACPI_LEVEL_SENSITIVE == - resource->irq.edge_level ? "Level" : "Edge"); + resource->irq.triggering ? "Level" : "Edge"); acpi_rs_out_string("Active", ACPI_ACTIVE_LOW == - resource->irq.active_high_low ? "Low" : "High"); + resource->irq.polarity ? "Low" : "High"); acpi_rs_out_string("Sharing", ACPI_SHARED == - resource->irq. - shared_exclusive ? "Shared" : "Exclusive"); + resource->irq.sharable ? "Shared" : "Exclusive"); acpi_rs_out_integer8("Interrupt Count", - (u8) resource->irq.number_of_interrupts); + (u8) resource->irq.interrupt_count); acpi_rs_out_title("Interrupt List"); - acpi_rs_dump_short_byte_list(resource->irq.number_of_interrupts, + acpi_rs_dump_short_byte_list(resource->irq.interrupt_count, resource->irq.interrupts); } @@ -470,7 +419,7 @@ static void acpi_rs_dump_irq(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_dma(union acpi_resource_data *resource) +void acpi_rs_dump_dma(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -523,16 +472,16 @@ static void acpi_rs_dump_dma(union acpi_resource_data *resource) } acpi_rs_out_integer8("DMA Channel Count", - (u8) resource->dma.number_of_channels); + (u8) resource->dma.channel_count); acpi_rs_out_title("Channel List"); - acpi_rs_dump_short_byte_list(resource->dma.number_of_channels, + acpi_rs_dump_short_byte_list(resource->dma.channel_count, resource->dma.channels); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_start_depend_fns + * FUNCTION: acpi_rs_dump_start_dpf * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -542,7 +491,7 @@ static void acpi_rs_dump_dma(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource) +void acpi_rs_dump_start_dpf(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -600,7 +549,7 @@ static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_io(union acpi_resource_data *resource) +void acpi_rs_dump_io(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -610,15 +559,13 @@ static void acpi_rs_dump_io(union acpi_resource_data *resource) ACPI_DECODE_16 == resource->io.io_decode ? "16-bit" : "10-bit"); - acpi_rs_out_integer32("Range Minimum Base", - resource->io.min_base_address); + acpi_rs_out_integer32("Address Minimum", resource->io.minimum); - acpi_rs_out_integer32("Range Maximum Base", - resource->io.max_base_address); + acpi_rs_out_integer32("Address Maximum", resource->io.maximum); acpi_rs_out_integer32("Alignment", resource->io.alignment); - acpi_rs_out_integer32("Range Length", resource->io.range_length); + acpi_rs_out_integer32("Address Length", resource->io.address_length); } /******************************************************************************* @@ -633,21 +580,21 @@ static void acpi_rs_dump_io(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) +void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("Fixed I/O Resource\n"); - acpi_rs_out_integer32("Range Base Address", - resource->fixed_io.base_address); + acpi_rs_out_integer32("Address", resource->fixed_io.address); - acpi_rs_out_integer32("Range Length", resource->fixed_io.range_length); + acpi_rs_out_integer32("Address Length", + resource->fixed_io.address_length); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_vendor_specific + * FUNCTION: acpi_rs_dump_vendor * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -657,16 +604,16 @@ static void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource) +void acpi_rs_dump_vendor(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("Vendor Specific Resource\n"); - acpi_rs_out_integer16("Length", (u16) resource->vendor_specific.length); + acpi_rs_out_integer16("Length", (u16) resource->vendor.byte_length); - acpi_rs_dump_byte_list(resource->vendor_specific.length, - resource->vendor_specific.reserved); + acpi_rs_dump_byte_list(resource->vendor.byte_length, + resource->vendor.byte_data); } /******************************************************************************* @@ -681,27 +628,24 @@ static void acpi_rs_dump_vendor_specific(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_memory24(union acpi_resource_data *resource) +void acpi_rs_dump_memory24(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("24-Bit Memory Range Resource\n"); - acpi_rs_out_string("Attribute", - ACPI_READ_WRITE_MEMORY == - resource->memory24.read_write_attribute ? - "Read/Write" : "Read Only"); + acpi_rs_dump_memory_attribute(resource->memory24.read_write_attribute); - acpi_rs_out_integer16("Range Minimum Base", - (u16) resource->memory24.min_base_address); + acpi_rs_out_integer16("Address Minimum", + (u16) resource->memory24.minimum); - acpi_rs_out_integer16("Range Maximum Base", - (u16) resource->memory24.max_base_address); + acpi_rs_out_integer16("Address Maximum", + (u16) resource->memory24.maximum); acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment); - acpi_rs_out_integer16("Range Length", - (u16) resource->memory24.range_length); + acpi_rs_out_integer16("Address Length", + (u16) resource->memory24.address_length); } /******************************************************************************* @@ -716,26 +660,22 @@ static void acpi_rs_dump_memory24(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_memory32(union acpi_resource_data *resource) +void acpi_rs_dump_memory32(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("32-Bit Memory Range Resource\n"); - acpi_rs_out_string("Attribute", - ACPI_READ_WRITE_MEMORY == - resource->memory32.read_write_attribute ? - "Read/Write" : "Read Only"); + acpi_rs_dump_memory_attribute(resource->memory32.read_write_attribute); - acpi_rs_out_integer32("Range Minimum Base", - resource->memory32.min_base_address); + acpi_rs_out_integer32("Address Minimum", resource->memory32.minimum); - acpi_rs_out_integer32("Range Maximum Base", - resource->memory32.max_base_address); + acpi_rs_out_integer32("Address Maximum", resource->memory32.maximum); acpi_rs_out_integer32("Alignment", resource->memory32.alignment); - acpi_rs_out_integer32("Range Length", resource->memory32.range_length); + acpi_rs_out_integer32("Address Length", + resource->memory32.address_length); } /******************************************************************************* @@ -750,22 +690,19 @@ static void acpi_rs_dump_memory32(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) +void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); - acpi_rs_out_string("Attribute", - ACPI_READ_WRITE_MEMORY == - resource->fixed_memory32.read_write_attribute ? - "Read/Write" : "Read Only"); + acpi_rs_dump_memory_attribute(resource->fixed_memory32. + read_write_attribute); - acpi_rs_out_integer32("Range Base Address", - resource->fixed_memory32.range_base_address); + acpi_rs_out_integer32("Address", resource->fixed_memory32.address); - acpi_rs_out_integer32("Range Length", - resource->fixed_memory32.range_length); + acpi_rs_out_integer32("Address Length", + resource->fixed_memory32.address_length); } /******************************************************************************* @@ -780,26 +717,25 @@ static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_address16(union acpi_resource_data *resource) +void acpi_rs_dump_address16(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); - acpi_os_printf("16-Bit Address Space Resource\n"); + acpi_os_printf("16-Bit WORD Address Space Resource\n"); acpi_rs_dump_address_common(resource); acpi_rs_out_integer16("Granularity", (u16) resource->address16.granularity); - acpi_rs_out_integer16("Address Range Min", - (u16) resource->address16.min_address_range); + acpi_rs_out_integer16("Address Minimum", + (u16) resource->address16.minimum); - acpi_rs_out_integer16("Address Range Max", - (u16) resource->address16.max_address_range); + acpi_rs_out_integer16("Address Maximum", + (u16) resource->address16.maximum); - acpi_rs_out_integer16("Address Translation Offset", - (u16) resource->address16. - address_translation_offset); + acpi_rs_out_integer16("Translation Offset", + (u16) resource->address16.translation_offset); acpi_rs_out_integer16("Address Length", (u16) resource->address16.address_length); @@ -819,24 +755,22 @@ static void acpi_rs_dump_address16(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_address32(union acpi_resource_data *resource) +void acpi_rs_dump_address32(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); - acpi_os_printf("32-Bit Address Space Resource\n"); + acpi_os_printf("32-Bit DWORD Address Space Resource\n"); acpi_rs_dump_address_common(resource); acpi_rs_out_integer32("Granularity", resource->address32.granularity); - acpi_rs_out_integer32("Address Range Min", - resource->address32.min_address_range); + acpi_rs_out_integer32("Address Minimum", resource->address32.minimum); - acpi_rs_out_integer32("Address Range Max", - resource->address32.max_address_range); + acpi_rs_out_integer32("Address Maximum", resource->address32.maximum); - acpi_rs_out_integer32("Address Translation Offset", - resource->address32.address_translation_offset); + acpi_rs_out_integer32("Translation Offset", + resource->address32.translation_offset); acpi_rs_out_integer32("Address Length", resource->address32.address_length); @@ -856,37 +790,32 @@ static void acpi_rs_dump_address32(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_address64(union acpi_resource_data *resource) +void acpi_rs_dump_address64(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); - acpi_os_printf("64-Bit Address Space Resource\n"); + acpi_os_printf("64-Bit QWORD Address Space Resource\n"); acpi_rs_dump_address_common(resource); acpi_rs_out_integer64("Granularity", resource->address64.granularity); - acpi_rs_out_integer64("Address Range Min", - resource->address64.min_address_range); + acpi_rs_out_integer64("Address Minimum", resource->address64.minimum); - acpi_rs_out_integer64("Address Range Max", - resource->address64.max_address_range); + acpi_rs_out_integer64("Address Maximum", resource->address64.maximum); - acpi_rs_out_integer64("Address Translation Offset", - resource->address64.address_translation_offset); + acpi_rs_out_integer64("Translation Offset", + resource->address64.translation_offset); acpi_rs_out_integer64("Address Length", resource->address64.address_length); - acpi_rs_out_integer64("Type Specific Attributes", - resource->address64.type_specific_attributes); - acpi_rs_dump_resource_source(&resource->address64.resource_source); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_extended_irq + * FUNCTION: acpi_rs_dump_ext_address64 * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -896,7 +825,46 @@ static void acpi_rs_dump_address64(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource) +void acpi_rs_dump_ext_address64(union acpi_resource_data *resource) +{ + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("64-Bit Extended Address Space Resource\n"); + + acpi_rs_dump_address_common(resource); + + acpi_rs_out_integer64("Granularity", + resource->ext_address64.granularity); + + acpi_rs_out_integer64("Address Minimum", + resource->ext_address64.minimum); + + acpi_rs_out_integer64("Address Maximum", + resource->ext_address64.maximum); + + acpi_rs_out_integer64("Translation Offset", + resource->ext_address64.translation_offset); + + acpi_rs_out_integer64("Address Length", + resource->ext_address64.address_length); + + acpi_rs_out_integer64("Type-Specific Attribute", + resource->ext_address64.type_specific_attributes); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_ext_irq + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void acpi_rs_dump_ext_irq(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -910,24 +878,22 @@ static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource) acpi_rs_out_string("Triggering", ACPI_LEVEL_SENSITIVE == resource->extended_irq. - edge_level ? "Level" : "Edge"); + triggering ? "Level" : "Edge"); acpi_rs_out_string("Active", - ACPI_ACTIVE_LOW == - resource->extended_irq. - active_high_low ? "Low" : "High"); + ACPI_ACTIVE_LOW == resource->extended_irq.polarity ? + "Low" : "High"); acpi_rs_out_string("Sharing", - ACPI_SHARED == - resource->extended_irq. - shared_exclusive ? "Shared" : "Exclusive"); + ACPI_SHARED == resource->extended_irq.sharable ? + "Shared" : "Exclusive"); acpi_rs_dump_resource_source(&resource->extended_irq.resource_source); acpi_rs_out_integer8("Interrupts", - (u8) resource->extended_irq.number_of_interrupts); + (u8) resource->extended_irq.interrupt_count); - acpi_rs_dump_dword_list(resource->extended_irq.number_of_interrupts, + acpi_rs_dump_dword_list(resource->extended_irq.interrupt_count, resource->extended_irq.interrupts); } @@ -943,9 +909,8 @@ static void acpi_rs_dump_extended_irq(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) +void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) { - ACPI_FUNCTION_ENTRY(); acpi_os_printf("Generic Register Resource\n"); @@ -957,15 +922,15 @@ static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) acpi_rs_out_integer8("Bit Offset", (u8) resource->generic_reg.bit_offset); - acpi_rs_out_integer8("Address Size", - (u8) resource->generic_reg.address_size); + acpi_rs_out_integer8("Access Size", + (u8) resource->generic_reg.access_size); acpi_rs_out_integer64("Address", resource->generic_reg.address); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_end_depend_fns + * FUNCTION: acpi_rs_dump_end_dpf * * PARAMETERS: Resource - Pointer to an internal resource descriptor * @@ -975,7 +940,7 @@ static void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource) +void acpi_rs_dump_end_dpf(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); @@ -994,7 +959,7 @@ static void acpi_rs_dump_end_depend_fns(union acpi_resource_data *resource) * ******************************************************************************/ -static void acpi_rs_dump_end_tag(union acpi_resource_data *resource) +void acpi_rs_dump_end_tag(union acpi_resource_data *resource) { ACPI_FUNCTION_ENTRY(); diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index 49a5f81c727b..b31cb33ec565 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c @@ -207,7 +207,7 @@ struct acpi_resource_info acpi_gbl_lg_resource_info[] = { {0, ACPI_RLARGE(struct aml_resource_memory24), ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)}, {0, ACPI_RLARGE(struct aml_resource_generic_register), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_registerister)}, + ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register)}, {0, 0, 0}, {1, ACPI_RLARGE(struct aml_resource_vendor_large), ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 6574e2ae2e52..0dab8cdfa800 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -49,426 +49,269 @@ ACPI_MODULE_NAME("rsio") /******************************************************************************* * - * FUNCTION: acpi_rs_io_resource + * FUNCTION: acpi_rs_get_io * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_io_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); + ACPI_FUNCTION_TRACE("rs_get_io"); - ACPI_FUNCTION_TRACE("rs_io_resource"); + /* Get the Decode flag */ - /* The number of bytes consumed are Constant */ + resource->data.io.io_decode = aml->io.information & 0x01; - *bytes_consumed = 8; + /* + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Alignment + * Length + */ + ACPI_MOVE_16_TO_32(&resource->data.io.minimum, &aml->io.minimum); + ACPI_MOVE_16_TO_32(&resource->data.io.maximum, &aml->io.maximum); + resource->data.io.alignment = aml->io.alignment; + resource->data.io.address_length = aml->io.address_length; - output_struct->type = ACPI_RSTYPE_IO; + /* Complete the resource header */ - /* Check Decode */ - - buffer += 1; - temp8 = *buffer; - - output_struct->data.io.io_decode = temp8 & 0x01; - - /* Check min_base Address */ - - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - output_struct->data.io.min_base_address = temp16; - - /* Check max_base Address */ - - buffer += 2; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - output_struct->data.io.max_base_address = temp16; - - /* Check Base alignment */ - - buffer += 2; - temp8 = *buffer; - - output_struct->data.io.alignment = temp8; - - /* Check range_length */ - - buffer += 1; - temp8 = *buffer; - - output_struct->data.io.range_length = temp8; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_IO; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_io_resource + * FUNCTION: acpi_rs_set_io * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); - - ACPI_FUNCTION_TRACE("rs_fixed_io_resource"); + ACPI_FUNCTION_TRACE("rs_set_io"); - /* The number of bytes consumed are Constant */ + /* I/O Information Byte */ - *bytes_consumed = 4; + aml->io.information = (u8) (resource->data.io.io_decode & 0x01); - output_struct->type = ACPI_RSTYPE_FIXED_IO; + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Alignment + * Length + */ + ACPI_MOVE_32_TO_16(&aml->io.minimum, &resource->data.io.minimum); + ACPI_MOVE_32_TO_16(&aml->io.maximum, &resource->data.io.maximum); + aml->io.alignment = (u8) resource->data.io.alignment; + aml->io.address_length = (u8) resource->data.io.address_length; - /* Check Range Base Address */ + /* Complete the AML descriptor header */ - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - output_struct->data.fixed_io.base_address = temp16; - - /* Check range_length */ - - buffer += 2; - temp8 = *buffer; - - output_struct->data.fixed_io.range_length = temp8; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IO, + sizeof(struct aml_resource_io), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_io_stream + * FUNCTION: acpi_rs_get_fixed_io * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_get_fixed_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_io_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07; - buffer += 1; - - /* Io Information Byte */ - - temp8 = (u8) (resource->data.io.io_decode & 0x01); - - *buffer = temp8; - buffer += 1; - - /* Set the Range minimum base address */ - - temp16 = (u16) resource->data.io.min_base_address; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set the Range maximum base address */ + ACPI_FUNCTION_TRACE("rs_get_fixed_io"); - temp16 = (u16) resource->data.io.max_base_address; + /* + * Get the following contiguous fields from the AML descriptor: + * Base Address + * Length + */ + ACPI_MOVE_16_TO_32(&resource->data.fixed_io.address, + &aml->fixed_io.address); + resource->data.fixed_io.address_length = aml->fixed_io.address_length; - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + /* Complete the resource header */ - /* Set the base alignment */ - - temp8 = (u8) resource->data.io.alignment; - - *buffer = temp8; - buffer += 1; - - /* Set the range length */ - - temp8 = (u8) resource->data.io.range_length; - - *buffer = temp8; - buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_io_stream + * FUNCTION: acpi_rs_set_fixed_io * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03; - buffer += 1; - - /* Set the Range base address */ - - temp16 = (u16) resource->data.fixed_io.base_address; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set the range length */ - - temp8 = (u8) resource->data.fixed_io.range_length; - - *buffer = temp8; - buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + ACPI_FUNCTION_TRACE("rs_set_fixed_io"); + + /* + * Set the following contiguous fields in the AML descriptor: + * Base Address + * Length + */ + ACPI_MOVE_32_TO_16(&aml->fixed_io.address, + &resource->data.fixed_io.address); + aml->fixed_io.address_length = + (u8) resource->data.fixed_io.address_length; + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO, + sizeof(struct aml_resource_fixed_io), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_dma_resource + * FUNCTION: acpi_rs_get_dma * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_dma_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_dma(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u8 temp8 = 0; - u8 index; - u8 i; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); + u32 channel_count = 0; + u32 i; + u8 temp8; - ACPI_FUNCTION_TRACE("rs_dma_resource"); - - /* The number of bytes consumed are Constant */ - - *bytes_consumed = 3; - output_struct->type = ACPI_RSTYPE_DMA; - - /* Point to the 8-bits of Byte 1 */ - - buffer += 1; - temp8 = *buffer; + ACPI_FUNCTION_TRACE("rs_get_dma"); /* Decode the DMA channel bits */ - for (i = 0, index = 0; index < 8; index++) { - if ((temp8 >> index) & 0x01) { - output_struct->data.dma.channels[i] = index; - i++; + for (i = 0; i < 8; i++) { + if ((aml->dma.dma_channel_mask >> i) & 0x01) { + resource->data.dma.channels[channel_count] = i; + channel_count++; } } - /* Zero DMA channels is valid */ - - output_struct->data.dma.number_of_channels = i; - if (i > 0) { - /* Calculate the structure size based upon the number of interrupts */ + resource->length = 0; + resource->data.dma.channel_count = channel_count; - struct_size += ((acpi_size) i - 1) * 4; + /* + * Calculate the structure size based upon the number of channels + * Note: Zero DMA channels is valid + */ + if (channel_count > 0) { + resource->length = (u32) (channel_count - 1) * 4; } - /* Point to Byte 2 */ + /* Get the flags: transfer preference, bus mastering, channel speed */ - buffer += 1; - temp8 = *buffer; + temp8 = aml->dma.flags; + resource->data.dma.transfer = temp8 & 0x03; + resource->data.dma.bus_master = (temp8 >> 2) & 0x01; + resource->data.dma.type = (temp8 >> 5) & 0x03; - /* Check for transfer preference (Bits[1:0]) */ - - output_struct->data.dma.transfer = temp8 & 0x03; - - if (0x03 == output_struct->data.dma.transfer) { + if (resource->data.dma.transfer == 0x03) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); return_ACPI_STATUS(AE_BAD_DATA); } - /* Get bus master preference (Bit[2]) */ - - output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; - - /* Get channel speed support (Bits[6:5]) */ + /* Complete the resource header */ - output_struct->data.dma.type = (temp8 >> 5) & 0x03; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_DMA; + resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_dma_stream + * FUNCTION: acpi_rs_set_dma * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_dma_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - - ACPI_FUNCTION_TRACE("rs_dma_stream"); - - /* The Descriptor Type field is static */ + u8 i; - *buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02; - buffer += 1; - temp8 = 0; + ACPI_FUNCTION_TRACE("rs_set_dma"); - /* Loop through all of the Channels and set the mask bits */ + /* Convert channel list to 8-bit DMA channel bitmask */ - for (index = 0; index < resource->data.dma.number_of_channels; index++) { - temp16 = (u16) resource->data.dma.channels[index]; - temp8 |= 0x1 << temp16; + aml->dma.dma_channel_mask = 0; + for (i = 0; i < resource->data.dma.channel_count; i++) { + aml->dma.dma_channel_mask |= + (1 << resource->data.dma.channels[i]); } - *buffer = temp8; - buffer += 1; - - /* Set the DMA Info */ - - temp8 = (u8) ((resource->data.dma.type & 0x03) << 5); - temp8 |= ((resource->data.dma.bus_master & 0x01) << 2); - temp8 |= (resource->data.dma.transfer & 0x03); + /* Set the DMA Flag bits */ - *buffer = temp8; - buffer += 1; + aml->dma.flags = (u8) + (((resource->data.dma.type & 0x03) << 5) | + ((resource->data.dma.bus_master & 0x01) << 2) | + (resource->data.dma.transfer & 0x03)); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_DMA, + sizeof(struct aml_resource_dma), aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 75df962115cc..4e854ba70811 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -49,93 +49,67 @@ ACPI_MODULE_NAME("rsirq") /******************************************************************************* * - * FUNCTION: acpi_rs_irq_resource + * FUNCTION: acpi_rs_get_irq * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - u8 i; - acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); - - ACPI_FUNCTION_TRACE("rs_irq_resource"); - - /* - * The number of bytes consumed are contained in the descriptor - * (Bits:0-1) - */ - temp8 = *buffer; - *bytes_consumed = (temp8 & 0x03) + 1; - output_struct->type = ACPI_RSTYPE_IRQ; + u32 interrupt_count = 0; + u32 i; + u32 resource_length; - /* Point to the 16-bits of Bytes 1 and 2 */ + ACPI_FUNCTION_TRACE("rs_get_irq"); - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + /* Get the IRQ mask (bytes 1:2) */ - output_struct->data.irq.number_of_interrupts = 0; + ACPI_MOVE_16_TO_16(&temp16, &aml->irq.irq_mask); - /* Decode the IRQ bits */ + /* Decode the IRQ bits (up to 16 possible) */ - for (i = 0, index = 0; index < 16; index++) { - if ((temp16 >> index) & 0x01) { - output_struct->data.irq.interrupts[i] = index; - i++; + for (i = 0; i < 16; i++) { + if ((temp16 >> i) & 0x01) { + resource->data.irq.interrupts[interrupt_count] = i; + interrupt_count++; } } /* Zero interrupts is valid */ - output_struct->data.irq.number_of_interrupts = i; - if (i > 0) { + resource_length = 0; + resource->data.irq.interrupt_count = interrupt_count; + if (interrupt_count > 0) { /* Calculate the structure size based upon the number of interrupts */ - struct_size += ((acpi_size) i - 1) * 4; + resource_length = (u32) (interrupt_count - 1) * 4; } - /* Point to Byte 3 if it is used */ - - if (4 == *bytes_consumed) { - buffer += 2; - temp8 = *buffer; + /* Get Flags (Byte 3) if it is used */ + if (aml_resource_length == 3) { /* Check for HE, LL interrupts */ - switch (temp8 & 0x09) { + switch (aml->irq.flags & 0x09) { case 0x01: /* HE */ - output_struct->data.irq.edge_level = - ACPI_EDGE_SENSITIVE; - output_struct->data.irq.active_high_low = - ACPI_ACTIVE_HIGH; + resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; + resource->data.irq.polarity = ACPI_ACTIVE_HIGH; break; case 0x08: /* LL */ - output_struct->data.irq.edge_level = - ACPI_LEVEL_SENSITIVE; - output_struct->data.irq.active_high_low = - ACPI_ACTIVE_LOW; + resource->data.irq.triggering = ACPI_LEVEL_SENSITIVE; + resource->data.irq.polarity = ACPI_ACTIVE_LOW; break; default: @@ -146,170 +120,131 @@ acpi_rs_irq_resource(u8 * byte_stream_buffer, */ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list, %X\n", - temp8)); + aml->irq.flags)); return_ACPI_STATUS(AE_BAD_DATA); } - /* Check for sharable */ + /* Get Sharing flag */ - output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; + resource->data.irq.sharable = (aml->irq.flags >> 3) & 0x01; } else { /* - * Assume Edge Sensitive, Active High, Non-Sharable - * per ACPI Specification + * Default configuration: assume Edge Sensitive, Active High, + * Non-Sharable as per the ACPI Specification */ - output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; - output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH; - output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; + resource->data.irq.polarity = ACPI_ACTIVE_HIGH; + resource->data.irq.sharable = ACPI_EXCLUSIVE; } - /* Set the Length parameter */ + /* Complete the resource header */ - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_IRQ; + resource->length = + resource_length + ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_irq_stream + * FUNCTION: acpi_rs_set_irq * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - u8 IRqinfo_byte_needed; + acpi_size descriptor_length; + u16 irq_mask; + u8 i; + + ACPI_FUNCTION_TRACE("rs_set_irq"); - ACPI_FUNCTION_TRACE("rs_irq_stream"); + /* Convert interrupt list to 16-bit IRQ bitmask */ + + irq_mask = 0; + for (i = 0; i < resource->data.irq.interrupt_count; i++) { + irq_mask |= (1 << resource->data.irq.interrupts[i]); + } + + /* Set the interrupt mask */ + + ACPI_MOVE_16_TO_16(&aml->irq.irq_mask, &irq_mask); /* * The descriptor field is set based upon whether a third byte is * needed to contain the IRQ Information. */ - if (ACPI_EDGE_SENSITIVE == resource->data.irq.edge_level && - ACPI_ACTIVE_HIGH == resource->data.irq.active_high_low && - ACPI_EXCLUSIVE == resource->data.irq.shared_exclusive) { - *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x02; - IRqinfo_byte_needed = FALSE; - } else { - *buffer = ACPI_RDESC_TYPE_IRQ_FORMAT | 0x03; - IRqinfo_byte_needed = TRUE; - } - - buffer += 1; - temp16 = 0; - - /* Loop through all of the interrupts and set the mask bits */ + if ((resource->data.irq.triggering == ACPI_EDGE_SENSITIVE) && + (resource->data.irq.polarity == ACPI_ACTIVE_HIGH) && + (resource->data.irq.sharable == ACPI_EXCLUSIVE)) { + /* irq_no_flags() descriptor can be used */ - for (index = 0; - index < resource->data.irq.number_of_interrupts; index++) { - temp8 = (u8) resource->data.irq.interrupts[index]; - temp16 |= 0x1 << temp8; - } + descriptor_length = sizeof(struct aml_resource_irq_noflags); + } else { + /* Irq() descriptor must be used */ - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + descriptor_length = sizeof(struct aml_resource_irq); - /* Set the IRQ Info byte if needed. */ + /* Set the IRQ Info byte */ - if (IRqinfo_byte_needed) { - temp8 = 0; - temp8 = (u8) ((resource->data.irq.shared_exclusive & - 0x01) << 4); + aml->irq.flags = (u8) + ((resource->data.irq.sharable & 0x01) << 4); - if (ACPI_LEVEL_SENSITIVE == resource->data.irq.edge_level && - ACPI_ACTIVE_LOW == resource->data.irq.active_high_low) { - temp8 |= 0x08; + if (ACPI_LEVEL_SENSITIVE == resource->data.irq.triggering && + ACPI_ACTIVE_LOW == resource->data.irq.polarity) { + aml->irq.flags |= 0x08; } else { - temp8 |= 0x01; + aml->irq.flags |= 0x01; } - - *buffer = temp8; - buffer += 1; } - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IRQ, descriptor_length, + aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_extended_irq_resource + * FUNCTION: acpi_rs_get_ext_irq * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_ext_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 *temp_ptr; - u8 index; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq); - - ACPI_FUNCTION_TRACE("rs_extended_irq_resource"); + char *out_resource_string; + u8 temp8; - /* Get the Descriptor Length field */ + ACPI_FUNCTION_TRACE("rs_get_ext_irq"); - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); + /* Get the flag bits */ - /* Validate minimum descriptor length */ - - if (temp16 < 6) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - *bytes_consumed = temp16 + 3; - output_struct->type = ACPI_RSTYPE_EXT_IRQ; - - /* Point to the Byte3 */ - - buffer += 2; - temp8 = *buffer; - - output_struct->data.extended_irq.producer_consumer = temp8 & 0x01; + temp8 = aml->extended_irq.flags; + resource->data.extended_irq.producer_consumer = temp8 & 0x01; + resource->data.extended_irq.polarity = (temp8 >> 2) & 0x01; + resource->data.extended_irq.sharable = (temp8 >> 3) & 0x01; /* * Check for Interrupt Mode @@ -319,165 +254,80 @@ acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, * * - Edge/Level are defined opposite in the table vs the headers */ - output_struct->data.extended_irq.edge_level = + resource->data.extended_irq.triggering = (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; - /* Check Interrupt Polarity */ - - output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; - - /* Check for sharable */ - - output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; - - /* Point to Byte4 (IRQ Table length) */ - - buffer += 1; - temp8 = *buffer; - - /* Must have at least one IRQ */ + /* Get the IRQ Table length (Byte4) */ + temp8 = aml->extended_irq.table_length; + resource->data.extended_irq.interrupt_count = temp8; if (temp8 < 1) { + /* Must have at least one IRQ */ + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } - output_struct->data.extended_irq.number_of_interrupts = temp8; - /* * Add any additional structure size to properly calculate * the next pointer at the end of this function */ - struct_size += (temp8 - 1) * 4; + resource->length = (temp8 - 1) * 4; + out_resource_string = ACPI_CAST_PTR(char, + (&resource->data.extended_irq. + interrupts[0] + temp8)); - /* Point to Byte5 (First IRQ Number) */ + /* Get every IRQ in the table, each is 32 bits */ - buffer += 1; + acpi_rs_move_data(resource->data.extended_irq.interrupts, + aml->extended_irq.interrupt_number, + (u16) temp8, ACPI_MOVE_TYPE_32_TO_32); - /* Cycle through every IRQ in the table */ + /* Get the optional resource_source (index and string) */ - for (index = 0; index < temp8; index++) { - ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq. - interrupts[index], buffer); + resource->length += + acpi_rs_get_resource_source(aml_resource_length, + (acpi_size) resource->length + + sizeof(struct + aml_resource_extended_irq), + &resource->data.extended_irq. + resource_source, aml, + out_resource_string); - /* Point to the next IRQ */ + /* Complete the resource header */ - buffer += 4; - } - - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. - */ - if (*bytes_consumed > - ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * - 4) + (5 + 1)) { - /* Dereference the Index */ - - temp8 = *buffer; - output_struct->data.extended_irq.resource_source.index = - (u32) temp8; - - /* Point to the String */ - - buffer += 1; - - /* Point the String pointer to the end of this structure. */ - - output_struct->data.extended_irq.resource_source.string_ptr = - (char *)((char *)output_struct + struct_size); - - temp_ptr = (u8 *) - output_struct->data.extended_irq.resource_source.string_ptr; - - /* Copy the string into the buffer */ - - index = 0; - while (*buffer) { - *temp_ptr = *buffer; - - temp_ptr += 1; - buffer += 1; - index += 1; - } - - /* Add the terminating null */ - - *temp_ptr = 0; - output_struct->data.extended_irq.resource_source.string_length = - index + 1; - - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - temp8 = (u8) (index + 1); - struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); - } else { - output_struct->data.extended_irq.resource_source.index = 0; - output_struct->data.extended_irq.resource_source.string_length = - 0; - output_struct->data.extended_irq.resource_source.string_ptr = - NULL; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; + resource->length += + ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_extended_irq_stream + * FUNCTION: acpi_rs_set_ext_irq * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_extended_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 *length_field; - u8 temp8 = 0; - u8 index; - - ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); - - /* Set the Descriptor Type field */ - - *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT; - buffer += 1; + acpi_size descriptor_length; - /* Save a pointer to the Length field - to be filled in later */ - - length_field = ACPI_CAST_PTR(u16, buffer); - buffer += 2; + ACPI_FUNCTION_TRACE("rs_set_ext_irq"); /* Set the Interrupt vector flags */ - temp8 = (u8) (resource->data.extended_irq.producer_consumer & 0x01); - temp8 |= ((resource->data.extended_irq.shared_exclusive & 0x01) << 3); + aml->extended_irq.flags = (u8) + ((resource->data.extended_irq.producer_consumer & 0x01) | + ((resource->data.extended_irq.sharable & 0x01) << 3) | + ((resource->data.extended_irq.polarity & 0x1) << 2)); /* * Set the Interrupt Mode @@ -488,64 +338,36 @@ acpi_rs_extended_irq_stream(struct acpi_resource *resource, * * - Edge/Level are defined opposite in the table vs the headers */ - if (ACPI_EDGE_SENSITIVE == resource->data.extended_irq.edge_level) { - temp8 |= 0x2; + if (resource->data.extended_irq.triggering == ACPI_EDGE_SENSITIVE) { + aml->extended_irq.flags |= 0x02; } - /* Set the Interrupt Polarity */ - - temp8 |= ((resource->data.extended_irq.active_high_low & 0x1) << 2); - - *buffer = temp8; - buffer += 1; - /* Set the Interrupt table length */ - temp8 = (u8) resource->data.extended_irq.number_of_interrupts; - - *buffer = temp8; - buffer += 1; + aml->extended_irq.table_length = (u8) + resource->data.extended_irq.interrupt_count; - for (index = 0; - index < resource->data.extended_irq.number_of_interrupts; - index++) { - ACPI_MOVE_32_TO_32(buffer, - &resource->data.extended_irq. - interrupts[index]); - buffer += 4; - } - - /* Resource Source Index and Resource Source are optional */ + descriptor_length = (sizeof(struct aml_resource_extended_irq) - 4) + + ((acpi_size) resource->data.extended_irq.interrupt_count * + sizeof(u32)); - if (0 != resource->data.extended_irq.resource_source.string_length) { - *buffer = - (u8) resource->data.extended_irq.resource_source.index; - buffer += 1; + /* Set each interrupt value */ - /* Copy the string */ + acpi_rs_move_data(aml->extended_irq.interrupt_number, + resource->data.extended_irq.interrupts, + (u16) resource->data.extended_irq.interrupt_count, + ACPI_MOVE_TYPE_32_TO_32); - ACPI_STRCPY((char *)buffer, - resource->data.extended_irq.resource_source. - string_ptr); - - /* - * Buffer needs to be set to the length of the string + one for the - * terminating null - */ - buffer += - (acpi_size) (ACPI_STRLEN - (resource->data.extended_irq.resource_source. - string_ptr) + 1); - } + /* Resource Source Index and Resource Source are optional */ - /* Return the number of bytes consumed in this operation */ + descriptor_length = acpi_rs_set_resource_source(aml, descriptor_length, + &resource->data. + extended_irq. + resource_source); - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + /* Complete the AML descriptor header */ - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - *length_field = (u16) (*bytes_consumed - 3); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_IRQ, + descriptor_length, aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 87e75349dd0a..f72d42e0927b 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -47,106 +47,70 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rslist") -/* Dispatch table for convert-to-stream functions */ -typedef -acpi_status(*ACPI_STREAM_HANDLER) (struct acpi_resource * resource, - u8 ** output_buffer, - acpi_size * bytes_consumed); - -static ACPI_STREAM_HANDLER acpi_gbl_stream_dispatch[] = { - acpi_rs_irq_stream, /* ACPI_RSTYPE_IRQ */ - acpi_rs_dma_stream, /* ACPI_RSTYPE_DMA */ - acpi_rs_start_depend_fns_stream, /* ACPI_RSTYPE_START_DPF */ - acpi_rs_end_depend_fns_stream, /* ACPI_RSTYPE_END_DPF */ - acpi_rs_io_stream, /* ACPI_RSTYPE_IO */ - acpi_rs_fixed_io_stream, /* ACPI_RSTYPE_FIXED_IO */ - acpi_rs_vendor_stream, /* ACPI_RSTYPE_VENDOR */ - acpi_rs_end_tag_stream, /* ACPI_RSTYPE_END_TAG */ - acpi_rs_memory24_stream, /* ACPI_RSTYPE_MEM24 */ - acpi_rs_memory32_range_stream, /* ACPI_RSTYPE_MEM32 */ - acpi_rs_fixed_memory32_stream, /* ACPI_RSTYPE_FIXED_MEM32 */ - acpi_rs_address16_stream, /* ACPI_RSTYPE_ADDRESS16 */ - acpi_rs_address32_stream, /* ACPI_RSTYPE_ADDRESS32 */ - acpi_rs_address64_stream, /* ACPI_RSTYPE_ADDRESS64 */ - acpi_rs_extended_irq_stream, /* ACPI_RSTYPE_EXT_IRQ */ - acpi_rs_generic_register_stream /* ACPI_RSTYPE_GENERIC_REG */ -}; - -/* Dispatch tables for convert-to-resource functions */ - -typedef -acpi_status(*ACPI_RESOURCE_HANDLER) (u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); - -static ACPI_RESOURCE_HANDLER acpi_gbl_sm_resource_dispatch[] = { - NULL, /* 0x00, Reserved */ - NULL, /* 0x01, Reserved */ - NULL, /* 0x02, Reserved */ - NULL, /* 0x03, Reserved */ - acpi_rs_irq_resource, /* ACPI_RDESC_TYPE_IRQ_FORMAT */ - acpi_rs_dma_resource, /* ACPI_RDESC_TYPE_DMA_FORMAT */ - acpi_rs_start_depend_fns_resource, /* ACPI_RDESC_TYPE_START_DEPENDENT */ - acpi_rs_end_depend_fns_resource, /* ACPI_RDESC_TYPE_END_DEPENDENT */ - acpi_rs_io_resource, /* ACPI_RDESC_TYPE_IO_PORT */ - acpi_rs_fixed_io_resource, /* ACPI_RDESC_TYPE_FIXED_IO_PORT */ - NULL, /* 0x0A, Reserved */ - NULL, /* 0x0B, Reserved */ - NULL, /* 0x0C, Reserved */ - NULL, /* 0x0D, Reserved */ - acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_SMALL_VENDOR */ - acpi_rs_end_tag_resource /* ACPI_RDESC_TYPE_END_TAG */ -}; - -static ACPI_RESOURCE_HANDLER acpi_gbl_lg_resource_dispatch[] = { - NULL, /* 0x00, Reserved */ - acpi_rs_memory24_resource, /* ACPI_RDESC_TYPE_MEMORY_24 */ - acpi_rs_generic_register_resource, /* ACPI_RDESC_TYPE_GENERIC_REGISTER */ - NULL, /* 0x03, Reserved */ - acpi_rs_vendor_resource, /* ACPI_RDESC_TYPE_LARGE_VENDOR */ - acpi_rs_memory32_range_resource, /* ACPI_RDESC_TYPE_MEMORY_32 */ - acpi_rs_fixed_memory32_resource, /* ACPI_RDESC_TYPE_FIXED_MEMORY_32 */ - acpi_rs_address32_resource, /* ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE */ - acpi_rs_address16_resource, /* ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE */ - acpi_rs_extended_irq_resource, /* ACPI_RDESC_TYPE_EXTENDED_XRUPT */ - acpi_rs_address64_resource, /* ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE */ - acpi_rs_address64_resource /* ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE */ -}; - /* Local prototypes */ +static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); -static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); +static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); /******************************************************************************* * - * FUNCTION: acpi_rs_get_resource_type + * FUNCTION: acpi_rs_validate_resource_length * - * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * PARAMETERS: Aml - Pointer to the AML resource descriptor * - * RETURN: The Resource Type with no extraneous bits (except the large/ - * small bit -- left alone) + * RETURN: Status - AE_OK if the resource length appears valid * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. + * DESCRIPTION: Validate the resource_length. Fixed-length descriptors must + * have the exact length; variable-length descriptors must be + * at least as long as the minimum. Certain Small descriptors + * can vary in size by at most one byte. * ******************************************************************************/ -u8 acpi_rs_get_resource_type(u8 resource_type) +static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) { + struct acpi_resource_info *resource_info; + u16 minimum_aml_resource_length; + u16 resource_length; + ACPI_FUNCTION_ENTRY(); - /* Determine if this is a small or large resource */ + /* Get the size and type info about this resource descriptor */ - if (resource_type & ACPI_RDESC_TYPE_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ + resource_info = + acpi_rs_get_resource_info(aml->small_header.descriptor_type); + if (!resource_info) { + return (AE_AML_INVALID_RESOURCE_TYPE); + } + + resource_length = acpi_rs_get_resource_length(aml); + minimum_aml_resource_length = + resource_info->minimum_aml_resource_length; + + /* Validate based upon the type of resource, fixed length or variable */ + + if (resource_info->length_type == ACPI_FIXED_LENGTH) { + /* Fixed length resource, length must match exactly */ - return (resource_type); + if (resource_length != minimum_aml_resource_length) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + } else if (resource_info->length_type == ACPI_VARIABLE_LENGTH) { + /* Variable length resource, must be at least the minimum */ + + if (resource_length < minimum_aml_resource_length) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } } else { - /* Small Resource Type -- bits 6:3 contain the name */ + /* Small variable length resource, allowed to be (Min) or (Min-1) */ - return ((u8) (resource_type & ACPI_RDESC_SMALL_MASK)); + if ((resource_length > minimum_aml_resource_length) || + (resource_length < (minimum_aml_resource_length - 1))) { + return (AE_AML_BAD_RESOURCE_LENGTH); + } } + + return (AE_OK); } /******************************************************************************* @@ -162,38 +126,38 @@ u8 acpi_rs_get_resource_type(u8 resource_type) * ******************************************************************************/ -static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) +static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) { ACPI_FUNCTION_ENTRY(); /* Determine if this is a small or large resource */ - if (resource_type & ACPI_RDESC_TYPE_LARGE) { + if (resource_type & ACPI_RESOURCE_NAME_LARGE) { /* Large Resource Type -- bits 6:0 contain the name */ - if (resource_type > ACPI_RDESC_LARGE_MAX) { + if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { return (NULL); } - return (acpi_gbl_lg_resource_dispatch[(resource_type & - ACPI_RDESC_LARGE_MASK)]); + return (acpi_gbl_lg_get_resource_dispatch[(resource_type & + ACPI_RESOURCE_NAME_LARGE_MASK)]); } else { /* Small Resource Type -- bits 6:3 contain the name */ - return (acpi_gbl_sm_resource_dispatch[((resource_type & - ACPI_RDESC_SMALL_MASK) - >> 3)]); + return (acpi_gbl_sm_get_resource_dispatch[((resource_type & + ACPI_RESOURCE_NAME_SMALL_MASK) + >> 3)]); } } /******************************************************************************* * - * FUNCTION: acpi_rs_byte_stream_to_list + * FUNCTION: acpi_rs_convert_aml_to_resources * - * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream - * byte_stream_buffer_length - Length of byte_stream_buffer - * output_buffer - Pointer to the buffer that will - * contain the output structures + * PARAMETERS: aml_buffer - Pointer to the resource byte stream + * aml_buffer_length - Length of aml_buffer + * output_buffer - Pointer to the buffer that will + * contain the output structures * * RETURN: Status * @@ -203,37 +167,60 @@ static ACPI_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) ******************************************************************************/ acpi_status -acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, - u32 byte_stream_buffer_length, u8 * output_buffer) +acpi_rs_convert_aml_to_resources(u8 * aml_buffer, + u32 aml_buffer_length, u8 * output_buffer) { u8 *buffer = output_buffer; acpi_status status; acpi_size bytes_parsed = 0; - acpi_size bytes_consumed = 0; - acpi_size structure_size = 0; struct acpi_resource *resource; - ACPI_RESOURCE_HANDLER handler; + u16 resource_length; + u32 descriptor_length; + ACPI_GET_RESOURCE_HANDLER handler; - ACPI_FUNCTION_TRACE("rs_byte_stream_to_list"); + ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); /* Loop until end-of-buffer or an end_tag is found */ - while (bytes_parsed < byte_stream_buffer_length) { + while (bytes_parsed < aml_buffer_length) { /* Get the handler associated with this Descriptor Type */ - handler = acpi_rs_get_resource_handler(*byte_stream_buffer); - if (handler) { - /* Convert a byte stream resource to local resource struct */ + handler = acpi_rs_get_resource_handler(*aml_buffer); + if (!handler) { + /* No handler indicates invalid resource type */ - status = handler(byte_stream_buffer, &bytes_consumed, - &buffer, &structure_size); - } else { - /* Invalid resource type */ + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + } - status = AE_AML_INVALID_RESOURCE_TYPE; + resource_length = + acpi_rs_get_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); + + descriptor_length = + acpi_rs_get_descriptor_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); + + /* + * Perform limited validation of the resource length, based upon + * what we know about the resource type + */ + status = + acpi_rs_validate_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } + /* Convert a byte stream resource to local resource struct */ + + status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer), + resource_length, + ACPI_CAST_PTR(struct acpi_resource, buffer)); if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -245,19 +232,19 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, /* Normal exit on completion of an end_tag resource descriptor */ - if (acpi_rs_get_resource_type(*byte_stream_buffer) == - ACPI_RDESC_TYPE_END_TAG) { + if (acpi_rs_get_resource_type(*aml_buffer) == + ACPI_RESOURCE_NAME_END_TAG) { return_ACPI_STATUS(AE_OK); } /* Update counter and point to the next input resource */ - bytes_parsed += bytes_consumed; - byte_stream_buffer += bytes_consumed; + bytes_parsed += descriptor_length; + aml_buffer += descriptor_length; /* Point to the next structure in the output buffer */ - buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size); + buffer += resource->length; } /* Completed buffer, but did not find an end_tag resource descriptor */ @@ -267,17 +254,15 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, /******************************************************************************* * - * FUNCTION: acpi_rs_list_to_byte_stream + * FUNCTION: acpi_rs_convert_resources_to_aml * - * PARAMETERS: Resource - Pointer to the resource linked list - * byte_steam_size_needed - Calculated size of the byte stream - * needed from calling - * acpi_rs_get_byte_stream_length() - * The size of the output_buffer is - * guaranteed to be >= - * byte_stream_size_needed - * output_buffer - Pointer to the buffer that will - * contain the byte stream + * PARAMETERS: Resource - Pointer to the resource linked list + * aml_size_needed - Calculated size of the byte stream + * needed from calling acpi_rs_get_aml_length() + * The size of the output_buffer is + * guaranteed to be >= aml_size_needed + * output_buffer - Pointer to the buffer that will + * contain the byte stream * * RETURN: Status * @@ -287,52 +272,69 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, ******************************************************************************/ acpi_status -acpi_rs_list_to_byte_stream(struct acpi_resource *resource, - acpi_size byte_stream_size_needed, - u8 * output_buffer) +acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, + acpi_size aml_size_needed, u8 * output_buffer) { - u8 *buffer = output_buffer; - acpi_size bytes_consumed = 0; + u8 *aml_buffer = output_buffer; acpi_status status; - ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); + ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); /* Convert each resource descriptor in the list */ while (1) { - /* Validate Type before dispatch */ + /* Validate Resource Descriptor Type before dispatch */ - if (resource->type > ACPI_RSTYPE_MAX) { + if (resource->type > ACPI_RESOURCE_TYPE_MAX) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", resource->type)); return_ACPI_STATUS(AE_BAD_DATA); } - /* Perform the conversion, per resource type */ + /* Perform the conversion per resource type */ + + status = + acpi_gbl_set_resource_dispatch[resource->type] (resource, + ACPI_CAST_PTR + (union + aml_resource, + aml_buffer)); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); + return_ACPI_STATUS(status); + } + + /* Perform final sanity check on the new AML resource descriptor */ - status = acpi_gbl_stream_dispatch[resource->type] (resource, - &buffer, - &bytes_consumed); + status = + acpi_rs_validate_resource_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* Check for end-of-list */ + /* Check for end-of-list, normal exit */ - if (resource->type == ACPI_RSTYPE_END_TAG) { - /* An End Tag indicates the end of the Resource Template */ + if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + /* An End Tag indicates the end of the input Resource Template */ return_ACPI_STATUS(AE_OK); } - /* Set the Buffer to point to the next (output) resource descriptor */ + /* Extract the total length of the new descriptor */ + /* Set the aml_buffer to point to the next (output) resource descriptor */ - buffer += bytes_consumed; + aml_buffer += + acpi_rs_get_descriptor_length(ACPI_CAST_PTR + (union aml_resource, + aml_buffer)); - /* Point to the next input resource object */ + /* Point to the next input resource descriptor */ - resource = ACPI_PTR_ADD(struct acpi_resource, - resource, resource->length); + resource = + ACPI_PTR_ADD(struct acpi_resource, resource, + resource->length); } } diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 418f1afb10a3..47e979e7ba35 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -49,446 +49,260 @@ ACPI_MODULE_NAME("rsmemory") /******************************************************************************* * - * FUNCTION: acpi_rs_memory24_resource + * FUNCTION: acpi_rs_get_memory24 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_memory24_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_memory24(union aml_resource * aml, + u16 aml_resource_length, struct acpi_resource * resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); + ACPI_FUNCTION_TRACE("rs_get_memory24"); - ACPI_FUNCTION_TRACE("rs_memory24_resource"); + /* Get the Read/Write bit */ - /* Point past the Descriptor to get the number of bytes consumed */ + resource->data.memory24.read_write_attribute = + (aml->memory24.information & 0x01); - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - buffer += 2; - *bytes_consumed = (acpi_size) temp16 + 3; - output_struct->type = ACPI_RSTYPE_MEM24; - - /* Check Byte 3 the Read/Write bit */ - - temp8 = *buffer; - buffer += 1; - output_struct->data.memory24.read_write_attribute = temp8 & 0x01; - - /* Get min_base_address (Bytes 4-5) */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - buffer += 2; - output_struct->data.memory24.min_base_address = temp16; - - /* Get max_base_address (Bytes 6-7) */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - buffer += 2; - output_struct->data.memory24.max_base_address = temp16; - - /* Get Alignment (Bytes 8-9) */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - buffer += 2; - output_struct->data.memory24.alignment = temp16; - - /* Get range_length (Bytes 10-11) */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - output_struct->data.memory24.range_length = temp16; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; + /* + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + acpi_rs_move_data(&resource->data.memory24.minimum, + &aml->memory24.minimum, 4, ACPI_MOVE_TYPE_16_TO_32); - /* Return the final size of the structure */ + /* Complete the resource header */ - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_MEMORY24; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_memory24_stream + * FUNCTION: acpi_rs_set_memory24 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_memory24_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_memory24_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_MEMORY_24; - buffer += 1; - - /* The length field is static */ - - temp16 = 0x09; - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + ACPI_FUNCTION_TRACE("rs_set_memory24"); /* Set the Information Byte */ - temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01); - *buffer = temp8; - buffer += 1; - - /* Set the Range minimum base address */ + aml->memory24.information = (u8) + (resource->data.memory24.read_write_attribute & 0x01); - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address); - buffer += 2; - - /* Set the Range maximum base address */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address); - buffer += 2; - - /* Set the base alignment */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment); - buffer += 2; - - /* Set the range length */ - - ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length); - buffer += 2; + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + acpi_rs_move_data(&aml->memory24.minimum, + &resource->data.memory24.minimum, 4, + ACPI_MOVE_TYPE_32_TO_16); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY24, + sizeof(struct aml_resource_memory24), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_memory32_range_resource + * FUNCTION: acpi_rs_get_memory32 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_memory32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); - - ACPI_FUNCTION_TRACE("rs_memory32_range_resource"); + ACPI_FUNCTION_TRACE("rs_get_memory32"); - /* Point past the Descriptor to get the number of bytes consumed */ + /* Get the Read/Write bit */ - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - buffer += 2; - *bytes_consumed = (acpi_size) temp16 + 3; - output_struct->type = ACPI_RSTYPE_MEM32; + resource->data.memory32.read_write_attribute = + (aml->memory32.information & 0x01); /* - * Point to the place in the output buffer where the data portion will - * begin. - * 1. Set the RESOURCE_DATA * Data to point to its own address, then - * 2. Set the pointer to the next address. - * - * NOTE: output_struct->Data is cast to u8, otherwise, this addition adds - * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length */ + acpi_rs_move_data(&resource->data.memory32.minimum, + &aml->memory32.minimum, 4, ACPI_MOVE_TYPE_32_TO_32); - /* Check Byte 3 the Read/Write bit */ - - temp8 = *buffer; - buffer += 1; - - output_struct->data.memory32.read_write_attribute = temp8 & 0x01; - - /* Get min_base_address (Bytes 4-7) */ - - ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address, - buffer); - buffer += 4; - - /* Get max_base_address (Bytes 8-11) */ - - ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address, - buffer); - buffer += 4; - - /* Get Alignment (Bytes 12-15) */ - - ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer); - buffer += 4; - - /* Get range_length (Bytes 16-19) */ - - ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer); - - /* Set the Length parameter */ + /* Complete the resource header */ - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_MEMORY32; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_memory32_resource + * FUNCTION: acpi_rs_set_memory32 * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32); - - ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource"); - - /* Point past the Descriptor to get the number of bytes consumed */ - - buffer += 1; - ACPI_MOVE_16_TO_16(&temp16, buffer); - - buffer += 2; - *bytes_consumed = (acpi_size) temp16 + 3; - output_struct->type = ACPI_RSTYPE_FIXED_MEM32; - - /* Check Byte 3 the Read/Write bit */ - - temp8 = *buffer; - buffer += 1; - output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; - - /* Get range_base_address (Bytes 4-7) */ - - ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32. - range_base_address, buffer); - buffer += 4; - - /* Get range_length (Bytes 8-11) */ + ACPI_FUNCTION_TRACE("rs_set_memory32"); - ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length, - buffer); + /* Set the Information Byte */ - /* Set the Length parameter */ + aml->memory32.information = (u8) + (resource->data.memory32.read_write_attribute & 0x01); - output_struct->length = (u32) struct_size; + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + acpi_rs_move_data(&aml->memory32.minimum, + &resource->data.memory32.minimum, 4, + ACPI_MOVE_TYPE_32_TO_32); - /* Return the final size of the structure */ + /* Complete the AML descriptor header */ - *structure_size = struct_size; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY32, + sizeof(struct aml_resource_memory32), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_memory32_range_stream + * FUNCTION: acpi_rs_get_fixed_memory32 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_memory32_range_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_get_fixed_memory32(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); - - /* The Descriptor Type field is static */ + ACPI_FUNCTION_TRACE("rs_get_fixed_memory32"); - *buffer = ACPI_RDESC_TYPE_MEMORY_32; - buffer += 1; - - /* The length field is static */ - - temp16 = 0x11; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set the Information Byte */ + /* Get the Read/Write bit */ - temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01); - *buffer = temp8; - buffer += 1; + resource->data.fixed_memory32.read_write_attribute = + (aml->fixed_memory32.information & 0x01); - /* Set the Range minimum base address */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address); - buffer += 4; - - /* Set the Range maximum base address */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address); - buffer += 4; - - /* Set the base alignment */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment); - buffer += 4; - - /* Set the range length */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length); - buffer += 4; + /* + * Get the following contiguous fields from the AML descriptor: + * Base Address + * Range Length + */ + ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address, + &aml->fixed_memory32.address); + ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address_length, + &aml->fixed_memory32.address_length); - /* Return the number of bytes consumed in this operation */ + /* Complete the resource header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_fixed_memory32_stream + * FUNCTION: acpi_rs_set_fixed_memory32 * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_fixed_memory32(struct acpi_resource *resource, + union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); - - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32; - buffer += 1; - - /* The length field is static */ - - temp16 = 0x09; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + ACPI_FUNCTION_TRACE("rs_set_fixed_memory32"); /* Set the Information Byte */ - temp8 = - (u8) (resource->data.fixed_memory32.read_write_attribute & 0x01); - *buffer = temp8; - buffer += 1; + aml->fixed_memory32.information = (u8) + (resource->data.fixed_memory32.read_write_attribute & 0x01); - /* Set the Range base address */ - - ACPI_MOVE_32_TO_32(buffer, - &resource->data.fixed_memory32.range_base_address); - buffer += 4; - - /* Set the range length */ - - ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length); - buffer += 4; + /* + * Set the following contiguous fields in the AML descriptor: + * Base Address + * Range Length + */ + ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address, + &resource->data.fixed_memory32.address); + ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address_length, + &resource->data.fixed_memory32.address_length); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_MEMORY32, + sizeof(struct aml_resource_fixed_memory32), + aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index fa7f5a85b61d..337a0f01cb23 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -49,641 +49,432 @@ ACPI_MODULE_NAME("rsmisc") /******************************************************************************* * - * FUNCTION: acpi_rs_generic_register_resource + * FUNCTION: acpi_rs_get_generic_reg * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_generic_register_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size) +acpi_rs_get_generic_reg(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16; - u8 temp8; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_reg); + ACPI_FUNCTION_TRACE("rs_get_generic_reg"); - ACPI_FUNCTION_TRACE("rs_generic_register_resource"); - - /* Byte 0 is the Descriptor Type */ - - buffer += 1; - - /* Get the Descriptor Length field (Bytes 1-2) */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - buffer += 2; - - /* Validate the descriptor length */ - - if (temp16 != 12) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } - - /* The number of bytes consumed is fixed (12 + 3) */ - - *bytes_consumed = 15; - - /* Fill out the structure */ - - output_struct->type = ACPI_RSTYPE_GENERIC_REG; - - /* Get space_id (Byte 3) */ - - temp8 = *buffer; - output_struct->data.generic_reg.space_id = temp8; - buffer += 1; - - /* Get register_bit_width (Byte 4) */ - - temp8 = *buffer; - output_struct->data.generic_reg.bit_width = temp8; - buffer += 1; - - /* Get register_bit_offset (Byte 5) */ - - temp8 = *buffer; - output_struct->data.generic_reg.bit_offset = temp8; - buffer += 1; - - /* Get address_size (Byte 6) */ - - temp8 = *buffer; - output_struct->data.generic_reg.address_size = temp8; - buffer += 1; - - /* Get register_address (Bytes 7-14) */ - - ACPI_MOVE_64_TO_64(&output_struct->data.generic_reg.address, buffer); - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + /* + * Get the following fields from the AML descriptor: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size + * Register Address + */ + resource->data.generic_reg.space_id = aml->generic_reg.address_space_id; + resource->data.generic_reg.bit_width = aml->generic_reg.bit_width; + resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset; + resource->data.generic_reg.access_size = aml->generic_reg.access_size; + ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address, + &aml->generic_reg.address); + + /* Complete the resource header */ + + resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_generic_register_stream + * FUNCTION: acpi_rs_set_generic_reg * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_generic_register_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16; - - ACPI_FUNCTION_TRACE("rs_generic_register_stream"); - - /* Set the Descriptor Type (Byte 0) */ - - *buffer = ACPI_RDESC_TYPE_GENERIC_REGISTER; - buffer += 1; - - /* Set the Descriptor Length (Bytes 1-2) */ - - temp16 = 12; - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; - - /* Set space_id (Byte 3) */ - - *buffer = (u8) resource->data.generic_reg.space_id; - buffer += 1; - - /* Set register_bit_width (Byte 4) */ - - *buffer = (u8) resource->data.generic_reg.bit_width; - buffer += 1; - - /* Set register_bit_offset (Byte 5) */ - - *buffer = (u8) resource->data.generic_reg.bit_offset; - buffer += 1; - - /* Set address_size (Byte 6) */ - - *buffer = (u8) resource->data.generic_reg.address_size; - buffer += 1; - - /* Set register_address (Bytes 7-14) */ + ACPI_FUNCTION_TRACE("rs_set_generic_reg"); - ACPI_MOVE_64_TO_64(buffer, &resource->data.generic_reg.address); - buffer += 8; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + /* + * Set the following fields in the AML descriptor: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size + * Register Address + */ + aml->generic_reg.address_space_id = + (u8) resource->data.generic_reg.space_id; + aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width; + aml->generic_reg.bit_offset = + (u8) resource->data.generic_reg.bit_offset; + aml->generic_reg.access_size = + (u8) resource->data.generic_reg.access_size; + ACPI_MOVE_64_TO_64(&aml->generic_reg.address, + &resource->data.generic_reg.address); + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER, + sizeof(struct + aml_resource_generic_register), aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_tag_resource + * FUNCTION: acpi_rs_get_vendor * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_end_tag_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_vendor(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = ACPI_RESOURCE_LENGTH; - - ACPI_FUNCTION_TRACE("rs_end_tag_resource"); + u8 *aml_byte_data; - /* The number of bytes consumed is static */ + ACPI_FUNCTION_TRACE("rs_get_vendor"); - *bytes_consumed = 2; + /* Determine if this is a large or small vendor specific item */ - /* Fill out the structure */ + if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large item, Point to the first vendor byte */ - output_struct->type = ACPI_RSTYPE_END_TAG; + aml_byte_data = + ((u8 *) aml) + sizeof(struct aml_resource_large_header); + } else { + /* Small item, Point to the first vendor byte */ - /* Set the Length parameter */ + aml_byte_data = + ((u8 *) aml) + sizeof(struct aml_resource_small_header); + } - output_struct->length = 0; + /* Copy the vendor-specific bytes */ - /* Return the final size of the structure */ + ACPI_MEMCPY(resource->data.vendor.byte_data, + aml_byte_data, aml_resource_length); + resource->data.vendor.byte_length = aml_resource_length; - *structure_size = struct_size; + /* + * In order for the struct_size to fall on a 32-bit boundary, + * calculate the length of the vendor string and expand the + * struct_size to the next 32-bit boundary. + */ + resource->type = ACPI_RESOURCE_TYPE_VENDOR; + resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + ACPI_ROUND_UP_to_32_bITS(aml_resource_length); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_tag_stream + * FUNCTION: acpi_rs_set_vendor * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_end_tag_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; + u32 resource_length; + u8 *source; + u8 *destination; - ACPI_FUNCTION_TRACE("rs_end_tag_stream"); + ACPI_FUNCTION_TRACE("rs_set_vendor"); - /* The Descriptor Type field is static */ + resource_length = resource->data.vendor.byte_length; + source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data); - *buffer = ACPI_RDESC_TYPE_END_TAG | 0x01; - buffer += 1; + /* Length determines if this is a large or small resource */ - /* - * Set the Checksum - zero means that the resource data is treated as if - * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) - */ - temp8 = 0; + if (resource_length > 7) { + /* Large item, get pointer to the data part of the descriptor */ + + destination = + ((u8 *) aml) + sizeof(struct aml_resource_large_header); + + /* Complete the AML descriptor header */ + + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE, + (u32) (resource_length + + sizeof(struct + aml_resource_large_header)), + aml); + } else { + /* Small item, get pointer to the data part of the descriptor */ - *buffer = temp8; - buffer += 1; + destination = + ((u8 *) aml) + sizeof(struct aml_resource_small_header); - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL, + (u32) (resource_length + + sizeof(struct + aml_resource_small_header)), + aml); + } + + /* Copy the vendor-specific bytes */ + + ACPI_MEMCPY(destination, source, resource_length); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_vendor_resource + * FUNCTION: acpi_rs_get_start_dpf * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_vendor_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_get_start_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor); - - ACPI_FUNCTION_TRACE("rs_vendor_resource"); - - /* Dereference the Descriptor to find if this is a large or small item. */ + ACPI_FUNCTION_TRACE("rs_get_start_dpf"); - temp8 = *buffer; + /* Get the flags byte if present */ - if (temp8 & ACPI_RDESC_TYPE_LARGE) { - /* Large Item, point to the length field */ + if (aml_resource_length == 1) { + /* Get the Compatibility priority */ - buffer += 1; + resource->data.start_dpf.compatibility_priority = + (aml->start_dpf.flags & 0x03); - /* Dereference */ - - ACPI_MOVE_16_TO_16(&temp16, buffer); - - /* Calculate bytes consumed */ + if (resource->data.start_dpf.compatibility_priority >= 3) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); + } - *bytes_consumed = (acpi_size) temp16 + 3; + /* Get the Performance/Robustness preference */ - /* Point to the first vendor byte */ + resource->data.start_dpf.performance_robustness = + ((aml->start_dpf.flags >> 2) & 0x03); - buffer += 2; + if (resource->data.start_dpf.performance_robustness >= 3) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); + } } else { - /* Small Item, dereference the size */ - - temp16 = (u8) (*buffer & 0x07); - - /* Calculate bytes consumed */ + /* start_dependent_no_pri(), no flags byte, set defaults */ - *bytes_consumed = (acpi_size) temp16 + 1; - - /* Point to the first vendor byte */ + resource->data.start_dpf.compatibility_priority = + ACPI_ACCEPTABLE_CONFIGURATION; - buffer += 1; + resource->data.start_dpf.performance_robustness = + ACPI_ACCEPTABLE_CONFIGURATION; } - output_struct->type = ACPI_RSTYPE_VENDOR; - output_struct->data.vendor_specific.length = temp16; - - for (index = 0; index < temp16; index++) { - output_struct->data.vendor_specific.reserved[index] = *buffer; - buffer += 1; - } + /* Complete the resource header */ - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the vendor string and expand the - * struct_size to the next 32-bit boundary. - */ - struct_size += ACPI_ROUND_UP_to_32_bITS(temp16); - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT; + resource->length = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_vendor_stream + * FUNCTION: acpi_rs_set_start_dpf * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_vendor_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u8 index; - - ACPI_FUNCTION_TRACE("rs_vendor_stream"); - - /* Dereference the length to find if this is a large or small item. */ - - if (resource->data.vendor_specific.length > 7) { - /* Large Item, Set the descriptor field and length bytes */ + ACPI_FUNCTION_TRACE("rs_set_start_dpf"); - *buffer = ACPI_RDESC_TYPE_LARGE_VENDOR; - buffer += 1; - - temp16 = (u16) resource->data.vendor_specific.length; - - ACPI_MOVE_16_TO_16(buffer, &temp16); - buffer += 2; + /* + * The descriptor type field is set based upon whether a byte is needed + * to contain Priority data. + */ + if (ACPI_ACCEPTABLE_CONFIGURATION == + resource->data.start_dpf.compatibility_priority && + ACPI_ACCEPTABLE_CONFIGURATION == + resource->data.start_dpf.performance_robustness) { + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof(struct + aml_resource_start_dependent_noprio), + aml); } else { - /* Small Item, Set the descriptor field */ - - temp8 = ACPI_RDESC_TYPE_SMALL_VENDOR; - temp8 |= (u8) resource->data.vendor_specific.length; - - *buffer = temp8; - buffer += 1; - } - - /* Loop through all of the Vendor Specific fields */ - - for (index = 0; index < resource->data.vendor_specific.length; index++) { - temp8 = resource->data.vendor_specific.reserved[index]; - - *buffer = temp8; - buffer += 1; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof(struct + aml_resource_start_dependent), + aml); + + /* Set the Flags byte */ + + aml->start_dpf.flags = (u8) + (((resource->data.start_dpf. + performance_robustness & 0x03) << 2) | (resource->data. + start_dpf. + compatibility_priority + & 0x03)); } - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_start_depend_fns_resource + * FUNCTION: acpi_rs_get_end_dpf * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size) +acpi_rs_get_end_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = byte_stream_buffer; - struct acpi_resource *output_struct = (void *)*output_buffer; - u8 temp8 = 0; - acpi_size struct_size = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf); - - ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource"); - - /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ - - temp8 = *buffer; - - *bytes_consumed = (temp8 & 0x01) + 1; - - output_struct->type = ACPI_RSTYPE_START_DPF; - - /* Point to Byte 1 if it is used */ - - if (2 == *bytes_consumed) { - buffer += 1; - temp8 = *buffer; - - /* Check Compatibility priority */ - - output_struct->data.start_dpf.compatibility_priority = - temp8 & 0x03; - - if (3 == output_struct->data.start_dpf.compatibility_priority) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); - } + ACPI_FUNCTION_TRACE("rs_get_end_dpf"); - /* Check Performance/Robustness preference */ + /* Complete the resource header */ - output_struct->data.start_dpf.performance_robustness = - (temp8 >> 2) & 0x03; - - if (3 == output_struct->data.start_dpf.performance_robustness) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); - } - } else { - output_struct->data.start_dpf.compatibility_priority = - ACPI_ACCEPTABLE_CONFIGURATION; - - output_struct->data.start_dpf.performance_robustness = - ACPI_ACCEPTABLE_CONFIGURATION; - } - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT; + resource->length = (u32) ACPI_RESOURCE_LENGTH; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_depend_fns_resource + * FUNCTION: acpi_rs_set_end_dpf * - * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte - * stream - * bytes_consumed - Pointer to where the number of bytes - * consumed the byte_stream_buffer is - * returned - * output_buffer - Pointer to the return data buffer - * structure_size - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the output_buffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size) +acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml) { - struct acpi_resource *output_struct = (void *)*output_buffer; - acpi_size struct_size = ACPI_RESOURCE_LENGTH; - - ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource"); - - /* The number of bytes consumed is static */ - - *bytes_consumed = 1; + ACPI_FUNCTION_TRACE("rs_set_end_dpf"); - /* Fill out the structure */ + /* Complete the AML descriptor header */ - output_struct->type = ACPI_RSTYPE_END_DPF; - - /* Set the Length parameter */ - - output_struct->length = (u32) struct_size; - - /* Return the final size of the structure */ - - *structure_size = struct_size; + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT, + sizeof(struct aml_resource_end_dependent), + aml); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_start_depend_fns_stream + * FUNCTION: acpi_rs_get_end_tag * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - u32 pointer that is filled with - * the number of bytes of the - * output_buffer used + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * aml_resource_length - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ acpi_status -acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_get_end_tag(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource) { - u8 *buffer = *output_buffer; - u8 temp8 = 0; - - ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); + ACPI_FUNCTION_TRACE("rs_get_end_tag"); - /* - * The descriptor type field is set based upon whether a byte is needed - * to contain Priority data. - */ - if (ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.compatibility_priority && - ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.performance_robustness) { - *buffer = ACPI_RDESC_TYPE_START_DEPENDENT; - } else { - *buffer = ACPI_RDESC_TYPE_START_DEPENDENT | 0x01; - buffer += 1; - - /* Set the Priority Byte Definition */ + /* Complete the resource header */ - temp8 = 0; - temp8 = (u8) ((resource->data.start_dpf.performance_robustness & - 0x03) << 2); - temp8 |= (resource->data.start_dpf.compatibility_priority & - 0x03); - *buffer = temp8; - } - - buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + resource->type = ACPI_RESOURCE_TYPE_END_TAG; + resource->length = ACPI_RESOURCE_LENGTH; return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_end_depend_fns_stream + * FUNCTION: acpi_rs_set_end_tag * - * PARAMETERS: Resource - Pointer to the resource linked list - * output_buffer - Pointer to the user's return buffer - * bytes_consumed - Pointer to where the number of bytes - * used in the output_buffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ acpi_status -acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed) +acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml) { - u8 *buffer = *output_buffer; - - ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); + ACPI_FUNCTION_TRACE("rs_set_end_tag"); - /* The Descriptor Type field is static */ - - *buffer = ACPI_RDESC_TYPE_END_DEPENDENT; - buffer += 1; + /* + * Set the Checksum - zero means that the resource data is treated as if + * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) + */ + aml->end_tag.checksum = 0; - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG, + sizeof(struct aml_resource_end_tag), aml); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 4446778eaf79..9d503de1a349 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -48,6 +48,438 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsutils") +/******************************************************************************* + * + * FUNCTION: acpi_rs_move_data + * + * PARAMETERS: Destination - Pointer to the destination descriptor + * Source - Pointer to the source descriptor + * item_count - How many items to move + * move_type - Byte width + * + * RETURN: None + * + * DESCRIPTION: Move multiple data items from one descriptor to another. Handles + * alignment issues and endian issues if necessary, as configured + * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) + * + ******************************************************************************/ +void +acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) +{ + acpi_native_uint i; + + /* One move per item */ + + for (i = 0; i < item_count; i++) { + switch (move_type) { + case ACPI_MOVE_TYPE_16_TO_32: + ACPI_MOVE_16_TO_32(&((u32 *) destination)[i], + &((u16 *) source)[i]); + break; + + case ACPI_MOVE_TYPE_32_TO_16: + ACPI_MOVE_32_TO_16(&((u16 *) destination)[i], + &((u32 *) source)[i]); + break; + + case ACPI_MOVE_TYPE_32_TO_32: + ACPI_MOVE_32_TO_32(&((u32 *) destination)[i], + &((u32 *) source)[i]); + break; + + case ACPI_MOVE_TYPE_64_TO_64: + ACPI_MOVE_64_TO_64(&((u64 *) destination)[i], + &((u64 *) source)[i]); + break; + + default: + return; + } + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_info + * + * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * + * RETURN: Pointer to the resource conversion handler + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type) +{ + struct acpi_resource_info *size_info; + + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (resource_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { + return (NULL); + } + + size_info = &acpi_gbl_lg_resource_info[(resource_type & + ACPI_RESOURCE_NAME_LARGE_MASK)]; + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + size_info = &acpi_gbl_sm_resource_info[((resource_type & + ACPI_RESOURCE_NAME_SMALL_MASK) + >> 3)]; + } + + /* Zero entry indicates an invalid resource type */ + + if (!size_info->minimum_internal_struct_length) { + return (NULL); + } + + return (size_info); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte Length + * + * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By + * definition, this does not include the size of the descriptor + * header or the length field itself. + * + ******************************************************************************/ + +u16 acpi_rs_get_resource_length(union aml_resource * aml) +{ + u16 resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_16(&resource_length, + &aml->large_header.resource_length); + + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + resource_length = (u16) (aml->small_header.descriptor_type & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + } + + return (resource_length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_descriptor_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte length + * + * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the + * length of the descriptor header and the length field itself. + * Used to walk descriptor lists. + * + ******************************************************************************/ + +u32 acpi_rs_get_descriptor_length(union aml_resource * aml) +{ + u32 descriptor_length; + + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_32(&descriptor_length, + &aml->large_header.resource_length); + descriptor_length += sizeof(struct aml_resource_large_header); + + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + descriptor_length = (u32) (aml->small_header.descriptor_type & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + descriptor_length += sizeof(struct aml_resource_small_header); + } + + return (descriptor_length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_set_resource_header + * + * PARAMETERS: descriptor_type - Byte to be inserted as the type + * total_length - Length of the AML descriptor, including + * the header and length fields. + * Aml - Pointer to the raw AML descriptor + * + * RETURN: None + * + * DESCRIPTION: Set the descriptor_type and resource_length fields of an AML + * resource descriptor, both Large and Small descriptors are + * supported automatically + * + ******************************************************************************/ + +void +acpi_rs_set_resource_header(u8 descriptor_type, + acpi_size total_length, union aml_resource *aml) +{ + u16 resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* Set the descriptor type */ + + aml->small_header.descriptor_type = descriptor_type; + + /* Determine if this is a small or large resource */ + + if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + resource_length = + (u16) (total_length - + sizeof(struct aml_resource_large_header)); + + /* Insert length into the Large descriptor length field */ + + ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, + &resource_length); + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + resource_length = + (u16) (total_length - + sizeof(struct aml_resource_small_header)); + + /* Insert length into the descriptor type byte */ + + aml->small_header.descriptor_type |= (u8) resource_length; + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_type + * + * PARAMETERS: resource_type - Byte 0 of a resource descriptor + * + * RETURN: The Resource Type with no extraneous bits (except the + * Large/Small descriptor bit -- this is left alone) + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +u8 acpi_rs_get_resource_type(u8 resource_type) +{ + ACPI_FUNCTION_ENTRY(); + + /* Determine if this is a small or large resource */ + + if (resource_type & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + return (resource_type); + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + return ((u8) (resource_type & ACPI_RESOURCE_NAME_SMALL_MASK)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_strcpy + * + * PARAMETERS: Destination - Pointer to the destination string + * Source - Pointer to the source string + * + * RETURN: String length, including NULL terminator + * + * DESCRIPTION: Local string copy that returns the string length, saving a + * strcpy followed by a strlen. + * + ******************************************************************************/ + +static u16 acpi_rs_strcpy(char *destination, char *source) +{ + u16 i; + + ACPI_FUNCTION_ENTRY(); + + for (i = 0; source[i]; i++) { + destination[i] = source[i]; + } + + destination[i] = 0; + + /* Return string length including the NULL terminator */ + + return ((u16) (i + 1)); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_get_resource_source + * + * PARAMETERS: resource_length - Length field of the descriptor + * minimum_length - Minimum length of the descriptor (minus + * any optional fields) + * resource_source - Where the resource_source is returned + * Aml - Pointer to the raw AML descriptor + * string_ptr - (optional) where to store the actual + * resource_source string + * + * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit + * + * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor + * to an internal resource descriptor + * + ******************************************************************************/ + +u16 +acpi_rs_get_resource_source(u16 resource_length, + acpi_size minimum_length, + struct acpi_resource_source * resource_source, + union aml_resource * aml, char *string_ptr) +{ + acpi_size total_length; + u8 *aml_resource_source; + + ACPI_FUNCTION_ENTRY(); + + total_length = + resource_length + sizeof(struct aml_resource_large_header); + aml_resource_source = ((u8 *) aml) + minimum_length; + + /* + * resource_source is present if the length of the descriptor is longer than + * the minimum length. + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the minimum length. + */ + if (total_length > (minimum_length + 1)) { + /* Get the resource_source_index */ + + resource_source->index = aml_resource_source[0]; + + resource_source->string_ptr = string_ptr; + if (!string_ptr) { + /* + * String destination pointer is not specified; Set the String + * pointer to the end of the current resource_source structure. + */ + resource_source->string_ptr = (char *) + ((u8 *) resource_source) + + sizeof(struct acpi_resource_source); + } + + /* Copy the resource_source string to the destination */ + + resource_source->string_length = + acpi_rs_strcpy(resource_source->string_ptr, + (char *)&aml_resource_source[1]); + + /* + * In order for the struct_size to fall on a 32-bit boundary, + * calculate the length of the string and expand the + * struct_size to the next 32-bit boundary. + */ + return ((u16) + ACPI_ROUND_UP_to_32_bITS(resource_source-> + string_length)); + } else { + /* resource_source is not present */ + + resource_source->index = 0; + resource_source->string_length = 0; + resource_source->string_ptr = NULL; + return (0); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_set_resource_source + * + * PARAMETERS: Aml - Pointer to the raw AML descriptor + * minimum_length - Minimum length of the descriptor (minus + * any optional fields) + * resource_source - Internal resource_source + + * + * RETURN: Total length of the AML descriptor + * + * DESCRIPTION: Convert an optoinal resource_source from internal format to a + * raw AML resource descriptor + * + ******************************************************************************/ + +acpi_size +acpi_rs_set_resource_source(union aml_resource * aml, + acpi_size minimum_length, + struct acpi_resource_source * resource_source) +{ + u8 *aml_resource_source; + acpi_size descriptor_length; + + ACPI_FUNCTION_ENTRY(); + + descriptor_length = minimum_length; + + /* Non-zero string length indicates presence of a resource_source */ + + if (resource_source->string_length) { + /* Point to the end of the AML descriptor */ + + aml_resource_source = ((u8 *) aml) + minimum_length; + + /* Copy the resource_source_index */ + + aml_resource_source[0] = (u8) resource_source->index; + + /* Copy the resource_source string */ + + ACPI_STRCPY((char *)&aml_resource_source[1], + resource_source->string_ptr); + + /* + * Add the length of the string (+ 1 for null terminator) to the + * final descriptor length + */ + descriptor_length += + ((acpi_size) resource_source->string_length + 1); + } + + /* Return the new total length of the AML descriptor */ + + return (descriptor_length); +} + /******************************************************************************* * * FUNCTION: acpi_rs_get_prt_method_data @@ -65,8 +497,9 @@ ACPI_MODULE_NAME("rsutils") * and the contents of the callers buffer is undefined. * ******************************************************************************/ + acpi_status -acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) +acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) { union acpi_operand_object *obj_desc; acpi_status status; @@ -284,7 +717,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) * Convert the linked list into a byte stream */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer); + status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 1a87c4c7bd97..9d179beb17ae 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -59,9 +59,9 @@ ACPI_MODULE_NAME("rsxface") ACPI_COPY_FIELD(out, in, max_address_fixed); \ ACPI_COPY_FIELD(out, in, attribute); \ ACPI_COPY_FIELD(out, in, granularity); \ - ACPI_COPY_FIELD(out, in, min_address_range); \ - ACPI_COPY_FIELD(out, in, max_address_range); \ - ACPI_COPY_FIELD(out, in, address_translation_offset); \ + ACPI_COPY_FIELD(out, in, minimum); \ + ACPI_COPY_FIELD(out, in, maximum); \ + ACPI_COPY_FIELD(out, in, translation_offset); \ ACPI_COPY_FIELD(out, in, address_length); \ ACPI_COPY_FIELD(out, in, resource_source); /******************************************************************************* @@ -269,7 +269,7 @@ acpi_walk_resources(acpi_handle device_handle, /* Walk the resource list */ for (;;) { - if (!resource || resource->type == ACPI_RSTYPE_END_TAG) { + if (!resource || resource->type == ACPI_RESOURCE_TYPE_END_TAG) { break; } @@ -382,19 +382,19 @@ acpi_resource_to_address64(struct acpi_resource *resource, struct acpi_resource_address32 *address32; switch (resource->type) { - case ACPI_RSTYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS16: address16 = (struct acpi_resource_address16 *)&resource->data; ACPI_COPY_ADDRESS(out, address16); break; - case ACPI_RSTYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS32: address32 = (struct acpi_resource_address32 *)&resource->data; ACPI_COPY_ADDRESS(out, address32); break; - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS64: /* Simple copy for 64 bit source */ diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index ad0252c2f7db..3cee0cee4cc2 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -251,7 +251,7 @@ acpi_status acpi_tb_get_table_rsdt(void) } ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", + "RSDP located at %p, points to RSDT physical=%8.8X%8.8X\n", acpi_gbl_RSDP, ACPI_FORMAT_UINT64(address.pointer.value))); diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 3b8a7e063e8a..b01a4b2ae7da 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -251,7 +251,7 @@ acpi_get_firmware_table(acpi_string signature, acpi_tb_get_rsdt_address(&address); ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", + "RSDP located at %p, RSDT physical=%8.8X%8.8X\n", acpi_gbl_RSDP, ACPI_FORMAT_UINT64(address.pointer.value))); diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 068450b36475..dc7f24b3a1c0 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -304,7 +304,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) if (!size) { _ACPI_REPORT_ERROR(module, line, component, - ("ut_allocate: Attempt to allocate zero bytes\n")); + ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); size = 1; } @@ -347,8 +347,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) if (!size) { _ACPI_REPORT_ERROR(module, line, component, - ("ut_callocate: Attempt to allocate zero bytes\n")); - return_PTR(NULL); + ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); + size = 1; } allocation = acpi_os_allocate(size); diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 399e64b51886..7f72839841ca 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -825,6 +825,9 @@ void acpi_ut_init_globals(void) acpi_gbl_ps_find_count = 0; acpi_gbl_acpi_hardware_present = TRUE; acpi_gbl_owner_id_mask = 0; + acpi_gbl_trace_method_name = 0; + acpi_gbl_trace_dbg_level = 0; + acpi_gbl_trace_dbg_layer = 0; acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index aa1dcd851f89..b57afa7421e8 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -811,15 +811,15 @@ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) while (buffer < end_buffer) { buffer_byte = *buffer; - if (buffer_byte & ACPI_RDESC_TYPE_LARGE) { + if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) { /* Large Descriptor - Length is next 2 bytes */ buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); } else { /* Small Descriptor. End Tag will be found here */ - if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == - ACPI_RDESC_TYPE_END_TAG) { + if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) == + ACPI_RESOURCE_NAME_END_TAG) { /* Found the end tag descriptor, all done. */ return (buffer); diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 5172d4e1236c..66a2fee06eb9 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -927,9 +927,9 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) if (ACPI_SUCCESS(status)) { unsigned long size; - size = addr.max_address_range - addr.min_address_range + 1; - hdp->hd_phys_address = addr.min_address_range; - hdp->hd_address = ioremap(addr.min_address_range, size); + size = addr.maximum - addr.minimum + 1; + hdp->hd_phys_address = addr.minimum; + hdp->hd_address = ioremap(addr.minimum, size); if (hpet_is_known(hdp)) { printk(KERN_DEBUG "%s: 0x%lx is busy\n", @@ -937,15 +937,15 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) iounmap(hdp->hd_address); return -EBUSY; } - } else if (res->type == ACPI_RSTYPE_FIXED_MEM32) { - struct acpi_resource_fixed_mem32 *fixmem32; + } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) { + struct acpi_resource_fixed_memory32 *fixmem32; fixmem32 = &res->data.fixed_memory32; if (!fixmem32) return -EINVAL; - hdp->hd_phys_address = fixmem32->range_base_address; - hdp->hd_address = ioremap(fixmem32->range_base_address, + hdp->hd_phys_address = fixmem32->address; + hdp->hd_address = ioremap(fixmem32->address, HPET_RANGE_SIZE); if (hpet_is_known(hdp)) { @@ -954,20 +954,20 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) iounmap(hdp->hd_address); return -EBUSY; } - } else if (res->type == ACPI_RSTYPE_EXT_IRQ) { - struct acpi_resource_ext_irq *irqp; + } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { + struct acpi_resource_extended_irq *irqp; int i; irqp = &res->data.extended_irq; - if (irqp->number_of_interrupts > 0) { - hdp->hd_nirqs = irqp->number_of_interrupts; + if (irqp->interrupt_count > 0) { + hdp->hd_nirqs = irqp->interrupt_count; for (i = 0; i < hdp->hd_nirqs; i++) { int rc = acpi_register_gsi(irqp->interrupts[i], - irqp->edge_level, - irqp->active_high_low); + irqp->triggering, + irqp->polarity); if (rc < 0) return AE_ERROR; hdp->hd_irq[i] = rc; diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 15ec05f69ddd..f4adebde6155 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -3,7 +3,7 @@ * * Copyright (c) 2004 Matthieu Castet * Copyright (c) 2004 Li Shaohua - * + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any @@ -32,17 +32,17 @@ /* * Allocated Resources */ -static int irq_flags(int edge_level, int active_high_low) +static int irq_flags(int triggering, int polarity) { int flag; - if (edge_level == ACPI_LEVEL_SENSITIVE) { - if(active_high_low == ACPI_ACTIVE_LOW) + if (triggering == ACPI_LEVEL_SENSITIVE) { + if(polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWLEVEL; else flag = IORESOURCE_IRQ_HIGHLEVEL; } else { - if(active_high_low == ACPI_ACTIVE_LOW) + if(polarity == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWEDGE; else flag = IORESOURCE_IRQ_HIGHEDGE; @@ -50,31 +50,31 @@ static int irq_flags(int edge_level, int active_high_low) return flag; } -static void decode_irq_flags(int flag, int *edge_level, int *active_high_low) +static void decode_irq_flags(int flag, int *triggering, int *polarity) { switch (flag) { case IORESOURCE_IRQ_LOWLEVEL: - *edge_level = ACPI_LEVEL_SENSITIVE; - *active_high_low = ACPI_ACTIVE_LOW; + *triggering = ACPI_LEVEL_SENSITIVE; + *polarity = ACPI_ACTIVE_LOW; break; case IORESOURCE_IRQ_HIGHLEVEL: - *edge_level = ACPI_LEVEL_SENSITIVE; - *active_high_low = ACPI_ACTIVE_HIGH; + *triggering = ACPI_LEVEL_SENSITIVE; + *polarity = ACPI_ACTIVE_HIGH; break; case IORESOURCE_IRQ_LOWEDGE: - *edge_level = ACPI_EDGE_SENSITIVE; - *active_high_low = ACPI_ACTIVE_LOW; + *triggering = ACPI_EDGE_SENSITIVE; + *polarity = ACPI_ACTIVE_LOW; break; case IORESOURCE_IRQ_HIGHEDGE: - *edge_level = ACPI_EDGE_SENSITIVE; - *active_high_low = ACPI_ACTIVE_HIGH; + *triggering = ACPI_EDGE_SENSITIVE; + *polarity = ACPI_ACTIVE_HIGH; break; } } static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, - int edge_level, int active_high_low) + int triggering, int polarity) { int i = 0; int irq; @@ -89,7 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, return; res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag - irq = acpi_register_gsi(gsi, edge_level, active_high_low); + irq = acpi_register_gsi(gsi, triggering, polarity); if (irq < 0) { res->irq_resource[i].flags |= IORESOURCE_DISABLED; return; @@ -164,73 +164,73 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, int i; switch (res->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: /* * Per spec, only one interrupt per descriptor is allowed in * _CRS, but some firmware violates this, so parse them all. */ - for (i = 0; i < res->data.irq.number_of_interrupts; i++) { + for (i = 0; i < res->data.irq.interrupt_count; i++) { pnpacpi_parse_allocated_irqresource(res_table, res->data.irq.interrupts[i], - res->data.irq.edge_level, - res->data.irq.active_high_low); + res->data.irq.triggering, + res->data.irq.polarity); } break; - case ACPI_RSTYPE_EXT_IRQ: - for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) { + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { pnpacpi_parse_allocated_irqresource(res_table, res->data.extended_irq.interrupts[i], - res->data.extended_irq.edge_level, - res->data.extended_irq.active_high_low); + res->data.extended_irq.triggering, + res->data.extended_irq.polarity); } break; - case ACPI_RSTYPE_DMA: - if (res->data.dma.number_of_channels > 0) - pnpacpi_parse_allocated_dmaresource(res_table, + case ACPI_RESOURCE_TYPE_DMA: + if (res->data.dma.channel_count > 0) + pnpacpi_parse_allocated_dmaresource(res_table, res->data.dma.channels[0]); break; - case ACPI_RSTYPE_IO: - pnpacpi_parse_allocated_ioresource(res_table, - res->data.io.min_base_address, - res->data.io.range_length); + case ACPI_RESOURCE_TYPE_IO: + pnpacpi_parse_allocated_ioresource(res_table, + res->data.io.minimum, + res->data.io.address_length); break; - case ACPI_RSTYPE_FIXED_IO: - pnpacpi_parse_allocated_ioresource(res_table, - res->data.fixed_io.base_address, - res->data.fixed_io.range_length); + case ACPI_RESOURCE_TYPE_FIXED_IO: + pnpacpi_parse_allocated_ioresource(res_table, + res->data.fixed_io.address, + res->data.fixed_io.address_length); break; - case ACPI_RSTYPE_MEM24: - pnpacpi_parse_allocated_memresource(res_table, - res->data.memory24.min_base_address, - res->data.memory24.range_length); + case ACPI_RESOURCE_TYPE_MEMORY24: + pnpacpi_parse_allocated_memresource(res_table, + res->data.memory24.minimum, + res->data.memory24.address_length); break; - case ACPI_RSTYPE_MEM32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.memory32.min_base_address, - res->data.memory32.range_length); + case ACPI_RESOURCE_TYPE_MEMORY32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.memory32.minimum, + res->data.memory32.address_length); break; - case ACPI_RSTYPE_FIXED_MEM32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.fixed_memory32.range_base_address, - res->data.fixed_memory32.range_length); + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.fixed_memory32.address, + res->data.fixed_memory32.address_length); break; - case ACPI_RSTYPE_ADDRESS16: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address16.min_address_range, + case ACPI_RESOURCE_TYPE_ADDRESS16: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address16.minimum, res->data.address16.address_length); break; - case ACPI_RSTYPE_ADDRESS32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address32.min_address_range, + case ACPI_RESOURCE_TYPE_ADDRESS32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address32.minimum, res->data.address32.address_length); break; - case ACPI_RSTYPE_ADDRESS64: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address64.min_address_range, + case ACPI_RESOURCE_TYPE_ADDRESS64: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address64.minimum, res->data.address64.address_length); break; - case ACPI_RSTYPE_VENDOR: + case ACPI_RESOURCE_TYPE_VENDOR: break; default: pnp_warn("PnPACPI: unknown resource type %d", res->type); @@ -253,13 +253,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso int i; struct pnp_dma * dma; - if (p->number_of_channels == 0) + if (p->channel_count == 0) return; dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); if (!dma) return; - for(i = 0; i < p->number_of_channels; i++) + for(i = 0; i < p->channel_count; i++) dma->map |= 1 << p->channels[i]; dma->flags = 0; if (p->bus_master) @@ -309,37 +309,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option, int i; struct pnp_irq * irq; - if (p->number_of_interrupts == 0) + if (p->interrupt_count == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; - for(i = 0; i < p->number_of_interrupts; i++) + for(i = 0; i < p->interrupt_count; i++) if (p->interrupts[i]) __set_bit(p->interrupts[i], irq->map); - irq->flags = irq_flags(p->edge_level, p->active_high_low); + irq->flags = irq_flags(p->triggering, p->polarity); pnp_register_irq_resource(option, irq); return; } static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, - struct acpi_resource_ext_irq *p) + struct acpi_resource_extended_irq *p) { int i; struct pnp_irq * irq; - if (p->number_of_interrupts == 0) + if (p->interrupt_count == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; - for(i = 0; i < p->number_of_interrupts; i++) + for(i = 0; i < p->interrupt_count; i++) if (p->interrupts[i]) __set_bit(p->interrupts[i], irq->map); - irq->flags = irq_flags(p->edge_level, p->active_high_low); + irq->flags = irq_flags(p->triggering, p->polarity); pnp_register_irq_resource(option, irq); return; @@ -351,16 +351,16 @@ pnpacpi_parse_port_option(struct pnp_option *option, { struct pnp_port * port; - if (io->range_length == 0) + if (io->address_length == 0) return; port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; - port->min = io->min_base_address; - port->max = io->max_base_address; + port->min = io->minimum; + port->max = io->maximum; port->align = io->alignment; - port->size = io->range_length; - port->flags = ACPI_DECODE_16 == io->io_decode ? + port->size = io->address_length; + port->flags = ACPI_DECODE_16 == io->io_decode ? PNP_PORT_FLAG_16BITADDR : 0; pnp_register_port_resource(option,port); return; @@ -372,13 +372,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, { struct pnp_port * port; - if (io->range_length == 0) + if (io->address_length == 0) return; port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; - port->min = port->max = io->base_address; - port->size = io->range_length; + port->min = port->max = io->address; + port->size = io->address_length; port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; pnp_register_port_resource(option,port); @@ -387,19 +387,19 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, static void pnpacpi_parse_mem24_option(struct pnp_option *option, - struct acpi_resource_mem24 *p) + struct acpi_resource_memory24 *p) { struct pnp_mem * mem; - if (p->range_length == 0) + if (p->address_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = p->min_base_address; - mem->max = p->max_base_address; + mem->min = p->minimum; + mem->max = p->maximum; mem->align = p->alignment; - mem->size = p->range_length; + mem->size = p->address_length; mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? IORESOURCE_MEM_WRITEABLE : 0; @@ -410,19 +410,19 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, static void pnpacpi_parse_mem32_option(struct pnp_option *option, - struct acpi_resource_mem32 *p) + struct acpi_resource_memory32 *p) { struct pnp_mem * mem; - if (p->range_length == 0) + if (p->address_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = p->min_base_address; - mem->max = p->max_base_address; + mem->min = p->minimum; + mem->max = p->maximum; mem->align = p->alignment; - mem->size = p->range_length; + mem->size = p->address_length; mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? IORESOURCE_MEM_WRITEABLE : 0; @@ -433,17 +433,17 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, static void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, - struct acpi_resource_fixed_mem32 *p) + struct acpi_resource_fixed_memory32 *p) { struct pnp_mem * mem; - if (p->range_length == 0) + if (p->address_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = mem->max = p->range_base_address; - mem->size = p->range_length; + mem->min = mem->max = p->address; + mem->size = p->address_length; mem->align = 0; mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? @@ -459,7 +459,7 @@ struct acpipnp_parse_option_s { struct pnp_dev *dev; }; -static acpi_status pnpacpi_option_resource(struct acpi_resource *res, +static acpi_status pnpacpi_option_resource(struct acpi_resource *res, void *data) { int priority = 0; @@ -468,34 +468,34 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, struct pnp_option *option = parse_data->option; switch (res->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: pnpacpi_parse_irq_option(option, &res->data.irq); break; - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: pnpacpi_parse_ext_irq_option(option, &res->data.extended_irq); break; - case ACPI_RSTYPE_DMA: + case ACPI_RESOURCE_TYPE_DMA: pnpacpi_parse_dma_option(option, &res->data.dma); break; - case ACPI_RSTYPE_IO: + case ACPI_RESOURCE_TYPE_IO: pnpacpi_parse_port_option(option, &res->data.io); break; - case ACPI_RSTYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: pnpacpi_parse_fixed_port_option(option, &res->data.fixed_io); break; - case ACPI_RSTYPE_MEM24: + case ACPI_RESOURCE_TYPE_MEMORY24: pnpacpi_parse_mem24_option(option, &res->data.memory24); break; - case ACPI_RSTYPE_MEM32: + case ACPI_RESOURCE_TYPE_MEMORY32: pnpacpi_parse_mem32_option(option, &res->data.memory32); break; - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: pnpacpi_parse_fixed_mem32_option(option, &res->data.fixed_memory32); break; - case ACPI_RSTYPE_START_DPF: + case ACPI_RESOURCE_TYPE_START_DEPENDENT: switch (res->data.start_dpf.compatibility_priority) { case ACPI_GOOD_CONFIGURATION: priority = PNP_RES_PRIORITY_PREFERRED; @@ -518,7 +518,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, return AE_ERROR; parse_data->option = option; break; - case ACPI_RSTYPE_END_DPF: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: /*only one EndDependentFn is allowed*/ if (!parse_data->option_independent) { pnp_warn("PnPACPI: more than one EndDependentFn"); @@ -535,7 +535,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, return AE_OK; } -acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, +acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, struct pnp_dev *dev) { acpi_status status; @@ -546,7 +546,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, return AE_ERROR; parse_data.option_independent = parse_data.option; parse_data.dev = dev; - status = acpi_walk_resources(handle, METHOD_NAME__PRS, + status = acpi_walk_resources(handle, METHOD_NAME__PRS, pnpacpi_option_resource, &parse_data); return status; @@ -560,18 +560,18 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, { int *res_cnt = (int *)data; switch (res->type) { - case ACPI_RSTYPE_IRQ: - case ACPI_RSTYPE_EXT_IRQ: - case ACPI_RSTYPE_DMA: - case ACPI_RSTYPE_IO: - case ACPI_RSTYPE_FIXED_IO: - case ACPI_RSTYPE_MEM24: - case ACPI_RSTYPE_MEM32: - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + case ACPI_RESOURCE_TYPE_DMA: + case ACPI_RESOURCE_TYPE_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_MEMORY24: + case ACPI_RESOURCE_TYPE_MEMORY32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: #if 0 - case ACPI_RSTYPE_ADDRESS16: - case ACPI_RSTYPE_ADDRESS32: - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: #endif (*res_cnt) ++; default: @@ -585,18 +585,18 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, { struct acpi_resource **resource = (struct acpi_resource **)data; switch (res->type) { - case ACPI_RSTYPE_IRQ: - case ACPI_RSTYPE_EXT_IRQ: - case ACPI_RSTYPE_DMA: - case ACPI_RSTYPE_IO: - case ACPI_RSTYPE_FIXED_IO: - case ACPI_RSTYPE_MEM24: - case ACPI_RSTYPE_MEM32: - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + case ACPI_RESOURCE_TYPE_DMA: + case ACPI_RESOURCE_TYPE_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_MEMORY24: + case ACPI_RESOURCE_TYPE_MEMORY32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: #if 0 - case ACPI_RSTYPE_ADDRESS16: - case ACPI_RSTYPE_ADDRESS32: - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS64: #endif (*resource)->type = res->type; (*resource)++; @@ -607,14 +607,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, return AE_OK; } -int pnpacpi_build_resource_template(acpi_handle handle, +int pnpacpi_build_resource_template(acpi_handle handle, struct acpi_buffer *buffer) { struct acpi_resource *resource; int res_cnt = 0; acpi_status status; - status = acpi_walk_resources(handle, METHOD_NAME__CRS, + status = acpi_walk_resources(handle, METHOD_NAME__CRS, pnpacpi_count_resources, &res_cnt); if (ACPI_FAILURE(status)) { pnp_err("Evaluate _CRS failed"); @@ -628,7 +628,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, return -ENOMEM; pnp_dbg("Res cnt %d", res_cnt); resource = (struct acpi_resource *)buffer->pointer; - status = acpi_walk_resources(handle, METHOD_NAME__CRS, + status = acpi_walk_resources(handle, METHOD_NAME__CRS, pnpacpi_type_resources, &resource); if (ACPI_FAILURE(status)) { kfree(buffer->pointer); @@ -636,54 +636,54 @@ int pnpacpi_build_resource_template(acpi_handle handle, return -EINVAL; } /* resource will pointer the end resource now */ - resource->type = ACPI_RSTYPE_END_TAG; + resource->type = ACPI_RESOURCE_TYPE_END_TAG; return 0; } -static void pnpacpi_encode_irq(struct acpi_resource *resource, +static void pnpacpi_encode_irq(struct acpi_resource *resource, struct resource *p) { - int edge_level, active_high_low; + int triggering, polarity; - decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, - &active_high_low); - resource->type = ACPI_RSTYPE_IRQ; + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, + &polarity); + resource->type = ACPI_RESOURCE_TYPE_IRQ; resource->length = sizeof(struct acpi_resource); - resource->data.irq.edge_level = edge_level; - resource->data.irq.active_high_low = active_high_low; - if (edge_level == ACPI_EDGE_SENSITIVE) - resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->data.irq.triggering = triggering; + resource->data.irq.polarity = polarity; + if (triggering == ACPI_EDGE_SENSITIVE) + resource->data.irq.sharable = ACPI_EXCLUSIVE; else - resource->data.irq.shared_exclusive = ACPI_SHARED; - resource->data.irq.number_of_interrupts = 1; + resource->data.irq.sharable = ACPI_SHARED; + resource->data.irq.interrupt_count = 1; resource->data.irq.interrupts[0] = p->start; } static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, struct resource *p) { - int edge_level, active_high_low; + int triggering, polarity; - decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, - &active_high_low); - resource->type = ACPI_RSTYPE_EXT_IRQ; + decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, + &polarity); + resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; resource->length = sizeof(struct acpi_resource); resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; - resource->data.extended_irq.edge_level = edge_level; - resource->data.extended_irq.active_high_low = active_high_low; - if (edge_level == ACPI_EDGE_SENSITIVE) - resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; + resource->data.extended_irq.triggering = triggering; + resource->data.extended_irq.polarity = polarity; + if (triggering == ACPI_EDGE_SENSITIVE) + resource->data.irq.sharable = ACPI_EXCLUSIVE; else - resource->data.irq.shared_exclusive = ACPI_SHARED; - resource->data.extended_irq.number_of_interrupts = 1; + resource->data.irq.sharable = ACPI_SHARED; + resource->data.extended_irq.interrupt_count = 1; resource->data.extended_irq.interrupts[0] = p->start; } static void pnpacpi_encode_dma(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_DMA; + resource->type = ACPI_RESOURCE_TYPE_DMA; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ if (p->flags & IORESOURCE_DMA_COMPATIBLE) @@ -701,75 +701,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, else if (p->flags & IORESOURCE_DMA_16BIT) resource->data.dma.transfer = ACPI_TRANSFER_16; resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; - resource->data.dma.number_of_channels = 1; + resource->data.dma.channel_count = 1; resource->data.dma.channels[0] = p->start; } static void pnpacpi_encode_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_IO; + resource->type = ACPI_RESOURCE_TYPE_IO; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? - ACPI_DECODE_16 : ACPI_DECODE_10; - resource->data.io.min_base_address = p->start; - resource->data.io.max_base_address = p->end; + ACPI_DECODE_16 : ACPI_DECODE_10; + resource->data.io.minimum = p->start; + resource->data.io.maximum = p->end; resource->data.io.alignment = 0; /* Correct? */ - resource->data.io.range_length = p->end - p->start + 1; + resource->data.io.address_length = p->end - p->start + 1; } static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_FIXED_IO; + resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; resource->length = sizeof(struct acpi_resource); - resource->data.fixed_io.base_address = p->start; - resource->data.fixed_io.range_length = p->end - p->start + 1; + resource->data.fixed_io.address = p->start; + resource->data.fixed_io.address_length = p->end - p->start + 1; } static void pnpacpi_encode_mem24(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_MEM24; + resource->type = ACPI_RESOURCE_TYPE_MEMORY24; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ resource->data.memory24.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.memory24.min_base_address = p->start; - resource->data.memory24.max_base_address = p->end; + resource->data.memory24.minimum = p->start; + resource->data.memory24.maximum = p->end; resource->data.memory24.alignment = 0; - resource->data.memory24.range_length = p->end - p->start + 1; + resource->data.memory24.address_length = p->end - p->start + 1; } static void pnpacpi_encode_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_MEM32; + resource->type = ACPI_RESOURCE_TYPE_MEMORY32; resource->length = sizeof(struct acpi_resource); resource->data.memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.memory32.min_base_address = p->start; - resource->data.memory32.max_base_address = p->end; + resource->data.memory32.minimum = p->start; + resource->data.memory32.maximum = p->end; resource->data.memory32.alignment = 0; - resource->data.memory32.range_length = p->end - p->start + 1; + resource->data.memory32.address_length = p->end - p->start + 1; } static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RSTYPE_FIXED_MEM32; + resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; resource->length = sizeof(struct acpi_resource); resource->data.fixed_memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.fixed_memory32.range_base_address = p->start; - resource->data.fixed_memory32.range_length = p->end - p->start + 1; + resource->data.fixed_memory32.address = p->start; + resource->data.fixed_memory32.address_length = p->end - p->start + 1; } -int pnpacpi_encode_resources(struct pnp_resource_table *res_table, +int pnpacpi_encode_resources(struct pnp_resource_table *res_table, struct acpi_buffer *buffer) { int i = 0; @@ -781,50 +781,50 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, pnp_dbg("res cnt %d", res_cnt); while (i < res_cnt) { switch(resource->type) { - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: pnp_dbg("Encode irq"); - pnpacpi_encode_irq(resource, + pnpacpi_encode_irq(resource, &res_table->irq_resource[irq]); irq++; break; - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: pnp_dbg("Encode ext irq"); - pnpacpi_encode_ext_irq(resource, + pnpacpi_encode_ext_irq(resource, &res_table->irq_resource[irq]); irq++; break; - case ACPI_RSTYPE_DMA: + case ACPI_RESOURCE_TYPE_DMA: pnp_dbg("Encode dma"); - pnpacpi_encode_dma(resource, + pnpacpi_encode_dma(resource, &res_table->dma_resource[dma]); dma ++; break; - case ACPI_RSTYPE_IO: + case ACPI_RESOURCE_TYPE_IO: pnp_dbg("Encode io"); - pnpacpi_encode_io(resource, + pnpacpi_encode_io(resource, &res_table->port_resource[port]); port ++; break; - case ACPI_RSTYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: pnp_dbg("Encode fixed io"); pnpacpi_encode_fixed_io(resource, &res_table->port_resource[port]); port ++; break; - case ACPI_RSTYPE_MEM24: + case ACPI_RESOURCE_TYPE_MEMORY24: pnp_dbg("Encode mem24"); pnpacpi_encode_mem24(resource, &res_table->mem_resource[mem]); mem ++; break; - case ACPI_RSTYPE_MEM32: + case ACPI_RESOURCE_TYPE_MEMORY32: pnp_dbg("Encode mem32"); pnpacpi_encode_mem32(resource, &res_table->mem_resource[mem]); mem ++; break; - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: pnp_dbg("Encode fixed mem32"); pnpacpi_encode_fixed_mem32(resource, &res_table->mem_resource[mem]); diff --git a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c index 36681ba7b033..809f89ab965c 100644 --- a/drivers/serial/8250_acpi.c +++ b/drivers/serial/8250_acpi.c @@ -27,7 +27,7 @@ struct serial_private { static acpi_status acpi_serial_mmio(struct uart_port *port, struct acpi_resource_address64 *addr) { - port->mapbase = addr->min_address_range; + port->mapbase = addr->minimum; port->iotype = UPIO_MEM; port->flags |= UPF_IOREMAP; return AE_OK; @@ -36,8 +36,8 @@ static acpi_status acpi_serial_mmio(struct uart_port *port, static acpi_status acpi_serial_port(struct uart_port *port, struct acpi_resource_io *io) { - if (io->range_length) { - port->iobase = io->min_base_address; + if (io->address_length) { + port->iobase = io->minimum; port->iotype = UPIO_PORT; } else printk(KERN_ERR "%s: zero-length IO port range?\n", __FUNCTION__); @@ -45,13 +45,13 @@ static acpi_status acpi_serial_port(struct uart_port *port, } static acpi_status acpi_serial_ext_irq(struct uart_port *port, - struct acpi_resource_ext_irq *ext_irq) + struct acpi_resource_extended_irq *ext_irq) { int rc; - if (ext_irq->number_of_interrupts > 0) { + if (ext_irq->interrupt_count > 0) { rc = acpi_register_gsi(ext_irq->interrupts[0], - ext_irq->edge_level, ext_irq->active_high_low); + ext_irq->triggering, ext_irq->polarity); if (rc < 0) return AE_ERROR; port->irq = rc; @@ -64,9 +64,9 @@ static acpi_status acpi_serial_irq(struct uart_port *port, { int rc; - if (irq->number_of_interrupts > 0) { + if (irq->interrupt_count > 0) { rc = acpi_register_gsi(irq->interrupts[0], - irq->edge_level, irq->active_high_low); + irq->triggering, irq->polarity); if (rc < 0) return AE_ERROR; port->irq = rc; @@ -83,11 +83,11 @@ static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data) status = acpi_resource_to_address64(res, &addr); if (ACPI_SUCCESS(status)) return acpi_serial_mmio(port, &addr); - else if (res->type == ACPI_RSTYPE_IO) + else if (res->type == ACPI_RESOURCE_TYPE_IO) return acpi_serial_port(port, &res->data.io); - else if (res->type == ACPI_RSTYPE_EXT_IRQ) + else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) return acpi_serial_ext_irq(port, &res->data.extended_irq); - else if (res->type == ACPI_RSTYPE_IRQ) + else if (res->type == ACPI_RESOURCE_TYPE_IRQ) return acpi_serial_irq(port, &res->data.irq); return AE_OK; } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 1427c5cf4304..cb59b018c84c 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* 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, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 759b4cff4f88..b2921b869bb4 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -187,73 +187,67 @@ void acpi_dm_decode_attribute(u8 attribute); * dmresrcl */ void -acpi_dm_word_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_dword_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_extended_descriptor(union asl_resource_desc *resource, +acpi_dm_extended_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_qword_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_memory24_descriptor(union asl_resource_desc *resource, +acpi_dm_memory24_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_memory32_descriptor(union asl_resource_desc *resource, +acpi_dm_memory32_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_fixed_memory32_descriptor(union asl_resource_desc *resource, +acpi_dm_fixed_memory32_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_generic_register_descriptor(union asl_resource_desc *resource, +acpi_dm_generic_register_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_interrupt_descriptor(union asl_resource_desc *resource, +acpi_dm_interrupt_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_vendor_large_descriptor(union asl_resource_desc *resource, +acpi_dm_vendor_large_descriptor(union aml_resource *resource, u32 length, u32 level); /* * dmresrcs */ void -acpi_dm_irq_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_dma_descriptor(union asl_resource_desc *resource, - u32 length, u32 level); +acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level); -void -acpi_dm_io_descriptor(union asl_resource_desc *resource, u32 length, u32 level); +void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_fixed_io_descriptor(union asl_resource_desc *resource, +acpi_dm_fixed_io_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_start_dependent_descriptor(union asl_resource_desc *resource, +acpi_dm_start_dependent_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_end_dependent_descriptor(union asl_resource_desc *resource, +acpi_dm_end_dependent_descriptor(union aml_resource *resource, u32 length, u32 level); void -acpi_dm_vendor_small_descriptor(union asl_resource_desc *resource, +acpi_dm_vendor_small_descriptor(union aml_resource *resource, u32 length, u32 level); /* diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index e9c2790139ec..cef51b1ddf94 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -80,6 +80,15 @@ extern u32 acpi_dbg_layer; extern u32 acpi_gbl_nesting_level; +/* Support for dynamic control method tracing mechanism */ + +ACPI_EXTERN u32 acpi_gbl_original_dbg_level; +ACPI_EXTERN u32 acpi_gbl_original_dbg_layer; +ACPI_EXTERN acpi_name acpi_gbl_trace_method_name; +ACPI_EXTERN u32 acpi_gbl_trace_dbg_level; +ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; +ACPI_EXTERN u32 acpi_gbl_trace_flags; + /***************************************************************************** * * Runtime configuration (static defaults that can be overriden at runtime) diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 76ac1533c405..dca0d40ea395 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -735,59 +735,52 @@ struct acpi_bit_register_info { /* resource_type values */ -#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 -#define ACPI_RESOURCE_TYPE_IO_RANGE 1 -#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 +#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 +#define ACPI_ADDRESS_TYPE_IO_RANGE 1 +#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 /* Resource descriptor types and masks */ -#define ACPI_RDESC_TYPE_LARGE 0x80 -#define ACPI_RDESC_TYPE_SMALL 0x00 +#define ACPI_RESOURCE_NAME_LARGE 0x80 +#define ACPI_RESOURCE_NAME_SMALL 0x00 -#define ACPI_RDESC_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ -#define ACPI_RDESC_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ -#define ACPI_RDESC_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ +#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ +#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ +#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ /* - * Small resource descriptor types + * Small resource descriptor "names" as defined by the ACPI specification. * Note: Bits 2:0 are used for the descriptor length */ -#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 -#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 -#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 -#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 -#define ACPI_RDESC_TYPE_IO_PORT 0x40 -#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 -#define ACPI_RDESC_TYPE_RESERVED_S1 0x50 -#define ACPI_RDESC_TYPE_RESERVED_S2 0x58 -#define ACPI_RDESC_TYPE_RESERVED_S3 0x60 -#define ACPI_RDESC_TYPE_RESERVED_S4 0x68 -#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 -#define ACPI_RDESC_TYPE_END_TAG 0x78 +#define ACPI_RESOURCE_NAME_IRQ 0x20 +#define ACPI_RESOURCE_NAME_DMA 0x28 +#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 +#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 +#define ACPI_RESOURCE_NAME_IO 0x40 +#define ACPI_RESOURCE_NAME_FIXED_IO 0x48 +#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 +#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 +#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 +#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 +#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 +#define ACPI_RESOURCE_NAME_END_TAG 0x78 /* - * Large resource descriptor types + * Large resource descriptor "names" as defined by the ACPI specification. + * Note: includes the Large Descriptor bit in bit[7] */ -#define ACPI_RDESC_TYPE_MEMORY_24 0x81 -#define ACPI_RDESC_TYPE_GENERIC_REGISTER 0x82 -#define ACPI_RDESC_TYPE_RESERVED_L1 0x83 -#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 -#define ACPI_RDESC_TYPE_MEMORY_32 0x85 -#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 -#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 -#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 -#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 -#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A -#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B -#define ACPI_RDESC_LARGE_MAX 0x8B - -/* - * Minimum lengths for descriptors with optional fields - */ -#define ACPI_RDESC_QWORD_MIN 43 -#define ACPI_RDESC_DWORD_MIN 23 -#define ACPI_RDESC_WORD_MIN 13 -#define ACPI_RDESC_EXT_XRUPT_MIN 6 +#define ACPI_RESOURCE_NAME_MEMORY24 0x81 +#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 +#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 +#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 +#define ACPI_RESOURCE_NAME_MEMORY32 0x85 +#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 +#define ACPI_RESOURCE_NAME_ADDRESS32 0x87 +#define ACPI_RESOURCE_NAME_ADDRESS16 0x88 +#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 +#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A +#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B +#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B /***************************************************************************** * @@ -795,7 +788,7 @@ struct acpi_bit_register_info { * ****************************************************************************/ -#define ACPI_ASCII_ZERO 0x30 +#define ACPI_ASCII_ZERO 0x30 /***************************************************************************** * diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 702cc4e57f5f..258cfe5e2aac 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -525,6 +525,9 @@ * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros * so that "_acpi_function_name" is defined. + * + * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining + * about these constructs. */ #ifdef ACPI_USE_DO_WHILE_0 #define ACPI_DO_WHILE0(a) do a while(0) @@ -532,10 +535,55 @@ #define ACPI_DO_WHILE0(a) a #endif -#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) -#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) -#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) -#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) +#define return_VOID ACPI_DO_WHILE0 ({ \ + acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ + return;}) +/* + * There are two versions of most of the return macros. The default version is + * safer, since it avoids side-effects by guaranteeing that the argument will + * not be evaluated twice. + * + * A less-safe version of the macros is provided for optional use if the + * compiler uses excessive CPU stack (for example, this may happen in the + * debug case if code optimzation is disabled.) + */ +#ifndef ACPI_SIMPLE_RETURN_MACROS + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + register acpi_status _s = (s); \ + acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + register void *_s = (void *) (s); \ + acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ + return (_s); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + register acpi_integer _s = (s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT8(s) ACPI_DO_WHILE0 ({ \ + register u8 _s = (u8) (s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ + register u32 _s = (u32) (s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#else /* Use original less-safe macros */ + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ + return((s)); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ + return((s)); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ + return((s)); }) +#define return_UINT8(s) return_VALUE(s) +#define return_UINT32(s) return_VALUE(s) + +#endif /* ACPI_SIMPLE_RETURN_MACROS */ /* Conditional execution */ @@ -612,6 +660,8 @@ #define return_VOID return #define return_ACPI_STATUS(s) return(s) #define return_VALUE(s) return(s) +#define return_UINT8(s) return(s) +#define return_UINT32(s) return(s) #define return_PTR(s) return(s) #endif diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index c1b4e1f882e4..b425f9bb6d43 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -52,8 +52,8 @@ /* ACPI PCI Interrupt Link (pci_link.c) */ int acpi_irq_penalty_init(void); -int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level, - int *active_high_low, char **name); +int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, + int *polarity, char **name); int acpi_pci_link_free_irq(acpi_handle handle); /* ACPI PCI Interrupt Routing (pci_irq.c) */ diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 2a9dbc13b0f2..02f00a8fee03 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -149,6 +149,9 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler); acpi_status acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); +acpi_status +acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); + /* * Object manipulation and enumeration */ diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index ce2cf72fd4c8..b66994e9e4ee 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -44,6 +44,51 @@ #ifndef __ACRESRC_H__ #define __ACRESRC_H__ +/* Need the AML resource descriptor structs */ + +#include "amlresrc.h" + +/* + * Resource dispatch and info tables + */ +struct acpi_resource_info { + u8 length_type; + u8 minimum_aml_resource_length; + u8 minimum_internal_struct_length; +}; + +/* Types for length_type above */ + +#define ACPI_FIXED_LENGTH 0 +#define ACPI_VARIABLE_LENGTH 1 +#define ACPI_SMALL_VARIABLE_LENGTH 2 + +/* Handlers */ + +typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource * + resource, + union aml_resource * aml); + +typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml, + u16 aml_resource_length, + struct acpi_resource * + resource); + +typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data); + +/* Tables indexed by internal resource type */ + +extern u8 acpi_gbl_aml_resource_sizes[]; +extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[]; +extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[]; + +/* Tables indexed by raw AML resource descriptor type */ + +extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; +extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; +extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[]; +extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[]; + /* * Function prototypes called from Acpi* APIs */ @@ -66,12 +111,12 @@ acpi_status acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); acpi_status -acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, +acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, struct acpi_buffer *output_buffer); acpi_status -acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer); +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer); acpi_status acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, @@ -90,184 +135,240 @@ void acpi_rs_dump_irq_list(u8 * route_table); * rscalc */ acpi_status -acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, - u8 ** byte_stream_start, u32 * size); - -acpi_status -acpi_rs_get_list_length(u8 * byte_stream_buffer, - u32 byte_stream_buffer_length, acpi_size * size_needed); +acpi_rs_get_list_length(u8 * aml_buffer, + u32 aml_buffer_length, acpi_size * size_needed); acpi_status -acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, - acpi_size * size_needed); +acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer, + acpi_size * size_needed); acpi_status acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, acpi_size * buffer_size_needed); acpi_status -acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, - u32 byte_stream_buffer_length, u8 * output_buffer); +acpi_rs_convert_aml_to_resources(u8 * aml_buffer, + u32 aml_buffer_length, u8 * output_buffer); acpi_status -acpi_rs_list_to_byte_stream(struct acpi_resource *resource, - acpi_size byte_stream_size_needed, - u8 * output_buffer); +acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, + acpi_size aml_size_needed, u8 * output_buffer); +/* + * rsio + */ acpi_status -acpi_rs_io_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_fixed_io(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_fixed_io_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_dma(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml); +/* + * rsirq + */ acpi_status -acpi_rs_dma_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_dma_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_address16_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_ext_irq(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_address16_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml); + +/* + * rsaddr + */ +acpi_status +acpi_rs_get_address16(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_address32_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_address32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_address32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_address64_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_address64_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_address64(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); +acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml); + +acpi_status +acpi_rs_get_ext_address64(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource); + +acpi_status +acpi_rs_set_ext_address64(struct acpi_resource *resource, + union aml_resource *aml); + +/* + * rsmemory + */ +acpi_status +acpi_rs_get_memory24(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); +acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, - acpi_size * bytes_consumed); +acpi_rs_get_memory32(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_memory24_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_fixed_memory32(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource); acpi_status -acpi_rs_memory24_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_fixed_memory32(struct acpi_resource *resource, + union aml_resource *aml); +/* + * rsmisc + */ acpi_status -acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); +acpi_rs_get_generic_reg(union aml_resource *aml, + u16 aml_resource_length, + struct acpi_resource *resource); acpi_status -acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); +acpi_rs_set_generic_reg(struct acpi_resource *resource, + union aml_resource *aml); acpi_status -acpi_rs_memory32_range_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_get_vendor(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_start_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_extended_irq_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_end_tag_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_end_dpf(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_end_tag_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml); acpi_status -acpi_rs_vendor_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, acpi_size * structure_size); +acpi_rs_get_end_tag(union aml_resource *aml, + u16 aml_resource_length, struct acpi_resource *resource); acpi_status -acpi_rs_vendor_stream(struct acpi_resource *resource, - u8 ** output_buffer, acpi_size * bytes_consumed); +acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml); + +/* + * rsutils + */ +void +acpi_rs_move_data(void *destination, + void *source, u16 item_count, u8 move_type); + +/* Types used in move_type above */ + +#define ACPI_MOVE_TYPE_16_TO_32 0 +#define ACPI_MOVE_TYPE_32_TO_16 1 +#define ACPI_MOVE_TYPE_32_TO_32 2 +#define ACPI_MOVE_TYPE_64_TO_64 3 + +u16 +acpi_rs_get_resource_source(u16 resource_length, + acpi_size minimum_length, + struct acpi_resource_source *resource_source, + union aml_resource *aml, char *string_ptr); + +acpi_size +acpi_rs_set_resource_source(union aml_resource *aml, + acpi_size minimum_length, + struct acpi_resource_source *resource_source); u8 acpi_rs_get_resource_type(u8 resource_start_byte); +u32 acpi_rs_get_descriptor_length(union aml_resource *aml); + +u16 acpi_rs_get_resource_length(union aml_resource *aml); + +void +acpi_rs_set_resource_header(u8 descriptor_type, + acpi_size total_length, union aml_resource *aml); + +struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* - * rsmisc + * rsdump */ -acpi_status -acpi_rs_generic_register_resource(u8 * byte_stream_buffer, - acpi_size * bytes_consumed, - u8 ** output_buffer, - acpi_size * structure_size); +void acpi_rs_dump_irq(union acpi_resource_data *resource); -acpi_status -acpi_rs_generic_register_stream(struct acpi_resource *resource, - u8 ** output_buffer, - acpi_size * bytes_consumed); +void acpi_rs_dump_address16(union acpi_resource_data *resource); + +void acpi_rs_dump_address32(union acpi_resource_data *resource); + +void acpi_rs_dump_address64(union acpi_resource_data *resource); + +void acpi_rs_dump_ext_address64(union acpi_resource_data *resource); + +void acpi_rs_dump_dma(union acpi_resource_data *resource); + +void acpi_rs_dump_io(union acpi_resource_data *resource); + +void acpi_rs_dump_ext_irq(union acpi_resource_data *resource); + +void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); + +void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); + +void acpi_rs_dump_memory24(union acpi_resource_data *resource); + +void acpi_rs_dump_memory32(union acpi_resource_data *resource); + +void acpi_rs_dump_start_dpf(union acpi_resource_data *resource); + +void acpi_rs_dump_vendor(union acpi_resource_data *resource); + +void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); + +void acpi_rs_dump_end_dpf(union acpi_resource_data *resource); + +void acpi_rs_dump_end_tag(union acpi_resource_data *resource); + +#endif #endif /* __ACRESRC_H__ */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 1dfa64fae4ec..43f7c509317a 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -978,10 +978,10 @@ struct acpi_mem_space_context { * Structures used to describe device resources */ struct acpi_resource_irq { - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; + u32 triggering; + u32 polarity; + u32 sharable; + u32 interrupt_count; u32 interrupts[1]; }; @@ -989,11 +989,11 @@ struct acpi_resource_dma { u32 type; u32 bus_master; u32 transfer; - u32 number_of_channels; + u32 channel_count; u32 channels[1]; }; -struct acpi_resource_start_dpf { +struct acpi_resource_start_dependent { u32 compatibility_priority; u32 performance_robustness; }; @@ -1005,46 +1005,46 @@ struct acpi_resource_start_dpf { struct acpi_resource_io { u32 io_decode; - u32 min_base_address; - u32 max_base_address; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; struct acpi_resource_fixed_io { - u32 base_address; - u32 range_length; + u32 address; + u32 address_length; }; struct acpi_resource_vendor { - u32 length; - u8 reserved[1]; + u32 byte_length; + u8 byte_data[1]; }; struct acpi_resource_end_tag { u8 checksum; }; -struct acpi_resource_mem24 { +struct acpi_resource_memory24 { u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; -struct acpi_resource_mem32 { +struct acpi_resource_memory32 { u32 read_write_attribute; - u32 min_base_address; - u32 max_base_address; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; -struct acpi_resource_fixed_mem32 { +struct acpi_resource_fixed_memory32 { u32 read_write_attribute; - u32 range_base_address; - u32 range_length; + u32 address; + u32 address_length; }; struct acpi_memory_attribute { @@ -1089,93 +1089,105 @@ ACPI_RESOURCE_ADDRESS_COMMON}; struct acpi_resource_address16 { ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; + u32 minimum; + u32 maximum; + u32 translation_offset; u32 address_length; struct acpi_resource_source resource_source; }; struct acpi_resource_address32 { ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 min_address_range; - u32 max_address_range; - u32 address_translation_offset; + u32 minimum; + u32 maximum; + u32 translation_offset; u32 address_length; struct acpi_resource_source resource_source; }; struct acpi_resource_address64 { ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; - u64 min_address_range; - u64 max_address_range; - u64 address_translation_offset; + u64 minimum; + u64 maximum; + u64 translation_offset; u64 address_length; - u64 type_specific_attributes; struct acpi_resource_source resource_source; }; -struct acpi_resource_ext_irq { +struct acpi_resource_extended_address64 { + ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; + u64 minimum; + u64 maximum; + u64 translation_offset; + u64 address_length; + u64 type_specific_attributes; + u8 revision_iD; +}; + +struct acpi_resource_extended_irq { u32 producer_consumer; - u32 edge_level; - u32 active_high_low; - u32 shared_exclusive; - u32 number_of_interrupts; + u32 triggering; + u32 polarity; + u32 sharable; + u32 interrupt_count; struct acpi_resource_source resource_source; u32 interrupts[1]; }; -struct acpi_resource_generic_reg { +struct acpi_resource_generic_register { u32 space_id; u32 bit_width; u32 bit_offset; - u32 address_size; + u32 access_size; u64 address; }; /* ACPI_RESOURCE_TYPEs */ -#define ACPI_RSTYPE_IRQ 0 -#define ACPI_RSTYPE_DMA 1 -#define ACPI_RSTYPE_START_DPF 2 -#define ACPI_RSTYPE_END_DPF 3 -#define ACPI_RSTYPE_IO 4 -#define ACPI_RSTYPE_FIXED_IO 5 -#define ACPI_RSTYPE_VENDOR 6 -#define ACPI_RSTYPE_END_TAG 7 -#define ACPI_RSTYPE_MEM24 8 -#define ACPI_RSTYPE_MEM32 9 -#define ACPI_RSTYPE_FIXED_MEM32 10 -#define ACPI_RSTYPE_ADDRESS16 11 -#define ACPI_RSTYPE_ADDRESS32 12 -#define ACPI_RSTYPE_ADDRESS64 13 -#define ACPI_RSTYPE_EXT_IRQ 14 -#define ACPI_RSTYPE_GENERIC_REG 15 -#define ACPI_RSTYPE_MAX 15 - -typedef u32 acpi_resource_type; +#define ACPI_RESOURCE_TYPE_IRQ 0 +#define ACPI_RESOURCE_TYPE_DMA 1 +#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 +#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 +#define ACPI_RESOURCE_TYPE_IO 4 +#define ACPI_RESOURCE_TYPE_FIXED_IO 5 +#define ACPI_RESOURCE_TYPE_VENDOR 6 +#define ACPI_RESOURCE_TYPE_END_TAG 7 +#define ACPI_RESOURCE_TYPE_MEMORY24 8 +#define ACPI_RESOURCE_TYPE_MEMORY32 9 +#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 +#define ACPI_RESOURCE_TYPE_ADDRESS16 11 +#define ACPI_RESOURCE_TYPE_ADDRESS32 12 +#define ACPI_RESOURCE_TYPE_ADDRESS64 13 +#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ +#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 +#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 +#define ACPI_RESOURCE_TYPE_MAX 16 union acpi_resource_data { struct acpi_resource_irq irq; struct acpi_resource_dma dma; - struct acpi_resource_start_dpf start_dpf; + struct acpi_resource_start_dependent start_dpf; struct acpi_resource_io io; struct acpi_resource_fixed_io fixed_io; - struct acpi_resource_vendor vendor_specific; + struct acpi_resource_vendor vendor; struct acpi_resource_end_tag end_tag; - struct acpi_resource_mem24 memory24; - struct acpi_resource_mem32 memory32; - struct acpi_resource_fixed_mem32 fixed_memory32; - struct acpi_resource_address address; /* Common 16/32/64 address fields */ + struct acpi_resource_memory24 memory24; + struct acpi_resource_memory32 memory32; + struct acpi_resource_fixed_memory32 fixed_memory32; struct acpi_resource_address16 address16; struct acpi_resource_address32 address32; struct acpi_resource_address64 address64; - struct acpi_resource_ext_irq extended_irq; - struct acpi_resource_generic_reg generic_reg; + struct acpi_resource_extended_address64 ext_address64; + struct acpi_resource_extended_irq extended_irq; + struct acpi_resource_generic_register generic_reg; + + /* Common fields */ + + struct acpi_resource_address address; /* Common 16/32/64 address fields */ }; struct acpi_resource { - acpi_resource_type type; + u32 type; u32 length; union acpi_resource_data data; }; @@ -1183,7 +1195,7 @@ struct acpi_resource { #define ACPI_RESOURCE_LENGTH 12 #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ -#define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) +#define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index a3c46ba6358d..103aff07db18 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -96,165 +96,159 @@ struct asl_resource_node { * Resource descriptors defined in the ACPI specification. * * Packing/alignment must be BYTE because these descriptors - * are used to overlay the AML byte stream. + * are used to overlay the raw AML byte stream. */ #pragma pack(1) -struct asl_irq_format_desc { - u8 descriptor_type; - u16 irq_mask; +/* + * SMALL descriptors + */ +#define AML_RESOURCE_SMALL_HEADER_COMMON \ + u8 descriptor_type; + +struct aml_resource_small_header { +AML_RESOURCE_SMALL_HEADER_COMMON}; + +struct aml_resource_irq { + AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; u8 flags; }; -struct asl_irq_noflags_desc { - u8 descriptor_type; - u16 irq_mask; +struct aml_resource_irq_noflags { + AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; }; -struct asl_dma_format_desc { - u8 descriptor_type; - u8 dma_channel_mask; +struct aml_resource_dma { + AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask; u8 flags; }; -struct asl_start_dependent_desc { - u8 descriptor_type; - u8 flags; +struct aml_resource_start_dependent { + AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; }; -struct asl_start_dependent_noprio_desc { - u8 descriptor_type; -}; +struct aml_resource_start_dependent_noprio { +AML_RESOURCE_SMALL_HEADER_COMMON}; -struct asl_end_dependent_desc { - u8 descriptor_type; -}; +struct aml_resource_end_dependent { +AML_RESOURCE_SMALL_HEADER_COMMON}; -struct asl_io_port_desc { - u8 descriptor_type; - u8 information; - u16 address_min; - u16 address_max; +struct aml_resource_io { + AML_RESOURCE_SMALL_HEADER_COMMON u8 information; + u16 minimum; + u16 maximum; u8 alignment; - u8 length; + u8 address_length; }; -struct asl_fixed_io_port_desc { - u8 descriptor_type; - u16 base_address; - u8 length; +struct aml_resource_fixed_io { + AML_RESOURCE_SMALL_HEADER_COMMON u16 address; + u8 address_length; }; -struct asl_small_vendor_desc { - u8 descriptor_type; - u8 vendor_defined[7]; -}; +struct aml_resource_vendor_small { +AML_RESOURCE_SMALL_HEADER_COMMON}; -struct asl_end_tag_desc { - u8 descriptor_type; - u8 checksum; +struct aml_resource_end_tag { + AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; }; -/* LARGE descriptors */ - -#define ASL_LARGE_HEADER_COMMON \ +/* + * LARGE descriptors + */ +#define AML_RESOURCE_LARGE_HEADER_COMMON \ u8 descriptor_type;\ - u16 length; + u16 resource_length; -struct asl_large_header { -ASL_LARGE_HEADER_COMMON}; +struct aml_resource_large_header { +AML_RESOURCE_LARGE_HEADER_COMMON}; -struct asl_memory_24_desc { - ASL_LARGE_HEADER_COMMON u8 information; - u16 address_min; - u16 address_max; +struct aml_resource_memory24 { + AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + u16 minimum; + u16 maximum; u16 alignment; - u16 range_length; + u16 address_length; }; -struct asl_large_vendor_desc { - ASL_LARGE_HEADER_COMMON u8 vendor_defined[1]; -}; +struct aml_resource_vendor_large { +AML_RESOURCE_LARGE_HEADER_COMMON}; -struct asl_memory_32_desc { - ASL_LARGE_HEADER_COMMON u8 information; - u32 address_min; - u32 address_max; +struct aml_resource_memory32 { + AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + u32 minimum; + u32 maximum; u32 alignment; - u32 range_length; + u32 address_length; }; -struct asl_fixed_memory_32_desc { - ASL_LARGE_HEADER_COMMON u8 information; - u32 base_address; - u32 range_length; +struct aml_resource_fixed_memory32 { + AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + u32 address; + u32 address_length; }; -struct asl_extended_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u8 revision_iD; +#define AML_RESOURCE_ADDRESS_COMMON \ + u8 resource_type; \ + u8 flags; \ + u8 specific_flags; + +struct aml_resource_address { +AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; + +struct aml_resource_extended_address64 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u8 revision_iD; u8 reserved; u64 granularity; - u64 address_min; - u64 address_max; + u64 minimum; + u64 maximum; u64 translation_offset; u64 address_length; u64 type_specific_attributes; - u8 optional_fields[2]; /* Used for length calculation only */ }; -#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ +#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ -struct asl_qword_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u64 granularity; - u64 address_min; - u64 address_max; +struct aml_resource_address64 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u64 granularity; + u64 minimum; + u64 maximum; u64 translation_offset; u64 address_length; - u8 optional_fields[2]; }; -struct asl_dword_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u32 granularity; - u32 address_min; - u32 address_max; +struct aml_resource_address32 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u32 granularity; + u32 minimum; + u32 maximum; u32 translation_offset; u32 address_length; - u8 optional_fields[2]; }; -struct asl_word_address_desc { - ASL_LARGE_HEADER_COMMON u8 resource_type; - u8 flags; - u8 specific_flags; - u16 granularity; - u16 address_min; - u16 address_max; +struct aml_resource_address16 { + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON u16 granularity; + u16 minimum; + u16 maximum; u16 translation_offset; u16 address_length; - u8 optional_fields[2]; }; -struct asl_extended_xrupt_desc { - ASL_LARGE_HEADER_COMMON u8 flags; +struct aml_resource_extended_irq { + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u8 table_length; u32 interrupt_number[1]; /* res_source_index, res_source optional fields follow */ }; -struct asl_generic_register_desc { - ASL_LARGE_HEADER_COMMON u8 address_space_id; +struct aml_resource_generic_register { + AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id; u8 bit_width; u8 bit_offset; - u8 access_size; /* ACPI 3.0, was Reserved */ + u8 access_size; /* ACPI 3.0, was previously Reserved */ u64 address; }; @@ -264,27 +258,39 @@ struct asl_generic_register_desc { /* Union of all resource descriptors, so we can allocate the worst case */ -union asl_resource_desc { - struct asl_irq_format_desc irq; - struct asl_dma_format_desc dma; - struct asl_io_port_desc iop; - struct asl_fixed_io_port_desc fio; - struct asl_start_dependent_desc std; - struct asl_end_dependent_desc end; - struct asl_small_vendor_desc smv; - struct asl_end_tag_desc et; - - struct asl_large_header lhd; - struct asl_memory_24_desc M24; - struct asl_large_vendor_desc lgv; - struct asl_memory_32_desc M32; - struct asl_fixed_memory_32_desc F32; - struct asl_qword_address_desc qas; - struct asl_dword_address_desc das; - struct asl_word_address_desc was; - struct asl_extended_address_desc eas; - struct asl_extended_xrupt_desc exx; - struct asl_generic_register_desc grg; +union aml_resource { + /* Descriptor headers */ + + struct aml_resource_small_header small_header; + struct aml_resource_large_header large_header; + + /* Small resource descriptors */ + + struct aml_resource_irq irq; + struct aml_resource_dma dma; + struct aml_resource_start_dependent start_dpf; + struct aml_resource_end_dependent end_dpf; + struct aml_resource_io io; + struct aml_resource_fixed_io fixed_io; + struct aml_resource_vendor_small vendor_small; + struct aml_resource_end_tag end_tag; + + /* Large resource descriptors */ + + struct aml_resource_memory24 memory24; + struct aml_resource_generic_register generic_reg; + struct aml_resource_vendor_large vendor_large; + struct aml_resource_memory32 memory32; + struct aml_resource_fixed_memory32 fixed_memory32; + struct aml_resource_address16 address16; + struct aml_resource_address32 address32; + struct aml_resource_address64 address64; + struct aml_resource_extended_address64 ext_address64; + struct aml_resource_extended_irq extended_irq; + + /* Utility overlays */ + + struct aml_resource_address address; u32 u32_item; u16 u16_item; u8 U8item; diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 6f8a17d105ab..ac59045e7bab 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h @@ -188,7 +188,7 @@ extern void mp_register_lapic_address (u64 address); extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); extern void mp_config_acpi_legacy_irqs (void); -extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low); +extern int mp_register_gsi (u32 gsi, int triggering, int polarity); #endif /*CONFIG_X86_IO_APIC*/ #endif diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 026c3c011dc0..84d3d9f034ce 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -435,7 +435,7 @@ extern int sbf_port ; #endif /* !CONFIG_ACPI */ -int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); +int acpi_register_gsi (u32 gsi, int triggering, int polarity); int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); /* -- cgit v1.2.3 From 0897831bb54eb36fd9e2a22da7f0f64be1b20d09 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 21 Oct 2005 00:00:00 -0400 Subject: [ACPI] ACPICA 20051021 Implemented support for the EM64T and other x86_64 processors. This essentially entails recognizing that these processors support non-aligned memory transfers. Previously, all 64-bit processors were assumed to lack hardware support for non-aligned transfers. Completed conversion of the Resource Manager to nearly full table-driven operation. Specifically, the resource conversion code (convert AML to internal format and the reverse) and the debug code to dump internal resource descriptors are fully table-driven, reducing code and data size and improving maintainability. The OSL interfaces for Acquire and Release Lock now use a 64-bit flag word on 64-bit processors instead of a fixed 32-bit word. (Alexey Starikovskiy) Implemented support within the resource conversion code for the Type-Specific byte within the various ACPI 3.0 *WordSpace macros. Fixed some issues within the resource conversion code for the type-specific flags for both Memory and I/O address resource descriptors. For Memory, implemented support for the MTP and TTP flags. For I/O, split the TRS and TTP flags into two separate fields. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- arch/ia64/pci/pci.c | 2 +- drivers/acpi/events/evgpe.c | 8 +- drivers/acpi/events/evgpeblk.c | 10 +- drivers/acpi/events/evxface.c | 4 +- drivers/acpi/executer/exmisc.c | 5 +- drivers/acpi/executer/exregion.c | 4 +- drivers/acpi/osl.c | 6 +- drivers/acpi/resources/rsaddr.c | 745 ++++++----------------- drivers/acpi/resources/rscalc.c | 71 ++- drivers/acpi/resources/rsdump.c | 1207 +++++++++++++++---------------------- drivers/acpi/resources/rsinfo.c | 115 ++-- drivers/acpi/resources/rsio.c | 333 +++++----- drivers/acpi/resources/rsirq.c | 393 ++++-------- drivers/acpi/resources/rslist.c | 92 +-- drivers/acpi/resources/rsmemory.c | 303 ++++------ drivers/acpi/resources/rsmisc.c | 814 +++++++++++++------------ drivers/acpi/resources/rsutils.c | 269 ++++----- drivers/acpi/resources/rsxface.c | 2 +- drivers/acpi/tables/tbutils.c | 5 +- drivers/acpi/utilities/utalloc.c | 2 +- drivers/acpi/utilities/utglobal.c | 64 +- drivers/acpi/utilities/utmisc.c | 146 ++++- drivers/pnp/pnpacpi/rsparser.c | 12 +- include/acpi/acconfig.h | 2 +- include/acpi/acdisasm.h | 17 +- include/acpi/acmacros.h | 6 +- include/acpi/acpiosxf.h | 4 +- include/acpi/acresrc.h | 401 ++++++------ include/acpi/actypes.h | 183 +++--- include/acpi/acutils.h | 7 +- include/acpi/amlresrc.h | 14 +- include/acpi/platform/acenv.h | 11 +- 32 files changed, 2275 insertions(+), 2982 deletions(-) (limited to 'drivers/acpi/resources/rsirq.c') diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 25f923d050e3..5536027da9d8 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -195,7 +195,7 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr) min = addr->minimum; max = min + addr->address_length - 1; - if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) + if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION) sparse = 1; space_nr = new_space(addr->translation_offset, sparse); diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f51c3b16c608..bdd86537738e 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -372,14 +372,14 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) { + acpi_status status; + struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_register_info *gpe_register_info; u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; u8 enabled_status_byte; - struct acpi_gpe_register_info *gpe_register_info; u32 status_reg; u32 enable_reg; - u32 flags; - acpi_status status; - struct acpi_gpe_block_info *gpe_block; + acpi_native_uint flags; acpi_native_uint i; acpi_native_uint j; diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index b312eb33c43e..7ca10c5f2914 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -136,7 +136,7 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; acpi_status status = AE_OK; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); @@ -479,7 +479,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 struct acpi_gpe_xrupt_info *next_gpe_xrupt; struct acpi_gpe_xrupt_info *gpe_xrupt; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); @@ -553,7 +553,7 @@ static acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) { acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); @@ -610,7 +610,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, struct acpi_gpe_block_info *next_gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_block; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); @@ -663,7 +663,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) { acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 43b33d19cdf9..57d73299298e 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -562,7 +562,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); @@ -653,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, struct acpi_gpe_event_info *gpe_event_info; struct acpi_handler_info *handler; acpi_status status; - u32 flags; + acpi_native_uint flags; ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index a3f4d72bedc9..1899ab251393 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -625,9 +625,8 @@ acpi_ex_do_logical_op(u16 opcode, /* Lexicographic compare: compare the data bytes */ - compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, - (const char *)local_operand1->buffer. - pointer, + compare = ACPI_MEMCMP(operand0->buffer.pointer, + local_operand1->buffer.pointer, (length0 > length1) ? length1 : length0); switch (opcode) { diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 9a2f5bea3afe..1897379b5f90 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -77,7 +77,7 @@ acpi_ex_system_memory_space_handler(u32 function, struct acpi_mem_space_context *mem_info = region_context; u32 length; acpi_size window_size; -#ifndef ACPI_MISALIGNED_TRANSFERS +#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED u32 remainder; #endif @@ -109,7 +109,7 @@ acpi_ex_system_memory_space_handler(u32 function, return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } -#ifndef ACPI_MISALIGNED_TRANSFERS +#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED /* * Hardware does not support non-aligned data transfers, we must verify * the request. diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index e3cd0b16031a..4ece850b2af1 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1058,11 +1058,9 @@ EXPORT_SYMBOL(max_cstate); * Acquire a spinlock. * * handle is a pointer to the spinlock_t. - * flags is *not* the result of save_flags - it is an ACPI-specific flag variable - * that indicates whether we are at interrupt level. */ -unsigned long acpi_os_acquire_lock(acpi_handle handle) +acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) { unsigned long flags; spin_lock_irqsave((spinlock_t *) handle, flags); @@ -1073,7 +1071,7 @@ unsigned long acpi_os_acquire_lock(acpi_handle handle) * Release a spinlock. See above. */ -void acpi_os_release_lock(acpi_handle handle, unsigned long flags) +void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags) { spin_unlock_irqrestore((spinlock_t *) handle, flags); } diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 6f48ebf3304e..4ac942badbc0 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -47,683 +47,334 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsaddr") -/* Local prototypes */ -static void -acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags); - -static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource); - -static void -acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); - -static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); - -static void -acpi_rs_set_address_common(union aml_resource *aml, - struct acpi_resource *resource); - -static u8 -acpi_rs_get_address_common(struct acpi_resource *resource, - union aml_resource *aml); - -/******************************************************************************* - * - * FUNCTION: acpi_rs_decode_general_flags - * - * PARAMETERS: Resource - Address resource data struct - * Flags - Raw AML flag byte - * - * RETURN: Decoded flag bits in resource struct - * - * DESCRIPTION: Decode a general flag byte to an address resource struct - * - ******************************************************************************/ - -static void -acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) -{ - ACPI_FUNCTION_ENTRY(); - - /* Producer / Consumer - flag bit[0] */ - - resource->address.producer_consumer = (u32) (flags & 0x01); - - /* Decode (_DEC) - flag bit[1] */ - - resource->address.decode = (u32) ((flags >> 1) & 0x01); - - /* Min Address Fixed (_MIF) - flag bit[2] */ - - resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01); - - /* Max Address Fixed (_MAF) - flag bit[3] */ - - resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_encode_general_flags - * - * PARAMETERS: Resource - Address resource data struct - * - * RETURN: Encoded general flag byte - * - * DESCRIPTION: Construct a general flag byte from an address resource struct - * - ******************************************************************************/ - -static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - return ((u8) - - /* Producer / Consumer - flag bit[0] */ - ((resource->address.producer_consumer & 0x01) | - /* Decode (_DEC) - flag bit[1] */ - ((resource->address.decode & 0x01) << 1) | - /* Min Address Fixed (_MIF) - flag bit[2] */ - ((resource->address.min_address_fixed & 0x01) << 2) | - /* Max Address Fixed (_MAF) - flag bit[3] */ - ((resource->address.max_address_fixed & 0x01) << 3)) - ); -} - /******************************************************************************* * - * FUNCTION: acpi_rs_decode_specific_flags - * - * PARAMETERS: Resource - Address resource data struct - * Flags - Raw AML flag byte - * - * RETURN: Decoded flag bits in attribute struct - * - * DESCRIPTION: Decode a type-specific flag byte to an attribute struct. - * Type-specific flags are only defined for the Memory and IO - * resource types. + * acpi_rs_convert_address16 - All WORD (16-bit) address resources * ******************************************************************************/ +struct acpi_rsconvert_info acpi_rs_convert_address16[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16, + ACPI_RS_SIZE(struct acpi_resource_address16), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address16)}, -static void -acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) -{ - ACPI_FUNCTION_ENTRY(); - - if (resource->address.resource_type == ACPI_MEMORY_RANGE) { - /* Write Status (_RW) - flag bit[0] */ - - resource->address.attribute.memory.read_write_attribute = - (u16) (flags & 0x01); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16, + sizeof(struct aml_resource_address16), + 0}, - /* Memory Attributes (_MEM) - flag bits[2:1] */ + /* Resource Type, General Flags, and Type-Specific Flags */ - resource->address.attribute.memory.cache_attribute = - (u16) ((flags >> 1) & 0x03); - } else if (resource->address.resource_type == ACPI_IO_RANGE) { - /* Ranges (_RNG) - flag bits[1:0] */ - - resource->address.attribute.io.range_attribute = - (u16) (flags & 0x03); - - /* Translations (_TTP and _TRS) - flag bits[5:4] */ - - resource->address.attribute.io.translation_attribute = - (u16) ((flags >> 4) & 0x03); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_encode_specific_flags - * - * PARAMETERS: Resource - Address resource data struct - * - * RETURN: Encoded type-specific flag byte - * - * DESCRIPTION: Construct a type-specific flag byte from an attribute struct. - * Type-specific flags are only defined for the Memory and IO - * resource types. - * - ******************************************************************************/ - -static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - if (resource->address.resource_type == ACPI_MEMORY_RANGE) { - return ((u8) - - /* Write Status (_RW) - flag bit[0] */ - ((resource->address.attribute.memory. - read_write_attribute & 0x01) | - /* Memory Attributes (_MEM) - flag bits[2:1] */ - ((resource->address.attribute.memory. - cache_attribute & 0x03) << 1))); - } else if (resource->address.resource_type == ACPI_IO_RANGE) { - return ((u8) - - /* Ranges (_RNG) - flag bits[1:0] */ - ((resource->address.attribute.io. - range_attribute & 0x03) | - /* Translations (_TTP and _TRS) - flag bits[5:4] */ - ((resource->address.attribute.io. - translation_attribute & 0x03) << 4))); - } - - return (0); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_address_common - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * Resource - Pointer to the internal resource struct - * - * RETURN: None - * - * DESCRIPTION: Convert common flag fields from a resource descriptor to an - * AML descriptor - * - ******************************************************************************/ - -static void -acpi_rs_set_address_common(union aml_resource *aml, - struct acpi_resource *resource) -{ - ACPI_FUNCTION_ENTRY(); - - /* Set the Resource Type (Memory, Io, bus_number, etc.) */ - - aml->address.resource_type = (u8) resource->data.address.resource_type; - - /* Set the general flags */ - - aml->address.flags = acpi_rs_encode_general_flags(&resource->data); - - /* Set the type-specific flags */ - - aml->address.specific_flags = - acpi_rs_encode_specific_flags(&resource->data); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_address_common - * - * PARAMETERS: Resource - Pointer to the internal resource struct - * Aml - Pointer to the AML resource descriptor - * - * RETURN: TRUE if the resource_type field is OK, FALSE otherwise - * - * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor - * to an internal resource descriptor - * - ******************************************************************************/ - -static u8 -acpi_rs_get_address_common(struct acpi_resource *resource, - union aml_resource *aml) -{ - ACPI_FUNCTION_ENTRY(); - - /* Validate resource type */ - - if ((aml->address.resource_type > 2) - && (aml->address.resource_type < 0xC0)) { - return (FALSE); - } - - /* Get the Resource Type (Memory, Io, bus_number, etc.) */ - - resource->data.address.resource_type = aml->address.resource_type; - - /* Get the General Flags */ - - acpi_rs_decode_general_flags(&resource->data, aml->address.flags); - - /* Get the Type-Specific Flags */ - - acpi_rs_decode_specific_flags(&resource->data, - aml->address.specific_flags); - return (TRUE); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_address16 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_address16(union aml_resource * aml, - u16 aml_resource_length, struct acpi_resource * resource) -{ - ACPI_FUNCTION_TRACE("rs_get_address16"); - - /* Get the Resource Type, general flags, and type-specific flags */ - - if (!acpi_rs_get_address_common(resource, aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + {ACPI_RSC_ADDRESS, 0, 0, 0}, /* - * Get the following contiguous fields from the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length */ - acpi_rs_move_data(&resource->data.address16.granularity, - &aml->address16.granularity, 5, - ACPI_MOVE_TYPE_16_TO_32); - - /* Get the optional resource_source (index and string) */ - - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + - acpi_rs_get_resource_source(aml_resource_length, - sizeof(struct aml_resource_address16), - &resource->data.address16. - resource_source, aml, NULL); + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.granularity), + AML_OFFSET(address16.granularity), + 5}, - /* Complete the resource header */ + /* Optional resource_source (Index and String) */ - resource->type = ACPI_RESOURCE_TYPE_ADDRESS16; - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address16.resource_source), + 0, + sizeof(struct aml_resource_address16)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_address16 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_address32 - All DWORD (32-bit) address resources * ******************************************************************************/ -acpi_status -acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; +struct acpi_rsconvert_info acpi_rs_convert_address32[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32, + ACPI_RS_SIZE(struct acpi_resource_address32), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address32)}, - ACPI_FUNCTION_TRACE("rs_set_address16"); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32, + sizeof(struct aml_resource_address32), + 0}, - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + /* Resource Type, General Flags, and Type-Specific Flags */ - acpi_rs_set_address_common(aml, resource); + {ACPI_RSC_ADDRESS, 0, 0, 0}, /* - * Set the following contiguous fields in the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length */ - acpi_rs_move_data(&aml->address16.granularity, - &resource->data.address16.granularity, 5, - ACPI_MOVE_TYPE_32_TO_16); - - /* Resource Source Index and Resource Source are optional */ + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.granularity), + AML_OFFSET(address32.granularity), + 5}, - descriptor_length = acpi_rs_set_resource_source(aml, - sizeof(struct - aml_resource_address16), - &resource->data. - address16. - resource_source); + /* Optional resource_source (Index and String) */ - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address32.resource_source), + 0, + sizeof(struct aml_resource_address32)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_address32 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_address64 - All QWORD (64-bit) address resources * ******************************************************************************/ -acpi_status -acpi_rs_get_address32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ +struct acpi_rsconvert_info acpi_rs_convert_address64[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64, + ACPI_RS_SIZE(struct acpi_resource_address64), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address64)}, - ACPI_FUNCTION_TRACE("rs_get_address32"); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64, + sizeof(struct aml_resource_address64), + 0}, - /* Get the Resource Type, general flags, and type-specific flags */ + /* Resource Type, General Flags, and Type-Specific Flags */ - if (!acpi_rs_get_address_common(resource, (void *)aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + {ACPI_RSC_ADDRESS, 0, 0, 0}, /* - * Get the following contiguous fields from the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length */ - acpi_rs_move_data(&resource->data.address32.granularity, - &aml->address32.granularity, 5, - ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.granularity), + AML_OFFSET(address64.granularity), + 5}, - /* Get the optional resource_source (index and string) */ + /* Optional resource_source (Index and String) */ - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + - acpi_rs_get_resource_source(aml_resource_length, - sizeof(struct aml_resource_address32), - &resource->data.address32. - resource_source, aml, NULL); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_ADDRESS32; - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address64.resource_source), + 0, + sizeof(struct aml_resource_address64)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_address32 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_ext_address64 - All Extended (64-bit) address resources * ******************************************************************************/ -acpi_status -acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; +struct acpi_rsconvert_info acpi_rs_convert_ext_address64[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, + ACPI_RS_SIZE(struct acpi_resource_extended_address64), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_address64)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, + sizeof(struct aml_resource_extended_address64), + 0}, - ACPI_FUNCTION_TRACE("rs_set_address32"); + /* Resource Type, General Flags, and Type-Specific Flags */ - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + {ACPI_RSC_ADDRESS, 0, 0, 0}, - acpi_rs_set_address_common(aml, resource); + /* Revision ID */ + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD), + AML_OFFSET(ext_address64.revision_iD), + 1}, /* - * Set the following contiguous fields in the AML descriptor: + * These fields are contiguous in both the source and destination: * Address Granularity * Address Range Minimum * Address Range Maximum * Address Translation Offset * Address Length + * Type-Specific Attribute */ - acpi_rs_move_data(&aml->address32.granularity, - &resource->data.address32.granularity, 5, - ACPI_MOVE_TYPE_32_TO_32); - - /* Resource Source Index and Resource Source are optional */ - - descriptor_length = acpi_rs_set_resource_source(aml, - sizeof(struct - aml_resource_address32), - &resource->data. - address32. - resource_source); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity), + AML_OFFSET(ext_address64.granularity), + 6} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_address64 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_general_flags - Flags common to all address descriptors * ******************************************************************************/ -acpi_status -acpi_rs_get_address64(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_address64"); +static struct acpi_rsconvert_info acpi_rs_convert_general_flags[6] = { + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.flags), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_general_flags)}, - /* Get the Resource Type, general Flags, and type-specific Flags */ + /* Resource Type (Memory, Io, bus_number, etc.) */ - if (!acpi_rs_get_address_common(resource, aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.address.resource_type), + AML_OFFSET(address.resource_type), + 1}, - /* - * Get the following contiguous fields from the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - acpi_rs_move_data(&resource->data.address64.granularity, - &aml->address64.granularity, 5, - ACPI_MOVE_TYPE_64_TO_64); + /* General Flags - Consume, Decode, min_fixed, max_fixed */ - /* Get the optional resource_source (index and string) */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer), + AML_OFFSET(address.flags), + 0}, - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + - acpi_rs_get_resource_source(aml_resource_length, - sizeof(struct aml_resource_address64), - &resource->data.address64. - resource_source, aml, NULL); + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.decode), + AML_OFFSET(address.flags), + 1}, - /* Complete the resource header */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.min_address_fixed), + AML_OFFSET(address.flags), + 2}, - resource->type = ACPI_RESOURCE_TYPE_ADDRESS64; - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.max_address_fixed), + AML_OFFSET(address.flags), + 3} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_address64 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_mem_flags - Flags common to Memory address descriptors * ******************************************************************************/ -acpi_status -acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; +static struct acpi_rsconvert_info acpi_rs_convert_mem_flags[5] = { + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_mem_flags)}, - ACPI_FUNCTION_TRACE("rs_set_address64"); + /* Memory-specific flags */ - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.write_protect), + AML_OFFSET(address.specific_flags), + 0}, - acpi_rs_set_address_common(aml, resource); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.caching), + AML_OFFSET(address.specific_flags), + 1}, - /* - * Set the following contiguous fields in the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - acpi_rs_move_data(&aml->address64.granularity, - &resource->data.address64.granularity, 5, - ACPI_MOVE_TYPE_64_TO_64); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.range_type), + AML_OFFSET(address.specific_flags), + 3}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.translation), + AML_OFFSET(address.specific_flags), + 5} +}; + +/******************************************************************************* + * + * acpi_rs_convert_io_flags - Flags common to I/O address descriptors + * + ******************************************************************************/ - /* Resource Source Index and Resource Source are optional */ +static struct acpi_rsconvert_info acpi_rs_convert_io_flags[4] = { + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io_flags)}, - descriptor_length = acpi_rs_set_resource_source(aml, - sizeof(struct - aml_resource_address64), - &resource->data. - address64. - resource_source); + /* I/O-specific flags */ - /* Complete the AML descriptor header */ + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.io.range_type), + AML_OFFSET(address.specific_flags), + 0}, - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.io.translation), + AML_OFFSET(address.specific_flags), + 4}, + + {ACPI_RSC_1BITFLAG, + ACPI_RS_OFFSET(data.address.info.io.translation_type), + AML_OFFSET(address.specific_flags), + 5} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_ext_address64 + * FUNCTION: acpi_rs_get_address_common * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned + * PARAMETERS: Resource - Pointer to the internal resource struct + * Aml - Pointer to the AML resource descriptor * - * RETURN: Status + * RETURN: TRUE if the resource_type field is OK, FALSE otherwise * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor + * to an internal resource descriptor * ******************************************************************************/ -acpi_status -acpi_rs_get_ext_address64(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource) +u8 +acpi_rs_get_address_common(struct acpi_resource *resource, + union aml_resource *aml) { + ACPI_FUNCTION_ENTRY(); - ACPI_FUNCTION_TRACE("rs_get_ext_address64"); - - /* Get the Resource Type, general flags, and type-specific flags */ + /* Validate the Resource Type */ - if (!acpi_rs_get_address_common(resource, aml)) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + if ((aml->address.resource_type > 2) + && (aml->address.resource_type < 0xC0)) { + return (FALSE); } - /* - * Get and validate the Revision ID - * Note: Only one revision ID is currently supported - */ - resource->data.ext_address64.revision_iD = - aml->ext_address64.revision_iD; - if (aml->ext_address64.revision_iD != - AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { - return_ACPI_STATUS(AE_SUPPORT); - } + /* Get the Resource Type and General Flags */ - /* - * Get the following contiguous fields from the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - * Type-Specific Attribute - */ - acpi_rs_move_data(&resource->data.ext_address64.granularity, - &aml->ext_address64.granularity, 6, - ACPI_MOVE_TYPE_64_TO_64); + (void)acpi_rs_convert_aml_to_resource(resource, aml, + acpi_rs_convert_general_flags); + + /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ - /* Complete the resource header */ + if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { + (void)acpi_rs_convert_aml_to_resource(resource, aml, + acpi_rs_convert_mem_flags); + } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { + (void)acpi_rs_convert_aml_to_resource(resource, aml, + acpi_rs_convert_io_flags); + } else { + /* Generic resource type, just grab the type_specific byte */ - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64); - return_ACPI_STATUS(AE_OK); + resource->data.address.info.type_specific = + aml->address.specific_flags; + } + + return (TRUE); } /******************************************************************************* * - * FUNCTION: acpi_rs_set_ext_address64 + * FUNCTION: acpi_rs_set_address_common * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * Resource - Pointer to the internal resource struct * - * RETURN: Status + * RETURN: None * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * DESCRIPTION: Convert common flag fields from a resource descriptor to an + * AML descriptor * ******************************************************************************/ -acpi_status -acpi_rs_set_ext_address64(struct acpi_resource *resource, - union aml_resource *aml) +void +acpi_rs_set_address_common(union aml_resource *aml, + struct acpi_resource *resource) { - ACPI_FUNCTION_TRACE("rs_set_ext_address64"); + ACPI_FUNCTION_ENTRY(); - /* Set the Resource Type, General Flags, and Type-Specific Flags */ + /* Set the Resource Type and General Flags */ - acpi_rs_set_address_common(aml, resource); + (void)acpi_rs_convert_resource_to_aml(resource, aml, + acpi_rs_convert_general_flags); - /* Only one Revision ID is currently supported */ + /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ - aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; - aml->ext_address64.reserved = 0; + if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { + (void)acpi_rs_convert_resource_to_aml(resource, aml, + acpi_rs_convert_mem_flags); + } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { + (void)acpi_rs_convert_resource_to_aml(resource, aml, + acpi_rs_convert_io_flags); + } else { + /* Generic resource type, just copy the type_specific byte */ - /* - * Set the following contiguous fields in the AML descriptor: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - * Type-Specific Attribute - */ - acpi_rs_move_data(&aml->ext_address64.granularity, - &resource->data.address64.granularity, 6, - ACPI_MOVE_TYPE_64_TO_64); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, - sizeof(struct - aml_resource_extended_address64), - aml); - return_ACPI_STATUS(AE_OK); + aml->address.specific_flags = + resource->data.address.info.type_specific; + } } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index d170dee07ce9..c29d3a447278 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -52,7 +52,7 @@ ACPI_MODULE_NAME("rscalc") /* Local prototypes */ static u8 acpi_rs_count_set_bits(u16 bit_field); -static acpi_size +static acpi_rs_length acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); static u32 @@ -100,7 +100,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) * ******************************************************************************/ -static acpi_size +static acpi_rs_length acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) { ACPI_FUNCTION_ENTRY(); @@ -111,7 +111,7 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) * resource_source_index (1). */ if (resource_source->string_ptr) { - return ((acpi_size) resource_source->string_length + 1); + return ((acpi_rs_length) (resource_source->string_length + 1)); } return (0); @@ -184,7 +184,7 @@ acpi_status acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) { acpi_size aml_size_needed = 0; - acpi_size segment_size; + acpi_rs_length total_size; ACPI_FUNCTION_TRACE("rs_get_aml_length"); @@ -199,7 +199,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) /* Get the base size of the (external stream) resource descriptor */ - segment_size = acpi_gbl_aml_resource_sizes[resource->type]; + total_size = acpi_gbl_aml_resource_sizes[resource->type]; /* * Augment the base size for descriptors with optional and/or @@ -216,13 +216,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) if (resource->data.vendor.byte_length > 7) { /* Base size of a Large resource descriptor */ - segment_size = + total_size = sizeof(struct aml_resource_large_header); } /* Add the size of the vendor-specific data */ - segment_size += resource->data.vendor.byte_length; + total_size = (acpi_rs_length) + (total_size + resource->data.vendor.byte_length); break; case ACPI_RESOURCE_TYPE_END_TAG: @@ -230,7 +231,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * End Tag: * We are done -- return the accumulated total size. */ - *size_needed = aml_size_needed + segment_size; + *size_needed = aml_size_needed + total_size; /* Normal exit */ @@ -241,10 +242,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * 16-Bit Address Resource: * Add the size of the optional resource_source info */ - segment_size += - acpi_rs_struct_option_length(&resource->data. - address16. - resource_source); + total_size = (acpi_rs_length) + (total_size + + acpi_rs_struct_option_length(&resource->data. + address16. + resource_source)); break; case ACPI_RESOURCE_TYPE_ADDRESS32: @@ -252,10 +254,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * 32-Bit Address Resource: * Add the size of the optional resource_source info */ - segment_size += - acpi_rs_struct_option_length(&resource->data. - address32. - resource_source); + total_size = (acpi_rs_length) + (total_size + + acpi_rs_struct_option_length(&resource->data. + address32. + resource_source)); break; case ACPI_RESOURCE_TYPE_ADDRESS64: @@ -263,10 +266,11 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * 64-Bit Address Resource: * Add the size of the optional resource_source info */ - segment_size += - acpi_rs_struct_option_length(&resource->data. - address64. - resource_source); + total_size = (acpi_rs_length) + (total_size + + acpi_rs_struct_option_length(&resource->data. + address64. + resource_source)); break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: @@ -275,16 +279,14 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * Add the size of each additional optional interrupt beyond the * required 1 (4 bytes for each u32 interrupt number) */ - segment_size += (((acpi_size) - resource->data.extended_irq. - interrupt_count - 1) * 4); - - /* Add the size of the optional resource_source info */ - - segment_size += - acpi_rs_struct_option_length(&resource->data. - extended_irq. - resource_source); + total_size = (acpi_rs_length) + (total_size + + ((resource->data.extended_irq.interrupt_count - + 1) * 4) + + /* Add the size of the optional resource_source info */ + acpi_rs_struct_option_length(&resource->data. + extended_irq. + resource_source)); break; default: @@ -293,7 +295,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) /* Update the total */ - aml_size_needed += segment_size; + aml_size_needed += total_size; /* Point to the next object */ @@ -341,7 +343,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, while (bytes_parsed < aml_buffer_length) { /* The next byte in the stream is the resource descriptor type */ - resource_type = acpi_rs_get_resource_type(*aml_buffer); + resource_type = acpi_ut_get_resource_type(aml_buffer); /* Get the base stream size and structure sizes for the descriptor */ @@ -352,10 +354,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, /* Get the Length field from the input resource descriptor */ - resource_length = - acpi_rs_get_resource_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + resource_length = acpi_ut_get_resource_length(aml_buffer); /* Augment the size for descriptors with optional fields */ diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 2f8990845b2d..27172a3d55d7 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -43,6 +43,7 @@ #include #include +#include #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsdump") @@ -61,108 +62,448 @@ static void acpi_rs_out_integer64(char *title, u64 value); static void acpi_rs_out_title(char *title); -static void acpi_rs_dump_byte_list(u32 length, u8 * data); +static void acpi_rs_dump_byte_list(u16 length, u8 * data); -static void acpi_rs_dump_dword_list(u32 length, u32 * data); +static void acpi_rs_dump_dword_list(u8 length, u32 * data); -static void acpi_rs_dump_short_byte_list(u32 length, u32 * data); +static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); static void acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); static void acpi_rs_dump_address_common(union acpi_resource_data *resource); +static void +acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); + +#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) +#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) +#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) + /******************************************************************************* * - * FUNCTION: acpi_rs_out* - * - * PARAMETERS: Title - Name of the resource field - * Value - Value of the resource field - * - * RETURN: None + * Resource Descriptor info tables * - * DESCRIPTION: Miscellaneous helper functions to consistently format the - * output of the resource dump routines + * Note: The first table entry must be a Title or Literal and must contain + * the table length (number of table entries) * ******************************************************************************/ -static void acpi_rs_out_string(char *title, char *value) -{ - acpi_os_printf("%27s : %s\n", title, value); -} +struct acpi_rsdump_info acpi_rs_dump_irq[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", + acpi_gbl_HEdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", + acpi_gbl_LLdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", + acpi_gbl_SHRdecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), + "Interrupt Count", NULL}, + {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), + "Interrupt List", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_dma[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", + acpi_gbl_TYPdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", + acpi_gbl_BMdecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", + acpi_gbl_SIZdecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", + NULL}, + {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), + "Start-Dependent-Functions", NULL}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), + "Compatibility Priority", acpi_gbl_config_decode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), + "Performance/Robustness", acpi_gbl_config_decode} +}; + +struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf), + "End-Dependent-Functions", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_io[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding", + acpi_gbl_io_decode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io), + "Fixed I/O", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor), + "Vendor Specific", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL}, + {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", + NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), + "24-Bit Memory Range", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), + "32-Bit Memory Range", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), + "32-Bit Fixed Memory Range", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), + "Address Length", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_address16[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), + "16-Bit WORD Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), + "Address Length", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_address32[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), + "32-Bit DWORD Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), + "Address Length", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_address64[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), + "64-Bit QWORD Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", + NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", + NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", + NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), + "Address Length", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), + "64-Bit Extended Address Space", NULL}, + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), + "Granularity", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), + "Address Minimum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), + "Address Maximum", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), + "Translation Offset", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), + "Address Length", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), + "Type-Specific Attribute", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq), + "Extended IRQ", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), + "Type", acpi_gbl_consume_decode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), + "Triggering", acpi_gbl_HEdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", + acpi_gbl_LLdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", + acpi_gbl_SHRdecode}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), + "Interrupt Count", NULL}, + {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]), + "Interrupt List", NULL} +}; + +struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg), + "Generic Register", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID", + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width", + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset", + NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size), + "Access Size", NULL}, + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} +}; -static void acpi_rs_out_integer8(char *title, u8 value) -{ - acpi_os_printf("%27s : %2.2X\n", title, value); -} - -static void acpi_rs_out_integer16(char *title, u16 value) -{ - acpi_os_printf("%27s : %4.4X\n", title, value); -} - -static void acpi_rs_out_integer32(char *title, u32 value) -{ - acpi_os_printf("%27s : %8.8X\n", title, value); -} - -static void acpi_rs_out_integer64(char *title, u64 value) -{ - acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); -} +/* + * Tables used for common address descriptor flag fields + */ +static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL, + NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), + "Consumer/Producer", acpi_gbl_consume_decode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", + acpi_gbl_DECdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), + "Min Relocatability", acpi_gbl_min_decode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), + "Max Relocatability", acpi_gbl_max_decode} +}; + +static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), + "Resource Type", "Memory Range"}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), + "Write Protect", acpi_gbl_RWdecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), + "Caching", acpi_gbl_MEMdecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), + "Range Type", acpi_gbl_MTPdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), + "Translation", acpi_gbl_TTPdecode} +}; + +static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), + "Resource Type", "I/O Range"}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), + "Range Type", acpi_gbl_RNGdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), + "Translation", acpi_gbl_TTPdecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), + "Translation Type", acpi_gbl_TRSdecode} +}; -static void acpi_rs_out_title(char *title) -{ - acpi_os_printf("%27s : ", title); -} +/* + * Table used to dump _PRT contents + */ +static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL}, + {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL}, + {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL}, + {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL}, + {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_dump*List + * FUNCTION: acpi_rs_dump_descriptor * - * PARAMETERS: Length - Number of elements in the list - * Data - Start of the list + * PARAMETERS: Resource * * RETURN: None * - * DESCRIPTION: Miscellaneous functions to dump lists of raw data + * DESCRIPTION: * ******************************************************************************/ -static void acpi_rs_dump_byte_list(u32 length, u8 * data) +static void +acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) { - u32 i; + void *target = NULL; + void *previous_target; + char *name; + u8 count; + + /* First table entry must contain the table length (# of table entries) */ + + count = table->offset; + + while (count) { + previous_target = target; + target = ((u8 *) resource) + table->offset; + name = table->name; + + switch (table->opcode) { + case ACPI_RSD_TITLE: + /* + * Optional resource title + */ + if (table->name) { + acpi_os_printf("%s Resource\n", name); + } + break; - for (i = 0; i < length; i++) { - acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); - } -} + /* Strings */ -static void acpi_rs_dump_dword_list(u32 length, u32 * data) -{ - u32 i; + case ACPI_RSD_LITERAL: + acpi_rs_out_string(name, (char *)table->pointer); + break; - for (i = 0; i < length; i++) { - acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); - } -} + case ACPI_RSD_STRING: + acpi_rs_out_string(name, (char *)target); + break; -static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) -{ - u32 i; + /* Data items, 8/16/32/64 bit */ - for (i = 0; i < length; i++) { - acpi_os_printf("%X ", data[i]); - } - acpi_os_printf("\n"); -} + case ACPI_RSD_UINT8: + acpi_rs_out_integer8(name, *(u8 *) target); + break; -static void acpi_rs_dump_memory_attribute(u32 read_write_attribute) -{ + case ACPI_RSD_UINT16: + acpi_rs_out_integer16(name, *(u16 *) target); + break; + + case ACPI_RSD_UINT32: + acpi_rs_out_integer32(name, *(u32 *) target); + break; - acpi_rs_out_string("Read/Write Attribute", - ACPI_READ_WRITE_MEMORY == read_write_attribute ? - "Read/Write" : "Read-Only"); + case ACPI_RSD_UINT64: + acpi_rs_out_integer64(name, *(u64 *) target); + break; + + /* Flags: 1-bit and 2-bit flags supported */ + + case ACPI_RSD_1BITFLAG: + acpi_rs_out_string(name, (char *) + ((const char **)table-> + pointer)[(*(u8 *) target) & 0x01]); + break; + + case ACPI_RSD_2BITFLAG: + acpi_rs_out_string(name, (char *) + ((const char **)table-> + pointer)[(*(u8 *) target) & 0x03]); + break; + + case ACPI_RSD_SHORTLIST: + /* + * Short byte list (single line output) for DMA and IRQ resources + * Note: The list length is obtained from the previous table entry + */ + if (previous_target) { + acpi_rs_out_title(name); + acpi_rs_dump_short_byte_list(* + ((u8 *) + previous_target), + (u8 *) target); + } + break; + + case ACPI_RSD_LONGLIST: + /* + * Long byte list for Vendor resource data + * Note: The list length is obtained from the previous table entry + */ + if (previous_target) { + acpi_rs_dump_byte_list(* + ((u16 *) + previous_target), + (u8 *) target); + } + break; + + case ACPI_RSD_DWORDLIST: + /* + * Dword list for Extended Interrupt resources + * Note: The list length is obtained from the previous table entry + */ + if (previous_target) { + acpi_rs_dump_dword_list(* + ((u8 *) + previous_target), + (u32 *) target); + } + break; + + case ACPI_RSD_ADDRESS: + /* + * Common flags for all Address resources + */ + acpi_rs_dump_address_common((union acpi_resource_data *) + target); + break; + + case ACPI_RSD_SOURCE: + /* + * Optional resource_source for Address resources + */ + acpi_rs_dump_resource_source((struct + acpi_resource_source *) + target); + break; + + default: + acpi_os_printf("**** Invalid table opcode [%X] ****\n", + table->opcode); + return; + } + + table++; + count--; + } } /******************************************************************************* @@ -187,8 +528,7 @@ acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) return; } - acpi_rs_out_integer8("Resource Source Index", - (u8) resource_source->index); + acpi_rs_out_integer8("Resource Source Index", resource_source->index); acpi_rs_out_string("Resource Source", resource_source->string_ptr ? @@ -217,65 +557,12 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) switch (resource->address.resource_type) { case ACPI_MEMORY_RANGE: - acpi_rs_out_string("Resource Type", "Memory Range"); - - acpi_rs_out_title("Type-Specific Flags"); - - switch (resource->address.attribute.memory.cache_attribute) { - case ACPI_NON_CACHEABLE_MEMORY: - acpi_os_printf("Noncacheable memory\n"); - break; - - case ACPI_CACHABLE_MEMORY: - acpi_os_printf("Cacheable memory\n"); - break; - - case ACPI_WRITE_COMBINING_MEMORY: - acpi_os_printf("Write-combining memory\n"); - break; - - case ACPI_PREFETCHABLE_MEMORY: - acpi_os_printf("Prefetchable memory\n"); - break; - - default: - acpi_os_printf("Invalid cache attribute\n"); - break; - } - - acpi_rs_dump_memory_attribute(resource->address.attribute. - memory.read_write_attribute); + acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); break; case ACPI_IO_RANGE: - acpi_rs_out_string("Resource Type", "I/O Range"); - - acpi_rs_out_title("Type-Specific Flags"); - - switch (resource->address.attribute.io.range_attribute) { - case ACPI_NON_ISA_ONLY_RANGES: - acpi_os_printf("Non-ISA I/O Addresses\n"); - break; - - case ACPI_ISA_ONLY_RANGES: - acpi_os_printf("ISA I/O Addresses\n"); - break; - - case ACPI_ENTIRE_RANGE: - acpi_os_printf("ISA and non-ISA I/O Addresses\n"); - break; - - default: - acpi_os_printf("Invalid range attribute\n"); - break; - } - - acpi_rs_out_string("Translation Attribute", - ACPI_SPARSE_TRANSLATION == - resource->address.attribute.io. - translation_attribute ? "Sparse Translation" - : "Dense Translation"); + acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); break; case ACPI_BUS_NUMBER_RANGE: @@ -292,24 +579,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) /* Decode the general flags */ - acpi_rs_out_string("Resource", - ACPI_CONSUMER == - resource->address. - producer_consumer ? "Consumer" : "Producer"); - - acpi_rs_out_string("Decode", - ACPI_SUB_DECODE == resource->address.decode ? - "Subtractive" : "Positive"); - - acpi_rs_out_string("Min Address", - ACPI_ADDRESS_FIXED == - resource->address. - min_address_fixed ? "Fixed" : "Not Fixed"); - - acpi_rs_out_string("Max Address", - ACPI_ADDRESS_FIXED == - resource->address. - max_address_fixed ? "Fixed" : "Not Fixed"); + acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); } /******************************************************************************* @@ -327,6 +597,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) { u32 count = 0; + u32 type; ACPI_FUNCTION_ENTRY(); @@ -335,14 +606,16 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) return; } - /* Dump all resource descriptors in the list */ + /* Walk list and dump all resource descriptors (END_TAG terminates) */ - while (resource_list) { + do { acpi_os_printf("\n[%02X] ", count); + count++; /* Validate Type before dispatch */ - if (resource_list->type > ACPI_RESOURCE_TYPE_MAX) { + type = resource_list->type; + if (type > ACPI_RESOURCE_TYPE_MAX) { acpi_os_printf ("Invalid descriptor type (%X) in resource list\n", resource_list->type); @@ -351,665 +624,141 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) /* Dump the resource descriptor */ - acpi_gbl_dump_resource_dispatch[resource_list-> - type] (&resource_list->data); - - /* Exit on end tag */ - - if (resource_list->type == ACPI_RESOURCE_TYPE_END_TAG) { - return; - } + acpi_rs_dump_descriptor(&resource_list->data, + acpi_gbl_dump_resource_dispatch[type]); - /* Get the next resource structure */ + /* Point to the next resource structure */ resource_list = ACPI_PTR_ADD(struct acpi_resource, resource_list, resource_list->length); - count++; - } -} -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_irq - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ + /* Exit when END_TAG descriptor is reached */ -void acpi_rs_dump_irq(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("IRQ Resource\n"); - - acpi_rs_out_string("Triggering", - ACPI_LEVEL_SENSITIVE == - resource->irq.triggering ? "Level" : "Edge"); - - acpi_rs_out_string("Active", - ACPI_ACTIVE_LOW == - resource->irq.polarity ? "Low" : "High"); - - acpi_rs_out_string("Sharing", - ACPI_SHARED == - resource->irq.sharable ? "Shared" : "Exclusive"); - - acpi_rs_out_integer8("Interrupt Count", - (u8) resource->irq.interrupt_count); - - acpi_rs_out_title("Interrupt List"); - acpi_rs_dump_short_byte_list(resource->irq.interrupt_count, - resource->irq.interrupts); + } while (type != ACPI_RESOURCE_TYPE_END_TAG); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_dma + * FUNCTION: acpi_rs_dump_irq_list * - * PARAMETERS: Resource - Pointer to an internal resource descriptor + * PARAMETERS: route_table - Pointer to the routing table to dump. * * RETURN: None * - * DESCRIPTION: Dump the field names and values of the resource descriptor + * DESCRIPTION: Print IRQ routing table * ******************************************************************************/ -void acpi_rs_dump_dma(union acpi_resource_data *resource) +void acpi_rs_dump_irq_list(u8 * route_table) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("DMA Resource\n"); - - acpi_rs_out_title("DMA Type"); - switch (resource->dma.type) { - case ACPI_COMPATIBILITY: - acpi_os_printf("Compatibility mode\n"); - break; - - case ACPI_TYPE_A: - acpi_os_printf("Type A\n"); - break; - - case ACPI_TYPE_B: - acpi_os_printf("Type B\n"); - break; - - case ACPI_TYPE_F: - acpi_os_printf("Type F\n"); - break; - - default: - acpi_os_printf("**** Invalid DMA type\n"); - break; - } - - acpi_rs_out_string("Bus Master", - ACPI_BUS_MASTER == - resource->dma.bus_master ? "Yes" : "No"); - - acpi_rs_out_title("Transfer Type"); - switch (resource->dma.transfer) { - case ACPI_TRANSFER_8: - acpi_os_printf("8-bit transfers only\n"); - break; - - case ACPI_TRANSFER_8_16: - acpi_os_printf("8-bit and 16-bit transfers\n"); - break; - - case ACPI_TRANSFER_16: - acpi_os_printf("16-bit transfers only\n"); - break; - - default: - acpi_os_printf("**** Invalid transfer preference\n"); - break; - } - - acpi_rs_out_integer8("DMA Channel Count", - (u8) resource->dma.channel_count); - - acpi_rs_out_title("Channel List"); - acpi_rs_dump_short_byte_list(resource->dma.channel_count, - resource->dma.channels); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_start_dpf - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ + struct acpi_pci_routing_table *prt_element; + u8 count; -void acpi_rs_dump_start_dpf(union acpi_resource_data *resource) -{ ACPI_FUNCTION_ENTRY(); - acpi_os_printf("Start Dependent Functions Resource\n"); - - acpi_rs_out_title("Compatibility Priority"); - switch (resource->start_dpf.compatibility_priority) { - case ACPI_GOOD_CONFIGURATION: - acpi_os_printf("Good configuration\n"); - break; - - case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf("Acceptable configuration\n"); - break; - - case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf("Sub-optimal configuration\n"); - break; - - default: - acpi_os_printf("**** Invalid compatibility priority\n"); - break; + if (!(acpi_dbg_level & ACPI_LV_RESOURCES) + || !(_COMPONENT & acpi_dbg_layer)) { + return; } - acpi_rs_out_title("Performance/Robustness"); - switch (resource->start_dpf.performance_robustness) { - case ACPI_GOOD_CONFIGURATION: - acpi_os_printf("Good configuration\n"); - break; + prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); - case ACPI_ACCEPTABLE_CONFIGURATION: - acpi_os_printf("Acceptable configuration\n"); - break; + /* Dump all table elements, Exit on zero length element */ - case ACPI_SUB_OPTIMAL_CONFIGURATION: - acpi_os_printf("Sub-optimal configuration\n"); - break; + for (count = 0; prt_element->length; count++) { + acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", + count); + acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); - default: - acpi_os_printf - ("**** Invalid performance robustness preference\n"); - break; + prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, + ((u8 *) prt_element) + + prt_element->length); } } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_io - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_io(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("I/O Resource\n"); - - acpi_rs_out_string("Decode", - ACPI_DECODE_16 == - resource->io.io_decode ? "16-bit" : "10-bit"); - - acpi_rs_out_integer32("Address Minimum", resource->io.minimum); - - acpi_rs_out_integer32("Address Maximum", resource->io.maximum); - - acpi_rs_out_integer32("Alignment", resource->io.alignment); - - acpi_rs_out_integer32("Address Length", resource->io.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_fixed_io - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Fixed I/O Resource\n"); - - acpi_rs_out_integer32("Address", resource->fixed_io.address); - - acpi_rs_out_integer32("Address Length", - resource->fixed_io.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_vendor - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_vendor(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Vendor Specific Resource\n"); - - acpi_rs_out_integer16("Length", (u16) resource->vendor.byte_length); - - acpi_rs_dump_byte_list(resource->vendor.byte_length, - resource->vendor.byte_data); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_memory24 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_memory24(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("24-Bit Memory Range Resource\n"); - - acpi_rs_dump_memory_attribute(resource->memory24.read_write_attribute); - - acpi_rs_out_integer16("Address Minimum", - (u16) resource->memory24.minimum); - - acpi_rs_out_integer16("Address Maximum", - (u16) resource->memory24.maximum); - - acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment); - - acpi_rs_out_integer16("Address Length", - (u16) resource->memory24.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_memory32 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_memory32(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("32-Bit Memory Range Resource\n"); - - acpi_rs_dump_memory_attribute(resource->memory32.read_write_attribute); - - acpi_rs_out_integer32("Address Minimum", resource->memory32.minimum); - - acpi_rs_out_integer32("Address Maximum", resource->memory32.maximum); - - acpi_rs_out_integer32("Alignment", resource->memory32.alignment); - - acpi_rs_out_integer32("Address Length", - resource->memory32.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_fixed_memory32 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) -{ - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); - - acpi_rs_dump_memory_attribute(resource->fixed_memory32. - read_write_attribute); - - acpi_rs_out_integer32("Address", resource->fixed_memory32.address); - - acpi_rs_out_integer32("Address Length", - resource->fixed_memory32.address_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_address16 + * FUNCTION: acpi_rs_out* * - * PARAMETERS: Resource - Pointer to an internal resource descriptor + * PARAMETERS: Title - Name of the resource field + * Value - Value of the resource field * * RETURN: None * - * DESCRIPTION: Dump the field names and values of the resource descriptor + * DESCRIPTION: Miscellaneous helper functions to consistently format the + * output of the resource dump routines * ******************************************************************************/ -void acpi_rs_dump_address16(union acpi_resource_data *resource) +static void acpi_rs_out_string(char *title, char *value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("16-Bit WORD Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer16("Granularity", - (u16) resource->address16.granularity); - - acpi_rs_out_integer16("Address Minimum", - (u16) resource->address16.minimum); - - acpi_rs_out_integer16("Address Maximum", - (u16) resource->address16.maximum); - - acpi_rs_out_integer16("Translation Offset", - (u16) resource->address16.translation_offset); - - acpi_rs_out_integer16("Address Length", - (u16) resource->address16.address_length); - - acpi_rs_dump_resource_source(&resource->address16.resource_source); + acpi_os_printf("%27s : %s\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_address32 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_address32(union acpi_resource_data *resource) +static void acpi_rs_out_integer8(char *title, u8 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("32-Bit DWORD Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer32("Granularity", resource->address32.granularity); - - acpi_rs_out_integer32("Address Minimum", resource->address32.minimum); - - acpi_rs_out_integer32("Address Maximum", resource->address32.maximum); - - acpi_rs_out_integer32("Translation Offset", - resource->address32.translation_offset); - - acpi_rs_out_integer32("Address Length", - resource->address32.address_length); - - acpi_rs_dump_resource_source(&resource->address32.resource_source); + acpi_os_printf("%27s : %2.2X\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_address64 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_address64(union acpi_resource_data *resource) +static void acpi_rs_out_integer16(char *title, u16 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("64-Bit QWORD Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer64("Granularity", resource->address64.granularity); - - acpi_rs_out_integer64("Address Minimum", resource->address64.minimum); - - acpi_rs_out_integer64("Address Maximum", resource->address64.maximum); - - acpi_rs_out_integer64("Translation Offset", - resource->address64.translation_offset); - - acpi_rs_out_integer64("Address Length", - resource->address64.address_length); - - acpi_rs_dump_resource_source(&resource->address64.resource_source); + acpi_os_printf("%27s : %4.4X\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_ext_address64 - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_ext_address64(union acpi_resource_data *resource) +static void acpi_rs_out_integer32(char *title, u32 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("64-Bit Extended Address Space Resource\n"); - - acpi_rs_dump_address_common(resource); - - acpi_rs_out_integer64("Granularity", - resource->ext_address64.granularity); - - acpi_rs_out_integer64("Address Minimum", - resource->ext_address64.minimum); - - acpi_rs_out_integer64("Address Maximum", - resource->ext_address64.maximum); - - acpi_rs_out_integer64("Translation Offset", - resource->ext_address64.translation_offset); - - acpi_rs_out_integer64("Address Length", - resource->ext_address64.address_length); - - acpi_rs_out_integer64("Type-Specific Attribute", - resource->ext_address64.type_specific_attributes); + acpi_os_printf("%27s : %8.8X\n", title, value); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_ext_irq - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_ext_irq(union acpi_resource_data *resource) +static void acpi_rs_out_integer64(char *title, u64 value) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Extended IRQ Resource\n"); - - acpi_rs_out_string("Resource", - ACPI_CONSUMER == - resource->extended_irq. - producer_consumer ? "Consumer" : "Producer"); - - acpi_rs_out_string("Triggering", - ACPI_LEVEL_SENSITIVE == - resource->extended_irq. - triggering ? "Level" : "Edge"); - - acpi_rs_out_string("Active", - ACPI_ACTIVE_LOW == resource->extended_irq.polarity ? - "Low" : "High"); - - acpi_rs_out_string("Sharing", - ACPI_SHARED == resource->extended_irq.sharable ? - "Shared" : "Exclusive"); - - acpi_rs_dump_resource_source(&resource->extended_irq.resource_source); - - acpi_rs_out_integer8("Interrupts", - (u8) resource->extended_irq.interrupt_count); - - acpi_rs_dump_dword_list(resource->extended_irq.interrupt_count, - resource->extended_irq.interrupts); + acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_generic_reg - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Dump the field names and values of the resource descriptor - * - ******************************************************************************/ - -void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) +static void acpi_rs_out_title(char *title) { - ACPI_FUNCTION_ENTRY(); - - acpi_os_printf("Generic Register Resource\n"); - - acpi_rs_out_integer8("Space ID", (u8) resource->generic_reg.space_id); - - acpi_rs_out_integer8("Bit Width", (u8) resource->generic_reg.bit_width); - - acpi_rs_out_integer8("Bit Offset", - (u8) resource->generic_reg.bit_offset); - - acpi_rs_out_integer8("Access Size", - (u8) resource->generic_reg.access_size); - - acpi_rs_out_integer64("Address", resource->generic_reg.address); + acpi_os_printf("%27s : ", title); } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_end_dpf + * FUNCTION: acpi_rs_dump*List * - * PARAMETERS: Resource - Pointer to an internal resource descriptor + * PARAMETERS: Length - Number of elements in the list + * Data - Start of the list * * RETURN: None * - * DESCRIPTION: Print type, no data. + * DESCRIPTION: Miscellaneous functions to dump lists of raw data * ******************************************************************************/ -void acpi_rs_dump_end_dpf(union acpi_resource_data *resource) +static void acpi_rs_dump_byte_list(u16 length, u8 * data) { - ACPI_FUNCTION_ENTRY(); + u8 i; - acpi_os_printf("end_dependent_functions Resource\n"); + for (i = 0; i < length; i++) { + acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); + } } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_end_tag - * - * PARAMETERS: Resource - Pointer to an internal resource descriptor - * - * RETURN: None - * - * DESCRIPTION: Print type, no data. - * - ******************************************************************************/ - -void acpi_rs_dump_end_tag(union acpi_resource_data *resource) +static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) { - ACPI_FUNCTION_ENTRY(); + u8 i; - acpi_os_printf("end_tag Resource\n"); + for (i = 0; i < length; i++) { + acpi_os_printf("%X ", data[i]); + } + acpi_os_printf("\n"); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_dump_irq_list - * - * PARAMETERS: route_table - Pointer to the routing table to dump. - * - * RETURN: None - * - * DESCRIPTION: Print IRQ routing table - * - ******************************************************************************/ - -void acpi_rs_dump_irq_list(u8 * route_table) +static void acpi_rs_dump_dword_list(u8 length, u32 * data) { - u8 *buffer = route_table; - u8 count = 0; - struct acpi_pci_routing_table *prt_element; - - ACPI_FUNCTION_ENTRY(); + u8 i; - if (!(acpi_dbg_level & ACPI_LV_RESOURCES) - || !(_COMPONENT & acpi_dbg_layer)) { - return; - } - - prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); - - /* Dump all table elements, Exit on null length element */ - - while (prt_element->length) { - acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", - count); - - acpi_rs_out_integer64("Address", prt_element->address); - - acpi_rs_out_integer32("Pin", prt_element->pin); - acpi_rs_out_string("Source", prt_element->source); - acpi_rs_out_integer32("Source Index", - prt_element->source_index); - - buffer += prt_element->length; - prt_element = - ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); - count++; + for (i = 0; i < length; i++) { + acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); } } diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index b31cb33ec565..973fc2834cbb 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c @@ -58,60 +58,60 @@ ACPI_MODULE_NAME("rsinfo") * descriptors are indexed by the acpi_resource_type field. */ /* Dispatch table for resource-to-AML (Set Resource) conversion functions */ -ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[] = { +struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = { acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ - acpi_rs_set_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ + acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ - acpi_rs_set_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ - acpi_rs_set_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ - acpi_rs_set_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ + acpi_rs_convert_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ + acpi_rs_convert_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ + acpi_rs_convert_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ - acpi_rs_set_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ - acpi_rs_set_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ - acpi_rs_set_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ - acpi_rs_set_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ - acpi_rs_set_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ - acpi_rs_set_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ - acpi_rs_set_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ - acpi_rs_set_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ - acpi_rs_set_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - acpi_rs_set_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + acpi_rs_convert_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ + acpi_rs_convert_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ + acpi_rs_convert_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ + acpi_rs_convert_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ + acpi_rs_convert_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ + acpi_rs_convert_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ + acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ + acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ + acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ + acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ -ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[] = { +struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = { NULL, /* 0x00, Reserved */ NULL, /* 0x01, Reserved */ NULL, /* 0x02, Reserved */ NULL, /* 0x03, Reserved */ acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ - acpi_rs_get_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ + acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ - acpi_rs_get_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ - acpi_rs_get_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ - acpi_rs_get_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ + acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ + acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ + acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ NULL, /* 0x0A, Reserved */ NULL, /* 0x0B, Reserved */ NULL, /* 0x0C, Reserved */ NULL, /* 0x0D, Reserved */ - acpi_rs_get_vendor, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ - acpi_rs_get_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ + acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ + acpi_rs_convert_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ }; -ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = { +struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[] = { NULL, /* 0x00, Reserved */ - acpi_rs_get_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ - acpi_rs_get_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ + acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ + acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ NULL, /* 0x03, Reserved */ - acpi_rs_get_vendor, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ - acpi_rs_get_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ - acpi_rs_get_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ - acpi_rs_get_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ - acpi_rs_get_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ - acpi_rs_get_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ - acpi_rs_get_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ - acpi_rs_get_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ + acpi_rs_get_vendor_large, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ + acpi_rs_convert_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ + acpi_rs_convert_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ + acpi_rs_convert_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ + acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ + acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ + acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ + acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ }; #ifdef ACPI_FUTURE_USAGE @@ -119,7 +119,7 @@ ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = { /* Dispatch table for resource dump functions */ -ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = { +struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */ acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */ acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ @@ -136,17 +136,17 @@ ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = { acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - acpi_rs_dump_generic_reg /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ + acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ }; + #endif #endif /* ACPI_FUTURE_USAGE */ - /* * Base sizes for external AML resource descriptors, indexed by internal type. * Includes size of the descriptor header (1 byte for small descriptors, * 3 bytes for large descriptors) */ -u8 acpi_gbl_aml_resource_sizes[] = { +const u8 acpi_gbl_aml_resource_sizes[] = { sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */ sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ @@ -168,8 +168,8 @@ u8 acpi_gbl_aml_resource_sizes[] = { /* Macros used in the tables below */ -#define ACPI_RLARGE(r) sizeof (r) - sizeof (struct aml_resource_large_header) -#define ACPI_RSMALL(r) sizeof (r) - sizeof (struct aml_resource_small_header) +#define ACPI_RLARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) +#define ACPI_RSMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) /* * Base sizes of resource descriptors, both the AML stream resource length @@ -182,47 +182,46 @@ struct acpi_resource_info acpi_gbl_sm_resource_info[] = { {0, 0, 0}, {0, 0, 0}, {2, ACPI_RSMALL(struct aml_resource_irq), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, + ACPI_RS_SIZE(struct acpi_resource_irq)}, {0, ACPI_RSMALL(struct aml_resource_dma), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, + ACPI_RS_SIZE(struct acpi_resource_dma)}, {2, ACPI_RSMALL(struct aml_resource_start_dependent), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent)}, - {0, ACPI_RSMALL(struct aml_resource_end_dependent), - ACPI_RESOURCE_LENGTH}, + ACPI_RS_SIZE(struct acpi_resource_start_dependent)}, + {0, ACPI_RSMALL(struct aml_resource_end_dependent), ACPI_RS_SIZE_MIN}, {0, ACPI_RSMALL(struct aml_resource_io), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, + ACPI_RS_SIZE(struct acpi_resource_io)}, {0, ACPI_RSMALL(struct aml_resource_fixed_io), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, + ACPI_RS_SIZE(struct acpi_resource_fixed_io)}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, ACPI_RSMALL(struct aml_resource_vendor_small), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, - {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RESOURCE_LENGTH} + ACPI_RS_SIZE(struct acpi_resource_vendor)}, + {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RS_SIZE_MIN} }; struct acpi_resource_info acpi_gbl_lg_resource_info[] = { {0, 0, 0}, {0, ACPI_RLARGE(struct aml_resource_memory24), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)}, + ACPI_RS_SIZE(struct acpi_resource_memory24)}, {0, ACPI_RLARGE(struct aml_resource_generic_register), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register)}, + ACPI_RS_SIZE(struct acpi_resource_generic_register)}, {0, 0, 0}, {1, ACPI_RLARGE(struct aml_resource_vendor_large), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, + ACPI_RS_SIZE(struct acpi_resource_vendor)}, {0, ACPI_RLARGE(struct aml_resource_memory32), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32)}, + ACPI_RS_SIZE(struct acpi_resource_memory32)}, {0, ACPI_RLARGE(struct aml_resource_fixed_memory32), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32)}, + ACPI_RS_SIZE(struct acpi_resource_fixed_memory32)}, {1, ACPI_RLARGE(struct aml_resource_address32), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, + ACPI_RS_SIZE(struct acpi_resource_address32)}, {1, ACPI_RLARGE(struct aml_resource_address16), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, + ACPI_RS_SIZE(struct acpi_resource_address16)}, {1, ACPI_RLARGE(struct aml_resource_extended_irq), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq)}, + ACPI_RS_SIZE(struct acpi_resource_extended_irq)}, {1, ACPI_RLARGE(struct aml_resource_address64), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, + ACPI_RS_SIZE(struct acpi_resource_address64)}, {0, ACPI_RLARGE(struct aml_resource_extended_address64), - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64)} + ACPI_RS_SIZE(struct acpi_resource_extended_address64)} }; diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 0dab8cdfa800..ef24ba110c6e 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -49,269 +49,206 @@ ACPI_MODULE_NAME("rsio") /******************************************************************************* * - * FUNCTION: acpi_rs_get_io - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_io * ******************************************************************************/ -acpi_status -acpi_rs_get_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_io"); +struct acpi_rsconvert_info acpi_rs_convert_io[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO, + ACPI_RS_SIZE(struct acpi_resource_io), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io)}, - /* Get the Decode flag */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, + sizeof(struct aml_resource_io), + 0}, - resource->data.io.io_decode = aml->io.information & 0x01; + /* Decode flag */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.io.io_decode), + AML_OFFSET(io.flags), + 0}, /* - * Get the following contiguous fields from the AML descriptor: - * Minimum Base Address - * Maximum Base Address + * These fields are contiguous in both the source and destination: * Address Alignment * Length + * Minimum Base Address + * Maximum Base Address */ - 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; - - /* Complete the resource header */ + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.io.alignment), + AML_OFFSET(io.alignment), + 2}, - resource->type = ACPI_RESOURCE_TYPE_IO; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.io.minimum), + AML_OFFSET(io.minimum), + 2} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_io - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_fixed_io * ******************************************************************************/ -acpi_status -acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_io"); - - /* I/O Information Byte */ - - aml->io.information = (u8) (resource->data.io.io_decode & 0x01); +struct acpi_rsconvert_info acpi_rs_convert_fixed_io[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO, + ACPI_RS_SIZE(struct acpi_resource_fixed_io), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_io)}, + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO, + sizeof(struct aml_resource_fixed_io), + 0}, /* - * Set the following contiguous fields in the AML descriptor: - * Minimum Base Address - * Maximum Base Address - * Address Alignment + * These fields are contiguous in both the source and destination: + * Base Address * 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; - - /* Complete the AML descriptor header */ + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_io.address_length), + AML_OFFSET(fixed_io.address_length), + 1}, - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IO, - sizeof(struct aml_resource_io), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_io.address), + AML_OFFSET(fixed_io.address), + 1} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_fixed_io - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_generic_reg * ******************************************************************************/ -acpi_status -acpi_rs_get_fixed_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_fixed_io"); +struct acpi_rsconvert_info acpi_rs_convert_generic_reg[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER, + ACPI_RS_SIZE(struct acpi_resource_generic_register), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_generic_reg)}, + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER, + sizeof(struct aml_resource_generic_register), + 0}, /* - * Get the following contiguous fields from the AML descriptor: - * Base Address - * Length + * These fields are contiguous in both the source and destination: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size */ - 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_RSC_MOVE8, ACPI_RS_OFFSET(data.generic_reg.space_id), + AML_OFFSET(generic_reg.address_space_id), + 4}, - /* Complete the resource header */ + /* Get the Register Address */ - resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.generic_reg.address), + AML_OFFSET(generic_reg.address), + 1} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_fixed_io - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned + * acpi_rs_convert_end_dpf * - * RETURN: Status + ******************************************************************************/ + +struct acpi_rsconvert_info acpi_rs_convert_end_dpf[2] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT, + ACPI_RS_SIZE_MIN, + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_dpf)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, + sizeof(struct aml_resource_end_dependent), + 0} +}; + +/******************************************************************************* * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_end_tag * ******************************************************************************/ -acpi_status -acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_fixed_io"); +struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG, + ACPI_RS_SIZE_MIN, + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_tag)}, /* - * Set the following contiguous fields in the AML descriptor: - * Base Address - * Length + * Note: The checksum field is set to zero, meaning that the resource + * data is treated as if the checksum operation succeeded. + * (ACPI Spec 1.0b Section 6.4.2.8) */ - ACPI_MOVE_32_TO_16(&aml->fixed_io.address, - &resource->data.fixed_io.address); - aml->fixed_io.address_length = - (u8) resource->data.fixed_io.address_length; - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO, - sizeof(struct aml_resource_fixed_io), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, + sizeof(struct aml_resource_end_tag), + 0} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_dma - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_get_start_dpf * ******************************************************************************/ -acpi_status -acpi_rs_get_dma(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - u32 channel_count = 0; - u32 i; - u8 temp8; +struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, + ACPI_RS_SIZE(struct acpi_resource_start_dependent), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, - ACPI_FUNCTION_TRACE("rs_get_dma"); + /* Defaults for Compatibility and Performance priorities */ - /* Decode the DMA channel bits */ + {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + ACPI_ACCEPTABLE_CONFIGURATION, + 2}, - for (i = 0; i < 8; i++) { - if ((aml->dma.dma_channel_mask >> i) & 0x01) { - resource->data.dma.channels[channel_count] = i; - channel_count++; - } - } + /* All done if there is no flag byte present in the descriptor */ - resource->length = 0; - resource->data.dma.channel_count = channel_count; + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, - /* - * 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; - } - - /* Get the flags: transfer preference, bus mastering, channel speed */ + /* Flag byte is present, get the flags */ - temp8 = aml->dma.flags; - resource->data.dma.transfer = temp8 & 0x03; - resource->data.dma.bus_master = (temp8 >> 2) & 0x01; - resource->data.dma.type = (temp8 >> 5) & 0x03; + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + AML_OFFSET(start_dpf.flags), + 0}, - if (resource->data.dma.transfer == 0x03) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid DMA.Transfer preference (3)\n")); - return_ACPI_STATUS(AE_BAD_DATA); - } - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_DMA; - resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), + AML_OFFSET(start_dpf.flags), + 2} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_dma - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_set_start_dpf * ******************************************************************************/ -acpi_status -acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml) -{ - u8 i; - - ACPI_FUNCTION_TRACE("rs_set_dma"); +struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof(struct aml_resource_start_dependent), + ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, - /* Convert channel list to 8-bit DMA channel bitmask */ + /* Set the default flag values */ - aml->dma.dma_channel_mask = 0; - for (i = 0; i < resource->data.dma.channel_count; i++) { - aml->dma.dma_channel_mask |= - (1 << resource->data.dma.channels[i]); - } + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + AML_OFFSET(start_dpf.flags), + 0}, - /* Set the DMA Flag bits */ + {ACPI_RSC_2BITFLAG, + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), + AML_OFFSET(start_dpf.flags), + 2}, + /* + * All done if flags byte is necessary -- if either priority value + * is not ACPI_ACCEPTABLE_CONFIGURATION + */ + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), + ACPI_ACCEPTABLE_CONFIGURATION}, - aml->dma.flags = (u8) - (((resource->data.dma.type & 0x03) << 5) | - ((resource->data.dma.bus_master & 0x01) << 2) | - (resource->data.dma.transfer & 0x03)); + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), + ACPI_ACCEPTABLE_CONFIGURATION}, - /* Complete the AML descriptor header */ + /* Flag byte is not necessary */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_DMA, - sizeof(struct aml_resource_dma), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_LENGTH, 0, 0, + sizeof(struct aml_resource_start_dependent_noprio)} +}; diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 4e854ba70811..79e71257b69a 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -49,325 +49,182 @@ ACPI_MODULE_NAME("rsirq") /******************************************************************************* * - * FUNCTION: acpi_rs_get_irq - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_get_irq * ******************************************************************************/ -acpi_status -acpi_rs_get_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - u16 temp16 = 0; - u32 interrupt_count = 0; - u32 i; - u32 resource_length; - - ACPI_FUNCTION_TRACE("rs_get_irq"); +struct acpi_rsconvert_info acpi_rs_get_irq[7] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, + ACPI_RS_SIZE(struct acpi_resource_irq), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, /* Get the IRQ mask (bytes 1:2) */ - ACPI_MOVE_16_TO_16(&temp16, &aml->irq.irq_mask); - - /* Decode the IRQ bits (up to 16 possible) */ - - for (i = 0; i < 16; i++) { - if ((temp16 >> i) & 0x01) { - resource->data.irq.interrupts[interrupt_count] = i; - interrupt_count++; - } - } - - /* Zero interrupts is valid */ - - resource_length = 0; - resource->data.irq.interrupt_count = interrupt_count; - if (interrupt_count > 0) { - /* Calculate the structure size based upon the number of interrupts */ - - resource_length = (u32) (interrupt_count - 1) * 4; - } - - /* Get Flags (Byte 3) if it is used */ - - if (aml_resource_length == 3) { - /* Check for HE, LL interrupts */ - - switch (aml->irq.flags & 0x09) { - case 0x01: /* HE */ - resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; - resource->data.irq.polarity = ACPI_ACTIVE_HIGH; - break; - - case 0x08: /* LL */ - resource->data.irq.triggering = ACPI_LEVEL_SENSITIVE; - resource->data.irq.polarity = ACPI_ACTIVE_LOW; - break; - - default: - /* - * Only _LL and _HE polarity/trigger interrupts - * are allowed (ACPI spec, section "IRQ Format") - * so 0x00 and 0x09 are illegal. - */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid interrupt polarity/trigger in resource list, %X\n", - aml->irq.flags)); - return_ACPI_STATUS(AE_BAD_DATA); - } - - /* Get Sharing flag */ - - resource->data.irq.sharable = (aml->irq.flags >> 3) & 0x01; - } else { - /* - * Default configuration: assume Edge Sensitive, Active High, - * Non-Sharable as per the ACPI Specification - */ - resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; - resource->data.irq.polarity = ACPI_ACTIVE_HIGH; - resource->data.irq.sharable = ACPI_EXCLUSIVE; - } - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_IRQ; - resource->length = - resource_length + ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), + AML_OFFSET(irq.irq_mask), + ACPI_RS_OFFSET(data.irq.interrupt_count)}, + + /* Set default flags (others are zero) */ + + {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.irq.triggering), + ACPI_EDGE_SENSITIVE, + 1}, + + /* All done if no flag byte present in descriptor */ + + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, + + /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), + AML_OFFSET(irq.flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), + AML_OFFSET(irq.flags), + 3}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), + AML_OFFSET(irq.flags), + 4} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_irq - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_set_irq * ******************************************************************************/ -acpi_status -acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; - u16 irq_mask; - u8 i; - - ACPI_FUNCTION_TRACE("rs_set_irq"); +struct acpi_rsconvert_info acpi_rs_set_irq[9] = { + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, + sizeof(struct aml_resource_irq), + ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)}, /* Convert interrupt list to 16-bit IRQ bitmask */ - irq_mask = 0; - for (i = 0; i < resource->data.irq.interrupt_count; i++) { - irq_mask |= (1 << resource->data.irq.interrupts[i]); - } + {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), + AML_OFFSET(irq.irq_mask), + ACPI_RS_OFFSET(data.irq.interrupt_count)}, + + /* Set the flags byte by default */ - /* Set the interrupt mask */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), + AML_OFFSET(irq.flags), + 0}, - ACPI_MOVE_16_TO_16(&aml->irq.irq_mask, &irq_mask); + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), + AML_OFFSET(irq.flags), + 3}, + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), + AML_OFFSET(irq.flags), + 4}, /* - * The descriptor field is set based upon whether a third byte is - * needed to contain the IRQ Information. + * Check if the flags byte is necessary. Not needed if the flags are: + * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE */ - if ((resource->data.irq.triggering == ACPI_EDGE_SENSITIVE) && - (resource->data.irq.polarity == ACPI_ACTIVE_HIGH) && - (resource->data.irq.sharable == ACPI_EXCLUSIVE)) { - /* irq_no_flags() descriptor can be used */ - - descriptor_length = sizeof(struct aml_resource_irq_noflags); - } else { - /* Irq() descriptor must be used */ - - descriptor_length = sizeof(struct aml_resource_irq); - - /* Set the IRQ Info byte */ + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.irq.triggering), + ACPI_EDGE_SENSITIVE}, - aml->irq.flags = (u8) - ((resource->data.irq.sharable & 0x01) << 4); + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.irq.polarity), + ACPI_ACTIVE_HIGH}, - if (ACPI_LEVEL_SENSITIVE == resource->data.irq.triggering && - ACPI_ACTIVE_LOW == resource->data.irq.polarity) { - aml->irq.flags |= 0x08; - } else { - aml->irq.flags |= 0x01; - } - } + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(data.irq.sharable), + ACPI_EXCLUSIVE}, - /* Complete the AML descriptor header */ + /* irq_no_flags() descriptor can be used */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IRQ, descriptor_length, - aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_ext_irq - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_ext_irq * ******************************************************************************/ -acpi_status -acpi_rs_get_ext_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - char *out_resource_string; - u8 temp8; - - ACPI_FUNCTION_TRACE("rs_get_ext_irq"); - - /* Get the flag bits */ +struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, + ACPI_RS_SIZE(struct acpi_resource_extended_irq), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)}, - temp8 = aml->extended_irq.flags; - resource->data.extended_irq.producer_consumer = temp8 & 0x01; - resource->data.extended_irq.polarity = (temp8 >> 2) & 0x01; - resource->data.extended_irq.sharable = (temp8 >> 3) & 0x01; + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ, + sizeof(struct aml_resource_extended_irq), + 0}, - /* - * Check for Interrupt Mode - * - * The definition of an Extended IRQ changed between ACPI spec v1.0b - * and ACPI spec 2.0 (section 6.4.3.6 in both). - * - * - Edge/Level are defined opposite in the table vs the headers - */ - resource->data.extended_irq.triggering = - (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; + /* Flag bits */ - /* Get the IRQ Table length (Byte4) */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), + AML_OFFSET(extended_irq.flags), + 0}, - temp8 = aml->extended_irq.table_length; - resource->data.extended_irq.interrupt_count = temp8; - if (temp8 < 1) { - /* Must have at least one IRQ */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.triggering), + AML_OFFSET(extended_irq.flags), + 1}, - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); - } + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.polarity), + AML_OFFSET(extended_irq.flags), + 2}, - /* - * Add any additional structure size to properly calculate - * the next pointer at the end of this function - */ - resource->length = (temp8 - 1) * 4; - out_resource_string = ACPI_CAST_PTR(char, - (&resource->data.extended_irq. - interrupts[0] + temp8)); + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable), + AML_OFFSET(extended_irq.flags), + 3}, - /* Get every IRQ in the table, each is 32 bits */ + /* IRQ Table length (Byte4) */ - acpi_rs_move_data(resource->data.extended_irq.interrupts, - aml->extended_irq.interrupt_number, - (u16) temp8, ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), + AML_OFFSET(extended_irq.interrupt_count), + sizeof(u32)} + , - /* Get the optional resource_source (index and string) */ + /* Copy every IRQ in the table, each is 32 bits */ - resource->length += - acpi_rs_get_resource_source(aml_resource_length, - (acpi_size) resource->length + - sizeof(struct - aml_resource_extended_irq), - &resource->data.extended_irq. - resource_source, aml, - out_resource_string); + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), + AML_OFFSET(extended_irq.interrupts[0]), + 0} + , - /* Complete the resource header */ + /* Optional resource_source (Index and String) */ - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; - resource->length += - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET(data.extended_irq.resource_source), + ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), + sizeof(struct aml_resource_extended_irq)} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_ext_irq - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_dma * ******************************************************************************/ -acpi_status -acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml) -{ - acpi_size descriptor_length; - - ACPI_FUNCTION_TRACE("rs_set_ext_irq"); - - /* Set the Interrupt vector flags */ - - aml->extended_irq.flags = (u8) - ((resource->data.extended_irq.producer_consumer & 0x01) | - ((resource->data.extended_irq.sharable & 0x01) << 3) | - ((resource->data.extended_irq.polarity & 0x1) << 2)); - - /* - * Set the Interrupt Mode - * - * The definition of an Extended IRQ changed between ACPI spec v1.0b - * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not - * implement the more restrictive definition of 1.0b - * - * - Edge/Level are defined opposite in the table vs the headers - */ - if (resource->data.extended_irq.triggering == ACPI_EDGE_SENSITIVE) { - aml->extended_irq.flags |= 0x02; - } - - /* Set the Interrupt table length */ - - aml->extended_irq.table_length = (u8) - resource->data.extended_irq.interrupt_count; +struct acpi_rsconvert_info acpi_rs_convert_dma[6] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA, + ACPI_RS_SIZE(struct acpi_resource_dma), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_dma)}, - descriptor_length = (sizeof(struct aml_resource_extended_irq) - 4) + - ((acpi_size) resource->data.extended_irq.interrupt_count * - sizeof(u32)); + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA, + sizeof(struct aml_resource_dma), + 0}, - /* Set each interrupt value */ + /* Flags: transfer preference, bus mastering, channel speed */ - acpi_rs_move_data(aml->extended_irq.interrupt_number, - resource->data.extended_irq.interrupts, - (u16) resource->data.extended_irq.interrupt_count, - ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.transfer), + AML_OFFSET(dma.flags), + 0}, - /* Resource Source Index and Resource Source are optional */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.dma.bus_master), + AML_OFFSET(dma.flags), + 2}, - descriptor_length = acpi_rs_set_resource_source(aml, descriptor_length, - &resource->data. - extended_irq. - resource_source); + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.type), + AML_OFFSET(dma.flags), + 5}, - /* Complete the AML descriptor header */ + /* DMA channel mask bits */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_IRQ, - descriptor_length, aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_BITMASK, ACPI_RS_OFFSET(data.dma.channels[0]), + AML_OFFSET(dma.dma_channel_mask), + ACPI_RS_OFFSET(data.dma.channel_count)} +}; diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index f72d42e0927b..ee17ef3315f8 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -48,7 +48,8 @@ ACPI_MODULE_NAME("rslist") /* Local prototypes */ -static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); +static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 + resource_type); static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); @@ -83,7 +84,7 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) return (AE_AML_INVALID_RESOURCE_TYPE); } - resource_length = acpi_rs_get_resource_length(aml); + resource_length = acpi_ut_get_resource_length(aml); minimum_aml_resource_length = resource_info->minimum_aml_resource_length; @@ -115,18 +116,17 @@ static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml) /******************************************************************************* * - * FUNCTION: acpi_rs_get_resource_handler + * FUNCTION: acpi_rs_get_conversion_info * * PARAMETERS: resource_type - Byte 0 of a resource descriptor * - * RETURN: Pointer to the resource conversion handler + * RETURN: Pointer to the resource conversion info table * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. + * DESCRIPTION: Get the conversion table associated with this resource type * ******************************************************************************/ -static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) +static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type) { ACPI_FUNCTION_ENTRY(); @@ -174,33 +174,24 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, acpi_status status; acpi_size bytes_parsed = 0; struct acpi_resource *resource; - u16 resource_length; - u32 descriptor_length; - ACPI_GET_RESOURCE_HANDLER handler; + acpi_rsdesc_size descriptor_length; + struct acpi_rsconvert_info *info; ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); /* Loop until end-of-buffer or an end_tag is found */ while (bytes_parsed < aml_buffer_length) { - /* Get the handler associated with this Descriptor Type */ + /* Get the conversion table associated with this Descriptor Type */ - handler = acpi_rs_get_resource_handler(*aml_buffer); - if (!handler) { - /* No handler indicates invalid resource type */ + info = acpi_rs_get_conversion_info(*aml_buffer); + if (!info) { + /* No table indicates an invalid resource type */ return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - resource_length = - acpi_rs_get_resource_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); - - descriptor_length = - acpi_rs_get_descriptor_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + descriptor_length = acpi_ut_get_descriptor_length(aml_buffer); /* * Perform limited validation of the resource length, based upon @@ -214,11 +205,16 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, return_ACPI_STATUS(status); } - /* Convert a byte stream resource to local resource struct */ + /* Convert the AML byte stream resource to a local resource struct */ - status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer), - resource_length, - ACPI_CAST_PTR(struct acpi_resource, buffer)); + status = + acpi_rs_convert_aml_to_resource(ACPI_CAST_PTR + (struct acpi_resource, + buffer), + ACPI_CAST_PTR(union + aml_resource, + aml_buffer), + info); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); return_ACPI_STATUS(status); @@ -232,7 +228,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml_buffer, /* Normal exit on completion of an end_tag resource descriptor */ - if (acpi_rs_get_resource_type(*aml_buffer) == + if (acpi_ut_get_resource_type(aml_buffer) == ACPI_RESOURCE_NAME_END_TAG) { return_ACPI_STATUS(AE_OK); } @@ -276,14 +272,15 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_size aml_size_needed, u8 * output_buffer) { u8 *aml_buffer = output_buffer; + u8 *end_aml_buffer = output_buffer + aml_size_needed; acpi_status status; ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); - /* Convert each resource descriptor in the list */ + /* Walk the resource descriptor list, convert each descriptor */ - while (1) { - /* Validate Resource Descriptor Type before dispatch */ + while (aml_buffer < end_aml_buffer) { + /* Validate the Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -292,14 +289,14 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, return_ACPI_STATUS(AE_BAD_DATA); } - /* Perform the conversion per resource type */ + /* Perform the conversion */ - status = - acpi_gbl_set_resource_dispatch[resource->type] (resource, - ACPI_CAST_PTR - (union - aml_resource, - aml_buffer)); + status = acpi_rs_convert_resource_to_aml(resource, + ACPI_CAST_PTR(union + aml_resource, + aml_buffer), + acpi_gbl_set_resource_dispatch + [resource->type]); if (ACPI_FAILURE(status)) { ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); return_ACPI_STATUS(status); @@ -323,18 +320,23 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, return_ACPI_STATUS(AE_OK); } - /* Extract the total length of the new descriptor */ - /* Set the aml_buffer to point to the next (output) resource descriptor */ - - aml_buffer += - acpi_rs_get_descriptor_length(ACPI_CAST_PTR - (union aml_resource, - aml_buffer)); + /* + * Extract the total length of the new descriptor and set the + * aml_buffer to point to the next (output) resource descriptor + */ + aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); /* Point to the next input resource descriptor */ resource = ACPI_PTR_ADD(struct acpi_resource, resource, resource->length); + + /* Check for end-of-list, normal exit */ + } + + /* Completed buffer, but did not find an end_tag resource descriptor */ + + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); } diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 47e979e7ba35..418a3fb64077 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -49,260 +49,187 @@ ACPI_MODULE_NAME("rsmemory") /******************************************************************************* * - * FUNCTION: acpi_rs_get_memory24 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_memory24 * ******************************************************************************/ -acpi_status -acpi_rs_get_memory24(union aml_resource * aml, - u16 aml_resource_length, struct acpi_resource * resource) -{ - ACPI_FUNCTION_TRACE("rs_get_memory24"); +struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24, + ACPI_RS_SIZE(struct acpi_resource_memory24), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)}, - /* Get the Read/Write bit */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, + sizeof(struct aml_resource_memory24), + 0}, - resource->data.memory24.read_write_attribute = - (aml->memory24.information & 0x01); + /* Read/Write bit */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect), + AML_OFFSET(memory24.flags), + 0}, /* - * Get the following contiguous fields from the AML descriptor: + * These fields are contiguous in both the source and destination: * Minimum Base Address * Maximum Base Address * Address Base Alignment * Range Length */ - acpi_rs_move_data(&resource->data.memory24.minimum, - &aml->memory24.minimum, 4, ACPI_MOVE_TYPE_16_TO_32); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_MEMORY24; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum), + AML_OFFSET(memory24.minimum), + 4} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_memory24 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_convert_memory32 * ******************************************************************************/ -acpi_status -acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_memory24"); +struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32, + ACPI_RS_SIZE(struct acpi_resource_memory32), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)}, - /* Set the Information Byte */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, + sizeof(struct aml_resource_memory32), + 0}, - aml->memory24.information = (u8) - (resource->data.memory24.read_write_attribute & 0x01); + /* Read/Write bit */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect), + AML_OFFSET(memory32.flags), + 0}, /* - * Set the following contiguous fields in the AML descriptor: + * These fields are contiguous in both the source and destination: * Minimum Base Address * Maximum Base Address * Address Base Alignment * Range Length */ - acpi_rs_move_data(&aml->memory24.minimum, - &resource->data.memory24.minimum, 4, - ACPI_MOVE_TYPE_32_TO_16); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY24, - sizeof(struct aml_resource_memory24), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum), + AML_OFFSET(memory32.minimum), + 4} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_memory32 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_convert_fixed_memory32 * ******************************************************************************/ -acpi_status -acpi_rs_get_memory32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_memory32"); +struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32, + ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)}, - /* Get the Read/Write bit */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, + sizeof(struct aml_resource_fixed_memory32), + 0}, - resource->data.memory32.read_write_attribute = - (aml->memory32.information & 0x01); + /* Read/Write bit */ + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect), + AML_OFFSET(fixed_memory32.flags), + 0}, /* - * Get the following contiguous fields from the AML descriptor: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment + * These fields are contiguous in both the source and destination: + * Base Address * Range Length */ - acpi_rs_move_data(&resource->data.memory32.minimum, - &aml->memory32.minimum, 4, ACPI_MOVE_TYPE_32_TO_32); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_MEMORY32; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address), + AML_OFFSET(fixed_memory32.address), + 2} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_memory32 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_get_vendor_small * ******************************************************************************/ -acpi_status -acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_memory32"); - - /* Set the Information Byte */ +struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, + ACPI_RS_SIZE(struct acpi_resource_vendor), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)}, - aml->memory32.information = (u8) - (resource->data.memory32.read_write_attribute & 0x01); + /* Length of the vendor data (byte count) */ - /* - * Set the following contiguous fields in the AML descriptor: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment - * Range Length - */ - acpi_rs_move_data(&aml->memory32.minimum, - &resource->data.memory32.minimum, 4, - ACPI_MOVE_TYPE_32_TO_32); + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + sizeof(u8)} + , - /* Complete the AML descriptor header */ + /* Vendor data */ - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY32, - sizeof(struct aml_resource_memory32), aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_small_header), + 0} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_get_fixed_memory32 - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * acpi_rs_get_vendor_large * ******************************************************************************/ -acpi_status -acpi_rs_get_fixed_memory32(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_fixed_memory32"); - - /* Get the Read/Write bit */ +struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = { + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, + ACPI_RS_SIZE(struct acpi_resource_vendor), + ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)}, - resource->data.fixed_memory32.read_write_attribute = - (aml->fixed_memory32.information & 0x01); + /* Length of the vendor data (byte count) */ - /* - * Get the following contiguous fields from the AML descriptor: - * Base Address - * Range Length - */ - ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address, - &aml->fixed_memory32.address); - ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address_length, - &aml->fixed_memory32.address_length); + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + sizeof(u8)} + , - /* Complete the resource header */ + /* Vendor data */ - resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_large_header), + 0} +}; /******************************************************************************* * - * FUNCTION: acpi_rs_set_fixed_memory32 - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * acpi_rs_set_vendor * ******************************************************************************/ -acpi_status -acpi_rs_set_fixed_memory32(struct acpi_resource *resource, - union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_fixed_memory32"); +struct acpi_rsconvert_info acpi_rs_set_vendor[7] = { + /* Default is a small vendor descriptor */ + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, + sizeof(struct aml_resource_small_header), + ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)}, + + /* Get the length and copy the data */ - /* Set the Information Byte */ + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + 0}, - aml->fixed_memory32.information = (u8) - (resource->data.fixed_memory32.read_write_attribute & 0x01); + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_small_header), + 0}, /* - * Set the following contiguous fields in the AML descriptor: - * Base Address - * Range Length + * All done if the Vendor byte length is 7 or less, meaning that it will + * fit within a small descriptor */ - ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address, - &resource->data.fixed_memory32.address); - ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address_length, - &resource->data.fixed_memory32.address_length); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_MEMORY32, - sizeof(struct aml_resource_fixed_memory32), - aml); - return_ACPI_STATUS(AE_OK); -} + {ACPI_RSC_EXIT_LE, 0, 0, 7}, + + /* Must create a large vendor descriptor */ + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, + sizeof(struct aml_resource_large_header), + 0}, + + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), + 0, + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), + sizeof(struct aml_resource_large_header), + 0} +}; diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 337a0f01cb23..16ad3bfbee2a 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -47,156 +47,267 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsmisc") +#define INIT_RESOURCE_TYPE(i) i->resource_offset +#define INIT_RESOURCE_LENGTH(i) i->aml_offset +#define INIT_TABLE_LENGTH(i) i->value +#define COMPARE_OPCODE(i) i->resource_offset +#define COMPARE_TARGET(i) i->aml_offset +#define COMPARE_VALUE(i) i->value /******************************************************************************* * - * FUNCTION: acpi_rs_get_generic_reg - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ -acpi_status -acpi_rs_get_generic_reg(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_generic_reg"); - - /* - * Get the following fields from the AML descriptor: - * Address Space ID - * Register Bit Width - * Register Bit Offset - * Access Size - * Register Address - */ - resource->data.generic_reg.space_id = aml->generic_reg.address_space_id; - resource->data.generic_reg.bit_width = aml->generic_reg.bit_width; - resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset; - resource->data.generic_reg.access_size = aml->generic_reg.access_size; - ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address, - &aml->generic_reg.address); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register); - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_generic_reg + * FUNCTION: acpi_rs_convert_aml_to_resource * * PARAMETERS: Resource - Pointer to the resource descriptor * Aml - Where the AML descriptor is returned + * Info - Pointer to appropriate conversion table * * RETURN: Status * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_generic_reg"); - - /* - * Set the following fields in the AML descriptor: - * Address Space ID - * Register Bit Width - * Register Bit Offset - * Access Size - * Register Address - */ - aml->generic_reg.address_space_id = - (u8) resource->data.generic_reg.space_id; - aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width; - aml->generic_reg.bit_offset = - (u8) resource->data.generic_reg.bit_offset; - aml->generic_reg.access_size = - (u8) resource->data.generic_reg.access_size; - ACPI_MOVE_64_TO_64(&aml->generic_reg.address, - &resource->data.generic_reg.address); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER, - sizeof(struct - aml_resource_generic_register), aml); - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_vendor - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. + * DESCRIPTION: Convert an external AML resource descriptor to the corresponding + * internal resource descriptor * ******************************************************************************/ - acpi_status -acpi_rs_get_vendor(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) +acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info) { - u8 *aml_byte_data; - - ACPI_FUNCTION_TRACE("rs_get_vendor"); + acpi_rs_length aml_resource_length; + void *source; + void *destination; + char *target; + u8 count; + u8 flags_mode = FALSE; + u16 item_count = 0; + u16 temp16 = 0; + + ACPI_FUNCTION_TRACE("rs_get_resource"); + + if (((acpi_native_uint) resource) & 0x3) { + acpi_os_printf + ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n", + resource, resource->type, resource->length); + } - /* Determine if this is a large or small vendor specific item */ + /* Extract the resource Length field (does not include header length) */ - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large item, Point to the first vendor byte */ + aml_resource_length = acpi_ut_get_resource_length(aml); - aml_byte_data = - ((u8 *) aml) + sizeof(struct aml_resource_large_header); - } else { - /* Small item, Point to the first vendor byte */ + /* + * First table entry must be ACPI_RSC_INITxxx and must contain the + * table length (# of table entries) + */ + count = INIT_TABLE_LENGTH(info); + + while (count) { + /* + * Source is the external AML byte stream buffer, + * destination is the internal resource descriptor + */ + source = ((u8 *) aml) + info->aml_offset; + destination = ((u8 *) resource) + info->resource_offset; + + switch (info->opcode) { + case ACPI_RSC_INITGET: + /* + * Get the resource type and the initial (minimum) length + */ + ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info)); + resource->type = INIT_RESOURCE_TYPE(info); + resource->length = INIT_RESOURCE_LENGTH(info); + break; + + case ACPI_RSC_INITSET: + break; + + case ACPI_RSC_FLAGINIT: + + flags_mode = TRUE; + break; + + case ACPI_RSC_1BITFLAG: + /* + * Mask and shift the flag bit + */ + *((u8 *) destination) = (u8) + ((*((u8 *) source) >> info->value) & 0x01); + break; + + case ACPI_RSC_2BITFLAG: + /* + * Mask and shift the flag bits + */ + *((u8 *) destination) = (u8) + ((*((u8 *) source) >> info->value) & 0x03); + break; + + case ACPI_RSC_COUNT: + + item_count = *((u8 *) source); + *((u8 *) destination) = (u8) item_count; + + resource->length = resource->length + + (info->value * (item_count - 1)); + break; + + case ACPI_RSC_COUNT16: + + item_count = aml_resource_length; + *((u16 *) destination) = item_count; + + resource->length = resource->length + + (info->value * (item_count - 1)); + break; + + case ACPI_RSC_LENGTH: + + resource->length = resource->length + info->value; + break; + + case ACPI_RSC_MOVE8: + case ACPI_RSC_MOVE16: + case ACPI_RSC_MOVE32: + case ACPI_RSC_MOVE64: + /* + * Raw data move. Use the Info value field unless item_count has + * been previously initialized via a COUNT opcode + */ + if (info->value) { + item_count = info->value; + } + acpi_rs_move_data(destination, source, item_count, + info->opcode); + break; + + case ACPI_RSC_SET8: + + ACPI_MEMSET(destination, info->aml_offset, info->value); + break; + + case ACPI_RSC_DATA8: + + target = ((char *)resource) + info->value; + ACPI_MEMCPY(destination, source, + *(ACPI_CAST_PTR(u16, target))); + break; + + case ACPI_RSC_ADDRESS: + /* + * Common handler for address descriptor flags + */ + if (!acpi_rs_get_address_common(resource, aml)) { + return_ACPI_STATUS + (AE_AML_INVALID_RESOURCE_TYPE); + } + break; + + case ACPI_RSC_SOURCE: + /* + * Optional resource_source (Index and String) + */ + resource->length += + acpi_rs_get_resource_source(aml_resource_length, + info->value, + destination, aml, NULL); + break; + + case ACPI_RSC_SOURCEX: + /* + * Optional resource_source (Index and String). This is the more + * complicated case used by the Interrupt() macro + */ + target = + ((char *)resource) + info->aml_offset + + (item_count * 4); + + resource->length += + acpi_rs_get_resource_source(aml_resource_length, + (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target); + break; + + case ACPI_RSC_BITMASK: + /* + * 8-bit encoded bitmask (DMA macro) + */ + item_count = + acpi_rs_decode_bitmask(*((u8 *) source), + destination); + if (item_count) { + resource->length += + resource->length + (item_count - 1); + } + + target = ((char *)resource) + info->value; + *((u8 *) target) = (u8) item_count; + break; + + case ACPI_RSC_BITMASK16: + /* + * 16-bit encoded bitmask (IRQ macro) + */ + ACPI_MOVE_16_TO_16(&temp16, source); + + item_count = + acpi_rs_decode_bitmask(temp16, destination); + if (item_count) { + resource->length = + resource->length + (item_count - 1); + } + + target = ((char *)resource) + info->value; + *((u8 *) target) = (u8) item_count; + break; + + case ACPI_RSC_EXIT_NE: + /* + * Control - Exit conversion if not equal + */ + switch (info->resource_offset) { + case ACPI_RSC_COMPARE_AML_LENGTH: + if (aml_resource_length != info->value) { + goto exit; + } + break; + + case ACPI_RSC_COMPARE_VALUE: + if (*((u8 *) source) != info->value) { + goto exit; + } + break; + + default: + acpi_os_printf + ("*** Invalid conversion sub-opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + break; + + default: + + acpi_os_printf("*** Invalid conversion opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } - aml_byte_data = - ((u8 *) aml) + sizeof(struct aml_resource_small_header); + count--; + info++; } - /* Copy the vendor-specific bytes */ - - ACPI_MEMCPY(resource->data.vendor.byte_data, - aml_byte_data, aml_resource_length); - resource->data.vendor.byte_length = aml_resource_length; + exit: + if (!flags_mode) { + /* Round the resource struct length up to the next 32-bit boundary */ - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the vendor string and expand the - * struct_size to the next 32-bit boundary. - */ - resource->type = ACPI_RESOURCE_TYPE_VENDOR; - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + - ACPI_ROUND_UP_to_32_bITS(aml_resource_length); + resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); + } return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_set_vendor + * FUNCTION: acpi_rs_convert_resource_to_aml * * PARAMETERS: Resource - Pointer to the resource descriptor * Aml - Where the AML descriptor is returned + * Info - Pointer to appropriate conversion table * * RETURN: Status * @@ -206,275 +317,236 @@ acpi_rs_get_vendor(union aml_resource *aml, ******************************************************************************/ acpi_status -acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml) +acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info) { - u32 resource_length; - u8 *source; - u8 *destination; - - ACPI_FUNCTION_TRACE("rs_set_vendor"); - - resource_length = resource->data.vendor.byte_length; - source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data); - - /* Length determines if this is a large or small resource */ + void *source = NULL; + void *destination; + acpi_rsdesc_size aml_length = 0; + u8 count; + u16 temp16 = 0; + u16 item_count = 0; - if (resource_length > 7) { - /* Large item, get pointer to the data part of the descriptor */ + ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); - destination = - ((u8 *) aml) + sizeof(struct aml_resource_large_header); + /* Validate the Resource pointer, must be 32-bit aligned */ - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE, - (u32) (resource_length + - sizeof(struct - aml_resource_large_header)), - aml); - } else { - /* Small item, get pointer to the data part of the descriptor */ - - destination = - ((u8 *) aml) + sizeof(struct aml_resource_small_header); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL, - (u32) (resource_length + - sizeof(struct - aml_resource_small_header)), - aml); + if (((acpi_native_uint) resource) & 0x3) { + acpi_os_printf + ("**** SET: Misaligned resource pointer: %p Type %2.2X Len %X\n", + resource, resource->type, resource->length); } - /* Copy the vendor-specific bytes */ - - ACPI_MEMCPY(destination, source, resource_length); - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_start_dpf - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_start_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_start_dpf"); - - /* Get the flags byte if present */ - - if (aml_resource_length == 1) { - /* Get the Compatibility priority */ - - resource->data.start_dpf.compatibility_priority = - (aml->start_dpf.flags & 0x03); - - if (resource->data.start_dpf.compatibility_priority >= 3) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); - } - - /* Get the Performance/Robustness preference */ - - resource->data.start_dpf.performance_robustness = - ((aml->start_dpf.flags >> 2) & 0x03); - - if (resource->data.start_dpf.performance_robustness >= 3) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); + /* + * First table entry must be ACPI_RSC_INITxxx and must contain the + * table length (# of table entries) + */ + count = INIT_TABLE_LENGTH(info); + + while (count) { + /* + * Source is the internal resource descriptor, + * destination is the external AML byte stream buffer + */ + source = ((u8 *) resource) + info->resource_offset; + destination = ((u8 *) aml) + info->aml_offset; + + switch (info->opcode) { + case ACPI_RSC_INITSET: + + ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info)); + aml_length = INIT_RESOURCE_LENGTH(info); + acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info), + aml_length, aml); + break; + + case ACPI_RSC_INITGET: + break; + + case ACPI_RSC_FLAGINIT: + /* + * Clear the flag byte + */ + *((u8 *) destination) = 0; + break; + + case ACPI_RSC_1BITFLAG: + /* + * Mask and shift the flag bit + */ + *((u8 *) destination) |= (u8) + ((*((u8 *) source) & 0x01) << info->value); + break; + + case ACPI_RSC_2BITFLAG: + /* + * Mask and shift the flag bits + */ + *((u8 *) destination) |= (u8) + ((*((u8 *) source) & 0x03) << info->value); + break; + + case ACPI_RSC_COUNT: + + item_count = *((u8 *) source); + *((u8 *) destination) = (u8) item_count; + + aml_length = (u16) (aml_length + + (info->value * (item_count - 1))); + break; + + case ACPI_RSC_COUNT16: + + item_count = *((u16 *) source); + aml_length = (u16) (aml_length + item_count); + acpi_rs_set_resource_length(aml_length, aml); + break; + + case ACPI_RSC_LENGTH: + + acpi_rs_set_resource_length(info->value, aml); + break; + + case ACPI_RSC_MOVE8: + case ACPI_RSC_MOVE16: + case ACPI_RSC_MOVE32: + case ACPI_RSC_MOVE64: + + if (info->value) { + item_count = info->value; + } + acpi_rs_move_data(destination, source, item_count, + info->opcode); + break; + + case ACPI_RSC_ADDRESS: + + /* Set the Resource Type, General Flags, and Type-Specific Flags */ + + acpi_rs_set_address_common(aml, resource); + break; + + case ACPI_RSC_SOURCEX: + /* + * Optional resource_source (Index and String) + */ + aml_length = + acpi_rs_set_resource_source(aml, + (acpi_rs_length) + aml_length, source); + acpi_rs_set_resource_length(aml_length, aml); + break; + + case ACPI_RSC_SOURCE: + /* + * Optional resource_source (Index and String). This is the more + * complicated case used by the Interrupt() macro + */ + aml_length = + acpi_rs_set_resource_source(aml, info->value, + source); + acpi_rs_set_resource_length(aml_length, aml); + break; + + case ACPI_RSC_BITMASK: + /* + * 8-bit encoded bitmask (DMA macro) + */ + *((u8 *) destination) = (u8) + acpi_rs_encode_bitmask(source, + *(((u8 *) resource) + + info->value)); + break; + + case ACPI_RSC_BITMASK16: + /* + * 16-bit encoded bitmask (IRQ macro) + */ + temp16 = + acpi_rs_encode_bitmask(source, + *(((u8 *) resource) + + info->value)); + ACPI_MOVE_16_TO_16(destination, &temp16); + break; + + case ACPI_RSC_EXIT_LE: + /* + * Control - Exit conversion if less than or equal + */ + if (item_count <= info->value) { + goto exit; + } + break; + + case ACPI_RSC_EXIT_NE: + /* + * Control - Exit conversion if not equal + */ + switch (COMPARE_OPCODE(info)) { + case ACPI_RSC_COMPARE_VALUE: + if (* + ((u8 *) (((u8 *) resource) + + COMPARE_TARGET(info))) != + COMPARE_VALUE(info)) { + goto exit; + } + break; + + default: + acpi_os_printf + ("*** Invalid conversion sub-opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + break; + + default: + + acpi_os_printf("*** Invalid conversion opcode\n"); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - } else { - /* start_dependent_no_pri(), no flags byte, set defaults */ - - resource->data.start_dpf.compatibility_priority = - ACPI_ACCEPTABLE_CONFIGURATION; - resource->data.start_dpf.performance_robustness = - ACPI_ACCEPTABLE_CONFIGURATION; + count--; + info++; } - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT; - resource->length = - ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent); + exit: return_ACPI_STATUS(AE_OK); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_start_dpf - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_start_dpf"); +#if 0 +/* Previous resource validations */ - /* - * The descriptor type field is set based upon whether a byte is needed - * to contain Priority data. - */ - if (ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.compatibility_priority && - ACPI_ACCEPTABLE_CONFIGURATION == - resource->data.start_dpf.performance_robustness) { - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, - sizeof(struct - aml_resource_start_dependent_noprio), - aml); - } else { - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, - sizeof(struct - aml_resource_start_dependent), - aml); - - /* Set the Flags byte */ - - aml->start_dpf.flags = (u8) - (((resource->data.start_dpf. - performance_robustness & 0x03) << 2) | (resource->data. - start_dpf. - compatibility_priority - & 0x03)); - } - return_ACPI_STATUS(AE_OK); +if (aml->ext_address64.revision_iD != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { + return_ACPI_STATUS(AE_SUPPORT); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_end_dpf - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_end_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_end_dpf"); - - /* Complete the resource header */ - - resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT; - resource->length = (u32) ACPI_RESOURCE_LENGTH; - return_ACPI_STATUS(AE_OK); +if (resource->data.start_dpf.performance_robustness >= 3) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_end_dpf - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_end_dpf"); - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT, - sizeof(struct aml_resource_end_dependent), - aml); - return_ACPI_STATUS(AE_OK); +if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { + /* + * Only [active_high, edge_sensitive] or [active_low, level_sensitive] + * polarity/trigger interrupts are allowed (ACPI spec, section + * "IRQ Format"), so 0x00 and 0x09 are illegal. + */ + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid interrupt polarity/trigger in resource list, %X\n", + aml->irq.flags)); + return_ACPI_STATUS(AE_BAD_DATA); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_end_tag - * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * aml_resource_length - Length of the resource from the AML header - * Resource - Where the internal resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding - * internal resource descriptor, simplifying bitflags and handling - * alignment and endian issues if necessary. - * - ******************************************************************************/ - -acpi_status -acpi_rs_get_end_tag(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource) -{ - ACPI_FUNCTION_TRACE("rs_get_end_tag"); - - /* Complete the resource header */ +resource->data.extended_irq.interrupt_count = temp8; +if (temp8 < 1) { + /* Must have at least one IRQ */ - resource->type = ACPI_RESOURCE_TYPE_END_TAG; - resource->length = ACPI_RESOURCE_LENGTH; - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); } -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_end_tag - * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. - * - ******************************************************************************/ - -acpi_status -acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml) -{ - ACPI_FUNCTION_TRACE("rs_set_end_tag"); - - /* - * Set the Checksum - zero means that the resource data is treated as if - * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) - */ - aml->end_tag.checksum = 0; - - /* Complete the AML descriptor header */ - - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG, - sizeof(struct aml_resource_end_tag), aml); - return_ACPI_STATUS(AE_OK); +if (resource->data.dma.transfer == 0x03) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid DMA.Transfer preference (3)\n")); + return_ACPI_STATUS(AE_BAD_DATA); } +#endif diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 9d503de1a349..7613033f5dcf 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -48,6 +48,64 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rsutils") +/******************************************************************************* + * + * FUNCTION: acpi_rs_decode_bitmask + * + * PARAMETERS: Mask - Bitmask to decode + * List - Where the converted list is returned + * + * RETURN: Count of bits set (length of list) + * + * DESCRIPTION: Convert a bit mask into a list of values + * + ******************************************************************************/ +u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) +{ + acpi_native_uint i; + u8 bit_count; + + /* Decode the mask bits */ + + for (i = 0, bit_count = 0; mask; i++) { + if (mask & 0x0001) { + list[bit_count] = (u8) i; + bit_count++; + } + + mask >>= 1; + } + + return (bit_count); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_encode_bitmask + * + * PARAMETERS: List - List of values to encode + * Count - Length of list + * + * RETURN: Encoded bitmask + * + * DESCRIPTION: Convert a list of values to an encoded bitmask + * + ******************************************************************************/ + +u16 acpi_rs_encode_bitmask(u8 * list, u8 count) +{ + acpi_native_uint i; + u16 mask; + + /* Encode the list into a single bitmask */ + + for (i = 0, mask = 0; i < count; i++) { + mask |= (0x0001 << list[i]); + } + + return (mask); +} + /******************************************************************************* * * FUNCTION: acpi_rs_move_data @@ -64,6 +122,7 @@ ACPI_MODULE_NAME("rsutils") * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) * ******************************************************************************/ + void acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) { @@ -73,22 +132,30 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) for (i = 0; i < item_count; i++) { switch (move_type) { - case ACPI_MOVE_TYPE_16_TO_32: - ACPI_MOVE_16_TO_32(&((u32 *) destination)[i], - &((u16 *) source)[i]); - break; + /* + * For the 8-bit case, we can perform the move all at once + * since there are no alignment or endian issues + */ + case ACPI_RSC_MOVE8: + ACPI_MEMCPY(destination, source, item_count); + return; - case ACPI_MOVE_TYPE_32_TO_16: - ACPI_MOVE_32_TO_16(&((u16 *) destination)[i], - &((u32 *) source)[i]); + /* + * 16-, 32-, and 64-bit cases must use the move macros that perform + * endian conversion and/or accomodate hardware that cannot perform + * misaligned memory transfers + */ + case ACPI_RSC_MOVE16: + ACPI_MOVE_16_TO_16(&((u16 *) destination)[i], + &((u16 *) source)[i]); break; - case ACPI_MOVE_TYPE_32_TO_32: + case ACPI_RSC_MOVE32: ACPI_MOVE_32_TO_32(&((u32 *) destination)[i], &((u32 *) source)[i]); break; - case ACPI_MOVE_TYPE_64_TO_64: + case ACPI_RSC_MOVE64: ACPI_MOVE_64_TO_64(&((u64 *) destination)[i], &((u64 *) source)[i]); break; @@ -148,80 +215,57 @@ struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type) /******************************************************************************* * - * FUNCTION: acpi_rs_get_resource_length + * FUNCTION: acpi_rs_set_resource_length * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * PARAMETERS: total_length - Length of the AML descriptor, including + * the header and length fields. + * Aml - Pointer to the raw AML descriptor * - * RETURN: Byte Length + * RETURN: None * - * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By - * definition, this does not include the size of the descriptor - * header or the length field itself. + * DESCRIPTION: Set the resource_length field of an AML + * resource descriptor, both Large and Small descriptors are + * supported automatically. Note: Descriptor Type field must + * be valid. * ******************************************************************************/ -u16 acpi_rs_get_resource_length(union aml_resource * aml) +void +acpi_rs_set_resource_length(acpi_rsdesc_size total_length, + union aml_resource *aml) { - u16 resource_length; + acpi_rs_length resource_length; ACPI_FUNCTION_ENTRY(); /* Determine if this is a small or large resource */ - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { + if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - ACPI_MOVE_16_TO_16(&resource_length, - &aml->large_header.resource_length); + resource_length = (acpi_rs_length) + (total_length - sizeof(struct aml_resource_large_header)); + + /* Insert length into the Large descriptor length field */ + ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, + &resource_length); } else { /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - resource_length = (u16) (aml->small_header.descriptor_type & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); - } - - return (resource_length); -} + resource_length = (acpi_rs_length) + (total_length - sizeof(struct aml_resource_small_header)); -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_descriptor_length - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Byte length - * - * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the - * length of the descriptor header and the length field itself. - * Used to walk descriptor lists. - * - ******************************************************************************/ - -u32 acpi_rs_get_descriptor_length(union aml_resource * aml) -{ - u32 descriptor_length; - - ACPI_FUNCTION_ENTRY(); - - /* Determine if this is a small or large resource */ - - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + /* Insert length into the descriptor type byte */ - ACPI_MOVE_16_TO_32(&descriptor_length, - &aml->large_header.resource_length); - descriptor_length += sizeof(struct aml_resource_large_header); + aml->small_header.descriptor_type = (u8) - } else { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + /* Clear any existing length, preserving descriptor type bits */ + ((aml->small_header. + descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - descriptor_length = (u32) (aml->small_header.descriptor_type & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); - descriptor_length += sizeof(struct aml_resource_small_header); + | resource_length); } - - return (descriptor_length); } /******************************************************************************* @@ -243,71 +287,18 @@ u32 acpi_rs_get_descriptor_length(union aml_resource * aml) void acpi_rs_set_resource_header(u8 descriptor_type, - acpi_size total_length, union aml_resource *aml) + acpi_rsdesc_size total_length, + union aml_resource *aml) { - u16 resource_length; - ACPI_FUNCTION_ENTRY(); - /* Set the descriptor type */ + /* Set the Descriptor Type */ aml->small_header.descriptor_type = descriptor_type; - /* Determine if this is a small or large resource */ - - if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - - resource_length = - (u16) (total_length - - sizeof(struct aml_resource_large_header)); - - /* Insert length into the Large descriptor length field */ - - ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, - &resource_length); - } else { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - - resource_length = - (u16) (total_length - - sizeof(struct aml_resource_small_header)); - - /* Insert length into the descriptor type byte */ - - aml->small_header.descriptor_type |= (u8) resource_length; - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_resource_type - * - * PARAMETERS: resource_type - Byte 0 of a resource descriptor - * - * RETURN: The Resource Type with no extraneous bits (except the - * Large/Small descriptor bit -- this is left alone) - * - * DESCRIPTION: Extract the Resource Type/Name from the first byte of - * a resource descriptor. - * - ******************************************************************************/ - -u8 acpi_rs_get_resource_type(u8 resource_type) -{ - ACPI_FUNCTION_ENTRY(); + /* Set the Resource Length */ - /* Determine if this is a small or large resource */ - - if (resource_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ - - return (resource_type); - } else { - /* Small Resource Type -- bits 6:3 contain the name */ - - return ((u8) (resource_type & ACPI_RESOURCE_NAME_SMALL_MASK)); - } + acpi_rs_set_resource_length(total_length, aml); } /******************************************************************************* @@ -360,13 +351,13 @@ static u16 acpi_rs_strcpy(char *destination, char *source) * ******************************************************************************/ -u16 -acpi_rs_get_resource_source(u16 resource_length, - acpi_size minimum_length, +acpi_rs_length +acpi_rs_get_resource_source(acpi_rs_length resource_length, + acpi_rs_length minimum_length, struct acpi_resource_source * resource_source, union aml_resource * aml, char *string_ptr) { - acpi_size total_length; + acpi_rsdesc_size total_length; u8 *aml_resource_source; ACPI_FUNCTION_ENTRY(); @@ -382,7 +373,7 @@ acpi_rs_get_resource_source(u16 resource_length, * Note: Some resource descriptors will have an additional null, so * we add 1 to the minimum length. */ - if (total_length > (minimum_length + 1)) { + if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { /* Get the resource_source_index */ resource_source->index = aml_resource_source[0]; @@ -398,20 +389,26 @@ acpi_rs_get_resource_source(u16 resource_length, sizeof(struct acpi_resource_source); } + /* + * In order for the struct_size to fall on a 32-bit boundary, calculate + * the length of the string (+1 for the NULL terminator) and expand the + * struct_size to the next 32-bit boundary. + * + * Zero the entire area of the buffer. + */ + total_length = + ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN + ((char *)&aml_resource_source[1]) + + 1); + ACPI_MEMSET(resource_source->string_ptr, 0, total_length); + /* Copy the resource_source string to the destination */ resource_source->string_length = acpi_rs_strcpy(resource_source->string_ptr, (char *)&aml_resource_source[1]); - /* - * In order for the struct_size to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * struct_size to the next 32-bit boundary. - */ - return ((u16) - ACPI_ROUND_UP_to_32_bITS(resource_source-> - string_length)); + return ((acpi_rs_length) total_length); } else { /* resource_source is not present */ @@ -434,18 +431,18 @@ acpi_rs_get_resource_source(u16 resource_length, * * RETURN: Total length of the AML descriptor * - * DESCRIPTION: Convert an optoinal resource_source from internal format to a + * DESCRIPTION: Convert an optional resource_source from internal format to a * raw AML resource descriptor * ******************************************************************************/ -acpi_size +acpi_rsdesc_size acpi_rs_set_resource_source(union aml_resource * aml, - acpi_size minimum_length, + acpi_rs_length minimum_length, struct acpi_resource_source * resource_source) { u8 *aml_resource_source; - acpi_size descriptor_length; + acpi_rsdesc_size descriptor_length; ACPI_FUNCTION_ENTRY(); @@ -472,7 +469,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, * final descriptor length */ descriptor_length += - ((acpi_size) resource_source->string_length + 1); + ((acpi_rsdesc_size) resource_source->string_length + 1); } /* Return the new total length of the AML descriptor */ diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 9d179beb17ae..09d250ab9872 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -57,7 +57,7 @@ ACPI_MODULE_NAME("rsxface") ACPI_COPY_FIELD(out, in, decode); \ ACPI_COPY_FIELD(out, in, min_address_fixed); \ ACPI_COPY_FIELD(out, in, max_address_fixed); \ - ACPI_COPY_FIELD(out, in, attribute); \ + ACPI_COPY_FIELD(out, in, info); \ ACPI_COPY_FIELD(out, in, granularity); \ ACPI_COPY_FIELD(out, in, minimum); \ ACPI_COPY_FIELD(out, in, maximum); \ diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 4b2fbb592f49..e6dfe688b76b 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -94,9 +94,8 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) new_table_desc->pointer->length) && (!ACPI_MEMCMP - ((const char *)table_desc->pointer, - (const char *)new_table_desc->pointer, - (acpi_size) new_table_desc->pointer->length))) { + (table_desc->pointer, new_table_desc->pointer, + new_table_desc->pointer->length))) { /* Match: this table is already installed */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index dc7f24b3a1c0..e04b6119a4d7 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -866,7 +866,7 @@ void acpi_ut_dump_allocations(u32 component, char *module) if (!num_outstanding) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No outstanding allocations.\n")); + "No outstanding allocations\n")); } else { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "%d(%X) Outstanding allocations\n", diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 7f72839841ca..413e1dd8ae36 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -217,23 +217,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to * perform a Notify() operation on it. */ -const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = - { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, -{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, -{"_SB_", ACPI_TYPE_DEVICE, NULL}, -{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, -{"_TZ_", ACPI_TYPE_THERMAL, NULL}, -{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, -{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, -{"_GL_", ACPI_TYPE_MUTEX, (char *)1}, +const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { + {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_SB_", ACPI_TYPE_DEVICE, NULL}, + {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, + {"_TZ_", ACPI_TYPE_THERMAL, NULL}, + {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, + {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, + {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) -{"_OSI", ACPI_TYPE_METHOD, (char *)1}, + {"_OSI", ACPI_TYPE_METHOD, (char *)1}, #endif /* Table terminator */ -{NULL, ACPI_TYPE_ANY, NULL} + {NULL, ACPI_TYPE_ANY, NULL} }; /* @@ -503,11 +503,13 @@ char *acpi_ut_get_region_name(u8 space_id) /* Event type decoding */ static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { +/*! [Begin] no source code translation (keep these strings as-is) */ "PM_Timer", - "global_lock", - "power_button", - "sleep_button", - "real_time_clock", + "GlobalLock", + "PowerButton", + "SleepButton", + "RealTimeClock", +/*! [End] no source code translation !*/ }; char *acpi_ut_get_event_name(u32 event_id) @@ -545,12 +547,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED"; /* Printable names of the ACPI object types */ static const char *acpi_gbl_ns_type_names[] = { +/*! [Begin] no source code translation (keep these strings as-is) */ /* 00 */ "Untyped", /* 01 */ "Integer", /* 02 */ "String", /* 03 */ "Buffer", /* 04 */ "Package", - /* 05 */ "field_unit", + /* 05 */ "FieldUnit", /* 06 */ "Device", /* 07 */ "Event", /* 08 */ "Method", @@ -559,23 +562,24 @@ static const char *acpi_gbl_ns_type_names[] = { /* 11 */ "Power", /* 12 */ "Processor", /* 13 */ "Thermal", - /* 14 */ "buffer_field", - /* 15 */ "ddb_handle", - /* 16 */ "debug_object", - /* 17 */ "region_field", - /* 18 */ "bank_field", - /* 19 */ "index_field", + /* 14 */ "BufferField", + /* 15 */ "DdbHandle", + /* 16 */ "DebugObject", + /* 17 */ "RegionField", + /* 18 */ "BankField", + /* 19 */ "IndexField", /* 20 */ "Reference", /* 21 */ "Alias", - /* 22 */ "method_alias", + /* 22 */ "MethodAlias", /* 23 */ "Notify", - /* 24 */ "addr_handler", - /* 25 */ "resource_desc", - /* 26 */ "resource_fld", + /* 24 */ "AddrHandler", + /* 25 */ "ResourceDesc", + /* 26 */ "ResourceFld", /* 27 */ "Scope", /* 28 */ "Extra", /* 29 */ "Data", /* 30 */ "Invalid" +/*! [End] no source code translation !*/ }; char *acpi_ut_get_type_name(acpi_object_type type) @@ -658,15 +662,16 @@ char *acpi_ut_get_node_name(void *object) /* Printable names of object descriptor types */ static const char *acpi_gbl_desc_type_names[] = { +/*! [Begin] no source code translation (keep these ASL Keywords as-is) */ /* 00 */ "Invalid", /* 01 */ "Cached", /* 02 */ "State-Generic", /* 03 */ "State-Update", /* 04 */ "State-Package", /* 05 */ "State-Control", - /* 06 */ "State-root_parse_scope", - /* 07 */ "State-parse_scope", - /* 08 */ "State-walk_scope", + /* 06 */ "State-RootParseScope", + /* 07 */ "State-ParseScope", + /* 08 */ "State-WalkScope", /* 09 */ "State-Result", /* 10 */ "State-Notify", /* 11 */ "State-Thread", @@ -674,6 +679,7 @@ static const char *acpi_gbl_desc_type_names[] = { /* 13 */ "Parser", /* 14 */ "Operand", /* 15 */ "Node" +/*! [End] no source code translation !*/ }; char *acpi_ut_get_descriptor_name(void *object) diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index b57afa7421e8..e9058d4da122 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -43,6 +43,7 @@ #include #include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utmisc") @@ -788,6 +789,113 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) return ((u8) (0 - sum)); } +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_type + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: The Resource Type with no extraneous bits (except the + * Large/Small descriptor bit -- this is left alone) + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +u8 acpi_ut_get_resource_type(void *aml) +{ + ACPI_FUNCTION_ENTRY(); + + /* + * Byte 0 contains the descriptor name (Resource Type) + * Determine if this is a small or large resource + */ + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource Type -- bits 6:0 contain the name */ + + return (*((u8 *) aml)); + } else { + /* Small Resource Type -- bits 6:3 contain the name */ + + return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte Length + * + * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By + * definition, this does not include the size of the descriptor + * header or the length field itself. + * + ******************************************************************************/ + +u16 acpi_ut_get_resource_length(void *aml) +{ + u16 resource_length; + + ACPI_FUNCTION_ENTRY(); + + /* + * Byte 0 contains the descriptor name (Resource Type) + * Determine if this is a small or large resource + */ + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]); + + } else { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + resource_length = (u16) (*((u8 *) aml) & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + } + + return (resource_length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_descriptor_length + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte length + * + * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the + * length of the descriptor header and the length field itself. + * Used to walk descriptor lists. + * + ******************************************************************************/ + +u32 acpi_ut_get_descriptor_length(void *aml) +{ + u32 descriptor_length; + + ACPI_FUNCTION_ENTRY(); + + /* First get the Resource Length (Does not include header length) */ + + descriptor_length = acpi_ut_get_resource_length(aml); + + /* Determine if this is a small or large resource */ + + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { + descriptor_length += sizeof(struct aml_resource_large_header); + } else { + descriptor_length += sizeof(struct aml_resource_small_header); + } + + return (descriptor_length); +} + /******************************************************************************* * * FUNCTION: acpi_ut_get_resource_end_tag @@ -796,42 +904,34 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) * * RETURN: Pointer to the end tag * - * DESCRIPTION: Find the END_TAG resource descriptor in a resource template + * DESCRIPTION: Find the END_TAG resource descriptor in an AML resource template * ******************************************************************************/ u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) { - u8 buffer_byte; - u8 *buffer; - u8 *end_buffer; - - buffer = obj_desc->buffer.pointer; - end_buffer = buffer + obj_desc->buffer.length; + u8 *aml; + u8 *end_aml; - while (buffer < end_buffer) { - buffer_byte = *buffer; - if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) { - /* Large Descriptor - Length is next 2 bytes */ + aml = obj_desc->buffer.pointer; + end_aml = aml + obj_desc->buffer.length; - buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); - } else { - /* Small Descriptor. End Tag will be found here */ + /* Walk the resource template, one descriptor per loop */ - if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) == - ACPI_RESOURCE_NAME_END_TAG) { - /* Found the end tag descriptor, all done. */ + while (aml < end_aml) { + if (acpi_ut_get_resource_type(aml) == + ACPI_RESOURCE_NAME_END_TAG) { + /* Found the end_tag descriptor, all done */ - return (buffer); - } + return (aml); + } - /* Length is in the header */ + /* Point to the next resource descriptor */ - buffer += ((buffer_byte & 0x07) + 1); - } + aml += acpi_ut_get_resource_length(aml); } - /* End tag not found */ + /* End tag was not found */ return (NULL); } diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index f4adebde6155..b8b46ab54f4e 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -401,7 +401,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, mem->align = p->alignment; mem->size = p->address_length; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -424,7 +424,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, mem->align = p->alignment; mem->size = p->address_length; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -446,7 +446,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, mem->size = p->address_length; mem->align = 0; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -734,7 +734,7 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, resource->type = ACPI_RESOURCE_TYPE_MEMORY24; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ - resource->data.memory24.read_write_attribute = + resource->data.memory24.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; resource->data.memory24.minimum = p->start; @@ -748,7 +748,7 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, { resource->type = ACPI_RESOURCE_TYPE_MEMORY32; resource->length = sizeof(struct acpi_resource); - resource->data.memory32.read_write_attribute = + resource->data.memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; resource->data.memory32.minimum = p->start; @@ -762,7 +762,7 @@ static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, { resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; resource->length = sizeof(struct acpi_resource); - resource->data.fixed_memory32.read_write_attribute = + resource->data.fixed_memory32.write_protect = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; resource->data.fixed_memory32.address = p->start; diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index cb59b018c84c..7676afec09a2 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20050930 +#define ACPI_CA_VERSION 0x20051021 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index b2921b869bb4..99250ee1b9d1 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -60,6 +60,7 @@ extern struct acpi_external_list *acpi_gbl_external_list; extern const char *acpi_gbl_io_decode[2]; extern const char *acpi_gbl_word_decode[4]; extern const char *acpi_gbl_consume_decode[2]; +extern const char *acpi_gbl_config_decode[4]; extern const char *acpi_gbl_min_decode[2]; extern const char *acpi_gbl_max_decode[2]; extern const char *acpi_gbl_DECdecode[2]; @@ -171,11 +172,19 @@ u8 acpi_dm_is_string_buffer(union acpi_parse_object *op); /* * dmresrc */ +void acpi_dm_dump_integer8(u8 value, char *name); + +void acpi_dm_dump_integer16(u16 value, char *name); + +void acpi_dm_dump_integer32(u32 value, char *name); + +void acpi_dm_dump_integer64(u64 value, char *name); + void -acpi_dm_resource_descriptor(struct acpi_op_walk_info *info, - u8 * byte_data, u32 byte_count); +acpi_dm_resource_template(struct acpi_op_walk_info *info, + u8 * byte_data, u32 byte_count); -u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op); +u8 acpi_dm_is_resource_template(union acpi_parse_object *op); void acpi_dm_indent(u32 level); @@ -223,6 +232,8 @@ void acpi_dm_vendor_large_descriptor(union aml_resource *resource, u32 length, u32 level); +void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level); + /* * dmresrcs */ diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 258cfe5e2aac..e42222c3d34c 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -202,7 +202,7 @@ #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) -#ifdef ACPI_MISALIGNED_TRANSFERS +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED /* The hardware supports unaligned transfers, just do the little-endian move */ @@ -563,11 +563,11 @@ return (_s); }) #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ register u8 _s = (u8) (s); \ - acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ return (_s); }) #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ register u32 _s = (u32) (s); \ - acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ return (_s); }) #else /* Use original less-safe macros */ diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 98e0b8cd14ed..58473f60755f 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -108,9 +108,9 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle); void acpi_os_delete_lock(acpi_handle handle); -unsigned long acpi_os_acquire_lock(acpi_handle handle); +acpi_native_uint acpi_os_acquire_lock(acpi_handle handle); -void acpi_os_release_lock(acpi_handle handle, unsigned long flags); +void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags); /* * Memory allocation and mapping diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index b66994e9e4ee..25cff0d5ba58 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -48,49 +48,133 @@ #include "amlresrc.h" +/* + * If possible, pack the following structures to byte alignment, since we + * don't care about performance for debug output + */ +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#pragma pack(1) +#endif + +/* + * Individual entry for the resource conversion tables + */ +typedef const struct acpi_rsconvert_info { + u8 opcode; + u8 resource_offset; + u8 aml_offset; + u8 value; + +} acpi_rsconvert_info; + +/* Resource conversion opcodes */ + +#define ACPI_RSC_INITGET 0 +#define ACPI_RSC_INITSET 1 +#define ACPI_RSC_FLAGINIT 2 +#define ACPI_RSC_1BITFLAG 3 +#define ACPI_RSC_2BITFLAG 4 +#define ACPI_RSC_COUNT 5 +#define ACPI_RSC_COUNT16 6 +#define ACPI_RSC_LENGTH 7 +#define ACPI_RSC_MOVE8 8 +#define ACPI_RSC_MOVE16 9 +#define ACPI_RSC_MOVE32 10 +#define ACPI_RSC_MOVE64 11 +#define ACPI_RSC_SET8 12 +#define ACPI_RSC_DATA8 13 +#define ACPI_RSC_ADDRESS 14 +#define ACPI_RSC_SOURCE 15 +#define ACPI_RSC_SOURCEX 16 +#define ACPI_RSC_BITMASK 17 +#define ACPI_RSC_BITMASK16 18 +#define ACPI_RSC_EXIT_NE 19 +#define ACPI_RSC_EXIT_LE 20 + +/* Resource Conversion sub-opcodes */ + +#define ACPI_RSC_COMPARE_AML_LENGTH 0 +#define ACPI_RSC_COMPARE_VALUE 1 + +#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info)) + +#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) +#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) + /* * Resource dispatch and info tables */ -struct acpi_resource_info { +typedef const struct acpi_resource_info { u8 length_type; u8 minimum_aml_resource_length; u8 minimum_internal_struct_length; -}; + +} acpi_resource_info; /* Types for length_type above */ -#define ACPI_FIXED_LENGTH 0 -#define ACPI_VARIABLE_LENGTH 1 -#define ACPI_SMALL_VARIABLE_LENGTH 2 +#define ACPI_FIXED_LENGTH 0 +#define ACPI_VARIABLE_LENGTH 1 +#define ACPI_SMALL_VARIABLE_LENGTH 2 + +typedef const struct acpi_rsdump_info { + u8 opcode; + u8 offset; + char *name; + const void *pointer; -/* Handlers */ +} acpi_rsdump_info; -typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource * - resource, - union aml_resource * aml); +/* Values for the Opcode field above */ -typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml, - u16 aml_resource_length, - struct acpi_resource * - resource); +#define ACPI_RSD_TITLE 0 +#define ACPI_RSD_LITERAL 1 +#define ACPI_RSD_STRING 2 +#define ACPI_RSD_UINT8 3 +#define ACPI_RSD_UINT16 4 +#define ACPI_RSD_UINT32 5 +#define ACPI_RSD_UINT64 6 +#define ACPI_RSD_1BITFLAG 7 +#define ACPI_RSD_2BITFLAG 8 +#define ACPI_RSD_SHORTLIST 9 +#define ACPI_RSD_LONGLIST 10 +#define ACPI_RSD_DWORDLIST 11 +#define ACPI_RSD_ADDRESS 12 +#define ACPI_RSD_SOURCE 13 -typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data); +/* restore default alignment */ -/* Tables indexed by internal resource type */ +#pragma pack() -extern u8 acpi_gbl_aml_resource_sizes[]; -extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[]; -extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[]; +/* Resource tables indexed by internal resource type */ -/* Tables indexed by raw AML resource descriptor type */ +extern const u8 acpi_gbl_aml_resource_sizes[]; +extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; + +/* Resource tables indexed by raw AML resource descriptor type */ extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; -extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[]; -extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[]; +extern struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[]; +extern struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[]; + +/* + * rscreate + */ +acpi_status +acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, + struct acpi_buffer *output_buffer); + +acpi_status +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer); + +acpi_status +acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, + struct acpi_buffer *output_buffer); /* - * Function prototypes called from Acpi* APIs + * rsutils */ acpi_status acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); @@ -110,27 +194,6 @@ acpi_rs_get_method_data(acpi_handle handle, acpi_status acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); -acpi_status -acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, - struct acpi_buffer *output_buffer); - -acpi_status -acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer); - -acpi_status -acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, - struct acpi_buffer *output_buffer); - -/* - * rsdump - */ -#ifdef ACPI_FUTURE_USAGE -void acpi_rs_dump_resource_list(struct acpi_resource *resource); - -void acpi_rs_dump_irq_list(u8 * route_table); -#endif /* ACPI_FUTURE_USAGE */ - /* * rscalc */ @@ -154,145 +217,29 @@ acpi_status acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_size aml_size_needed, u8 * output_buffer); -/* - * rsio - */ -acpi_status -acpi_rs_get_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_fixed_io(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_dma(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml); - -/* - * rsirq - */ -acpi_status -acpi_rs_get_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_ext_irq(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml); - /* * rsaddr */ -acpi_status -acpi_rs_get_address16(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_address32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_address64(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_ext_address64(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource); - -acpi_status -acpi_rs_set_ext_address64(struct acpi_resource *resource, - union aml_resource *aml); - -/* - * rsmemory - */ -acpi_status -acpi_rs_get_memory24(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_memory32(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_fixed_memory32(union aml_resource *aml, - u16 aml_resource_length, +void +acpi_rs_set_address_common(union aml_resource *aml, struct acpi_resource *resource); -acpi_status -acpi_rs_set_fixed_memory32(struct acpi_resource *resource, +u8 +acpi_rs_get_address_common(struct acpi_resource *resource, union aml_resource *aml); /* * rsmisc */ acpi_status -acpi_rs_get_generic_reg(union aml_resource *aml, - u16 aml_resource_length, - struct acpi_resource *resource); - -acpi_status -acpi_rs_set_generic_reg(struct acpi_resource *resource, - union aml_resource *aml); - -acpi_status -acpi_rs_get_vendor(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_start_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml); - -acpi_status -acpi_rs_get_end_dpf(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml); +acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info); acpi_status -acpi_rs_get_end_tag(union aml_resource *aml, - u16 aml_resource_length, struct acpi_resource *resource); - -acpi_status -acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml); +acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, + union aml_resource *aml, + struct acpi_rsconvert_info *info); /* * rsutils @@ -301,74 +248,94 @@ void acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type); -/* Types used in move_type above */ +u8 acpi_rs_decode_bitmask(u16 mask, u8 * list); -#define ACPI_MOVE_TYPE_16_TO_32 0 -#define ACPI_MOVE_TYPE_32_TO_16 1 -#define ACPI_MOVE_TYPE_32_TO_32 2 -#define ACPI_MOVE_TYPE_64_TO_64 3 +u16 acpi_rs_encode_bitmask(u8 * list, u8 count); -u16 -acpi_rs_get_resource_source(u16 resource_length, - acpi_size minimum_length, +acpi_rs_length +acpi_rs_get_resource_source(acpi_rs_length resource_length, + acpi_rs_length minimum_length, struct acpi_resource_source *resource_source, union aml_resource *aml, char *string_ptr); -acpi_size +acpi_rsdesc_size acpi_rs_set_resource_source(union aml_resource *aml, - acpi_size minimum_length, + acpi_rs_length minimum_length, struct acpi_resource_source *resource_source); -u8 acpi_rs_get_resource_type(u8 resource_start_byte); - -u32 acpi_rs_get_descriptor_length(union aml_resource *aml); - -u16 acpi_rs_get_resource_length(union aml_resource *aml); - void acpi_rs_set_resource_header(u8 descriptor_type, - acpi_size total_length, union aml_resource *aml); + acpi_rsdesc_size total_length, + union aml_resource *aml); + +void +acpi_rs_set_resource_length(acpi_rsdesc_size total_length, + union aml_resource *aml); struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* * rsdump */ -void acpi_rs_dump_irq(union acpi_resource_data *resource); - -void acpi_rs_dump_address16(union acpi_resource_data *resource); - -void acpi_rs_dump_address32(union acpi_resource_data *resource); - -void acpi_rs_dump_address64(union acpi_resource_data *resource); - -void acpi_rs_dump_ext_address64(union acpi_resource_data *resource); - -void acpi_rs_dump_dma(union acpi_resource_data *resource); - -void acpi_rs_dump_io(union acpi_resource_data *resource); - -void acpi_rs_dump_ext_irq(union acpi_resource_data *resource); - -void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); - -void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); - -void acpi_rs_dump_memory24(union acpi_resource_data *resource); - -void acpi_rs_dump_memory32(union acpi_resource_data *resource); - -void acpi_rs_dump_start_dpf(union acpi_resource_data *resource); - -void acpi_rs_dump_vendor(union acpi_resource_data *resource); +void acpi_rs_dump_resource_list(struct acpi_resource *resource); -void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); +void acpi_rs_dump_irq_list(u8 * route_table); -void acpi_rs_dump_end_dpf(union acpi_resource_data *resource); +/* + * Resource conversion tables + */ +extern struct acpi_rsconvert_info acpi_rs_convert_dma[]; +extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[]; +extern struct acpi_rsconvert_info acpi_rs_convert_io[]; +extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[]; +extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[]; +extern struct acpi_rsconvert_info acpi_rs_convert_memory24[]; +extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[]; +extern struct acpi_rsconvert_info acpi_rs_convert_memory32[]; +extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[]; +extern struct acpi_rsconvert_info acpi_rs_convert_address32[]; +extern struct acpi_rsconvert_info acpi_rs_convert_address16[]; +extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; +extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; +extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; + +/* These resources require separate get/set tables */ + +extern struct acpi_rsconvert_info acpi_rs_get_irq[]; +extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[]; +extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[]; +extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[]; + +extern struct acpi_rsconvert_info acpi_rs_set_irq[]; +extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[]; +extern struct acpi_rsconvert_info acpi_rs_set_vendor[]; -void acpi_rs_dump_end_tag(union acpi_resource_data *resource); +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +/* + * rsinfo + */ +extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; +/* + * rsdump + */ +extern struct acpi_rsdump_info acpi_rs_dump_irq[]; +extern struct acpi_rsdump_info acpi_rs_dump_dma[]; +extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; +extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; +extern struct acpi_rsdump_info acpi_rs_dump_io[]; +extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; +extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; +extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; +extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; +extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; +extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; +extern struct acpi_rsdump_info acpi_rs_dump_address16[]; +extern struct acpi_rsdump_info acpi_rs_dump_address32[]; +extern struct acpi_rsdump_info acpi_rs_dump_address64[]; +extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; +extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; +extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; #endif #endif /* __ACRESRC_H__ */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 43f7c509317a..29b887017b18 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -83,10 +83,11 @@ typedef COMPILER_DEPENDENT_UINT64 u64; * UINT32 32-bit (4 byte) unsigned value * INT64 64-bit (8 byte) signed value * UINT64 64-bit (8 byte) unsigned value - * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value - * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value + * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on x86_64/IA-64 unsigned value */ +typedef unsigned long acpi_native_uint; + #ifndef ACPI_MACHINE_WIDTH #error ACPI_MACHINE_WIDTH not defined #endif @@ -108,9 +109,6 @@ typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s64 acpi_native_int; -typedef u64 acpi_native_uint; - typedef u64 acpi_table_ptr; typedef u64 acpi_io_address; typedef u64 acpi_physical_address; @@ -121,9 +119,22 @@ typedef u64 acpi_size; #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX +/* + * In the case of the Itanium Processor Family (IPF), the hardware does not + * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag + * to indicate that special precautions must be taken to avoid alignment faults. + * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) + * + * Note: Em64_t and other X86-64 processors do support misaligned transfers, + * so there is no need to define this flag. + */ +#if defined (__IA64__) || defined (__ia64__) +#define ACPI_MISALIGNMENT_NOT_SUPPORTED +#endif + #elif ACPI_MACHINE_WIDTH == 16 -/*! [Begin] no source code translation (keep the typedefs) */ +/*! [Begin] no source code translation (keep the typedefs as-is) */ /* * 16-bit type definitions @@ -142,16 +153,12 @@ struct { /*! [End] no source code translation !*/ -typedef u16 acpi_native_uint; -typedef s16 acpi_native_int; - typedef u32 acpi_table_ptr; typedef u32 acpi_io_address; typedef char *acpi_physical_address; typedef u16 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 -#define ACPI_MISALIGNED_TRANSFERS #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ #define ACPI_MAX_PTR ACPI_UINT16_MAX #define ACPI_SIZE_MAX ACPI_UINT16_MAX @@ -179,16 +186,12 @@ typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef s32 acpi_native_int; -typedef u32 acpi_native_uint; - typedef u64 acpi_table_ptr; typedef u32 acpi_io_address; typedef u64 acpi_physical_address; typedef u32 acpi_size; #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 -#define ACPI_MISALIGNED_TRANSFERS #define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX @@ -895,6 +898,8 @@ struct acpi_mem_space_context { /* * Definitions for Resource Attributes */ +typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ +typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ /* * Memory Attributes @@ -927,8 +932,8 @@ struct acpi_mem_space_context { /* * IRQ Attributes */ -#define ACPI_EDGE_SENSITIVE (u8) 0x00 -#define ACPI_LEVEL_SENSITIVE (u8) 0x01 +#define ACPI_LEVEL_SENSITIVE (u8) 0x00 +#define ACPI_EDGE_SENSITIVE (u8) 0x01 #define ACPI_ACTIVE_HIGH (u8) 0x00 #define ACPI_ACTIVE_LOW (u8) 0x01 @@ -974,28 +979,35 @@ struct acpi_mem_space_context { #define ACPI_PRODUCER (u8) 0x00 #define ACPI_CONSUMER (u8) 0x01 +/* + * If possible, pack the following structures to byte alignment + */ +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#pragma pack(1) +#endif + /* * Structures used to describe device resources */ struct acpi_resource_irq { - u32 triggering; - u32 polarity; - u32 sharable; - u32 interrupt_count; - u32 interrupts[1]; + u8 triggering; + u8 polarity; + u8 sharable; + u8 interrupt_count; + u8 interrupts[1]; }; struct acpi_resource_dma { - u32 type; - u32 bus_master; - u32 transfer; - u32 channel_count; - u32 channels[1]; + u8 type; + u8 bus_master; + u8 transfer; + u8 channel_count; + u8 channels[1]; }; struct acpi_resource_start_dependent { - u32 compatibility_priority; - u32 performance_robustness; + u8 compatibility_priority; + u8 performance_robustness; }; /* @@ -1004,20 +1016,20 @@ struct acpi_resource_start_dependent { */ struct acpi_resource_io { - u32 io_decode; - u32 minimum; - u32 maximum; - u32 alignment; - u32 address_length; + u8 io_decode; + u8 alignment; + u8 address_length; + u16 minimum; + u16 maximum; }; struct acpi_resource_fixed_io { - u32 address; - u32 address_length; + u16 address; + u8 address_length; }; struct acpi_resource_vendor { - u32 byte_length; + u16 byte_length; u8 byte_data[1]; }; @@ -1026,15 +1038,15 @@ struct acpi_resource_end_tag { }; struct acpi_resource_memory24 { - u32 read_write_attribute; - u32 minimum; - u32 maximum; - u32 alignment; - u32 address_length; + u8 write_protect; + u16 minimum; + u16 maximum; + u16 alignment; + u16 address_length; }; struct acpi_resource_memory32 { - u32 read_write_attribute; + u8 write_protect; u32 minimum; u32 maximum; u32 alignment; @@ -1042,57 +1054,59 @@ struct acpi_resource_memory32 { }; struct acpi_resource_fixed_memory32 { - u32 read_write_attribute; + u8 write_protect; u32 address; u32 address_length; }; struct acpi_memory_attribute { - u16 cache_attribute; - u16 read_write_attribute; + u8 write_protect; + u8 caching; + u8 range_type; + u8 translation; }; struct acpi_io_attribute { - u16 range_attribute; - u16 translation_attribute; -}; - -struct acpi_bus_attribute { - u16 reserved1; - u16 reserved2; + u8 range_type; + u8 translation; + u8 translation_type; + u8 reserved1; }; union acpi_resource_attribute { - struct acpi_memory_attribute memory; + struct acpi_memory_attribute mem; struct acpi_io_attribute io; - struct acpi_bus_attribute bus; + + /* Used for the *word_space macros */ + + u8 type_specific; }; struct acpi_resource_source { - u32 index; - u32 string_length; + u8 index; + u16 string_length; char *string_ptr; }; /* Fields common to all address descriptors, 16/32/64 bit */ #define ACPI_RESOURCE_ADDRESS_COMMON \ - u32 resource_type; \ - u32 producer_consumer; \ - u32 decode; \ - u32 min_address_fixed; \ - u32 max_address_fixed; \ - union acpi_resource_attribute attribute; + u8 resource_type; \ + u8 producer_consumer; \ + u8 decode; \ + u8 min_address_fixed; \ + u8 max_address_fixed; \ + union acpi_resource_attribute info; struct acpi_resource_address { ACPI_RESOURCE_ADDRESS_COMMON}; struct acpi_resource_address16 { - ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 minimum; - u32 maximum; - u32 translation_offset; - u32 address_length; + ACPI_RESOURCE_ADDRESS_COMMON u16 granularity; + u16 minimum; + u16 maximum; + u16 translation_offset; + u16 address_length; struct acpi_resource_source resource_source; }; @@ -1115,30 +1129,30 @@ struct acpi_resource_address64 { }; struct acpi_resource_extended_address64 { - ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; + ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; + u64 granularity; u64 minimum; u64 maximum; u64 translation_offset; u64 address_length; - u64 type_specific_attributes; - u8 revision_iD; + u64 type_specific; }; struct acpi_resource_extended_irq { - u32 producer_consumer; - u32 triggering; - u32 polarity; - u32 sharable; - u32 interrupt_count; + u8 producer_consumer; + u8 triggering; + u8 polarity; + u8 sharable; + u8 interrupt_count; struct acpi_resource_source resource_source; u32 interrupts[1]; }; struct acpi_resource_generic_register { - u32 space_id; - u32 bit_width; - u32 bit_offset; - u32 access_size; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; u64 address; }; @@ -1192,14 +1206,17 @@ struct acpi_resource { union acpi_resource_data data; }; -#define ACPI_RESOURCE_LENGTH 12 -#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ +/* restore default alignment */ + +#pragma pack() -#define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) +#define ACPI_RS_SIZE_MIN 12 +#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ +#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) -#ifdef ACPI_MISALIGNED_TRANSFERS +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) #else #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index c1086452696e..7386eb81bd2a 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -159,7 +159,6 @@ extern const u8 _acpi_ctype[]; #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) -#define ACPI_IS_ASCII(c) ((c) < 0x80) #endif /* ACPI_USE_SYSTEM_CLIBRARY */ @@ -419,6 +418,12 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); #define ACPI_ANY_BASE 0 +u32 acpi_ut_get_descriptor_length(void *aml); + +u16 acpi_ut_get_resource_length(void *aml); + +u8 acpi_ut_get_resource_type(void *aml); + u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index 103aff07db18..3112be527731 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -134,7 +134,7 @@ struct aml_resource_end_dependent { AML_RESOURCE_SMALL_HEADER_COMMON}; struct aml_resource_io { - AML_RESOURCE_SMALL_HEADER_COMMON u8 information; + AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; u16 minimum; u16 maximum; u8 alignment; @@ -164,7 +164,7 @@ struct aml_resource_large_header { AML_RESOURCE_LARGE_HEADER_COMMON}; struct aml_resource_memory24 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u16 minimum; u16 maximum; u16 alignment; @@ -175,7 +175,7 @@ struct aml_resource_vendor_large { AML_RESOURCE_LARGE_HEADER_COMMON}; struct aml_resource_memory32 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u32 minimum; u32 maximum; u32 alignment; @@ -183,7 +183,7 @@ struct aml_resource_memory32 { }; struct aml_resource_fixed_memory32 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; u32 address; u32 address_length; }; @@ -205,7 +205,7 @@ struct aml_resource_extended_address64 { u64 maximum; u64 translation_offset; u64 address_length; - u64 type_specific_attributes; + u64 type_specific; }; #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ @@ -239,8 +239,8 @@ struct aml_resource_address16 { struct aml_resource_extended_irq { AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; - u8 table_length; - u32 interrupt_number[1]; + u8 interrupt_count; + u32 interrupts[1]; /* res_source_index, res_source optional fields follow */ }; diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 08539125696a..53aa997f05fc 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -206,6 +206,8 @@ * *****************************************************************************/ +#define ACPI_IS_ASCII(c) ((c) < 0x80) + #ifdef ACPI_USE_SYSTEM_CLIBRARY /* * Use the standard C library headers. @@ -235,7 +237,7 @@ #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) -#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) @@ -247,7 +249,6 @@ #define ACPI_IS_UPPER(i) isupper((int) (i)) #define ACPI_IS_PRINT(i) isprint((int) (i)) #define ACPI_IS_ALPHA(i) isalpha((int) (i)) -#define ACPI_IS_ASCII(i) isascii((int) (i)) #else @@ -274,8 +275,8 @@ typedef char *va_list; /* * Storage alignment properties */ -#define _AUPBND (sizeof (acpi_native_int) - 1) -#define _ADNBND (sizeof (acpi_native_int) - 1) +#define _AUPBND (sizeof (acpi_native_uint) - 1) +#define _ADNBND (sizeof (acpi_native_uint) - 1) /* * Variable argument list macro definitions @@ -297,7 +298,7 @@ typedef char *va_list; #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) -#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) #define ACPI_TOUPPER acpi_ut_to_upper -- cgit v1.2.3 From 4a90c7e86202f46fa9af011bdbcdf36e355d1721 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 13 Jan 2006 16:22:00 -0500 Subject: [ACPI] ACPICA 20060113 Added 2006 copyright. At SuSE's suggestion, enabled all error messages without enabling function tracing, ie with CONFIG_ACPI_DEBUG=n Replaced all instances of the ACPI_DEBUG_PRINT macro invoked at the ACPI_DB_ERROR and ACPI_DB_WARN debug levels with the ACPI_REPORT_ERROR and ACPI_REPORT_WARNING macros, respectively. This preserves all error and warning messages in the non-debug version of the ACPICA code (this has been referred to as the "debug lite" option.) Over 200 cases were converted to create a total of over 380 error/warning messages across the ACPICA code. This increases the code and data size of the default non-debug version by about 13K. Added ACPI_NO_ERROR_MESSAGES flag to enable deleting all messages. The size of the debug version remains about the same. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsfield.c | 9 ++-- drivers/acpi/dispatcher/dsinit.c | 20 +++---- drivers/acpi/dispatcher/dsmethod.c | 2 +- drivers/acpi/dispatcher/dsmthdat.c | 28 ++++------ drivers/acpi/dispatcher/dsobject.c | 21 +++----- drivers/acpi/dispatcher/dsopcode.c | 41 ++++++-------- drivers/acpi/dispatcher/dsutils.c | 18 +++---- drivers/acpi/dispatcher/dswexec.c | 36 ++++--------- drivers/acpi/dispatcher/dswload.c | 2 +- drivers/acpi/dispatcher/dswscope.c | 6 +-- drivers/acpi/dispatcher/dswstate.c | 106 +++++++++++++------------------------ drivers/acpi/events/evevent.c | 4 +- drivers/acpi/events/evgpe.c | 20 ++++--- drivers/acpi/events/evgpeblk.c | 20 +++---- drivers/acpi/events/evmisc.c | 12 ++--- drivers/acpi/events/evregion.c | 45 +++++----------- drivers/acpi/events/evrgnini.c | 2 +- drivers/acpi/events/evsci.c | 2 +- drivers/acpi/events/evxface.c | 13 +++-- drivers/acpi/events/evxfevnt.c | 23 ++++---- drivers/acpi/events/evxfregn.c | 2 +- drivers/acpi/executer/exconfig.c | 6 +-- drivers/acpi/executer/exconvrt.c | 15 ++---- drivers/acpi/executer/excreate.c | 2 +- drivers/acpi/executer/exdump.c | 2 +- drivers/acpi/executer/exfield.c | 2 +- drivers/acpi/executer/exfldio.c | 60 ++++++--------------- drivers/acpi/executer/exmisc.c | 12 +++-- drivers/acpi/executer/exmutex.c | 2 +- drivers/acpi/executer/exnames.c | 16 +++--- drivers/acpi/executer/exoparg1.c | 59 ++++++++------------- drivers/acpi/executer/exoparg2.c | 28 +++++----- drivers/acpi/executer/exoparg3.c | 8 +-- drivers/acpi/executer/exoparg6.c | 13 ++--- drivers/acpi/executer/exprep.c | 11 ++-- drivers/acpi/executer/exregion.c | 12 ++--- drivers/acpi/executer/exresnte.c | 50 +++++++---------- drivers/acpi/executer/exresolv.c | 28 +++++----- drivers/acpi/executer/exresop.c | 89 +++++++++---------------------- drivers/acpi/executer/exstore.c | 19 +++---- drivers/acpi/executer/exstoren.c | 13 ++--- drivers/acpi/executer/exstorob.c | 2 +- drivers/acpi/executer/exsystem.c | 4 +- drivers/acpi/executer/exutils.c | 6 +-- drivers/acpi/hardware/hwacpi.c | 7 ++- drivers/acpi/hardware/hwgpe.c | 2 +- drivers/acpi/hardware/hwregs.c | 29 ++++------ drivers/acpi/hardware/hwsleep.c | 2 +- drivers/acpi/hardware/hwtimer.c | 2 +- drivers/acpi/namespace/nsaccess.c | 18 +++---- drivers/acpi/namespace/nsalloc.c | 7 ++- drivers/acpi/namespace/nsdump.c | 5 +- drivers/acpi/namespace/nsdumpdv.c | 2 +- drivers/acpi/namespace/nseval.c | 5 +- drivers/acpi/namespace/nsinit.c | 22 ++++---- drivers/acpi/namespace/nsload.c | 6 +-- drivers/acpi/namespace/nsnames.c | 10 ++-- drivers/acpi/namespace/nsobject.c | 10 ++-- drivers/acpi/namespace/nsparse.c | 2 +- drivers/acpi/namespace/nssearch.c | 11 ++-- drivers/acpi/namespace/nsutils.c | 29 ++++------ drivers/acpi/namespace/nswalk.c | 2 +- drivers/acpi/namespace/nsxfeval.c | 21 ++++---- drivers/acpi/namespace/nsxfname.c | 2 +- drivers/acpi/namespace/nsxfobj.c | 2 +- drivers/acpi/parser/psargs.c | 4 +- drivers/acpi/parser/psloop.c | 23 ++------ drivers/acpi/parser/psopcode.c | 4 +- drivers/acpi/parser/psparse.c | 8 +-- drivers/acpi/parser/psscope.c | 2 +- drivers/acpi/parser/pstree.c | 5 +- drivers/acpi/parser/psutils.c | 2 +- drivers/acpi/parser/pswalk.c | 2 +- drivers/acpi/parser/psxface.c | 2 +- drivers/acpi/resources/rsaddr.c | 2 +- drivers/acpi/resources/rscalc.c | 2 +- drivers/acpi/resources/rscreate.c | 42 +++------------ drivers/acpi/resources/rsdump.c | 2 +- drivers/acpi/resources/rsinfo.c | 2 +- drivers/acpi/resources/rsio.c | 2 +- drivers/acpi/resources/rsirq.c | 2 +- drivers/acpi/resources/rslist.c | 6 +-- drivers/acpi/resources/rsmemory.c | 2 +- drivers/acpi/resources/rsmisc.c | 9 ++-- drivers/acpi/resources/rsutils.c | 2 +- drivers/acpi/resources/rsxface.c | 2 +- drivers/acpi/tables/tbconvrt.c | 2 +- drivers/acpi/tables/tbget.c | 6 +-- drivers/acpi/tables/tbgetall.c | 2 +- drivers/acpi/tables/tbinstal.c | 2 +- drivers/acpi/tables/tbrsdt.c | 18 +++---- drivers/acpi/tables/tbutils.c | 22 +++----- drivers/acpi/tables/tbxface.c | 17 +++--- drivers/acpi/tables/tbxfroot.c | 22 +++----- drivers/acpi/utilities/utalloc.c | 32 ++++++----- drivers/acpi/utilities/utcache.c | 2 +- drivers/acpi/utilities/utcopy.c | 7 ++- drivers/acpi/utilities/utdebug.c | 2 +- drivers/acpi/utilities/utdelete.c | 9 ++-- drivers/acpi/utilities/uteval.c | 24 ++++----- drivers/acpi/utilities/utglobal.c | 21 ++++---- drivers/acpi/utilities/utinit.c | 7 ++- drivers/acpi/utilities/utmath.c | 10 ++-- drivers/acpi/utilities/utmisc.c | 18 +++---- drivers/acpi/utilities/utmutex.c | 37 +++---------- drivers/acpi/utilities/utobject.c | 28 +++++----- drivers/acpi/utilities/utresrc.c | 2 +- drivers/acpi/utilities/utstate.c | 2 +- drivers/acpi/utilities/utxface.c | 7 ++- include/acpi/acconfig.h | 4 +- include/acpi/acdebug.h | 2 +- include/acpi/acdisasm.h | 2 +- include/acpi/acdispat.h | 2 +- include/acpi/acevents.h | 2 +- include/acpi/acexcep.h | 2 +- include/acpi/acglobal.h | 2 +- include/acpi/achware.h | 2 +- include/acpi/acinterp.h | 2 +- include/acpi/aclocal.h | 2 +- include/acpi/acmacros.h | 83 ++++++++++++++++------------- include/acpi/acnames.h | 2 +- include/acpi/acnamesp.h | 4 +- include/acpi/acobject.h | 2 +- include/acpi/acopcode.h | 2 +- include/acpi/acoutput.h | 12 +++-- include/acpi/acparser.h | 2 +- include/acpi/acpi.h | 2 +- include/acpi/acpiosxf.h | 2 +- include/acpi/acpixf.h | 2 +- include/acpi/acresrc.h | 2 +- include/acpi/acstruct.h | 2 +- include/acpi/actables.h | 2 +- include/acpi/actbl.h | 2 +- include/acpi/actbl1.h | 2 +- include/acpi/actbl2.h | 2 +- include/acpi/actypes.h | 2 +- include/acpi/acutils.h | 9 ++-- include/acpi/amlcode.h | 2 +- include/acpi/amlresrc.h | 2 +- include/acpi/platform/acenv.h | 2 +- include/acpi/platform/acgcc.h | 2 +- include/acpi/platform/aclinux.h | 2 +- 142 files changed, 658 insertions(+), 1023 deletions(-) (limited to 'drivers/acpi/resources/rsirq.c') diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 2022aeaecfbb..f3a008ff1eae 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -293,7 +293,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, + (acpi_integer) arg->common.value.size; if (position > ACPI_UINT32_MAX) { - ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name)); + ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", ACPI_CAST_PTR(char, &info->field_node->name))); return_ACPI_STATUS(AE_SUPPORT); } @@ -302,9 +302,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid opcode in field list: %X\n", - arg->common.aml_opcode)); + ACPI_REPORT_ERROR(("Invalid opcode in field list: %X\n", + arg->common.aml_opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index 4fa80abfe6c0..258fbdfaa69c 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,7 +84,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, acpi_object_type type; acpi_status status; - ACPI_FUNCTION_NAME("ds_init_one_object"); + ACPI_FUNCTION_ENTRY(); /* * We are only interested in NS nodes owned by the table that @@ -105,11 +105,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, status = acpi_ds_initialize_region(obj_handle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Region %p [%4.4s] - Init failure, %s\n", - obj_handle, - acpi_ut_get_node_name(obj_handle), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Region %p [%4.4s] - Init failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status))); } info->op_region_count++; @@ -148,11 +144,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, */ status = acpi_ds_parse_method(obj_handle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "\n+Method %p [%4.4s] - parse failure, %s\n", - obj_handle, - acpi_ut_get_node_name(obj_handle), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("\n+Method %p [%4.4s] - parse failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status))); /* This parse failed, but we will continue parsing more methods */ } @@ -214,8 +206,8 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, acpi_ds_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("walk_namespace failed, %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index e7ce86b8d954..d861add3fc1f 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index 4095ce70982b..ce33c34f87c6 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -260,9 +260,7 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_LOCAL_OP: if (index > ACPI_METHOD_MAX_LOCAL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Local index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_LOCAL)); + ACPI_REPORT_ERROR(("Local index %d is invalid (max %d)\n", index, ACPI_METHOD_MAX_LOCAL)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -274,9 +272,8 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_ARG_OP: if (index > ACPI_METHOD_MAX_ARG) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Arg index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_ARG)); + ACPI_REPORT_ERROR(("Arg index %d is invalid (max %d)\n", + index, ACPI_METHOD_MAX_ARG)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -286,8 +283,7 @@ acpi_ds_method_data_get_node(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n", - opcode)); + ACPI_REPORT_ERROR(("Opcode %d is invalid\n", opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } @@ -378,8 +374,7 @@ acpi_ds_method_data_get_value(u16 opcode, /* Validate the object descriptor */ if (!dest_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null object descriptor pointer\n")); + ACPI_REPORT_ERROR(("Null object descriptor pointer\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -424,23 +419,18 @@ acpi_ds_method_data_get_value(u16 opcode, switch (opcode) { case AML_ARG_OP: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Uninitialized Arg[%d] at node %p\n", - index, node)); + ACPI_REPORT_ERROR(("Uninitialized Arg[%d] at node %p\n", index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); case AML_LOCAL_OP: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Uninitialized Local[%d] at node %p\n", - index, node)); + ACPI_REPORT_ERROR(("Uninitialized Local[%d] at node %p\n", index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); default: - ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n", - opcode)); + ACPI_REPORT_ERROR(("Not a Arg/Local opcode: %X\n", opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 905a84e4b145..dc116d679a58 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -214,10 +214,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, byte_list = arg->named.next; if (byte_list) { if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting bytelist, got AML opcode %X in op %p\n", - byte_list->common.aml_opcode, - byte_list)); + ACPI_REPORT_ERROR(("Expecting bytelist, got AML opcode %X in op %p\n", byte_list->common.aml_opcode, byte_list)); acpi_ut_remove_reference(obj_desc); return (AE_TYPE); @@ -543,9 +540,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown constant opcode %X\n", - opcode)); + ACPI_REPORT_ERROR(("Unknown constant opcode %X\n", opcode)); status = AE_AML_OPERAND_TYPE; break; } @@ -560,9 +555,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown Integer type %X\n", - op_info->type)); + ACPI_REPORT_ERROR(("Unknown Integer type %X\n", + op_info->type)); status = AE_AML_OPERAND_TYPE; break; } @@ -640,9 +634,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unimplemented data type: %X\n", - ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_REPORT_ERROR(("Unimplemented data type: %X\n", + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; break; diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 939d167bf87b..60414ee84b0a 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -413,9 +413,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Host object must be a Buffer */ if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Target of Create Field is not a Buffer object - %s\n", - acpi_ut_get_object_type_name(buffer_desc))); + ACPI_REPORT_ERROR(("Target of Create Field is not a Buffer object - %s\n", acpi_ut_get_object_type_name(buffer_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -427,10 +425,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode, * after resolution in acpi_ex_resolve_operands(). */ if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(%s) destination not a NS Node [%s]\n", - acpi_ps_get_opcode_name(aml_opcode), - acpi_ut_get_descriptor_name(result_desc))); + ACPI_REPORT_ERROR(("(%s) destination not a NS Node [%s]\n", + acpi_ps_get_opcode_name(aml_opcode), + acpi_ut_get_descriptor_name(result_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -453,8 +450,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Must have a valid (>0) bit count */ if (bit_count == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Attempt to create_field of length 0\n")); + ACPI_REPORT_ERROR(("Attempt to create_field of length 0\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -507,9 +503,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown field creation opcode %02x\n", - aml_opcode)); + ACPI_REPORT_ERROR(("Unknown field creation opcode %02x\n", + aml_opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -517,13 +512,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Entire field must fit within the current length of the buffer */ if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", - acpi_ut_get_node_name(result_desc), - bit_offset + bit_count, - acpi_ut_get_node_name(buffer_desc->buffer. - node), - 8 * (u32) buffer_desc->buffer.length)); + ACPI_REPORT_ERROR(("Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", acpi_ut_get_node_name(result_desc), bit_offset + bit_count, acpi_ut_get_node_name(buffer_desc->buffer.node), 8 * (u32) buffer_desc->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -629,9 +618,10 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, "after acpi_ex_resolve_operands"); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", - acpi_ps_get_opcode_name(op->common. - aml_opcode), status)); + ACPI_REPORT_ERROR(("(%s) bad operand(s) (%X)\n", + acpi_ps_get_opcode_name(op->common. + aml_opcode), + status)); return_ACPI_STATUS(status); } @@ -1155,9 +1145,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown control opcode=%X Op=%p\n", - op->common.aml_opcode, op)); + ACPI_REPORT_ERROR(("Unknown control opcode=%X Op=%p\n", + op->common.aml_opcode, op)); status = AE_AML_BAD_OPCODE; break; diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 2cc53da5c0bd..cd9aa7faa57b 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -176,7 +176,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, /* Must have both an Op and a Result Object */ if (!op) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); + ACPI_REPORT_ERROR(("Null Op\n")); return_UINT8(TRUE); } @@ -216,8 +216,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, parent_info = acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); if (parent_info->class == AML_CLASS_UNKNOWN) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown parent opcode. Op=%p\n", op)); + ACPI_REPORT_ERROR(("Unknown parent opcode Op=%p\n", op)); return_UINT8(FALSE); } @@ -344,7 +343,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); if (!op) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); + ACPI_REPORT_ERROR(("Null Op\n")); return_VOID; } @@ -635,10 +634,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, * Only error is underflow, and this indicates * a missing or null operand! */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Missing or null operand, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("Missing or null operand, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } } else { @@ -730,7 +726,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, */ (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n", - (arg_count + 1), acpi_format_exception(status))); + ACPI_REPORT_ERROR(("While creating Arg %d - %s\n", + (arg_count + 1), acpi_format_exception(status))); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 74f6996db2d7..5a9b91fe93d2 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,9 +100,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, if (result_obj) { status = acpi_ds_result_pop(&obj_desc, walk_state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not get result from predicate evaluation, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not get result from predicate evaluation, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -123,9 +121,8 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (!obj_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No predicate obj_desc=%p State=%p\n", - obj_desc, walk_state)); + ACPI_REPORT_ERROR(("No predicate obj_desc=%p State=%p\n", + obj_desc, walk_state)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -140,10 +137,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", - obj_desc, walk_state, - ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_REPORT_ERROR(("Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", obj_desc, walk_state, ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -362,8 +356,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) op_class = walk_state->op_info->class; if (op_class == AML_CLASS_UNKNOWN) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n", - op->common.aml_opcode)); + ACPI_REPORT_ERROR(("Unknown opcode %X\n", + op->common.aml_opcode)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -453,12 +447,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) walk_state->operands[1]->reference.offset)) { status = AE_OK; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "[%s]: Could not resolve operands, %s\n", - acpi_ps_get_opcode_name - (walk_state->opcode), - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("[%s]: Could not resolve operands, %s\n", acpi_ps_get_opcode_name(walk_state->opcode), acpi_format_exception(status))); } } @@ -677,8 +666,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_UNDEFINED: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Undefined opcode type Op=%p\n", op)); + ACPI_REPORT_ERROR(("Undefined opcode type Op=%p\n", + op)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); case AML_TYPE_BOGUS: @@ -690,10 +679,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", - op_class, op_type, - op->common.aml_opcode, op)); + ACPI_REPORT_ERROR(("Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", op_class, op_type, op->common.aml_opcode, op)); status = AE_NOT_IMPLEMENTED; break; diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 441931cab08a..4cad6afa82f7 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index defe956ef751..e7fc88ca47ba 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,14 +107,14 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, if (!node) { /* Invalid scope */ - ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n")); + ACPI_REPORT_ERROR(("Null scope parameter\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Make sure object type is valid */ if (!acpi_ut_valid_object_type(type)) { - ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); + ACPI_REPORT_WARNING(("Invalid object type: 0x%X\n", type)); } /* Allocate a new scope object */ diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 7d68a5aaf3c4..61aae2dcc5e2 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,26 +92,23 @@ acpi_ds_result_remove(union acpi_operand_object **object, state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result object pushed! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_MAX_OPERAND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index out of range: %X State=%p Num=%X\n", - index, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Index out of range: %X State=%p Num=%X\n", + index, walk_state, + state->results.num_results)); } /* Check for a valid result object */ if (!state->results.obj_desc[index]) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X, Index=%X\n", - walk_state, state->results.num_results, - index)); + ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X, Index=%X\n", + walk_state, state->results.num_results, + index)); return (AE_AML_NO_RETURN_VALUE); } @@ -163,9 +160,8 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } if (!state->results.num_results) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Result stack is empty! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("Result stack is empty! State=%p\n", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -192,8 +188,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result objects! State=%p\n", walk_state)); + ACPI_REPORT_ERROR(("No result objects! State=%p\n", walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -222,15 +217,14 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Warning: No result object pushed! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (!state->results.num_results) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result objects! State=%p\n", walk_state)); + ACPI_REPORT_ERROR(("No result objects! State=%p\n", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -250,10 +244,9 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, /* Check for a valid result object */ if (!*object) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X Index=%X\n", - walk_state, state->results.num_results, - (u32) index)); + ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X Index=%X\n", + walk_state, state->results.num_results, + (u32) index)); return (AE_AML_NO_RETURN_VALUE); } @@ -293,18 +286,14 @@ acpi_ds_result_push(union acpi_operand_object * object, } if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Result stack overflow: Obj=%p State=%p Num=%X\n", - object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Result stack overflow: Obj=%p State=%p Num=%X\n", object, walk_state, state->results.num_results)); return (AE_STACK_OVERFLOW); } if (!object) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null Object! Obj=%p State=%p Num=%X\n", - object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Null Object! Obj=%p State=%p Num=%X\n", + object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } @@ -413,10 +402,7 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) /* Check for stack overflow */ if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "overflow! Obj=%p State=%p #Ops=%X\n", - object, walk_state, - walk_state->num_operands)); + ACPI_REPORT_ERROR(("Object stack overflow! Obj=%p State=%p #Ops=%X\n", object, walk_state, walk_state->num_operands)); return (AE_STACK_OVERFLOW); } @@ -460,10 +446,7 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Underflow! Count=%X State=%p #Ops=%X\n", - pop_count, walk_state, - walk_state->num_operands)); + ACPI_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -506,10 +489,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Underflow! Count=%X State=%p #Ops=%X\n", - pop_count, walk_state, - walk_state->num_operands)); + ACPI_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -826,16 +806,14 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) } if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%p is not a valid walk state\n", - walk_state)); + ACPI_REPORT_ERROR(("%p is not a valid walk state\n", + walk_state)); return; } if (walk_state->parser_state.scope) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%p walk still has a scope list\n", - walk_state)); + ACPI_REPORT_ERROR(("%p walk still has a scope list\n", + walk_state)); } /* Always must free any linked control states */ @@ -894,25 +872,18 @@ acpi_ds_result_insert(void *object, state = walk_state->results; if (!state) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No result object pushed! State=%p\n", - walk_state)); + ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index out of range: %X Obj=%p State=%p Num=%X\n", - index, object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Index out of range: %X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); return (AE_BAD_PARAMETER); } if (!object) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null Object! Index=%X Obj=%p State=%p Num=%X\n", - index, object, walk_state, - state->results.num_results)); + ACPI_REPORT_ERROR(("Null Object! Index=%X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); return (AE_BAD_PARAMETER); } @@ -986,9 +957,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Missing operand/stack empty! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + ACPI_REPORT_ERROR(("Missing operand/stack empty! State=%p #Ops=%X\n", walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } @@ -1000,9 +969,8 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, /* Check for a valid operand */ if (!walk_state->operands[walk_state->num_operands]) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null operand! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X\n", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 9522c643b88b..b380ae1044b7 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,7 +73,7 @@ acpi_status acpi_ev_initialize_events(void) /* Make sure we have ACPI tables */ if (!acpi_gbl_DSDT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n")); + ACPI_REPORT_WARNING(("No ACPI tables present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index bdd86537738e..353b907edbfa 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -599,7 +599,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ACPI_GPE_EDGE_TRIGGERED) { 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)); + ACPI_REPORT_ERROR(("%s, Unable to clear GPE[%2X]\n", + acpi_format_exception(status), + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -637,7 +639,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) ACPI_GPE_LEVEL_TRIGGERED) { 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)); + ACPI_REPORT_ERROR(("%s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } } @@ -651,7 +653,9 @@ 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)); + ACPI_REPORT_ERROR(("%s, Unable to disable GPE[%2X]\n", + acpi_format_exception(status), + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } @@ -663,7 +667,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) acpi_ev_asynch_execute_gpe_method, gpe_event_info); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); + ACPI_REPORT_ERROR(("%s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); } break; @@ -671,7 +675,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) /* No handler or method to run! */ - ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number)); + ACPI_REPORT_ERROR(("No handler or method for GPE[%2X], disabling event\n", gpe_number)); /* * Disable the GPE. The GPE will remain disabled until the ACPI @@ -679,7 +683,9 @@ 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)); + ACPI_REPORT_ERROR(("%s, Unable to disable GPE[%2X]\n", + acpi_format_exception(status), + gpe_number)); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); } break; diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 8efca2eac27e..3b9bbdda551d 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -279,9 +279,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, default: /* Unknown method type, just ignore it! */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", - name)); + ACPI_REPORT_ERROR(("Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", name)); return_ACPI_STATUS(AE_OK); } @@ -291,9 +289,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, if (gpe_number == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", - name)); + ACPI_REPORT_ERROR(("Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", name)); return_ACPI_STATUS(AE_OK); } @@ -527,9 +523,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 acpi_ev_gpe_xrupt_handler, gpe_xrupt); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not install GPE interrupt handler at level 0x%X\n", - interrupt_number)); + ACPI_REPORT_ERROR(("Could not install GPE interrupt handler at level 0x%X\n", interrupt_number)); return_PTR(NULL); } } @@ -745,8 +739,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) sizeof(struct acpi_gpe_register_info)); if (!gpe_register_info) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not allocate the gpe_register_info table\n")); + ACPI_REPORT_ERROR(("Could not allocate the gpe_register_info table\n")); return_ACPI_STATUS(AE_NO_MEMORY); } @@ -759,8 +752,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ACPI_GPE_REGISTER_WIDTH) * sizeof(struct acpi_gpe_event_info)); if (!gpe_event_info) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not allocate the gpe_event_info table\n")); + ACPI_REPORT_ERROR(("Could not allocate the gpe_event_info table\n")); status = AE_NO_MEMORY; goto error_exit; } diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 7e57b8470f55..78883239784a 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -542,9 +542,7 @@ void acpi_ev_terminate(void) for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { status = acpi_disable_event((u32) i, 0); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not disable fixed event %d\n", - (u32) i)); + ACPI_REPORT_ERROR(("Could not disable fixed event %d\n", (u32) i)); } } @@ -556,8 +554,7 @@ void acpi_ev_terminate(void) status = acpi_ev_remove_sci_handler(); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not remove SCI handler\n")); + ACPI_REPORT_ERROR(("Could not remove SCI handler\n")); } } @@ -570,8 +567,7 @@ void acpi_ev_terminate(void) if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { status = acpi_disable(); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "acpi_disable failed\n")); + ACPI_REPORT_WARNING(("acpi_disable failed\n")); } } return_VOID; diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 84fad082d80d..900e5b32e595 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -295,12 +295,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, handler_desc = region_obj->region.handler; if (!handler_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No handler for Region [%4.4s] (%p) [%s]\n", - acpi_ut_get_node_name(region_obj->region. - node), region_obj, - acpi_ut_get_region_name(region_obj->region. - space_id))); + ACPI_REPORT_ERROR(("No handler for Region [%4.4s] (%p) [%s]\n", + acpi_ut_get_node_name(region_obj->region. + node), region_obj, + acpi_ut_get_region_name(region_obj->region. + space_id))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -317,12 +316,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, if (!region_setup) { /* No initialization routine, exit with error */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No init routine for region(%p) [%s]\n", - region_obj, - acpi_ut_get_region_name(region_obj-> - region. - space_id))); + ACPI_REPORT_ERROR(("No init routine for region(%p) [%s]\n", region_obj, acpi_ut_get_region_name(region_obj->region.space_id))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -347,12 +341,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, /* Check for failure of the Region Setup */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Region Init: %s [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name(region_obj-> - region. - space_id))); + ACPI_REPORT_ERROR(("Region Initialization: %s [%s]\n", + acpi_format_exception(status), + acpi_ut_get_region_name(region_obj-> + region. + space_id))); return_ACPI_STATUS(status); } @@ -501,12 +494,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, status = acpi_ev_execute_reg_method(region_obj, 0); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s from region _REG, [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name - (region_obj->region. - space_id))); + ACPI_REPORT_ERROR(("%s from region _REG, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); } if (acpi_ns_is_locked) { @@ -528,12 +516,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, /* Init routine may fail, Just ignore errors */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s from region init, [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name - (region_obj->region. - space_id))); + ACPI_REPORT_ERROR(("%s from region init, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); } region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index a1bd2da27c45..de1a38e9ce22 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index e2c0b48a7e9f..9a622169008a 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 57d73299298e..b2f69b1ac4b5 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -143,8 +143,8 @@ acpi_install_fixed_event_handler(u32 event, if (ACPI_SUCCESS(status)) status = acpi_enable_event(event, 0); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Could not enable fixed event.\n")); + ACPI_REPORT_WARNING(("Could not enable fixed event %X\n", + event)); /* Remove the handler */ @@ -204,10 +204,9 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) acpi_gbl_fixed_event_handlers[event].context = NULL; if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Could not write to fixed event enable register.\n")); + ACPI_REPORT_WARNING(("Could not write to fixed event enable register %X\n", event)); } else { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X\n", event)); } @@ -434,7 +433,7 @@ acpi_remove_notify_handler(acpi_handle device, if (device == ACPI_ROOT_OBJECT) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Removing notify handler for ROOT object.\n")); + "Removing notify handler for namespace root object\n")); if (((handler_type & ACPI_SYSTEM_NOTIFY) && !acpi_gbl_system_notify.handler) || diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index c1b898928256..90eb7939e986 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,8 +70,7 @@ acpi_status acpi_enable(void) /* Make sure we have the FADT */ if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "No FADT information present!\n")); + ACPI_REPORT_WARNING(("No FADT information present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -83,7 +82,7 @@ acpi_status acpi_enable(void) status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n")); + ACPI_REPORT_ERROR(("Could not transition to ACPI mode\n")); return_ACPI_STATUS(status); } @@ -113,8 +112,7 @@ acpi_status acpi_disable(void) ACPI_FUNCTION_TRACE("acpi_disable"); if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "No FADT information present!\n")); + ACPI_REPORT_WARNING(("No FADT information present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -127,8 +125,7 @@ acpi_status acpi_disable(void) status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not exit ACPI mode to legacy mode")); + ACPI_REPORT_ERROR(("Could not exit ACPI mode to legacy mode")); return_ACPI_STATUS(status); } @@ -185,9 +182,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags) } if (value != 1) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not enable %s event\n", - acpi_ut_get_event_name(event))); + ACPI_REPORT_ERROR(("Could not enable %s event\n", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } @@ -384,9 +380,8 @@ acpi_status acpi_disable_event(u32 event, u32 flags) } if (value != 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not disable %s events\n", - acpi_ut_get_event_name(event))); + ACPI_REPORT_ERROR(("Could not disable %s events\n", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index 6f28ea2db5ba..abf5caca9ae5 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 1ce365d651d8..109d0255a5bb 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -413,9 +413,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, (!ACPI_STRNCMP(table_ptr->signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Table has invalid signature [%4.4s], must be SSDT or PSDT\n", - table_ptr->signature)); + ACPI_REPORT_ERROR(("Table has invalid signature [%4.4s], must be SSDT or PSDT\n", table_ptr->signature)); status = AE_BAD_SIGNATURE; goto cleanup; } diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index fa9e75d4ec65..e6f55cf8ad31 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -654,17 +654,8 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown Target type ID 0x%X Op %s dest_type %s\n", - GET_CURRENT_ARG_TYPE(walk_state->op_info-> - runtime_args), - walk_state->op_info->name, - acpi_ut_get_type_name(destination_type))); - - ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n", - GET_CURRENT_ARG_TYPE(walk_state->op_info-> - runtime_args))) - status = AE_AML_INTERNAL; + ACPI_REPORT_ERROR(("Unknown Target type ID 0x%X aml_opcode %X dest_type %s\n", GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args), walk_state->opcode, acpi_ut_get_type_name(destination_type))); + status = AE_AML_INTERNAL; } /* diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 91c49188fb07..da313dad576a 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 17c79cd91b31..a7cca8d4f855 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index ab1ba399aa28..78a76f91a1c9 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index ba6e08843c29..9fe27fd04a2f 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,10 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, /* We must have a valid region */ if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed Region, found type %X (%s)\n", - ACPI_GET_OBJECT_TYPE(rgn_desc), - acpi_ut_get_object_type_name(rgn_desc))); + ACPI_REPORT_ERROR(("Needed Region, found type %X (%s)\n", + ACPI_GET_OBJECT_TYPE(rgn_desc), + acpi_ut_get_object_type_name(rgn_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -162,31 +161,14 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, * than the region itself. For example, a region of length one * byte, and a field with Dword access specified. */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", - acpi_ut_get_node_name(obj_desc-> - common_field. - node), - obj_desc->common_field. - access_byte_width, - acpi_ut_get_node_name(rgn_desc-> - region.node), - rgn_desc->region.length)); + ACPI_REPORT_ERROR(("Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", acpi_ut_get_node_name(obj_desc->common_field.node), obj_desc->common_field.access_byte_width, acpi_ut_get_node_name(rgn_desc->region.node), rgn_desc->region.length)); } /* * Offset rounded up to next multiple of field width * exceeds region length, indicate an error */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", - acpi_ut_get_node_name(obj_desc->common_field. - node), - obj_desc->common_field.base_byte_offset, - field_datum_byte_offset, - obj_desc->common_field.access_byte_width, - acpi_ut_get_node_name(rgn_desc->region.node), - rgn_desc->region.length)); + ACPI_REPORT_ERROR(("Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", acpi_ut_get_node_name(obj_desc->common_field.node), obj_desc->common_field.base_byte_offset, field_datum_byte_offset, obj_desc->common_field.access_byte_width, acpi_ut_get_node_name(rgn_desc->region.node), rgn_desc->region.length)); return_ACPI_STATUS(AE_AML_REGION_LIMIT); } @@ -270,12 +252,11 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, if (ACPI_FAILURE(status)) { if (status == AE_NOT_IMPLEMENTED) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Region %s(%X) not implemented\n", - acpi_ut_get_region_name(rgn_desc-> - region. - space_id), - rgn_desc->region.space_id)); + ACPI_REPORT_ERROR(("Region %s(%X) not implemented\n", + acpi_ut_get_region_name(rgn_desc-> + region. + space_id), + rgn_desc->region.space_id)); } else if (status == AE_NOT_EXIST) { ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n", acpi_ut_get_region_name(rgn_desc-> @@ -618,11 +599,10 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "write_with_update_rule: Unknown update_rule setting: %X\n", - (obj_desc->common_field. - field_flags & - AML_FIELD_UPDATE_RULE_MASK))); + ACPI_REPORT_ERROR(("Unknown update_rule value: %X\n", + (obj_desc->common_field. + field_flags & + AML_FIELD_UPDATE_RULE_MASK))); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } } @@ -677,10 +657,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field size %X (bits) is too large for buffer (%X)\n", - obj_desc->common_field.bit_length, - buffer_length)); + ACPI_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_length)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } @@ -792,10 +769,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Field size %X (bits) is too large for buffer (%X)\n", - obj_desc->common_field.bit_length, - buffer_length)); + ACPI_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_length)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 0778bff632bf..5ad34566738c 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,7 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode)); + ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", + obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } break; @@ -113,7 +114,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); + ACPI_REPORT_ERROR(("Invalid descriptor type %X\n", + ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); return_ACPI_STATUS(AE_TYPE); } @@ -266,7 +268,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, break; default: - ACPI_REPORT_ERROR(("Concatanate - invalid object type: %X\n", + ACPI_REPORT_ERROR(("Invalid object type: %X\n", ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; } @@ -368,7 +370,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Invalid object type, should not happen here */ - ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n", + ACPI_REPORT_ERROR(("Invalid object type: %X\n", ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; goto cleanup; diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index ab47f6d8b5c0..89b8ab79410b 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 7bb5e17b5680..de3216b6a4fc 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,7 +99,8 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) */ name_string = ACPI_MEM_ALLOCATE(size_needed); if (!name_string) { - ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); + ACPI_REPORT_ERROR(("Could not allocate size %d\n", + size_needed)); return_PTR(NULL); } @@ -167,8 +168,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) char_buf[0] = *aml_address; if ('0' <= char_buf[0] && char_buf[0] <= '9') { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n", - char_buf[0])); + ACPI_REPORT_ERROR(("Invalid leading digit: %c\n", char_buf[0])); return_ACPI_STATUS(AE_CTRL_PENDING); } @@ -211,9 +211,8 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) * the required 4 */ status = AE_AML_BAD_NAME; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bad character %02x in name, at %p\n", - *aml_address, aml_address)); + ACPI_REPORT_ERROR(("Bad character %02x in name, at %p\n", + *aml_address, aml_address)); } *in_aml_address = ACPI_CAST_PTR(u8, aml_address); @@ -412,8 +411,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, if (AE_CTRL_PENDING == status && has_prefix) { /* Ran out of segments after processing a prefix */ - ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n", - name_string)); + ACPI_REPORT_ERROR(("Malformed Name at %p\n", name_string)); status = AE_AML_BAD_NAME; } diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 97e34542f5e4..bc8837ecb716 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,7 +111,8 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -188,7 +189,8 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -227,7 +229,8 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -346,9 +349,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Check the range of the digit */ if (temp32 > 9) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "BCD digit too large (not decimal): 0x%X\n", - temp32)); + ACPI_REPORT_ERROR(("BCD digit too large (not decimal): 0x%X\n", temp32)); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; @@ -393,12 +394,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Overflow if there is any data left in Digit */ if (digit > 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Integer too large to convert to BCD: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64(operand - [0]-> - integer. - value))); + ACPI_REPORT_ERROR(("Integer too large to convert to BCD: %8.8X%8.8X\n", ACPI_FORMAT_UINT64(operand[0]->integer.value))); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } @@ -525,15 +521,16 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* These are two obsolete opcodes */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s is obsolete and not implemented\n", - acpi_ps_get_opcode_name(walk_state->opcode))); + ACPI_REPORT_ERROR(("%s is obsolete and not implemented\n", + acpi_ps_get_opcode_name(walk_state-> + opcode))); status = AE_SUPPORT; goto cleanup; default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -639,11 +636,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc, walk_state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s: bad operand(s) %s\n", - acpi_ps_get_opcode_name(walk_state-> - opcode), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("%s: bad operand(s) %s\n", + acpi_ps_get_opcode_name(walk_state-> + opcode), + acpi_format_exception(status))); goto cleanup; } @@ -742,9 +738,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", - acpi_ut_get_type_name(type))); + ACPI_REPORT_ERROR(("Operand is not Buf/Int/Str/Pkg - found type %s\n", acpi_ut_get_type_name(type))); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -941,11 +935,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown Index target_type %X in obj %p\n", - operand[0]->reference. - target_type, - operand[0])); + ACPI_REPORT_ERROR(("Unknown Index target_type %X in obj %p\n", operand[0]->reference.target_type, operand[0])); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -971,11 +961,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown opcode in ref(%p) - %X\n", - operand[0], - operand[0]->reference. - opcode)); + ACPI_REPORT_ERROR(("Unknown opcode in ref(%p) - %X\n", operand[0], operand[0]->reference.opcode)); status = AE_TYPE; goto cleanup; @@ -985,7 +971,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index d8472842c1fd..7c59dda40946 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,9 +111,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) /* Are notifies allowed on this object? */ if (!acpi_ev_is_notify_object(node)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unexpected notify object type [%s]\n", - acpi_ut_get_type_name(node->type))); + ACPI_REPORT_ERROR(("Unexpected notify object type [%s]\n", acpi_ut_get_type_name(node->type))); status = AE_AML_OPERAND_TYPE; break; @@ -157,7 +155,8 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; } @@ -221,7 +220,8 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -389,10 +389,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) /* Object to be indexed is a Package */ if (index >= operand[0]->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index value (%X%8.8X) beyond package end (%X)\n", - ACPI_FORMAT_UINT64(index), - operand[0]->package.count)); + ACPI_REPORT_ERROR(("Index value (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -405,10 +402,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) /* Object to be indexed is a Buffer/String */ if (index >= operand[0]->buffer.length) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index value (%X%8.8X) beyond end of buffer (%X)\n", - ACPI_FORMAT_UINT64(index), - operand[0]->buffer.length)); + ACPI_REPORT_ERROR(("Index value (%X%8.8X) beyond end of buffer (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->buffer.length)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -440,7 +434,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -544,7 +539,8 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 2ea1c322970b..a979b338a491 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,7 +119,8 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -242,7 +243,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index 5dee77139576..05e7f9b67f29 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -234,8 +234,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || (operand[3]->integer.value > MAX_MATCH_OPERATOR)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Match operator out of range\n")); + ACPI_REPORT_ERROR(("Match operator out of range\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -244,10 +243,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) index = operand[5]->integer.value; if (index >= operand[0]->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Index (%X%8.8X) beyond package end (%X)\n", - ACPI_FORMAT_UINT64(index), - operand[0]->package.count)); + ACPI_REPORT_ERROR(("Index (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(index), operand[0]->package.count)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -316,7 +312,8 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) default: - ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", + walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 88ccbf3b29d0..3bde780c94cf 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -274,8 +274,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, default: /* Invalid field access type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown field access type %X\n", access)); + ACPI_REPORT_ERROR(("Unknown field access type %X\n", access)); return_UINT32(0); } @@ -422,15 +421,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { if (!info->region_node) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n")); + ACPI_REPORT_ERROR(("Null region_node\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } type = acpi_ns_get_type(info->region_node); if (type != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed Region, found type %X (%s)\n", - type, acpi_ut_get_type_name(type))); + ACPI_REPORT_ERROR(("Needed Region, found type %X (%s)\n", type, acpi_ut_get_type_name(type))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 80118be3f544..82983575cca6 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -103,9 +103,8 @@ acpi_ex_system_memory_space_handler(u32 function, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid system_memory width %d\n", - bit_width)); + ACPI_REPORT_ERROR(("Invalid system_memory width %d\n", + bit_width)); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } @@ -159,10 +158,7 @@ acpi_ex_system_memory_space_handler(u32 function, (void **)&mem_info-> mapped_logical_address); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X%8.8X, size %X\n", - ACPI_FORMAT_UINT64(address), - (u32) window_size)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X, size %X\n", ACPI_FORMAT_UINT64(address), (u32) window_size)); mem_info->mapped_length = 0; return_ACPI_STATUS(status); } diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index ff5d8f97e8eb..a5cca7eda210 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,8 +122,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, } if (!source_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No object attached to node %p\n", node)); + ACPI_REPORT_ERROR(("No object attached to node %p\n", node)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -135,10 +134,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_PACKAGE: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a Package, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a Package, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -154,10 +152,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_BUFFER: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a Buffer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a Buffer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -173,10 +170,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_STRING: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a String, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a String, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -189,10 +185,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_INTEGER: if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Object not a Integer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Object not a Integer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -236,9 +231,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_ANY: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Untyped entry %p, no attached object!\n", - node)); + ACPI_REPORT_ERROR(("Untyped entry %p, no attached object!\n", + node)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ @@ -257,12 +251,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, default: /* No named references are allowed here */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported Reference opcode %X (%s)\n", - source_desc->reference.opcode, - acpi_ps_get_opcode_name(source_desc-> - reference. - opcode))); + ACPI_REPORT_ERROR(("Unsupported Reference opcode %X (%s)\n", source_desc->reference.opcode, acpi_ps_get_opcode_name(source_desc->reference.opcode))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -272,9 +261,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* Default case is for unknown types */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Node %p - Unknown object type %X\n", - node, entry_type)); + ACPI_REPORT_ERROR(("Node %p - Unknown object type %X\n", + node, entry_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 97eecbd3242d..ae2d2da00844 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,7 +81,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); if (!stack_ptr || !*stack_ptr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n")); + ACPI_REPORT_ERROR(("Internal - null pointer\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -97,8 +97,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, } if (!*stack_ptr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Internal - null pointer\n")); + ACPI_REPORT_ERROR(("Internal - null pointer\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } } @@ -228,9 +227,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, * A NULL object descriptor means an unitialized element of * the package, can't dereference it */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Attempt to deref an Index to NULL pkg element Idx=%p\n", - stack_desc)); + ACPI_REPORT_ERROR(("Attempt to deref an Index to NULL pkg element Idx=%p\n", stack_desc)); status = AE_AML_UNINITIALIZED_ELEMENT; } break; @@ -239,7 +236,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, /* Invalid reference object */ - ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); + ACPI_REPORT_ERROR(("Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); status = AE_AML_INTERNAL; break; } @@ -264,7 +261,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, default: - ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); + ACPI_REPORT_ERROR(("Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); status = AE_AML_INTERNAL; break; } @@ -386,7 +383,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); + ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", + node, + acpi_ut_get_descriptor_name + (node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -442,7 +442,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); + ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", + node, + acpi_ut_get_descriptor_name + (node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -511,7 +514,8 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode)); + ACPI_REPORT_ERROR(("Unknown Reference subtype %X\n", + obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index b04e4a3707a1..804faebf825c 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,7 +73,7 @@ static acpi_status acpi_ex_check_object_type(acpi_object_type type_needed, acpi_object_type this_type, void *object) { - ACPI_FUNCTION_NAME("ex_check_object_type"); + ACPI_FUNCTION_ENTRY(); if (type_needed == ACPI_TYPE_ANY) { /* All types OK, so we don't perform any typechecks */ @@ -95,10 +95,9 @@ acpi_ex_check_object_type(acpi_object_type type_needed, } if (type_needed != this_type) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [%s], found [%s] %p\n", - acpi_ut_get_type_name(type_needed), - acpi_ut_get_type_name(this_type), object)); + ACPI_REPORT_ERROR(("Needed type [%s], found [%s] %p\n", + acpi_ut_get_type_name(type_needed), + acpi_ut_get_type_name(this_type), object)); return (AE_AML_OPERAND_TYPE); } @@ -151,7 +150,7 @@ acpi_ex_resolve_operands(u16 opcode, arg_types = op_info->runtime_args; if (arg_types == ARGI_INVALID_OPCODE) { - ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); + ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -169,7 +168,8 @@ acpi_ex_resolve_operands(u16 opcode, */ while (GET_CURRENT_ARG_TYPE(arg_types)) { if (!stack_ptr || !*stack_ptr) { - ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); + ACPI_REPORT_ERROR(("Null stack entry at %p\n", + stack_ptr)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -198,9 +198,7 @@ acpi_ex_resolve_operands(u16 opcode, /* Check for bad acpi_object_type */ if (!acpi_ut_valid_object_type(object_type)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bad operand object type [%X]\n", - object_type)); + ACPI_REPORT_ERROR(("Bad operand object type [%X]\n", object_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -238,13 +236,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", - obj_desc->reference. - opcode, - (acpi_ps_get_opcode_info - (obj_desc->reference. - opcode))->name)); + ACPI_REPORT_ERROR(("Operand is a Reference, Unknown Reference Opcode: %X\n", obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -255,11 +247,10 @@ acpi_ex_resolve_operands(u16 opcode, /* Invalid descriptor */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid descriptor %p [%s]\n", - obj_desc, - acpi_ut_get_descriptor_name - (obj_desc))); + ACPI_REPORT_ERROR(("Invalid descriptor %p [%s]\n", + obj_desc, + acpi_ut_get_descriptor_name + (obj_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -417,11 +408,7 @@ acpi_ex_resolve_operands(u16 opcode, acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), - obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -444,11 +431,7 @@ acpi_ex_resolve_operands(u16 opcode, status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), - obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -472,11 +455,7 @@ acpi_ex_resolve_operands(u16 opcode, ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), - obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -502,10 +481,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -539,10 +515,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Integer/String/Buffer], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -566,10 +539,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Buffer/String/Package/Reference], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Buffer/String/Package/Reference], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -588,10 +558,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Buffer/String/Package], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Buffer/String/Package], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -611,10 +578,7 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed [Region/region_field], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed [Region/region_field], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -656,10 +620,7 @@ acpi_ex_resolve_operands(u16 opcode, break; } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", - acpi_ut_get_object_type_name - (obj_desc), obj_desc)); + ACPI_REPORT_ERROR(("Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -669,9 +630,7 @@ acpi_ex_resolve_operands(u16 opcode, /* Unknown type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Internal - Unknown ARGI (required operand) type %X\n", - this_arg_type)); + ACPI_REPORT_ERROR(("Internal - Unknown ARGI (required operand) type %X\n", this_arg_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index a7d8eea305c2..202ebe1eb957 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -250,7 +250,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, /* Validate parameters */ if (!source_desc || !dest_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n")); + ACPI_REPORT_ERROR(("Null parameter\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -290,10 +290,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, /* Destination is not a Reference object */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Target is not a Reference or Constant object - %s [%p]\n", - acpi_ut_get_object_type_name(dest_desc), - dest_desc)); + ACPI_REPORT_ERROR(("Target is not a Reference or Constant object - %s [%p]\n", acpi_ut_get_object_type_name(dest_desc), dest_desc)); ACPI_DUMP_STACK_ENTRY(source_desc); ACPI_DUMP_STACK_ENTRY(dest_desc); @@ -360,7 +357,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, default: - ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n", + ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", ref_desc->reference.opcode)); ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); @@ -490,10 +487,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, /* All other types are invalid */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Source must be Integer/Buffer/String type, not %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_REPORT_ERROR(("Source must be Integer/Buffer/String type, not %s\n", acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -503,8 +497,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Target is not a Package or buffer_field\n")); + ACPI_REPORT_ERROR(("Target is not a Package or buffer_field\n")); status = AE_AML_OPERAND_TYPE; break; } diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 382f63c14ea1..25bbc1d78547 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -123,11 +123,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, && (source_desc->reference.opcode == AML_LOAD_OP))) { /* Conversion successful but still not a valid type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", - acpi_ut_get_object_type_name - (source_desc), - acpi_ut_get_type_name(target_type))); + ACPI_REPORT_ERROR(("Cannot assign type %s to %s (must be type Int/Str/Buf)\n", acpi_ut_get_object_type_name(source_desc), acpi_ut_get_type_name(target_type))); status = AE_AML_OPERAND_TYPE; } break; @@ -280,9 +276,8 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, /* * All other types come here. */ - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Store into type %s not implemented\n", - acpi_ut_get_object_type_name(dest_desc))); + ACPI_REPORT_WARNING(("Store into type %s not implemented\n", + acpi_ut_get_object_type_name(dest_desc))); status = AE_NOT_IMPLEMENTED; break; diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 855db7130751..6ab707087750 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 8a88b841237d..9a3684d3cf87 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -129,7 +129,7 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n", + ACPI_REPORT_ERROR(("Time parameter is too large (%d)\n", how_long)); status = AE_AML_OPERAND_VALUE; } else { diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 9f4e547d7734..990c40e0c041 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -200,9 +200,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) if (ACPI_SUCCESS(status)) { locked = TRUE; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not acquire Global Lock, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not acquire Global Lock, %s\n", acpi_format_exception(status))); } } diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 20a335cc9bea..5c068cc4f674 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,8 +68,7 @@ acpi_status acpi_hw_initialize(void) /* We must have the ACPI tables by the time we get here */ if (!acpi_gbl_FADT) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n")); - + ACPI_REPORT_ERROR(("No FADT is present\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -108,7 +107,7 @@ acpi_status acpi_hw_set_mode(u32 mode) * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n")); + ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed\n")); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 5c8e5dfd024e..d84942d22dd5 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index b243f20708b7..b4b50a3d1705 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -7,7 +7,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -202,12 +202,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", - acpi_format_exception(status), - sleep_state_name, info.return_object, - acpi_ut_get_object_type_name(info. - return_object))); + ACPI_REPORT_ERROR(("%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", acpi_format_exception(status), sleep_state_name, info.return_object, acpi_ut_get_object_type_name(info.return_object))); } acpi_ut_remove_reference(info.return_object); @@ -230,12 +225,11 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) { - ACPI_FUNCTION_NAME("hw_get_bit_register_info"); + ACPI_FUNCTION_ENTRY(); if (register_id > ACPI_BITREG_MAX) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid bit_register ID: %X\n", - register_id)); + ACPI_REPORT_ERROR(("Invalid bit_register ID: %X\n", + register_id)); return (NULL); } @@ -570,8 +564,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n", - register_id)); + ACPI_REPORT_ERROR(("Unknown Register ID: %X\n", register_id)); status = AE_BAD_PARAMETER; break; } @@ -766,9 +759,8 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_REPORT_ERROR(("Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } @@ -837,9 +829,8 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_REPORT_ERROR(("Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 34519069050c..992128d71117 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index aff6dc141784..fc10b7cb456f 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 6923059ba3c7..c2db93e25b78 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -110,10 +110,7 @@ acpi_status acpi_ns_root_initialize(void) ACPI_NS_NO_UPSEARCH, NULL, &new_node); if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not create predefined name %s, %s\n", - init_val->name, - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not create predefined name %s, %s\n", init_val->name, acpi_format_exception(status))); } /* @@ -124,9 +121,7 @@ acpi_status acpi_ns_root_initialize(void) if (init_val->val) { status = acpi_os_predefined_override(init_val, &val); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not override predefined %s\n", - init_val->name)); + ACPI_REPORT_ERROR(("Could not override predefined %s\n", init_val->name)); } if (!val) { @@ -339,7 +334,10 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, prefix_node = scope_info->scope.node; if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node))); + ACPI_REPORT_ERROR(("%p is not a namespace node [%s]\n", + prefix_node, + acpi_ut_get_descriptor_name + (prefix_node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -600,7 +598,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, (this_node->type != type_to_check_for)) { /* Complain about a type mismatch */ - ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); + ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", ACPI_CAST_PTR(char, &simple_name), acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); } /* diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index cc7a85f8cfe6..3db950f5d5a0 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -272,9 +272,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) /* Grandchildren should have all been deleted already */ if (child_node->child) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Found a grandchild! P=%p C=%p\n", - parent_node, child_node)); + ACPI_REPORT_ERROR(("Found a grandchild! P=%p C=%p\n", + parent_node, child_node)); } /* Now we can free this child object */ diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 864c642759fa..2f0b70e3e881 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -198,7 +198,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, /* Check the node type and name */ if (type > ACPI_TYPE_LOCAL_MAX) { - ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type)); + ACPI_REPORT_WARNING(("Invalid ACPI Object Type %08X\n", + type)); } if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index 55de883943d6..aff899a935e3 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 0191c7d92824..e3c667072e2f 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -373,8 +373,7 @@ acpi_ns_execute_control_method(struct acpi_parameter_info *info) info->obj_desc = acpi_ns_get_attached_object(info->node); if (!info->obj_desc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No attached method object\n")); + ACPI_REPORT_ERROR(("No attached method object\n")); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(AE_NULL_OBJECT); diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index efa3f4233736..6c117893f301 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,8 +93,8 @@ acpi_status acpi_ns_initialize_objects(void) ACPI_UINT32_MAX, acpi_ns_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("walk_namespace failed! %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -159,8 +159,8 @@ acpi_status acpi_ns_initialize_devices(void) (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("walk_namespace failed! %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -289,12 +289,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n")); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not execute arguments for [%4.4s] (%s), %s\n", - acpi_ut_get_node_name(node), - acpi_ut_get_type_name(type), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("\nCould not execute arguments for [%4.4s] (%s), %s\n", acpi_ut_get_node_name(node), acpi_ut_get_type_name(type), acpi_format_exception(status))); } /* @@ -421,8 +416,9 @@ acpi_ns_init_one_device(acpi_handle obj_handle, #ifdef ACPI_DEBUG_OUTPUT char *scope_name = acpi_ns_get_external_pathname(ini_node); - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", - scope_name, acpi_format_exception(status))); + ACPI_REPORT_WARNING(("%s._INI failed: %s\n", + scope_name, + acpi_format_exception(status))); ACPI_MEM_FREE(scope_name); #endif diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index c28849de465a..0b4a866ef5aa 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,7 +92,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, /* Check validity of the AML start and length */ if (!table_desc->aml_start) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n")); + ACPI_REPORT_ERROR(("Null AML pointer\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -263,7 +263,7 @@ acpi_status acpi_ns_load_namespace(void) /* There must be at least a DSDT installed */ if (acpi_gbl_DSDT == NULL) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n")); + ACPI_REPORT_ERROR(("DSDT is not in memory\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 5400728eb791..411e1f8b11d0 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, acpi_size index; struct acpi_namespace_node *parent_node; - ACPI_FUNCTION_NAME("ns_build_external_path"); + ACPI_FUNCTION_ENTRY(); /* Special case for root */ @@ -110,9 +110,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, name_buffer[index] = AML_ROOT_PREFIX; if (index != 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not construct pathname; index=%X, size=%X, Path=%s\n", - (u32) index, (u32) size, &name_buffer[size])); + ACPI_REPORT_ERROR(("Could not construct pathname; index=%X, size=%X, Path=%s\n", (u32) index, (u32) size, &name_buffer[size])); } return; @@ -148,7 +146,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) name_buffer = ACPI_MEM_CALLOCATE(size); if (!name_buffer) { - ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n")); + ACPI_REPORT_ERROR(("Allocation failure\n")); return_PTR(NULL); } diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index fc9be946ebed..86113093f7b7 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,21 +84,21 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, if (!node) { /* Invalid handle */ - ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n")); + ACPI_REPORT_ERROR(("Null named_obj handle\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!object && (ACPI_TYPE_ANY != type)) { /* Null object */ - ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); + ACPI_REPORT_ERROR(("Null object, but type not ACPI_TYPE_ANY\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { /* Not a name handle */ - ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n", + ACPI_REPORT_ERROR(("Invalid handle %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -254,7 +254,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); if (!node) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n")); + ACPI_REPORT_WARNING(("Null Node ptr\n")); return_PTR(NULL); } diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 433442a9ec74..232be4303653 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index c1b1943d4670..f094a2eb8512 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -298,18 +298,15 @@ acpi_ns_search_and_enter(u32 target_name, /* Parameter validation */ if (!node || !target_name || !return_node) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Null param: Node %p Name %X return_node %p\n", - node, target_name, return_node)); - - ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n")); + ACPI_REPORT_ERROR(("Null param: Node %p Name %X return_node %p\n", node, target_name, return_node)); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Name must consist of printable characters */ if (!acpi_ut_valid_acpi_name(target_name)) { - ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name)); + ACPI_REPORT_ERROR(("Bad character in ACPI Name: %X\n", + target_name)); return_ACPI_STATUS(AE_BAD_CHARACTER); } diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 549075fb9f88..bc779fdd3caf 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,6 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * internal_name - Name or path of the namespace node * lookup_status - Exception code from NS lookup * @@ -76,14 +75,12 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); void acpi_ns_report_error(char *module_name, u32 line_number, - u32 component_id, char *internal_name, acpi_status lookup_status) { acpi_status status; char *name = NULL; - acpi_os_printf("%8s-%04d: *** Error: Looking up ", - module_name, line_number); + acpi_ut_report_error(module_name, line_number); if (lookup_status == AE_BAD_CHARACTER) { /* There is a non-ascii character in the name */ @@ -109,7 +106,7 @@ acpi_ns_report_error(char *module_name, } } - acpi_os_printf(" in namespace, %s\n", + acpi_os_printf("Namespace lookup failure, %s\n", acpi_format_exception(lookup_status)); } @@ -119,10 +116,9 @@ acpi_ns_report_error(char *module_name, * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * Message - Error message to use on failure * prefix_node - Prefix relative to the path - * Path - Path to the node + * Path - Path to the node (optional) * method_status - Execution status * * RETURN: None @@ -134,7 +130,6 @@ acpi_ns_report_error(char *module_name, void acpi_ns_report_method_error(char *module_name, u32 line_number, - u32 component_id, char *message, struct acpi_namespace_node *prefix_node, char *path, acpi_status method_status) @@ -142,17 +137,16 @@ acpi_ns_report_method_error(char *module_name, acpi_status status; struct acpi_namespace_node *node = prefix_node; + acpi_ut_report_error(module_name, line_number); + if (path) { status = acpi_ns_get_node_by_path(path, prefix_node, ACPI_NS_NO_UPSEARCH, &node); if (ACPI_FAILURE(status)) { - acpi_os_printf - ("report_method_error: Could not get node\n"); - return; + acpi_os_printf("[Could not get node by pathname]"); } } - acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); acpi_ns_print_node_pathname(node, message); acpi_os_printf(", %s\n", acpi_format_exception(method_status)); } @@ -248,7 +242,7 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) ACPI_FUNCTION_TRACE("ns_get_type"); if (!node) { - ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); + ACPI_REPORT_WARNING(("Null Node parameter\n")); return_UINT32(ACPI_TYPE_ANY); } @@ -275,7 +269,7 @@ u32 acpi_ns_local(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* Type code out of range */ - ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); + ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); return_UINT32(ACPI_NS_NORMAL); } @@ -627,7 +621,7 @@ acpi_ns_externalize_name(u32 internal_name_length, * with internal_name (invalid format). */ if (required_length > internal_name_length) { - ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n")); + ACPI_REPORT_ERROR(("Invalid internal name\n")); return_ACPI_STATUS(AE_BAD_PATHNAME); } @@ -803,8 +797,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* type code out of range */ - ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", - type)); + ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); return_UINT32(ACPI_NS_NORMAL); } diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index 5f164c0df33b..fcab1e784b81 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 75b137a6a3c9..de13add43efc 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,8 +112,7 @@ acpi_evaluate_object_typed(acpi_handle handle, if (return_buffer->length == 0) { /* Error because caller specifically asked for a return value */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n")); - + ACPI_REPORT_ERROR(("No return value\n")); return_ACPI_STATUS(AE_NULL_OBJECT); } @@ -125,11 +124,11 @@ acpi_evaluate_object_typed(acpi_handle handle, /* Return object type does not match requested type */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Incorrect return type [%s] requested [%s]\n", - acpi_ut_get_type_name(((union acpi_object *) - return_buffer->pointer)->type), - acpi_ut_get_type_name(return_type))); + ACPI_REPORT_ERROR(("Incorrect return type [%s] requested [%s]\n", + acpi_ut_get_type_name(((union acpi_object *) + return_buffer->pointer)-> + type), + acpi_ut_get_type_name(return_type))); if (must_free) { /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ @@ -236,11 +235,9 @@ acpi_evaluate_object(acpi_handle handle, * qualified names above, this is an error */ if (!pathname) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Both Handle and Pathname are NULL\n")); + ACPI_REPORT_ERROR(("Both Handle and Pathname are NULL\n")); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Handle is NULL and Pathname is relative\n")); + ACPI_REPORT_ERROR(("Handle is NULL and Pathname is relative\n")); } status = AE_BAD_PARAMETER; diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 6b5f8d4481d1..853e6d170c96 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index 0856d42e6909..a0332595677a 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index e6d4cb9fd303..3c37cd0ecd80 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -298,7 +298,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, acpi_ps_append_arg(arg, name_op); if (!method_desc) { - ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); + ACPI_REPORT_ERROR(("Control Method %p has no attached object\n", node)); return_ACPI_STATUS(AE_AML_INTERNAL); } diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index e81e51b8b3ae..c66029b890b1 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -123,16 +123,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) && ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) { if (status == AE_AML_NO_RETURN_VALUE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invoked method did not return a value, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("Invoked method did not return a value, %s\n", acpi_format_exception(status))); } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "get_predicate Failed, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("get_predicate Failed, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -190,11 +184,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* The opcode is unrecognized. Just skip unknown opcodes */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Found unknown opcode %X at AML address %p offset %X, ignoring\n", - walk_state->opcode, - parser_state->aml, - walk_state->aml_offset)); + ACPI_REPORT_ERROR(("Found unknown opcode %X at AML address %p offset %X, ignoring\n", walk_state->opcode, parser_state->aml, walk_state->aml_offset)); ACPI_DUMP_BUFFER(parser_state->aml, 128); @@ -281,10 +271,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->descending_callback(walk_state, &op); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "During name lookup/catalog, %s\n", - acpi_format_exception - (status))); + ACPI_REPORT_ERROR(("During name lookup/catalog, %s\n", acpi_format_exception(status))); goto close_this_op; } diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 229ae86afe8b..11d6351ab8b2 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -747,7 +747,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) /* Unknown AML opcode */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Unknown AML opcode [%4.4X]\n", opcode)); return (&acpi_gbl_aml_op_info[_UNK]); diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index f0979b2956f2..3b540fe17a0c 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -512,9 +512,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } else if ((status != AE_OK) && (walk_state->method_desc)) { /* Either the method parse or actual execution failed */ - ACPI_REPORT_METHOD_ERROR - ("Method parse/execution failed", - walk_state->method_node, NULL, status); + ACPI_REPORT_MTERROR("Method parse/execution failed", + walk_state->method_node, NULL, + status); /* Check for possible multi-thread reentrancy problem */ diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index 1c953b6f1af1..bc6047caccd9 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index f0e755884eea..d387e2b01dbb 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,7 +132,8 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) if (op_info->class == AML_CLASS_UNKNOWN) { /* Invalid opcode */ - ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode)); + ACPI_REPORT_ERROR(("Invalid AML Opcode: 0x%2.2X\n", + op->common.aml_opcode)); return; } diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 2075efbb4324..3e07cb9cb748 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 08f2321b6ded..06f05bfd7612 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 14d544d60867..2dd48cbb7c02 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 4ac942badbc0..8fa3213ce000 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index c2c4d9079c6c..1dfa6906d455 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 6c7c6c560635..7f46ca0bf33a 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -207,21 +207,14 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /* Each element of the top-level package must also be a package */ if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(PRT[%X]) Need sub-package, found %s\n", - index, - acpi_ut_get_object_type_name - (*top_object_list))); + ACPI_REPORT_ERROR(("(PRT[%X]) Need sub-package, found %s\n", index, acpi_ut_get_object_type_name(*top_object_list))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Each sub-package must be of length 4 */ if ((*top_object_list)->package.count != 4) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(PRT[%X]) Need package of length 4, found length %d\n", - index, - (*top_object_list)->package.count)); + ACPI_REPORT_ERROR(("(PRT[%X]) Need package of length 4, found length %d\n", index, (*top_object_list)->package.count)); return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); } @@ -238,11 +231,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->address = obj_desc->integer.value; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(PRT[%X].Address) Need Integer, found %s\n", - index, - acpi_ut_get_object_type_name - (obj_desc))); + ACPI_REPORT_ERROR(("(PRT[%X].Address) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -252,11 +241,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->pin = (u32) obj_desc->integer.value; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(PRT[%X].Pin) Need Integer, found %s\n", - index, - acpi_ut_get_object_type_name - (obj_desc))); + ACPI_REPORT_ERROR(("(PRT[%X].Pin) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -267,10 +252,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, case ACPI_TYPE_LOCAL_REFERENCE: if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(PRT[%X].Source) Need name, found reference op %X\n", - index, - obj_desc->reference.opcode)); + ACPI_REPORT_ERROR(("(PRT[%X].Source) Need name, found reference op %X\n", index, obj_desc->reference.opcode)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -316,11 +298,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", - index, - acpi_ut_get_object_type_name - (obj_desc))); + ACPI_REPORT_ERROR(("(PRT[%X].Source) Need Ref/String/Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -335,11 +313,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->source_index = (u32) obj_desc->integer.value; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "(PRT[%X].source_index) Need Integer, found %s\n", - index, - acpi_ut_get_object_type_name - (obj_desc))); + ACPI_REPORT_ERROR(("(PRT[%X].source_index) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index c24e3eb658c3..98356e2482c5 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index 623b06689336..d9ae64b77bd9 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index ef24ba110c6e..ea567167c4f2 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 79e71257b69a..1fa63bc2e36f 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 573c06705641..e4778a51c17e 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,9 +156,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Validate the (internal) Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid descriptor type (%X) in resource list\n", - resource->type)); + ACPI_REPORT_ERROR(("Invalid descriptor type (%X) in resource list\n", resource->type)); return_ACPI_STATUS(AE_BAD_DATA); } diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 418a3fb64077..a5131936d690 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 4a758bd4a5c8..83bfe0dd3eba 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -523,9 +523,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { * polarity/trigger interrupts are allowed (ACPI spec, section * "IRQ Format"), so 0x00 and 0x09 are illegal. */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid interrupt polarity/trigger in resource list, %X\n", - aml->irq.flags)); + ACPI_REPORT_ERROR(("Invalid interrupt polarity/trigger in resource list, %X\n", aml->irq.flags)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -537,8 +535,7 @@ if (temp8 < 1) { } if (resource->data.dma.transfer == 0x03) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid DMA.Transfer preference (3)\n")); + ACPI_REPORT_ERROR(("Invalid DMA.Transfer preference (3)\n")); return_ACPI_STATUS(AE_BAD_DATA); } #endif diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 2236a0c90daa..25b5aedd6612 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 50a956b705b0..88b67077aeeb 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index cd33397d9231..48290b7e6ba5 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 6acd5aeb093e..0fedf4b27ea5 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -362,8 +362,8 @@ acpi_tb_get_this_table(struct acpi_pointer *address, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid address flags %X\n", - address->pointer_type)); + ACPI_REPORT_ERROR(("Invalid address flags %X\n", + address->pointer_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 33c9ed8a6f99..496f336b3e3a 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 10db8484e462..e1c9faa3982e 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 3cee0cee4cc2..178309026850 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -176,7 +176,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) { int no_match; - ACPI_FUNCTION_NAME("tb_validate_rsdt"); + ACPI_FUNCTION_ENTRY(); /* * Search for appropriate signature, RSDT or XSDT @@ -192,15 +192,11 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) if (no_match) { /* Invalid RSDT or XSDT signature */ - ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); + ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located. RSDP:\n")); ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); - ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, - "RSDT/XSDT signature at %X (%p) is invalid\n", - acpi_gbl_RSDP->rsdt_physical_address, - (void *)(acpi_native_uint) acpi_gbl_RSDP-> - rsdt_physical_address)); + ACPI_REPORT_ERROR(("RSDT/XSDT signature at %X (%p) is invalid\n", acpi_gbl_RSDP->rsdt_physical_address, (void *)(acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { ACPI_REPORT_ERROR(("Looking for RSDT\n")) @@ -209,7 +205,6 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) } ACPI_DUMP_BUFFER((char *)table_ptr, 48); - return (AE_BAD_SIGNATURE); } @@ -243,9 +238,8 @@ acpi_status acpi_tb_get_table_rsdt(void) table_info.type = ACPI_TABLE_XSDT; status = acpi_tb_get_table(&address, &table_info); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not get the RSDT/XSDT, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not get the RSDT/XSDT, %s\n", + acpi_format_exception(status))); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 9d0bf536d674..38c6749e43d5 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -144,14 +144,13 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) { acpi_name signature; - ACPI_FUNCTION_NAME("tb_validate_table_header"); + ACPI_FUNCTION_ENTRY(); /* Verify that this is a valid address */ if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Cannot read table header at %p\n", - table_header)); + ACPI_REPORT_ERROR(("Cannot read table header at %p\n", + table_header)); return (AE_BAD_ADDRESS); } @@ -160,12 +159,10 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) ACPI_MOVE_32_TO_32(&signature, table_header->signature); if (!acpi_ut_valid_acpi_name(signature)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Table signature at %p [%p] has invalid characters\n", - table_header, &signature)); + ACPI_REPORT_ERROR(("Table signature at %p [%p] has invalid characters\n", table_header, &signature)); ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", - (char *)&signature)); + ACPI_CAST_PTR(char, &signature))); ACPI_DUMP_BUFFER(table_header, sizeof(struct acpi_table_header)); @@ -175,9 +172,7 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) /* Validate the table length */ if (table_header->length < sizeof(struct acpi_table_header)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid length in table header %p name %4.4s\n", - table_header, (char *)&signature)); + ACPI_REPORT_ERROR(("Invalid length in table header %p name %4.4s\n", table_header, (char *)&signature)); ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length)); @@ -291,8 +286,7 @@ acpi_tb_handle_to_object(u16 table_id, } } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n", - table_id)); + ACPI_REPORT_ERROR(("table_id=%X does not exist\n", table_id)); return (AE_BAD_PARAMETER); } #endif diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 3f96a4909aad..83a9ca8cb98c 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ acpi_status acpi_load_tables(void) status = acpi_os_get_root_pointer(ACPI_LOGICAL_ADDRESSING, &rsdp_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Could not get RSDP, %s\n", + ACPI_REPORT_ERROR(("Could not get RSDP, %s\n", acpi_format_exception(status))); goto error_exit; } @@ -86,7 +86,8 @@ acpi_status acpi_load_tables(void) status = acpi_tb_verify_rsdp(&rsdp_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: RSDP Failed validation: %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("RSDP Failed validation: %s\n", + acpi_format_exception(status))); goto error_exit; } @@ -94,7 +95,8 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_table_rsdt(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Could not load RSDT: %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not load RSDT: %s\n", + acpi_format_exception(status))); goto error_exit; } @@ -102,7 +104,7 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_required_tables(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not get all required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); goto error_exit; } @@ -112,14 +114,15 @@ acpi_status acpi_load_tables(void) status = acpi_ns_load_namespace(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("acpi_load_tables: Could not load namespace: %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not load namespace: %s\n", + acpi_format_exception(status))); goto error_exit; } return_ACPI_STATUS(AE_OK); error_exit: - ACPI_REPORT_ERROR(("acpi_load_tables: Could not load tables: %s\n", + ACPI_REPORT_ERROR(("Could not load tables: %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index b01a4b2ae7da..6538ed818f5b 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -396,9 +396,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) status = acpi_tb_find_rsdp(&table_info, flags); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "RSDP structure not found, %s Flags=%X\n", - acpi_format_exception(status), flags)); + ACPI_REPORT_ERROR(("RSDP structure not found, %s Flags=%X\n", + acpi_format_exception(status), flags)); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -503,10 +502,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_PTR_LENGTH, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - ACPI_EBDA_PTR_LOCATION, - ACPI_EBDA_PTR_LENGTH)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS(status); } @@ -530,10 +526,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_WINDOW_SIZE, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - physical_address, - ACPI_EBDA_WINDOW_SIZE)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", physical_address, ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS(status); } @@ -563,10 +556,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Could not map memory at %8.8X for length %X\n", - ACPI_HI_RSDP_WINDOW_BASE, - ACPI_HI_RSDP_WINDOW_SIZE)); + ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index b11b7ed788c6..0efcbdf7e620 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -301,7 +301,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); size = 1; } @@ -310,7 +310,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_allocate: Could not allocate size %X\n", (u32) size)); @@ -344,7 +344,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) /* Check for an inadvertent size of zero bytes */ if (!size) { - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); size = 1; } @@ -353,7 +353,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_callocate: Could not allocate size %X\n", (u32) size)); return_PTR(NULL); @@ -480,7 +480,7 @@ void *acpi_ut_callocate_and_track(acpi_size size, if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_callocate: Could not allocate size %X\n", (u32) size)); return (NULL); @@ -524,7 +524,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); if (NULL == allocation) { - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("acpi_ut_free: Attempt to delete a NULL address\n")); return_VOID; @@ -540,8 +540,8 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) status = acpi_ut_remove_allocation(debug_block, component, module, line); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Could not free memory, %s\n", + acpi_format_exception(status))); } acpi_os_free(debug_block); @@ -626,8 +626,8 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, if (element) { ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n", - element, allocation)); + ACPI_REPORT_ERROR(("Element %p Address %p\n", + element, allocation)); goto unlock_and_exit; } @@ -687,7 +687,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, if (NULL == mem_list->list_head) { /* No allocations! */ - _ACPI_REPORT_ERROR(module, line, component, + _ACPI_REPORT_ERROR(module, line, ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); return_ACPI_STATUS(AE_OK); @@ -863,12 +863,10 @@ void acpi_ut_dump_allocations(u32 component, char *module) /* Print summary */ if (!num_outstanding) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No outstanding allocations\n")); + ACPI_REPORT_INFO(("No outstanding allocations\n")); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%d(%X) Outstanding allocations\n", - num_outstanding, num_outstanding)); + ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n", + num_outstanding, num_outstanding)); } return_VOID; diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 93d48681d276..2177cb1ef2c4 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 568df9e42f89..1a4da006822a 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -606,8 +606,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, /* * Packages as external input to control methods are not supported, */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Packages as parameters not implemented!\n")); + ACPI_REPORT_ERROR(("Packages as parameters not implemented!\n")); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -870,7 +869,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, count + 1) * sizeof(void *)); if (!dest_obj->package.elements) { - ACPI_REPORT_ERROR(("aml_build_copy_internal_package_object: Package allocation failure\n")); + ACPI_REPORT_ERROR(("Package allocation failure\n")); return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index d80e92639932..35f3d581e034 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 2bc878f7a127..1079a1a1f195 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -363,8 +363,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n", - action)); + ACPI_REPORT_ERROR(("Unknown action (%X)\n", action)); break; } @@ -374,9 +373,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) */ if (count > ACPI_MAX_REFERENCE_COUNT) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "**** Warning **** Large Reference Count (%X) in object %p\n\n", - count, object)); + ACPI_REPORT_WARNING(("Large Reference Count (%X) in object %p\n\n", count, object)); } return; diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index cd63a2d93fe3..f4dc374a0eec 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -154,8 +154,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, acpi_ut_get_node_name(prefix_node), path)); } else { - ACPI_REPORT_METHOD_ERROR("Method execution failed", - prefix_node, path, status); + ACPI_REPORT_MTERROR("Method execution failed", + prefix_node, path, status); } return_ACPI_STATUS(status); @@ -165,9 +165,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, if (!info.return_object) { if (expected_return_btypes) { - ACPI_REPORT_METHOD_ERROR("No object was returned from", - prefix_node, path, - AE_NOT_EXIST); + ACPI_REPORT_MTERROR("No object was returned from", + prefix_node, path, AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -212,15 +211,10 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, /* Is the return object one of the expected types? */ if (!(expected_return_btypes & return_btype)) { - ACPI_REPORT_METHOD_ERROR("Return object type is incorrect", - prefix_node, path, AE_TYPE); - - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Type returned from %s was incorrect: %s, expected Btypes: %X\n", - path, - acpi_ut_get_object_type_name(info. - return_object), - expected_return_btypes)); + ACPI_REPORT_MTERROR("Return object type is incorrect", + prefix_node, path, AE_TYPE); + + ACPI_REPORT_ERROR(("Type returned from %s was incorrect: %s, expected Btypes: %X\n", path, acpi_ut_get_object_type_name(info.return_object), expected_return_btypes)); /* On error exit, we must delete the return object */ diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 7c59c2b0d953..87ca9a0a8b76 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,8 +67,11 @@ const char *acpi_format_exception(acpi_status status) acpi_status sub_status; const char *exception = NULL; - ACPI_FUNCTION_NAME("format_exception"); + ACPI_FUNCTION_ENTRY(); + /* + * Status is composed of two parts, a "type" and an actual code + */ sub_status = (status & ~AE_CODE_MASK); switch (status & AE_CODE_MASK) { @@ -118,13 +121,13 @@ const char *acpi_format_exception(acpi_status status) if (!exception) { /* Exception code was not recognized */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unknown exception code: 0x%8.8X\n", status)); + ACPI_REPORT_ERROR(("Unknown exception code: 0x%8.8X\n", + status)); - return ((const char *)"UNKNOWN_STATUS_CODE"); + exception = "UNKNOWN_STATUS_CODE"; } - return ((const char *)exception); + return (ACPI_CAST_PTR(const char, exception)); } /******************************************************************************* @@ -519,7 +522,7 @@ char *acpi_ut_get_event_name(u32 event_id) return ("invalid_event_iD"); } - return ((char *)acpi_gbl_event_types[event_id]); + return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); } /******************************************************************************* @@ -586,10 +589,10 @@ char *acpi_ut_get_type_name(acpi_object_type type) { if (type > ACPI_TYPE_INVALID) { - return ((char *)acpi_gbl_bad_type); + return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); } - return ((char *)acpi_gbl_ns_type_names[type]); + return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); } char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index 9dde82b0beaf..7565ba6f90d5 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -221,15 +221,14 @@ void acpi_ut_subsystem_shutdown(void) /* Just exit if subsystem is already shutdown */ if (acpi_gbl_shutdown) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "ACPI Subsystem is already terminated\n")); + ACPI_REPORT_ERROR(("ACPI Subsystem is already terminated\n")); return_VOID; } /* Subsystem appears active, go ahead and shut it down */ acpi_gbl_shutdown = TRUE; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); /* Close the acpi_event Handling */ diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 68a0a6f94129..06214201329d 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -82,7 +82,7 @@ acpi_ut_short_divide(acpi_integer dividend, /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -144,7 +144,7 @@ acpi_ut_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -266,7 +266,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } @@ -292,7 +292,7 @@ acpi_ut_divide(acpi_integer in_dividend, /* Always check for a zero divisor */ if (in_divisor == 0) { - ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); + ACPI_REPORT_ERROR(("Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 48d511d5c04b..a77ffcd5570f 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -841,7 +841,6 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * * RETURN: None * @@ -849,10 +848,10 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) * ******************************************************************************/ -void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) +void acpi_ut_report_error(char *module_name, u32 line_number) { - acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); + acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); } /******************************************************************************* @@ -861,7 +860,6 @@ void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * * RETURN: None * @@ -869,11 +867,10 @@ void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) * ******************************************************************************/ -void -acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) +void acpi_ut_report_warning(char *module_name, u32 line_number) { - acpi_os_printf("%8s-%04d: *** Warning: ", module_name, line_number); + acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); } /******************************************************************************* @@ -882,7 +879,6 @@ acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) * * PARAMETERS: module_name - Caller's module name (for error output) * line_number - Caller's line number (for error output) - * component_id - Caller's component ID (for error output) * * RETURN: None * @@ -890,8 +886,8 @@ acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) * ******************************************************************************/ -void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id) +void acpi_ut_report_info(char *module_name, u32 line_number) { - acpi_os_printf("%8s-%04d: *** Info: ", module_name, line_number); + acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); } diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index e158b1b6313b..ffaff55270b1 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -216,21 +216,12 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) for (i = mutex_id; i < MAX_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Mutex [%s] already acquired by this thread [%X]\n", - acpi_ut_get_mutex_name - (mutex_id), - this_thread_id)); + ACPI_REPORT_ERROR(("Mutex [%s] already acquired by this thread [%X]\n", acpi_ut_get_mutex_name(mutex_id), this_thread_id)); return (AE_ALREADY_ACQUIRED); } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", - this_thread_id, - acpi_ut_get_mutex_name(i), - acpi_ut_get_mutex_name - (mutex_id))); + ACPI_REPORT_ERROR(("Invalid acquire order: Thread %X owns [%s], wants [%s]\n", this_thread_id, acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); return (AE_ACQUIRE_DEADLOCK); } @@ -253,11 +244,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_gbl_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Thread %X could not acquire Mutex [%s] %s\n", - this_thread_id, - acpi_ut_get_mutex_name(mutex_id), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Thread %X could not acquire Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); } return (status); @@ -295,9 +282,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) * Mutex must be acquired in order to release it! */ if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Mutex [%s] is not acquired, cannot release\n", - acpi_ut_get_mutex_name(mutex_id))); + ACPI_REPORT_ERROR(("Mutex [%X] is not acquired, cannot release\n", mutex_id)); return (AE_NOT_ACQUIRED); } @@ -318,11 +303,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) continue; } - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid release order: owns [%s], releasing [%s]\n", - acpi_ut_get_mutex_name(i), - acpi_ut_get_mutex_name - (mutex_id))); + ACPI_REPORT_ERROR(("Invalid release order: owns [%s], releasing [%s]\n", acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); return (AE_RELEASE_DEADLOCK); } @@ -338,11 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Thread %X could not release Mutex [%s] %s\n", - this_thread_id, - acpi_ut_get_mutex_name(mutex_id), - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("Thread %X could not release Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); } else { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 3015e1540053..1b6b21577805 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -177,7 +177,8 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) buffer = ACPI_MEM_CALLOCATE(buffer_size); if (!buffer) { - ACPI_REPORT_ERROR(("create_buffer: could not allocate size %X\n", (u32) buffer_size)); + ACPI_REPORT_ERROR(("Could not allocate size %X\n", + (u32) buffer_size)); acpi_ut_remove_reference(buffer_desc); return_PTR(NULL); } @@ -228,7 +229,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) */ string = ACPI_MEM_CALLOCATE(string_size + 1); if (!string) { - ACPI_REPORT_ERROR(("create_string: could not allocate size %X\n", (u32) string_size)); + ACPI_REPORT_ERROR(("Could not allocate size %X\n", + (u32) string_size)); acpi_ut_remove_reference(string_desc); return_PTR(NULL); } @@ -310,7 +312,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, object = acpi_os_acquire_object(acpi_gbl_operand_cache); if (!object) { - _ACPI_REPORT_ERROR(module_name, line_number, component_id, + _ACPI_REPORT_ERROR(module_name, line_number, ("Could not allocate an object descriptor\n")); return_PTR(NULL); @@ -345,9 +347,9 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object) /* Object must be an union acpi_operand_object */ if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "%p is not an ACPI Operand object [%s]\n", - object, acpi_ut_get_descriptor_name(object))); + ACPI_REPORT_ERROR(("%p is not an ACPI Operand object [%s]\n", + object, + acpi_ut_get_descriptor_name(object))); return_VOID; } @@ -449,10 +451,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, * Notably, Locals and Args are not supported, but this may be * required eventually. */ - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported Reference opcode=%X in object %p\n", - internal_object->reference.opcode, - internal_object)); + ACPI_REPORT_ERROR(("Unsupported Reference opcode=%X in object %p\n", internal_object->reference.opcode, internal_object)); status = AE_TYPE; break; } @@ -460,10 +459,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unsupported type=%X in object %p\n", - ACPI_GET_OBJECT_TYPE(internal_object), - internal_object)); + ACPI_REPORT_ERROR(("Unsupported type=%X in object %p\n", + ACPI_GET_OBJECT_TYPE(internal_object), + internal_object)); status = AE_TYPE; break; } diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index eaf0edec6efe..36bf9e4bf529 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 6ff1d7073349..4b134a722907 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 57adc5bc02f3..b4bc94883200 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ acpi_status acpi_initialize_subsystem(void) status = acpi_os_initialize(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n", + ACPI_REPORT_ERROR(("OSL failed to initialize, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -154,8 +154,7 @@ acpi_status acpi_enable_subsystem(u32 flags) status = acpi_enable(); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "acpi_enable failed.\n")); + ACPI_REPORT_WARNING(("acpi_enable failed\n")); return_ACPI_STATUS(status); } } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 1f2477eb95fe..675a32f78329 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20051216 +#define ACPI_CA_VERSION 0x20060113 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index 70ce3b4d006e..d8167095caf3 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 0a8f49f5d2f1..11a8fe39cb04 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index cc6407eef701..c41a926ff317 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index b40062c3ba7a..f2717be4fe0d 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 4f005eb65928..dc768aa580e4 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index dfb3b2493ae5..734cc77bf2c7 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/achware.h b/include/acpi/achware.h index 3644d7248e7e..29b60a8c0593 100644 --- a/include/acpi/achware.h +++ b/include/acpi/achware.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 87e5e44572ca..9f22cfcb624b 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index da7f1cb96f5d..97f8e4185e4f 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 0fa8f72dbace..49ba151766de 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -443,56 +443,66 @@ #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) /* - * Reporting macros that are never compiled out + * Module name is include in both debug and non-debug versions primarily for + * error messages. The __FILE__ macro is not very useful for this, because it + * often includes the entire pathname to the module */ -#define ACPI_PARAM_LIST(pl) pl +#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) + +#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; +#else +#define ACPI_MODULE_NAME(name) +#endif /* - * Error reporting. These versions add callers module and line#. - * - * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT - * isn't defined, only use it in debug mode. + * Ascii error messages can be configured out */ -#ifdef ACPI_DEBUG_OUTPUT +#ifndef ACPI_NO_ERROR_MESSAGES + +#define ACPI_PARAM_LIST(pl) pl +#define ACPI_LOCATION_INFO _acpi_module_name, __LINE__ -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e); +/* + * Error reporting. Callers module and line number are inserted automatically + * These macros are used for both the debug and non-debug versions of the code + */ +#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info (ACPI_LOCATION_INFO); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error (ACPI_LOCATION_INFO); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning (ACPI_LOCATION_INFO); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error (ACPI_LOCATION_INFO, \ + s, e); +#define ACPI_REPORT_MTERROR(s,n,p,e) acpi_ns_report_method_error (ACPI_LOCATION_INFO, \ + s, n, p, e); -#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e); +/* Error reporting. These versions pass thru the module and lineno */ +#define _ACPI_REPORT_INFO(a,b,fp) {acpi_ut_report_info (a,b); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define _ACPI_REPORT_ERROR(a,b,fp) {acpi_ut_report_error (a,b); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} +#define _ACPI_REPORT_WARNING(a,b,fp) {acpi_ut_report_warning (a,b); \ + acpi_os_printf ACPI_PARAM_LIST (fp);} #else -#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e); - -#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e); +/* No error messages */ +#define ACPI_REPORT_INFO(fp) +#define ACPI_REPORT_ERROR(fp) +#define ACPI_REPORT_WARNING(fp) +#define ACPI_REPORT_NSERROR(s,e) +#define ACPI_REPORT_MTERROR(s,n,p,e) +#define _ACPI_REPORT_INFO(a,b,c,fp) +#define _ACPI_REPORT_ERROR(a,b,c,fp) +#define _ACPI_REPORT_WARNING(a,b,c,fp) #endif -/* Error reporting. These versions pass thru the module and line# */ - -#define _ACPI_REPORT_INFO(a,b,c,fp) {acpi_ut_report_info(a,b,c); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define _ACPI_REPORT_ERROR(a,b,c,fp) {acpi_ut_report_error(a,b,c); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} -#define _ACPI_REPORT_WARNING(a,b,c,fp) {acpi_ut_report_warning(a,b,c); \ - acpi_os_printf ACPI_PARAM_LIST(fp);} - /* * Debug macros that are conditionally compiled */ #ifdef ACPI_DEBUG_OUTPUT -#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; /* * Common parameters used for debug output functions: @@ -649,9 +659,6 @@ * This is the non-debug case -- make everything go away, * leaving no executable debug code! */ -#define ACPI_MODULE_NAME(name) -#define _acpi_module_name "" - #define ACPI_DEBUG_EXEC(a) #define ACPI_NORMAL_EXEC(a) a; diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 4f9063f3e951..b67da3636899 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index dd3501f7e5d6..b667a804fc8a 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -263,13 +263,11 @@ u32 acpi_ns_local(acpi_object_type type); void acpi_ns_report_error(char *module_name, u32 line_number, - u32 component_id, char *internal_name, acpi_status lookup_status); void acpi_ns_report_method_error(char *module_name, u32 line_number, - u32 component_id, char *message, struct acpi_namespace_node *node, char *path, acpi_status lookup_status); diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index 4a326ba6d482..1bd411962c77 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index 64da42992199..e6d78bd9e90a 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 68d7edf0f697..7785d481dc3e 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -137,13 +137,19 @@ /* Exception level -- used in the global "debug_level" */ -#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) -#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) +/* + * These two levels are essentially obsolete, all instances in the + * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING + * (Kept here because some drivers may still use them) + */ +#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) +#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) + /* Trace level -- also used in the global "debug_level" */ #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index d352d40de1f3..5a1ff484af33 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index ccf34f9dac64..b9a39d1009bd 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 58473f60755f..768f63f391cd 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -8,7 +8,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 2a88429bc4ec..66cf2ecef57a 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index ba281f7740a0..fa02e8083381 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index 99d235339801..d8c1c2cdac0c 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actables.h b/include/acpi/actables.h index f92c1858b808..30a47542e1c8 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index ef2ddcadfe61..ed53f842dad4 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 67312c3a915a..cd428d57add0 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 50305ce2681a..dfc7ac1094bb 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 18e1338c5c7f..74819e9b4699 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 5fa21e03a62f..10f6625f6390 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -275,12 +275,11 @@ acpi_ut_ptr_exit(u32 line_number, const char *function_name, char *module_name, u32 component_id, u8 * ptr); -void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id); +void acpi_ut_report_error(char *module_name, u32 line_number); -void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id); +void acpi_ut_report_info(char *module_name, u32 line_number); -void -acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id); +void acpi_ut_report_warning(char *module_name, u32 line_number); void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 7fdf5299f501..37964a59aef8 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index 2e3382c1e5e3..fb4735315ad3 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 53aa997f05fc..31b0f18342f6 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index 4c0e0ba09ba0..ea2a6322f64d 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 1b9cbf05b79e..c21c27fe7e1e 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without -- cgit v1.2.3