From b5ff5cf6cc0f2e7ada13137c3e5662a3a03dfab0 Mon Sep 17 00:00:00 2001 From: Thomas Rosner Date: Fri, 6 Jan 2006 01:31:00 -0500 Subject: [PATCH] --- yaml --- r: 19512 b: refs/heads/master c: 876c184b31dc73cc3f38c5b86dee55d091a56769 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/i386/kernel/acpi/boot.c | 6 +- trunk/arch/i386/kernel/mpparse.c | 8 +- trunk/arch/ia64/kernel/acpi-ext.c | 22 +- trunk/arch/ia64/kernel/acpi.c | 6 +- trunk/arch/ia64/pci/pci.c | 10 +- trunk/arch/x86_64/kernel/io_apic.c | 10 +- trunk/arch/x86_64/kernel/mpparse.c | 8 +- trunk/drivers/acpi/acpi_memhotplug.c | 17 +- trunk/drivers/acpi/dispatcher/dsfield.c | 9 +- trunk/drivers/acpi/dispatcher/dsinit.c | 45 +- trunk/drivers/acpi/dispatcher/dsmethod.c | 354 +++--- trunk/drivers/acpi/dispatcher/dsmthdat.c | 28 +- trunk/drivers/acpi/dispatcher/dsobject.c | 102 +- trunk/drivers/acpi/dispatcher/dsopcode.c | 41 +- trunk/drivers/acpi/dispatcher/dsutils.c | 30 +- trunk/drivers/acpi/dispatcher/dswexec.c | 69 +- trunk/drivers/acpi/dispatcher/dswload.c | 244 ++-- trunk/drivers/acpi/dispatcher/dswscope.c | 6 +- trunk/drivers/acpi/dispatcher/dswstate.c | 106 +- trunk/drivers/acpi/ec.c | 4 +- trunk/drivers/acpi/events/evevent.c | 46 +- trunk/drivers/acpi/events/evgpe.c | 38 +- trunk/drivers/acpi/events/evgpeblk.c | 189 ++- trunk/drivers/acpi/events/evmisc.c | 12 +- trunk/drivers/acpi/events/evregion.c | 45 +- trunk/drivers/acpi/events/evrgnini.c | 2 +- trunk/drivers/acpi/events/evsci.c | 6 +- trunk/drivers/acpi/events/evxface.c | 17 +- trunk/drivers/acpi/events/evxfevnt.c | 30 +- trunk/drivers/acpi/events/evxfregn.c | 2 +- trunk/drivers/acpi/executer/exconfig.c | 6 +- trunk/drivers/acpi/executer/exconvrt.c | 27 +- trunk/drivers/acpi/executer/excreate.c | 2 +- trunk/drivers/acpi/executer/exdump.c | 671 ++++------- trunk/drivers/acpi/executer/exfield.c | 2 +- trunk/drivers/acpi/executer/exfldio.c | 60 +- trunk/drivers/acpi/executer/exmisc.c | 100 +- trunk/drivers/acpi/executer/exmutex.c | 2 +- trunk/drivers/acpi/executer/exnames.c | 22 +- trunk/drivers/acpi/executer/exoparg1.c | 59 +- trunk/drivers/acpi/executer/exoparg2.c | 38 +- trunk/drivers/acpi/executer/exoparg3.c | 12 +- trunk/drivers/acpi/executer/exoparg6.c | 13 +- trunk/drivers/acpi/executer/exprep.c | 15 +- trunk/drivers/acpi/executer/exregion.c | 32 +- trunk/drivers/acpi/executer/exresnte.c | 50 +- trunk/drivers/acpi/executer/exresolv.c | 28 +- trunk/drivers/acpi/executer/exresop.c | 91 +- trunk/drivers/acpi/executer/exstore.c | 19 +- trunk/drivers/acpi/executer/exstoren.c | 13 +- trunk/drivers/acpi/executer/exstorob.c | 6 +- trunk/drivers/acpi/executer/exsystem.c | 4 +- trunk/drivers/acpi/executer/exutils.c | 12 +- trunk/drivers/acpi/glue.c | 8 +- trunk/drivers/acpi/hardware/hwacpi.c | 15 +- trunk/drivers/acpi/hardware/hwgpe.c | 2 +- trunk/drivers/acpi/hardware/hwregs.c | 32 +- trunk/drivers/acpi/hardware/hwsleep.c | 2 +- trunk/drivers/acpi/hardware/hwtimer.c | 2 +- trunk/drivers/acpi/motherboard.c | 30 +- trunk/drivers/acpi/namespace/nsaccess.c | 20 +- trunk/drivers/acpi/namespace/nsalloc.c | 7 +- trunk/drivers/acpi/namespace/nsdump.c | 9 +- trunk/drivers/acpi/namespace/nsdumpdv.c | 2 +- trunk/drivers/acpi/namespace/nseval.c | 5 +- trunk/drivers/acpi/namespace/nsinit.c | 103 +- trunk/drivers/acpi/namespace/nsload.c | 6 +- trunk/drivers/acpi/namespace/nsnames.c | 12 +- trunk/drivers/acpi/namespace/nsobject.c | 10 +- trunk/drivers/acpi/namespace/nsparse.c | 2 +- trunk/drivers/acpi/namespace/nssearch.c | 28 +- trunk/drivers/acpi/namespace/nsutils.c | 41 +- trunk/drivers/acpi/namespace/nswalk.c | 2 +- trunk/drivers/acpi/namespace/nsxfeval.c | 27 +- trunk/drivers/acpi/namespace/nsxfname.c | 2 +- trunk/drivers/acpi/namespace/nsxfobj.c | 2 +- trunk/drivers/acpi/osl.c | 8 +- trunk/drivers/acpi/parser/psargs.c | 352 +++--- trunk/drivers/acpi/parser/psloop.c | 32 +- trunk/drivers/acpi/parser/psopcode.c | 4 +- trunk/drivers/acpi/parser/psparse.c | 54 +- trunk/drivers/acpi/parser/psscope.c | 2 +- trunk/drivers/acpi/parser/pstree.c | 5 +- trunk/drivers/acpi/parser/psutils.c | 2 +- trunk/drivers/acpi/parser/pswalk.c | 2 +- trunk/drivers/acpi/parser/psxface.c | 144 +-- trunk/drivers/acpi/pci_irq.c | 48 +- trunk/drivers/acpi/pci_link.c | 100 +- trunk/drivers/acpi/pci_root.c | 8 +- trunk/drivers/acpi/processor_idle.c | 67 +- trunk/drivers/acpi/resources/Makefile | 2 +- trunk/drivers/acpi/resources/rsaddr.c | 1164 ++++++++++++++---- trunk/drivers/acpi/resources/rscalc.c | 817 ++++++++----- trunk/drivers/acpi/resources/rscreate.c | 101 +- trunk/drivers/acpi/resources/rsdump.c | 1395 ++++++++++++++-------- trunk/drivers/acpi/resources/rsinfo.c | 204 ---- trunk/drivers/acpi/resources/rsio.c | 544 ++++++--- trunk/drivers/acpi/resources/rsirq.c | 568 +++++++-- trunk/drivers/acpi/resources/rslist.c | 528 ++++++-- trunk/drivers/acpi/resources/rsmemory.c | 517 ++++++-- trunk/drivers/acpi/resources/rsmisc.c | 856 +++++++------ trunk/drivers/acpi/resources/rsutils.c | 390 +----- trunk/drivers/acpi/resources/rsxface.c | 230 +--- trunk/drivers/acpi/scan.c | 2 +- trunk/drivers/acpi/tables/tbconvrt.c | 6 +- trunk/drivers/acpi/tables/tbget.c | 6 +- trunk/drivers/acpi/tables/tbgetall.c | 6 +- trunk/drivers/acpi/tables/tbinstal.c | 2 +- trunk/drivers/acpi/tables/tbrsdt.c | 20 +- trunk/drivers/acpi/tables/tbutils.c | 35 +- trunk/drivers/acpi/tables/tbxface.c | 17 +- trunk/drivers/acpi/tables/tbxfroot.c | 24 +- trunk/drivers/acpi/utilities/Makefile | 5 +- trunk/drivers/acpi/utilities/utalloc.c | 42 +- trunk/drivers/acpi/utilities/utcache.c | 2 +- trunk/drivers/acpi/utilities/utcopy.c | 26 +- trunk/drivers/acpi/utilities/utdebug.c | 2 +- trunk/drivers/acpi/utilities/utdelete.c | 9 +- trunk/drivers/acpi/utilities/uteval.c | 42 +- trunk/drivers/acpi/utilities/utglobal.c | 108 +- trunk/drivers/acpi/utilities/utinit.c | 7 +- trunk/drivers/acpi/utilities/utmath.c | 10 +- trunk/drivers/acpi/utilities/utmisc.c | 147 +-- trunk/drivers/acpi/utilities/utmutex.c | 41 +- trunk/drivers/acpi/utilities/utobject.c | 28 +- trunk/drivers/acpi/utilities/utresrc.c | 538 --------- trunk/drivers/acpi/utilities/utstate.c | 4 +- trunk/drivers/acpi/utilities/utxface.c | 59 +- trunk/drivers/char/hpet.c | 26 +- trunk/drivers/pnp/pnpacpi/rsparser.c | 547 ++++----- trunk/drivers/serial/8250_acpi.c | 22 +- trunk/include/acpi/acconfig.h | 22 +- trunk/include/acpi/acdebug.h | 2 +- trunk/include/acpi/acdisasm.h | 81 +- trunk/include/acpi/acdispat.h | 5 +- trunk/include/acpi/acevents.h | 8 +- trunk/include/acpi/acexcep.h | 2 +- trunk/include/acpi/acglobal.h | 23 +- trunk/include/acpi/achware.h | 2 +- trunk/include/acpi/acinterp.h | 48 +- trunk/include/acpi/aclocal.h | 103 +- trunk/include/acpi/acmacros.h | 190 +-- trunk/include/acpi/acnames.h | 2 +- trunk/include/acpi/acnamesp.h | 4 +- trunk/include/acpi/acobject.h | 2 +- trunk/include/acpi/acopcode.h | 2 +- trunk/include/acpi/acoutput.h | 12 +- trunk/include/acpi/acparser.h | 2 +- trunk/include/acpi/acpi.h | 2 +- trunk/include/acpi/acpi_drivers.h | 4 +- trunk/include/acpi/acpiosxf.h | 6 +- trunk/include/acpi/acpixf.h | 13 +- trunk/include/acpi/acresrc.h | 390 +++--- trunk/include/acpi/acstruct.h | 2 +- trunk/include/acpi/actables.h | 2 +- trunk/include/acpi/actbl.h | 8 +- trunk/include/acpi/actbl1.h | 2 +- trunk/include/acpi/actbl2.h | 2 +- trunk/include/acpi/actypes.h | 590 ++++----- trunk/include/acpi/acutils.h | 57 +- trunk/include/acpi/amlcode.h | 2 +- trunk/include/acpi/amlresrc.h | 271 ++--- trunk/include/acpi/platform/acenv.h | 14 +- trunk/include/acpi/platform/acgcc.h | 2 +- trunk/include/acpi/platform/aclinux.h | 6 +- trunk/include/asm-x86_64/mpspec.h | 2 +- trunk/include/linux/acpi.h | 2 +- 168 files changed, 7701 insertions(+), 7280 deletions(-) delete mode 100644 trunk/drivers/acpi/resources/rsinfo.c delete mode 100644 trunk/drivers/acpi/utilities/utresrc.c diff --git a/[refs] b/[refs] index c2c7c744ab80..fa0e8bfbb41e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d4ec6c7cc9a15a7a529719bc3b84f46812f9842e +refs/heads/master: 876c184b31dc73cc3f38c5b86dee55d091a56769 diff --git a/trunk/arch/i386/kernel/acpi/boot.c b/trunk/arch/i386/kernel/acpi/boot.c index 1f378df14f34..447fa9e33ffb 100644 --- a/trunk/arch/i386/kernel/acpi/boot.c +++ b/trunk/arch/i386/kernel/acpi/boot.c @@ -464,7 +464,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) * success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi(u32 gsi, int triggering, int polarity) +int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) { unsigned int irq; unsigned int plat_gsi = gsi; @@ -476,14 +476,14 @@ int acpi_register_gsi(u32 gsi, int triggering, int polarity) if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { extern void eisa_set_level_irq(unsigned int irq); - if (triggering == ACPI_LEVEL_SENSITIVE) + if (edge_level == ACPI_LEVEL_SENSITIVE) eisa_set_level_irq(gsi); } #endif #ifdef CONFIG_X86_IO_APIC if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { - plat_gsi = mp_register_gsi(gsi, triggering, polarity); + plat_gsi = mp_register_gsi(gsi, edge_level, active_high_low); } #endif acpi_gsi_to_irq(plat_gsi, &irq); diff --git a/trunk/arch/i386/kernel/mpparse.c b/trunk/arch/i386/kernel/mpparse.c index 0102f3d50e57..91a64016956e 100644 --- a/trunk/arch/i386/kernel/mpparse.c +++ b/trunk/arch/i386/kernel/mpparse.c @@ -1080,7 +1080,7 @@ void __init mp_config_acpi_legacy_irqs (void) #define MAX_GSI_NUM 4096 -int mp_register_gsi (u32 gsi, int triggering, int polarity) +int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) { int ioapic = -1; int ioapic_pin = 0; @@ -1129,7 +1129,7 @@ int mp_register_gsi (u32 gsi, int triggering, int polarity) mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<type != ACPI_RESOURCE_TYPE_VENDOR) + if (resource->id != ACPI_RSTYPE_VENDOR) return AE_OK; vendor = (struct acpi_resource_vendor *)&resource->data; - descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data; - if (vendor->byte_length <= sizeof(*info->descriptor) || + descriptor = (struct acpi_vendor_descriptor *)vendor->reserved; + if (vendor->length <= sizeof(*info->descriptor) || descriptor->guid_id != info->descriptor->guid_id || efi_guidcmp(descriptor->guid, info->descriptor->guid)) return AE_OK; - byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor); - info->data = acpi_os_allocate(byte_length); + length = vendor->length - sizeof(struct acpi_vendor_descriptor); + info->data = acpi_os_allocate(length); if (!info->data) return AE_NO_MEMORY; memcpy(info->data, - vendor->byte_data + sizeof(struct acpi_vendor_descriptor), - byte_length); - info->length = byte_length; + vendor->reserved + sizeof(struct acpi_vendor_descriptor), + length); + info->length = length; return AE_CTRL_TERMINATE; } acpi_status acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, - u8 ** data, u32 * byte_length) + u8 ** data, u32 * 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; - *byte_length = info.length; + *length = info.length; return AE_OK; } diff --git a/trunk/arch/ia64/kernel/acpi.c b/trunk/arch/ia64/kernel/acpi.c index d2702c419cf8..9ad94ddf6687 100644 --- a/trunk/arch/ia64/kernel/acpi.c +++ b/trunk/arch/ia64/kernel/acpi.c @@ -567,16 +567,16 @@ void __init acpi_numa_arch_fixup(void) * success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi(u32 gsi, int triggering, int polarity) +int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) { if (has_8259 && gsi < 16) return isa_irq_to_vector(gsi); return iosapic_register_intr(gsi, - (polarity == + (active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, - (triggering == + (edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); } diff --git a/trunk/arch/ia64/pci/pci.c b/trunk/arch/ia64/pci/pci.c index 337abd50c6ea..30dbc98bf0b3 100644 --- a/trunk/arch/ia64/pci/pci.c +++ b/trunk/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->minimum; + min = addr->min_address_range; max = min + addr->address_length - 1; - if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION) + if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) sparse = 1; - space_nr = new_space(addr->translation_offset, sparse); + space_nr = new_space(addr->address_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.translation_offset; + offset = addr.address_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.minimum + offset; + window->resource.start = addr.min_address_range + offset; window->resource.end = window->resource.start + addr.address_length - 1; window->resource.child = NULL; window->offset = offset; diff --git a/trunk/arch/x86_64/kernel/io_apic.c b/trunk/arch/x86_64/kernel/io_apic.c index 619767d3ea2b..97154ab058b4 100644 --- a/trunk/arch/x86_64/kernel/io_apic.c +++ b/trunk/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 triggering, int polarity) +int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) { 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 triggering, int p 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 = triggering; - entry.polarity = polarity; + entry.trigger = edge_level; + entry.polarity = active_high_low; 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 triggering, int p 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, - triggering, polarity); + edge_level, active_high_low); - ioapic_register_intr(irq, entry.vector, triggering); + ioapic_register_intr(irq, entry.vector, edge_level); if (!ioapic && (irq < 16)) disable_8259A_irq(irq); diff --git a/trunk/arch/x86_64/kernel/mpparse.c b/trunk/arch/x86_64/kernel/mpparse.c index dc49bfb6db0a..1105250bf02c 100644 --- a/trunk/arch/x86_64/kernel/mpparse.c +++ b/trunk/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 triggering, int polarity) +int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) { int ioapic = -1; int ioapic_pin = 0; @@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity) mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<caching = - address64.info.mem.caching; - mem_device->write_protect = - address64.info.mem.write_protect; - mem_device->start_addr = address64.minimum; - mem_device->end_addr = address64.maximum; + mem_device->cache_attribute = + address64.attribute.memory.cache_attribute; + mem_device->read_write_attribute = + address64.attribute.memory.read_write_attribute; + mem_device->start_addr = address64.min_address_range; + mem_device->end_addr = address64.max_address_range; } } @@ -250,6 +250,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) int result; u64 start = mem_device->start_addr; u64 len = mem_device->end_addr - start + 1; + unsigned long attr = mem_device->read_write_attribute; ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); diff --git a/trunk/drivers/acpi/dispatcher/dsfield.c b/trunk/drivers/acpi/dispatcher/dsfield.c index f3a008ff1eae..2022aeaecfbb 100644 --- a/trunk/drivers/acpi/dispatcher/dsfield.c +++ b/trunk/drivers/acpi/dispatcher/dsfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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", ACPI_CAST_PTR(char, &info->field_node->name))); + ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name)); return_ACPI_STATUS(AE_SUPPORT); } @@ -302,8 +302,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, default: - ACPI_REPORT_ERROR(("Invalid opcode in field list: %X\n", - arg->common.aml_opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid opcode in field list: %X\n", + arg->common.aml_opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } diff --git a/trunk/drivers/acpi/dispatcher/dsinit.c b/trunk/drivers/acpi/dispatcher/dsinit.c index 258fbdfaa69c..8693c704aea6 100644 --- a/trunk/drivers/acpi/dispatcher/dsinit.c +++ b/trunk/drivers/acpi/dispatcher/dsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_ENTRY(); + ACPI_FUNCTION_NAME("ds_init_one_object"); /* * We are only interested in NS nodes owned by the table that @@ -105,7 +105,11 @@ acpi_ds_init_one_object(acpi_handle obj_handle, status = acpi_ds_initialize_region(obj_handle); if (ACPI_FAILURE(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))); + 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))); } info->op_region_count++; @@ -113,6 +117,14 @@ acpi_ds_init_one_object(acpi_handle obj_handle, case ACPI_TYPE_METHOD: + /* + * Print a dot for each method unless we are going to print + * the entire pathname + */ + if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { + ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); + } + /* * Set the execution data width (32 or 64) based upon the * revision number of the parent ACPI table. @@ -122,21 +134,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle, if (info->table_desc->pointer->revision == 1) { node->flags |= ANOBJ_DATA_WIDTH_32; } -#ifdef ACPI_INIT_PARSE_METHODS - /* - * Note 11/2005: Removed this code to parse all methods during table - * load because it causes problems if there are any errors during the - * parse. Also, it seems like overkill and we probably don't want to - * abort a table load because of an issue with a single method. - */ - - /* - * Print a dot for each method unless we are going to print - * the entire pathname - */ - if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); - } /* * Always parse methods to detect errors, we will delete @@ -144,11 +141,15 @@ acpi_ds_init_one_object(acpi_handle obj_handle, */ status = acpi_ds_parse_method(obj_handle); if (ACPI_FAILURE(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))); + 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))); /* This parse failed, but we will continue parsing more methods */ } -#endif + info->method_count++; break; @@ -206,8 +207,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_REPORT_ERROR(("walk_namespace failed, %s\n", - acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, diff --git a/trunk/drivers/acpi/dispatcher/dsmethod.c b/trunk/drivers/acpi/dispatcher/dsmethod.c index d861add3fc1f..36c1ca0b9adb 100644 --- a/trunk/drivers/acpi/dispatcher/dsmethod.c +++ b/trunk/drivers/acpi/dispatcher/dsmethod.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,66 +47,135 @@ #include #include #include -#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsmethod") /******************************************************************************* * - * FUNCTION: acpi_ds_method_error + * FUNCTION: acpi_ds_parse_method * - * PARAMETERS: Status - Execution status - * walk_state - Current state + * PARAMETERS: Node - Method node * * RETURN: Status * - * DESCRIPTION: Called on method error. Invoke the global exception handler if - * present, dump the method data if the disassembler is configured + * DESCRIPTION: Parse the AML that is associated with the method. * - * Note: Allows the exception handler to change the status code + * MUTEX: Assumes parser is locked * ******************************************************************************/ -acpi_status -acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) +acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) { - ACPI_FUNCTION_ENTRY(); + acpi_status status; + union acpi_operand_object *obj_desc; + union acpi_parse_object *op; + struct acpi_walk_state *walk_state; + + ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); - /* Ignore AE_OK and control exception codes */ + /* Parameter Validation */ - if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) { - return (status); + if (!node) { + return_ACPI_STATUS(AE_NULL_ENTRY); } - /* Invoke the global exception handler */ + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** Parsing [%4.4s] **** named_obj=%p\n", + acpi_ut_get_node_name(node), node)); + + /* Extract the method object from the method Node */ - if (acpi_gbl_exception_handler) { - /* Exit the interpreter, allow handler to execute methods */ + obj_desc = acpi_ns_get_attached_object(node); + if (!obj_desc) { + return_ACPI_STATUS(AE_NULL_OBJECT); + } - acpi_ex_exit_interpreter(); + /* Create a mutex for the method if there is a concurrency limit */ - /* - * Handler can map the exception code to anything it wants, including - * AE_OK, in which case the executing method will not be aborted. - */ - status = acpi_gbl_exception_handler(status, - walk_state->method_node ? - walk_state->method_node-> - name.integer : 0, - walk_state->opcode, - walk_state->aml_offset, - NULL); - (void)acpi_ex_enter_interpreter(); + if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && + (!obj_desc->method.semaphore)) { + status = acpi_os_create_semaphore(obj_desc->method.concurrency, + obj_desc->method.concurrency, + &obj_desc->method.semaphore); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } + + /* + * Allocate a new parser op to be the root of the parsed + * method tree + */ + op = acpi_ps_alloc_op(AML_METHOD_OP); + if (!op) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + /* Init new op with the method name and pointer back to the Node */ + + acpi_ps_set_name(op, node->name.integer); + op->common.node = node; + + /* + * Get a new owner_id for objects created by this method. Namespace + * objects (such as Operation Regions) can be created during the + * first pass parse. + */ + status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); + if (ACPI_FAILURE(status)) { + goto cleanup; + } + + /* Create and initialize a new walk state */ + + walk_state = + acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, + NULL); + if (!walk_state) { + status = AE_NO_MEMORY; + goto cleanup2; } -#ifdef ACPI_DISASSEMBLER + + status = acpi_ds_init_aml_walk(walk_state, op, node, + obj_desc->method.aml_start, + obj_desc->method.aml_length, NULL, 1); if (ACPI_FAILURE(status)) { - /* Display method locals/args if disassembler is present */ + acpi_ds_delete_walk_state(walk_state); + goto cleanup2; + } - acpi_dm_dump_method_info(status, walk_state, walk_state->op); + /* + * Parse the method, first pass + * + * The first pass load is where newly declared named objects are added into + * the namespace. Actual evaluation of the named objects (what would be + * called a "second pass") happens during the actual execution of the + * method so that operands to the named objects can take on dynamic + * run-time values. + */ + status = acpi_ps_parse_aml(walk_state); + if (ACPI_FAILURE(status)) { + goto cleanup2; } -#endif - return (status); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", + acpi_ut_get_node_name(node), node, op)); + + /* + * Delete the parse tree. We simply re-parse the method for every + * execution since there isn't much overhead (compared to keeping lots + * of parse trees around) + */ + acpi_ns_delete_namespace_subtree(node); + acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); + + cleanup2: + acpi_ut_release_owner_id(&obj_desc->method.owner_id); + + cleanup: + acpi_ps_delete_parse_tree(op); + return_ACPI_STATUS(status); } /******************************************************************************* @@ -126,9 +195,9 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) ******************************************************************************/ acpi_status -acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, - union acpi_operand_object * obj_desc, - struct acpi_namespace_node * calling_method_node) +acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_namespace_node *calling_method_node) { acpi_status status = AE_OK; @@ -476,54 +545,16 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) } } - /* - * There are no more threads executing this method. Perform - * additional cleanup. - * - * The method Node is stored in the walk state - */ - method_node = walk_state->method_node; - - /* Lock namespace for possible update */ - - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* - * Delete any namespace entries created immediately underneath - * the method - */ - if (method_node->child) { - acpi_ns_delete_namespace_subtree(method_node); - } - - /* - * Delete any namespace entries created anywhere else within - * the namespace by the execution of this method - */ - acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. - owner_id); - status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - - /* Are there any other threads currently executing this method? */ - if (walk_state->method_desc->method.thread_count) { - /* - * Additional threads. Do not release the owner_id in this case, - * we immediately reuse it for the next thread executing this method - */ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "*** Completed execution of one thread, %d threads remaining\n", + "*** Not deleting method namespace, there are still %d threads\n", walk_state->method_desc->method. thread_count)); - } else { - /* This is the only executing thread for this method */ + } else { /* This is the last executing thread */ /* * Support to dynamically change a method from not_serialized to - * Serialized if it appears that the method is incorrectly written and + * Serialized if it appears that the method is written foolishly and * does not support multiple thread execution. The best example of this * is if such a method creates namespace objects and blocks. A second * thread will fail with an AE_ALREADY_EXISTS exception @@ -539,8 +570,34 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) semaphore); } - /* No more threads, we can free the owner_id */ + /* + * There are no more threads executing this method. Perform + * additional cleanup. + * + * The method Node is stored in the walk state + */ + method_node = walk_state->method_node; + + /* + * Delete any namespace entries created immediately underneath + * the method + */ + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto exit; + } + + if (method_node->child) { + acpi_ns_delete_namespace_subtree(method_node); + } + /* + * Delete any namespace entries created anywhere else within + * the namespace + */ + acpi_ns_delete_namespace_by_owner(walk_state->method_desc-> + method.owner_id); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); acpi_ut_release_owner_id(&walk_state->method_desc->method. owner_id); } @@ -549,140 +606,3 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); return_VOID; } - -#ifdef ACPI_INIT_PARSE_METHODS - /* - * Note 11/2005: Removed this code to parse all methods during table - * load because it causes problems if there are any errors during the - * parse. Also, it seems like overkill and we probably don't want to - * abort a table load because of an issue with a single method. - */ - -/******************************************************************************* - * - * FUNCTION: acpi_ds_parse_method - * - * PARAMETERS: Node - Method node - * - * RETURN: Status - * - * DESCRIPTION: Parse the AML that is associated with the method. - * - * MUTEX: Assumes parser is locked - * - ******************************************************************************/ - -acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) -{ - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - - ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); - - /* Parameter Validation */ - - if (!node) { - return_ACPI_STATUS(AE_NULL_ENTRY); - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** Parsing [%4.4s] **** named_obj=%p\n", - acpi_ut_get_node_name(node), node)); - - /* Extract the method object from the method Node */ - - obj_desc = acpi_ns_get_attached_object(node); - if (!obj_desc) { - return_ACPI_STATUS(AE_NULL_OBJECT); - } - - /* Create a mutex for the method if there is a concurrency limit */ - - if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && - (!obj_desc->method.semaphore)) { - status = acpi_os_create_semaphore(obj_desc->method.concurrency, - obj_desc->method.concurrency, - &obj_desc->method.semaphore); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } - - /* - * Allocate a new parser op to be the root of the parsed - * method tree - */ - op = acpi_ps_alloc_op(AML_METHOD_OP); - if (!op) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - /* Init new op with the method name and pointer back to the Node */ - - acpi_ps_set_name(op, node->name.integer); - op->common.node = node; - - /* - * Get a new owner_id for objects created by this method. Namespace - * objects (such as Operation Regions) can be created during the - * first pass parse. - */ - status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - goto cleanup; - } - - /* Create and initialize a new walk state */ - - walk_state = - acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, - NULL); - if (!walk_state) { - status = AE_NO_MEMORY; - goto cleanup2; - } - - status = acpi_ds_init_aml_walk(walk_state, op, node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, NULL, 1); - if (ACPI_FAILURE(status)) { - acpi_ds_delete_walk_state(walk_state); - goto cleanup2; - } - - /* - * Parse the method, first pass - * - * The first pass load is where newly declared named objects are added into - * the namespace. Actual evaluation of the named objects (what would be - * called a "second pass") happens during the actual execution of the - * method so that operands to the named objects can take on dynamic - * run-time values. - */ - status = acpi_ps_parse_aml(walk_state); - if (ACPI_FAILURE(status)) { - goto cleanup2; - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", - acpi_ut_get_node_name(node), node, op)); - - /* - * Delete the parse tree. We simply re-parse the method for every - * execution since there isn't much overhead (compared to keeping lots - * of parse trees around) - */ - acpi_ns_delete_namespace_subtree(node); - acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); - - cleanup2: - acpi_ut_release_owner_id(&obj_desc->method.owner_id); - - cleanup: - acpi_ps_delete_parse_tree(op); - return_ACPI_STATUS(status); -} -#endif diff --git a/trunk/drivers/acpi/dispatcher/dsmthdat.c b/trunk/drivers/acpi/dispatcher/dsmthdat.c index ce33c34f87c6..4095ce70982b 100644 --- a/trunk/drivers/acpi/dispatcher/dsmthdat.c +++ b/trunk/drivers/acpi/dispatcher/dsmthdat.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -260,7 +260,9 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_LOCAL_OP: if (index > ACPI_METHOD_MAX_LOCAL) { - ACPI_REPORT_ERROR(("Local index %d is invalid (max %d)\n", index, ACPI_METHOD_MAX_LOCAL)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Local index %d is invalid (max %d)\n", + index, ACPI_METHOD_MAX_LOCAL)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -272,8 +274,9 @@ acpi_ds_method_data_get_node(u16 opcode, case AML_ARG_OP: if (index > ACPI_METHOD_MAX_ARG) { - ACPI_REPORT_ERROR(("Arg index %d is invalid (max %d)\n", - index, ACPI_METHOD_MAX_ARG)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Arg index %d is invalid (max %d)\n", + index, ACPI_METHOD_MAX_ARG)); return_ACPI_STATUS(AE_AML_INVALID_INDEX); } @@ -283,7 +286,8 @@ acpi_ds_method_data_get_node(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Opcode %d is invalid\n", opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n", + opcode)); return_ACPI_STATUS(AE_AML_BAD_OPCODE); } @@ -374,7 +378,8 @@ acpi_ds_method_data_get_value(u16 opcode, /* Validate the object descriptor */ if (!dest_desc) { - ACPI_REPORT_ERROR(("Null object descriptor pointer\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null object descriptor pointer\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -419,18 +424,23 @@ acpi_ds_method_data_get_value(u16 opcode, switch (opcode) { case AML_ARG_OP: - ACPI_REPORT_ERROR(("Uninitialized Arg[%d] at node %p\n", index, node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Uninitialized Arg[%d] at node %p\n", + index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); case AML_LOCAL_OP: - ACPI_REPORT_ERROR(("Uninitialized Local[%d] at node %p\n", index, node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Uninitialized Local[%d] at node %p\n", + index, node)); return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); default: - ACPI_REPORT_ERROR(("Not a Arg/Local opcode: %X\n", opcode)); + ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n", + opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/trunk/drivers/acpi/dispatcher/dsobject.c b/trunk/drivers/acpi/dispatcher/dsobject.c index dc116d679a58..8ac0cd93adb5 100644 --- a/trunk/drivers/acpi/dispatcher/dsobject.c +++ b/trunk/drivers/acpi/dispatcher/dsobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,7 +51,6 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsobject") -/* Local prototypes */ static acpi_status acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, union acpi_parse_object *op, @@ -86,7 +85,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, *obj_desc_ptr = NULL; if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { /* - * This is a named object reference. If this name was + * This is an named object reference. If this name was * previously looked up in the namespace, it was stored in this op. * Otherwise, go ahead and look it up now */ @@ -97,48 +96,18 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - ACPI_CAST_INDIRECT_PTR(struct - acpi_namespace_node, - &(op-> - common. - node))); - if (ACPI_FAILURE(status)) { - /* Check if we are resolving a named reference within a package */ - - if ((status == AE_NOT_FOUND) - && (acpi_gbl_enable_interpreter_slack) - && - ((op->common.parent->common.aml_opcode == - AML_PACKAGE_OP) - || (op->common.parent->common.aml_opcode == - AML_VAR_PACKAGE_OP))) { - /* - * We didn't find the target and we are populating elements - * of a package - ignore if slack enabled. Some ASL code - * contains dangling invalid references in packages and - * expects that no exception will be issued. Leave the - * element as a null element. It cannot be used, but it - * can be overwritten by subsequent ASL code - this is - * typically the case. - */ - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Ignoring unresolved reference in package [%4.4s]\n", - walk_state-> - scope_info->scope. - node->name.ascii)); - - return_ACPI_STATUS(AE_OK); - } else { - ACPI_REPORT_NSERROR(op->common.value. - string, status); - } + (struct acpi_namespace_node **) + &(op->common.node)); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_NSERROR(op->common.value.string, + status); return_ACPI_STATUS(status); } } } - /* Create and init a new internal ACPI object */ + /* Create and init the internal ACPI object */ obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info (op->common.aml_opcode))-> @@ -188,13 +157,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); - /* - * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". - * The buffer object already exists (from the NS node), otherwise it must - * be created. - */ obj_desc = *obj_desc_ptr; - if (!obj_desc) { + if (obj_desc) { + /* + * We are evaluating a Named buffer object "Name (xxxx, Buffer)". + * The buffer object already exists (from the NS node) + */ + } else { /* Create a new buffer object */ obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); @@ -214,7 +183,10 @@ 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_REPORT_ERROR(("Expecting bytelist, got AML opcode %X in op %p\n", byte_list->common.aml_opcode, byte_list)); + ACPI_DEBUG_PRINT((ACPI_DB_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); @@ -287,7 +259,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, union acpi_operand_object *obj_desc = NULL; u32 package_list_length; acpi_status status = AE_OK; - acpi_native_uint i; + u32 i; ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); @@ -299,12 +271,13 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, parent = parent->common.parent; } - /* - * If we are evaluating a Named package object "Name (xxxx, Package)", - * the package object already exists, otherwise it must be created. - */ obj_desc = *obj_desc_ptr; - if (!obj_desc) { + if (obj_desc) { + /* + * We are evaluating a Named package object "Name (xxxx, Package)". + * Get the existing package object from the NS node + */ + } else { obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); *obj_desc_ptr = obj_desc; if (!obj_desc) { @@ -318,9 +291,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, /* Count the number of items in the package list */ + package_list_length = 0; arg = op->common.value.arg; arg = arg->common.next; - for (package_list_length = 0; arg; package_list_length++) { + while (arg) { + package_list_length++; arg = arg->common.next; } @@ -347,11 +322,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, } /* - * Initialize all elements of the package + * Now init the elements of the package */ + i = 0; arg = op->common.value.arg; arg = arg->common.next; - for (i = 0; arg; i++) { + while (arg) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { /* Object (package or buffer) is already built */ @@ -364,6 +340,8 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, package. elements[i]); } + + i++; arg = arg->common.next; } @@ -540,7 +518,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("Unknown constant opcode %X\n", opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown constant opcode %X\n", + opcode)); status = AE_AML_OPERAND_TYPE; break; } @@ -555,8 +535,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, break; default: - ACPI_REPORT_ERROR(("Unknown Integer type %X\n", - op_info->type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown Integer type %X\n", + op_info->type)); status = AE_AML_OPERAND_TYPE; break; } @@ -634,8 +615,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("Unimplemented data type: %X\n", - ACPI_GET_OBJECT_TYPE(obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unimplemented data type: %X\n", + ACPI_GET_OBJECT_TYPE(obj_desc))); status = AE_AML_OPERAND_TYPE; break; diff --git a/trunk/drivers/acpi/dispatcher/dsopcode.c b/trunk/drivers/acpi/dispatcher/dsopcode.c index 60414ee84b0a..939d167bf87b 100644 --- a/trunk/drivers/acpi/dispatcher/dsopcode.c +++ b/trunk/drivers/acpi/dispatcher/dsopcode.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -413,7 +413,9 @@ 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_REPORT_ERROR(("Target of Create Field is not a Buffer object - %s\n", acpi_ut_get_object_type_name(buffer_desc))); + 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))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -425,9 +427,10 @@ 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_REPORT_ERROR(("(%s) destination not a NS Node [%s]\n", - acpi_ps_get_opcode_name(aml_opcode), - acpi_ut_get_descriptor_name(result_desc))); + 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))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -450,7 +453,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode, /* Must have a valid (>0) bit count */ if (bit_count == 0) { - ACPI_REPORT_ERROR(("Attempt to create_field of length 0\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Attempt to create_field of length 0\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -503,8 +507,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode, default: - ACPI_REPORT_ERROR(("Unknown field creation opcode %02x\n", - aml_opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown field creation opcode %02x\n", + aml_opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -512,7 +517,13 @@ 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_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)); + 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)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -618,10 +629,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, "after acpi_ex_resolve_operands"); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("(%s) bad operand(s) (%X)\n", - acpi_ps_get_opcode_name(op->common. - aml_opcode), - status)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", + acpi_ps_get_opcode_name(op->common. + aml_opcode), status)); return_ACPI_STATUS(status); } @@ -1145,8 +1155,9 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, default: - ACPI_REPORT_ERROR(("Unknown control opcode=%X Op=%p\n", - op->common.aml_opcode, op)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown control opcode=%X Op=%p\n", + op->common.aml_opcode, op)); status = AE_AML_BAD_OPCODE; break; diff --git a/trunk/drivers/acpi/dispatcher/dsutils.c b/trunk/drivers/acpi/dispatcher/dsutils.c index cd9aa7faa57b..83ae1c1aa286 100644 --- a/trunk/drivers/acpi/dispatcher/dsutils.c +++ b/trunk/drivers/acpi/dispatcher/dsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -176,8 +176,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op, /* Must have both an Op and a Result Object */ if (!op) { - ACPI_REPORT_ERROR(("Null Op\n")); - return_UINT8(TRUE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); + return_VALUE(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_UINT8(FALSE); + return_VALUE(FALSE); } /* Get info on the parent. The root_op is AML_SCOPE */ @@ -216,8 +216,9 @@ 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_REPORT_ERROR(("Unknown parent opcode Op=%p\n", op)); - return_UINT8(FALSE); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown parent opcode. Op=%p\n", op)); + return_VALUE(FALSE); } /* @@ -303,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_UINT8(TRUE); + return_VALUE(TRUE); result_not_used: ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, @@ -312,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_UINT8(FALSE); + return_VALUE(FALSE); } /******************************************************************************* @@ -343,7 +344,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_REPORT_ERROR(("Null Op\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); return_VOID; } @@ -615,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-> @@ -634,7 +635,10 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, * Only error is underflow, and this indicates * a missing or null operand! */ - ACPI_REPORT_ERROR(("Missing or null operand, %s\n", acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Missing or null operand, %s\n", + acpi_format_exception + (status))); return_ACPI_STATUS(status); } } else { @@ -726,7 +730,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, */ (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); - ACPI_REPORT_ERROR(("While creating Arg %d - %s\n", - (arg_count + 1), acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n", + (arg_count + 1), acpi_format_exception(status))); return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/dispatcher/dswexec.c b/trunk/drivers/acpi/dispatcher/dswexec.c index 5a9b91fe93d2..e522763bb692 100644 --- a/trunk/drivers/acpi/dispatcher/dswexec.c +++ b/trunk/drivers/acpi/dispatcher/dswexec.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,7 +100,9 @@ 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_REPORT_ERROR(("Could not get result from predicate evaluation, %s\n", acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not get result from predicate evaluation, %s\n", + acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -121,8 +123,9 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (!obj_desc) { - ACPI_REPORT_ERROR(("No predicate obj_desc=%p State=%p\n", - obj_desc, walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No predicate obj_desc=%p State=%p\n", + obj_desc, walk_state)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -137,7 +140,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, } if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { - 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))); + 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))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -308,13 +314,12 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: + /* * Most operators with arguments. * Start a new result/operand state */ - if (walk_state->opcode != AML_CREATE_FIELD_OP) { - status = acpi_ds_result_stack_push(walk_state); - } + status = acpi_ds_result_stack_push(walk_state); break; default: @@ -356,8 +361,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_REPORT_ERROR(("Unknown opcode %X\n", - op->common.aml_opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n", + op->common.aml_opcode)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -447,7 +452,12 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) walk_state->operands[1]->reference.offset)) { status = AE_OK; } else { - ACPI_REPORT_ERROR(("[%s]: Could not resolve operands, %s\n", acpi_ps_get_opcode_name(walk_state->opcode), acpi_format_exception(status))); + 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))); } } @@ -666,8 +676,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_UNDEFINED: - ACPI_REPORT_ERROR(("Undefined opcode type Op=%p\n", - op)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Undefined opcode type Op=%p\n", op)); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); case AML_TYPE_BOGUS: @@ -679,7 +689,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", op_class, op_type, op->common.aml_opcode, op)); + 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)); status = AE_NOT_IMPLEMENTED; break; @@ -710,6 +723,20 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) cleanup: + /* Invoke exception handler on error */ + + if (ACPI_FAILURE(status) && + acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { + acpi_ex_exit_interpreter(); + status = acpi_gbl_exception_handler(status, + walk_state->method_node-> + name.integer, + walk_state->opcode, + walk_state->aml_offset, + NULL); + (void)acpi_ex_enter_interpreter(); + } + if (walk_state->result_obj) { /* Break to debugger to display result */ @@ -731,14 +758,18 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) } #endif - /* Invoke exception handler on error */ + /* Always clear the object stack */ + + walk_state->num_operands = 0; + +#ifdef ACPI_DISASSEMBLER + + /* On error, display method locals/args */ if (ACPI_FAILURE(status)) { - status = acpi_ds_method_error(status, walk_state); + acpi_dm_dump_method_info(status, walk_state, op); } +#endif - /* Always clear the object stack */ - - walk_state->num_operands = 0; return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/dispatcher/dswload.c b/trunk/drivers/acpi/dispatcher/dswload.c index 4cad6afa82f7..411731261c29 100644 --- a/trunk/drivers/acpi/dispatcher/dswload.c +++ b/trunk/drivers/acpi/dispatcher/dswload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, char *path; u32 flags; - ACPI_FUNCTION_TRACE("ds_load1_begin_op"); + ACPI_FUNCTION_NAME("ds_load1_begin_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, @@ -138,14 +138,14 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, if (op) { if (!(walk_state->op_info->flags & AML_NAMED)) { *out_op = op; - return_ACPI_STATUS(AE_OK); + return (AE_OK); } /* Check if this object has already been installed in the namespace */ if (op->common.node) { *out_op = op; - return_ACPI_STATUS(AE_OK); + return (AE_OK); } } @@ -188,7 +188,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, #endif if (ACPI_FAILURE(status)) { ACPI_REPORT_NSERROR(path, status); - return_ACPI_STATUS(status); + return (status); } /* @@ -235,7 +235,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); - return_ACPI_STATUS(AE_AML_OPERAND_TYPE); + return (AE_AML_OPERAND_TYPE); } break; @@ -257,7 +257,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, * buffer_field, or Package), the name of the object is already * in the namespace. */ - if (walk_state->deferred_node) { /* This name is already in the namespace, get the node */ @@ -266,16 +265,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, break; } - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (walk_state->method_node) { - node = NULL; - status = AE_OK; - break; - } - flags = ACPI_NS_NO_UPSEARCH; if ((walk_state->opcode != AML_SCOPE_OP) && (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { @@ -301,7 +290,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, &(node)); if (ACPI_FAILURE(status)) { ACPI_REPORT_NSERROR(path, status); - return_ACPI_STATUS(status); + return (status); } break; } @@ -313,29 +302,28 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, op = acpi_ps_alloc_op(walk_state->opcode); if (!op) { - return_ACPI_STATUS(AE_NO_MEMORY); + return (AE_NO_MEMORY); } } - /* Initialize the op */ + /* Initialize */ + + op->named.name = node->name.integer; #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) - op->named.path = ACPI_CAST_PTR(u8, path); + op->named.path = (u8 *) path; #endif - if (node) { - /* - * Put the Node in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - op->common.node = node; - op->named.name = node->name.integer; - } - + /* + * Put the Node in the "op" object that the parser uses, so we + * can get it again quickly when this scope is closed + */ + op->common.node = node; acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), op); + *out_op = op; - return_ACPI_STATUS(status); + return (status); } /******************************************************************************* @@ -351,13 +339,13 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, * ******************************************************************************/ -acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) +acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) { union acpi_parse_object *op; acpi_object_type object_type; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("ds_load1_end_op"); + ACPI_FUNCTION_NAME("ds_load1_end_op"); op = walk_state->op; ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, @@ -366,7 +354,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) /* We are only interested in opcodes that have an associated name */ if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) { - return_ACPI_STATUS(AE_OK); + return (AE_OK); } /* Get the object type to determine if we should pop the scope */ @@ -375,37 +363,21 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) #ifndef ACPI_NO_METHOD_EXECUTION if (walk_state->op_info->flags & AML_FIELD) { - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (!walk_state->method_node) { - if (walk_state->opcode == AML_FIELD_OP || - walk_state->opcode == AML_BANK_FIELD_OP || - walk_state->opcode == AML_INDEX_FIELD_OP) { - status = - acpi_ds_init_field_objects(op, walk_state); - } + if (walk_state->opcode == AML_FIELD_OP || + walk_state->opcode == AML_BANK_FIELD_OP || + walk_state->opcode == AML_INDEX_FIELD_OP) { + status = acpi_ds_init_field_objects(op, walk_state); } - return_ACPI_STATUS(status); + return (status); } - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (!walk_state->method_node) { - if (op->common.aml_opcode == AML_REGION_OP) { - status = - acpi_ex_create_region(op->named.data, - op->named.length, - (acpi_adr_space_type) - ((op->common.value.arg)-> - common.value.integer), - walk_state); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + if (op->common.aml_opcode == AML_REGION_OP) { + status = acpi_ex_create_region(op->named.data, op->named.length, + (acpi_adr_space_type) + ((op->common.value.arg)->common. + value.integer), walk_state); + if (ACPI_FAILURE(status)) { + return (status); } } #endif @@ -419,63 +391,47 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) common. aml_opcode))-> object_type; - - /* Set node type if we have a namespace node */ - - if (op->common.node) { - op->common.node->type = (u8) object_type; - } + op->common.node->type = (u8) object_type; } } - /* - * If we are executing a method, do not create any namespace objects - * during the load phase, only during execution. - */ - if (!walk_state->method_node) { - if (op->common.aml_opcode == AML_METHOD_OP) { - /* - * method_op pkg_length name_string method_flags term_list - * - * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing - * of invocations of the method (need to know the number of - * arguments.) - */ - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p named_obj=%p\n", - walk_state, op, op->named.node)); + if (op->common.aml_opcode == AML_METHOD_OP) { + /* + * method_op pkg_length name_string method_flags term_list + * + * Note: We must create the method node/object pair as soon as we + * see the method declaration. This allows later pass1 parsing + * of invocations of the method (need to know the number of + * arguments.) + */ + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p named_obj=%p\n", + walk_state, op, op->named.node)); - if (!acpi_ns_get_attached_object(op->named.node)) { - walk_state->operands[0] = - ACPI_CAST_PTR(void, op->named.node); - walk_state->num_operands = 1; + if (!acpi_ns_get_attached_object(op->named.node)) { + walk_state->operands[0] = (void *)op->named.node; + walk_state->num_operands = 1; - status = - acpi_ds_create_operands(walk_state, - op->common.value. - arg); - if (ACPI_SUCCESS(status)) { - status = - acpi_ex_create_method(op->named. - data, - op->named. - length, - walk_state); - } - walk_state->operands[0] = NULL; - walk_state->num_operands = 0; + status = + acpi_ds_create_operands(walk_state, + op->common.value.arg); + if (ACPI_SUCCESS(status)) { + status = acpi_ex_create_method(op->named.data, + op->named.length, + walk_state); + } + walk_state->operands[0] = NULL; + walk_state->num_operands = 0; - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + if (ACPI_FAILURE(status)) { + return (status); } } } - /* Pop the scope stack (only if loading a table) */ + /* Pop the scope stack */ - if (!walk_state->method_node && acpi_ns_opens_scope(object_type)) { + if (acpi_ns_opens_scope(object_type)) { ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", acpi_ut_get_type_name(object_type), op)); @@ -483,7 +439,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) status = acpi_ds_scope_stack_pop(walk_state); } - return_ACPI_STATUS(status); + return (status); } /******************************************************************************* @@ -500,8 +456,8 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) ******************************************************************************/ acpi_status -acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, - union acpi_parse_object **out_op) +acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, + union acpi_parse_object ** out_op) { union acpi_parse_object *op; struct acpi_namespace_node *node; @@ -884,13 +840,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) case AML_TYPE_NAMED_FIELD: - /* - * If we are executing a method, initialize the field - */ - if (walk_state->method_node) { - status = acpi_ds_init_field_objects(op, walk_state); - } - switch (op->common.aml_opcode) { case AML_INDEX_FIELD_OP: @@ -980,24 +929,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) switch (op->common.aml_opcode) { #ifndef ACPI_NO_METHOD_EXECUTION case AML_REGION_OP: - - /* - * If we are executing a method, initialize the region - */ - if (walk_state->method_node) { - status = - acpi_ex_create_region(op->named.data, - op->named.length, - (acpi_adr_space_type) - ((op->common.value. - arg)->common.value. - integer), - walk_state); - if (ACPI_FAILURE(status)) { - return (status); - } - } - /* * The op_region is not fully parsed at this time. Only valid * argument is the space_id. (We must save the address of the @@ -1026,50 +957,11 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) status = acpi_ds_create_node(walk_state, node, op); break; - - case AML_METHOD_OP: - /* - * method_op pkg_length name_string method_flags term_list - * - * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing - * of invocations of the method (need to know the number of - * arguments.) - */ - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p named_obj=%p\n", - walk_state, op, op->named.node)); - - if (!acpi_ns_get_attached_object(op->named.node)) { - walk_state->operands[0] = - ACPI_CAST_PTR(void, op->named.node); - walk_state->num_operands = 1; - - status = - acpi_ds_create_operands(walk_state, - op->common.value. - arg); - if (ACPI_SUCCESS(status)) { - status = - acpi_ex_create_method(op->named. - data, - op->named. - length, - walk_state); - } - walk_state->operands[0] = NULL; - walk_state->num_operands = 0; - - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } - break; - #endif /* ACPI_NO_METHOD_EXECUTION */ default: /* All NAMED_COMPLEX opcodes must be handled above */ + /* Note: Method objects were already created in Pass 1 */ break; } break; diff --git a/trunk/drivers/acpi/dispatcher/dswscope.c b/trunk/drivers/acpi/dispatcher/dswscope.c index e7fc88ca47ba..defe956ef751 100644 --- a/trunk/drivers/acpi/dispatcher/dswscope.c +++ b/trunk/drivers/acpi/dispatcher/dswscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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(("Null scope parameter\n")); + ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Make sure object type is valid */ if (!acpi_ut_valid_object_type(type)) { - ACPI_REPORT_WARNING(("Invalid object type: 0x%X\n", type)); + ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); } /* Allocate a new scope object */ diff --git a/trunk/drivers/acpi/dispatcher/dswstate.c b/trunk/drivers/acpi/dispatcher/dswstate.c index 61aae2dcc5e2..7d68a5aaf3c4 100644 --- a/trunk/drivers/acpi/dispatcher/dswstate.c +++ b/trunk/drivers/acpi/dispatcher/dswstate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,23 +92,26 @@ acpi_ds_result_remove(union acpi_operand_object **object, state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_MAX_OPERAND) { - ACPI_REPORT_ERROR(("Index out of range: %X State=%p Num=%X\n", - index, walk_state, - state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_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_REPORT_ERROR(("Null operand! State=%p #Ops=%X, Index=%X\n", - walk_state, state->results.num_results, - index)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null operand! State=%p #Ops=%X, Index=%X\n", + walk_state, state->results.num_results, + index)); return (AE_AML_NO_RETURN_VALUE); } @@ -160,8 +163,9 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } if (!state->results.num_results) { - ACPI_REPORT_ERROR(("Result stack is empty! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Result stack is empty! State=%p\n", + walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -188,7 +192,8 @@ acpi_ds_result_pop(union acpi_operand_object ** object, } } - ACPI_REPORT_ERROR(("No result objects! State=%p\n", walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result objects! State=%p\n", walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -217,14 +222,15 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Warning: No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (!state->results.num_results) { - ACPI_REPORT_ERROR(("No result objects! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result objects! State=%p\n", walk_state)); return (AE_AML_NO_RETURN_VALUE); } @@ -244,9 +250,10 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, /* Check for a valid result object */ if (!*object) { - ACPI_REPORT_ERROR(("Null operand! State=%p #Ops=%X Index=%X\n", - walk_state, state->results.num_results, - (u32) index)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null operand! State=%p #Ops=%X Index=%X\n", + walk_state, state->results.num_results, + (u32) index)); return (AE_AML_NO_RETURN_VALUE); } @@ -286,14 +293,18 @@ acpi_ds_result_push(union acpi_operand_object * object, } if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { - ACPI_REPORT_ERROR(("Result stack overflow: Obj=%p State=%p Num=%X\n", object, walk_state, state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_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_REPORT_ERROR(("Null Object! Obj=%p State=%p Num=%X\n", - object, walk_state, - state->results.num_results)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null Object! Obj=%p State=%p Num=%X\n", + object, walk_state, + state->results.num_results)); return (AE_BAD_PARAMETER); } @@ -402,7 +413,10 @@ 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_REPORT_ERROR(("Object stack overflow! Obj=%p State=%p #Ops=%X\n", object, walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "overflow! Obj=%p State=%p #Ops=%X\n", + object, walk_state, + walk_state->num_operands)); return (AE_STACK_OVERFLOW); } @@ -446,7 +460,10 @@ 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_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Underflow! Count=%X State=%p #Ops=%X\n", + pop_count, walk_state, + walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -489,7 +506,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_REPORT_ERROR(("Object stack underflow! Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Underflow! Count=%X State=%p #Ops=%X\n", + pop_count, walk_state, + walk_state->num_operands)); return (AE_STACK_UNDERFLOW); } @@ -806,14 +826,16 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) } if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { - ACPI_REPORT_ERROR(("%p is not a valid walk state\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%p is not a valid walk state\n", + walk_state)); return; } if (walk_state->parser_state.scope) { - ACPI_REPORT_ERROR(("%p walk still has a scope list\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%p walk still has a scope list\n", + walk_state)); } /* Always must free any linked control states */ @@ -872,18 +894,25 @@ acpi_ds_result_insert(void *object, state = walk_state->results; if (!state) { - ACPI_REPORT_ERROR(("No result object pushed! State=%p\n", - walk_state)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No result object pushed! State=%p\n", + walk_state)); return (AE_NOT_EXIST); } if (index >= ACPI_OBJ_NUM_OPERANDS) { - ACPI_REPORT_ERROR(("Index out of range: %X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); + 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)); return (AE_BAD_PARAMETER); } if (!object) { - ACPI_REPORT_ERROR(("Null Object! Index=%X Obj=%p State=%p Num=%X\n", index, object, walk_state, state->results.num_results)); + 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)); return (AE_BAD_PARAMETER); } @@ -957,7 +986,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, /* Check for stack underflow */ if (walk_state->num_operands == 0) { - ACPI_REPORT_ERROR(("Missing operand/stack empty! State=%p #Ops=%X\n", walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Missing operand/stack empty! State=%p #Ops=%X\n", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } @@ -969,8 +1000,9 @@ 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_REPORT_ERROR(("Null operand! State=%p #Ops=%X\n", - walk_state, walk_state->num_operands)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Null operand! State=%p #Ops=%X\n", + walk_state, walk_state->num_operands)); *object = NULL; return (AE_AML_NO_OPERAND); } diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index 0ecbfa5db1ba..7e1a445955bc 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/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_RESOURCE_TYPE_IO) { + if (resource->id != ACPI_RSTYPE_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.minimum; + addr->address = resource->data.io.min_base_address; return AE_OK; } diff --git a/trunk/drivers/acpi/events/evevent.c b/trunk/drivers/acpi/events/evevent.c index b380ae1044b7..842d1e3fb37b 100644 --- a/trunk/drivers/acpi/events/evevent.c +++ b/trunk/drivers/acpi/events/evevent.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_REPORT_WARNING(("No ACPI tables present!\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -98,48 +98,6 @@ acpi_status acpi_ev_initialize_events(void) return_ACPI_STATUS(status); } -/******************************************************************************* - * - * FUNCTION: acpi_ev_install_fadt_gpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks - * (0 and 1). This causes the _PRW methods to be run, so the HW - * must be fully initialized at this point, including global lock - * support. - * - ******************************************************************************/ - -acpi_status acpi_ev_install_fadt_gpes(void) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); - - /* Namespace must be locked */ - - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return (status); - } - - /* FADT GPE Block 0 */ - - (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, - acpi_gbl_gpe_fadt_blocks[0]); - - /* FADT GPE Block 1 */ - - (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, - acpi_gbl_gpe_fadt_blocks[1]); - - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - return_ACPI_STATUS(AE_OK); -} - /******************************************************************************* * * FUNCTION: acpi_ev_install_xrupt_handlers diff --git a/trunk/drivers/acpi/events/evgpe.c b/trunk/drivers/acpi/events/evgpe.c index 353b907edbfa..b2f232df13d8 100644 --- a/trunk/drivers/acpi/events/evgpe.c +++ b/trunk/drivers/acpi/events/evgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -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; - acpi_native_uint flags; + u32 flags; + acpi_status status; + struct acpi_gpe_block_info *gpe_block; acpi_native_uint i; acpi_native_uint j; @@ -599,10 +599,8 @@ 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(("%s, Unable to clear GPE[%2X]\n", - acpi_format_exception(status), - gpe_number)); - return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); + 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); } } @@ -639,8 +637,8 @@ 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(("%s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); - return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); + 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); } } break; @@ -653,10 +651,8 @@ 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(("%s, Unable to disable GPE[%2X]\n", - acpi_format_exception(status), - gpe_number)); - return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); + 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); } /* @@ -667,7 +663,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(("%s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); } break; @@ -675,7 +671,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(("No handler or method for GPE[%2X], disabling event\n", gpe_number)); + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number)); /* * Disable the GPE. The GPE will remain disabled until the ACPI @@ -683,15 +679,13 @@ 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(("%s, Unable to disable GPE[%2X]\n", - acpi_format_exception(status), - gpe_number)); - return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); + 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); } break; } - return_UINT32(ACPI_INTERRUPT_HANDLED); + return_VALUE(ACPI_INTERRUPT_HANDLED); } #ifdef ACPI_GPE_NOTIFY_CHECK diff --git a/trunk/drivers/acpi/events/evgpeblk.c b/trunk/drivers/acpi/events/evgpeblk.c index 3b9bbdda551d..b312eb33c43e 100644 --- a/trunk/drivers/acpi/events/evgpeblk.c +++ b/trunk/drivers/acpi/events/evgpeblk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,7 +78,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block); * * RETURN: TRUE if the gpe_event is valid * - * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. + * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. * Should be called only when the GPE lists are semaphore locked * and not subject to change. * @@ -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; - acpi_native_uint flags; + u32 flags; ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); @@ -264,7 +264,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, * 2) Edge/Level determination is based on the 2nd character * of the method name * - * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE + * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE * if a _PRW object is found that points to this GPE. */ switch (name[1]) { @@ -279,7 +279,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, default: /* Unknown method type, just ignore it! */ - ACPI_REPORT_ERROR(("Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", name)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", + name)); return_ACPI_STATUS(AE_OK); } @@ -289,7 +291,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, if (gpe_number == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ - ACPI_REPORT_ERROR(("Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", name)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", + name)); return_ACPI_STATUS(AE_OK); } @@ -309,14 +313,14 @@ acpi_ev_save_method_info(acpi_handle obj_handle, /* * Now we can add this information to the gpe_event_info block - * for use during dispatch of this GPE. Default type is RUNTIME, although + * for use during dispatch of this GPE. Default type is RUNTIME, although * this may change when the _PRW methods are executed later. */ gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; - gpe_event_info->flags = (u8) - (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME); + gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | + ACPI_GPE_TYPE_RUNTIME); gpe_event_info->dispatch.method_node = (struct acpi_namespace_node *)obj_handle; @@ -337,11 +341,11 @@ acpi_ev_save_method_info(acpi_handle obj_handle, * * PARAMETERS: Callback from walk_namespace * - * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is + * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is * not aborted on a single _PRW failure. * * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a - * Device. Run the _PRW method. If present, extract the GPE + * Device. Run the _PRW method. If present, extract the GPE * number and mark the GPE as a WAKE GPE. * ******************************************************************************/ @@ -439,7 +443,6 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, gpe_event_info->flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); - status = acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); if (ACPI_FAILURE(status)) { @@ -463,7 +466,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, * * RETURN: A GPE interrupt block * - * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt + * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt * block per unique interrupt level used for GPEs. * Should be called only when the GPE lists are semaphore locked * and not subject to change. @@ -476,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; - acpi_native_uint flags; + u32 flags; ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); @@ -523,7 +526,9 @@ 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_REPORT_ERROR(("Could not install GPE interrupt handler at level 0x%X\n", interrupt_number)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not install GPE interrupt handler at level 0x%X\n", + interrupt_number)); return_PTR(NULL); } } @@ -548,7 +553,7 @@ static acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) { acpi_status status; - acpi_native_uint flags; + u32 flags; ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); @@ -561,9 +566,8 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) /* Disable this interrupt */ - status = - acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, - acpi_ev_gpe_xrupt_handler); + status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, + acpi_ev_gpe_xrupt_handler); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -606,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; - acpi_native_uint flags; + u32 flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); @@ -659,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; - acpi_native_uint flags; + u32 flags; ACPI_FUNCTION_TRACE("ev_install_gpe_block"); @@ -739,20 +743,22 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) sizeof(struct acpi_gpe_register_info)); if (!gpe_register_info) { - ACPI_REPORT_ERROR(("Could not allocate the gpe_register_info table\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not allocate the gpe_register_info table\n")); return_ACPI_STATUS(AE_NO_MEMORY); } /* * Allocate the GPE event_info block. There are eight distinct GPEs - * per register. Initialization to zeros is sufficient. + * per register. Initialization to zeros is sufficient. */ gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> register_count * ACPI_GPE_REGISTER_WIDTH) * sizeof(struct acpi_gpe_event_info)); if (!gpe_event_info) { - ACPI_REPORT_ERROR(("Could not allocate the gpe_event_info table\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not allocate the gpe_event_info table\n")); status = AE_NO_MEMORY; goto error_exit; } @@ -763,9 +769,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) gpe_block->event_info = gpe_event_info; /* - * Initialize the GPE Register and Event structures. A goal of these + * Initialize the GPE Register and Event structures. A goal of these * tables is to hide the fact that there are two separate GPE register sets - * in a given GPE hardware block, the status registers occupy the first half, + * in a given gpe hardware block, the status registers occupy the first half, * and the enable registers occupy the second half. */ this_register = gpe_register_info; @@ -806,8 +812,11 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) this_event++; } - /* Disable all GPEs within this register */ - + /* + * Clear the status/enable registers. Note that status registers + * are cleared by writing a '1', while enable registers are cleared + * by writing a '0'. + */ status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, &this_register-> enable_address); @@ -815,8 +824,6 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) goto error_exit; } - /* Clear any pending GPE events within this register */ - status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, &this_register-> status_address); @@ -853,9 +860,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) * * RETURN: Status * - * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within - * the block are disabled at exit. - * Note: Assumes namespace is locked. + * DESCRIPTION: Create and Install a block of GPE registers * ******************************************************************************/ @@ -867,8 +872,14 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block) { - acpi_status status; struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_event_info *gpe_event_info; + acpi_native_uint i; + acpi_native_uint j; + u32 wake_gpe_count; + u32 gpe_enabled_count; + acpi_status status; + struct acpi_gpe_walk_info gpe_info; ACPI_FUNCTION_TRACE("ev_create_gpe_block"); @@ -885,24 +896,22 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, /* Initialize the new GPE block */ - gpe_block->node = gpe_device; gpe_block->register_count = register_count; gpe_block->block_base_number = gpe_block_base_number; + gpe_block->node = gpe_device; ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, sizeof(struct acpi_generic_address)); - /* - * Create the register_info and event_info sub-structures - * Note: disables and clears all GPEs in the block - */ + /* Create the register_info and event_info sub-structures */ + status = acpi_ev_create_gpe_info_blocks(gpe_block); if (ACPI_FAILURE(status)) { ACPI_MEM_FREE(gpe_block); return_ACPI_STATUS(status); } - /* Install the new block in the global lists */ + /* Install the new block in the global list(s) */ status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); if (ACPI_FAILURE(status)) { @@ -917,70 +926,16 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, acpi_ev_save_method_info, gpe_block, NULL); - /* Return the new block */ - - if (return_gpe_block) { - (*return_gpe_block) = gpe_block; - } - - ACPI_DEBUG_PRINT((ACPI_DB_INIT, - "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", - (u32) gpe_block->block_base_number, - (u32) (gpe_block->block_base_number + - ((gpe_block->register_count * - ACPI_GPE_REGISTER_WIDTH) - 1)), - gpe_device->name.ascii, gpe_block->register_count, - interrupt_number)); - - return_ACPI_STATUS(AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ev_initialize_gpe_block - * - * PARAMETERS: gpe_device - Handle to the parent GPE block - * gpe_block - Gpe Block info - * - * RETURN: Status - * - * DESCRIPTION: Initialize and enable a GPE block. First find and run any - * _PRT methods associated with the block, then enable the - * appropriate GPEs. - * Note: Assumes namespace is locked. - * - ******************************************************************************/ - -acpi_status -acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, - struct acpi_gpe_block_info *gpe_block) -{ - acpi_status status; - struct acpi_gpe_event_info *gpe_event_info; - struct acpi_gpe_walk_info gpe_info; - u32 wake_gpe_count; - u32 gpe_enabled_count; - acpi_native_uint i; - acpi_native_uint j; - - ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); - - /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ - - if (!gpe_block) { - return_ACPI_STATUS(AE_OK); - } - /* - * Runtime option: Should wake GPEs be enabled at runtime? The default - * is no, they should only be enabled just as the machine goes to sleep. + * Runtime option: Should Wake GPEs be enabled at runtime? The default + * is No, they should only be enabled just as the machine goes to sleep. */ if (acpi_gbl_leave_wake_gpes_disabled) { /* - * Differentiate runtime vs wake GPEs, via the _PRW control methods. - * Each GPE that has one or more _PRWs that reference it is by - * definition a wake GPE and will not be enabled while the machine - * is running. + * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. + * (Each GPE that has one or more _PRWs that reference it is by + * definition a WAKE GPE and will not be enabled while the machine + * is running.) */ gpe_info.gpe_block = gpe_block; gpe_info.gpe_device = gpe_device; @@ -993,12 +948,9 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, } /* - * Enable all GPEs in this block that have these attributes: - * 1) are "runtime" or "run/wake" GPEs, and - * 2) have a corresponding _Lxx or _Exx method - * - * Any other GPEs within this block must be enabled via the acpi_enable_gpe() - * external interface. + * Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs, + * and 2) have a corresponding _Lxx or _Exx method. All other GPEs must + * be enabled via the acpi_enable_gpe() external interface. */ wake_gpe_count = 0; gpe_enabled_count = 0; @@ -1024,19 +976,32 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, } } + /* Dump info about this GPE block */ + + ACPI_DEBUG_PRINT((ACPI_DB_INIT, + "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", + (u32) gpe_block->block_base_number, + (u32) (gpe_block->block_base_number + + ((gpe_block->register_count * + ACPI_GPE_REGISTER_WIDTH) - 1)), + gpe_device->name.ascii, gpe_block->register_count, + interrupt_number)); + + /* Enable all valid GPEs found above */ + + status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); + ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Found %u Wake, Enabled %u Runtime GPEs in this block\n", wake_gpe_count, gpe_enabled_count)); - /* Enable all valid runtime GPEs found above */ + /* Return the new block */ - status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); - if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not enable GPEs in gpe_block %p\n", - gpe_block)); + if (return_gpe_block) { + (*return_gpe_block) = gpe_block; } - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* diff --git a/trunk/drivers/acpi/events/evmisc.c b/trunk/drivers/acpi/events/evmisc.c index 78883239784a..7e57b8470f55 100644 --- a/trunk/drivers/acpi/events/evmisc.c +++ b/trunk/drivers/acpi/events/evmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -542,7 +542,9 @@ 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_REPORT_ERROR(("Could not disable fixed event %d\n", (u32) i)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not disable fixed event %d\n", + (u32) i)); } } @@ -554,7 +556,8 @@ void acpi_ev_terminate(void) status = acpi_ev_remove_sci_handler(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not remove SCI handler\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not remove SCI handler\n")); } } @@ -567,7 +570,8 @@ void acpi_ev_terminate(void) if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { status = acpi_disable(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_WARNING(("acpi_disable failed\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "acpi_disable failed\n")); } } return_VOID; diff --git a/trunk/drivers/acpi/events/evregion.c b/trunk/drivers/acpi/events/evregion.c index 900e5b32e595..84fad082d80d 100644 --- a/trunk/drivers/acpi/events/evregion.c +++ b/trunk/drivers/acpi/events/evregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -295,11 +295,12 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, handler_desc = region_obj->region.handler; if (!handler_desc) { - 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))); + 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))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -316,7 +317,12 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, if (!region_setup) { /* No initialization routine, exit with error */ - ACPI_REPORT_ERROR(("No init routine for region(%p) [%s]\n", region_obj, acpi_ut_get_region_name(region_obj->region.space_id))); + 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))); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -341,11 +347,12 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, /* Check for failure of the Region Setup */ if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Region Initialization: %s [%s]\n", - acpi_format_exception(status), - acpi_ut_get_region_name(region_obj-> - region. - space_id))); + 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))); return_ACPI_STATUS(status); } @@ -494,7 +501,12 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, status = acpi_ev_execute_reg_method(region_obj, 0); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s from region _REG, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); + 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))); } if (acpi_ns_is_locked) { @@ -516,7 +528,12 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, /* Init routine may fail, Just ignore errors */ if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("%s from region init, [%s]\n", acpi_format_exception(status), acpi_ut_get_region_name(region_obj->region.space_id))); + 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))); } region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); diff --git a/trunk/drivers/acpi/events/evrgnini.c b/trunk/drivers/acpi/events/evrgnini.c index de1a38e9ce22..a1bd2da27c45 100644 --- a/trunk/drivers/acpi/events/evrgnini.c +++ b/trunk/drivers/acpi/events/evrgnini.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/events/evsci.c b/trunk/drivers/acpi/events/evsci.c index 9a622169008a..141835977002 100644 --- a/trunk/drivers/acpi/events/evsci.c +++ b/trunk/drivers/acpi/events/evsci.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -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_UINT32(interrupt_handled); + return_VALUE(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_UINT32(interrupt_handled); + return_VALUE(interrupt_handled); } /****************************************************************************** diff --git a/trunk/drivers/acpi/events/evxface.c b/trunk/drivers/acpi/events/evxface.c index b2f69b1ac4b5..43b33d19cdf9 100644 --- a/trunk/drivers/acpi/events/evxface.c +++ b/trunk/drivers/acpi/events/evxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_REPORT_WARNING(("Could not enable fixed event %X\n", - event)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Could not enable fixed event.\n")); /* Remove the handler */ @@ -204,9 +204,10 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) acpi_gbl_fixed_event_handlers[event].context = NULL; if (ACPI_FAILURE(status)) { - ACPI_REPORT_WARNING(("Could not write to fixed event enable register %X\n", event)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Could not write to fixed event enable register.\n")); } else { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n", event)); } @@ -433,7 +434,7 @@ acpi_remove_notify_handler(acpi_handle device, if (device == ACPI_ROOT_OBJECT) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Removing notify handler for namespace root object\n")); + "Removing notify handler for ROOT object.\n")); if (((handler_type & ACPI_SYSTEM_NOTIFY) && !acpi_gbl_system_notify.handler) || @@ -561,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; - acpi_native_uint flags; + u32 flags; ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); @@ -652,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; - acpi_native_uint flags; + u32 flags; ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); diff --git a/trunk/drivers/acpi/events/evxfevnt.c b/trunk/drivers/acpi/events/evxfevnt.c index 90eb7939e986..887ff9f28a0d 100644 --- a/trunk/drivers/acpi/events/evxfevnt.c +++ b/trunk/drivers/acpi/events/evxfevnt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,7 +70,8 @@ acpi_status acpi_enable(void) /* Make sure we have the FADT */ if (!acpi_gbl_FADT) { - ACPI_REPORT_WARNING(("No FADT information present!\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "No FADT information present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -82,7 +83,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); } @@ -112,7 +113,8 @@ acpi_status acpi_disable(void) ACPI_FUNCTION_TRACE("acpi_disable"); if (!acpi_gbl_FADT) { - ACPI_REPORT_WARNING(("No FADT information present!\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "No FADT information present!\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -125,7 +127,8 @@ acpi_status acpi_disable(void) status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not exit ACPI mode to legacy mode")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not exit ACPI mode to legacy mode")); return_ACPI_STATUS(status); } @@ -182,8 +185,9 @@ acpi_status acpi_enable_event(u32 event, u32 flags) } if (value != 1) { - ACPI_REPORT_ERROR(("Could not enable %s event\n", - acpi_ut_get_event_name(event))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not enable %s event\n", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } @@ -380,8 +384,9 @@ acpi_status acpi_disable_event(u32 event, u32 flags) } if (value != 0) { - ACPI_REPORT_ERROR(("Could not disable %s events\n", - acpi_ut_get_event_name(event))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not disable %s events\n", + acpi_ut_get_event_name(event))); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); } @@ -621,13 +626,6 @@ acpi_install_gpe_block(acpi_handle gpe_device, goto unlock_and_exit; } - /* Run the _PRW methods and enable the GPEs */ - - status = acpi_ev_initialize_gpe_block(node, gpe_block); - if (ACPI_FAILURE(status)) { - goto unlock_and_exit; - } - /* Get the device_object attached to the node */ obj_desc = acpi_ns_get_attached_object(node); diff --git a/trunk/drivers/acpi/events/evxfregn.c b/trunk/drivers/acpi/events/evxfregn.c index abf5caca9ae5..6f28ea2db5ba 100644 --- a/trunk/drivers/acpi/events/evxfregn.c +++ b/trunk/drivers/acpi/events/evxfregn.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exconfig.c b/trunk/drivers/acpi/executer/exconfig.c index 109d0255a5bb..1ce365d651d8 100644 --- a/trunk/drivers/acpi/executer/exconfig.c +++ b/trunk/drivers/acpi/executer/exconfig.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -413,7 +413,9 @@ 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_REPORT_ERROR(("Table has invalid signature [%4.4s], must be SSDT or PSDT\n", table_ptr->signature)); + ACPI_DEBUG_PRINT((ACPI_DB_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/trunk/drivers/acpi/executer/exconvrt.c b/trunk/drivers/acpi/executer/exconvrt.c index e6f55cf8ad31..04e5194989a6 100644 --- a/trunk/drivers/acpi/executer/exconvrt.c +++ b/trunk/drivers/acpi/executer/exconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -504,12 +504,18 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, } /* - * Create a new string object and string buffer + * Perform the conversion. * (-1 because of extra separator included in string_length from above) */ + string_length--; + if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */ + return_ACPI_STATUS(AE_AML_STRING_LIMIT); + } + + /* Create a new string object and string buffer */ + return_desc = - acpi_ut_create_string_object((acpi_size) - (string_length - 1)); + acpi_ut_create_string_object((acpi_size) string_length); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -654,8 +660,17 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, break; default: - 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; + 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; } /* diff --git a/trunk/drivers/acpi/executer/excreate.c b/trunk/drivers/acpi/executer/excreate.c index da313dad576a..91c49188fb07 100644 --- a/trunk/drivers/acpi/executer/excreate.c +++ b/trunk/drivers/acpi/executer/excreate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exdump.c b/trunk/drivers/acpi/executer/exdump.c index a7cca8d4f855..bc2fa996047e 100644 --- a/trunk/drivers/acpi/executer/exdump.c +++ b/trunk/drivers/acpi/executer/exdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,386 +55,20 @@ ACPI_MODULE_NAME("exdump") */ #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* Local prototypes */ +#ifdef ACPI_FUTURE_USAGE static void acpi_ex_out_string(char *title, char *value); static void acpi_ex_out_pointer(char *title, void *value); +static void acpi_ex_out_integer(char *title, u32 value); + static void acpi_ex_out_address(char *title, acpi_physical_address value); -static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); +static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); static void -acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, - u32 level, u32 index); - -/******************************************************************************* - * - * Object Descriptor info tables - * - * Note: The first table entry must be an INIT opcode and must contain - * the table length (number of table entries) - * - ******************************************************************************/ - -static struct acpi_exdump_info acpi_ex_dump_integer[2] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL}, - {ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"} -}; - -static struct acpi_exdump_info acpi_ex_dump_string[4] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"}, - {ACPI_EXD_STRING, 0, NULL} -}; - -static struct acpi_exdump_info acpi_ex_dump_buffer[4] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"}, - {ACPI_EXD_BUFFER, 0, NULL} -}; - -static struct acpi_exdump_info acpi_ex_dump_package[5] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"}, - {ACPI_EXD_PACKAGE, 0, NULL} -}; - -static struct acpi_exdump_info acpi_ex_dump_device[4] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.system_notify), - "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.device_notify), - "Device Notify"} -}; - -static struct acpi_exdump_info acpi_ex_dump_event[2] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} -}; - -static struct acpi_exdump_info acpi_ex_dump_method[8] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"} -}; - -static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, - {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), - "Acquire Depth"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"} -}; - -static struct acpi_exdump_info acpi_ex_dump_region[7] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"}, - {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.handler), "Handler"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"} -}; - -static struct acpi_exdump_info acpi_ex_dump_power[5] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level), - "System Level"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order), - "Resource Order"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.system_notify), - "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.device_notify), - "Device Notify"} -}; - -static struct acpi_exdump_info acpi_ex_dump_processor[7] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.length), "Length"}, - {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify), - "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.device_notify), - "Device Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"} -}; - -static struct acpi_exdump_info acpi_ex_dump_thermal[4] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.system_notify), - "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.device_notify), - "Device Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"} -}; - -static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj), - "Buffer Object"} -}; - -static struct acpi_exdump_info acpi_ex_dump_region_field[3] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"} -}; - -static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj), - "Region Object"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"} -}; - -static struct acpi_exdump_info acpi_ex_dump_index_field[5] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, - {ACPI_EXD_FIELD, 0, NULL}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj), - "Index Object"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"} -}; - -static struct acpi_exdump_info acpi_ex_dump_reference[7] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, - {ACPI_EXD_REFERENCE, 0, NULL} -}; - -static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler), - NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.next), "Next"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.region_list), - "Region List"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.node), "Node"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"} -}; - -static struct acpi_exdump_info acpi_ex_dump_notify[3] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"} -}; - -/* Miscellaneous tables */ - -static struct acpi_exdump_info acpi_ex_dump_common[4] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL}, - {ACPI_EXD_TYPE, 0, NULL}, - {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count), - "Reference Count"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"} -}; - -static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags), - "Field Flags"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width), - "Access Byte Width"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length), - "Bit Length"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset), - "Field Bit Offset"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset), - "Base Byte Offset"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} -}; - -static struct acpi_exdump_info acpi_ex_dump_node[6] = { - {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, - {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, - {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), - "Reference Count"}, - {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, - {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} -}; - -/* Dispatch table, indexed by object type */ - -static struct acpi_exdump_info *acpi_ex_dump_info[] = { - NULL, - acpi_ex_dump_integer, - acpi_ex_dump_string, - acpi_ex_dump_buffer, - acpi_ex_dump_package, - NULL, - acpi_ex_dump_device, - acpi_ex_dump_event, - acpi_ex_dump_method, - acpi_ex_dump_mutex, - acpi_ex_dump_region, - acpi_ex_dump_power, - acpi_ex_dump_processor, - acpi_ex_dump_thermal, - acpi_ex_dump_buffer_field, - NULL, - NULL, - acpi_ex_dump_region_field, - acpi_ex_dump_bank_field, - acpi_ex_dump_index_field, - acpi_ex_dump_reference, - NULL, - NULL, - acpi_ex_dump_notify, - acpi_ex_dump_address_handler, - NULL, - NULL, - NULL -}; - -/******************************************************************************* - * - * FUNCTION: acpi_ex_dump_object - * - * PARAMETERS: obj_desc - Descriptor to dump - * Info - Info table corresponding to this object - * type - * - * RETURN: None - * - * DESCRIPTION: Walk the info table for this object - * - ******************************************************************************/ - -static void -acpi_ex_dump_object(union acpi_operand_object *obj_desc, - struct acpi_exdump_info *info) -{ - u8 *target; - char *name; - u8 count; - - if (!info) { - acpi_os_printf - ("ex_dump_object: Display not implemented for object type %s\n", - acpi_ut_get_object_type_name(obj_desc)); - return; - } - - /* First table entry must contain the table length (# of table entries) */ - - count = info->offset; - - while (count) { - target = ACPI_ADD_PTR(u8, obj_desc, info->offset); - name = info->name; - - switch (info->opcode) { - case ACPI_EXD_INIT: - break; - - case ACPI_EXD_TYPE: - acpi_ex_out_string("Type", - acpi_ut_get_object_type_name - (obj_desc)); - break; - - case ACPI_EXD_UINT8: - - acpi_os_printf("%20s : %2.2X\n", name, *target); - break; - - case ACPI_EXD_UINT16: - - acpi_os_printf("%20s : %4.4X\n", name, - ACPI_GET16(target)); - break; - - case ACPI_EXD_UINT32: - - acpi_os_printf("%20s : %8.8X\n", name, - ACPI_GET32(target)); - break; - - case ACPI_EXD_UINT64: - - acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", - ACPI_FORMAT_UINT64(ACPI_GET64(target))); - break; - - case ACPI_EXD_POINTER: - - acpi_ex_out_pointer(name, - *ACPI_CAST_PTR(void *, target)); - break; - - case ACPI_EXD_ADDRESS: - - acpi_ex_out_address(name, - *ACPI_CAST_PTR - (acpi_physical_address, target)); - break; - - case ACPI_EXD_STRING: - - acpi_ut_print_string(obj_desc->string.pointer, - ACPI_UINT8_MAX); - acpi_os_printf("\n"); - break; - - case ACPI_EXD_BUFFER: - - ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, - obj_desc->buffer.length); - break; - - case ACPI_EXD_PACKAGE: - - /* Dump the package contents */ - - acpi_os_printf("\nPackage Contents:\n"); - acpi_ex_dump_package_obj(obj_desc, 0, 0); - break; - - case ACPI_EXD_FIELD: - - acpi_ex_dump_object(obj_desc, - acpi_ex_dump_field_common); - break; - - case ACPI_EXD_REFERENCE: - - acpi_ex_out_string("Opcode", - (acpi_ps_get_opcode_info - (obj_desc->reference.opcode))-> - name); - acpi_ex_dump_reference_obj(obj_desc); - break; - - default: - acpi_os_printf("**** Invalid table opcode [%X] ****\n", - info->opcode); - return; - } - - info++; - count--; - } -} +acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); +#endif /* ACPI_FUTURE_USAGE */ /******************************************************************************* * @@ -580,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); @@ -686,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); @@ -807,6 +441,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, return; } +#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * * FUNCTION: acpi_ex_out* functions @@ -830,6 +465,11 @@ static void acpi_ex_out_pointer(char *title, void *value) acpi_os_printf("%20s : %p\n", title, value); } +static void acpi_ex_out_integer(char *title, u32 value) +{ + acpi_os_printf("%20s : %.2X\n", title, value); +} + static void acpi_ex_out_address(char *title, acpi_physical_address value) { @@ -842,16 +482,16 @@ static void acpi_ex_out_address(char *title, acpi_physical_address value) /******************************************************************************* * - * FUNCTION: acpi_ex_dump_namespace_node + * FUNCTION: acpi_ex_dump_node * - * PARAMETERS: Node - Descriptor to dump + * PARAMETERS: *Node - Descriptor to dump * Flags - Force display if TRUE * * DESCRIPTION: Dumps the members of the given.Node * ******************************************************************************/ -void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) +void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) { ACPI_FUNCTION_ENTRY(); @@ -866,17 +506,19 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); + acpi_ex_out_integer("Flags", node->flags); + acpi_ex_out_integer("Owner Id", node->owner_id); + acpi_ex_out_integer("Reference Count", node->reference_count); acpi_ex_out_pointer("Attached Object", acpi_ns_get_attached_object(node)); + acpi_ex_out_pointer("child_list", node->child); + acpi_ex_out_pointer("next_peer", node->peer); acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); - - acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), - acpi_ex_dump_node); } /******************************************************************************* * - * FUNCTION: acpi_ex_dump_reference_obj + * FUNCTION: acpi_ex_dump_reference * * PARAMETERS: Object - Descriptor to dump * @@ -884,16 +526,14 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) * ******************************************************************************/ -static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) +static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) { struct acpi_buffer ret_buf; acpi_status status; - ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; - if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { acpi_os_printf("Named Object %p ", obj_desc->reference.node); - + ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_ns_handle_to_pathname(obj_desc->reference.node, &ret_buf); @@ -911,9 +551,9 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) /******************************************************************************* * - * FUNCTION: acpi_ex_dump_package_obj + * FUNCTION: acpi_ex_dump_package * - * PARAMETERS: obj_desc - Descriptor to dump + * PARAMETERS: Object - Descriptor to dump * Level - Indentation Level * Index - Package index for this object * @@ -922,8 +562,7 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) ******************************************************************************/ static void -acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, - u32 level, u32 index) +acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) { u32 i; @@ -969,8 +608,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, acpi_os_printf("[Buffer] Length %.2X = ", obj_desc->buffer.length); if (obj_desc->buffer.length) { - acpi_ut_dump_buffer(ACPI_CAST_PTR - (u8, obj_desc->buffer.pointer), + acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT); } else { @@ -980,19 +618,19 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, 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++) { - acpi_ex_dump_package_obj(obj_desc->package.elements[i], - level + 1, i); + acpi_ex_dump_package(obj_desc->package.elements[i], + level + 1, i); } break; case ACPI_TYPE_LOCAL_REFERENCE: acpi_os_printf("[Object Reference] "); - acpi_ex_dump_reference_obj(obj_desc); + acpi_ex_dump_reference(obj_desc); break; default: @@ -1007,7 +645,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, * * FUNCTION: acpi_ex_dump_object_descriptor * - * PARAMETERS: obj_desc - Descriptor to dump + * PARAMETERS: Object - Descriptor to dump * Flags - Force display if TRUE * * DESCRIPTION: Dumps the members of the object descriptor given. @@ -1032,13 +670,11 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) } if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { - acpi_ex_dump_namespace_node((struct acpi_namespace_node *) - obj_desc, flags); - + acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, + flags); acpi_os_printf("\nAttached Object (%p):\n", ((struct acpi_namespace_node *)obj_desc)-> object); - acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) obj_desc)->object, flags); return_VOID; @@ -1051,18 +687,233 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) return_VOID; } - if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) { - return_VOID; - } - /* Common Fields */ - acpi_ex_dump_object(obj_desc, acpi_ex_dump_common); + acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc)); + acpi_ex_out_integer("Reference Count", + obj_desc->common.reference_count); + acpi_ex_out_integer("Flags", obj_desc->common.flags); + + /* Object-specific Fields */ + + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { + case ACPI_TYPE_INTEGER: + + acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", + ACPI_FORMAT_UINT64(obj_desc->integer.value)); + break; + + case ACPI_TYPE_STRING: + + acpi_ex_out_integer("Length", obj_desc->string.length); + + acpi_os_printf("%20s : %p ", "Pointer", + obj_desc->string.pointer); + acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); + acpi_os_printf("\n"); + break; + + case ACPI_TYPE_BUFFER: + + acpi_ex_out_integer("Length", obj_desc->buffer.length); + acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer); + ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, + obj_desc->buffer.length); + break; + + case ACPI_TYPE_PACKAGE: + + acpi_ex_out_integer("Flags", obj_desc->package.flags); + acpi_ex_out_integer("Elements", obj_desc->package.count); + acpi_ex_out_pointer("Element List", obj_desc->package.elements); + + /* Dump the package contents */ + + acpi_os_printf("\nPackage Contents:\n"); + acpi_ex_dump_package(obj_desc, 0, 0); + break; + + case ACPI_TYPE_DEVICE: + + acpi_ex_out_pointer("Handler", obj_desc->device.handler); + acpi_ex_out_pointer("system_notify", + obj_desc->device.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->device.device_notify); + break; + + case ACPI_TYPE_EVENT: + + acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore); + break; + + case ACPI_TYPE_METHOD: + + acpi_ex_out_integer("param_count", + obj_desc->method.param_count); + acpi_ex_out_integer("Concurrency", + obj_desc->method.concurrency); + acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore); + acpi_ex_out_integer("owner_id", obj_desc->method.owner_id); + acpi_ex_out_integer("aml_length", obj_desc->method.aml_length); + acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start); + break; + + case ACPI_TYPE_MUTEX: + + acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level); + acpi_ex_out_pointer("owner_thread", + obj_desc->mutex.owner_thread); + acpi_ex_out_integer("acquire_depth", + obj_desc->mutex.acquisition_depth); + acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore); + break; + + case ACPI_TYPE_REGION: + + acpi_ex_out_integer("space_id", obj_desc->region.space_id); + acpi_ex_out_integer("Flags", obj_desc->region.flags); + acpi_ex_out_address("Address", obj_desc->region.address); + acpi_ex_out_integer("Length", obj_desc->region.length); + acpi_ex_out_pointer("Handler", obj_desc->region.handler); + acpi_ex_out_pointer("Next", obj_desc->region.next); + break; + + case ACPI_TYPE_POWER: - /* Object-specific fields */ + acpi_ex_out_integer("system_level", + obj_desc->power_resource.system_level); + acpi_ex_out_integer("resource_order", + obj_desc->power_resource.resource_order); + acpi_ex_out_pointer("system_notify", + obj_desc->power_resource.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->power_resource.device_notify); + break; + + case ACPI_TYPE_PROCESSOR: + + acpi_ex_out_integer("Processor ID", + obj_desc->processor.proc_id); + acpi_ex_out_integer("Length", obj_desc->processor.length); + acpi_ex_out_address("Address", + (acpi_physical_address) obj_desc->processor. + address); + acpi_ex_out_pointer("system_notify", + obj_desc->processor.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->processor.device_notify); + acpi_ex_out_pointer("Handler", obj_desc->processor.handler); + break; + + case ACPI_TYPE_THERMAL: + + acpi_ex_out_pointer("system_notify", + obj_desc->thermal_zone.system_notify); + acpi_ex_out_pointer("device_notify", + obj_desc->thermal_zone.device_notify); + acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler); + break; + + case ACPI_TYPE_BUFFER_FIELD: + case ACPI_TYPE_LOCAL_REGION_FIELD: + case ACPI_TYPE_LOCAL_BANK_FIELD: + case ACPI_TYPE_LOCAL_INDEX_FIELD: + + acpi_ex_out_integer("field_flags", + obj_desc->common_field.field_flags); + acpi_ex_out_integer("access_byte_width", + obj_desc->common_field.access_byte_width); + acpi_ex_out_integer("bit_length", + obj_desc->common_field.bit_length); + acpi_ex_out_integer("fld_bit_offset", + obj_desc->common_field. + start_field_bit_offset); + acpi_ex_out_integer("base_byte_offset", + obj_desc->common_field.base_byte_offset); + acpi_ex_out_pointer("parent_node", obj_desc->common_field.node); + + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { + case ACPI_TYPE_BUFFER_FIELD: + acpi_ex_out_pointer("buffer_obj", + obj_desc->buffer_field.buffer_obj); + break; + + case ACPI_TYPE_LOCAL_REGION_FIELD: + acpi_ex_out_pointer("region_obj", + obj_desc->field.region_obj); + break; + + case ACPI_TYPE_LOCAL_BANK_FIELD: + acpi_ex_out_integer("Value", + obj_desc->bank_field.value); + acpi_ex_out_pointer("region_obj", + obj_desc->bank_field.region_obj); + acpi_ex_out_pointer("bank_obj", + obj_desc->bank_field.bank_obj); + break; + + case ACPI_TYPE_LOCAL_INDEX_FIELD: + acpi_ex_out_integer("Value", + obj_desc->index_field.value); + acpi_ex_out_pointer("Index", + obj_desc->index_field.index_obj); + acpi_ex_out_pointer("Data", + obj_desc->index_field.data_obj); + break; + + default: + /* All object types covered above */ + break; + } + break; + + case ACPI_TYPE_LOCAL_REFERENCE: + + acpi_ex_out_integer("target_type", + obj_desc->reference.target_type); + acpi_ex_out_string("Opcode", + (acpi_ps_get_opcode_info + (obj_desc->reference.opcode))->name); + acpi_ex_out_integer("Offset", obj_desc->reference.offset); + acpi_ex_out_pointer("obj_desc", obj_desc->reference.object); + acpi_ex_out_pointer("Node", obj_desc->reference.node); + acpi_ex_out_pointer("Where", obj_desc->reference.where); + + acpi_ex_dump_reference(obj_desc); + break; + + case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: + + acpi_ex_out_integer("space_id", + obj_desc->address_space.space_id); + acpi_ex_out_pointer("Next", obj_desc->address_space.next); + acpi_ex_out_pointer("region_list", + obj_desc->address_space.region_list); + acpi_ex_out_pointer("Node", obj_desc->address_space.node); + acpi_ex_out_pointer("Context", obj_desc->address_space.context); + break; + + case ACPI_TYPE_LOCAL_NOTIFY: + + acpi_ex_out_pointer("Node", obj_desc->notify.node); + acpi_ex_out_pointer("Context", obj_desc->notify.context); + break; + + case ACPI_TYPE_LOCAL_ALIAS: + case ACPI_TYPE_LOCAL_METHOD_ALIAS: + case ACPI_TYPE_LOCAL_EXTRA: + case ACPI_TYPE_LOCAL_DATA: + default: + + acpi_os_printf + ("ex_dump_object_descriptor: Display not implemented for object type %s\n", + acpi_ut_get_object_type_name(obj_desc)); + break; + } - acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]); return_VOID; } +#endif /* ACPI_FUTURE_USAGE */ #endif diff --git a/trunk/drivers/acpi/executer/exfield.c b/trunk/drivers/acpi/executer/exfield.c index 78a76f91a1c9..ab1ba399aa28 100644 --- a/trunk/drivers/acpi/executer/exfield.c +++ b/trunk/drivers/acpi/executer/exfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exfldio.c b/trunk/drivers/acpi/executer/exfldio.c index 9fe27fd04a2f..ba6e08843c29 100644 --- a/trunk/drivers/acpi/executer/exfldio.c +++ b/trunk/drivers/acpi/executer/exfldio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,9 +94,10 @@ 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_REPORT_ERROR(("Needed Region, found type %X (%s)\n", - ACPI_GET_OBJECT_TYPE(rgn_desc), - acpi_ut_get_object_type_name(rgn_desc))); + 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))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -161,14 +162,31 @@ 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_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)); + 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)); } /* * Offset rounded up to next multiple of field width * exceeds region length, indicate an error */ - 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)); + 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)); return_ACPI_STATUS(AE_AML_REGION_LIMIT); } @@ -252,11 +270,12 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, if (ACPI_FAILURE(status)) { if (status == AE_NOT_IMPLEMENTED) { - ACPI_REPORT_ERROR(("Region %s(%X) not implemented\n", - acpi_ut_get_region_name(rgn_desc-> - region. - space_id), - rgn_desc->region.space_id)); + 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)); } else if (status == AE_NOT_EXIST) { ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n", acpi_ut_get_region_name(rgn_desc-> @@ -599,10 +618,11 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Unknown update_rule value: %X\n", - (obj_desc->common_field. - field_flags & - AML_FIELD_UPDATE_RULE_MASK))); + 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))); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } } @@ -657,7 +677,10 @@ 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_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_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)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } @@ -769,7 +792,10 @@ 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_REPORT_ERROR(("Field size %X (bits) is too large for buffer (%X)\n", obj_desc->common_field.bit_length, buffer_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)); return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } diff --git a/trunk/drivers/acpi/executer/exmisc.c b/trunk/drivers/acpi/executer/exmisc.c index 5ad34566738c..a3f4d72bedc9 100644 --- a/trunk/drivers/acpi/executer/exmisc.c +++ b/trunk/drivers/acpi/executer/exmisc.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,6 @@ #include #include #include -#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exmisc") @@ -98,8 +97,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", - obj_desc->reference.opcode)); + ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } break; @@ -114,8 +112,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_REPORT_ERROR(("Invalid descriptor type %X\n", - ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); + ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); return_ACPI_STATUS(AE_TYPE); } @@ -160,58 +157,48 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, union acpi_operand_object **actual_return_desc, struct acpi_walk_state *walk_state) { - acpi_status status; union acpi_operand_object *return_desc; u8 *new_buf; - u8 *end_tag; - acpi_size length0; + u8 *end_tag1; + u8 *end_tag2; acpi_size length1; + acpi_size length2; ACPI_FUNCTION_TRACE("ex_concat_template"); - /* - * Find the end_tag descriptor in each resource template. - * Note: returned pointers point TO the end_tag, not past it. - * - * Compute the length of each resource template - */ - status = acpi_ut_get_resource_end_tag(operand0, &end_tag); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer); + /* Find the end_tags in each resource template */ - status = acpi_ut_get_resource_end_tag(operand1, &end_tag); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + end_tag1 = acpi_ut_get_resource_end_tag(operand0); + end_tag2 = acpi_ut_get_resource_end_tag(operand1); + if (!end_tag1 || !end_tag2) { + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } - /* Include the end_tag in the second template length */ + /* Compute the length of each part */ - length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) + - sizeof(struct aml_resource_end_tag); + length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); + length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ /* Create a new buffer object for the result */ - return_desc = acpi_ut_create_buffer_object(length0 + length1); + return_desc = acpi_ut_create_buffer_object(length1 + length2); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } - /* - * Copy the templates to the new buffer, 0 first, then 1 follows. One - * end_tag descriptor is copied from Operand1. - */ + /* Copy the templates to the new descriptor */ + new_buf = return_desc->buffer.pointer; - ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); - ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); + ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); + ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); - /* Set the end_tag checksum to zero, means "ignore checksum" */ + /* Compute the new checksum */ - new_buf[return_desc->buffer.length - 1] = 0; + new_buf[return_desc->buffer.length - 1] = + acpi_ut_generate_checksum(return_desc->buffer.pointer, + (return_desc->buffer.length - 1)); - /* Return the completed resource template */ + /* Return the completed template descriptor */ *actual_return_desc = return_desc; return_ACPI_STATUS(AE_OK); @@ -242,6 +229,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, union acpi_operand_object *return_desc; char *new_buf; acpi_status status; + acpi_size new_length; ACPI_FUNCTION_TRACE("ex_do_concatenate"); @@ -268,7 +256,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, break; default: - ACPI_REPORT_ERROR(("Invalid object type: %X\n", + ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; } @@ -308,7 +296,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Copy the first integer, LSB first */ - ACPI_MEMCPY(new_buf, &operand0->integer.value, + ACPI_MEMCPY(new_buf, + &operand0->integer.value, acpi_gbl_integer_byte_width); /* Copy the second integer (LSB first) after the first */ @@ -322,11 +311,14 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Result of two Strings is a String */ - return_desc = acpi_ut_create_string_object((acpi_size) - (operand0->string. - length + - local_operand1-> - string.length)); + new_length = (acpi_size) operand0->string.length + + (acpi_size) local_operand1->string.length; + if (new_length > ACPI_MAX_STRING_CONVERSION) { + status = AE_AML_STRING_LIMIT; + goto cleanup; + } + + return_desc = acpi_ut_create_string_object(new_length); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -346,10 +338,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Result of two Buffers is a Buffer */ return_desc = acpi_ut_create_buffer_object((acpi_size) - (operand0->buffer. - length + - local_operand1-> - buffer.length)); + operand0->buffer. + length + + (acpi_size) + local_operand1-> + buffer.length); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -359,8 +352,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Concatenate the buffers */ - ACPI_MEMCPY(new_buf, operand0->buffer.pointer, - operand0->buffer.length); + ACPI_MEMCPY(new_buf, + operand0->buffer.pointer, operand0->buffer.length); ACPI_MEMCPY(new_buf + operand0->buffer.length, local_operand1->buffer.pointer, local_operand1->buffer.length); @@ -370,7 +363,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Invalid object type, should not happen here */ - ACPI_REPORT_ERROR(("Invalid object type: %X\n", + ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n", ACPI_GET_OBJECT_TYPE(operand0))); status = AE_AML_INTERNAL; goto cleanup; @@ -632,8 +625,9 @@ acpi_ex_do_logical_op(u16 opcode, /* Lexicographic compare: compare the data bytes */ - compare = ACPI_MEMCMP(operand0->buffer.pointer, - local_operand1->buffer.pointer, + compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, + (const char *)local_operand1->buffer. + pointer, (length0 > length1) ? length1 : length0); switch (opcode) { diff --git a/trunk/drivers/acpi/executer/exmutex.c b/trunk/drivers/acpi/executer/exmutex.c index 89b8ab79410b..ab47f6d8b5c0 100644 --- a/trunk/drivers/acpi/executer/exmutex.c +++ b/trunk/drivers/acpi/executer/exmutex.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exnames.c b/trunk/drivers/acpi/executer/exnames.c index de3216b6a4fc..239d8473e9a5 100644 --- a/trunk/drivers/acpi/executer/exnames.c +++ b/trunk/drivers/acpi/executer/exnames.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,8 +99,7 @@ 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(("Could not allocate size %d\n", - size_needed)); + ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); return_PTR(NULL); } @@ -168,7 +167,8 @@ 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_REPORT_ERROR(("Invalid leading digit: %c\n", char_buf[0])); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n", + char_buf[0])); return_ACPI_STATUS(AE_CTRL_PENDING); } @@ -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) { /* @@ -211,11 +211,12 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) * the required 4 */ status = AE_AML_BAD_NAME; - ACPI_REPORT_ERROR(("Bad character %02x in name, at %p\n", - *aml_address, aml_address)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Bad character %02x in name, at %p\n", + *aml_address, aml_address)); } - *in_aml_address = ACPI_CAST_PTR(u8, aml_address); + *in_aml_address = (u8 *) aml_address; return_ACPI_STATUS(status); } @@ -411,7 +412,8 @@ 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(("Malformed Name at %p\n", name_string)); + ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n", + name_string)); status = AE_AML_BAD_NAME; } diff --git a/trunk/drivers/acpi/executer/exoparg1.c b/trunk/drivers/acpi/executer/exoparg1.c index bc8837ecb716..97e34542f5e4 100644 --- a/trunk/drivers/acpi/executer/exoparg1.c +++ b/trunk/drivers/acpi/executer/exoparg1.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,8 +111,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -189,8 +188,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -229,8 +227,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) default: /* Unknown opcode */ - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -349,7 +346,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* Check the range of the digit */ if (temp32 > 9) { - ACPI_REPORT_ERROR(("BCD digit too large (not decimal): 0x%X\n", temp32)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "BCD digit too large (not decimal): 0x%X\n", + temp32)); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; @@ -394,7 +393,12 @@ 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_REPORT_ERROR(("Integer too large to convert to BCD: %8.8X%8.8X\n", ACPI_FORMAT_UINT64(operand[0]->integer.value))); + 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))); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } @@ -521,16 +525,15 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) /* These are two obsolete opcodes */ - ACPI_REPORT_ERROR(("%s is obsolete and not implemented\n", - acpi_ps_get_opcode_name(walk_state-> - opcode))); + ACPI_DEBUG_PRINT((ACPI_DB_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(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -636,10 +639,11 @@ 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_REPORT_ERROR(("%s: bad operand(s) %s\n", - acpi_ps_get_opcode_name(walk_state-> - opcode), - acpi_format_exception(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))); goto cleanup; } @@ -738,7 +742,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_REPORT_ERROR(("Operand is not Buf/Int/Str/Pkg - found type %s\n", acpi_ut_get_type_name(type))); + 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))); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -935,7 +941,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown Index target_type %X in obj %p\n", operand[0]->reference.target_type, operand[0])); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown Index target_type %X in obj %p\n", + operand[0]->reference. + target_type, + operand[0])); status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -961,7 +971,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) break; default: - ACPI_REPORT_ERROR(("Unknown opcode in ref(%p) - %X\n", operand[0], operand[0]->reference.opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown opcode in ref(%p) - %X\n", + operand[0], + operand[0]->reference. + opcode)); status = AE_TYPE; goto cleanup; @@ -971,8 +985,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/trunk/drivers/acpi/executer/exoparg2.c b/trunk/drivers/acpi/executer/exoparg2.c index 7c59dda40946..8d70c6beef00 100644 --- a/trunk/drivers/acpi/executer/exoparg2.c +++ b/trunk/drivers/acpi/executer/exoparg2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,7 +111,9 @@ 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_REPORT_ERROR(("Unexpected notify object type [%s]\n", acpi_ut_get_type_name(node->type))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unexpected notify object type [%s]\n", + acpi_ut_get_type_name(node->type))); status = AE_AML_OPERAND_TYPE; break; @@ -155,8 +157,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; } @@ -220,8 +221,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -344,6 +344,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) (length < operand[1]->integer.value) && (operand[0]->buffer.pointer[length])) { length++; + if (length > ACPI_MAX_STRING_CONVERSION) { + status = AE_AML_STRING_LIMIT; + goto cleanup; + } } /* Allocate a new string object */ @@ -354,10 +358,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) goto cleanup; } - /* - * Copy the raw buffer data with no transform. - * (NULL terminated already) - */ + /* Copy the raw buffer data with no transform. NULL terminated already */ + ACPI_MEMCPY(return_desc->string.pointer, operand[0]->buffer.pointer, length); break; @@ -389,7 +391,10 @@ 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_REPORT_ERROR(("Index value (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(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)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -402,7 +407,10 @@ 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_REPORT_ERROR(("Index value (%X%8.8X) beyond end of buffer (%X)\n", ACPI_FORMAT_UINT64(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)); status = AE_AML_BUFFER_LIMIT; goto cleanup; } @@ -434,8 +442,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; break; } @@ -539,8 +546,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/trunk/drivers/acpi/executer/exoparg3.c b/trunk/drivers/acpi/executer/exoparg3.c index a979b338a491..483365777670 100644 --- a/trunk/drivers/acpi/executer/exoparg3.c +++ b/trunk/drivers/acpi/executer/exoparg3.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,8 +119,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -224,8 +223,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) goto cleanup; } - if (buffer) { - /* We have a buffer, copy the portion requested */ + if (length > 0) { + /* Copy the portion requested */ ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, length); @@ -243,8 +242,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/trunk/drivers/acpi/executer/exoparg6.c b/trunk/drivers/acpi/executer/exoparg6.c index 05e7f9b67f29..5dee77139576 100644 --- a/trunk/drivers/acpi/executer/exoparg6.c +++ b/trunk/drivers/acpi/executer/exoparg6.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -234,7 +234,8 @@ 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_REPORT_ERROR(("Match operator out of range\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Match operator out of range\n")); status = AE_AML_OPERAND_VALUE; goto cleanup; } @@ -243,7 +244,10 @@ 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_REPORT_ERROR(("Index (%X%8.8X) beyond package end (%X)\n", ACPI_FORMAT_UINT64(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)); status = AE_AML_PACKAGE_LIMIT; goto cleanup; } @@ -312,8 +316,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) default: - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", - walk_state->opcode)); + ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/trunk/drivers/acpi/executer/exprep.c b/trunk/drivers/acpi/executer/exprep.c index 3bde780c94cf..7476c363e407 100644 --- a/trunk/drivers/acpi/executer/exprep.c +++ b/trunk/drivers/acpi/executer/exprep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -274,8 +274,9 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, default: /* Invalid field access type */ - ACPI_REPORT_ERROR(("Unknown field access type %X\n", access)); - return_UINT32(0); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown field access type %X\n", access)); + return_VALUE(0); } if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { @@ -288,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, } *return_byte_alignment = byte_alignment; - return_UINT32(bit_length); + return_VALUE(bit_length); } /******************************************************************************* @@ -421,13 +422,15 @@ 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_REPORT_ERROR(("Null region_node\n")); + ACPI_DEBUG_PRINT((ACPI_DB_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_REPORT_ERROR(("Needed Region, found type %X (%s)\n", type, acpi_ut_get_type_name(type))); + ACPI_DEBUG_PRINT((ACPI_DB_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/trunk/drivers/acpi/executer/exregion.c b/trunk/drivers/acpi/executer/exregion.c index 82983575cca6..9a2f5bea3afe 100644 --- a/trunk/drivers/acpi/executer/exregion.c +++ b/trunk/drivers/acpi/executer/exregion.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -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; -#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED +#ifndef ACPI_MISALIGNED_TRANSFERS u32 remainder; #endif @@ -103,12 +103,13 @@ acpi_ex_system_memory_space_handler(u32 function, break; default: - ACPI_REPORT_ERROR(("Invalid system_memory width %d\n", - bit_width)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid system_memory width %d\n", + bit_width)); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } -#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED +#ifndef ACPI_MISALIGNED_TRANSFERS /* * Hardware does not support non-aligned data transfers, we must verify * the request. @@ -158,7 +159,10 @@ acpi_ex_system_memory_space_handler(u32 function, (void **)&mem_info-> mapped_logical_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X, size %X\n", ACPI_FORMAT_UINT64(address), (u32) window_size)); + 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)); mem_info->mapped_length = 0; return_ACPI_STATUS(status); } @@ -195,20 +199,20 @@ acpi_ex_system_memory_space_handler(u32 function, *value = 0; switch (bit_width) { case 8: - *value = (acpi_integer) ACPI_GET8(logical_addr_ptr); + *value = (acpi_integer) * ((u8 *) logical_addr_ptr); break; case 16: - *value = (acpi_integer) ACPI_GET16(logical_addr_ptr); + *value = (acpi_integer) * ((u16 *) logical_addr_ptr); break; case 32: - *value = (acpi_integer) ACPI_GET32(logical_addr_ptr); + *value = (acpi_integer) * ((u32 *) logical_addr_ptr); break; #if ACPI_MACHINE_WIDTH != 16 case 64: - *value = (acpi_integer) ACPI_GET64(logical_addr_ptr); + *value = (acpi_integer) * ((u64 *) logical_addr_ptr); break; #endif default: @@ -221,20 +225,20 @@ acpi_ex_system_memory_space_handler(u32 function, switch (bit_width) { case 8: - ACPI_SET8(logical_addr_ptr) = (u8) * value; + *(u8 *) logical_addr_ptr = (u8) * value; break; case 16: - ACPI_SET16(logical_addr_ptr) = (u16) * value; + *(u16 *) logical_addr_ptr = (u16) * value; break; case 32: - ACPI_SET32(logical_addr_ptr) = (u32) * value; + *(u32 *) logical_addr_ptr = (u32) * value; break; #if ACPI_MACHINE_WIDTH != 16 case 64: - ACPI_SET64(logical_addr_ptr) = (u64) * value; + *(u64 *) logical_addr_ptr = (u64) * value; break; #endif diff --git a/trunk/drivers/acpi/executer/exresnte.c b/trunk/drivers/acpi/executer/exresnte.c index a5cca7eda210..ff5d8f97e8eb 100644 --- a/trunk/drivers/acpi/executer/exresnte.c +++ b/trunk/drivers/acpi/executer/exresnte.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,7 +122,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, } if (!source_desc) { - ACPI_REPORT_ERROR(("No object attached to node %p\n", node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No object attached to node %p\n", node)); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -134,9 +135,10 @@ 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_REPORT_ERROR(("Object not a Package, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a Package, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -152,9 +154,10 @@ 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_REPORT_ERROR(("Object not a Buffer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a Buffer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -170,9 +173,10 @@ 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_REPORT_ERROR(("Object not a String, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a String, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -185,9 +189,10 @@ 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_REPORT_ERROR(("Object not a Integer, type %s\n", - acpi_ut_get_object_type_name - (source_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Object not a Integer, type %s\n", + acpi_ut_get_object_type_name + (source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -231,8 +236,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_ANY: - ACPI_REPORT_ERROR(("Untyped entry %p, no attached object!\n", - node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Untyped entry %p, no attached object!\n", + node)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ @@ -251,7 +257,12 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, default: /* No named references are allowed here */ - ACPI_REPORT_ERROR(("Unsupported Reference opcode %X (%s)\n", source_desc->reference.opcode, acpi_ps_get_opcode_name(source_desc->reference.opcode))); + 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))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -261,8 +272,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* Default case is for unknown types */ - ACPI_REPORT_ERROR(("Node %p - Unknown object type %X\n", - node, entry_type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Node %p - Unknown object type %X\n", + node, entry_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); diff --git a/trunk/drivers/acpi/executer/exresolv.c b/trunk/drivers/acpi/executer/exresolv.c index ae2d2da00844..97eecbd3242d 100644 --- a/trunk/drivers/acpi/executer/exresolv.c +++ b/trunk/drivers/acpi/executer/exresolv.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_REPORT_ERROR(("Internal - null pointer\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -97,7 +97,8 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, } if (!*stack_ptr) { - ACPI_REPORT_ERROR(("Internal - null pointer\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Internal - null pointer\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } } @@ -227,7 +228,9 @@ 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_REPORT_ERROR(("Attempt to deref an Index to NULL pkg element Idx=%p\n", stack_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Attempt to deref an Index to NULL pkg element Idx=%p\n", + stack_desc)); status = AE_AML_UNINITIALIZED_ELEMENT; } break; @@ -236,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, /* Invalid reference object */ - ACPI_REPORT_ERROR(("Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); + ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); status = AE_AML_INTERNAL; break; } @@ -261,7 +264,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); + ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); status = AE_AML_INTERNAL; break; } @@ -383,10 +386,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", - node, - acpi_ut_get_descriptor_name - (node))); + ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -442,10 +442,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR(("Not a NS node %p [%s]\n", - node, - acpi_ut_get_descriptor_name - (node))); + ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -514,8 +511,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, default: - ACPI_REPORT_ERROR(("Unknown Reference subtype %X\n", - obj_desc->reference.opcode)); + ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } } diff --git a/trunk/drivers/acpi/executer/exresop.c b/trunk/drivers/acpi/executer/exresop.c index 804faebf825c..ff064e79ab90 100644 --- a/trunk/drivers/acpi/executer/exresop.c +++ b/trunk/drivers/acpi/executer/exresop.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_ENTRY(); + ACPI_FUNCTION_NAME("ex_check_object_type"); if (type_needed == ACPI_TYPE_ANY) { /* All types OK, so we don't perform any typechecks */ @@ -95,9 +95,10 @@ acpi_ex_check_object_type(acpi_object_type type_needed, } if (type_needed != this_type) { - 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)); + 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)); return (AE_AML_OPERAND_TYPE); } @@ -150,13 +151,13 @@ acpi_ex_resolve_operands(u16 opcode, arg_types = op_info->runtime_args; if (arg_types == ARGI_INVALID_OPCODE) { - ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", opcode)); + ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); return_ACPI_STATUS(AE_AML_INTERNAL); } 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)); /* @@ -168,8 +169,7 @@ acpi_ex_resolve_operands(u16 opcode, */ while (GET_CURRENT_ARG_TYPE(arg_types)) { if (!stack_ptr || !*stack_ptr) { - ACPI_REPORT_ERROR(("Null stack entry at %p\n", - stack_ptr)); + ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -198,7 +198,9 @@ acpi_ex_resolve_operands(u16 opcode, /* Check for bad acpi_object_type */ if (!acpi_ut_valid_object_type(object_type)) { - ACPI_REPORT_ERROR(("Bad operand object type [%X]\n", object_type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Bad operand object type [%X]\n", + object_type)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -236,7 +238,13 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Operand is a Reference, Unknown Reference Opcode: %X\n", obj_desc->reference.opcode)); + 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)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -247,10 +255,11 @@ acpi_ex_resolve_operands(u16 opcode, /* Invalid descriptor */ - ACPI_REPORT_ERROR(("Invalid descriptor %p [%s]\n", - obj_desc, - acpi_ut_get_descriptor_name - (obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid descriptor %p [%s]\n", + obj_desc, + acpi_ut_get_descriptor_name + (obj_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -408,7 +417,11 @@ 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_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -431,7 +444,11 @@ 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_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -455,7 +472,11 @@ acpi_ex_resolve_operands(u16 opcode, ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -481,7 +502,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -515,7 +539,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_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,7 +566,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Buffer/String/Package/Reference], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + 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)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -558,7 +588,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Buffer/String/Package], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -578,7 +611,10 @@ acpi_ex_resolve_operands(u16 opcode, break; default: - ACPI_REPORT_ERROR(("Needed [Region/region_field], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -620,7 +656,10 @@ acpi_ex_resolve_operands(u16 opcode, break; } - ACPI_REPORT_ERROR(("Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc)); + 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)); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } @@ -630,7 +669,9 @@ acpi_ex_resolve_operands(u16 opcode, /* Unknown type */ - ACPI_REPORT_ERROR(("Internal - Unknown ARGI (required operand) type %X\n", this_arg_type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Internal - Unknown ARGI (required operand) type %X\n", + this_arg_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/trunk/drivers/acpi/executer/exstore.c b/trunk/drivers/acpi/executer/exstore.c index 202ebe1eb957..a7d8eea305c2 100644 --- a/trunk/drivers/acpi/executer/exstore.c +++ b/trunk/drivers/acpi/executer/exstore.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_REPORT_ERROR(("Null parameter\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n")); return_ACPI_STATUS(AE_AML_NO_OPERAND); } @@ -290,7 +290,10 @@ acpi_ex_store(union acpi_operand_object *source_desc, /* Destination is not a Reference object */ - 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_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_DUMP_STACK_ENTRY(source_desc); ACPI_DUMP_STACK_ENTRY(dest_desc); @@ -357,7 +360,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, default: - ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", + ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n", ref_desc->reference.opcode)); ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); @@ -487,7 +490,10 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, /* All other types are invalid */ - ACPI_REPORT_ERROR(("Source must be Integer/Buffer/String type, not %s\n", acpi_ut_get_object_type_name(source_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -497,7 +503,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, break; default: - ACPI_REPORT_ERROR(("Target is not a Package or buffer_field\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Target is not a Package or buffer_field\n")); status = AE_AML_OPERAND_TYPE; break; } diff --git a/trunk/drivers/acpi/executer/exstoren.c b/trunk/drivers/acpi/executer/exstoren.c index 25bbc1d78547..382f63c14ea1 100644 --- a/trunk/drivers/acpi/executer/exstoren.c +++ b/trunk/drivers/acpi/executer/exstoren.c @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -123,7 +123,11 @@ 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_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))); + 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))); status = AE_AML_OPERAND_TYPE; } break; @@ -276,8 +280,9 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, /* * All other types come here. */ - ACPI_REPORT_WARNING(("Store into type %s not implemented\n", - acpi_ut_get_object_type_name(dest_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "Store into type %s not implemented\n", + acpi_ut_get_object_type_name(dest_desc))); status = AE_NOT_IMPLEMENTED; break; diff --git a/trunk/drivers/acpi/executer/exstorob.c b/trunk/drivers/acpi/executer/exstorob.c index 6ab707087750..c4ff654a6697 100644 --- a/trunk/drivers/acpi/executer/exstorob.c +++ b/trunk/drivers/acpi/executer/exstorob.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,7 +71,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, /* We know that source_desc is a buffer by now */ - buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer); + buffer = (u8 *) source_desc->buffer.pointer; length = source_desc->buffer.length; /* @@ -160,7 +160,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, /* We know that source_desc is a string by now */ - buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer); + buffer = (u8 *) source_desc->string.pointer; length = source_desc->string.length; /* diff --git a/trunk/drivers/acpi/executer/exsystem.c b/trunk/drivers/acpi/executer/exsystem.c index 9a3684d3cf87..8a88b841237d 100644 --- a/trunk/drivers/acpi/executer/exsystem.c +++ b/trunk/drivers/acpi/executer/exsystem.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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(("Time parameter is too large (%d)\n", + ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n", how_long)); status = AE_AML_OPERAND_VALUE; } else { diff --git a/trunk/drivers/acpi/executer/exutils.c b/trunk/drivers/acpi/executer/exutils.c index 990c40e0c041..1ee79d8c8f88 100644 --- a/trunk/drivers/acpi/executer/exutils.c +++ b/trunk/drivers/acpi/executer/exutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -200,11 +200,13 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) if (ACPI_SUCCESS(status)) { locked = TRUE; } else { - ACPI_REPORT_ERROR(("Could not acquire Global Lock, %s\n", acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not acquire Global Lock, %s\n", + acpi_format_exception(status))); } } - return_UINT8(locked); + return_VALUE(locked); } /******************************************************************************* @@ -266,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_UINT32(1); + return_VALUE(1); } current_value = value; @@ -280,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) num_digits++; } - return_UINT32(num_digits); + return_VALUE(num_digits); } /******************************************************************************* diff --git a/trunk/drivers/acpi/glue.c b/trunk/drivers/acpi/glue.c index 8daef57b994c..aa993715d644 100644 --- a/trunk/drivers/acpi/glue.c +++ b/trunk/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_RESOURCE_TYPE_ADDRESS16 && - resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && - resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) + if (resource->id != ACPI_RSTYPE_ADDRESS16 && + resource->id != ACPI_RSTYPE_ADDRESS32 && + resource->id != ACPI_RSTYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); if ((address.address_length > 0) && (address.resource_type == ACPI_BUS_NUMBER_RANGE)) - *busnr = address.minimum; + *busnr = address.min_address_range; return AE_OK; } diff --git a/trunk/drivers/acpi/hardware/hwacpi.c b/trunk/drivers/acpi/hardware/hwacpi.c index 5c068cc4f674..1bb3463d7040 100644 --- a/trunk/drivers/acpi/hardware/hwacpi.c +++ b/trunk/drivers/acpi/hardware/hwacpi.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,7 +68,8 @@ acpi_status acpi_hw_initialize(void) /* We must have the ACPI tables by the time we get here */ if (!acpi_gbl_FADT) { - ACPI_REPORT_ERROR(("No FADT is present\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n")); + return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -107,7 +108,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); } @@ -203,18 +204,18 @@ u32 acpi_hw_get_mode(void) * system does not support mode transition. */ if (!acpi_gbl_FADT->smi_cmd) { - return_UINT32(ACPI_SYS_MODE_ACPI); + return_VALUE(ACPI_SYS_MODE_ACPI); } status = acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); if (ACPI_FAILURE(status)) { - return_UINT32(ACPI_SYS_MODE_LEGACY); + return_VALUE(ACPI_SYS_MODE_LEGACY); } if (value) { - return_UINT32(ACPI_SYS_MODE_ACPI); + return_VALUE(ACPI_SYS_MODE_ACPI); } else { - return_UINT32(ACPI_SYS_MODE_LEGACY); + return_VALUE(ACPI_SYS_MODE_LEGACY); } } diff --git a/trunk/drivers/acpi/hardware/hwgpe.c b/trunk/drivers/acpi/hardware/hwgpe.c index d84942d22dd5..5c8e5dfd024e 100644 --- a/trunk/drivers/acpi/hardware/hwgpe.c +++ b/trunk/drivers/acpi/hardware/hwgpe.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/hardware/hwregs.c b/trunk/drivers/acpi/hardware/hwregs.c index b4b50a3d1705..536a7aea80c9 100644 --- a/trunk/drivers/acpi/hardware/hwregs.c +++ b/trunk/drivers/acpi/hardware/hwregs.c @@ -7,7 +7,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -144,8 +144,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) info.parameters = NULL; info.return_object = NULL; - sleep_state_name = - ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); + sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; status = acpi_ns_evaluate_by_name(sleep_state_name, &info); if (ACPI_FAILURE(status)) { @@ -202,7 +201,12 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) } if (ACPI_FAILURE(status)) { - 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_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_ut_remove_reference(info.return_object); @@ -225,11 +229,12 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) { - ACPI_FUNCTION_ENTRY(); + ACPI_FUNCTION_NAME("hw_get_bit_register_info"); if (register_id > ACPI_BITREG_MAX) { - ACPI_REPORT_ERROR(("Invalid bit_register ID: %X\n", - register_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid bit_register ID: %X\n", + register_id)); return (NULL); } @@ -564,7 +569,8 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) break; default: - ACPI_REPORT_ERROR(("Unknown Register ID: %X\n", register_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n", + register_id)); status = AE_BAD_PARAMETER; break; } @@ -759,8 +765,9 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) break; default: - ACPI_REPORT_ERROR(("Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } @@ -829,8 +836,9 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) break; default: - ACPI_REPORT_ERROR(("Unsupported address space: %X\n", - reg->address_space_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported address space: %X\n", + reg->address_space_id)); return (AE_BAD_PARAMETER); } diff --git a/trunk/drivers/acpi/hardware/hwsleep.c b/trunk/drivers/acpi/hardware/hwsleep.c index 992128d71117..34519069050c 100644 --- a/trunk/drivers/acpi/hardware/hwsleep.c +++ b/trunk/drivers/acpi/hardware/hwsleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/hardware/hwtimer.c b/trunk/drivers/acpi/hardware/hwtimer.c index fc10b7cb456f..aff6dc141784 100644 --- a/trunk/drivers/acpi/hardware/hwtimer.c +++ b/trunk/drivers/acpi/hardware/hwtimer.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/motherboard.c b/trunk/drivers/acpi/motherboard.c index 468244147ec1..e928e8c2c6ec 100644 --- a/trunk/drivers/acpi/motherboard.c +++ b/trunk/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_RESOURCE_TYPE_IO) { + if (res->id == ACPI_RSTYPE_IO) { struct acpi_resource_io *io_res = &res->data.io; - if (io_res->minimum != io_res->maximum) + if (io_res->min_base_address != io_res->max_base_address) return_VALUE(AE_OK); if (IS_RESERVED_ADDR - (io_res->minimum, io_res->address_length)) { + (io_res->min_base_address, io_res->range_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - io_res->minimum, - io_res->minimum + - io_res->address_length)); + io_res->min_base_address, + io_res->min_base_address + + io_res->range_length)); requested_res = - request_region(io_res->minimum, - io_res->address_length, "motherboard"); + request_region(io_res->min_base_address, + io_res->range_length, "motherboard"); } - } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) { + } else if (res->id == ACPI_RSTYPE_FIXED_IO) { struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io; if (IS_RESERVED_ADDR - (fixed_io_res->address, fixed_io_res->address_length)) { + (fixed_io_res->base_address, fixed_io_res->range_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n", - fixed_io_res->address, - fixed_io_res->address + - fixed_io_res->address_length)); + fixed_io_res->base_address, + fixed_io_res->base_address + + fixed_io_res->range_length)); requested_res = - request_region(fixed_io_res->address, - fixed_io_res->address_length, + request_region(fixed_io_res->base_address, + fixed_io_res->range_length, "motherboard"); } } else { diff --git a/trunk/drivers/acpi/namespace/nsaccess.c b/trunk/drivers/acpi/namespace/nsaccess.c index c2db93e25b78..edfbe34600f5 100644 --- a/trunk/drivers/acpi/namespace/nsaccess.c +++ b/trunk/drivers/acpi/namespace/nsaccess.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -110,7 +110,10 @@ 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_REPORT_ERROR(("Could not create predefined name %s, %s\n", init_val->name, acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not create predefined name %s, %s\n", + init_val->name, + acpi_format_exception(status))); } /* @@ -121,7 +124,9 @@ acpi_status acpi_ns_root_initialize(void) if (init_val->val) { status = acpi_os_predefined_override(init_val, &val); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not override predefined %s\n", init_val->name)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not override predefined %s\n", + init_val->name)); } if (!val) { @@ -334,10 +339,7 @@ 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(("%p is not a namespace node [%s]\n", - prefix_node, - acpi_ut_get_descriptor_name - (prefix_node))); + ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node))); return_ACPI_STATUS(AE_AML_INTERNAL); } @@ -496,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; @@ -598,7 +600,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", ACPI_CAST_PTR(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", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); } /* diff --git a/trunk/drivers/acpi/namespace/nsalloc.c b/trunk/drivers/acpi/namespace/nsalloc.c index 3db950f5d5a0..cc7a85f8cfe6 100644 --- a/trunk/drivers/acpi/namespace/nsalloc.c +++ b/trunk/drivers/acpi/namespace/nsalloc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -272,8 +272,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) /* Grandchildren should have all been deleted already */ if (child_node->child) { - ACPI_REPORT_ERROR(("Found a grandchild! P=%p C=%p\n", - parent_node, child_node)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Found a grandchild! P=%p C=%p\n", + parent_node, child_node)); } /* Now we can free this child object */ diff --git a/trunk/drivers/acpi/namespace/nsdump.c b/trunk/drivers/acpi/namespace/nsdump.c index 2f0b70e3e881..9faf1d5c86ed 100644 --- a/trunk/drivers/acpi/namespace/nsdump.c +++ b/trunk/drivers/acpi/namespace/nsdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -198,8 +198,7 @@ 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 Object Type %08X\n", - type)); + ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type)); } if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { @@ -213,9 +212,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, /* * Now we can print out the pertinent information */ - acpi_os_printf(" %-12s %p %2.2X ", - acpi_ut_get_type_name(type), this_node, - this_node->owner_id); + acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node); dbg_level = acpi_dbg_level; acpi_dbg_level = 0; diff --git a/trunk/drivers/acpi/namespace/nsdumpdv.c b/trunk/drivers/acpi/namespace/nsdumpdv.c index aff899a935e3..55de883943d6 100644 --- a/trunk/drivers/acpi/namespace/nsdumpdv.c +++ b/trunk/drivers/acpi/namespace/nsdumpdv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nseval.c b/trunk/drivers/acpi/namespace/nseval.c index e3c667072e2f..0191c7d92824 100644 --- a/trunk/drivers/acpi/namespace/nseval.c +++ b/trunk/drivers/acpi/namespace/nseval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -373,7 +373,8 @@ 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_REPORT_ERROR(("No attached method object\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No attached method object\n")); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(AE_NULL_OBJECT); diff --git a/trunk/drivers/acpi/namespace/nsinit.c b/trunk/drivers/acpi/namespace/nsinit.c index 6c117893f301..0a08d2f04a06 100644 --- a/trunk/drivers/acpi/namespace/nsinit.c +++ b/trunk/drivers/acpi/namespace/nsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_REPORT_ERROR(("walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_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_REPORT_ERROR(("walk_namespace failed! %s\n", - acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", + acpi_format_exception(status))); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -289,7 +289,12 @@ acpi_ns_init_one_object(acpi_handle obj_handle, } if (ACPI_FAILURE(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))); + 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))); } /* @@ -331,22 +336,23 @@ acpi_ns_init_one_device(acpi_handle obj_handle, struct acpi_parameter_info pinfo; u32 flags; acpi_status status; - struct acpi_namespace_node *ini_node; - struct acpi_namespace_node *device_node; ACPI_FUNCTION_TRACE("ns_init_one_device"); - device_node = acpi_ns_map_handle_to_node(obj_handle); - if (!device_node) { + pinfo.parameters = NULL; + pinfo.parameter_type = ACPI_PARAM_ARGS; + + pinfo.node = acpi_ns_map_handle_to_node(obj_handle); + if (!pinfo.node) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * We will run _STA/_INI on Devices, Processors and thermal_zones only */ - if ((device_node->type != ACPI_TYPE_DEVICE) && - (device_node->type != ACPI_TYPE_PROCESSOR) && - (device_node->type != ACPI_TYPE_THERMAL)) { + if ((pinfo.node->type != ACPI_TYPE_DEVICE) && + (pinfo.node->type != ACPI_TYPE_PROCESSOR) && + (pinfo.node->type != ACPI_TYPE_THERMAL)) { return_ACPI_STATUS(AE_OK); } @@ -358,70 +364,57 @@ acpi_ns_init_one_device(acpi_handle obj_handle, info->device_count++; /* - * Check if the _INI method exists for this device - - * if _INI does not exist, there is no need to run _STA - * No _INI means device requires no initialization - */ - status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), - device_node, ACPI_TYPE_METHOD, &ini_node); - if (ACPI_FAILURE(status)) { - /* No _INI method found - move on to next device */ - - return_ACPI_STATUS(AE_OK); - } - - /* - * Run _STA to determine if we can run _INI on the device - - * the device must be present before _INI can be run. - * However, _STA is not required - assume device present if no _STA + * Run _STA to determine if we can run _INI on the device. */ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, - device_node, + pinfo.node, METHOD_NAME__STA)); - - pinfo.node = device_node; - pinfo.parameters = NULL; - pinfo.parameter_type = ACPI_PARAM_ARGS; - status = acpi_ut_execute_STA(pinfo.node, &flags); + if (ACPI_FAILURE(status)) { - /* Ignore error and move on to next device */ + if (pinfo.node->type == ACPI_TYPE_DEVICE) { + /* Ignore error and move on to next device */ - return_ACPI_STATUS(AE_OK); - } + return_ACPI_STATUS(AE_OK); + } - if (flags != ACPI_UINT32_MAX) { + /* _STA is not required for Processor or thermal_zone objects */ + } else { info->num_STA++; - } - if (!(flags & ACPI_STA_DEVICE_PRESENT)) { - /* Don't look at children of a not present device */ + if (!(flags & 0x01)) { + /* Don't look at children of a not present device */ - return_ACPI_STATUS(AE_CTRL_DEPTH); + return_ACPI_STATUS(AE_CTRL_DEPTH); + } } /* - * The device is present and _INI exists. Run the _INI method. - * (We already have the _INI node from above) + * The device is present. Run _INI. */ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, pinfo.node, METHOD_NAME__INI)); - - pinfo.node = ini_node; - status = acpi_ns_evaluate_by_handle(&pinfo); + status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); if (ACPI_FAILURE(status)) { - /* Ignore error and move on to next device */ + /* No _INI (AE_NOT_FOUND) means device requires no initialization */ + + if (status != AE_NOT_FOUND) { + /* Ignore error and move on to next device */ #ifdef ACPI_DEBUG_OUTPUT - char *scope_name = acpi_ns_get_external_pathname(ini_node); + char *scope_name = + acpi_ns_get_external_pathname(pinfo.node); - ACPI_REPORT_WARNING(("%s._INI failed: %s\n", - scope_name, - acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", + scope_name, + acpi_format_exception(status))); - ACPI_MEM_FREE(scope_name); + ACPI_MEM_FREE(scope_name); #endif + } + + status = AE_OK; } else { /* Delete any return object (especially if implicit_return is enabled) */ @@ -441,5 +434,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle, acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); } - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/namespace/nsload.c b/trunk/drivers/acpi/namespace/nsload.c index 0b4a866ef5aa..c28849de465a 100644 --- a/trunk/drivers/acpi/namespace/nsload.c +++ b/trunk/drivers/acpi/namespace/nsload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_REPORT_ERROR(("Null AML pointer\n")); + ACPI_DEBUG_PRINT((ACPI_DB_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_REPORT_ERROR(("DSDT is not in memory\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n")); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } diff --git a/trunk/drivers/acpi/namespace/nsnames.c b/trunk/drivers/acpi/namespace/nsnames.c index 411e1f8b11d0..d5e8dea61c27 100644 --- a/trunk/drivers/acpi/namespace/nsnames.c +++ b/trunk/drivers/acpi/namespace/nsnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_ENTRY(); + ACPI_FUNCTION_NAME("ns_build_external_path"); /* Special case for root */ @@ -110,7 +110,9 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, name_buffer[index] = AML_ROOT_PREFIX; if (index != 0) { - ACPI_REPORT_ERROR(("Could not construct pathname; index=%X, size=%X, Path=%s\n", (u32) index, (u32) size, &name_buffer[size])); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not construct pathname; index=%X, size=%X, Path=%s\n", + (u32) index, (u32) size, &name_buffer[size])); } return; @@ -146,7 +148,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) name_buffer = ACPI_MEM_CALLOCATE(size); if (!name_buffer) { - ACPI_REPORT_ERROR(("Allocation failure\n")); + ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n")); return_PTR(NULL); } @@ -239,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/trunk/drivers/acpi/namespace/nsobject.c b/trunk/drivers/acpi/namespace/nsobject.c index 86113093f7b7..fc9be946ebed 100644 --- a/trunk/drivers/acpi/namespace/nsobject.c +++ b/trunk/drivers/acpi/namespace/nsobject.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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(("Null named_obj handle\n")); + ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n")); return_ACPI_STATUS(AE_BAD_PARAMETER); } if (!object && (ACPI_TYPE_ANY != type)) { /* Null object */ - ACPI_REPORT_ERROR(("Null object, but type not ACPI_TYPE_ANY\n")); + ACPI_REPORT_ERROR(("ns_attach_object: 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(("Invalid handle %p [%s]\n", + ACPI_REPORT_ERROR(("ns_attach_object: 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_REPORT_WARNING(("Null Node ptr\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n")); return_PTR(NULL); } diff --git a/trunk/drivers/acpi/namespace/nsparse.c b/trunk/drivers/acpi/namespace/nsparse.c index 232be4303653..433442a9ec74 100644 --- a/trunk/drivers/acpi/namespace/nsparse.c +++ b/trunk/drivers/acpi/namespace/nsparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nssearch.c b/trunk/drivers/acpi/namespace/nssearch.c index f094a2eb8512..50a3ca5470ed 100644 --- a/trunk/drivers/acpi/namespace/nssearch.c +++ b/trunk/drivers/acpi/namespace/nssearch.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,8 +99,8 @@ acpi_ns_search_node(u32 target_name, if (scope_name) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", - scope_name, node, ACPI_CAST_PTR(char, - &target_name), + scope_name, node, + (char *)&target_name, acpi_ut_get_type_name(type))); ACPI_MEM_FREE(scope_name); @@ -131,7 +131,7 @@ acpi_ns_search_node(u32 target_name, */ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", - ACPI_CAST_PTR(char, &target_name), + (char *)&target_name, acpi_ut_get_type_name(next_node-> type), next_node, @@ -160,8 +160,7 @@ acpi_ns_search_node(u32 target_name, ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", - ACPI_CAST_PTR(char, &target_name), - acpi_ut_get_type_name(type), + (char *)&target_name, acpi_ut_get_type_name(type), acpi_ut_get_node_name(node), node, node->child)); return_ACPI_STATUS(AE_NOT_FOUND); @@ -211,14 +210,14 @@ acpi_ns_search_parent_tree(u32 target_name, */ if (!parent_node) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", - ACPI_CAST_PTR(char, &target_name))); + (char *)&target_name)); return_ACPI_STATUS(AE_NOT_FOUND); } if (acpi_ns_local(type)) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] type [%s] must be local to this scope (no parent search)\n", - ACPI_CAST_PTR(char, &target_name), + (char *)&target_name, acpi_ut_get_type_name(type))); return_ACPI_STATUS(AE_NOT_FOUND); } @@ -228,7 +227,7 @@ acpi_ns_search_parent_tree(u32 target_name, ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Searching parent [%4.4s] for [%4.4s]\n", acpi_ut_get_node_name(parent_node), - ACPI_CAST_PTR(char, &target_name))); + (char *)&target_name)); /* * Search parents until target is found or we have backed up to the root @@ -298,15 +297,18 @@ acpi_ns_search_and_enter(u32 target_name, /* Parameter validation */ if (!node || !target_name || !return_node) { - ACPI_REPORT_ERROR(("Null param: Node %p Name %X return_node %p\n", 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")); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Name must consist of printable characters */ if (!acpi_ut_valid_acpi_name(target_name)) { - ACPI_REPORT_ERROR(("Bad character in ACPI Name: %X\n", - target_name)); + ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name)); return_ACPI_STATUS(AE_BAD_CHARACTER); } @@ -358,7 +360,7 @@ acpi_ns_search_and_enter(u32 target_name, if (interpreter_mode == ACPI_IMODE_EXECUTE) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n", - ACPI_CAST_PTR(char, &target_name), node)); + (char *)&target_name, node)); return_ACPI_STATUS(AE_NOT_FOUND); } diff --git a/trunk/drivers/acpi/namespace/nsutils.c b/trunk/drivers/acpi/namespace/nsutils.c index bc779fdd3caf..ebec036423c9 100644 --- a/trunk/drivers/acpi/namespace/nsutils.c +++ b/trunk/drivers/acpi/namespace/nsutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,6 +63,7 @@ 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 * @@ -75,12 +76,14 @@ 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_ut_report_error(module_name, line_number); + acpi_os_printf("%8s-%04d: *** Error: Looking up ", + module_name, line_number); if (lookup_status == AE_BAD_CHARACTER) { /* There is a non-ascii character in the name */ @@ -106,7 +109,7 @@ acpi_ns_report_error(char *module_name, } } - acpi_os_printf("Namespace lookup failure, %s\n", + acpi_os_printf(" in namespace, %s\n", acpi_format_exception(lookup_status)); } @@ -116,9 +119,10 @@ 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 (optional) + * Path - Path to the node * method_status - Execution status * * RETURN: None @@ -130,6 +134,7 @@ 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) @@ -137,16 +142,17 @@ 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("[Could not get node by pathname]"); + acpi_os_printf + ("report_method_error: Could not get node\n"); + return; } } + 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)); } @@ -242,11 +248,11 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) ACPI_FUNCTION_TRACE("ns_get_type"); if (!node) { - ACPI_REPORT_WARNING(("Null Node parameter\n")); - return_UINT32(ACPI_TYPE_ANY); + ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); + return_VALUE(ACPI_TYPE_ANY); } - return_UINT32((acpi_object_type) node->type); + return_VALUE((acpi_object_type) node->type); } /******************************************************************************* @@ -269,11 +275,11 @@ u32 acpi_ns_local(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* Type code out of range */ - ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); - return_UINT32(ACPI_NS_NORMAL); + ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); + return_VALUE(ACPI_NS_NORMAL); } - return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); + return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); } /******************************************************************************* @@ -621,7 +627,7 @@ acpi_ns_externalize_name(u32 internal_name_length, * with internal_name (invalid format). */ if (required_length > internal_name_length) { - ACPI_REPORT_ERROR(("Invalid internal name\n")); + ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n")); return_ACPI_STATUS(AE_BAD_PATHNAME); } @@ -797,11 +803,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) if (!acpi_ut_valid_object_type(type)) { /* type code out of range */ - ACPI_REPORT_WARNING(("Invalid Object Type %X\n", type)); - return_UINT32(ACPI_NS_NORMAL); + ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", + type)); + return_VALUE(ACPI_NS_NORMAL); } - return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); + return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); } /******************************************************************************* diff --git a/trunk/drivers/acpi/namespace/nswalk.c b/trunk/drivers/acpi/namespace/nswalk.c index fcab1e784b81..5f164c0df33b 100644 --- a/trunk/drivers/acpi/namespace/nswalk.c +++ b/trunk/drivers/acpi/namespace/nswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsxfeval.c b/trunk/drivers/acpi/namespace/nsxfeval.c index de13add43efc..c07b046659ff 100644 --- a/trunk/drivers/acpi/namespace/nsxfeval.c +++ b/trunk/drivers/acpi/namespace/nsxfeval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,7 +112,8 @@ acpi_evaluate_object_typed(acpi_handle handle, if (return_buffer->length == 0) { /* Error because caller specifically asked for a return value */ - ACPI_REPORT_ERROR(("No return value\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n")); + return_ACPI_STATUS(AE_NULL_OBJECT); } @@ -124,11 +125,11 @@ acpi_evaluate_object_typed(acpi_handle handle, /* Return object type does not match requested 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))); + 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))); if (must_free) { /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ @@ -235,9 +236,11 @@ acpi_evaluate_object(acpi_handle handle, * qualified names above, this is an error */ if (!pathname) { - ACPI_REPORT_ERROR(("Both Handle and Pathname are NULL\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Both Handle and Pathname are NULL\n")); } else { - ACPI_REPORT_ERROR(("Handle is NULL and Pathname is relative\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Handle is NULL and Pathname is relative\n")); } status = AE_BAD_PARAMETER; @@ -396,7 +399,7 @@ acpi_walk_namespace(acpi_object_type type, /* Parameter validation */ - if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) { + if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) { return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -470,8 +473,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, return (AE_CTRL_DEPTH); } - if (!(flags & ACPI_STA_DEVICE_PRESENT)) { - /* Don't examine children of the device if not present */ + if (!(flags & 0x01)) { + /* Don't return at the device or children of the device if not there */ return (AE_CTRL_DEPTH); } diff --git a/trunk/drivers/acpi/namespace/nsxfname.c b/trunk/drivers/acpi/namespace/nsxfname.c index 853e6d170c96..6b5f8d4481d1 100644 --- a/trunk/drivers/acpi/namespace/nsxfname.c +++ b/trunk/drivers/acpi/namespace/nsxfname.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsxfobj.c b/trunk/drivers/acpi/namespace/nsxfobj.c index a0332595677a..0856d42e6909 100644 --- a/trunk/drivers/acpi/namespace/nsxfobj.c +++ b/trunk/drivers/acpi/namespace/nsxfobj.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index 58e7c47354ee..e3cd0b16031a 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -1058,9 +1058,11 @@ 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. */ -acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) +unsigned long acpi_os_acquire_lock(acpi_handle handle) { unsigned long flags; spin_lock_irqsave((spinlock_t *) handle, flags); @@ -1071,9 +1073,9 @@ acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) * Release a spinlock. See above. */ -void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags) +void acpi_os_release_lock(acpi_handle handle, unsigned long flags) { - spin_unlock_irqrestore((spinlock_t *) handle, (unsigned long) flags); + spin_unlock_irqrestore((spinlock_t *) handle, flags); } #ifndef ACPI_USE_LOCAL_CACHE diff --git a/trunk/drivers/acpi/parser/psargs.c b/trunk/drivers/acpi/parser/psargs.c index 3c37cd0ecd80..5858188f94a6 100644 --- a/trunk/drivers/acpi/parser/psargs.c +++ b/trunk/drivers/acpi/parser/psargs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,6 @@ #include #include #include -#include #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psargs") @@ -63,51 +62,61 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state * * PARAMETERS: parser_state - Current parser state object * - * RETURN: Decoded package length. On completion, the AML pointer points + * RETURN: Decoded package length. On completion, the AML pointer points * past the length byte or bytes. * - * DESCRIPTION: Decode and return a package length field. - * Note: Largest package length is 28 bits, from ACPI specification + * DESCRIPTION: Decode and return a package length field * ******************************************************************************/ static u32 acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) { - u8 *aml = parser_state->aml; - u32 package_length = 0; - acpi_native_uint byte_count; - u8 byte_zero_mask = 0x3F; /* Default [0:5] */ + u32 encoded_length; + u32 length = 0; ACPI_FUNCTION_TRACE("ps_get_next_package_length"); - /* - * Byte 0 bits [6:7] contain the number of additional bytes - * used to encode the package length, either 0,1,2, or 3 - */ - byte_count = (aml[0] >> 6); - parser_state->aml += (byte_count + 1); + encoded_length = (u32) ACPI_GET8(parser_state->aml); + parser_state->aml++; - /* Get bytes 3, 2, 1 as needed */ + switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */ + case 0: /* 1-byte encoding (bits 0-5) */ - while (byte_count) { - /* - * Final bit positions for the package length bytes: - * Byte3->[20:27] - * Byte2->[12:19] - * Byte1->[04:11] - * Byte0->[00:03] - */ - package_length |= (aml[byte_count] << ((byte_count << 3) - 4)); + length = (encoded_length & 0x3F); + break; - byte_zero_mask = 0x0F; /* Use bits [0:3] of byte 0 */ - byte_count--; - } + case 1: /* 2-byte encoding (next byte + bits 0-3) */ + + length = ((ACPI_GET8(parser_state->aml) << 04) | + (encoded_length & 0x0F)); + parser_state->aml++; + break; + + case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */ - /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ + length = ((ACPI_GET8(parser_state->aml + 1) << 12) | + (ACPI_GET8(parser_state->aml) << 04) | + (encoded_length & 0x0F)); + parser_state->aml += 2; + break; + + case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */ + + length = ((ACPI_GET8(parser_state->aml + 2) << 20) | + (ACPI_GET8(parser_state->aml + 1) << 12) | + (ACPI_GET8(parser_state->aml) << 04) | + (encoded_length & 0x0F)); + parser_state->aml += 3; + break; + + default: + + /* Can't get here, only 2 bits / 4 cases */ + break; + } - package_length |= (aml[0] & byte_zero_mask); - return_UINT32(package_length); + return_VALUE(length); } /******************************************************************************* @@ -126,15 +135,16 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) { u8 *start = parser_state->aml; - u32 package_length; + acpi_native_uint length; ACPI_FUNCTION_TRACE("ps_get_next_package_end"); - /* Function below updates parser_state->Aml */ + /* Function below changes parser_state->Aml */ - package_length = acpi_ps_get_next_package_length(parser_state); + length = + (acpi_native_uint) acpi_ps_get_next_package_length(parser_state); - return_PTR(start + package_length); /* end of package */ + return_PTR(start + length); /* end of package */ } /******************************************************************************* @@ -159,15 +169,17 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) ACPI_FUNCTION_TRACE("ps_get_next_namestring"); - /* Point past any namestring prefix characters (backslash or carat) */ + /* Handle multiple prefix characters */ + + while (acpi_ps_is_prefix_char(ACPI_GET8(end))) { + /* Include prefix '\\' or '^' */ - while (acpi_ps_is_prefix_char(*end)) { end++; } - /* Decode the path prefix character */ + /* Decode the path */ - switch (*end) { + switch (ACPI_GET8(end)) { case 0: /* null_name */ @@ -187,9 +199,9 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) case AML_MULTI_NAME_PREFIX_OP: - /* Multiple name segments, 4 chars each, count in next byte */ + /* Multiple name segments, 4 chars each */ - end += 2 + (*(end + 1) * ACPI_NAME_SIZE); + end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE); break; default: @@ -200,7 +212,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) break; } - parser_state->aml = end; + parser_state->aml = (u8 *) end; return_PTR((char *)start); } @@ -212,7 +224,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) * Arg - Where the namepath will be stored * arg_count - If the namepath points to a control method * the method's argument is returned here. - * possible_method_call - Whether the namepath can possibly be the + * method_call - Whether the namepath can possibly be the * start of a method call * * RETURN: Status @@ -228,11 +240,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) acpi_status acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, struct acpi_parse_state *parser_state, - union acpi_parse_object *arg, u8 possible_method_call) + union acpi_parse_object *arg, u8 method_call) { char *path; union acpi_parse_object *name_op; - acpi_status status; + acpi_status status = AE_OK; union acpi_operand_object *method_desc; struct acpi_namespace_node *node; union acpi_generic_state scope_info; @@ -240,127 +252,115 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, ACPI_FUNCTION_TRACE("ps_get_next_namepath"); path = acpi_ps_get_next_namestring(parser_state); - acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); - - /* Null path case is allowed, just exit */ - - if (!path) { - arg->common.value.name = path; - return_ACPI_STATUS(AE_OK); - } - - /* Setup search scope info */ - scope_info.scope.node = NULL; - node = parser_state->start_node; - if (node) { - scope_info.scope.node = node; - } + /* Null path case is allowed */ - /* - * Lookup the name in the internal namespace. We don't want to add - * anything new to the namespace here, however, so we use MODE_EXECUTE. - * Allow searching of the parent tree, but don't open a new scope - - * we just want to lookup the object (must be mode EXECUTE to perform - * the upsearch) - */ - status = - acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &node); - - /* - * If this name is a control method invocation, we must - * setup the method call - */ - if (ACPI_SUCCESS(status) && - possible_method_call && (node->type == ACPI_TYPE_METHOD)) { - /* This name is actually a control method invocation */ - - method_desc = acpi_ns_get_attached_object(node); - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "Control Method - %p Desc %p Path=%p\n", node, - method_desc, path)); - - name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); - if (!name_op) { - return_ACPI_STATUS(AE_NO_MEMORY); + if (path) { + /* + * Lookup the name in the internal namespace + */ + scope_info.scope.node = NULL; + node = parser_state->start_node; + if (node) { + scope_info.scope.node = node; } - /* Change Arg into a METHOD CALL and attach name to it */ - - acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); - name_op->common.value.name = path; - - /* Point METHODCALL/NAME to the METHOD Node */ - - name_op->common.node = node; - acpi_ps_append_arg(arg, name_op); + /* + * Lookup object. We don't want to add anything new to the namespace + * here, however. So we use MODE_EXECUTE. Allow searching of the + * parent tree, but don't open a new scope -- we just want to lookup the + * object (MUST BE mode EXECUTE to perform upsearch) + */ + status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | + ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); + if (ACPI_SUCCESS(status) && method_call) { + if (node->type == ACPI_TYPE_METHOD) { + /* This name is actually a control method invocation */ + + method_desc = acpi_ns_get_attached_object(node); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Control Method - %p Desc %p Path=%p\n", + node, method_desc, path)); + + name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); + if (!name_op) { + return_ACPI_STATUS(AE_NO_MEMORY); + } - if (!method_desc) { - ACPI_REPORT_ERROR(("Control Method %p has no attached object\n", node)); - return_ACPI_STATUS(AE_AML_INTERNAL); - } + /* Change arg into a METHOD CALL and attach name to it */ - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "Control Method - %p Args %X\n", - node, method_desc->method.param_count)); + acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); + name_op->common.value.name = path; - /* Get the number of arguments to expect */ + /* Point METHODCALL/NAME to the METHOD Node */ - walk_state->arg_count = method_desc->method.param_count; - return_ACPI_STATUS(AE_OK); - } + name_op->common.node = node; + acpi_ps_append_arg(arg, name_op); - /* - * Special handling if the name was not found during the lookup - - * some not_found cases are allowed - */ - if (status == AE_NOT_FOUND) { - /* 1) not_found is ok during load pass 1/2 (allow forward references) */ + if (!method_desc) { + ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); + return_ACPI_STATUS(AE_AML_INTERNAL); + } - if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != - ACPI_PARSE_EXECUTE) { - status = AE_OK; - } + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "Control Method - %p Args %X\n", + node, + method_desc->method. + param_count)); - /* 2) not_found during a cond_ref_of(x) is ok by definition */ + /* Get the number of arguments to expect */ - else if (walk_state->op->common.aml_opcode == - AML_COND_REF_OF_OP) { - status = AE_OK; - } + walk_state->arg_count = + method_desc->method.param_count; + return_ACPI_STATUS(AE_OK); + } - /* - * 3) not_found while building a Package is ok at this point, we - * may flag as an error later if slack mode is not enabled. - * (Some ASL code depends on allowing this behavior) - */ - else if ((arg->common.parent) && - ((arg->common.parent->common.aml_opcode == - AML_PACKAGE_OP) - || (arg->common.parent->common.aml_opcode == - AML_VAR_PACKAGE_OP))) { - status = AE_OK; + /* + * Else this is normal named object reference. + * Just init the NAMEPATH object with the pathname. + * (See code below) + */ } - } - - /* Final exception check (may have been changed from code above) */ - - if (ACPI_FAILURE(status)) { - ACPI_REPORT_NSERROR(path, status); - if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE) { - /* Report a control method execution error */ - - status = acpi_ds_method_error(status, walk_state); + if (ACPI_FAILURE(status)) { + /* + * 1) Any error other than NOT_FOUND is always severe + * 2) NOT_FOUND is only important if we are executing a method. + * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok. + */ + if ((((walk_state-> + parse_flags & ACPI_PARSE_MODE_MASK) == + ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND) + && (walk_state->op->common.aml_opcode != + AML_COND_REF_OF_OP)) + || (status != AE_NOT_FOUND)) { + ACPI_REPORT_NSERROR(path, status); + + acpi_os_printf + ("search_node %p start_node %p return_node %p\n", + scope_info.scope.node, + parser_state->start_node, node); + + } else { + /* + * We got a NOT_FOUND during table load or we encountered + * a cond_ref_of(x) where the target does not exist. + * Either case is ok + */ + status = AE_OK; + } } } - /* Save the namepath */ - + /* + * Regardless of success/failure above, + * Just initialize the Op with the pathname. + */ + acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); arg->common.value.name = path; + return_ACPI_STATUS(status); } @@ -382,63 +382,59 @@ void acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, u32 arg_type, union acpi_parse_object *arg) { - u32 length; - u16 opcode; - u8 *aml = parser_state->aml; ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); switch (arg_type) { case ARGP_BYTEDATA: - /* Get 1 byte from the AML stream */ - - opcode = AML_BYTE_OP; - arg->common.value.integer = (acpi_integer) * aml; - length = 1; + acpi_ps_init_op(arg, AML_BYTE_OP); + arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml); + parser_state->aml++; break; case ARGP_WORDDATA: + acpi_ps_init_op(arg, AML_WORD_OP); + /* Get 2 bytes from the AML stream */ - opcode = AML_WORD_OP; - ACPI_MOVE_16_TO_64(&arg->common.value.integer, aml); - length = 2; + ACPI_MOVE_16_TO_32(&arg->common.value.integer, + parser_state->aml); + parser_state->aml += 2; break; case ARGP_DWORDDATA: + acpi_ps_init_op(arg, AML_DWORD_OP); + /* Get 4 bytes from the AML stream */ - opcode = AML_DWORD_OP; - ACPI_MOVE_32_TO_64(&arg->common.value.integer, aml); - length = 4; + ACPI_MOVE_32_TO_32(&arg->common.value.integer, + parser_state->aml); + parser_state->aml += 4; break; case ARGP_QWORDDATA: + acpi_ps_init_op(arg, AML_QWORD_OP); + /* Get 8 bytes from the AML stream */ - opcode = AML_QWORD_OP; - ACPI_MOVE_64_TO_64(&arg->common.value.integer, aml); - length = 8; + ACPI_MOVE_64_TO_64(&arg->common.value.integer, + parser_state->aml); + parser_state->aml += 8; break; case ARGP_CHARLIST: - /* Get a pointer to the string, point past the string */ - - opcode = AML_STRING_OP; - arg->common.value.string = ACPI_CAST_PTR(char, aml); + acpi_ps_init_op(arg, AML_STRING_OP); + arg->common.value.string = (char *)parser_state->aml; - /* Find the null terminator */ - - length = 0; - while (aml[length]) { - length++; + while (ACPI_GET8(parser_state->aml) != '\0') { + parser_state->aml++; } - length++; + parser_state->aml++; break; case ARGP_NAME: @@ -447,16 +443,14 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); arg->common.value.name = acpi_ps_get_next_namestring(parser_state); - return_VOID; + break; default: ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); - return_VOID; + break; } - acpi_ps_init_op(arg, opcode); - parser_state->aml += length; return_VOID; } @@ -546,7 +540,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state * access_type is first operand, access_attribute is second */ field->common.value.integer = - (((u32) ACPI_GET8(parser_state->aml) << 8)); + (ACPI_GET8(parser_state->aml) << 8); parser_state->aml++; field->common.value.integer |= ACPI_GET8(parser_state->aml); parser_state->aml++; diff --git a/trunk/drivers/acpi/parser/psloop.c b/trunk/drivers/acpi/parser/psloop.c index c66029b890b1..088d33999d90 100644 --- a/trunk/drivers/acpi/parser/psloop.c +++ b/trunk/drivers/acpi/parser/psloop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -123,10 +123,16 @@ 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_REPORT_ERROR(("Invoked method did not return a value, %s\n", acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invoked method did not return a value, %s\n", + acpi_format_exception + (status))); } - ACPI_REPORT_ERROR(("get_predicate Failed, %s\n", acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "get_predicate Failed, %s\n", + acpi_format_exception + (status))); return_ACPI_STATUS(status); } @@ -184,7 +190,11 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) /* The opcode is unrecognized. Just skip unknown opcodes */ - 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_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_DUMP_BUFFER(parser_state->aml, 128); @@ -271,7 +281,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->descending_callback(walk_state, &op); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("During name lookup/catalog, %s\n", acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "During name lookup/catalog, %s\n", + acpi_format_exception + (status))); goto close_this_op; } @@ -691,15 +704,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types, &walk_state->arg_count); - - if (op->common.aml_opcode != AML_WHILE_OP) { - status2 = - acpi_ds_result_stack_pop - (walk_state); - if (ACPI_FAILURE(status2)) { - return_ACPI_STATUS(status2); - } - } } /* Close this iteration of the While loop */ diff --git a/trunk/drivers/acpi/parser/psopcode.c b/trunk/drivers/acpi/parser/psopcode.c index 11d6351ab8b2..229ae86afe8b 100644 --- a/trunk/drivers/acpi/parser/psopcode.c +++ b/trunk/drivers/acpi/parser/psopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_EXEC, + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode)); return (&acpi_gbl_aml_op_info[_UNK]); diff --git a/trunk/drivers/acpi/parser/psparse.c b/trunk/drivers/acpi/parser/psparse.c index 3b540fe17a0c..76d4d640d83c 100644 --- a/trunk/drivers/acpi/parser/psparse.c +++ b/trunk/drivers/acpi/parser/psparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -333,6 +333,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, switch (callback_status) { case AE_CTRL_TERMINATE: + /* * A control method was terminated via a RETURN statement. * The walk of this method is complete. @@ -345,19 +346,13 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, parser_state->aml = walk_state->aml_last_while; walk_state->control_state->common.value = FALSE; - status = acpi_ds_result_stack_pop(walk_state); - if (ACPI_SUCCESS(status)) { - status = AE_CTRL_BREAK; - } + status = AE_CTRL_BREAK; break; case AE_CTRL_CONTINUE: parser_state->aml = walk_state->aml_last_while; - status = acpi_ds_result_stack_pop(walk_state); - if (ACPI_SUCCESS(status)) { - status = AE_CTRL_CONTINUE; - } + status = AE_CTRL_CONTINUE; break; case AE_CTRL_PENDING: @@ -374,18 +369,16 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, #endif case AE_CTRL_TRUE: + /* * Predicate of an IF was true, and we are at the matching ELSE. * Just close out this package */ parser_state->aml = acpi_ps_get_next_package_end(parser_state); - status = acpi_ds_result_stack_pop(walk_state); - if (ACPI_SUCCESS(status)) { - status = AE_CTRL_PENDING; - } break; case AE_CTRL_FALSE: + /* * Either an IF/WHILE Predicate was false or we encountered a BREAK * opcode. In both cases, we do not execute the rest of the @@ -510,23 +503,22 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } else if (status == AE_CTRL_TERMINATE) { status = AE_OK; } else if ((status != AE_OK) && (walk_state->method_desc)) { - /* Either the method parse or actual execution failed */ + ACPI_REPORT_METHOD_ERROR("Method execution failed", + walk_state->method_node, NULL, + status); + + /* Ensure proper cleanup */ - ACPI_REPORT_MTERROR("Method parse/execution failed", - walk_state->method_node, NULL, - status); + walk_state->parse_flags |= ACPI_PARSE_EXECUTE; /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && (!walk_state->method_desc->method.semaphore)) { /* - * Method tried to create an object twice. The probable cause is - * that the method cannot handle reentrancy. - * - * The method is marked not_serialized, but it tried to create + * This method is marked not_serialized, but it tried to create * a named object, causing the second thread entrance to fail. - * Workaround this problem by marking the method permanently + * We will workaround this by marking the method permanently * as Serialized. */ walk_state->method_desc->method.method_flags |= @@ -544,22 +536,15 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) acpi_ds_scope_stack_clear(walk_state); /* - * If we just returned from the execution of a control method or if we - * encountered an error during the method parse phase, there's lots of - * cleanup to do + * If we just returned from the execution of a control method, + * there's lots of cleanup to do */ - if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == - ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { + if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == + ACPI_PARSE_EXECUTE) { if (walk_state->method_desc) { /* Decrement the thread count on the method parse tree */ - if (walk_state->method_desc->method. - thread_count) { - walk_state->method_desc->method. - thread_count--; - } else { - ACPI_REPORT_ERROR(("Invalid zero thread count in method\n")); - } + walk_state->method_desc->method.thread_count--; } acpi_ds_terminate_control_method(walk_state); @@ -568,6 +553,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) /* Delete this walk state and all linked control states */ acpi_ps_cleanup_scope(&walk_state->parser_state); + previous_walk_state = walk_state; ACPI_DEBUG_PRINT((ACPI_DB_PARSE, diff --git a/trunk/drivers/acpi/parser/psscope.c b/trunk/drivers/acpi/parser/psscope.c index bc6047caccd9..1c953b6f1af1 100644 --- a/trunk/drivers/acpi/parser/psscope.c +++ b/trunk/drivers/acpi/parser/psscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/parser/pstree.c b/trunk/drivers/acpi/parser/pstree.c index d387e2b01dbb..f0e755884eea 100644 --- a/trunk/drivers/acpi/parser/pstree.c +++ b/trunk/drivers/acpi/parser/pstree.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,8 +132,7 @@ 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(("Invalid AML Opcode: 0x%2.2X\n", - op->common.aml_opcode)); + ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode)); return; } diff --git a/trunk/drivers/acpi/parser/psutils.c b/trunk/drivers/acpi/parser/psutils.c index 3e07cb9cb748..2075efbb4324 100644 --- a/trunk/drivers/acpi/parser/psutils.c +++ b/trunk/drivers/acpi/parser/psutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/parser/pswalk.c b/trunk/drivers/acpi/parser/pswalk.c index 06f05bfd7612..08f2321b6ded 100644 --- a/trunk/drivers/acpi/parser/pswalk.c +++ b/trunk/drivers/acpi/parser/pswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/parser/psxface.c b/trunk/drivers/acpi/parser/psxface.c index 2dd48cbb7c02..4dcbd443160e 100644 --- a/trunk/drivers/acpi/parser/psxface.c +++ b/trunk/drivers/acpi/parser/psxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,145 +50,11 @@ 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 = *ACPI_CAST_PTR(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 @@ -238,10 +104,6 @@ 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 @@ -267,10 +129,6 @@ 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/trunk/drivers/acpi/pci_irq.c b/trunk/drivers/acpi/pci_irq.c index 726dda1fce1c..09567c2edcfb 100644 --- a/trunk/drivers/acpi/pci_irq.c +++ b/trunk/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 *triggering, int *polarity, char **link) + int *edge_level, int *active_high_low, 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, triggering, - polarity, link); + entry->link.index, edge_level, + active_high_low, 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; - *triggering = ACPI_LEVEL_SENSITIVE; - *polarity = ACPI_ACTIVE_LOW; + *edge_level = ACPI_LEVEL_SENSITIVE; + *active_high_low = 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 *triggering, int *polarity, char **link) + int *edge_level, int *active_high_low, char **link) { int irq; @@ -307,8 +307,8 @@ static int acpi_pci_irq_lookup(struct pci_bus *bus, int device, int pin, - int *triggering, - int *polarity, char **link, irq_lookup_func func) + int *edge_level, + int *active_high_low, 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, triggering, polarity, link); + ret = func(entry, edge_level, active_high_low, 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 *triggering, - int *polarity, char **link, irq_lookup_func func) + int *edge_level, + int *active_high_low, 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, triggering, polarity, + pin, edge_level, active_high_low, link, func); } @@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) { int irq = 0; u8 pin = 0; - int triggering = ACPI_LEVEL_SENSITIVE; - int polarity = ACPI_ACTIVE_LOW; + int edge_level = ACPI_LEVEL_SENSITIVE; + int active_high_low = 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, - &triggering, &polarity, &link, + &edge_level, &active_high_low, &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, &triggering, - &polarity, &link, + irq = acpi_pci_irq_derive(dev, pin, &edge_level, + &active_high_low, &link, acpi_pci_allocate_irq); /* @@ -463,7 +463,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) } } - rc = acpi_register_gsi(irq, triggering, polarity); + rc = acpi_register_gsi(irq, edge_level, active_high_low); 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, - (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", - (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); + (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", + (active_high_low == 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 triggering = ACPI_LEVEL_SENSITIVE; - int polarity = ACPI_ACTIVE_LOW; + int edge_level = ACPI_LEVEL_SENSITIVE; + int active_high_low = 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, - &triggering, &polarity, NULL, + &edge_level, &active_high_low, 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, - &triggering, &polarity, NULL, + &edge_level, &active_high_low, NULL, acpi_pci_free_irq); if (gsi < 0) return_VOID; diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index 07bc6dfe662b..78927c0f1551 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/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 triggering; /* All IRQs */ - u8 polarity; /* All IRQs */ + u8 edge_level; /* All IRQs */ + u8 active_high_low; /* All IRQs */ u8 resource_type; u8 possible_count; u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; @@ -108,19 +108,19 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); - switch (resource->type) { - case ACPI_RESOURCE_TYPE_START_DEPENDENT: + switch (resource->id) { + case ACPI_RSTYPE_START_DPF: return_ACPI_STATUS(AE_OK); - case ACPI_RESOURCE_TYPE_IRQ: + case ACPI_RSTYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->interrupt_count) { + if (!p || !p->number_of_interrupts) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank IRQ resource\n")); return_ACPI_STATUS(AE_OK); } for (i = 0; - (i < p->interrupt_count + (i < p->number_of_interrupts && 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.triggering = p->triggering; - link->irq.polarity = p->polarity; - link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ; + link->irq.edge_level = p->edge_level; + link->irq.active_high_low = p->active_high_low; + link->irq.resource_type = ACPI_RSTYPE_IRQ; break; } - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + case ACPI_RSTYPE_EXT_IRQ: { - struct acpi_resource_extended_irq *p = + struct acpi_resource_ext_irq *p = &resource->data.extended_irq; - if (!p || !p->interrupt_count) { + if (!p || !p->number_of_interrupts) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank EXT IRQ resource\n")); return_ACPI_STATUS(AE_OK); } for (i = 0; - (i < p->interrupt_count + (i < p->number_of_interrupts && 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.triggering = p->triggering; - link->irq.polarity = p->polarity; - link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; + link->irq.edge_level = p->edge_level; + link->irq.active_high_low = p->active_high_low; + link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; break; } default: @@ -201,11 +201,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); - switch (resource->type) { - case ACPI_RESOURCE_TYPE_IRQ: + switch (resource->id) { + case ACPI_RSTYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; - if (!p || !p->interrupt_count) { + if (!p || !p->number_of_interrupts) { /* * 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_RESOURCE_TYPE_EXTENDED_IRQ: + case ACPI_RSTYPE_EXT_IRQ: { - struct acpi_resource_extended_irq *p = + struct acpi_resource_ext_irq *p = &resource->data.extended_irq; - if (!p || !p->interrupt_count) { + if (!p || !p->number_of_interrupts) { /* * extended IRQ descriptors must * return at least 1 IRQ @@ -233,10 +233,8 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) *irq = p->interrupts[0]; break; } - break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type)); - case ACPI_RESOURCE_TYPE_END_TAG: + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource isn't an IRQ\n")); return_ACPI_STATUS(AE_OK); } return_ACPI_STATUS(AE_CTRL_TERMINATE); @@ -327,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_RESOURCE_TYPE_IRQ: - resource->res.type = ACPI_RESOURCE_TYPE_IRQ; + case ACPI_RSTYPE_IRQ: + resource->res.id = ACPI_RSTYPE_IRQ; resource->res.length = sizeof(struct acpi_resource); - 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 = + 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 = ACPI_EXCLUSIVE; else - resource->res.data.irq.sharable = ACPI_SHARED; - resource->res.data.irq.interrupt_count = 1; + resource->res.data.irq.shared_exclusive = ACPI_SHARED; + resource->res.data.irq.number_of_interrupts = 1; resource->res.data.irq.interrupts[0] = irq; break; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; + case ACPI_RSTYPE_EXT_IRQ: + resource->res.id = ACPI_RSTYPE_EXT_IRQ; resource->res.length = sizeof(struct acpi_resource); resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER; - 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 = + 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 = ACPI_EXCLUSIVE; else - resource->res.data.irq.sharable = ACPI_SHARED; - resource->res.data.extended_irq.interrupt_count = 1; + resource->res.data.irq.shared_exclusive = ACPI_SHARED; + resource->res.data.extended_irq.number_of_interrupts = 1; resource->res.data.extended_irq.interrupts[0] = irq; /* ignore resource_source, it's optional */ break; @@ -366,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) goto end; } - resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; + resource->end.id = ACPI_RSTYPE_END_TAG; /* Attempt to set the resource */ status = acpi_set_current_resources(link->handle, &buffer); @@ -615,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 *triggering, int *polarity, char **name) + int *edge_level, int *active_high_low, char **name) { int result = 0; struct acpi_device *device = NULL; @@ -655,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle, link->refcnt++; up(&acpi_link_lock); - if (triggering) - *triggering = link->irq.triggering; - if (polarity) - *polarity = link->irq.polarity; + if (edge_level) + *edge_level = link->irq.edge_level; + if (active_high_low) + *active_high_low = link->irq.active_high_low; if (name) *name = acpi_device_bid(link->device); ACPI_DEBUG_PRINT((ACPI_DB_INFO, diff --git a/trunk/drivers/acpi/pci_root.c b/trunk/drivers/acpi/pci_root.c index 4c313eab6313..0fd9988c283d 100644 --- a/trunk/drivers/acpi/pci_root.c +++ b/trunk/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_RESOURCE_TYPE_ADDRESS16 && - resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && - resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) + if (resource->id != ACPI_RSTYPE_ADDRESS16 && + resource->id != ACPI_RSTYPE_ADDRESS32 && + resource->id != ACPI_RSTYPE_ADDRESS64) return AE_OK; acpi_resource_to_address64(resource, &address); if ((address.address_length > 0) && (address.resource_type == ACPI_BUS_NUMBER_RANGE)) - *busnr = address.minimum; + *busnr = address.min_address_range; return AE_OK; } diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 807b0df308f1..552420e1f890 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -95,22 +95,57 @@ static int set_max_cstate(struct dmi_system_id *id) } static struct dmi_system_id __initdata processor_power_dmi_table[] = { - {set_max_cstate, "IBM ThinkPad R40e", { - DMI_MATCH(DMI_BIOS_VENDOR, - "IBM"), - DMI_MATCH(DMI_BIOS_VERSION, - "1SET60WW")}, - (void *)1}, - {set_max_cstate, "Medion 41700", { - DMI_MATCH(DMI_BIOS_VENDOR, - "Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION, - "R01-A1J")}, (void *)1}, - {set_max_cstate, "Clevo 5600D", { - DMI_MATCH(DMI_BIOS_VENDOR, - "Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION, - "SHE845M0.86C.0013.D.0302131307")}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET43WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET45WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET47WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET50WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET52WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET55WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET56WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET59WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET61WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET62WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET64WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET65WW") }, (void*)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET68WW") }, (void*)1}, + { set_max_cstate, "Medion 41700", { + DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), + DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J")}, (void *)1}, + { set_max_cstate, "Clevo 5600D", { + DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), + DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")}, (void *)2}, {}, }; diff --git a/trunk/drivers/acpi/resources/Makefile b/trunk/drivers/acpi/resources/Makefile index 8de4f69dfa09..2130b74170c3 100644 --- a/trunk/drivers/acpi/resources/Makefile +++ b/trunk/drivers/acpi/resources/Makefile @@ -2,7 +2,7 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ +obj-y := rsaddr.o rscreate.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/trunk/drivers/acpi/resources/rsaddr.c b/trunk/drivers/acpi/resources/rsaddr.c index 8fa3213ce000..23b54baa0cb2 100644 --- a/trunk/drivers/acpi/resources/rsaddr.c +++ b/trunk/drivers/acpi/resources/rsaddr.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,334 +47,1072 @@ #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); + /******************************************************************************* * - * acpi_rs_convert_address16 - All WORD (16-bit) address resources + * FUNCTION: acpi_rs_decode_general_flags + * + * PARAMETERS: Resource - Address resource data struct + * Flags - Actual flag byte + * + * RETURN: Decoded flag bits in resource struct + * + * DESCRIPTION: Decode a general flag byte to an address resource struct * ******************************************************************************/ -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)}, - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16, - sizeof(struct aml_resource_address16), - 0}, +static void +acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) +{ + ACPI_FUNCTION_ENTRY(); + + /* Producer / Consumer - flag bit[0] */ - /* Resource Type, General Flags, and Type-Specific Flags */ + resource->address.producer_consumer = (u32) (flags & 0x01); - {ACPI_RSC_ADDRESS, 0, 0, 0}, + /* Decode (_DEC) - flag bit[1] */ - /* - * These fields are contiguous in both the source and destination: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.granularity), - AML_OFFSET(address16.granularity), - 5}, + resource->address.decode = (u32) ((flags >> 1) & 0x01); - /* Optional resource_source (Index and String) */ + /* Min Address Fixed (_MIF) - flag bit[2] */ - {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address16.resource_source), - 0, - sizeof(struct aml_resource_address16)} -}; + 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); +} /******************************************************************************* * - * acpi_rs_convert_address32 - All DWORD (32-bit) address resources + * 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 * ******************************************************************************/ -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)}, +static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) +{ + u8 flags; - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32, - sizeof(struct aml_resource_address32), - 0}, + ACPI_FUNCTION_ENTRY(); - /* Resource Type, General Flags, and Type-Specific Flags */ + /* Producer / Consumer - flag bit[0] */ - {ACPI_RSC_ADDRESS, 0, 0, 0}, + flags = (u8) (resource->address.producer_consumer & 0x01); - /* - * These fields are contiguous in both the source and destination: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.granularity), - AML_OFFSET(address32.granularity), - 5}, + /* Decode (_DEC) - flag bit[1] */ + + flags |= (u8) ((resource->address.decode & 0x01) << 1); - /* Optional resource_source (Index and String) */ + /* Min Address Fixed (_MIF) - flag bit[2] */ - {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address32.resource_source), - 0, - sizeof(struct aml_resource_address32)} -}; + 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); +} /******************************************************************************* * - * acpi_rs_convert_address64 - All QWORD (64-bit) address resources + * FUNCTION: acpi_rs_decode_specific_flags + * + * PARAMETERS: Resource - Address resource data struct + * Flags - Actual 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. * ******************************************************************************/ -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)}, +static void +acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) +{ + ACPI_FUNCTION_ENTRY(); - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64, - sizeof(struct aml_resource_address64), - 0}, + if (resource->address.resource_type == ACPI_MEMORY_RANGE) { + /* Write Status (_RW) - flag bit[0] */ - /* Resource Type, General Flags, and Type-Specific Flags */ + resource->address.attribute.memory.read_write_attribute = + (u16) (flags & 0x01); - {ACPI_RSC_ADDRESS, 0, 0, 0}, + /* Memory Attributes (_MEM) - flag bits[2:1] */ - /* - * These fields are contiguous in both the source and destination: - * Address Granularity - * Address Range Minimum - * Address Range Maximum - * Address Translation Offset - * Address Length - */ - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.granularity), - AML_OFFSET(address64.granularity), - 5}, + 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] */ - /* Optional resource_source (Index and String) */ + resource->address.attribute.io.range_attribute = + (u16) (flags & 0x03); - {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address64.resource_source), - 0, - sizeof(struct aml_resource_address64)} -}; + /* Translations (_TTP and _TRS) - flag bits[5:4] */ + + resource->address.attribute.io.translation_attribute = + (u16) ((flags >> 4) & 0x03); + } +} /******************************************************************************* * - * acpi_rs_convert_ext_address64 - All Extended (64-bit) address resources + * 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. * ******************************************************************************/ -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)}, +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); + } 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 (flags); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_address16_resource + * + * 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 + * + * 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. + * + ******************************************************************************/ + +acpi_status +acpi_rs_address16_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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_TRACE("rs_address16_resource"); + + /* Get the Descriptor Length field */ + + buffer += 1; + ACPI_MOVE_16_TO_16(&temp16, buffer); + + /* Validate minimum descriptor length */ + + if (temp16 < 13) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); + } + + *bytes_consumed = temp16 + 3; + output_struct->id = ACPI_RSTYPE_ADDRESS16; + + /* Get the Resource Type (Byte3) */ - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, - sizeof(struct aml_resource_extended_address64), - 0}, + buffer += 2; + temp8 = *buffer; - /* Resource Type, General Flags, and Type-Specific Flags */ + /* Values 0-2 and 0xC0-0xFF are valid */ - {ACPI_RSC_ADDRESS, 0, 0, 0}, + if ((temp8 > 2) && (temp8 < 0xC0)) { + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + } + + 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 min_address_range (Bytes 8-9) */ - /* Revision ID */ + buffer += 2; + ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range, + buffer); + + /* Get max_address_range (Bytes 10-11) */ + + buffer += 2; + ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range, + buffer); + + /* Get address_translation_offset (Bytes 12-13) */ + + buffer += 2; + ACPI_MOVE_16_TO_32(&output_struct->data.address16. + address_translation_offset, buffer); + + /* Get address_length (Bytes 14-15) */ + + buffer += 2; + ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length, + buffer); + + /* Resource Source Index (if present) */ + + buffer += 2; - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD), - AML_OFFSET(ext_address64.revision_iD), - 1}, /* - * 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 + * 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. */ - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity), - AML_OFFSET(ext_address64.granularity), - 6} -}; + if (*bytes_consumed > (16 + 1)) { + /* Dereference the Index */ + + output_struct->data.address16.resource_source.index = + (u32) * buffer; + + /* Point to the String */ + + buffer += 1; + + /* Point the String pointer to the end of this structure */ + + output_struct->data.address16.resource_source.string_ptr = + (char *)((u8 *) output_struct + struct_size); + + 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; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_general_flags - Flags common to all address descriptors + * FUNCTION: acpi_rs_address16_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_address16_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u8 *length_field; + acpi_size actual_bytes; + + ACPI_FUNCTION_TRACE("rs_address16_stream"); + + /* Set the Descriptor Type field */ + + *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; + buffer += 1; + + /* Save a pointer to the Length field - to be filled in later */ + + length_field = buffer; + buffer += 2; + + /* Set the Resource Type (Memory, Io, bus_number) */ + + *buffer = (u8) (linked_list->data.address16.resource_type & 0x03); + buffer += 1; + + /* Set the general flags */ + + *buffer = acpi_rs_encode_general_flags(&linked_list->data); + buffer += 1; + + /* Set the type specific flags */ + + *buffer = acpi_rs_encode_specific_flags(&linked_list->data); + buffer += 1; + + /* Set the address space granularity */ + + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity); + buffer += 2; + + /* Set the address range minimum */ - /* Resource Type (Memory, Io, bus_number, etc.) */ + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16.min_address_range); + buffer += 2; - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.address.resource_type), - AML_OFFSET(address.resource_type), - 1}, + /* Set the address range maximum */ - /* General Flags - Consume, Decode, min_fixed, max_fixed */ + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16.max_address_range); + buffer += 2; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer), - AML_OFFSET(address.flags), - 0}, + /* Set the address translation offset */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.decode), - AML_OFFSET(address.flags), - 1}, + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.address16. + address_translation_offset); + buffer += 2; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.min_address_fixed), - AML_OFFSET(address.flags), - 2}, + /* Set the address length */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.max_address_fixed), - AML_OFFSET(address.flags), - 3} -}; + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length); + buffer += 2; + + /* Resource Source Index and Resource Source are optional */ + + if (linked_list->data.address16.resource_source.string_length) { + *buffer = + (u8) linked_list->data.address16.resource_source.index; + buffer += 1; + + /* Copy the resource_source string */ + + ACPI_STRCPY((char *)buffer, + linked_list->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 + (linked_list->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); + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_mem_flags - Flags common to Memory address descriptors + * FUNCTION: acpi_rs_address32_resource + * + * 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 + * + * 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. * ******************************************************************************/ -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_status +acpi_rs_address32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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); - /* Memory-specific flags */ + ACPI_FUNCTION_TRACE("rs_address32_resource"); - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.write_protect), - AML_OFFSET(address.specific_flags), - 0}, + /* Get the Descriptor Length field */ - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.caching), - AML_OFFSET(address.specific_flags), - 1}, + buffer += 1; + ACPI_MOVE_16_TO_16(&temp16, buffer); - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.range_type), - AML_OFFSET(address.specific_flags), - 3}, + /* Validate minimum descriptor length */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.translation), - AML_OFFSET(address.specific_flags), - 5} -}; + if (temp16 < 23) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); + } + + *bytes_consumed = temp16 + 3; + output_struct->id = ACPI_RSTYPE_ADDRESS32; + + /* Get the Resource Type (Byte3) */ + + buffer += 2; + temp8 = *buffer; + + /* Values 0-2 and 0xC0-0xFF are valid */ + + if ((temp8 > 2) && (temp8 < 0xC0)) { + 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. + */ + if (*bytes_consumed > (26 + 1)) { + /* Dereference the Index */ + + output_struct->data.address32.resource_source.index = + (u32) * buffer; + + /* Point to the String */ + + buffer += 1; + + /* Point the String pointer to the end of this structure */ + + output_struct->data.address32.resource_source.string_ptr = + (char *)((u8 *) output_struct + struct_size); + + 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; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_io_flags - Flags common to I/O address descriptors + * FUNCTION: acpi_rs_address32_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_address32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer; + u16 *length_field; + + ACPI_FUNCTION_TRACE("rs_address32_stream"); + + buffer = *output_buffer; + + /* Set the Descriptor Type field */ + + *buffer = ACPI_RDESC_TYPE_DWORD_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) (linked_list->data.address32.resource_type & 0x03); + buffer += 1; + + /* Set the general flags */ + + *buffer = acpi_rs_encode_general_flags(&linked_list->data); + buffer += 1; + + /* Set the type specific flags */ + + *buffer = acpi_rs_encode_specific_flags(&linked_list->data); + buffer += 1; + + /* Set the address space granularity */ + + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity); + buffer += 4; + + /* Set the address range minimum */ + + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32.min_address_range); + buffer += 4; + + /* Set the address range maximum */ + + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32.max_address_range); + buffer += 4; + + /* Set the address translation offset */ + + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.address32. + address_translation_offset); + buffer += 4; + + /* Set the address length */ + + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length); + buffer += 4; - /* I/O-specific flags */ + /* Resource Source Index and Resource Source are optional */ - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.io.range_type), - AML_OFFSET(address.specific_flags), - 0}, + if (linked_list->data.address32.resource_source.string_length) { + *buffer = + (u8) linked_list->data.address32.resource_source.index; + buffer += 1; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.io.translation), - AML_OFFSET(address.specific_flags), - 4}, + /* Copy the resource_source string */ - {ACPI_RSC_1BITFLAG, - ACPI_RS_OFFSET(data.address.info.io.translation_type), - AML_OFFSET(address.specific_flags), - 5} -}; + ACPI_STRCPY((char *)buffer, + linked_list->data.address32.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 + (linked_list->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); + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * FUNCTION: acpi_rs_get_address_common + * FUNCTION: acpi_rs_address64_resource * - * PARAMETERS: Resource - Pointer to the internal resource struct - * Aml - Pointer to the AML resource descriptor + * 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 * - * RETURN: TRUE if the resource_type field is OK, FALSE otherwise + * RETURN: Status * - * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor - * to an internal resource descriptor + * 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. * ******************************************************************************/ -u8 -acpi_rs_get_address_common(struct acpi_resource *resource, - union aml_resource *aml) +acpi_status +acpi_rs_address64_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - ACPI_FUNCTION_ENTRY(); + 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); - /* Validate the Resource Type */ + ACPI_FUNCTION_TRACE("rs_address64_resource"); - if ((aml->address.resource_type > 2) - && (aml->address.resource_type < 0xC0)) { - return (FALSE); + /* 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); } - /* Get the Resource Type and General Flags */ + *bytes_consumed = temp16 + 3; + output_struct->id = ACPI_RSTYPE_ADDRESS64; - (void)acpi_rs_convert_aml_to_resource(resource, aml, - acpi_rs_convert_general_flags); + /* Get the Resource Type (Byte3) */ - /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ + buffer += 2; + temp8 = *buffer; - 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 */ + /* Values 0-2 and 0xC0-0xFF are valid */ + + if ((temp8 > 2) && (temp8 < 0xC0)) { + 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 address_length (Bytes 38-45) or (Bytes 40-47) */ + + buffer += 8; + ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, + buffer); - resource->data.address.info.type_specific = - aml->address.specific_flags; + 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; + + if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { + /* Get type_specific_attribute (Bytes 48-55) */ + + buffer += 8; + ACPI_MOVE_64_TO_64(&output_struct->data.address64. + type_specific_attributes, buffer); + } else { + output_struct->data.address64.type_specific_attributes = 0; + + /* Resource Source Index (if present) */ + + buffer += 8; + + /* + * 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 */ + + output_struct->data.address64.resource_source.index = + (u32) * buffer; + + /* Point to the String */ + + buffer += 1; + + /* Point the String pointer to the end of this structure */ + + output_struct->data.address64.resource_source. + string_ptr = + (char *)((u8 *) output_struct + struct_size); + + temp_ptr = (u8 *) + output_struct->data.address64.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.address64.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); + } } - return (TRUE); + /* Set the Length parameter */ + + output_struct->length = (u32) struct_size; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_set_address_common + * FUNCTION: acpi_rs_address64_stream * - * PARAMETERS: Aml - Pointer to the AML resource descriptor - * Resource - Pointer to the internal resource struct + * PARAMETERS: linked_list - 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 * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Convert common flag fields from a resource descriptor to an - * AML descriptor + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -void -acpi_rs_set_address_common(union aml_resource *aml, - struct acpi_resource *resource) +acpi_status +acpi_rs_address64_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) { - ACPI_FUNCTION_ENTRY(); + u8 *buffer; + u16 *length_field; - /* Set the Resource Type and General Flags */ + ACPI_FUNCTION_TRACE("rs_address64_stream"); - (void)acpi_rs_convert_resource_to_aml(resource, aml, - acpi_rs_convert_general_flags); + buffer = *output_buffer; - /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ + /* Set the Descriptor Type field */ - 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 */ + *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) (linked_list->data.address64.resource_type & 0x03); + buffer += 1; + + /* Set the general flags */ + + *buffer = acpi_rs_encode_general_flags(&linked_list->data); + buffer += 1; + + /* Set the type specific flags */ + + *buffer = acpi_rs_encode_specific_flags(&linked_list->data); + buffer += 1; + + /* Set the address space granularity */ + + ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity); + buffer += 8; - aml->address.specific_flags = - resource->data.address.info.type_specific; + /* Set the address range minimum */ + + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64.min_address_range); + buffer += 8; + + /* Set the address range maximum */ + + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64.max_address_range); + buffer += 8; + + /* Set the address translation offset */ + + ACPI_MOVE_64_TO_64(buffer, + &linked_list->data.address64. + address_translation_offset); + buffer += 8; + + /* Set the address length */ + + ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length); + buffer += 8; + + /* Resource Source Index and Resource Source are optional */ + + if (linked_list->data.address64.resource_source.string_length) { + *buffer = + (u8) linked_list->data.address64.resource_source.index; + buffer += 1; + + /* Copy the resource_source string */ + + ACPI_STRCPY((char *)buffer, + linked_list->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 + (linked_list->data.address64.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); + return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/resources/rscalc.c b/trunk/drivers/acpi/resources/rscalc.c index 1dfa6906d455..378f58390fc1 100644 --- a/trunk/drivers/acpi/resources/rscalc.c +++ b/trunk/drivers/acpi/resources/rscalc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,433 +49,652 @@ #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME("rscalc") -/* Local prototypes */ -static u8 acpi_rs_count_set_bits(u16 bit_field); - -static acpi_rs_length -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); - /******************************************************************************* * - * FUNCTION: acpi_rs_count_set_bits + * FUNCTION: acpi_rs_get_byte_stream_length * - * PARAMETERS: bit_field - Field in which to count bits + * PARAMETERS: linked_list - Pointer to the resource linked list + * size_needed - u32 pointer of the size buffer needed + * to properly return the parsed data * - * RETURN: Number of bits set within the field + * RETURN: Status * - * DESCRIPTION: Count the number of bits set in a resource field. Used for - * (Short descriptor) interrupt and DMA lists. + * DESCRIPTION: Takes the resource byte stream and parses it once, calculating + * the size buffer needed to hold the linked list that conveys + * the resource data. * ******************************************************************************/ - -static u8 acpi_rs_count_set_bits(u16 bit_field) +acpi_status +acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list, + acpi_size * size_needed) { - u8 bits_set; + acpi_size byte_stream_size_needed = 0; + acpi_size segment_size; + u8 done = FALSE; - ACPI_FUNCTION_ENTRY(); + ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); - for (bits_set = 0; bit_field; bits_set++) { - /* Zero the least significant bit that is set */ + while (!done) { + /* Init the variable that will hold the size to add to the total. */ - bit_field &= (bit_field - 1); - } + segment_size = 0; - return (bits_set); -} + switch (linked_list->id) { + case ACPI_RSTYPE_IRQ: + /* + * IRQ Resource + * For an IRQ Resource, Byte 3, although optional, will always be + * created - it holds IRQ information. + */ + segment_size = 4; + break; -/******************************************************************************* - * - * FUNCTION: acpi_rs_struct_option_length - * - * PARAMETERS: resource_source - Pointer to optional descriptor field - * - * RETURN: Status - * - * DESCRIPTION: Common code to handle optional resource_source_index and - * resource_source fields in some Large descriptors. Used during - * list-to-stream conversion - * - ******************************************************************************/ + case ACPI_RSTYPE_DMA: + /* + * DMA Resource + * For this resource the size is static + */ + segment_size = 3; + break; -static acpi_rs_length -acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) -{ - ACPI_FUNCTION_ENTRY(); + case ACPI_RSTYPE_START_DPF: + /* + * Start Dependent Functions Resource + * For a start_dependent_functions Resource, Byte 1, although + * optional, will always be created. + */ + segment_size = 2; + break; - /* - * If the resource_source string is valid, return the size of the string - * (string_length includes the NULL terminator) plus the size of the - * resource_source_index (1). - */ - if (resource_source->string_ptr) { - return ((acpi_rs_length) (resource_source->string_length + 1)); - } + case ACPI_RSTYPE_END_DPF: + /* + * End Dependent Functions Resource + * For this resource the size is static + */ + segment_size = 1; + break; - return (0); -} + case ACPI_RSTYPE_IO: + /* + * IO Port Resource + * For this resource the size is static + */ + segment_size = 8; + break; -/******************************************************************************* - * - * FUNCTION: acpi_rs_stream_option_length - * - * PARAMETERS: resource_length - Length from the resource header - * minimum_total_length - Minimum length of this resource, before - * any optional fields. Includes header size - * - * RETURN: Length of optional string (0 if no string present) - * - * DESCRIPTION: Common code to handle optional resource_source_index and - * resource_source fields in some Large descriptors. Used during - * stream-to-list conversion - * - ******************************************************************************/ + case ACPI_RSTYPE_FIXED_IO: + /* + * Fixed IO Port Resource + * For this resource the size is static + */ + segment_size = 4; + break; -static u32 -acpi_rs_stream_option_length(u32 resource_length, - u32 minimum_aml_resource_length) -{ - u32 string_length = 0; + case ACPI_RSTYPE_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 (linked_list->data.vendor_specific.length > 7) { + segment_size = 3; + } else { + segment_size = 1; + } + segment_size += + linked_list->data.vendor_specific.length; + break; + + case ACPI_RSTYPE_END_TAG: + /* + * End Tag + * For this resource the size is static + */ + segment_size = 2; + done = TRUE; + break; - ACPI_FUNCTION_ENTRY(); + case ACPI_RSTYPE_MEM24: + /* + * 24-Bit Memory Resource + * For this resource the size is static + */ + segment_size = 12; + break; - /* - * The resource_source_index and resource_source are optional elements of some - * Large-type resource descriptors. - */ + case ACPI_RSTYPE_MEM32: + /* + * 32-Bit Memory Range Resource + * For this resource the size is static + */ + segment_size = 20; + break; - /* - * 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 - * and is followed by a (required) null terminated string. The string 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_aml_resource_length) { - /* Compute the length of the optional string */ + case ACPI_RSTYPE_FIXED_MEM32: + /* + * 32-Bit Fixed Memory Resource + * For this resource the size is static + */ + segment_size = 12; + break; + + case ACPI_RSTYPE_ADDRESS16: + /* + * 16-Bit Address Resource + * The base size of this byte stream is 16. If a Resource Source + * string is not NULL, add 1 for the Index + the length of the null + * terminated string Resource Source + 1 for the null. + */ + segment_size = 16; + + if (linked_list->data.address16.resource_source. + string_ptr) { + segment_size += + linked_list->data.address16.resource_source. + string_length; + segment_size++; + } + break; + + case ACPI_RSTYPE_ADDRESS32: + /* + * 32-Bit Address Resource + * The base size of this byte stream is 26. If a Resource + * Source string is not NULL, add 1 for the Index + the + * length of the null terminated string Resource Source + + * 1 for the null. + */ + segment_size = 26; + + if (linked_list->data.address32.resource_source. + string_ptr) { + segment_size += + linked_list->data.address32.resource_source. + string_length; + segment_size++; + } + break; + + case ACPI_RSTYPE_ADDRESS64: + /* + * 64-Bit Address Resource + * The base size of this byte stream is 46. If a resource_source + * string is not NULL, add 1 for the Index + the length of the null + * terminated string Resource Source + 1 for the null. + */ + segment_size = 46; + + if (linked_list->data.address64.resource_source. + string_ptr) { + segment_size += + linked_list->data.address64.resource_source. + string_length; + segment_size++; + } + break; - string_length = - resource_length - minimum_aml_resource_length - 1; + case ACPI_RSTYPE_EXT_IRQ: + /* + * Extended IRQ Resource + * The base size of this byte stream is 9. This is for an Interrupt + * table length of 1. For each additional interrupt, add 4. + * If a Resource Source string is not NULL, add 1 for the + * Index + the length of the null terminated string + * Resource Source + 1 for the null. + */ + segment_size = 9 + (((acpi_size) + linked_list->data.extended_irq. + number_of_interrupts - 1) * 4); + + if (linked_list->data.extended_irq.resource_source. + string_ptr) { + segment_size += + linked_list->data.extended_irq. + resource_source.string_length; + segment_size++; + } + break; + + default: + + /* If we get here, everything is out of sync, exit with error */ + + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); + + } /* switch (linked_list->Id) */ + + /* Update the total */ + + byte_stream_size_needed += segment_size; + + /* Point to the next object */ + + linked_list = ACPI_PTR_ADD(struct acpi_resource, + linked_list, linked_list->length); } - /* Round up length to 32 bits for internal structure alignment */ + /* This is the data the caller needs */ - return (ACPI_ROUND_UP_to_32_bITS(string_length)); + *size_needed = byte_stream_size_needed; + return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_get_aml_length + * FUNCTION: acpi_rs_get_list_length * - * PARAMETERS: Resource - Pointer to the resource linked list - * size_needed - Where the required size is returned + * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream + * byte_stream_buffer_length - Size of byte_stream_buffer + * size_needed - u32 pointer of the size buffer + * needed to properly return the + * parsed data * * RETURN: Status * - * DESCRIPTION: Takes a linked list of internal resource descriptors and - * calculates the size buffer needed to hold the corresponding - * external resource byte stream. + * DESCRIPTION: Takes the resource byte stream and parses it once, calculating + * the size buffer needed to hold the linked list that conveys + * the resource data. * ******************************************************************************/ acpi_status -acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) +acpi_rs_get_list_length(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, acpi_size * size_needed) { - acpi_size aml_size_needed = 0; - acpi_rs_length total_size; - - ACPI_FUNCTION_TRACE("rs_get_aml_length"); + u32 buffer_size = 0; + u32 bytes_parsed = 0; + u8 number_of_interrupts = 0; + u8 number_of_channels = 0; + u8 resource_type; + u32 structure_size; + u32 bytes_consumed; + u8 *buffer; + u8 temp8; + u16 temp16; + u8 index; + u8 additional_bytes; - /* Traverse entire list of internal resource descriptors */ + ACPI_FUNCTION_TRACE("rs_get_list_length"); - while (resource) { - /* Validate the descriptor type */ + while (bytes_parsed < byte_stream_buffer_length) { + /* The next byte in the stream is the resource type */ - if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); - } + resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); - /* Get the base size of the (external stream) resource descriptor */ + switch (resource_type) { + case ACPI_RDESC_TYPE_MEMORY_24: + /* + * 24-Bit Memory Resource + */ + bytes_consumed = 12; - total_size = acpi_gbl_aml_resource_sizes[resource->type]; + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); + break; - /* - * Augment the base size for descriptors with optional and/or - * variable-length fields - */ - switch (resource->type) { - case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RDESC_TYPE_LARGE_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. + * Vendor Defined Resource */ - if (resource->data.vendor.byte_length > 7) { - /* Base size of a Large resource descriptor */ + buffer = byte_stream_buffer; + ++buffer; - total_size = - sizeof(struct aml_resource_large_header); - } + ACPI_MOVE_16_TO_16(&temp16, buffer); + bytes_consumed = temp16 + 3; - /* Add the size of the vendor-specific data */ + /* Ensure a 32-bit boundary for the structure */ - total_size = (acpi_rs_length) - (total_size + resource->data.vendor.byte_length); + temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16); + + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + (temp16 * sizeof(u8)); break; - case ACPI_RESOURCE_TYPE_END_TAG: + case ACPI_RDESC_TYPE_MEMORY_32: /* - * End Tag: - * We are done -- return the accumulated total size. + * 32-Bit Memory Range Resource */ - *size_needed = aml_size_needed + total_size; - - /* Normal exit */ + bytes_consumed = 20; - return_ACPI_STATUS(AE_OK); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); + break; - case ACPI_RESOURCE_TYPE_ADDRESS16: + case ACPI_RDESC_TYPE_FIXED_MEMORY_32: /* - * 16-Bit Address Resource: - * Add the size of the optional resource_source info + * 32-Bit Fixed Memory Resource */ - total_size = (acpi_rs_length) - (total_size + - acpi_rs_struct_option_length(&resource->data. - address16. - resource_source)); + bytes_consumed = 12; + + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_fixed_mem32); break; - case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: /* - * 32-Bit Address Resource: - * Add the size of the optional resource_source info + * 64-Bit Address Resource */ - total_size = (acpi_rs_length) - (total_size + - acpi_rs_struct_option_length(&resource->data. - address32. - resource_source)); + buffer = byte_stream_buffer; + + ++buffer; + ACPI_MOVE_16_TO_16(&temp16, buffer); + + bytes_consumed = temp16 + 3; + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_address64); break; - case ACPI_RESOURCE_TYPE_ADDRESS64: + case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: /* - * 64-Bit Address Resource: - * Add the size of the optional resource_source info + * 64-Bit Address Resource */ - total_size = (acpi_rs_length) - (total_size + - acpi_rs_struct_option_length(&resource->data. - address64. - resource_source)); - break; + buffer = byte_stream_buffer; + + ++buffer; + ACPI_MOVE_16_TO_16(&temp16, buffer); + + bytes_consumed = temp16 + 3; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: /* - * Extended IRQ Resource: - * Add the size of each additional optional interrupt beyond the - * required 1 (4 bytes for each u32 interrupt number) + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 43, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ - 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)); + if (43 < temp16) { + temp8 = (u8) (temp16 - 44); + } else { + temp8 = 0; + } + + /* Ensure a 64-bit boundary for the structure */ + + temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8); + + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + + (temp8 * sizeof(u8)); break; - default: + case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: + /* + * 32-Bit Address Resource + */ + buffer = byte_stream_buffer; + + ++buffer; + ACPI_MOVE_16_TO_16(&temp16, buffer); + + bytes_consumed = temp16 + 3; + + /* + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 23, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. + */ + if (23 < temp16) { + temp8 = (u8) (temp16 - 24); + } else { + temp8 = 0; + } + + /* Ensure a 32-bit boundary for the structure */ + + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); + + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + + (temp8 * sizeof(u8)); break; - } - /* Update the total */ + case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: + /* + * 16-Bit Address Resource + */ + buffer = byte_stream_buffer; - aml_size_needed += total_size; + ++buffer; + ACPI_MOVE_16_TO_16(&temp16, buffer); - /* Point to the next object */ + bytes_consumed = temp16 + 3; - resource = - ACPI_ADD_PTR(struct acpi_resource, resource, - resource->length); - } + /* + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 13, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. + */ + if (13 < temp16) { + temp8 = (u8) (temp16 - 14); + } else { + temp8 = 0; + } - /* Did not find an end_tag resource descriptor */ + /* Ensure a 32-bit boundary for the structure */ - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); -} + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); -/******************************************************************************* - * - * FUNCTION: acpi_rs_get_list_length - * - * 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 - * - * DESCRIPTION: Takes an external resource byte stream and calculates the size - * buffer needed to hold the corresponding internal resource - * descriptor linked list. - * - ******************************************************************************/ + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + + (temp8 * sizeof(u8)); + break; -acpi_status -acpi_rs_get_list_length(u8 * aml_buffer, - u32 aml_buffer_length, acpi_size * size_needed) -{ - acpi_status status; - u8 *end_aml; - u8 *buffer; - u32 buffer_size = 0; - u16 temp16; - u16 resource_length; - u32 extra_struct_bytes; - u8 resource_index; - u8 minimum_aml_resource_length; + case ACPI_RDESC_TYPE_EXTENDED_XRUPT: + /* + * Extended IRQ + */ + buffer = byte_stream_buffer; - ACPI_FUNCTION_TRACE("rs_get_list_length"); + ++buffer; + ACPI_MOVE_16_TO_16(&temp16, buffer); - end_aml = aml_buffer + aml_buffer_length; + bytes_consumed = temp16 + 3; - /* Walk the list of AML resource descriptors */ + /* + * Point past the length field and the Interrupt vector flags to + * save off the Interrupt table length to the Temp8 variable. + */ + buffer += 3; + temp8 = *buffer; - while (aml_buffer < end_aml) { - /* Validate the Resource Type and Resource Length */ + /* + * To compensate for multiple interrupt numbers, add 4 bytes for + * each additional interrupts greater than 1 + */ + additional_bytes = (u8) ((temp8 - 1) * 4); - status = acpi_ut_validate_resource(aml_buffer, &resource_index); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + /* + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 9, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. + */ + if (9 + additional_bytes < temp16) { + temp8 = (u8) (temp16 - (9 + additional_bytes)); + } else { + temp8 = 0; + } - /* Get the resource length and base (minimum) AML size */ + /* Ensure a 32-bit boundary for the structure */ - resource_length = acpi_ut_get_resource_length(aml_buffer); - minimum_aml_resource_length = - acpi_gbl_resource_aml_sizes[resource_index]; + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); - /* - * Augment the size for descriptors with optional - * and/or variable length fields - */ - extra_struct_bytes = 0; - buffer = - aml_buffer + acpi_ut_get_resource_header_length(aml_buffer); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) + + (additional_bytes * sizeof(u8)) + + (temp8 * sizeof(u8)); + break; - switch (acpi_ut_get_resource_type(aml_buffer)) { - case ACPI_RESOURCE_NAME_IRQ: + case ACPI_RDESC_TYPE_IRQ_FORMAT: /* - * IRQ Resource: - * Get the number of bits set in the 16-bit IRQ mask + * IRQ Resource. + * Determine if it there are two or three trailing bytes */ + buffer = byte_stream_buffer; + temp8 = *buffer; + + if (temp8 & 0x01) { + bytes_consumed = 4; + } else { + bytes_consumed = 3; + } + + /* Point past the descriptor */ + + ++buffer; + + /* Look at the number of bits set */ + ACPI_MOVE_16_TO_16(&temp16, buffer); - extra_struct_bytes = acpi_rs_count_set_bits(temp16); + + for (index = 0; index < 16; index++) { + if (temp16 & 0x1) { + ++number_of_interrupts; + } + + temp16 >>= 1; + } + + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) + + (number_of_interrupts * sizeof(u32)); break; - case ACPI_RESOURCE_NAME_DMA: + case ACPI_RDESC_TYPE_DMA_FORMAT: /* - * DMA Resource: - * Get the number of bits set in the 8-bit DMA mask + * DMA Resource */ - extra_struct_bytes = acpi_rs_count_set_bits(*buffer); + buffer = byte_stream_buffer; + bytes_consumed = 3; + + /* Point past the descriptor */ + + ++buffer; + + /* Look at the number of bits set */ + + temp8 = *buffer; + + for (index = 0; index < 8; index++) { + if (temp8 & 0x1) { + ++number_of_channels; + } + + temp8 >>= 1; + } + + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) + + (number_of_channels * sizeof(u32)); break; - case ACPI_RESOURCE_NAME_VENDOR_SMALL: + case ACPI_RDESC_TYPE_START_DEPENDENT: /* - * Vendor Resource: - * Ensure a 32-bit boundary for the structure + * Start Dependent Functions Resource + * Determine if it there are two or three trailing bytes */ - extra_struct_bytes = - ACPI_ROUND_UP_to_32_bITS(resource_length) - - resource_length; + buffer = byte_stream_buffer; + temp8 = *buffer; + + if (temp8 & 0x01) { + bytes_consumed = 2; + } else { + bytes_consumed = 1; + } + + structure_size = + ACPI_SIZEOF_RESOURCE(struct + acpi_resource_start_dpf); break; - case ACPI_RESOURCE_NAME_END_TAG: + case ACPI_RDESC_TYPE_END_DEPENDENT: /* - * End Tag: This is the normal exit, add size of end_tag + * End Dependent Functions Resource */ - *size_needed = buffer_size + ACPI_RS_SIZE_MIN; - return_ACPI_STATUS(AE_OK); + bytes_consumed = 1; + structure_size = ACPI_RESOURCE_LENGTH; + break; - case ACPI_RESOURCE_NAME_VENDOR_LARGE: + case ACPI_RDESC_TYPE_IO_PORT: /* - * Vendor Resource: - * Add vendor data and ensure a 32-bit boundary for the structure + * IO Port Resource */ - extra_struct_bytes = - ACPI_ROUND_UP_to_32_bITS(resource_length) - - resource_length; + bytes_consumed = 8; + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); break; - case ACPI_RESOURCE_NAME_ADDRESS32: - case ACPI_RESOURCE_NAME_ADDRESS16: + case ACPI_RDESC_TYPE_FIXED_IO_PORT: /* - * 32-Bit or 16-bit Address Resource: - * Add the size of any optional data (resource_source) + * Fixed IO Port Resource */ - extra_struct_bytes = - acpi_rs_stream_option_length(resource_length, - minimum_aml_resource_length); + bytes_consumed = 4; + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); break; - case ACPI_RESOURCE_NAME_EXTENDED_IRQ: + case ACPI_RDESC_TYPE_SMALL_VENDOR: /* - * Extended IRQ: - * Point past the interrupt_vector_flags to get the - * interrupt_table_length. + * Vendor Specific Resource */ - buffer++; + buffer = byte_stream_buffer; - extra_struct_bytes = - /* - * Add 4 bytes for each additional interrupt. Note: at - * least one interrupt is required and is included in - * the minimum descriptor size - */ - ((*buffer - 1) * sizeof(u32)) + - /* Add the size of any optional data (resource_source) */ - acpi_rs_stream_option_length(resource_length - - extra_struct_bytes, - minimum_aml_resource_length); + temp8 = *buffer; + temp8 = (u8) (temp8 & 0x7); + bytes_consumed = temp8 + 1; + + /* Ensure a 32-bit boundary for the structure */ + + temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); + structure_size = + ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + + (temp8 * sizeof(u8)); break; - case ACPI_RESOURCE_NAME_ADDRESS64: + case ACPI_RDESC_TYPE_END_TAG: /* - * 64-Bit Address Resource: - * Add the size of any optional data (resource_source) - * Ensure a 64-bit boundary for the structure + * End Tag */ - extra_struct_bytes = - ACPI_ROUND_UP_to_64_bITS - (acpi_rs_stream_option_length - (resource_length, minimum_aml_resource_length)); + bytes_consumed = 2; + structure_size = ACPI_RESOURCE_LENGTH; + byte_stream_buffer_length = bytes_parsed; break; default: - break; + /* + * If we get here, everything is out of sync, + * exit with an error + */ + return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); } - /* Update the required buffer size for the internal descriptor structs */ + /* Update the return value and counter */ - temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + - extra_struct_bytes); - buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); + buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size); + bytes_parsed += bytes_consumed; - /* - * Point to the next resource within the stream - * using the size of the header plus the length contained in the header - */ - aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); + /* Set the byte stream to point to the next resource */ + + byte_stream_buffer += bytes_consumed; } - /* Did not find an end_tag resource descriptor */ + /* This is the data the caller needs */ - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + *size_needed = buffer_size; + return_ACPI_STATUS(AE_OK); } /******************************************************************************* diff --git a/trunk/drivers/acpi/resources/rscreate.c b/trunk/drivers/acpi/resources/rscreate.c index 7f46ca0bf33a..0911526b7ad8 100644 --- a/trunk/drivers/acpi/resources/rscreate.c +++ b/trunk/drivers/acpi/resources/rscreate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate") * * FUNCTION: acpi_rs_create_resource_list * - * PARAMETERS: aml_buffer - Pointer to the resource byte stream - * output_buffer - Pointer to the user's buffer + * PARAMETERS: byte_stream_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,30 +67,33 @@ ACPI_MODULE_NAME("rscreate") * ******************************************************************************/ acpi_status -acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, +acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, struct acpi_buffer *output_buffer) { acpi_status status; - u8 *aml_start; + u8 *byte_stream_start; acpi_size list_size_needed = 0; - u32 aml_buffer_length; + u32 byte_stream_buffer_length; ACPI_FUNCTION_TRACE("rs_create_resource_list"); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", + byte_stream_buffer)); /* Params already validated, so we don't re-validate here */ - aml_buffer_length = aml_buffer->buffer.length; - aml_start = aml_buffer->buffer.pointer; + byte_stream_buffer_length = byte_stream_buffer->buffer.length; + byte_stream_start = byte_stream_buffer->buffer.pointer; /* - * Pass the aml_buffer into a module that can calculate + * Pass the byte_stream_buffer into a module that can calculate * the buffer size needed for the linked list */ - status = acpi_rs_get_list_length(aml_start, aml_buffer_length, - &list_size_needed); + status = + acpi_rs_get_list_length(byte_stream_start, + byte_stream_buffer_length, + &list_size_needed); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", status, (u32) list_size_needed)); @@ -107,8 +110,10 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, /* Do the conversion */ - status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, - output_buffer->pointer); + status = + acpi_rs_byte_stream_to_list(byte_stream_start, + byte_stream_buffer_length, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -207,14 +212,21 @@ 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_REPORT_ERROR(("(PRT[%X]) Need sub-package, found %s\n", index, acpi_ut_get_object_type_name(*top_object_list))); + ACPI_DEBUG_PRINT((ACPI_DB_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_REPORT_ERROR(("(PRT[%X]) Need package of length 4, found length %d\n", index, (*top_object_list)->package.count)); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -231,7 +243,11 @@ 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_REPORT_ERROR(("(PRT[%X].Address) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Address) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -241,7 +257,11 @@ 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_REPORT_ERROR(("(PRT[%X].Pin) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Pin) Need Integer, found %s\n", + index, + acpi_ut_get_object_type_name + (obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -252,7 +272,10 @@ 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_REPORT_ERROR(("(PRT[%X].Source) Need name, found reference op %X\n", index, obj_desc->reference.opcode)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "(PRT[%X].Source) Need name, found reference op %X\n", + index, + obj_desc->reference.opcode)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -298,7 +321,11 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, default: - ACPI_REPORT_ERROR(("(PRT[%X].Source) Need Ref/String/Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + 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))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -313,7 +340,11 @@ 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_REPORT_ERROR(("(PRT[%X].source_index) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_DEBUG_PRINT((ACPI_DB_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); } @@ -329,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /******************************************************************************* * - * FUNCTION: acpi_rs_create_aml_resources + * FUNCTION: acpi_rs_create_byte_stream * * PARAMETERS: linked_list_buffer - Pointer to the resource linked list * output_buffer - Pointer to the user's buffer @@ -346,13 +377,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ******************************************************************************/ acpi_status -acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, - struct acpi_buffer *output_buffer) +acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, + struct acpi_buffer *output_buffer) { acpi_status status; - acpi_size aml_size_needed = 0; + acpi_size byte_stream_size_needed = 0; - ACPI_FUNCTION_TRACE("rs_create_aml_resources"); + ACPI_FUNCTION_TRACE("rs_create_byte_stream"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", linked_list_buffer)); @@ -363,10 +394,11 @@ acpi_rs_create_aml_resources(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_aml_length(linked_list_buffer, &aml_size_needed); + status = acpi_rs_get_byte_stream_length(linked_list_buffer, + &byte_stream_size_needed); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", - (u32) aml_size_needed, + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", + (u32) byte_stream_size_needed, acpi_format_exception(status))); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -374,7 +406,8 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, /* Validate/Allocate/Clear caller buffer */ - status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed); + status = + acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -382,9 +415,9 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, /* Do the conversion */ status = - acpi_rs_convert_resources_to_aml(linked_list_buffer, - aml_size_needed, - output_buffer->pointer); + acpi_rs_list_to_byte_stream(linked_list_buffer, + byte_stream_size_needed, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/resources/rsdump.c b/trunk/drivers/acpi/resources/rsdump.c index 98356e2482c5..75bd34d1783f 100644 --- a/trunk/drivers/acpi/resources/rsdump.c +++ b/trunk/drivers/acpi/resources/rsdump.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,716 +49,1063 @@ ACPI_MODULE_NAME("rsdump") #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* Local prototypes */ -static void acpi_rs_out_string(char *title, char *value); +static void acpi_rs_dump_irq(union acpi_resource_data *data); -static void acpi_rs_out_integer8(char *title, u8 value); +static void acpi_rs_dump_address16(union acpi_resource_data *data); -static void acpi_rs_out_integer16(char *title, u16 value); +static void acpi_rs_dump_address32(union acpi_resource_data *data); -static void acpi_rs_out_integer32(char *title, u32 value); +static void acpi_rs_dump_address64(union acpi_resource_data *data); -static void acpi_rs_out_integer64(char *title, u64 value); +static void acpi_rs_dump_dma(union acpi_resource_data *data); -static void acpi_rs_out_title(char *title); +static void acpi_rs_dump_io(union acpi_resource_data *data); -static void acpi_rs_dump_byte_list(u16 length, u8 * data); +static void acpi_rs_dump_extended_irq(union acpi_resource_data *data); -static void acpi_rs_dump_dword_list(u8 length, u32 * data); +static void acpi_rs_dump_fixed_io(union acpi_resource_data *data); -static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data); -static void -acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); +static void acpi_rs_dump_memory24(union acpi_resource_data *data); -static void acpi_rs_dump_address_common(union acpi_resource_data *resource); +static void acpi_rs_dump_memory32(union acpi_resource_data *data); -static void -acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); +static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data); -#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)) +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data); /******************************************************************************* * - * Resource Descriptor info tables + * FUNCTION: acpi_rs_dump_irq * - * Note: The first table entry must be a Title or Literal and must contain - * the table length (number of table entries) + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: None + * + * DESCRIPTION: Prints out the various members of the Data structure type. * ******************************************************************************/ -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_dump_irq(union acpi_resource_data *data) +{ + struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data; + u8 index = 0; -/* - * 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", (void *)"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", (void *)"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} -}; + ACPI_FUNCTION_ENTRY(); -/* - * 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} -}; + acpi_os_printf("IRQ Resource\n"); + + acpi_os_printf(" %s Triggered\n", + ACPI_LEVEL_SENSITIVE == + irq_data->edge_level ? "Level" : "Edge"); + + acpi_os_printf(" Active %s\n", + ACPI_ACTIVE_LOW == + irq_data->active_high_low ? "Low" : "High"); + + acpi_os_printf(" %s\n", + ACPI_SHARED == + irq_data->shared_exclusive ? "Shared" : "Exclusive"); + + acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts); + + for (index = 0; index < irq_data->number_of_interrupts; index++) { + acpi_os_printf("%X ", irq_data->interrupts[index]); + } + + acpi_os_printf(")\n"); + return; +} /******************************************************************************* * - * FUNCTION: acpi_rs_dump_descriptor + * FUNCTION: acpi_rs_dump_dma * - * PARAMETERS: Resource + * PARAMETERS: Data - pointer to the resource structure to dump. * * RETURN: None * - * DESCRIPTION: + * DESCRIPTION: Prints out the various members of the Data structure type. * ******************************************************************************/ -static void -acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) +static void acpi_rs_dump_dma(union acpi_resource_data *data) { - u8 *target = NULL; - u8 *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 = ACPI_ADD_PTR(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; + struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data; + u8 index = 0; - /* Strings */ + ACPI_FUNCTION_ENTRY(); - case ACPI_RSD_LITERAL: - acpi_rs_out_string(name, - ACPI_CAST_PTR(char, table->pointer)); - break; + acpi_os_printf("DMA Resource\n"); - case ACPI_RSD_STRING: - acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); - break; + switch (dma_data->type) { + case ACPI_COMPATIBILITY: + acpi_os_printf(" Compatibility mode\n"); + break; - /* Data items, 8/16/32/64 bit */ + case ACPI_TYPE_A: + acpi_os_printf(" Type A\n"); + break; - case ACPI_RSD_UINT8: - acpi_rs_out_integer8(name, ACPI_GET8(target)); - break; + case ACPI_TYPE_B: + acpi_os_printf(" Type B\n"); + break; - case ACPI_RSD_UINT16: - acpi_rs_out_integer16(name, ACPI_GET16(target)); - break; + case ACPI_TYPE_F: + acpi_os_printf(" Type F\n"); + break; - case ACPI_RSD_UINT32: - acpi_rs_out_integer32(name, ACPI_GET32(target)); - break; + default: + acpi_os_printf(" Invalid DMA type\n"); + break; + } - case ACPI_RSD_UINT64: - acpi_rs_out_integer64(name, ACPI_GET64(target)); - break; + acpi_os_printf(" %sBus Master\n", + ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); - /* Flags: 1-bit and 2-bit flags supported */ + switch (dma_data->transfer) { + case ACPI_TRANSFER_8: + acpi_os_printf(" 8-bit only transfer\n"); + break; - case ACPI_RSD_1BITFLAG: - acpi_rs_out_string(name, ACPI_CAST_PTR(char, - table-> - pointer[*target & - 0x01])); - break; + case ACPI_TRANSFER_8_16: + acpi_os_printf(" 8 and 16-bit transfer\n"); + break; - case ACPI_RSD_2BITFLAG: - acpi_rs_out_string(name, ACPI_CAST_PTR(char, - table-> - pointer[*target & - 0x03])); - break; + case ACPI_TRANSFER_16: + acpi_os_printf(" 16 bit only transfer\n"); + 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(*previous_target, - target); - } - break; + default: + acpi_os_printf(" Invalid transfer preference\n"); + 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(ACPI_GET16 - (previous_target), - target); - } - break; + acpi_os_printf(" Number of Channels: %X ( ", + dma_data->number_of_channels); - 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(*previous_target, - ACPI_CAST_PTR(u32, - target)); - } - break; + for (index = 0; index < dma_data->number_of_channels; index++) { + acpi_os_printf("%X ", dma_data->channels[index]); + } - case ACPI_RSD_ADDRESS: - /* - * Common flags for all Address resources - */ - acpi_rs_dump_address_common(ACPI_CAST_PTR - (union acpi_resource_data, - target)); - break; + acpi_os_printf(")\n"); + return; +} - case ACPI_RSD_SOURCE: - /* - * Optional resource_source for Address resources - */ - acpi_rs_dump_resource_source(ACPI_CAST_PTR - (struct - acpi_resource_source, - target)); - break; +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_start_depend_fns + * + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: None + * + * DESCRIPTION: Prints out the various members of the Data structure type. + * + ******************************************************************************/ - default: - acpi_os_printf("**** Invalid table opcode [%X] ****\n", - table->opcode); - return; - } +static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data) +{ + struct acpi_resource_start_dpf *sdf_data = + (struct acpi_resource_start_dpf *)data; + + ACPI_FUNCTION_ENTRY(); - table++; - count--; + acpi_os_printf("Start Dependent Functions Resource\n"); + + switch (sdf_data->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; } + + switch (sdf_data->performance_robustness) { + 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 performance robustness preference\n"); + break; + } + + return; +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_io + * + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: None + * + * DESCRIPTION: Prints out the various members of the Data structure type. + * + ******************************************************************************/ + +static void acpi_rs_dump_io(union acpi_resource_data *data) +{ + struct acpi_resource_io *io_data = (struct acpi_resource_io *)data; + + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("Io Resource\n"); + + acpi_os_printf(" %d bit decode\n", + ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); + + acpi_os_printf(" Range minimum base: %08X\n", + io_data->min_base_address); + + acpi_os_printf(" Range maximum base: %08X\n", + io_data->max_base_address); + + acpi_os_printf(" Alignment: %08X\n", io_data->alignment); + + acpi_os_printf(" Range Length: %08X\n", io_data->range_length); + + return; +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_fixed_io + * + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: None + * + * DESCRIPTION: Prints out the various members of the Data structure type. + * + ******************************************************************************/ + +static void acpi_rs_dump_fixed_io(union acpi_resource_data *data) +{ + struct acpi_resource_fixed_io *fixed_io_data = + (struct acpi_resource_fixed_io *)data; + + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("Fixed Io Resource\n"); + acpi_os_printf(" Range base address: %08X", + fixed_io_data->base_address); + + acpi_os_printf(" Range length: %08X", fixed_io_data->range_length); + + return; } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_resource_source + * FUNCTION: acpi_rs_dump_vendor_specific * - * PARAMETERS: resource_source - Pointer to a Resource Source struct + * PARAMETERS: Data - pointer to the resource structure to dump. * * RETURN: None * - * DESCRIPTION: Common routine for dumping the optional resource_source and the - * corresponding resource_source_index. + * DESCRIPTION: Prints out the various members of the Data structure type. * ******************************************************************************/ -static void -acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) +static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data) { + struct acpi_resource_vendor *vendor_data = + (struct acpi_resource_vendor *)data; + u16 index = 0; + ACPI_FUNCTION_ENTRY(); - if (resource_source->index == 0xFF) { - return; + acpi_os_printf("Vendor Specific Resource\n"); + + acpi_os_printf(" Length: %08X\n", vendor_data->length); + + for (index = 0; index < vendor_data->length; index++) { + acpi_os_printf(" Byte %X: %08X\n", + index, vendor_data->reserved[index]); } - acpi_rs_out_integer8("Resource Source Index", resource_source->index); + return; +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_memory24 + * + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: None + * + * DESCRIPTION: Prints out the various members of the Data structure type. + * + ******************************************************************************/ + +static void acpi_rs_dump_memory24(union acpi_resource_data *data) +{ + struct acpi_resource_mem24 *memory24_data = + (struct acpi_resource_mem24 *)data; + + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("24-Bit Memory Range Resource\n"); + + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + memory24_data->read_write_attribute ? + "/Write" : " only"); + + acpi_os_printf(" Range minimum base: %08X\n", + memory24_data->min_base_address); + + acpi_os_printf(" Range maximum base: %08X\n", + memory24_data->max_base_address); + + acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment); + + acpi_os_printf(" Range length: %08X\n", memory24_data->range_length); + + return; +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_memory32 + * + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: None + * + * DESCRIPTION: Prints out the various members of the Data structure type. + * + ******************************************************************************/ + +static void acpi_rs_dump_memory32(union acpi_resource_data *data) +{ + struct acpi_resource_mem32 *memory32_data = + (struct acpi_resource_mem32 *)data; + + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("32-Bit Memory Range Resource\n"); + + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + memory32_data->read_write_attribute ? + "/Write" : " only"); + + acpi_os_printf(" Range minimum base: %08X\n", + memory32_data->min_base_address); + + acpi_os_printf(" Range maximum base: %08X\n", + memory32_data->max_base_address); + + acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment); + + acpi_os_printf(" Range length: %08X\n", memory32_data->range_length); - acpi_rs_out_string("Resource Source", - resource_source->string_ptr ? - resource_source->string_ptr : "[Not Specified]"); + return; } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_address_common + * FUNCTION: acpi_rs_dump_fixed_memory32 * - * PARAMETERS: Resource - Pointer to an internal resource descriptor + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: + * + * DESCRIPTION: Prints out the various members of the Data structure type. + * + ******************************************************************************/ + +static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data) +{ + struct acpi_resource_fixed_mem32 *fixed_memory32_data = + (struct acpi_resource_fixed_mem32 *)data; + + ACPI_FUNCTION_ENTRY(); + + acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); + + acpi_os_printf(" Read%s\n", + ACPI_READ_WRITE_MEMORY == + fixed_memory32_data-> + read_write_attribute ? "/Write" : " Only"); + + acpi_os_printf(" Range base address: %08X\n", + fixed_memory32_data->range_base_address); + + acpi_os_printf(" Range length: %08X\n", + fixed_memory32_data->range_length); + + return; +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_address16 + * + * PARAMETERS: Data - pointer to the resource structure to dump. * * RETURN: None * - * DESCRIPTION: Dump the fields that are common to all Address resource - * descriptors + * DESCRIPTION: Prints out the various members of the Data structure type. * ******************************************************************************/ -static void acpi_rs_dump_address_common(union acpi_resource_data *resource) +static void acpi_rs_dump_address16(union acpi_resource_data *data) { + struct acpi_resource_address16 *address16_data = + (struct acpi_resource_address16 *)data; + ACPI_FUNCTION_ENTRY(); - /* Decode the type-specific flags */ + acpi_os_printf("16-Bit Address Space Resource\n"); + acpi_os_printf(" Resource Type: "); - switch (resource->address.resource_type) { + switch (address16_data->resource_type) { case ACPI_MEMORY_RANGE: - acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); + acpi_os_printf("Memory Range\n"); + + switch (address16_data->attribute.memory.cache_attribute) { + case ACPI_NON_CACHEABLE_MEMORY: + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); + break; + + case ACPI_CACHABLE_MEMORY: + acpi_os_printf(" Type Specific: Cacheable memory\n"); + break; + + case ACPI_WRITE_COMBINING_MEMORY: + acpi_os_printf + (" Type Specific: Write-combining memory\n"); + break; + + case ACPI_PREFETCHABLE_MEMORY: + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); + break; + + default: + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); + break; + } + + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address16_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); break; case ACPI_IO_RANGE: - acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); + acpi_os_printf("I/O Range\n"); + + switch (address16_data->attribute.io.range_attribute) { + case ACPI_NON_ISA_ONLY_RANGES: + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); + break; + + case ACPI_ISA_ONLY_RANGES: + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); + break; + + case ACPI_ENTIRE_RANGE: + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); + break; + + default: + acpi_os_printf + (" Type Specific: Invalid range attribute\n"); + break; + } + + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address16_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); break; case ACPI_BUS_NUMBER_RANGE: - acpi_rs_out_string("Resource Type", "Bus Number Range"); + acpi_os_printf("Bus Number Range\n"); break; default: - acpi_rs_out_integer8("Resource Type", - (u8) resource->address.resource_type); + acpi_os_printf("0x%2.2X\n", address16_data->resource_type); break; } - /* Decode the general flags */ + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address16_data->producer_consumer ? + "Consumer" : "Producer"); + + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address16_data->decode ? + "Subtractive" : "Positive"); - acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? + "" : "not"); + + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? + "" : "not"); + + acpi_os_printf(" Granularity: %08X\n", address16_data->granularity); + + acpi_os_printf(" Address range min: %08X\n", + address16_data->min_address_range); + + acpi_os_printf(" Address range max: %08X\n", + address16_data->max_address_range); + + acpi_os_printf(" Address translation offset: %08X\n", + address16_data->address_translation_offset); + + acpi_os_printf(" Address Length: %08X\n", + address16_data->address_length); + + if (0xFF != address16_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X\n", + address16_data->resource_source.index); + + acpi_os_printf(" Resource Source: %s\n", + address16_data->resource_source.string_ptr); + } + + return; } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_resource_list + * FUNCTION: acpi_rs_dump_address32 * - * PARAMETERS: resource_list - Pointer to a resource descriptor list + * PARAMETERS: Data - pointer to the resource structure to dump. * * RETURN: None * - * DESCRIPTION: Dispatches the structure to the correct dump routine. + * DESCRIPTION: Prints out the various members of the Data structure type. * ******************************************************************************/ -void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) +static void acpi_rs_dump_address32(union acpi_resource_data *data) { - u32 count = 0; - u32 type; + struct acpi_resource_address32 *address32_data = + (struct acpi_resource_address32 *)data; ACPI_FUNCTION_ENTRY(); - if (!(acpi_dbg_level & ACPI_LV_RESOURCES) - || !(_COMPONENT & acpi_dbg_layer)) { - return; - } + acpi_os_printf("32-Bit Address Space Resource\n"); - /* Walk list and dump all resource descriptors (END_TAG terminates) */ + switch (address32_data->resource_type) { + case ACPI_MEMORY_RANGE: + + acpi_os_printf(" Resource Type: Memory Range\n"); + + switch (address32_data->attribute.memory.cache_attribute) { + case ACPI_NON_CACHEABLE_MEMORY: + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); + break; + + case ACPI_CACHABLE_MEMORY: + acpi_os_printf(" Type Specific: Cacheable memory\n"); + break; + + case ACPI_WRITE_COMBINING_MEMORY: + acpi_os_printf + (" Type Specific: Write-combining memory\n"); + break; + + case ACPI_PREFETCHABLE_MEMORY: + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); + break; + + default: + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); + break; + } + + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address32_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); + break; + + case ACPI_IO_RANGE: + + acpi_os_printf(" Resource Type: Io Range\n"); + + switch (address32_data->attribute.io.range_attribute) { + case ACPI_NON_ISA_ONLY_RANGES: + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); + break; - do { - acpi_os_printf("\n[%02X] ", count); - count++; + case ACPI_ISA_ONLY_RANGES: + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); + break; - /* Validate Type before dispatch */ + case ACPI_ENTIRE_RANGE: + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); + break; - type = resource_list->type; - if (type > ACPI_RESOURCE_TYPE_MAX) { + default: acpi_os_printf - ("Invalid descriptor type (%X) in resource list\n", - resource_list->type); - return; + (" Type Specific: Invalid Range attribute"); + break; } - /* Dump the resource descriptor */ + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address32_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); + break; + + case ACPI_BUS_NUMBER_RANGE: + + acpi_os_printf(" Resource Type: Bus Number Range\n"); + break; + + default: + + acpi_os_printf(" Resource Type: 0x%2.2X\n", + address32_data->resource_type); + break; + } + + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address32_data->producer_consumer ? + "Consumer" : "Producer"); + + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address32_data->decode ? + "Subtractive" : "Positive"); + + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? + "" : "not "); + + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? + "" : "not "); - acpi_rs_dump_descriptor(&resource_list->data, - acpi_gbl_dump_resource_dispatch[type]); + acpi_os_printf(" Granularity: %08X\n", address32_data->granularity); - /* Point to the next resource structure */ + acpi_os_printf(" Address range min: %08X\n", + address32_data->min_address_range); - resource_list = - ACPI_ADD_PTR(struct acpi_resource, resource_list, - resource_list->length); + acpi_os_printf(" Address range max: %08X\n", + address32_data->max_address_range); - /* Exit when END_TAG descriptor is reached */ + acpi_os_printf(" Address translation offset: %08X\n", + address32_data->address_translation_offset); - } while (type != ACPI_RESOURCE_TYPE_END_TAG); + acpi_os_printf(" Address Length: %08X\n", + address32_data->address_length); + + if (0xFF != address32_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X\n", + address32_data->resource_source.index); + + acpi_os_printf(" Resource Source: %s\n", + address32_data->resource_source.string_ptr); + } + + return; } /******************************************************************************* * - * FUNCTION: acpi_rs_dump_irq_list + * FUNCTION: acpi_rs_dump_address64 * - * PARAMETERS: route_table - Pointer to the routing table to dump. + * PARAMETERS: Data - pointer to the resource structure to dump. * * RETURN: None * - * DESCRIPTION: Print IRQ routing table + * DESCRIPTION: Prints out the various members of the Data structure type. * ******************************************************************************/ -void acpi_rs_dump_irq_list(u8 * route_table) +static void acpi_rs_dump_address64(union acpi_resource_data *data) { - struct acpi_pci_routing_table *prt_element; - u8 count; + struct acpi_resource_address64 *address64_data = + (struct acpi_resource_address64 *)data; ACPI_FUNCTION_ENTRY(); - if (!(acpi_dbg_level & ACPI_LV_RESOURCES) - || !(_COMPONENT & acpi_dbg_layer)) { - return; + acpi_os_printf("64-Bit Address Space Resource\n"); + + switch (address64_data->resource_type) { + case ACPI_MEMORY_RANGE: + + acpi_os_printf(" Resource Type: Memory Range\n"); + + switch (address64_data->attribute.memory.cache_attribute) { + case ACPI_NON_CACHEABLE_MEMORY: + acpi_os_printf + (" Type Specific: Noncacheable memory\n"); + break; + + case ACPI_CACHABLE_MEMORY: + acpi_os_printf(" Type Specific: Cacheable memory\n"); + break; + + case ACPI_WRITE_COMBINING_MEMORY: + acpi_os_printf + (" Type Specific: Write-combining memory\n"); + break; + + case ACPI_PREFETCHABLE_MEMORY: + acpi_os_printf + (" Type Specific: Prefetchable memory\n"); + break; + + default: + acpi_os_printf + (" Type Specific: Invalid cache attribute\n"); + break; + } + + acpi_os_printf(" Type Specific: Read%s\n", + ACPI_READ_WRITE_MEMORY == + address64_data->attribute.memory. + read_write_attribute ? "/Write" : " Only"); + break; + + case ACPI_IO_RANGE: + + acpi_os_printf(" Resource Type: Io Range\n"); + + switch (address64_data->attribute.io.range_attribute) { + case ACPI_NON_ISA_ONLY_RANGES: + acpi_os_printf + (" Type Specific: Non-ISA Io Addresses\n"); + break; + + case ACPI_ISA_ONLY_RANGES: + acpi_os_printf(" Type Specific: ISA Io Addresses\n"); + break; + + case ACPI_ENTIRE_RANGE: + acpi_os_printf + (" Type Specific: ISA and non-ISA Io Addresses\n"); + break; + + default: + acpi_os_printf + (" Type Specific: Invalid Range attribute"); + break; + } + + acpi_os_printf(" Type Specific: %s Translation\n", + ACPI_SPARSE_TRANSLATION == + address64_data->attribute.io. + translation_attribute ? "Sparse" : "Dense"); + break; + + case ACPI_BUS_NUMBER_RANGE: + + acpi_os_printf(" Resource Type: Bus Number Range\n"); + break; + + default: + + acpi_os_printf(" Resource Type: 0x%2.2X\n", + address64_data->resource_type); + break; } - prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == address64_data->producer_consumer ? + "Consumer" : "Producer"); + + acpi_os_printf(" %s decode\n", + ACPI_SUB_DECODE == address64_data->decode ? + "Subtractive" : "Positive"); + + acpi_os_printf(" Min address is %s fixed\n", + ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? + "" : "not "); + + acpi_os_printf(" Max address is %s fixed\n", + ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? + "" : "not "); - /* Dump all table elements, Exit on zero length element */ + acpi_os_printf(" Granularity: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->granularity)); - 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); + acpi_os_printf(" Address range min: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->min_address_range)); - prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table, - prt_element, prt_element->length); + acpi_os_printf(" Address range max: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->max_address_range)); + + acpi_os_printf(" Address translation offset: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data-> + address_translation_offset)); + + acpi_os_printf(" Address Length: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data->address_length)); + + acpi_os_printf(" Type Specific Attributes: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(address64_data-> + type_specific_attributes)); + + if (0xFF != address64_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X\n", + address64_data->resource_source.index); + + acpi_os_printf(" Resource Source: %s\n", + address64_data->resource_source.string_ptr); } + + return; } /******************************************************************************* * - * FUNCTION: acpi_rs_out* + * FUNCTION: acpi_rs_dump_extended_irq * - * PARAMETERS: Title - Name of the resource field - * Value - Value of the resource field + * PARAMETERS: Data - pointer to the resource structure to dump. * * RETURN: None * - * DESCRIPTION: Miscellaneous helper functions to consistently format the - * output of the resource dump routines + * DESCRIPTION: Prints out the various members of the Data structure type. * ******************************************************************************/ -static void acpi_rs_out_string(char *title, char *value) +static void acpi_rs_dump_extended_irq(union acpi_resource_data *data) { - acpi_os_printf("%27s : %s\n", title, value); -} + struct acpi_resource_ext_irq *ext_irq_data = + (struct acpi_resource_ext_irq *)data; + u8 index = 0; -static void acpi_rs_out_integer8(char *title, u8 value) -{ - acpi_os_printf("%27s : %2.2X\n", title, value); -} + ACPI_FUNCTION_ENTRY(); -static void acpi_rs_out_integer16(char *title, u16 value) -{ - acpi_os_printf("%27s : %4.4X\n", title, value); -} + acpi_os_printf("Extended IRQ Resource\n"); -static void acpi_rs_out_integer32(char *title, u32 value) -{ - acpi_os_printf("%27s : %8.8X\n", title, value); -} + acpi_os_printf(" Resource %s\n", + ACPI_CONSUMER == ext_irq_data->producer_consumer ? + "Consumer" : "Producer"); -static void acpi_rs_out_integer64(char *title, u64 value) -{ - acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); -} + acpi_os_printf(" %s\n", + ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? + "Level" : "Edge"); -static void acpi_rs_out_title(char *title) -{ - acpi_os_printf("%27s : ", title); + acpi_os_printf(" Active %s\n", + ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? + "low" : "high"); + + acpi_os_printf(" %s\n", + ACPI_SHARED == ext_irq_data->shared_exclusive ? + "Shared" : "Exclusive"); + + acpi_os_printf(" Interrupts : %X ( ", + ext_irq_data->number_of_interrupts); + + for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { + acpi_os_printf("%X ", ext_irq_data->interrupts[index]); + } + + acpi_os_printf(")\n"); + + if (0xFF != ext_irq_data->resource_source.index) { + acpi_os_printf(" Resource Source Index: %X", + ext_irq_data->resource_source.index); + + acpi_os_printf(" Resource Source: %s", + ext_irq_data->resource_source.string_ptr); + } + + return; } /******************************************************************************* * - * FUNCTION: acpi_rs_dump*List + * FUNCTION: acpi_rs_dump_resource_list * - * PARAMETERS: Length - Number of elements in the list - * Data - Start of the list + * PARAMETERS: Resource - pointer to the resource structure to dump. * * RETURN: None * - * DESCRIPTION: Miscellaneous functions to dump lists of raw data + * DESCRIPTION: Dispatches the structure to the correct dump routine. * ******************************************************************************/ -static void acpi_rs_dump_byte_list(u16 length, u8 * data) +void acpi_rs_dump_resource_list(struct acpi_resource *resource) { - u8 i; + u8 count = 0; + u8 done = FALSE; - for (i = 0; i < length; i++) { - acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); - } -} + ACPI_FUNCTION_ENTRY(); -static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) -{ - u8 i; + if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { + while (!done) { + acpi_os_printf("Resource structure %X.\n", count++); + + switch (resource->id) { + case ACPI_RSTYPE_IRQ: + acpi_rs_dump_irq(&resource->data); + break; + + case ACPI_RSTYPE_DMA: + acpi_rs_dump_dma(&resource->data); + break; + + case ACPI_RSTYPE_START_DPF: + acpi_rs_dump_start_depend_fns(&resource->data); + break; + + case ACPI_RSTYPE_END_DPF: + acpi_os_printf + ("end_dependent_functions Resource\n"); + /* acpi_rs_dump_end_dependent_functions (Resource->Data); */ + break; + + case ACPI_RSTYPE_IO: + acpi_rs_dump_io(&resource->data); + break; + + case ACPI_RSTYPE_FIXED_IO: + acpi_rs_dump_fixed_io(&resource->data); + break; + + case ACPI_RSTYPE_VENDOR: + acpi_rs_dump_vendor_specific(&resource->data); + break; + + case ACPI_RSTYPE_END_TAG: + /*rs_dump_end_tag (Resource->Data); */ + acpi_os_printf("end_tag Resource\n"); + done = TRUE; + break; + + case ACPI_RSTYPE_MEM24: + acpi_rs_dump_memory24(&resource->data); + break; + + case ACPI_RSTYPE_MEM32: + acpi_rs_dump_memory32(&resource->data); + break; + + case ACPI_RSTYPE_FIXED_MEM32: + acpi_rs_dump_fixed_memory32(&resource->data); + break; + + case ACPI_RSTYPE_ADDRESS16: + acpi_rs_dump_address16(&resource->data); + break; + + case ACPI_RSTYPE_ADDRESS32: + acpi_rs_dump_address32(&resource->data); + break; + + case ACPI_RSTYPE_ADDRESS64: + acpi_rs_dump_address64(&resource->data); + break; + + case ACPI_RSTYPE_EXT_IRQ: + acpi_rs_dump_extended_irq(&resource->data); + break; + + default: + acpi_os_printf("Invalid resource type\n"); + break; + + } - for (i = 0; i < length; i++) { - acpi_os_printf("%X ", data[i]); + resource = + ACPI_PTR_ADD(struct acpi_resource, resource, + resource->length); + } } - acpi_os_printf("\n"); + + return; } -static void acpi_rs_dump_dword_list(u8 length, u32 * data) +/******************************************************************************* + * + * FUNCTION: acpi_rs_dump_irq_list + * + * PARAMETERS: route_table - pointer to the routing table to dump. + * + * RETURN: None + * + * DESCRIPTION: Dispatches the structures to the correct dump routine. + * + ******************************************************************************/ + +void acpi_rs_dump_irq_list(u8 * route_table) { - u8 i; + u8 *buffer = route_table; + u8 count = 0; + u8 done = FALSE; + struct acpi_pci_routing_table *prt_element; + + ACPI_FUNCTION_ENTRY(); + + if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { + prt_element = + ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); + + while (!done) { + acpi_os_printf("PCI IRQ Routing Table structure %X.\n", + count++); + + acpi_os_printf(" Address: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64(prt_element-> + address)); - for (i = 0; i < length; i++) { - acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); + acpi_os_printf(" Pin: %X\n", prt_element->pin); + + acpi_os_printf(" Source: %s\n", prt_element->source); + + acpi_os_printf(" source_index: %X\n", + prt_element->source_index); + + buffer += prt_element->length; + prt_element = + ACPI_CAST_PTR(struct acpi_pci_routing_table, + buffer); + if (0 == prt_element->length) { + done = TRUE; + } + } } + + return; } #endif diff --git a/trunk/drivers/acpi/resources/rsinfo.c b/trunk/drivers/acpi/resources/rsinfo.c deleted file mode 100644 index d9ae64b77bd9..000000000000 --- a/trunk/drivers/acpi/resources/rsinfo.c +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * - * Module Name: rsinfo - Dispatch and Info tables - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2006, R. Byron Moore - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#include -#include - -#define _COMPONENT ACPI_RESOURCES -ACPI_MODULE_NAME("rsinfo") - -/* - * Resource dispatch and information tables. Any new resource types (either - * Large or Small) must be reflected in each of these tables, so they are here - * in one place. - * - * The tables for Large descriptors are indexed by bits 6:0 of the AML - * descriptor type byte. The tables for Small descriptors are indexed by - * bits 6:3 of the descriptor byte. The tables for internal resource - * descriptors are indexed by the acpi_resource_type field. - */ -/* Dispatch table for resource-to-AML (Set Resource) conversion functions */ -struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = { - acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ - acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ - acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ - 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_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 */ - -struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = { - /* Small descriptors */ - - NULL, /* 0x00, Reserved */ - NULL, /* 0x01, Reserved */ - NULL, /* 0x02, Reserved */ - NULL, /* 0x03, Reserved */ - acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ - acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ - acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ - 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_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ - acpi_rs_convert_end_tag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ - - /* Large descriptors */ - - NULL, /* 0x00, Reserved */ - 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_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 -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -/* Dispatch table for resource dump functions */ - -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 */ - acpi_rs_dump_end_dpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ - acpi_rs_dump_io, /* ACPI_RESOURCE_TYPE_IO */ - acpi_rs_dump_fixed_io, /* ACPI_RESOURCE_TYPE_FIXED_IO */ - acpi_rs_dump_vendor, /* ACPI_RESOURCE_TYPE_VENDOR */ - acpi_rs_dump_end_tag, /* ACPI_RESOURCE_TYPE_END_TAG */ - acpi_rs_dump_memory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */ - acpi_rs_dump_memory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */ - acpi_rs_dump_fixed_memory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ - acpi_rs_dump_address16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */ - acpi_rs_dump_address32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */ - 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 */ -}; -#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) - */ -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) */ - sizeof(struct aml_resource_end_dependent), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ - sizeof(struct aml_resource_io), /* ACPI_RESOURCE_TYPE_IO */ - sizeof(struct aml_resource_fixed_io), /* ACPI_RESOURCE_TYPE_FIXED_IO */ - sizeof(struct aml_resource_vendor_small), /* ACPI_RESOURCE_TYPE_VENDOR */ - sizeof(struct aml_resource_end_tag), /* ACPI_RESOURCE_TYPE_END_TAG */ - sizeof(struct aml_resource_memory24), /* ACPI_RESOURCE_TYPE_MEMORY24 */ - sizeof(struct aml_resource_memory32), /* ACPI_RESOURCE_TYPE_MEMORY32 */ - sizeof(struct aml_resource_fixed_memory32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ - sizeof(struct aml_resource_address16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */ - sizeof(struct aml_resource_address32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */ - sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ - sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ - sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ - sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ -}; - -const u8 acpi_gbl_resource_struct_sizes[] = { - /* Small descriptors */ - - 0, - 0, - 0, - 0, - ACPI_RS_SIZE(struct acpi_resource_irq), - ACPI_RS_SIZE(struct acpi_resource_dma), - ACPI_RS_SIZE(struct acpi_resource_start_dependent), - ACPI_RS_SIZE_MIN, - ACPI_RS_SIZE(struct acpi_resource_io), - ACPI_RS_SIZE(struct acpi_resource_fixed_io), - 0, - 0, - 0, - 0, - ACPI_RS_SIZE(struct acpi_resource_vendor), - ACPI_RS_SIZE_MIN, - - /* Large descriptors */ - - 0, - ACPI_RS_SIZE(struct acpi_resource_memory24), - ACPI_RS_SIZE(struct acpi_resource_generic_register), - 0, - ACPI_RS_SIZE(struct acpi_resource_vendor), - ACPI_RS_SIZE(struct acpi_resource_memory32), - ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), - ACPI_RS_SIZE(struct acpi_resource_address32), - ACPI_RS_SIZE(struct acpi_resource_address16), - ACPI_RS_SIZE(struct acpi_resource_extended_irq), - ACPI_RS_SIZE(struct acpi_resource_address64), - ACPI_RS_SIZE(struct acpi_resource_extended_address64) -}; diff --git a/trunk/drivers/acpi/resources/rsio.c b/trunk/drivers/acpi/resources/rsio.c index ea567167c4f2..d53bbe89e851 100644 --- a/trunk/drivers/acpi/resources/rsio.c +++ b/trunk/drivers/acpi/resources/rsio.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,206 +49,428 @@ ACPI_MODULE_NAME("rsio") /******************************************************************************* * - * acpi_rs_convert_io + * FUNCTION: acpi_rs_io_resource * - ******************************************************************************/ -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)}, - - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, - sizeof(struct aml_resource_io), - 0}, - - /* Decode flag */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.io.io_decode), - AML_OFFSET(io.flags), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Address Alignment - * Length - * Minimum Base Address - * Maximum Base Address - */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.io.alignment), - AML_OFFSET(io.alignment), - 2}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.io.minimum), - AML_OFFSET(io.minimum), - 2} -}; - -/******************************************************************************* + * 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 + * + * RETURN: Status * - * acpi_rs_convert_fixed_io + * 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. * ******************************************************************************/ +acpi_status +acpi_rs_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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_io_resource"); + + /* The number of bytes consumed are Constant */ + + *bytes_consumed = 8; + + output_struct->id = ACPI_RSTYPE_IO; + + /* 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 */ -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}, - /* - * These fields are contiguous in both the source and destination: - * Base Address - * Length - */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_io.address_length), - AML_OFFSET(fixed_io.address_length), - 1}, - - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_io.address), - AML_OFFSET(fixed_io.address), - 1} -}; + buffer += 2; + ACPI_MOVE_16_TO_16(&temp16, buffer); + + output_struct->data.io.max_base_address = temp16; + + /* Check Base alignment */ + + buffer += 2; + temp8 = *buffer; + + output_struct->data.io.alignment = temp8; + + /* Check range_length */ + + buffer += 1; + temp8 = *buffer; + + output_struct->data.io.range_length = temp8; + + /* Set the Length parameter */ + + output_struct->length = (u32) struct_size; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_generic_reg + * FUNCTION: acpi_rs_fixed_io_resource + * + * 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 + * + * 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. * ******************************************************************************/ -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}, - /* - * These fields are contiguous in both the source and destination: - * Address Space ID - * Register Bit Width - * Register Bit Offset - * Access Size - */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.generic_reg.space_id), - AML_OFFSET(generic_reg.address_space_id), - 4}, - - /* Get the Register Address */ - - {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.generic_reg.address), - AML_OFFSET(generic_reg.address), - 1} -}; +acpi_status +acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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"); + + /* The number of bytes consumed are Constant */ + + *bytes_consumed = 4; + + output_struct->id = ACPI_RSTYPE_FIXED_IO; + + /* Check Range Base Address */ + + 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; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_end_dpf + * FUNCTION: acpi_rs_io_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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_status +acpi_rs_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + + ACPI_FUNCTION_TRACE("rs_io_stream"); + + /* The descriptor field is static */ + + *buffer = 0x47; + buffer += 1; + + /* Io Information Byte */ + + temp8 = (u8) (linked_list->data.io.io_decode & 0x01); + + *buffer = temp8; + buffer += 1; + + /* Set the Range minimum base address */ + + temp16 = (u16) linked_list->data.io.min_base_address; + + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set the Range maximum base address */ + + temp16 = (u16) linked_list->data.io.max_base_address; - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, - sizeof(struct aml_resource_end_dependent), - 0} -}; + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set the base alignment */ + + temp8 = (u8) linked_list->data.io.alignment; + + *buffer = temp8; + buffer += 1; + + /* Set the range length */ + + temp8 = (u8) linked_list->data.io.range_length; + + *buffer = temp8; + buffer += 1; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_end_tag + * FUNCTION: acpi_rs_fixed_io_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, - - /* - * 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_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, - sizeof(struct aml_resource_end_tag), - 0} -}; +acpi_status +acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + + ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); + + /* The descriptor field is static */ + + *buffer = 0x4B; + + buffer += 1; + + /* Set the Range base address */ + + temp16 = (u16) linked_list->data.fixed_io.base_address; + + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set the range length */ + + temp8 = (u8) linked_list->data.fixed_io.range_length; + + *buffer = temp8; + buffer += 1; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_get_start_dpf + * FUNCTION: acpi_rs_dma_resource + * + * 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 + * + * 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. * ******************************************************************************/ -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_status +acpi_rs_dma_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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); + + ACPI_FUNCTION_TRACE("rs_dma_resource"); + + /* The number of bytes consumed are Constant */ - /* Defaults for Compatibility and Performance priorities */ + *bytes_consumed = 3; + output_struct->id = ACPI_RSTYPE_DMA; - {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), - ACPI_ACCEPTABLE_CONFIGURATION, - 2}, + /* Point to the 8-bits of Byte 1 */ - /* All done if there is no flag byte present in the descriptor */ + buffer += 1; + temp8 = *buffer; - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, + /* Decode the DMA channel bits */ - /* Flag byte is present, get the flags */ + for (i = 0, index = 0; index < 8; index++) { + if ((temp8 >> index) & 0x01) { + output_struct->data.dma.channels[i] = index; + i++; + } + } - {ACPI_RSC_2BITFLAG, - ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), - AML_OFFSET(start_dpf.flags), - 0}, + /* Zero DMA channels is valid */ - {ACPI_RSC_2BITFLAG, - ACPI_RS_OFFSET(data.start_dpf.performance_robustness), - AML_OFFSET(start_dpf.flags), - 2} -}; + output_struct->data.dma.number_of_channels = i; + if (i > 0) { + /* Calculate the structure size based upon the number of interrupts */ + + struct_size += ((acpi_size) i - 1) * 4; + } + + /* Point to Byte 2 */ + + buffer += 1; + temp8 = *buffer; + + /* Check for transfer preference (Bits[1:0]) */ + + output_struct->data.dma.transfer = temp8 & 0x03; + + if (0x03 == output_struct->data.dma.transfer) { + 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]) */ + + 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; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_set_start_dpf + * FUNCTION: acpi_rs_dma_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, - - /* Set the default flag values */ - - {ACPI_RSC_2BITFLAG, - ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), - AML_OFFSET(start_dpf.flags), - 0}, - - {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}, - - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.start_dpf.performance_robustness), - ACPI_ACCEPTABLE_CONFIGURATION}, - - /* Flag byte is not necessary */ - - {ACPI_RSC_LENGTH, 0, 0, - sizeof(struct aml_resource_start_dependent_noprio)} -}; +acpi_status +acpi_rs_dma_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + + ACPI_FUNCTION_TRACE("rs_dma_stream"); + + /* The descriptor field is static */ + + *buffer = 0x2A; + buffer += 1; + temp8 = 0; + + /* Loop through all of the Channels and set the mask bits */ + + for (index = 0; + index < linked_list->data.dma.number_of_channels; index++) { + temp16 = (u16) linked_list->data.dma.channels[index]; + temp8 |= 0x1 << temp16; + } + + *buffer = temp8; + buffer += 1; + + /* Set the DMA Info */ + + temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); + temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); + temp8 |= (linked_list->data.dma.transfer & 0x03); + + *buffer = temp8; + buffer += 1; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} diff --git a/trunk/drivers/acpi/resources/rsirq.c b/trunk/drivers/acpi/resources/rsirq.c index 1fa63bc2e36f..56043fee96cb 100644 --- a/trunk/drivers/acpi/resources/rsirq.c +++ b/trunk/drivers/acpi/resources/rsirq.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,182 +49,504 @@ ACPI_MODULE_NAME("rsirq") /******************************************************************************* * - * acpi_rs_get_irq + * FUNCTION: acpi_rs_irq_resource + * + * 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 + * + * 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. * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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->id = ACPI_RSTYPE_IRQ; + + /* Point to the 16-bits of Bytes 1 and 2 */ + + buffer += 1; + ACPI_MOVE_16_TO_16(&temp16, buffer); + + output_struct->data.irq.number_of_interrupts = 0; + + /* Decode the IRQ bits */ + + for (i = 0, index = 0; index < 16; index++) { + if ((temp16 >> index) & 0x01) { + output_struct->data.irq.interrupts[i] = index; + i++; + } + } - /* Get the IRQ mask (bytes 1:2) */ + /* Zero interrupts is valid */ - {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), - AML_OFFSET(irq.irq_mask), - ACPI_RS_OFFSET(data.irq.interrupt_count)}, + output_struct->data.irq.number_of_interrupts = i; + if (i > 0) { + /* Calculate the structure size based upon the number of interrupts */ - /* Set default flags (others are zero) */ + struct_size += ((acpi_size) i - 1) * 4; + } - {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.irq.triggering), - ACPI_EDGE_SENSITIVE, - 1}, + /* Point to Byte 3 if it is used */ - /* All done if no flag byte present in descriptor */ + if (4 == *bytes_consumed) { + buffer += 2; + temp8 = *buffer; - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, + /* Check for HE, LL interrupts */ - /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ + switch (temp8 & 0x09) { + case 0x01: /* HE */ + output_struct->data.irq.edge_level = + ACPI_EDGE_SENSITIVE; + output_struct->data.irq.active_high_low = + ACPI_ACTIVE_HIGH; + break; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), - AML_OFFSET(irq.flags), - 0}, + case 0x08: /* LL */ + output_struct->data.irq.edge_level = + ACPI_LEVEL_SENSITIVE; + output_struct->data.irq.active_high_low = + ACPI_ACTIVE_LOW; + break; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), - AML_OFFSET(irq.flags), - 3}, + 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", + temp8)); + return_ACPI_STATUS(AE_BAD_DATA); + } - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), - AML_OFFSET(irq.flags), - 4} -}; + /* Check for sharable */ + + output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; + } else { + /* + * Assume Edge Sensitive, Active High, Non-Sharable + * per 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; + } + + /* Set the Length parameter */ + + output_struct->length = (u32) struct_size; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_set_irq + * FUNCTION: acpi_rs_irq_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + u8 IRqinfo_byte_needed; - /* Convert interrupt list to 16-bit IRQ bitmask */ + ACPI_FUNCTION_TRACE("rs_irq_stream"); - {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), - AML_OFFSET(irq.irq_mask), - ACPI_RS_OFFSET(data.irq.interrupt_count)}, + /* + * 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; + IRqinfo_byte_needed = FALSE; + } else { + *buffer = 0x23; + IRqinfo_byte_needed = TRUE; + } + + buffer += 1; + temp16 = 0; + + /* 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]; + temp16 |= 0x1 << temp8; + } + + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set the IRQ Info byte if needed. */ + + if (IRqinfo_byte_needed) { + temp8 = 0; + temp8 = (u8) ((linked_list->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) { + temp8 |= 0x08; + } else { + temp8 |= 0x01; + } + + *buffer = temp8; + buffer += 1; + } + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} - /* Set the flags byte by default */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_extended_irq_resource + * + * 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 + * + * 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. + * + ******************************************************************************/ + +acpi_status +acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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"); + + /* Get the Descriptor Length field */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), - AML_OFFSET(irq.flags), - 0}, + buffer += 1; + ACPI_MOVE_16_TO_16(&temp16, buffer); - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), - AML_OFFSET(irq.flags), - 3}, + /* Validate minimum descriptor length */ + + if (temp16 < 6) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); + } + + *bytes_consumed = temp16 + 3; + output_struct->id = ACPI_RSTYPE_EXT_IRQ; + + /* Point to the Byte3 */ + + buffer += 2; + temp8 = *buffer; + + output_struct->data.extended_irq.producer_consumer = temp8 & 0x01; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), - AML_OFFSET(irq.flags), - 4}, /* - * Check if the flags byte is necessary. Not needed if the flags are: - * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE + * 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 */ - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.irq.triggering), - ACPI_EDGE_SENSITIVE}, + output_struct->data.extended_irq.edge_level = + (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.irq.polarity), - ACPI_ACTIVE_HIGH}, + /* Check Interrupt Polarity */ - {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.irq.sharable), - ACPI_EXCLUSIVE}, + output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; - /* irq_no_flags() descriptor can be used */ + /* Check for sharable */ - {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} -}; + output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; -/******************************************************************************* - * - * acpi_rs_convert_ext_irq - * - ******************************************************************************/ + /* Point to Byte4 (IRQ Table length) */ + + buffer += 1; + temp8 = *buffer; -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)}, + /* Must have at least one IRQ */ - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ, - sizeof(struct aml_resource_extended_irq), - 0}, + if (temp8 < 1) { + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); + } - /* Flag bits */ + output_struct->data.extended_irq.number_of_interrupts = temp8; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), - AML_OFFSET(extended_irq.flags), - 0}, + /* + * Add any additional structure size to properly calculate + * the next pointer at the end of this function + */ + struct_size += (temp8 - 1) * 4; + + /* Point to Byte5 (First IRQ Number) */ + + buffer += 1; + + /* Cycle through every IRQ in the table */ + + for (index = 0; index < temp8; index++) { + ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq. + interrupts[index], buffer); + + /* Point to the next IRQ */ + + 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 */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.triggering), - AML_OFFSET(extended_irq.flags), - 1}, + temp8 = *buffer; + output_struct->data.extended_irq.resource_source.index = + (u32) temp8; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.polarity), - AML_OFFSET(extended_irq.flags), - 2}, + /* Point to the String */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable), - AML_OFFSET(extended_irq.flags), - 3}, + buffer += 1; - /* IRQ Table length (Byte4) */ + /* Point the String pointer to the end of this structure. */ - {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), - AML_OFFSET(extended_irq.interrupt_count), - sizeof(u32)} - , + output_struct->data.extended_irq.resource_source.string_ptr = + (char *)((char *)output_struct + struct_size); - /* Copy every IRQ in the table, each is 32 bits */ + temp_ptr = (u8 *) + output_struct->data.extended_irq.resource_source.string_ptr; - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), - AML_OFFSET(extended_irq.interrupts[0]), - 0} - , + /* Copy the string into the buffer */ - /* Optional resource_source (Index and String) */ + index = 0; + while (*buffer) { + *temp_ptr = *buffer; - {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)} -}; + 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; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_dma + * FUNCTION: acpi_rs_extended_irq_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 *length_field; + u8 temp8 = 0; + u8 index; - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA, - sizeof(struct aml_resource_dma), - 0}, + ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); - /* Flags: transfer preference, bus mastering, channel speed */ + /* Set the Descriptor Type field */ - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.transfer), - AML_OFFSET(dma.flags), - 0}, + *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT; + buffer += 1; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.dma.bus_master), - AML_OFFSET(dma.flags), - 2}, + /* Save a pointer to the Length field - to be filled in later */ - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.type), - AML_OFFSET(dma.flags), - 5}, + length_field = ACPI_CAST_PTR(u16, buffer); + buffer += 2; - /* DMA channel mask bits */ + /* Set the Interrupt vector flags */ - {ACPI_RSC_BITMASK, ACPI_RS_OFFSET(data.dma.channels[0]), - AML_OFFSET(dma.dma_channel_mask), - ACPI_RS_OFFSET(data.dma.channel_count)} -}; + temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01); + temp8 |= + ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); + + /* + * 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 (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) { + temp8 |= 0x2; + } + + /* Set the Interrupt Polarity */ + + temp8 |= ((linked_list->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; + + *buffer = temp8; + buffer += 1; + + for (index = 0; + index < linked_list->data.extended_irq.number_of_interrupts; + index++) { + ACPI_MOVE_32_TO_32(buffer, + &linked_list->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) { + *buffer = + (u8) linked_list->data.extended_irq.resource_source.index; + buffer += 1; + + /* Copy the string */ + + ACPI_STRCPY((char *)buffer, + linked_list->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 + (linked_list->data.extended_irq. + 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); + return_ACPI_STATUS(AE_OK); +} diff --git a/trunk/drivers/acpi/resources/rslist.c b/trunk/drivers/acpi/resources/rslist.c index e4778a51c17e..103eb31c284e 100644 --- a/trunk/drivers/acpi/resources/rslist.c +++ b/trunk/drivers/acpi/resources/rslist.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,89 +49,294 @@ ACPI_MODULE_NAME("rslist") /******************************************************************************* * - * FUNCTION: acpi_rs_convert_aml_to_resources + * FUNCTION: acpi_rs_get_resource_type * - * PARAMETERS: Aml - Pointer to the resource byte stream - * aml_length - Length of Aml - * output_buffer - Pointer to the buffer that will - * contain the output structures + * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor * - * RETURN: Status + * RETURN: The Resource Type with no extraneous bits * - * DESCRIPTION: Takes the resource byte stream and parses it, creating a - * linked list of resources in the caller's output buffer + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. * ******************************************************************************/ -acpi_status -acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) +u8 acpi_rs_get_resource_type(u8 resource_start_byte) { - struct acpi_resource *resource = (void *)output_buffer; - acpi_status status; - u8 resource_index; - u8 *end_aml; - ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); + ACPI_FUNCTION_ENTRY(); - end_aml = aml + aml_length; + /* Determine if this is a small or large resource */ - /* Loop until end-of-buffer or an end_tag is found */ + switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { + case ACPI_RDESC_TYPE_SMALL: - while (aml < end_aml) { - /* Validate the Resource Type and Resource Length */ + /* Small Resource Type -- Only bits 6:3 are valid */ - status = acpi_ut_validate_resource(aml, &resource_index); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); + + case ACPI_RDESC_TYPE_LARGE: + + /* Large Resource Type -- All bits are valid */ + + return (resource_start_byte); + + default: + /* Invalid type */ + break; + } - /* Convert the AML byte stream resource to a local resource struct */ + return (0xFF); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_byte_stream_to_list + * + * 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 + * + * RETURN: Status + * + * DESCRIPTION: Takes the resource byte stream and parses it, creating a + * linked list of resources in the caller's output buffer + * + ******************************************************************************/ + +acpi_status +acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, u8 * output_buffer) +{ + acpi_status status; + acpi_size bytes_parsed = 0; + u8 resource_type = 0; + acpi_size bytes_consumed = 0; + u8 *buffer = output_buffer; + acpi_size structure_size = 0; + u8 end_tag_processed = FALSE; + struct acpi_resource *resource; + + ACPI_FUNCTION_TRACE("rs_byte_stream_to_list"); + + while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) { + /* The next byte in the stream is the resource type */ + + resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); + + switch (resource_type) { + case ACPI_RDESC_TYPE_MEMORY_24: + /* + * 24-Bit Memory Resource + */ + status = acpi_rs_memory24_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_LARGE_VENDOR: + /* + * Vendor Defined Resource + */ + status = acpi_rs_vendor_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_MEMORY_32: + /* + * 32-Bit Memory Range Resource + */ + status = + acpi_rs_memory32_range_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_FIXED_MEMORY_32: + /* + * 32-Bit Fixed Memory Resource + */ + status = + acpi_rs_fixed_memory32_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: + case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: + /* + * 64-Bit Address Resource + */ + status = acpi_rs_address64_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: + /* + * 32-Bit Address Resource + */ + status = acpi_rs_address32_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: + /* + * 16-Bit Address Resource + */ + status = acpi_rs_address16_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_EXTENDED_XRUPT: + /* + * Extended IRQ + */ + status = + acpi_rs_extended_irq_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_IRQ_FORMAT: + /* + * IRQ Resource + */ + status = acpi_rs_irq_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_DMA_FORMAT: + /* + * DMA Resource + */ + status = acpi_rs_dma_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_START_DEPENDENT: + /* + * Start Dependent Functions Resource + */ + status = + acpi_rs_start_depend_fns_resource + (byte_stream_buffer, &bytes_consumed, &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_END_DEPENDENT: + /* + * End Dependent Functions Resource + */ + status = + acpi_rs_end_depend_fns_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_IO_PORT: + /* + * IO Port Resource + */ + status = acpi_rs_io_resource(byte_stream_buffer, + &bytes_consumed, &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_FIXED_IO_PORT: + /* + * Fixed IO Port Resource + */ + status = acpi_rs_fixed_io_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_SMALL_VENDOR: + /* + * Vendor Specific Resource + */ + status = acpi_rs_vendor_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + case ACPI_RDESC_TYPE_END_TAG: + /* + * End Tag + */ + end_tag_processed = TRUE; + status = acpi_rs_end_tag_resource(byte_stream_buffer, + &bytes_consumed, + &buffer, + &structure_size); + break; + + default: + /* + * Invalid/Unknown resource type + */ + status = AE_AML_INVALID_RESOURCE_TYPE; + break; + } - status = - acpi_rs_convert_aml_to_resource(resource, - ACPI_CAST_PTR(union - aml_resource, - aml), - acpi_gbl_get_resource_dispatch - [resource_index]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not convert AML resource (Type %X) to resource, %s\n", *aml, acpi_format_exception(status))); return_ACPI_STATUS(status); } - /* Normal exit on completion of an end_tag resource descriptor */ + /* Update the return value and counter */ - if (acpi_ut_get_resource_type(aml) == - ACPI_RESOURCE_NAME_END_TAG) { - return_ACPI_STATUS(AE_OK); - } + bytes_parsed += bytes_consumed; - /* Point to the next input AML resource */ + /* Set the byte stream to point to the next resource */ - aml += acpi_ut_get_descriptor_length(aml); + byte_stream_buffer += bytes_consumed; - /* Point to the next structure in the output buffer */ + /* Set the Buffer to the next structure */ - resource = - ACPI_ADD_PTR(struct acpi_resource, resource, - resource->length); + resource = ACPI_CAST_PTR(struct acpi_resource, buffer); + resource->length = + (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length); + buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size); } - /* Did not find an end_tag resource descriptor */ + /* Check the reason for exiting the while loop */ + + if (!end_tag_processed) { + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + } - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_convert_resources_to_aml + * FUNCTION: acpi_rs_list_to_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 + * PARAMETERS: linked_list - 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 * * RETURN: Status * @@ -141,69 +346,180 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) ******************************************************************************/ acpi_status -acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, - acpi_size aml_size_needed, u8 * output_buffer) +acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, + acpi_size byte_stream_size_needed, + u8 * output_buffer) { - u8 *aml = output_buffer; - u8 *end_aml = output_buffer + aml_size_needed; acpi_status status; - - ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); - - /* Walk the resource descriptor list, convert each descriptor */ - - while (aml < end_aml) { - /* Validate the (internal) Resource Type */ - - if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - ACPI_REPORT_ERROR(("Invalid descriptor type (%X) in resource list\n", resource->type)); - return_ACPI_STATUS(AE_BAD_DATA); + u8 *buffer = output_buffer; + acpi_size bytes_consumed = 0; + u8 done = FALSE; + + ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); + + while (!done) { + switch (linked_list->id) { + case ACPI_RSTYPE_IRQ: + /* + * IRQ Resource + */ + status = + acpi_rs_irq_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_DMA: + /* + * DMA Resource + */ + status = + acpi_rs_dma_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_START_DPF: + /* + * Start Dependent Functions Resource + */ + status = acpi_rs_start_depend_fns_stream(linked_list, + &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_END_DPF: + /* + * End Dependent Functions Resource + */ + status = acpi_rs_end_depend_fns_stream(linked_list, + &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_IO: + /* + * IO Port Resource + */ + status = + acpi_rs_io_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_FIXED_IO: + /* + * Fixed IO Port Resource + */ + status = + acpi_rs_fixed_io_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_VENDOR: + /* + * Vendor Defined Resource + */ + status = + acpi_rs_vendor_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_END_TAG: + /* + * End Tag + */ + status = + acpi_rs_end_tag_stream(linked_list, &buffer, + &bytes_consumed); + + /* An End Tag indicates the end of the Resource Template */ + + done = TRUE; + break; + + case ACPI_RSTYPE_MEM24: + /* + * 24-Bit Memory Resource + */ + status = + acpi_rs_memory24_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_MEM32: + /* + * 32-Bit Memory Range Resource + */ + status = + acpi_rs_memory32_range_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_FIXED_MEM32: + /* + * 32-Bit Fixed Memory Resource + */ + status = + acpi_rs_fixed_memory32_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_ADDRESS16: + /* + * 16-Bit Address Descriptor Resource + */ + status = acpi_rs_address16_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_ADDRESS32: + /* + * 32-Bit Address Descriptor Resource + */ + status = acpi_rs_address32_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_ADDRESS64: + /* + * 64-Bit Address Descriptor Resource + */ + status = acpi_rs_address64_stream(linked_list, &buffer, + &bytes_consumed); + break; + + case ACPI_RSTYPE_EXT_IRQ: + /* + * Extended IRQ Resource + */ + status = + acpi_rs_extended_irq_stream(linked_list, &buffer, + &bytes_consumed); + break; + + default: + /* + * If we get here, everything is out of sync, + * so exit with an error + */ + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Invalid descriptor type (%X) in resource list\n", + linked_list->id)); + status = AE_BAD_DATA; + break; } - /* Perform the conversion */ - - status = acpi_rs_convert_resource_to_aml(resource, - ACPI_CAST_PTR(union - aml_resource, - aml), - 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); } - /* Perform final sanity check on the new AML resource descriptor */ - - status = - acpi_ut_validate_resource(ACPI_CAST_PTR - (union aml_resource, aml), NULL); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + /* Set the Buffer to point to the open byte */ - /* Check for end-of-list, normal exit */ + buffer += bytes_consumed; - if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { - /* An End Tag indicates the end of the input Resource Template */ + /* Point to the next object */ - return_ACPI_STATUS(AE_OK); - } - - /* - * Extract the total length of the new descriptor and set the - * Aml to point to the next (output) resource descriptor - */ - aml += acpi_ut_get_descriptor_length(aml); - - /* Point to the next input resource descriptor */ - - resource = - ACPI_ADD_PTR(struct acpi_resource, resource, - resource->length); + linked_list = ACPI_PTR_ADD(struct acpi_resource, + linked_list, linked_list->length); } - /* Completed buffer, but did not find an end_tag resource descriptor */ - - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); + return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/resources/rsmemory.c b/trunk/drivers/acpi/resources/rsmemory.c index a5131936d690..daba1a1ed46d 100644 --- a/trunk/drivers/acpi/resources/rsmemory.c +++ b/trunk/drivers/acpi/resources/rsmemory.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,187 +49,454 @@ ACPI_MODULE_NAME("rsmemory") /******************************************************************************* * - * acpi_rs_convert_memory24 + * FUNCTION: acpi_rs_memory24_resource + * + * 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 + * + * 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. * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_memory24_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, - sizeof(struct aml_resource_memory24), - 0}, + ACPI_FUNCTION_TRACE("rs_memory24_resource"); - /* Read/Write bit */ + /* Point past the Descriptor to get the number of bytes consumed */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect), - AML_OFFSET(memory24.flags), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment - * Range Length - */ - {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum), - AML_OFFSET(memory24.minimum), - 4} -}; + buffer += 1; + + ACPI_MOVE_16_TO_16(&temp16, buffer); + buffer += 2; + *bytes_consumed = (acpi_size) temp16 + 3; + output_struct->id = 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; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_memory32 + * FUNCTION: acpi_rs_memory24_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_memory24_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, - sizeof(struct aml_resource_memory32), - 0}, + ACPI_FUNCTION_TRACE("rs_memory24_stream"); - /* Read/Write bit */ + /* The descriptor field is static */ - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect), - AML_OFFSET(memory32.flags), - 0}, - /* - * These fields are contiguous in both the source and destination: - * Minimum Base Address - * Maximum Base Address - * Address Base Alignment - * Range Length - */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum), - AML_OFFSET(memory32.minimum), - 4} -}; + *buffer = 0x81; + buffer += 1; + + /* The length field is static */ + + temp16 = 0x09; + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set the Information Byte */ + + temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); + *buffer = temp8; + buffer += 1; + + /* Set the Range minimum base address */ + + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.memory24.min_base_address); + buffer += 2; + + /* Set the Range maximum base address */ + + ACPI_MOVE_32_TO_16(buffer, + &linked_list->data.memory24.max_base_address); + buffer += 2; + + /* Set the base alignment */ + + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment); + buffer += 2; + + /* Set the range length */ + + ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length); + buffer += 2; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_convert_fixed_memory32 + * FUNCTION: acpi_rs_memory32_range_resource + * + * 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 + * + * 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. * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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"); + + /* Point past the Descriptor to get the number of bytes consumed */ + + buffer += 1; - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, - sizeof(struct aml_resource_fixed_memory32), - 0}, + ACPI_MOVE_16_TO_16(&temp16, buffer); + buffer += 2; + *bytes_consumed = (acpi_size) temp16 + 3; - /* Read/Write bit */ + output_struct->id = ACPI_RSTYPE_MEM32; - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect), - AML_OFFSET(fixed_memory32.flags), - 0}, /* - * These fields are contiguous in both the source and destination: - * Base Address - * Range Length + * 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) */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address), - AML_OFFSET(fixed_memory32.address), - 2} -}; + + /* 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 */ + + output_struct->length = (u32) struct_size; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_get_vendor_small + * FUNCTION: acpi_rs_fixed_memory32_resource + * + * 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 + * + * 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. * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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"); - /* Length of the vendor data (byte count) */ + /* Point past the Descriptor to get the number of bytes consumed */ - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), - 0, - sizeof(u8)} - , + buffer += 1; + ACPI_MOVE_16_TO_16(&temp16, buffer); - /* Vendor data */ + buffer += 2; + *bytes_consumed = (acpi_size) temp16 + 3; - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), - sizeof(struct aml_resource_small_header), - 0} -}; + output_struct->id = 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_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length, + buffer); + + /* Set the Length parameter */ + + output_struct->length = (u32) struct_size; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_get_vendor_large + * FUNCTION: acpi_rs_memory32_range_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -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)}, +acpi_status +acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + + ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); + + /* The descriptor field is static */ + + *buffer = 0x85; + buffer += 1; + + /* The length field is static */ + + temp16 = 0x11; + + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set the Information Byte */ + + temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); + *buffer = temp8; + buffer += 1; + + /* Set the Range minimum base address */ + + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.memory32.min_base_address); + buffer += 4; + + /* Set the Range maximum base address */ + + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.memory32.max_base_address); + buffer += 4; - /* Length of the vendor data (byte count) */ + /* Set the base alignment */ - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), - 0, - sizeof(u8)} - , + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment); + buffer += 4; - /* Vendor data */ + /* Set the range length */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), - sizeof(struct aml_resource_large_header), - 0} -}; + ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length); + buffer += 4; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} /******************************************************************************* * - * acpi_rs_set_vendor + * FUNCTION: acpi_rs_fixed_memory32_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream * ******************************************************************************/ -struct acpi_rsconvert_info acpi_rs_set_vendor[7] = { - /* Default is a small vendor descriptor */ +acpi_status +acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, - sizeof(struct aml_resource_small_header), - ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)}, + ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); - /* Get the length and copy the data */ + /* The descriptor field is static */ - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), - 0, - 0}, + *buffer = 0x86; + buffer += 1; - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), - sizeof(struct aml_resource_small_header), - 0}, + /* The length field is static */ - /* - * All done if the Vendor byte length is 7 or less, meaning that it will - * fit within a small descriptor - */ - {ACPI_RSC_EXIT_LE, 0, 0, 7}, + temp16 = 0x09; + + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + + /* Set the Information Byte */ + + temp8 = + (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); + *buffer = temp8; + buffer += 1; + + /* Set the Range base address */ + + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.fixed_memory32. + range_base_address); + buffer += 4; - /* Must create a large vendor descriptor */ + /* Set the range length */ - {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, - sizeof(struct aml_resource_large_header), - 0}, + ACPI_MOVE_32_TO_32(buffer, + &linked_list->data.fixed_memory32.range_length); + buffer += 4; - {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), - 0, - 0}, + /* Return the number of bytes consumed in this operation */ - {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), - sizeof(struct aml_resource_large_header), - 0} -}; + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} diff --git a/trunk/drivers/acpi/resources/rsmisc.c b/trunk/drivers/acpi/resources/rsmisc.c index 83bfe0dd3eba..7a8a34e757f5 100644 --- a/trunk/drivers/acpi/resources/rsmisc.c +++ b/trunk/drivers/acpi/resources/rsmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,495 +47,481 @@ #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_convert_aml_to_resource + * FUNCTION: acpi_rs_end_tag_resource * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * Info - Pointer to appropriate conversion table + * 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 * * RETURN: Status * - * DESCRIPTION: Convert an external AML resource descriptor to the corresponding - * internal resource descriptor + * 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. * ******************************************************************************/ acpi_status -acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, - union aml_resource *aml, - struct acpi_rsconvert_info *info) +acpi_rs_end_tag_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) { - acpi_rs_length aml_resource_length; - void *source; - void *destination; - char *target; - u8 count; - u8 flags_mode = FALSE; - u16 item_count = 0; + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = ACPI_RESOURCE_LENGTH; + + ACPI_FUNCTION_TRACE("rs_end_tag_resource"); + + /* The number of bytes consumed is static */ + + *bytes_consumed = 2; + + /* Fill out the structure */ + + output_struct->id = ACPI_RSTYPE_END_TAG; + + /* Set the Length parameter */ + + output_struct->length = 0; + + /* Return the final size of the structure */ + + *structure_size = struct_size; + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_end_tag_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream + * + ******************************************************************************/ + +acpi_status +acpi_rs_end_tag_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u8 temp8 = 0; + + ACPI_FUNCTION_TRACE("rs_end_tag_stream"); + + /* The descriptor field is static */ + + *buffer = 0x79; + 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) + */ + temp8 = 0; + + *buffer = temp8; + buffer += 1; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_vendor_resource + * + * 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 + * + * 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. + * + ******************************************************************************/ + +acpi_status +acpi_rs_vendor_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + 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. */ + + temp8 = *buffer; + + if (temp8 & 0x80) { + /* Large Item, point to the length field */ + + buffer += 1; + + /* Dereference */ - ACPI_FUNCTION_TRACE("rs_get_resource"); + ACPI_MOVE_16_TO_16(&temp16, buffer); - 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); + /* Calculate bytes consumed */ + + *bytes_consumed = (acpi_size) temp16 + 3; + + /* Point to the first vendor byte */ + + buffer += 2; + } else { + /* Small Item, dereference the size */ + + temp16 = (u8) (*buffer & 0x07); + + /* Calculate bytes consumed */ + + *bytes_consumed = (acpi_size) temp16 + 1; + + /* Point to the first vendor byte */ + + buffer += 1; } - /* Extract the resource Length field (does not include header length) */ + output_struct->id = ACPI_RSTYPE_VENDOR; + output_struct->data.vendor_specific.length = temp16; - aml_resource_length = acpi_ut_get_resource_length(aml); + for (index = 0; index < temp16; index++) { + output_struct->data.vendor_specific.reserved[index] = *buffer; + buffer += 1; + } /* - * First table entry must be ACPI_RSC_INITxxx and must contain the - * table length (# of table entries) + * 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. */ - count = INIT_TABLE_LENGTH(info); - - while (count) { - /* - * Source is the external AML byte stream buffer, - * destination is the internal resource descriptor - */ - source = ACPI_ADD_PTR(void, aml, info->aml_offset); - destination = - ACPI_ADD_PTR(void, 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 - */ - ACPI_SET8(destination) = (u8) - ((ACPI_GET8(source) >> info->value) & 0x01); - break; - - case ACPI_RSC_2BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET8(destination) = (u8) - ((ACPI_GET8(source) >> info->value) & 0x03); - break; - - case ACPI_RSC_COUNT: - - item_count = ACPI_GET8(source); - ACPI_SET8(destination) = (u8) item_count; - - resource->length = resource->length + - (info->value * (item_count - 1)); - break; - - case ACPI_RSC_COUNT16: - - item_count = aml_resource_length; - ACPI_SET16(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 = ACPI_ADD_PTR(char, resource, info->value); - ACPI_MEMCPY(destination, source, ACPI_GET16(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 = - ACPI_ADD_PTR(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(ACPI_GET8(source), - destination); - if (item_count) { - resource->length += (item_count - 1); - } - - target = ACPI_ADD_PTR(char, resource, info->value); - ACPI_SET8(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 += (item_count - 1); - } - - target = ACPI_ADD_PTR(char, resource, info->value); - ACPI_SET8(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 (ACPI_GET8(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); - } + 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; + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_rs_vendor_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream + * + ******************************************************************************/ + +acpi_status +acpi_rs_vendor_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u16 temp16 = 0; + u8 temp8 = 0; + u8 index; + + ACPI_FUNCTION_TRACE("rs_vendor_stream"); - count--; - info++; + /* Dereference the length to find if this is a large or small item. */ + + if (linked_list->data.vendor_specific.length > 7) { + /* Large Item, Set the descriptor field and length bytes */ + + *buffer = 0x84; + buffer += 1; + + temp16 = (u16) linked_list->data.vendor_specific.length; + + ACPI_MOVE_16_TO_16(buffer, &temp16); + buffer += 2; + } else { + /* Small Item, Set the descriptor field */ + + temp8 = 0x70; + temp8 |= (u8) linked_list->data.vendor_specific.length; + + *buffer = temp8; + buffer += 1; } - exit: - if (!flags_mode) { - /* Round the resource struct length up to the next 32-bit boundary */ + /* Loop through all of the Vendor Specific fields */ - resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); + for (index = 0; index < linked_list->data.vendor_specific.length; + index++) { + temp8 = linked_list->data.vendor_specific.reserved[index]; + + *buffer = temp8; + buffer += 1; } + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); return_ACPI_STATUS(AE_OK); } /******************************************************************************* * - * FUNCTION: acpi_rs_convert_resource_to_aml + * FUNCTION: acpi_rs_start_depend_fns_resource * - * PARAMETERS: Resource - Pointer to the resource descriptor - * Aml - Where the AML descriptor is returned - * Info - Pointer to appropriate conversion table + * 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 * * RETURN: Status * - * DESCRIPTION: Convert an internal resource descriptor to the corresponding - * external AML resource descriptor. + * 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. * ******************************************************************************/ acpi_status -acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, - union aml_resource *aml, - struct acpi_rsconvert_info *info) +acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size) { - void *source = NULL; - void *destination; - acpi_rsdesc_size aml_length = 0; - u8 count; - u16 temp16 = 0; - u16 item_count = 0; + 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_convert_resource_to_aml"); + ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource"); - /* - * 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 = ACPI_ADD_PTR(void, resource, info->resource_offset); - destination = ACPI_ADD_PTR(void, 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 - */ - ACPI_SET8(destination) = 0; - break; - - case ACPI_RSC_1BITFLAG: - /* - * Mask and shift the flag bit - */ - ACPI_SET8(destination) |= (u8) - ((ACPI_GET8(source) & 0x01) << info->value); - break; - - case ACPI_RSC_2BITFLAG: - /* - * Mask and shift the flag bits - */ - ACPI_SET8(destination) |= (u8) - ((ACPI_GET8(source) & 0x03) << info->value); - break; - - case ACPI_RSC_COUNT: - - item_count = ACPI_GET8(source); - ACPI_SET8(destination) = (u8) item_count; - - aml_length = - (u16) (aml_length + - (info->value * (item_count - 1))); - break; - - case ACPI_RSC_COUNT16: - - item_count = ACPI_GET16(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) - */ - ACPI_SET8(destination) = (u8) - acpi_rs_encode_bitmask(source, - *ACPI_ADD_PTR(u8, resource, - info->value)); - break; - - case ACPI_RSC_BITMASK16: - /* - * 16-bit encoded bitmask (IRQ macro) - */ - temp16 = acpi_rs_encode_bitmask(source, - *ACPI_ADD_PTR(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 (*ACPI_ADD_PTR(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); + /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ + + temp8 = *buffer; + + *bytes_consumed = (temp8 & 0x01) + 1; + + output_struct->id = 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); } - count--; - info++; + /* Check Performance/Robustness preference */ + + 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; } - exit: + /* Set the Length parameter */ + + output_struct->length = (u32) struct_size; + + /* Return the final size of the structure */ + + *structure_size = struct_size; return_ACPI_STATUS(AE_OK); } -#if 0 -/* Previous resource validations */ +/******************************************************************************* + * + * FUNCTION: acpi_rs_end_depend_fns_resource + * + * 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 + * + * 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. + * + ******************************************************************************/ + +acpi_status +acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size) +{ + struct acpi_resource *output_struct = (void *)*output_buffer; + acpi_size struct_size = ACPI_RESOURCE_LENGTH; -if (aml->ext_address64.revision_iD != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { - return_ACPI_STATUS(AE_SUPPORT); -} + ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource"); + + /* The number of bytes consumed is static */ + + *bytes_consumed = 1; -if (resource->data.start_dpf.performance_robustness >= 3) { - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); + /* Fill out the structure */ + + output_struct->id = 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; + return_ACPI_STATUS(AE_OK); } -if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { +/******************************************************************************* + * + * FUNCTION: acpi_rs_start_depend_fns_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream + * + ******************************************************************************/ + +acpi_status +acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + u8 temp8 = 0; + + ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); + /* - * 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. + * The descriptor field is set based upon whether a byte is needed + * to contain Priority data. */ - ACPI_REPORT_ERROR(("Invalid interrupt polarity/trigger in resource list, %X\n", aml->irq.flags)); - return_ACPI_STATUS(AE_BAD_DATA); -} + if (ACPI_ACCEPTABLE_CONFIGURATION == + linked_list->data.start_dpf.compatibility_priority && + ACPI_ACCEPTABLE_CONFIGURATION == + linked_list->data.start_dpf.performance_robustness) { + *buffer = 0x30; + } else { + *buffer = 0x31; + buffer += 1; + + /* Set the Priority Byte Definition */ + + temp8 = 0; + temp8 = + (u8) ((linked_list->data.start_dpf. + performance_robustness & 0x03) << 2); + temp8 |= + (linked_list->data.start_dpf.compatibility_priority & 0x03); + *buffer = temp8; + } + + buffer += 1; -resource->data.extended_irq.interrupt_count = temp8; -if (temp8 < 1) { - /* Must have at least one IRQ */ + /* Return the number of bytes consumed in this operation */ - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } -if (resource->data.dma.transfer == 0x03) { - ACPI_REPORT_ERROR(("Invalid DMA.Transfer preference (3)\n")); - return_ACPI_STATUS(AE_BAD_DATA); +/******************************************************************************* + * + * FUNCTION: acpi_rs_end_depend_fns_stream + * + * PARAMETERS: linked_list - 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 + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream + * + ******************************************************************************/ + +acpi_status +acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed) +{ + u8 *buffer = *output_buffer; + + ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); + + /* The descriptor field is static */ + + *buffer = 0x38; + buffer += 1; + + /* Return the number of bytes consumed in this operation */ + + *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); + return_ACPI_STATUS(AE_OK); } -#endif diff --git a/trunk/drivers/acpi/resources/rsutils.c b/trunk/drivers/acpi/resources/rsutils.c index 25b5aedd6612..4446778eaf79 100644 --- a/trunk/drivers/acpi/resources/rsutils.c +++ b/trunk/drivers/acpi/resources/rsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,389 +48,6 @@ #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; - - ACPI_FUNCTION_ENTRY(); - - /* 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; - - ACPI_FUNCTION_ENTRY(); - - /* 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 - * - * 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; - - ACPI_FUNCTION_ENTRY(); - - /* One move per item */ - - for (i = 0; i < item_count; i++) { - switch (move_type) { - /* - * 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; - - /* - * 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(&ACPI_CAST_PTR(u16, destination)[i], - &ACPI_CAST_PTR(u16, source)[i]); - break; - - case ACPI_RSC_MOVE32: - ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i], - &ACPI_CAST_PTR(u32, source)[i]); - break; - - case ACPI_RSC_MOVE64: - ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i], - &ACPI_CAST_PTR(u64, source)[i]); - break; - - default: - return; - } - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_set_resource_length - * - * PARAMETERS: 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 resource_length field of an AML - * resource descriptor, both Large and Small descriptors are - * supported automatically. Note: Descriptor Type field must - * be valid. - * - ******************************************************************************/ - -void -acpi_rs_set_resource_length(acpi_rsdesc_size total_length, - union aml_resource *aml) -{ - acpi_rs_length resource_length; - - ACPI_FUNCTION_ENTRY(); - - /* Length is the total descriptor length minus the header length */ - - resource_length = (acpi_rs_length) - (total_length - acpi_ut_get_resource_header_length(aml)); - - /* Length is stored differently for large and small descriptors */ - - if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { - /* Large descriptor -- bytes 1-2 contain the 16-bit length */ - - ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, - &resource_length); - } else { - /* Small descriptor -- bits 2:0 of byte 0 contain the length */ - - aml->small_header.descriptor_type = (u8) - - /* Clear any existing length, preserving descriptor type bits */ - ((aml->small_header. - descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - - | resource_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_rsdesc_size total_length, - union aml_resource *aml) -{ - ACPI_FUNCTION_ENTRY(); - - /* Set the Resource Type */ - - aml->small_header.descriptor_type = descriptor_type; - - /* Set the Resource Length */ - - acpi_rs_set_resource_length(total_length, aml); -} - -/******************************************************************************* - * - * 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 - * - ******************************************************************************/ - -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_rsdesc_size total_length; - u8 *aml_resource_source; - - ACPI_FUNCTION_ENTRY(); - - total_length = - resource_length + sizeof(struct aml_resource_large_header); - aml_resource_source = ACPI_ADD_PTR(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 > (acpi_rsdesc_size) (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 = - ACPI_ADD_PTR(char, resource_source, - 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]); - - return ((acpi_rs_length) total_length); - } - - /* 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 optional resource_source from internal format to a - * raw AML resource descriptor - * - ******************************************************************************/ - -acpi_rsdesc_size -acpi_rs_set_resource_source(union aml_resource * aml, - acpi_rs_length minimum_length, - struct acpi_resource_source * resource_source) -{ - u8 *aml_resource_source; - acpi_rsdesc_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 = ACPI_ADD_PTR(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_rsdesc_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 @@ -448,9 +65,8 @@ acpi_rs_set_resource_source(union aml_resource * aml, * 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; @@ -668,7 +284,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_aml_resources(in_buffer->pointer, &buffer); + status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/resources/rsxface.c b/trunk/drivers/acpi/resources/rsxface.c index 88b67077aeeb..ee5a5c509199 100644 --- a/trunk/drivers/acpi/resources/rsxface.c +++ b/trunk/drivers/acpi/resources/rsxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,17 +57,13 @@ 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, info); \ + ACPI_COPY_FIELD(out, in, attribute); \ ACPI_COPY_FIELD(out, in, granularity); \ - ACPI_COPY_FIELD(out, in, minimum); \ - ACPI_COPY_FIELD(out, in, maximum); \ - ACPI_COPY_FIELD(out, in, translation_offset); \ + 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, address_length); \ ACPI_COPY_FIELD(out, in, resource_source); -/* Local prototypes */ -static acpi_status -acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); - /******************************************************************************* * * FUNCTION: acpi_get_irq_routing_table @@ -90,7 +86,6 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); * the object indicated by the passed device_handle. * ******************************************************************************/ - acpi_status acpi_get_irq_routing_table(acpi_handle device_handle, struct acpi_buffer *ret_buffer) @@ -227,12 +222,12 @@ EXPORT_SYMBOL(acpi_get_possible_resources); * * FUNCTION: acpi_walk_resources * - * PARAMETERS: device_handle - Handle to the device object for the + * PARAMETERS: device_handle - a handle to the device object for the * device we are querying - * Name - Method name of the resources we want + * Path - method name of the resources we want * (METHOD_NAME__CRS or METHOD_NAME__PRS) - * user_function - Called for each resource - * Context - Passed to user_function + * user_function - called for each resource + * Context - passed to user_function * * RETURN: Status * @@ -244,74 +239,79 @@ EXPORT_SYMBOL(acpi_get_possible_resources); acpi_status acpi_walk_resources(acpi_handle device_handle, - char *name, + char *path, ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) { acpi_status status; - struct acpi_buffer buffer; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_resource *resource; - struct acpi_resource *resource_end; + struct acpi_resource *buffer_end; ACPI_FUNCTION_TRACE("acpi_walk_resources"); - /* Parameter validation */ - - if (!device_handle || !user_function || !name || - (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && - ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { + if (!device_handle || + (ACPI_STRNCMP(path, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && + ACPI_STRNCMP(path, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* Get the _CRS or _PRS resource list */ - - buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_rs_get_method_data(device_handle, name, &buffer); + status = acpi_rs_get_method_data(device_handle, path, &buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* Buffer now contains the resource list */ + /* Setup pointers */ - resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); - resource_end = - ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); + resource = (struct acpi_resource *)buffer.pointer; + buffer_end = ACPI_CAST_PTR(struct acpi_resource, + ((u8 *) buffer.pointer + buffer.length)); - /* Walk the resource list until the end_tag is found (or buffer end) */ + /* Walk the resource list */ - while (resource < resource_end) { - /* Sanity check the resource */ - - if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - status = AE_AML_INVALID_RESOURCE_TYPE; + for (;;) { + if (!resource || resource->id == ACPI_RSTYPE_END_TAG) { break; } - /* Invoke the user function, abort on any error returned */ - status = user_function(resource, context); - if (ACPI_FAILURE(status)) { - if (status == AE_CTRL_TERMINATE) { - /* This is an OK termination by the user function */ - status = AE_OK; - } - break; - } + switch (status) { + case AE_OK: + case AE_CTRL_DEPTH: - /* end_tag indicates end-of-list */ + /* Just keep going */ - if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { + status = AE_OK; break; + + case AE_CTRL_TERMINATE: + + /* Exit now, with OK stats */ + + status = AE_OK; + goto cleanup; + + default: + + /* All others are valid exceptions */ + + goto cleanup; } /* Get the next resource descriptor */ - resource = - ACPI_ADD_PTR(struct acpi_resource, resource, - resource->length); + resource = ACPI_NEXT_RESOURCE(resource); + + /* Check for end-of-buffer */ + + if (resource >= buffer_end) { + goto cleanup; + } } - ACPI_MEM_FREE(buffer.pointer); + cleanup: + + acpi_os_free(buffer.pointer); return_ACPI_STATUS(status); } @@ -360,8 +360,8 @@ EXPORT_SYMBOL(acpi_set_current_resources); * * FUNCTION: acpi_resource_to_address64 * - * PARAMETERS: Resource - Pointer to a resource - * Out - Pointer to the users's return + * PARAMETERS: resource - Pointer to a resource + * out - Pointer to the users's return * buffer (a struct * struct acpi_resource_address64) * @@ -381,26 +381,20 @@ acpi_resource_to_address64(struct acpi_resource *resource, struct acpi_resource_address16 *address16; struct acpi_resource_address32 *address32; - if (!resource || !out) { - return (AE_BAD_PARAMETER); - } - - /* Convert 16 or 32 address descriptor to 64 */ - - switch (resource->type) { - case ACPI_RESOURCE_TYPE_ADDRESS16: + switch (resource->id) { + case ACPI_RSTYPE_ADDRESS16: address16 = (struct acpi_resource_address16 *)&resource->data; ACPI_COPY_ADDRESS(out, address16); break; - case ACPI_RESOURCE_TYPE_ADDRESS32: + case ACPI_RSTYPE_ADDRESS32: address32 = (struct acpi_resource_address32 *)&resource->data; ACPI_COPY_ADDRESS(out, address32); break; - case ACPI_RESOURCE_TYPE_ADDRESS64: + case ACPI_RSTYPE_ADDRESS64: /* Simple copy for 64 bit source */ @@ -416,113 +410,3 @@ acpi_resource_to_address64(struct acpi_resource *resource, } EXPORT_SYMBOL(acpi_resource_to_address64); - -/******************************************************************************* - * - * FUNCTION: acpi_get_vendor_resource - * - * PARAMETERS: device_handle - Handle for the parent device object - * Name - Method name for the parent resource - * (METHOD_NAME__CRS or METHOD_NAME__PRS) - * Uuid - Pointer to the UUID to be matched. - * includes both subtype and 16-byte UUID - * ret_buffer - Where the vendor resource is returned - * - * RETURN: Status - * - * DESCRIPTION: Walk a resource template for the specified evice to find a - * vendor-defined resource that matches the supplied UUID and - * UUID subtype. Returns a struct acpi_resource of type Vendor. - * - ******************************************************************************/ - -acpi_status -acpi_get_vendor_resource(acpi_handle device_handle, - char *name, - struct acpi_vendor_uuid * uuid, - struct acpi_buffer * ret_buffer) -{ - struct acpi_vendor_walk_info info; - acpi_status status; - - /* Other parameters are validated by acpi_walk_resources */ - - if (!uuid || !ret_buffer) { - return (AE_BAD_PARAMETER); - } - - info.uuid = uuid; - info.buffer = ret_buffer; - info.status = AE_NOT_EXIST; - - /* Walk the _CRS or _PRS resource list for this device */ - - status = - acpi_walk_resources(device_handle, name, - acpi_rs_match_vendor_resource, &info); - if (ACPI_FAILURE(status)) { - return (status); - } - - return (info.status); -} - -/******************************************************************************* - * - * FUNCTION: acpi_rs_match_vendor_resource - * - * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID - * - ******************************************************************************/ - -static acpi_status -acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) -{ - struct acpi_vendor_walk_info *info = context; - struct acpi_resource_vendor_typed *vendor; - struct acpi_buffer *buffer; - acpi_status status; - - /* Ignore all descriptors except Vendor */ - - if (resource->type != ACPI_RESOURCE_TYPE_VENDOR) { - return (AE_OK); - } - - vendor = &resource->data.vendor_typed; - - /* - * For a valid match, these conditions must hold: - * - * 1) Length of descriptor data must be at least as long as a UUID struct - * 2) The UUID subtypes must match - * 3) The UUID data must match - */ - if ((vendor->byte_length < (ACPI_UUID_LENGTH + 1)) || - (vendor->uuid_subtype != info->uuid->subtype) || - (ACPI_MEMCMP(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) { - return (AE_OK); - } - - /* Validate/Allocate/Clear caller buffer */ - - buffer = info->buffer; - status = acpi_ut_initialize_buffer(buffer, resource->length); - if (ACPI_FAILURE(status)) { - return (status); - } - - /* Found the correct resource, copy and return it */ - - ACPI_MEMCPY(buffer->pointer, resource, resource->length); - buffer->length = resource->length; - - /* Found the desired descriptor, terminate resource walk */ - - info->status = AE_OK; - return (AE_CTRL_TERMINATE); -} diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index c60516d0f66b..0745d20afb8c 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -844,7 +844,7 @@ static void acpi_device_set_id(struct acpi_device *device, * ---- * Fix for the system root bus device -- the only root-level device. */ - if (((acpi_handle)parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) { + if ((parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) { hid = ACPI_BUS_HID; strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); strcpy(device->pnp.device_class, ACPI_BUS_CLASS); diff --git a/trunk/drivers/acpi/tables/tbconvrt.c b/trunk/drivers/acpi/tables/tbconvrt.c index 48290b7e6ba5..a03939399fa9 100644 --- a/trunk/drivers/acpi/tables/tbconvrt.c +++ b/trunk/drivers/acpi/tables/tbconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -554,9 +554,7 @@ acpi_status acpi_tb_convert_table_fadt(void) ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Hex dump of common internal FADT, size %d (%X)\n", acpi_gbl_FADT->length, acpi_gbl_FADT->length)); - - ACPI_DUMP_BUFFER(ACPI_CAST_PTR(u8, acpi_gbl_FADT), - acpi_gbl_FADT->length); + ACPI_DUMP_BUFFER((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/tables/tbget.c b/trunk/drivers/acpi/tables/tbget.c index 0fedf4b27ea5..6acd5aeb093e 100644 --- a/trunk/drivers/acpi/tables/tbget.c +++ b/trunk/drivers/acpi/tables/tbget.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_REPORT_ERROR(("Invalid address flags %X\n", - address->pointer_type)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid address flags %X\n", + address->pointer_type)); return_ACPI_STATUS(AE_BAD_PARAMETER); } diff --git a/trunk/drivers/acpi/tables/tbgetall.c b/trunk/drivers/acpi/tables/tbgetall.c index 496f336b3e3a..8d72343537e7 100644 --- a/trunk/drivers/acpi/tables/tbgetall.c +++ b/trunk/drivers/acpi/tables/tbgetall.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -292,9 +292,7 @@ acpi_status acpi_tb_get_required_tables(void) "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, acpi_gbl_integer_bit_width)); - - ACPI_DUMP_BUFFER(ACPI_CAST_PTR(u8, acpi_gbl_DSDT), - acpi_gbl_DSDT->length); + ACPI_DUMP_BUFFER((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length); /* Always delete the RSDP mapping, we are done with it */ diff --git a/trunk/drivers/acpi/tables/tbinstal.c b/trunk/drivers/acpi/tables/tbinstal.c index e1c9faa3982e..10db8484e462 100644 --- a/trunk/drivers/acpi/tables/tbinstal.c +++ b/trunk/drivers/acpi/tables/tbinstal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/tables/tbrsdt.c b/trunk/drivers/acpi/tables/tbrsdt.c index 178309026850..ad0252c2f7db 100644 --- a/trunk/drivers/acpi/tables/tbrsdt.c +++ b/trunk/drivers/acpi/tables/tbrsdt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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_ENTRY(); + ACPI_FUNCTION_NAME("tb_validate_rsdt"); /* * Search for appropriate signature, RSDT or XSDT @@ -192,11 +192,15 @@ 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. RSDP:\n")); + ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); - 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)); + 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)); if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { ACPI_REPORT_ERROR(("Looking for RSDT\n")) @@ -205,6 +209,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) } ACPI_DUMP_BUFFER((char *)table_ptr, 48); + return (AE_BAD_SIGNATURE); } @@ -238,14 +243,15 @@ 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_REPORT_ERROR(("Could not get the RSDT/XSDT, %s\n", - acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not get the RSDT/XSDT, %s\n", + acpi_format_exception(status))); return_ACPI_STATUS(status); } 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/trunk/drivers/acpi/tables/tbutils.c b/trunk/drivers/acpi/tables/tbutils.c index 38c6749e43d5..4b2fbb592f49 100644 --- a/trunk/drivers/acpi/tables/tbutils.c +++ b/trunk/drivers/acpi/tables/tbutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,8 +94,9 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) new_table_desc->pointer->length) && (!ACPI_MEMCMP - (table_desc->pointer, new_table_desc->pointer, - new_table_desc->pointer->length))) { + ((const char *)table_desc->pointer, + (const char *)new_table_desc->pointer, + (acpi_size) new_table_desc->pointer->length))) { /* Match: this table is already installed */ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, @@ -144,13 +145,14 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) { acpi_name signature; - ACPI_FUNCTION_ENTRY(); + ACPI_FUNCTION_NAME("tb_validate_table_header"); /* Verify that this is a valid address */ if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { - ACPI_REPORT_ERROR(("Cannot read table header at %p\n", - table_header)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Cannot read table header at %p\n", + table_header)); return (AE_BAD_ADDRESS); } @@ -159,10 +161,12 @@ 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_REPORT_ERROR(("Table signature at %p [%p] has invalid characters\n", table_header, &signature)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Table signature at %p [%p] has invalid characters\n", + table_header, &signature)); ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", - ACPI_CAST_PTR(char, &signature))); + (char *)&signature)); ACPI_DUMP_BUFFER(table_header, sizeof(struct acpi_table_header)); @@ -172,7 +176,9 @@ 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_REPORT_ERROR(("Invalid length in table header %p name %4.4s\n", table_header, (char *)&signature)); + ACPI_DEBUG_PRINT((ACPI_DB_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)); @@ -235,16 +241,16 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) u8 acpi_tb_generate_checksum(void *buffer, u32 length) { - u8 *end_buffer; - u8 *rover; + const u8 *limit; + const u8 *rover; u8 sum = 0; if (buffer && length) { /* Buffer and Length are valid */ - end_buffer = ACPI_ADD_PTR(u8, buffer, length); + limit = (u8 *) buffer + length; - for (rover = buffer; rover < end_buffer; rover++) { + for (rover = buffer; rover < limit; rover++) { sum = (u8) (sum + *rover); } } @@ -286,7 +292,8 @@ acpi_tb_handle_to_object(u16 table_id, } } - ACPI_REPORT_ERROR(("table_id=%X does not exist\n", table_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n", + table_id)); return (AE_BAD_PARAMETER); } #endif diff --git a/trunk/drivers/acpi/tables/tbxface.c b/trunk/drivers/acpi/tables/tbxface.c index 83a9ca8cb98c..3f96a4909aad 100644 --- a/trunk/drivers/acpi/tables/tbxface.c +++ b/trunk/drivers/acpi/tables/tbxface.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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(("Could not get RSDP, %s\n", + ACPI_REPORT_ERROR(("acpi_load_tables: Could not get RSDP, %s\n", acpi_format_exception(status))); goto error_exit; } @@ -86,8 +86,7 @@ acpi_status acpi_load_tables(void) status = acpi_tb_verify_rsdp(&rsdp_address); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("RSDP Failed validation: %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("acpi_load_tables: RSDP Failed validation: %s\n", acpi_format_exception(status))); goto error_exit; } @@ -95,8 +94,7 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_table_rsdt(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not load RSDT: %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("acpi_load_tables: Could not load RSDT: %s\n", acpi_format_exception(status))); goto error_exit; } @@ -104,7 +102,7 @@ acpi_status acpi_load_tables(void) status = acpi_tb_get_required_tables(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not get all required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); + ACPI_REPORT_ERROR(("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status))); goto error_exit; } @@ -114,15 +112,14 @@ acpi_status acpi_load_tables(void) status = acpi_ns_load_namespace(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not load namespace: %s\n", - acpi_format_exception(status))); + ACPI_REPORT_ERROR(("acpi_load_tables: Could not load namespace: %s\n", acpi_format_exception(status))); goto error_exit; } return_ACPI_STATUS(AE_OK); error_exit: - ACPI_REPORT_ERROR(("Could not load tables: %s\n", + ACPI_REPORT_ERROR(("acpi_load_tables: Could not load tables: %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); diff --git a/trunk/drivers/acpi/tables/tbxfroot.c b/trunk/drivers/acpi/tables/tbxfroot.c index 6538ed818f5b..3b8a7e063e8a 100644 --- a/trunk/drivers/acpi/tables/tbxfroot.c +++ b/trunk/drivers/acpi/tables/tbxfroot.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -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))); @@ -396,8 +396,9 @@ 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_REPORT_ERROR(("RSDP structure not found, %s Flags=%X\n", - acpi_format_exception(status), flags)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "RSDP structure not found, %s Flags=%X\n", + acpi_format_exception(status), flags)); return_ACPI_STATUS(AE_NO_ACPI_TABLES); } @@ -502,7 +503,10 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_PTR_LENGTH, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); + 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)); return_ACPI_STATUS(status); } @@ -526,7 +530,10 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ACPI_EBDA_WINDOW_SIZE, (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", physical_address, ACPI_EBDA_WINDOW_SIZE)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Could not map memory at %8.8X for length %X\n", + physical_address, + ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS(status); } @@ -556,7 +563,10 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) (void *)&table_ptr); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not map memory at %8.8X for length %X\n", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); + 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)); return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/utilities/Makefile b/trunk/drivers/acpi/utilities/Makefile index 88eff14c4894..e87108b7338a 100644 --- a/trunk/drivers/acpi/utilities/Makefile +++ b/trunk/drivers/acpi/utilities/Makefile @@ -2,8 +2,7 @@ # Makefile for all Linux ACPI interpreter subdirectories # -obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ - utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ - utstate.o utmutex.o utobject.o utcache.o utresrc.o +obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ + utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o EXTRA_CFLAGS += $(ACPI_CFLAGS) diff --git a/trunk/drivers/acpi/utilities/utalloc.c b/trunk/drivers/acpi/utilities/utalloc.c index 0efcbdf7e620..068450b36475 100644 --- a/trunk/drivers/acpi/utilities/utalloc.c +++ b/trunk/drivers/acpi/utilities/utalloc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ ACPI_MODULE_NAME("utalloc") /* Local prototypes */ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS +#ifdef ACPI_DBG_TRACK_ALLOCATIONS static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); static acpi_status @@ -58,7 +58,9 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address, static acpi_status acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, u32 component, char *module, u32 line); +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS static acpi_status acpi_ut_create_list(char *list_name, u16 object_size, struct acpi_memory_list **return_cache); @@ -301,8 +303,8 @@ 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, - ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); + _ACPI_REPORT_ERROR(module, line, component, + ("ut_allocate: Attempt to allocate zero bytes\n")); size = 1; } @@ -310,7 +312,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, + _ACPI_REPORT_ERROR(module, line, component, ("ut_allocate: Could not allocate size %X\n", (u32) size)); @@ -344,16 +346,16 @@ 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, - ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); - size = 1; + _ACPI_REPORT_ERROR(module, line, component, + ("ut_callocate: Attempt to allocate zero bytes\n")); + return_PTR(NULL); } allocation = acpi_os_allocate(size); if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, + _ACPI_REPORT_ERROR(module, line, component, ("ut_callocate: Could not allocate size %X\n", (u32) size)); return_PTR(NULL); @@ -480,7 +482,7 @@ void *acpi_ut_callocate_and_track(acpi_size size, if (!allocation) { /* Report allocation error */ - _ACPI_REPORT_ERROR(module, line, + _ACPI_REPORT_ERROR(module, line, component, ("ut_callocate: Could not allocate size %X\n", (u32) size)); return (NULL); @@ -524,7 +526,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, + _ACPI_REPORT_ERROR(module, line, component, ("acpi_ut_free: Attempt to delete a NULL address\n")); return_VOID; @@ -540,8 +542,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_REPORT_ERROR(("Could not free memory, %s\n", - acpi_format_exception(status))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n", + acpi_format_exception(status))); } acpi_os_free(debug_block); @@ -626,8 +628,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_REPORT_ERROR(("Element %p Address %p\n", - element, allocation)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n", + element, allocation)); goto unlock_and_exit; } @@ -687,7 +689,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, if (NULL == mem_list->list_head) { /* No allocations! */ - _ACPI_REPORT_ERROR(module, line, + _ACPI_REPORT_ERROR(module, line, component, ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); return_ACPI_STATUS(AE_OK); @@ -863,10 +865,12 @@ void acpi_ut_dump_allocations(u32 component, char *module) /* Print summary */ if (!num_outstanding) { - ACPI_REPORT_INFO(("No outstanding allocations\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "No outstanding allocations.\n")); } else { - ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n", - num_outstanding, num_outstanding)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%d(%X) Outstanding allocations\n", + num_outstanding, num_outstanding)); } return_VOID; diff --git a/trunk/drivers/acpi/utilities/utcache.c b/trunk/drivers/acpi/utilities/utcache.c index 2177cb1ef2c4..93d48681d276 100644 --- a/trunk/drivers/acpi/utilities/utcache.c +++ b/trunk/drivers/acpi/utilities/utcache.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/utilities/utcopy.c b/trunk/drivers/acpi/utilities/utcopy.c index 1a4da006822a..5442b32de611 100644 --- a/trunk/drivers/acpi/utilities/utcopy.c +++ b/trunk/drivers/acpi/utilities/utcopy.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -398,17 +398,14 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, * Build a simple object (no nested objects) */ status = acpi_ut_copy_isimple_to_esimple(internal_object, - ACPI_CAST_PTR(union - acpi_object, - ret_buffer-> - pointer), - ACPI_ADD_PTR(u8, - ret_buffer-> - pointer, - ACPI_ROUND_UP_TO_NATIVE_WORD - (sizeof - (union - acpi_object))), + (union acpi_object *) + ret_buffer->pointer, + ((u8 *) ret_buffer-> + pointer + + ACPI_ROUND_UP_TO_NATIVE_WORD + (sizeof + (union + acpi_object))), &ret_buffer->length); /* * build simple does not include the object size in the length @@ -606,7 +603,8 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, /* * Packages as external input to control methods are not supported, */ - ACPI_REPORT_ERROR(("Packages as parameters not implemented!\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Packages as parameters not implemented!\n")); return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } @@ -869,7 +867,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(("Package allocation failure\n")); + ACPI_REPORT_ERROR(("aml_build_copy_internal_package_object: Package allocation failure\n")); return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/trunk/drivers/acpi/utilities/utdebug.c b/trunk/drivers/acpi/utilities/utdebug.c index 35f3d581e034..d80e92639932 100644 --- a/trunk/drivers/acpi/utilities/utdebug.c +++ b/trunk/drivers/acpi/utilities/utdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/utilities/utdelete.c b/trunk/drivers/acpi/utilities/utdelete.c index 1079a1a1f195..2bc878f7a127 100644 --- a/trunk/drivers/acpi/utilities/utdelete.c +++ b/trunk/drivers/acpi/utilities/utdelete.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -363,7 +363,8 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) default: - ACPI_REPORT_ERROR(("Unknown action (%X)\n", action)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n", + action)); break; } @@ -373,7 +374,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) */ if (count > ACPI_MAX_REFERENCE_COUNT) { - ACPI_REPORT_WARNING(("Large Reference Count (%X) in object %p\n\n", count, object)); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "**** Warning **** Large Reference Count (%X) in object %p\n\n", + count, object)); } return; diff --git a/trunk/drivers/acpi/utilities/uteval.c b/trunk/drivers/acpi/utilities/uteval.c index f4dc374a0eec..7b81d5ef3c32 100644 --- a/trunk/drivers/acpi/utilities/uteval.c +++ b/trunk/drivers/acpi/utilities/uteval.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,9 +95,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { if (!ACPI_STRCMP(string_desc->string.pointer, - ACPI_CAST_PTR(char, - acpi_gbl_valid_osi_strings[i]))) - { + (char *)acpi_gbl_valid_osi_strings[i])) { /* This string is supported */ return_desc->integer.value = 0xFFFFFFFF; @@ -154,8 +152,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, acpi_ut_get_node_name(prefix_node), path)); } else { - ACPI_REPORT_MTERROR("Method execution failed", - prefix_node, path, status); + ACPI_REPORT_METHOD_ERROR("Method execution failed", + prefix_node, path, status); } return_ACPI_STATUS(status); @@ -165,8 +163,9 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, if (!info.return_object) { if (expected_return_btypes) { - ACPI_REPORT_MTERROR("No object was returned from", - prefix_node, path, AE_NOT_EXIST); + ACPI_REPORT_METHOD_ERROR("No object was returned from", + prefix_node, path, + AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST); } @@ -211,10 +210,15 @@ 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_MTERROR("Return object type is incorrect", - prefix_node, path, AE_TYPE); + ACPI_REPORT_METHOD_ERROR("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)); + 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)); /* On error exit, we must delete the return object */ @@ -588,7 +592,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) "_STA on %4.4s was not found, assuming device is present\n", acpi_ut_get_node_name(device_node))); - *flags = ACPI_UINT32_MAX; + *flags = 0x0F; status = AE_OK; } @@ -633,17 +637,17 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) for (i = 0; i < 4; i++) { highest[i] = 0xFF; status = acpi_ut_evaluate_object(device_node, - ACPI_CAST_PTR(char, - acpi_gbl_highest_dstate_names - [i]), - ACPI_BTYPE_INTEGER, &obj_desc); + (char *) + acpi_gbl_highest_dstate_names + [i], ACPI_BTYPE_INTEGER, + &obj_desc); if (ACPI_FAILURE(status)) { if (status != AE_NOT_FOUND) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s on Device %4.4s, %s\n", - ACPI_CAST_PTR(char, - acpi_gbl_highest_dstate_names - [i]), + (char *) + acpi_gbl_highest_dstate_names + [i], acpi_ut_get_node_name (device_node), acpi_format_exception diff --git a/trunk/drivers/acpi/utilities/utglobal.c b/trunk/drivers/acpi/utilities/utglobal.c index 87ca9a0a8b76..399e64b51886 100644 --- a/trunk/drivers/acpi/utilities/utglobal.c +++ b/trunk/drivers/acpi/utilities/utglobal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,11 +67,8 @@ const char *acpi_format_exception(acpi_status status) acpi_status sub_status; const char *exception = NULL; - ACPI_FUNCTION_ENTRY(); + ACPI_FUNCTION_NAME("format_exception"); - /* - * Status is composed of two parts, a "type" and an actual code - */ sub_status = (status & ~AE_CODE_MASK); switch (status & AE_CODE_MASK) { @@ -121,13 +118,13 @@ const char *acpi_format_exception(acpi_status status) if (!exception) { /* Exception code was not recognized */ - ACPI_REPORT_ERROR(("Unknown exception code: 0x%8.8X\n", - status)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unknown exception code: 0x%8.8X\n", status)); - exception = "UNKNOWN_STATUS_CODE"; + return ((const char *)"UNKNOWN_STATUS_CODE"); } - return (ACPI_CAST_PTR(const char, exception)); + return ((const char *)exception); } /******************************************************************************* @@ -220,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} }; /* @@ -488,7 +485,7 @@ char *acpi_ut_get_region_name(u8 space_id) return ("invalid_space_id"); } - return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); + return ((char *)acpi_gbl_region_types[space_id]); } /******************************************************************************* @@ -506,13 +503,11 @@ 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", - "GlobalLock", - "PowerButton", - "SleepButton", - "RealTimeClock", -/*! [End] no source code translation !*/ + "global_lock", + "power_button", + "sleep_button", + "real_time_clock", }; char *acpi_ut_get_event_name(u32 event_id) @@ -522,7 +517,7 @@ char *acpi_ut_get_event_name(u32 event_id) return ("invalid_event_iD"); } - return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); + return ((char *)acpi_gbl_event_types[event_id]); } /******************************************************************************* @@ -550,13 +545,12 @@ 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 */ "FieldUnit", + /* 05 */ "field_unit", /* 06 */ "Device", /* 07 */ "Event", /* 08 */ "Method", @@ -565,34 +559,33 @@ static const char *acpi_gbl_ns_type_names[] = { /* 11 */ "Power", /* 12 */ "Processor", /* 13 */ "Thermal", - /* 14 */ "BufferField", - /* 15 */ "DdbHandle", - /* 16 */ "DebugObject", - /* 17 */ "RegionField", - /* 18 */ "BankField", - /* 19 */ "IndexField", + /* 14 */ "buffer_field", + /* 15 */ "ddb_handle", + /* 16 */ "debug_object", + /* 17 */ "region_field", + /* 18 */ "bank_field", + /* 19 */ "index_field", /* 20 */ "Reference", /* 21 */ "Alias", - /* 22 */ "MethodAlias", + /* 22 */ "method_alias", /* 23 */ "Notify", - /* 24 */ "AddrHandler", - /* 25 */ "ResourceDesc", - /* 26 */ "ResourceFld", + /* 24 */ "addr_handler", + /* 25 */ "resource_desc", + /* 26 */ "resource_fld", /* 27 */ "Scope", /* 28 */ "Extra", /* 29 */ "Data", /* 30 */ "Invalid" -/*! [End] no source code translation !*/ }; char *acpi_ut_get_type_name(acpi_object_type type) { if (type > ACPI_TYPE_INVALID) { - return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); + return ((char *)acpi_gbl_bad_type); } - return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); + return ((char *)acpi_gbl_ns_type_names[type]); } char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) @@ -641,7 +634,7 @@ char *acpi_ut_get_node_name(void *object) /* Name must be a valid ACPI name */ - if (!acpi_ut_valid_acpi_name(node->name.integer)) { + if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) { return ("????"); } @@ -665,16 +658,15 @@ 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-RootParseScope", - /* 07 */ "State-ParseScope", - /* 08 */ "State-WalkScope", + /* 06 */ "State-root_parse_scope", + /* 07 */ "State-parse_scope", + /* 08 */ "State-walk_scope", /* 09 */ "State-Result", /* 10 */ "State-Notify", /* 11 */ "State-Thread", @@ -682,7 +674,6 @@ 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) @@ -693,12 +684,11 @@ char *acpi_ut_get_descriptor_name(void *object) } if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { - return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); + return ((char *)acpi_gbl_bad_type); } - return (ACPI_CAST_PTR(char, - acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE - (object)])); + return ((char *) + acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); } @@ -797,11 +787,6 @@ void acpi_ut_init_globals(void) acpi_gbl_mutex_info[i].use_count = 0; } - for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { - acpi_gbl_owner_id_mask[i] = 0; - } - acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */ - /* GPE support */ acpi_gbl_gpe_xrupt_list_head = NULL; @@ -839,11 +824,7 @@ void acpi_ut_init_globals(void) acpi_gbl_ns_lookup_count = 0; acpi_gbl_ps_find_count = 0; acpi_gbl_acpi_hardware_present = TRUE; - acpi_gbl_last_owner_id_index = 0; - acpi_gbl_next_owner_id_offset = 0; - acpi_gbl_trace_method_name = 0; - acpi_gbl_trace_dbg_level = 0; - acpi_gbl_trace_dbg_layer = 0; + acpi_gbl_owner_id_mask = 0; acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; @@ -855,6 +836,7 @@ void acpi_ut_init_globals(void) /* Namespace */ acpi_gbl_root_node = NULL; + acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; diff --git a/trunk/drivers/acpi/utilities/utinit.c b/trunk/drivers/acpi/utilities/utinit.c index 7565ba6f90d5..9dde82b0beaf 100644 --- a/trunk/drivers/acpi/utilities/utinit.c +++ b/trunk/drivers/acpi/utilities/utinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -221,14 +221,15 @@ void acpi_ut_subsystem_shutdown(void) /* Just exit if subsystem is already shutdown */ if (acpi_gbl_shutdown) { - ACPI_REPORT_ERROR(("ACPI Subsystem is already terminated\n")); + ACPI_DEBUG_PRINT((ACPI_DB_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/trunk/drivers/acpi/utilities/utmath.c b/trunk/drivers/acpi/utilities/utmath.c index 06214201329d..68a0a6f94129 100644 --- a/trunk/drivers/acpi/utilities/utmath.c +++ b/trunk/drivers/acpi/utilities/utmath.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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(("Divide by zero\n")); + ACPI_REPORT_ERROR(("acpi_ut_short_divide: 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(("Divide by zero\n")); + ACPI_REPORT_ERROR(("acpi_ut_divide: 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(("Divide by zero\n")); + ACPI_REPORT_ERROR(("acpi_ut_short_divide: 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(("Divide by zero\n")); + ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); } diff --git a/trunk/drivers/acpi/utilities/utmisc.c b/trunk/drivers/acpi/utilities/utmisc.c index a77ffcd5570f..2ce872d75890 100644 --- a/trunk/drivers/acpi/utilities/utmisc.c +++ b/trunk/drivers/acpi/utilities/utmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,8 +63,6 @@ ACPI_MODULE_NAME("utmisc") acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) { acpi_native_uint i; - acpi_native_uint j; - acpi_native_uint k; acpi_status status; ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); @@ -84,66 +82,31 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) return_ACPI_STATUS(status); } - /* - * Find a free owner ID, cycle through all possible IDs on repeated - * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have - * to be scanned twice. - */ - for (i = 0, j = acpi_gbl_last_owner_id_index; - i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { - if (j >= ACPI_NUM_OWNERID_MASKS) { - j = 0; /* Wraparound to start of mask array */ - } - - for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { - if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { - /* There are no free IDs in this mask */ - - break; - } - - if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) { - /* - * Found a free ID. The actual ID is the bit index plus one, - * making zero an invalid Owner ID. Save this as the last ID - * allocated and update the global ID mask. - */ - acpi_gbl_owner_id_mask[j] |= (1 << k); - - acpi_gbl_last_owner_id_index = (u8) j; - acpi_gbl_next_owner_id_offset = (u8) (k + 1); + /* Find a free owner ID */ - /* - * Construct encoded ID from the index and bit position - * - * Note: Last [j].k (bit 255) is never used and is marked - * permanently allocated (prevents +1 overflow) - */ - *owner_id = - (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); + for (i = 0; i < 64; i++) { + if (!(acpi_gbl_owner_id_mask & (1ULL << i))) { + ACPI_DEBUG_PRINT((ACPI_DB_VALUES, + "Current owner_id mask: %16.16LX New ID: %2.2X\n", + acpi_gbl_owner_id_mask, + (unsigned int)(i + 1))); - ACPI_DEBUG_PRINT((ACPI_DB_VALUES, - "Allocated owner_id: %2.2X\n", - (unsigned int)*owner_id)); - goto exit; - } + acpi_gbl_owner_id_mask |= (1ULL << i); + *owner_id = (acpi_owner_id) (i + 1); + goto exit; } - - acpi_gbl_next_owner_id_offset = 0; } /* - * All owner_ids have been allocated. This typically should + * If we are here, all owner_ids have been allocated. This probably should * not happen since the IDs are reused after deallocation. The IDs are * allocated upon table load (one per table) and method execution, and * they are released when a table is unloaded or a method completes * execution. - * - * If this error happens, there may be very deep nesting of invoked control - * methods, or there may be a bug where the IDs are not released. */ + *owner_id = 0; status = AE_OWNER_ID_LIMIT; - ACPI_REPORT_ERROR(("Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT\n")); + ACPI_REPORT_ERROR(("Could not allocate new owner_id (64 max), AE_OWNER_ID_LIMIT\n")); exit: (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -160,7 +123,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) * control method or unloading a table. Either way, we would * ignore any error anyway. * - * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 + * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 64 * ******************************************************************************/ @@ -168,8 +131,6 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) { acpi_owner_id owner_id = *owner_id_ptr; acpi_status status; - acpi_native_uint index; - u32 bit; ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); @@ -179,7 +140,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) /* Zero is not a valid owner_iD */ - if (owner_id == 0) { + if ((owner_id == 0) || (owner_id > 64)) { ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); return_VOID; } @@ -195,18 +156,10 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) owner_id--; - /* Decode ID to index/offset pair */ - - index = ACPI_DIV_32(owner_id); - bit = 1 << ACPI_MOD_32(owner_id); - /* Free the owner ID only if it is valid */ - if (acpi_gbl_owner_id_mask[index] & bit) { - acpi_gbl_owner_id_mask[index] ^= bit; - } else { - ACPI_REPORT_ERROR(("Release of non-allocated owner_id: %2.2X\n", - owner_id + 1)); + if (acpi_gbl_owner_id_mask & (1ULL << owner_id)) { + acpi_gbl_owner_id_mask ^= (1ULL << owner_id); } (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -835,12 +788,61 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) return ((u8) (0 - sum)); } +/******************************************************************************* + * + * FUNCTION: acpi_ut_get_resource_end_tag + * + * PARAMETERS: obj_desc - The resource template buffer object + * + * RETURN: Pointer to the end tag + * + * DESCRIPTION: Find the END_TAG resource descriptor in a 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; + + while (buffer < end_buffer) { + buffer_byte = *buffer; + if (buffer_byte & ACPI_RDESC_TYPE_MASK) { + /* 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) { + /* Found the end tag descriptor, all done. */ + + return (buffer); + } + + /* Length is in the header */ + + buffer += ((buffer_byte & 0x07) + 1); + } + } + + /* End tag not found */ + + return (NULL); +} + /******************************************************************************* * * FUNCTION: acpi_ut_report_error * * 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 * @@ -848,10 +850,10 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) * ******************************************************************************/ -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) { - acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); + acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); } /******************************************************************************* @@ -860,6 +862,7 @@ void acpi_ut_report_error(char *module_name, u32 line_number) * * 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 * @@ -867,10 +870,11 @@ void acpi_ut_report_error(char *module_name, u32 line_number) * ******************************************************************************/ -void acpi_ut_report_warning(char *module_name, u32 line_number) +void +acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id) { - acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); + acpi_os_printf("%8s-%04d: *** Warning: ", module_name, line_number); } /******************************************************************************* @@ -879,6 +883,7 @@ void acpi_ut_report_warning(char *module_name, u32 line_number) * * 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 * @@ -886,8 +891,8 @@ void acpi_ut_report_warning(char *module_name, u32 line_number) * ******************************************************************************/ -void acpi_ut_report_info(char *module_name, u32 line_number) +void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id) { - acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); + acpi_os_printf("%8s-%04d: *** Info: ", module_name, line_number); } diff --git a/trunk/drivers/acpi/utilities/utmutex.c b/trunk/drivers/acpi/utilities/utmutex.c index ffaff55270b1..90134c56ece9 100644 --- a/trunk/drivers/acpi/utilities/utmutex.c +++ b/trunk/drivers/acpi/utilities/utmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -214,14 +214,23 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) * the ACPI subsystem code. */ for (i = mutex_id; i < MAX_MUTEX; i++) { - if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { + if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { if (i == mutex_id) { - ACPI_REPORT_ERROR(("Mutex [%s] already acquired by this thread [%X]\n", acpi_ut_get_mutex_name(mutex_id), this_thread_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)); return (AE_ALREADY_ACQUIRED); } - 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))); + 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))); return (AE_ACQUIRE_DEADLOCK); } @@ -244,7 +253,11 @@ 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_REPORT_ERROR(("Thread %X could not acquire Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); + 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))); } return (status); @@ -282,7 +295,9 @@ 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_REPORT_ERROR(("Mutex [%X] is not acquired, cannot release\n", mutex_id)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Mutex [%s] is not acquired, cannot release\n", + acpi_ut_get_mutex_name(mutex_id))); return (AE_NOT_ACQUIRED); } @@ -298,12 +313,16 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) * the ACPI subsystem code. */ for (i = mutex_id; i < MAX_MUTEX; i++) { - if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { + if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { if (i == mutex_id) { continue; } - ACPI_REPORT_ERROR(("Invalid release order: owns [%s], releasing [%s]\n", acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); + 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))); return (AE_RELEASE_DEADLOCK); } @@ -319,7 +338,11 @@ 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_REPORT_ERROR(("Thread %X could not release Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(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))); } else { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", diff --git a/trunk/drivers/acpi/utilities/utobject.c b/trunk/drivers/acpi/utilities/utobject.c index 1b6b21577805..3015e1540053 100644 --- a/trunk/drivers/acpi/utilities/utobject.c +++ b/trunk/drivers/acpi/utilities/utobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -177,8 +177,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) buffer = ACPI_MEM_CALLOCATE(buffer_size); if (!buffer) { - ACPI_REPORT_ERROR(("Could not allocate size %X\n", - (u32) buffer_size)); + ACPI_REPORT_ERROR(("create_buffer: could not allocate size %X\n", (u32) buffer_size)); acpi_ut_remove_reference(buffer_desc); return_PTR(NULL); } @@ -229,8 +228,7 @@ 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(("Could not allocate size %X\n", - (u32) string_size)); + ACPI_REPORT_ERROR(("create_string: could not allocate size %X\n", (u32) string_size)); acpi_ut_remove_reference(string_desc); return_PTR(NULL); } @@ -312,7 +310,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, + _ACPI_REPORT_ERROR(module_name, line_number, component_id, ("Could not allocate an object descriptor\n")); return_PTR(NULL); @@ -347,9 +345,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_REPORT_ERROR(("%p is not an ACPI Operand object [%s]\n", - object, - acpi_ut_get_descriptor_name(object))); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "%p is not an ACPI Operand object [%s]\n", + object, acpi_ut_get_descriptor_name(object))); return_VOID; } @@ -451,7 +449,10 @@ 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_REPORT_ERROR(("Unsupported Reference opcode=%X in object %p\n", internal_object->reference.opcode, internal_object)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported Reference opcode=%X in object %p\n", + internal_object->reference.opcode, + internal_object)); status = AE_TYPE; break; } @@ -459,9 +460,10 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, default: - ACPI_REPORT_ERROR(("Unsupported type=%X in object %p\n", - ACPI_GET_OBJECT_TYPE(internal_object), - internal_object)); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unsupported type=%X in object %p\n", + ACPI_GET_OBJECT_TYPE(internal_object), + internal_object)); status = AE_TYPE; break; } diff --git a/trunk/drivers/acpi/utilities/utresrc.c b/trunk/drivers/acpi/utilities/utresrc.c deleted file mode 100644 index 36bf9e4bf529..000000000000 --- a/trunk/drivers/acpi/utilities/utresrc.c +++ /dev/null @@ -1,538 +0,0 @@ -/******************************************************************************* - * - * Module Name: utresrc - Resource managment utilities - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2006, R. Byron Moore - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#include -#include - -#define _COMPONENT ACPI_UTILITIES -ACPI_MODULE_NAME("utmisc") - -#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) -/* - * Strings used to decode resource descriptors. - * Used by both the disasssembler and the debugger resource dump routines - */ -const char *acpi_gbl_BMdecode[2] = { - "not_bus_master", - "bus_master" -}; - -const char *acpi_gbl_config_decode[4] = { - "0 - Good Configuration", - "1 - Acceptable Configuration", - "2 - Suboptimal Configuration", - "3 - ***Invalid Configuration***", -}; - -const char *acpi_gbl_consume_decode[2] = { - "resource_producer", - "resource_consumer" -}; - -const char *acpi_gbl_DECdecode[2] = { - "pos_decode", - "sub_decode" -}; - -const char *acpi_gbl_HEdecode[2] = { - "Level", - "Edge" -}; - -const char *acpi_gbl_io_decode[2] = { - "Decode10", - "Decode16" -}; - -const char *acpi_gbl_LLdecode[2] = { - "active_high", - "active_low" -}; - -const char *acpi_gbl_max_decode[2] = { - "max_not_fixed", - "max_fixed" -}; - -const char *acpi_gbl_MEMdecode[4] = { - "non_cacheable", - "Cacheable", - "write_combining", - "Prefetchable" -}; - -const char *acpi_gbl_min_decode[2] = { - "min_not_fixed", - "min_fixed" -}; - -const char *acpi_gbl_MTPdecode[4] = { - "address_range_memory", - "address_range_reserved", - "address_range_aCPI", - "address_range_nVS" -}; - -const char *acpi_gbl_RNGdecode[4] = { - "invalid_ranges", - "non_iSAonly_ranges", - "ISAonly_ranges", - "entire_range" -}; - -const char *acpi_gbl_RWdecode[2] = { - "read_only", - "read_write" -}; - -const char *acpi_gbl_SHRdecode[2] = { - "Exclusive", - "Shared" -}; - -const char *acpi_gbl_SIZdecode[4] = { - "Transfer8", - "Transfer8_16", - "Transfer16", - "invalid_size" -}; - -const char *acpi_gbl_TRSdecode[2] = { - "dense_translation", - "sparse_translation" -}; - -const char *acpi_gbl_TTPdecode[2] = { - "type_static", - "type_translation" -}; - -const char *acpi_gbl_TYPdecode[4] = { - "Compatibility", - "type_a", - "type_b", - "type_f" -}; - -#endif - -/* - * Base sizes of the raw AML resource descriptors, indexed by resource type. - * Zero indicates a reserved (and therefore invalid) resource type. - */ -const u8 acpi_gbl_resource_aml_sizes[] = { - /* Small descriptors */ - - 0, - 0, - 0, - 0, - ACPI_AML_SIZE_SMALL(struct aml_resource_irq), - ACPI_AML_SIZE_SMALL(struct aml_resource_dma), - ACPI_AML_SIZE_SMALL(struct aml_resource_start_dependent), - ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent), - ACPI_AML_SIZE_SMALL(struct aml_resource_io), - ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io), - 0, - 0, - 0, - 0, - ACPI_AML_SIZE_SMALL(struct aml_resource_vendor_small), - ACPI_AML_SIZE_SMALL(struct aml_resource_end_tag), - - /* Large descriptors */ - - 0, - ACPI_AML_SIZE_LARGE(struct aml_resource_memory24), - ACPI_AML_SIZE_LARGE(struct aml_resource_generic_register), - 0, - ACPI_AML_SIZE_LARGE(struct aml_resource_vendor_large), - ACPI_AML_SIZE_LARGE(struct aml_resource_memory32), - ACPI_AML_SIZE_LARGE(struct aml_resource_fixed_memory32), - ACPI_AML_SIZE_LARGE(struct aml_resource_address32), - ACPI_AML_SIZE_LARGE(struct aml_resource_address16), - ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq), - ACPI_AML_SIZE_LARGE(struct aml_resource_address64), - ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64) -}; - -/* - * Resource types, used to validate the resource length field. - * The length of fixed-length types must match exactly, variable - * lengths must meet the minimum required length, etc. - * Zero indicates a reserved (and therefore invalid) resource type. - */ -static const u8 acpi_gbl_resource_types[] = { - /* Small descriptors */ - - 0, - 0, - 0, - 0, - ACPI_SMALL_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_SMALL_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, - 0, - 0, - 0, - 0, - ACPI_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, - - /* Large descriptors */ - - 0, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, - 0, - ACPI_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_FIXED_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_VARIABLE_LENGTH, - ACPI_FIXED_LENGTH -}; - -/******************************************************************************* - * - * FUNCTION: acpi_ut_validate_resource - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * return_index - Where the resource index is returned. NULL - * if the index is not required. - * - * RETURN: Status, and optionally the Index into the global resource tables - * - * DESCRIPTION: Validate an AML resource descriptor by checking the Resource - * Type and Resource Length. Returns an index into the global - * resource information/dispatch tables for later use. - * - ******************************************************************************/ - -acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) -{ - u8 resource_type; - u8 resource_index; - acpi_rs_length resource_length; - acpi_rs_length minimum_resource_length; - - ACPI_FUNCTION_ENTRY(); - - /* - * 1) Validate the resource_type field (Byte 0) - */ - resource_type = ACPI_GET8(aml); - - /* - * Byte 0 contains the descriptor name (Resource Type) - * Examine the large/small bit in the resource header - */ - if (resource_type & ACPI_RESOURCE_NAME_LARGE) { - /* Verify the large resource type (name) against the max */ - - if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { - return (AE_AML_INVALID_RESOURCE_TYPE); - } - - /* - * Large Resource Type -- bits 6:0 contain the name - * Translate range 0x80-0x8B to index range 0x10-0x1B - */ - resource_index = (u8) (resource_type - 0x70); - } else { - /* - * Small Resource Type -- bits 6:3 contain the name - * Shift range to index range 0x00-0x0F - */ - resource_index = (u8) - ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); - } - - /* Check validity of the resource type, zero indicates name is invalid */ - - if (!acpi_gbl_resource_types[resource_index]) { - return (AE_AML_INVALID_RESOURCE_TYPE); - } - - /* - * 2) Validate the resource_length field. This ensures that the length - * is at least reasonable, and guarantees that it is non-zero. - */ - resource_length = acpi_ut_get_resource_length(aml); - minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index]; - - /* Validate based upon the type of resource - fixed length or variable */ - - switch (acpi_gbl_resource_types[resource_index]) { - case ACPI_FIXED_LENGTH: - - /* Fixed length resource, length must match exactly */ - - if (resource_length != minimum_resource_length) { - return (AE_AML_BAD_RESOURCE_LENGTH); - } - break; - - case ACPI_VARIABLE_LENGTH: - - /* Variable length resource, length must be at least the minimum */ - - if (resource_length < minimum_resource_length) { - return (AE_AML_BAD_RESOURCE_LENGTH); - } - break; - - case ACPI_SMALL_VARIABLE_LENGTH: - - /* Small variable length resource, length can be (Min) or (Min-1) */ - - if ((resource_length > minimum_resource_length) || - (resource_length < (minimum_resource_length - 1))) { - return (AE_AML_BAD_RESOURCE_LENGTH); - } - break; - - default: - - /* Shouldn't happen (because of validation earlier), but be sure */ - - return (AE_AML_INVALID_RESOURCE_TYPE); - } - - /* Optionally return the resource table index */ - - if (return_index) { - *return_index = resource_index; - } - - return (AE_OK); -} - -/******************************************************************************* - * - * 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) - * Examine the large/small bit in the resource header - */ - if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource Type -- bits 6:0 contain the name */ - - return (ACPI_GET8(aml)); - } else { - /* Small Resource Type -- bits 6:3 contain the name */ - - return ((u8) (ACPI_GET8(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) -{ - acpi_rs_length resource_length; - - ACPI_FUNCTION_ENTRY(); - - /* - * Byte 0 contains the descriptor name (Resource Type) - * Examine the large/small bit in the resource header - */ - if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ - - ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); - - } else { - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ - - resource_length = (u16) (ACPI_GET8(aml) & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); - } - - return (resource_length); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_resource_header_length - * - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor - * - * RETURN: Length of the AML header (depends on large/small descriptor) - * - * DESCRIPTION: Get the length of the header for this resource. - * - ******************************************************************************/ - -u8 acpi_ut_get_resource_header_length(void *aml) -{ - ACPI_FUNCTION_ENTRY(); - - /* Examine the large/small bit in the resource header */ - - if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { - return (sizeof(struct aml_resource_large_header)); - } else { - return (sizeof(struct aml_resource_small_header)); - } -} - -/******************************************************************************* - * - * 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) -{ - ACPI_FUNCTION_ENTRY(); - - /* - * Get the Resource Length (does not include header length) and add - * the header length (depends on if this is a small or large resource) - */ - return (acpi_ut_get_resource_length(aml) + - acpi_ut_get_resource_header_length(aml)); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_resource_end_tag - * - * PARAMETERS: obj_desc - The resource template buffer object - * end_tag - Where the pointer to the end_tag is returned - * - * RETURN: Status, pointer to the end tag - * - * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template - * - ******************************************************************************/ - -acpi_status -acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, - u8 ** end_tag) -{ - acpi_status status; - u8 *aml; - u8 *end_aml; - - ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); - - /* Get start and end pointers */ - - aml = obj_desc->buffer.pointer; - end_aml = aml + obj_desc->buffer.length; - - /* Walk the resource template, one descriptor per iteration */ - - while (aml < end_aml) { - /* Validate the Resource Type and Resource Length */ - - status = acpi_ut_validate_resource(aml, NULL); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* end_tag resource indicates the end of the resource template */ - - if (acpi_ut_get_resource_type(aml) == - ACPI_RESOURCE_NAME_END_TAG) { - /* Return the pointer to the end_tag */ - - *end_tag = aml; - return_ACPI_STATUS(AE_OK); - } - - /* - * Point to the next resource descriptor in the AML buffer. The - * descriptor length is guaranteed to be non-zero by resource - * validation above. - */ - aml += acpi_ut_get_descriptor_length(aml); - } - - /* Did not find an end_tag resource descriptor */ - - return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); -} diff --git a/trunk/drivers/acpi/utilities/utstate.c b/trunk/drivers/acpi/utilities/utstate.c index 4b134a722907..c1cb27583be8 100644 --- a/trunk/drivers/acpi/utilities/utstate.c +++ b/trunk/drivers/acpi/utilities/utstate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ acpi_status acpi_ut_create_pkg_state_and_push(void *internal_object, void *external_object, u16 index, - union acpi_generic_state **state_list) + union acpi_generic_state ** state_list) { union acpi_generic_state *state; diff --git a/trunk/drivers/acpi/utilities/utxface.c b/trunk/drivers/acpi/utilities/utxface.c index b4bc94883200..f06bd5e5e9d1 100644 --- a/trunk/drivers/acpi/utilities/utxface.c +++ b/trunk/drivers/acpi/utilities/utxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, 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(("OSL failed to initialize, %s\n", + ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n", acpi_format_exception(status))); return_ACPI_STATUS(status); } @@ -154,7 +154,8 @@ acpi_status acpi_enable_subsystem(u32 flags) status = acpi_enable(); if (ACPI_FAILURE(status)) { - ACPI_REPORT_WARNING(("acpi_enable failed\n")); + ACPI_DEBUG_PRINT((ACPI_DB_WARN, + "acpi_enable failed.\n")); return_ACPI_STATUS(status); } } @@ -177,14 +178,10 @@ acpi_status acpi_enable_subsystem(u32 flags) /* * Initialize ACPI Event handling (Fixed and General Purpose) * - * Note1: We must have the hardware and events initialized before we can - * execute any control methods safely. Any control method can require - * ACPI hardware support, so the hardware must be fully initialized before - * any method execution! - * - * Note2: Fixed events are initialized and enabled here. GPEs are - * initialized, but cannot be enabled until after the hardware is - * completely initialized (SCI and global_lock activated) + * NOTE: We must have the hardware AND events initialized before we can + * execute ANY control methods SAFELY. Any control method can require + * ACPI hardware support, so the hardware MUST be initialized before + * execution! */ if (!(flags & ACPI_NO_EVENT_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -196,10 +193,8 @@ acpi_status acpi_enable_subsystem(u32 flags) } } - /* - * Install the SCI handler and Global Lock handler. This completes the - * hardware initialization. - */ + /* Install the SCI handler and Global Lock handler */ + if (!(flags & ACPI_NO_HANDLER_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); @@ -210,24 +205,6 @@ acpi_status acpi_enable_subsystem(u32 flags) } } - /* - * Complete the GPE initialization for the GPE blocks defined in the FADT - * (GPE block 0 and 1). - * - * Note1: This is where the _PRW methods are executed for the GPEs. These - * methods can only be executed after the SCI and Global Lock handlers are - * installed and initialized. - * - * Note2: Currently, there seems to be no need to run the _REG methods - * before execution of the _PRW methods and enabling of the GPEs. - */ - if (!(flags & ACPI_NO_EVENT_INIT)) { - status = acpi_ev_install_fadt_gpes(); - if (ACPI_FAILURE(status)) { - return (status); - } - } - return_ACPI_STATUS(status); } @@ -253,9 +230,9 @@ acpi_status acpi_initialize_objects(u32 flags) /* * Run all _REG methods * - * Note: Any objects accessed by the _REG methods will be automatically - * initialized, even if they contain executable AML (see the call to - * acpi_ns_initialize_objects below). + * NOTE: Any objects accessed + * by the _REG methods will be automatically initialized, even if they + * contain executable AML (see call to acpi_ns_initialize_objects below). */ if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -268,9 +245,9 @@ acpi_status acpi_initialize_objects(u32 flags) } /* - * Initialize the objects that remain uninitialized. This runs the - * executable AML that may be part of the declaration of these objects: - * operation_regions, buffer_fields, Buffers, and Packages. + * Initialize the objects that remain uninitialized. This + * runs the executable AML that may be part of the declaration of these + * objects: operation_regions, buffer_fields, Buffers, and Packages. */ if (!(flags & ACPI_NO_OBJECT_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -283,8 +260,8 @@ acpi_status acpi_initialize_objects(u32 flags) } /* - * Initialize all device objects in the namespace. This runs the device - * _STA and _INI methods. + * Initialize all device objects in the namespace + * This runs the _STA and _INI methods. */ if (!(flags & ACPI_NO_DEVICE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, diff --git a/trunk/drivers/char/hpet.c b/trunk/drivers/char/hpet.c index 66a2fee06eb9..3808d9572619 100644 --- a/trunk/drivers/char/hpet.c +++ b/trunk/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.maximum - addr.minimum + 1; - hdp->hd_phys_address = addr.minimum; - hdp->hd_address = ioremap(addr.minimum, 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); 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_RESOURCE_TYPE_FIXED_MEMORY32) { - struct acpi_resource_fixed_memory32 *fixmem32; + } else if (res->id == ACPI_RSTYPE_FIXED_MEM32) { + struct acpi_resource_fixed_mem32 *fixmem32; fixmem32 = &res->data.fixed_memory32; if (!fixmem32) return -EINVAL; - hdp->hd_phys_address = fixmem32->address; - hdp->hd_address = ioremap(fixmem32->address, + hdp->hd_phys_address = fixmem32->range_base_address; + hdp->hd_address = ioremap(fixmem32->range_base_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_RESOURCE_TYPE_EXTENDED_IRQ) { - struct acpi_resource_extended_irq *irqp; + } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { + struct acpi_resource_ext_irq *irqp; int i; irqp = &res->data.extended_irq; - if (irqp->interrupt_count > 0) { - hdp->hd_nirqs = irqp->interrupt_count; + if (irqp->number_of_interrupts > 0) { + hdp->hd_nirqs = irqp->number_of_interrupts; for (i = 0; i < hdp->hd_nirqs; i++) { int rc = acpi_register_gsi(irqp->interrupts[i], - irqp->triggering, - irqp->polarity); + irqp->edge_level, + irqp->active_high_low); if (rc < 0) return AE_ERROR; hdp->hd_irq[i] = rc; diff --git a/trunk/drivers/pnp/pnpacpi/rsparser.c b/trunk/drivers/pnp/pnpacpi/rsparser.c index 407b4eaddcbf..416d30debe6c 100644 --- a/trunk/drivers/pnp/pnpacpi/rsparser.c +++ b/trunk/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 triggering, int polarity) +static int irq_flags(int edge_level, int active_high_low) { int flag; - if (triggering == ACPI_LEVEL_SENSITIVE) { - if(polarity == ACPI_ACTIVE_LOW) + if (edge_level == ACPI_LEVEL_SENSITIVE) { + if(active_high_low == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWLEVEL; else flag = IORESOURCE_IRQ_HIGHLEVEL; } else { - if(polarity == ACPI_ACTIVE_LOW) + if(active_high_low == ACPI_ACTIVE_LOW) flag = IORESOURCE_IRQ_LOWEDGE; else flag = IORESOURCE_IRQ_HIGHEDGE; @@ -50,31 +50,31 @@ static int irq_flags(int triggering, int polarity) return flag; } -static void decode_irq_flags(int flag, int *triggering, int *polarity) +static void decode_irq_flags(int flag, int *edge_level, int *active_high_low) { switch (flag) { case IORESOURCE_IRQ_LOWLEVEL: - *triggering = ACPI_LEVEL_SENSITIVE; - *polarity = ACPI_ACTIVE_LOW; + *edge_level = ACPI_LEVEL_SENSITIVE; + *active_high_low = ACPI_ACTIVE_LOW; break; case IORESOURCE_IRQ_HIGHLEVEL: - *triggering = ACPI_LEVEL_SENSITIVE; - *polarity = ACPI_ACTIVE_HIGH; + *edge_level = ACPI_LEVEL_SENSITIVE; + *active_high_low = ACPI_ACTIVE_HIGH; break; case IORESOURCE_IRQ_LOWEDGE: - *triggering = ACPI_EDGE_SENSITIVE; - *polarity = ACPI_ACTIVE_LOW; + *edge_level = ACPI_EDGE_SENSITIVE; + *active_high_low = ACPI_ACTIVE_LOW; break; case IORESOURCE_IRQ_HIGHEDGE: - *triggering = ACPI_EDGE_SENSITIVE; - *polarity = ACPI_ACTIVE_HIGH; + *edge_level = ACPI_EDGE_SENSITIVE; + *active_high_low = ACPI_ACTIVE_HIGH; break; } } static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, - int triggering, int polarity) + int edge_level, int active_high_low) { 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, triggering, polarity); + irq = acpi_register_gsi(gsi, edge_level, active_high_low); if (irq < 0) { res->irq_resource[i].flags |= IORESOURCE_DISABLED; return; @@ -163,96 +163,77 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; int i; - switch (res->type) { - case ACPI_RESOURCE_TYPE_IRQ: + switch (res->id) { + case ACPI_RSTYPE_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.interrupt_count; i++) { + for (i = 0; i < res->data.irq.number_of_interrupts; i++) { pnpacpi_parse_allocated_irqresource(res_table, res->data.irq.interrupts[i], - res->data.irq.triggering, - res->data.irq.polarity); + res->data.irq.edge_level, + res->data.irq.active_high_low); } break; - 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_RESOURCE_TYPE_IO: - pnpacpi_parse_allocated_ioresource(res_table, - res->data.io.minimum, - res->data.io.address_length); + case ACPI_RSTYPE_EXT_IRQ: + for (i = 0; i < res->data.extended_irq.number_of_interrupts; 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); + } break; - - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - case ACPI_RESOURCE_TYPE_END_DEPENDENT: + case ACPI_RSTYPE_DMA: + if (res->data.dma.number_of_channels > 0) + pnpacpi_parse_allocated_dmaresource(res_table, + res->data.dma.channels[0]); break; - - case ACPI_RESOURCE_TYPE_FIXED_IO: - pnpacpi_parse_allocated_ioresource(res_table, - res->data.fixed_io.address, - res->data.fixed_io.address_length); + case ACPI_RSTYPE_IO: + pnpacpi_parse_allocated_ioresource(res_table, + res->data.io.min_base_address, + res->data.io.range_length); break; - - case ACPI_RESOURCE_TYPE_VENDOR: + case ACPI_RSTYPE_FIXED_IO: + pnpacpi_parse_allocated_ioresource(res_table, + res->data.fixed_io.base_address, + res->data.fixed_io.range_length); break; - - case ACPI_RESOURCE_TYPE_END_TAG: + case ACPI_RSTYPE_MEM24: + pnpacpi_parse_allocated_memresource(res_table, + res->data.memory24.min_base_address, + res->data.memory24.range_length); break; - - case ACPI_RESOURCE_TYPE_MEMORY24: - pnpacpi_parse_allocated_memresource(res_table, - res->data.memory24.minimum, - res->data.memory24.address_length); + case ACPI_RSTYPE_MEM32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.memory32.min_base_address, + res->data.memory32.range_length); break; - case ACPI_RESOURCE_TYPE_MEMORY32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.memory32.minimum, - res->data.memory32.address_length); + case ACPI_RSTYPE_FIXED_MEM32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.fixed_memory32.range_base_address, + res->data.fixed_memory32.range_length); break; - 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_RESOURCE_TYPE_ADDRESS16: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address16.minimum, + case ACPI_RSTYPE_ADDRESS16: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address16.min_address_range, res->data.address16.address_length); break; - case ACPI_RESOURCE_TYPE_ADDRESS32: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address32.minimum, + case ACPI_RSTYPE_ADDRESS32: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address32.min_address_range, res->data.address32.address_length); break; - case ACPI_RESOURCE_TYPE_ADDRESS64: - pnpacpi_parse_allocated_memresource(res_table, - res->data.address64.minimum, + case ACPI_RSTYPE_ADDRESS64: + pnpacpi_parse_allocated_memresource(res_table, + res->data.address64.min_address_range, res->data.address64.address_length); break; - - case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: - break; - - 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.triggering, - res->data.extended_irq.polarity); - } - break; - - case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: + case ACPI_RSTYPE_VENDOR: break; - default: - pnp_warn("PnPACPI: unknown resource type %d", res->type); + pnp_warn("PnPACPI: unknown resource type %d", res->id); return AE_ERROR; } @@ -272,13 +253,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso int i; struct pnp_dma * dma; - if (p->channel_count == 0) + if (p->number_of_channels == 0) return; dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); if (!dma) return; - for(i = 0; i < p->channel_count; i++) + for(i = 0; i < p->number_of_channels; i++) dma->map |= 1 << p->channels[i]; dma->flags = 0; if (p->bus_master) @@ -328,37 +309,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option, int i; struct pnp_irq * irq; - if (p->interrupt_count == 0) + if (p->number_of_interrupts == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; - for(i = 0; i < p->interrupt_count; i++) + for(i = 0; i < p->number_of_interrupts; i++) if (p->interrupts[i]) __set_bit(p->interrupts[i], irq->map); - irq->flags = irq_flags(p->triggering, p->polarity); + irq->flags = irq_flags(p->edge_level, p->active_high_low); pnp_register_irq_resource(option, irq); return; } static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, - struct acpi_resource_extended_irq *p) + struct acpi_resource_ext_irq *p) { int i; struct pnp_irq * irq; - if (p->interrupt_count == 0) + if (p->number_of_interrupts == 0) return; irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; - for(i = 0; i < p->interrupt_count; i++) + for(i = 0; i < p->number_of_interrupts; i++) if (p->interrupts[i]) __set_bit(p->interrupts[i], irq->map); - irq->flags = irq_flags(p->triggering, p->polarity); + irq->flags = irq_flags(p->edge_level, p->active_high_low); pnp_register_irq_resource(option, irq); return; @@ -370,16 +351,16 @@ pnpacpi_parse_port_option(struct pnp_option *option, { struct pnp_port * port; - if (io->address_length == 0) + if (io->range_length == 0) return; port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; - port->min = io->minimum; - port->max = io->maximum; + port->min = io->min_base_address; + port->max = io->max_base_address; port->align = io->alignment; - port->size = io->address_length; - port->flags = ACPI_DECODE_16 == io->io_decode ? + port->size = io->range_length; + port->flags = ACPI_DECODE_16 == io->io_decode ? PNP_PORT_FLAG_16BITADDR : 0; pnp_register_port_resource(option,port); return; @@ -391,13 +372,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, { struct pnp_port * port; - if (io->address_length == 0) + if (io->range_length == 0) return; port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; - port->min = port->max = io->address; - port->size = io->address_length; + port->min = port->max = io->base_address; + port->size = io->range_length; port->align = 0; port->flags = PNP_PORT_FLAG_FIXED; pnp_register_port_resource(option,port); @@ -406,21 +387,21 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, static void pnpacpi_parse_mem24_option(struct pnp_option *option, - struct acpi_resource_memory24 *p) + struct acpi_resource_mem24 *p) { struct pnp_mem * mem; - if (p->address_length == 0) + if (p->range_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = p->minimum; - mem->max = p->maximum; + mem->min = p->min_base_address; + mem->max = p->max_base_address; mem->align = p->alignment; - mem->size = p->address_length; + mem->size = p->range_length; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -429,21 +410,21 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, static void pnpacpi_parse_mem32_option(struct pnp_option *option, - struct acpi_resource_memory32 *p) + struct acpi_resource_mem32 *p) { struct pnp_mem * mem; - if (p->address_length == 0) + if (p->range_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = p->minimum; - mem->max = p->maximum; + mem->min = p->min_base_address; + mem->max = p->max_base_address; mem->align = p->alignment; - mem->size = p->address_length; + mem->size = p->range_length; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); @@ -452,72 +433,33 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, static void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, - struct acpi_resource_fixed_memory32 *p) + struct acpi_resource_fixed_mem32 *p) { struct pnp_mem * mem; - if (p->address_length == 0) + if (p->range_length == 0) return; mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; - mem->min = mem->max = p->address; - mem->size = p->address_length; + mem->min = mem->max = p->range_base_address; + mem->size = p->range_length; mem->align = 0; - mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? + mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? IORESOURCE_MEM_WRITEABLE : 0; pnp_register_mem_resource(option,mem); return; } -static void -pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) -{ - struct acpi_resource_address64 addr, *p = &addr; - acpi_status status; - struct pnp_mem * mem; - struct pnp_port * port; - - status = acpi_resource_to_address64(r, p); - if (!ACPI_SUCCESS(status)) { - pnp_warn("PnPACPI: failed to convert resource type %d", r->type); - return; - } - - if (p->address_length == 0) - return; - - if (p->resource_type == ACPI_MEMORY_RANGE) { - mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); - if (!mem) - return; - mem->min = mem->max = p->minimum; - mem->size = p->address_length; - mem->align = 0; - mem->flags = (p->info.mem.write_protect == - ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; - pnp_register_mem_resource(option,mem); - } else if (p->resource_type == ACPI_IO_RANGE) { - port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); - if (!port) - return; - port->min = port->max = p->minimum; - port->size = p->address_length; - port->align = 0; - port->flags = PNP_PORT_FLAG_FIXED; - pnp_register_port_resource(option,port); - } -} - struct acpipnp_parse_option_s { struct pnp_option *option; struct pnp_option *option_independent; 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; @@ -525,16 +467,35 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, struct pnp_dev *dev = parse_data->dev; struct pnp_option *option = parse_data->option; - switch (res->type) { - case ACPI_RESOURCE_TYPE_IRQ: + switch (res->id) { + case ACPI_RSTYPE_IRQ: pnpacpi_parse_irq_option(option, &res->data.irq); break; - - case ACPI_RESOURCE_TYPE_DMA: + case ACPI_RSTYPE_EXT_IRQ: + pnpacpi_parse_ext_irq_option(option, + &res->data.extended_irq); + break; + case ACPI_RSTYPE_DMA: pnpacpi_parse_dma_option(option, &res->data.dma); break; - - case ACPI_RESOURCE_TYPE_START_DEPENDENT: + case ACPI_RSTYPE_IO: + pnpacpi_parse_port_option(option, &res->data.io); + break; + case ACPI_RSTYPE_FIXED_IO: + pnpacpi_parse_fixed_port_option(option, + &res->data.fixed_io); + break; + case ACPI_RSTYPE_MEM24: + pnpacpi_parse_mem24_option(option, &res->data.memory24); + break; + case ACPI_RSTYPE_MEM32: + pnpacpi_parse_mem32_option(option, &res->data.memory32); + break; + case ACPI_RSTYPE_FIXED_MEM32: + pnpacpi_parse_fixed_mem32_option(option, + &res->data.fixed_memory32); + break; + case ACPI_RSTYPE_START_DPF: switch (res->data.start_dpf.compatibility_priority) { case ACPI_GOOD_CONFIGURATION: priority = PNP_RES_PRIORITY_PREFERRED; @@ -557,8 +518,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, return AE_ERROR; parse_data->option = option; break; - - case ACPI_RESOURCE_TYPE_END_DEPENDENT: + case ACPI_RSTYPE_END_DPF: /*only one EndDependentFn is allowed*/ if (!parse_data->option_independent) { pnp_warn("PnPACPI: more than one EndDependentFn"); @@ -567,59 +527,15 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, parse_data->option = parse_data->option_independent; parse_data->option_independent = NULL; break; - - case ACPI_RESOURCE_TYPE_IO: - pnpacpi_parse_port_option(option, &res->data.io); - break; - - case ACPI_RESOURCE_TYPE_FIXED_IO: - pnpacpi_parse_fixed_port_option(option, - &res->data.fixed_io); - break; - - case ACPI_RESOURCE_TYPE_VENDOR: - case ACPI_RESOURCE_TYPE_END_TAG: - break; - - case ACPI_RESOURCE_TYPE_MEMORY24: - pnpacpi_parse_mem24_option(option, &res->data.memory24); - break; - - case ACPI_RESOURCE_TYPE_MEMORY32: - pnpacpi_parse_mem32_option(option, &res->data.memory32); - break; - - case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: - pnpacpi_parse_fixed_mem32_option(option, - &res->data.fixed_memory32); - break; - - case ACPI_RESOURCE_TYPE_ADDRESS16: - case ACPI_RESOURCE_TYPE_ADDRESS32: - case ACPI_RESOURCE_TYPE_ADDRESS64: - pnpacpi_parse_address_option(option, res); - break; - - case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: - break; - - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - pnpacpi_parse_ext_irq_option(option, - &res->data.extended_irq); - break; - - case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: - break; - default: - pnp_warn("PnPACPI: unknown resource type %d", res->type); + pnp_warn("PnPACPI: unknown resource type %d", res->id); return AE_ERROR; } 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; @@ -630,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; @@ -643,24 +559,21 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, void *data) { int *res_cnt = (int *)data; - switch (res->type) { - case ACPI_RESOURCE_TYPE_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: - case ACPI_RESOURCE_TYPE_ADDRESS16: - case ACPI_RESOURCE_TYPE_ADDRESS32: - case ACPI_RESOURCE_TYPE_ADDRESS64: - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + switch (res->id) { + 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: +#if 0 + case ACPI_RSTYPE_ADDRESS16: + case ACPI_RSTYPE_ADDRESS32: + case ACPI_RSTYPE_ADDRESS64: +#endif (*res_cnt) ++; - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - case ACPI_RESOURCE_TYPE_END_DEPENDENT: - case ACPI_RESOURCE_TYPE_VENDOR: - case ACPI_RESOURCE_TYPE_END_TAG: - case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: default: return AE_OK; } @@ -671,25 +584,22 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) { struct acpi_resource **resource = (struct acpi_resource **)data; - switch (res->type) { - case ACPI_RESOURCE_TYPE_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: - case ACPI_RESOURCE_TYPE_ADDRESS16: - case ACPI_RESOURCE_TYPE_ADDRESS32: - case ACPI_RESOURCE_TYPE_ADDRESS64: - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - (*resource)->type = res->type; + switch (res->id) { + 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: +#if 0 + case ACPI_RSTYPE_ADDRESS16: + case ACPI_RSTYPE_ADDRESS32: + case ACPI_RSTYPE_ADDRESS64: +#endif + (*resource)->id = res->id; (*resource)++; - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - case ACPI_RESOURCE_TYPE_END_DEPENDENT: - case ACPI_RESOURCE_TYPE_VENDOR: - case ACPI_RESOURCE_TYPE_END_TAG: - case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: default: return AE_OK; } @@ -697,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"); @@ -718,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); @@ -726,54 +636,54 @@ int pnpacpi_build_resource_template(acpi_handle handle, return -EINVAL; } /* resource will pointer the end resource now */ - resource->type = ACPI_RESOURCE_TYPE_END_TAG; + resource->id = ACPI_RSTYPE_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 triggering, polarity; + int edge_level, active_high_low; - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, - &polarity); - resource->type = ACPI_RESOURCE_TYPE_IRQ; + decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, + &active_high_low); + resource->id = ACPI_RSTYPE_IRQ; resource->length = sizeof(struct acpi_resource); - resource->data.irq.triggering = triggering; - resource->data.irq.polarity = polarity; - if (triggering == ACPI_EDGE_SENSITIVE) - resource->data.irq.sharable = ACPI_EXCLUSIVE; + 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; else - resource->data.irq.sharable = ACPI_SHARED; - resource->data.irq.interrupt_count = 1; + resource->data.irq.shared_exclusive = ACPI_SHARED; + resource->data.irq.number_of_interrupts = 1; resource->data.irq.interrupts[0] = p->start; } static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, struct resource *p) { - int triggering, polarity; + int edge_level, active_high_low; - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, - &polarity); - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; + decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, + &active_high_low); + resource->id = ACPI_RSTYPE_EXT_IRQ; resource->length = sizeof(struct acpi_resource); resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; - resource->data.extended_irq.triggering = triggering; - resource->data.extended_irq.polarity = polarity; - if (triggering == ACPI_EDGE_SENSITIVE) - resource->data.irq.sharable = ACPI_EXCLUSIVE; + 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; else - resource->data.irq.sharable = ACPI_SHARED; - resource->data.extended_irq.interrupt_count = 1; + resource->data.irq.shared_exclusive = ACPI_SHARED; + resource->data.extended_irq.number_of_interrupts = 1; resource->data.extended_irq.interrupts[0] = p->start; } static void pnpacpi_encode_dma(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_DMA; + resource->id = ACPI_RSTYPE_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) @@ -791,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.channel_count = 1; + resource->data.dma.number_of_channels = 1; resource->data.dma.channels[0] = p->start; } static void pnpacpi_encode_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_IO; + resource->id = ACPI_RSTYPE_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.minimum = p->start; - resource->data.io.maximum = p->end; + ACPI_DECODE_16 : ACPI_DECODE_10; + resource->data.io.min_base_address = p->start; + resource->data.io.max_base_address = p->end; resource->data.io.alignment = 0; /* Correct? */ - resource->data.io.address_length = p->end - p->start + 1; + resource->data.io.range_length = p->end - p->start + 1; } static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; + resource->id = ACPI_RSTYPE_FIXED_IO; resource->length = sizeof(struct acpi_resource); - resource->data.fixed_io.address = p->start; - resource->data.fixed_io.address_length = p->end - p->start + 1; + resource->data.fixed_io.base_address = p->start; + resource->data.fixed_io.range_length = p->end - p->start + 1; } static void pnpacpi_encode_mem24(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_MEMORY24; + resource->id = ACPI_RSTYPE_MEM24; resource->length = sizeof(struct acpi_resource); /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ - resource->data.memory24.write_protect = + resource->data.memory24.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.memory24.minimum = p->start; - resource->data.memory24.maximum = p->end; + resource->data.memory24.min_base_address = p->start; + resource->data.memory24.max_base_address = p->end; resource->data.memory24.alignment = 0; - resource->data.memory24.address_length = p->end - p->start + 1; + resource->data.memory24.range_length = p->end - p->start + 1; } static void pnpacpi_encode_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_MEMORY32; + resource->id = ACPI_RSTYPE_MEM32; resource->length = sizeof(struct acpi_resource); - resource->data.memory32.write_protect = + resource->data.memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.memory32.minimum = p->start; - resource->data.memory32.maximum = p->end; + resource->data.memory32.min_base_address = p->start; + resource->data.memory32.max_base_address = p->end; resource->data.memory32.alignment = 0; - resource->data.memory32.address_length = p->end - p->start + 1; + resource->data.memory32.range_length = p->end - p->start + 1; } static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, struct resource *p) { - resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; + resource->id = ACPI_RSTYPE_FIXED_MEM32; resource->length = sizeof(struct acpi_resource); - resource->data.fixed_memory32.write_protect = + resource->data.fixed_memory32.read_write_attribute = (p->flags & IORESOURCE_MEM_WRITEABLE) ? ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; - resource->data.fixed_memory32.address = p->start; - resource->data.fixed_memory32.address_length = p->end - p->start + 1; + resource->data.fixed_memory32.range_base_address = p->start; + resource->data.fixed_memory32.range_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; @@ -870,67 +780,58 @@ 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_RESOURCE_TYPE_IRQ: + switch(resource->id) { + case ACPI_RSTYPE_IRQ: pnp_dbg("Encode irq"); - pnpacpi_encode_irq(resource, + pnpacpi_encode_irq(resource, &res_table->irq_resource[irq]); irq++; break; - case ACPI_RESOURCE_TYPE_DMA: + case ACPI_RSTYPE_EXT_IRQ: + pnp_dbg("Encode ext irq"); + pnpacpi_encode_ext_irq(resource, + &res_table->irq_resource[irq]); + irq++; + break; + case ACPI_RSTYPE_DMA: pnp_dbg("Encode dma"); - pnpacpi_encode_dma(resource, + pnpacpi_encode_dma(resource, &res_table->dma_resource[dma]); dma ++; break; - case ACPI_RESOURCE_TYPE_IO: + case ACPI_RSTYPE_IO: pnp_dbg("Encode io"); - pnpacpi_encode_io(resource, + pnpacpi_encode_io(resource, &res_table->port_resource[port]); port ++; break; - case ACPI_RESOURCE_TYPE_FIXED_IO: + case ACPI_RSTYPE_FIXED_IO: pnp_dbg("Encode fixed io"); pnpacpi_encode_fixed_io(resource, &res_table->port_resource[port]); port ++; break; - case ACPI_RESOURCE_TYPE_MEMORY24: + case ACPI_RSTYPE_MEM24: pnp_dbg("Encode mem24"); pnpacpi_encode_mem24(resource, &res_table->mem_resource[mem]); mem ++; break; - case ACPI_RESOURCE_TYPE_MEMORY32: + case ACPI_RSTYPE_MEM32: pnp_dbg("Encode mem32"); pnpacpi_encode_mem32(resource, &res_table->mem_resource[mem]); mem ++; break; - case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + case ACPI_RSTYPE_FIXED_MEM32: pnp_dbg("Encode fixed mem32"); pnpacpi_encode_fixed_mem32(resource, &res_table->mem_resource[mem]); mem ++; break; - case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - pnp_dbg("Encode ext irq"); - pnpacpi_encode_ext_irq(resource, - &res_table->irq_resource[irq]); - irq++; - break; - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - case ACPI_RESOURCE_TYPE_END_DEPENDENT: - case ACPI_RESOURCE_TYPE_VENDOR: - case ACPI_RESOURCE_TYPE_END_TAG: - case ACPI_RESOURCE_TYPE_ADDRESS16: - case ACPI_RESOURCE_TYPE_ADDRESS32: - case ACPI_RESOURCE_TYPE_ADDRESS64: - case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: - case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: default: /* other type */ - pnp_warn("unknown resource type %d", resource->type); + pnp_warn("unknown resource type %d", resource->id); return -EINVAL; } resource ++; diff --git a/trunk/drivers/serial/8250_acpi.c b/trunk/drivers/serial/8250_acpi.c index 809f89ab965c..a802bdce6e5d 100644 --- a/trunk/drivers/serial/8250_acpi.c +++ b/trunk/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->minimum; + port->mapbase = addr->min_address_range; 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->address_length) { - port->iobase = io->minimum; + if (io->range_length) { + port->iobase = io->min_base_address; 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_extended_irq *ext_irq) + struct acpi_resource_ext_irq *ext_irq) { int rc; - if (ext_irq->interrupt_count > 0) { + if (ext_irq->number_of_interrupts > 0) { rc = acpi_register_gsi(ext_irq->interrupts[0], - ext_irq->triggering, ext_irq->polarity); + ext_irq->edge_level, ext_irq->active_high_low); 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->interrupt_count > 0) { + if (irq->number_of_interrupts > 0) { rc = acpi_register_gsi(irq->interrupts[0], - irq->triggering, irq->polarity); + irq->edge_level, irq->active_high_low); 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_RESOURCE_TYPE_IO) + else if (res->id == ACPI_RSTYPE_IO) return acpi_serial_port(port, &res->data.io); - else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) + else if (res->id == ACPI_RSTYPE_EXT_IRQ) return acpi_serial_ext_irq(port, &res->data.extended_irq); - else if (res->type == ACPI_RESOURCE_TYPE_IRQ) + else if (res->id == ACPI_RSTYPE_IRQ) return acpi_serial_irq(port, &res->data.irq); return AE_OK; } diff --git a/trunk/include/acpi/acconfig.h b/trunk/include/acpi/acconfig.h index 675a32f78329..427cff1a3f83 100644 --- a/trunk/include/acpi/acconfig.h +++ b/trunk/include/acpi/acconfig.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,9 +61,9 @@ * */ -/* Current ACPICA subsystem version in YYYYMMDD format */ +/* Version string */ -#define ACPI_CA_VERSION 0x20060113 +#define ACPI_CA_VERSION 0x20050902 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -98,6 +98,11 @@ #define ACPI_CA_SUPPORT_LEVEL 3 +/* String size constants */ + +#define ACPI_MAX_STRING_LENGTH 512 +#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ + /* Maximum count for a semaphore object */ #define ACPI_MAX_SEMAPHORE_COUNT 256 @@ -110,10 +115,6 @@ #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 -/* owner_id tracking. 8 entries allows for 255 owner_ids */ - -#define ACPI_NUM_OWNERID_MASKS 8 - /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) @@ -133,11 +134,14 @@ #define ACPI_METHOD_NUM_ARGS 7 #define ACPI_METHOD_MAX_ARG 6 -/* Length of _HID, _UID, _CID, and UUID values */ +/* Maximum length of resulting string when converting from a buffer */ + +#define ACPI_MAX_STRING_CONVERSION 200 + +/* Length of _HID, _UID, and _CID values */ #define ACPI_DEVICE_ID_LENGTH 0x09 #define ACPI_MAX_CID_LENGTH 48 -#define ACPI_UUID_LENGTH 16 /* * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG diff --git a/trunk/include/acpi/acdebug.h b/trunk/include/acpi/acdebug.h index d8167095caf3..70ce3b4d006e 100644 --- a/trunk/include/acpi/acdebug.h +++ b/trunk/include/acpi/acdebug.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acdisasm.h b/trunk/include/acpi/acdisasm.h index 11a8fe39cb04..3d96dcb1bb4b 100644 --- a/trunk/include/acpi/acdisasm.h +++ b/trunk/include/acpi/acdisasm.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,11 +57,26 @@ struct acpi_external_list { }; extern struct acpi_external_list *acpi_gbl_external_list; - -/* Strings used for decoding flags to ASL keywords */ - +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_min_decode[2]; +extern const char *acpi_gbl_max_decode[2]; +extern const char *acpi_gbl_DECdecode[2]; +extern const char *acpi_gbl_RNGdecode[4]; +extern const char *acpi_gbl_MEMdecode[4]; +extern const char *acpi_gbl_RWdecode[2]; extern const char *acpi_gbl_irq_decode[2]; +extern const char *acpi_gbl_HEdecode[2]; +extern const char *acpi_gbl_LLdecode[2]; +extern const char *acpi_gbl_SHRdecode[2]; +extern const char *acpi_gbl_TYPdecode[4]; +extern const char *acpi_gbl_BMdecode[2]; +extern const char *acpi_gbl_SIZdecode[4]; +extern const char *acpi_gbl_TTPdecode[2]; +extern const char *acpi_gbl_MTPdecode[4]; +extern const char *acpi_gbl_TRSdecode[2]; + extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; @@ -156,19 +171,11 @@ 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_template(struct acpi_op_walk_info *info, - u8 * byte_data, u32 byte_count); +acpi_dm_resource_descriptor(struct acpi_op_walk_info *info, + u8 * byte_data, u32 byte_count); -u8 acpi_dm_is_resource_template(union acpi_parse_object *op); +u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op); void acpi_dm_indent(u32 level); @@ -180,69 +187,73 @@ void acpi_dm_decode_attribute(u8 attribute); * dmresrcl */ void -acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level); +acpi_dm_word_descriptor(struct asl_word_address_desc *resource, + u32 length, u32 level); void -acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level); +acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource, + u32 length, u32 level); void -acpi_dm_extended_descriptor(union aml_resource *resource, +acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource, u32 length, u32 level); void -acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level); +acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource, + u32 length, u32 level); void -acpi_dm_memory24_descriptor(union aml_resource *resource, +acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource, u32 length, u32 level); void -acpi_dm_memory32_descriptor(union aml_resource *resource, +acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource, u32 length, u32 level); void -acpi_dm_fixed_memory32_descriptor(union aml_resource *resource, - u32 length, u32 level); +acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource, + u32 length, u32 level); void -acpi_dm_generic_register_descriptor(union aml_resource *resource, +acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource, u32 length, u32 level); void -acpi_dm_interrupt_descriptor(union aml_resource *resource, +acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource, u32 length, u32 level); void -acpi_dm_vendor_large_descriptor(union aml_resource *resource, +acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource, u32 length, u32 level); -void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level); - /* * dmresrcs */ void -acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level); +acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource, + u32 length, u32 level); void -acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level); +acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource, + u32 length, u32 level); -void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level); +void +acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level); void -acpi_dm_fixed_io_descriptor(union aml_resource *resource, +acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource, u32 length, u32 level); void -acpi_dm_start_dependent_descriptor(union aml_resource *resource, +acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource, u32 length, u32 level); void -acpi_dm_end_dependent_descriptor(union aml_resource *resource, +acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource, u32 length, u32 level); void -acpi_dm_vendor_small_descriptor(union aml_resource *resource, +acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource, u32 length, u32 level); /* diff --git a/trunk/include/acpi/acdispat.h b/trunk/include/acpi/acdispat.h index c41a926ff317..065f24a77cfc 100644 --- a/trunk/include/acpi/acdispat.h +++ b/trunk/include/acpi/acdispat.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -201,9 +201,6 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, union acpi_operand_object *obj_desc, struct acpi_namespace_node *calling_method_node); -acpi_status -acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state); - /* * dsinit */ diff --git a/trunk/include/acpi/acevents.h b/trunk/include/acpi/acevents.h index f2717be4fe0d..bfa54600ecd9 100644 --- a/trunk/include/acpi/acevents.h +++ b/trunk/include/acpi/acevents.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,8 +51,6 @@ acpi_status acpi_ev_initialize_events(void); acpi_status acpi_ev_install_xrupt_handlers(void); -acpi_status acpi_ev_install_fadt_gpes(void); - u32 acpi_ev_fixed_event_detect(void); /* @@ -107,10 +105,6 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, u32 interrupt_number, struct acpi_gpe_block_info **return_gpe_block); -acpi_status -acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, - struct acpi_gpe_block_info *gpe_block); - acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); u32 diff --git a/trunk/include/acpi/acexcep.h b/trunk/include/acpi/acexcep.h index dc768aa580e4..4f005eb65928 100644 --- a/trunk/include/acpi/acexcep.h +++ b/trunk/include/acpi/acexcep.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acglobal.h b/trunk/include/acpi/acglobal.h index 734cc77bf2c7..4ab2ca18b8df 100644 --- a/trunk/include/acpi/acglobal.h +++ b/trunk/include/acpi/acglobal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,15 +80,6 @@ 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) @@ -98,15 +89,11 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags; /* * Enable "slack" in the AML interpreter? Default is FALSE, and the * interpreter strictly follows the ACPI specification. Setting to TRUE - * allows the interpreter to ignore certain errors and/or bad AML constructs. - * - * Currently, these features are enabled by this flag: - * + * allows the interpreter to forgive certain bad AML constructs. Currently: * 1) Allow "implicit return" of last value in a control method - * 2) Allow access beyond the end of an operation region + * 2) Allow access beyond end of operation region * 3) Allow access to uninitialized locals/args (auto-init to integer 0) * 4) Allow ANY object type to be a source operand for the Store() operator - * 5) Allow unresolved references (invalid target name) in package objects */ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); @@ -224,11 +211,9 @@ ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; ACPI_EXTERN u32 acpi_gbl_ps_find_count; -ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; +ACPI_EXTERN u64 acpi_gbl_owner_id_mask; ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; ACPI_EXTERN u16 acpi_gbl_global_lock_handle; -ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; -ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; ACPI_EXTERN u8 acpi_gbl_debugger_configuration; ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; ACPI_EXTERN u8 acpi_gbl_step_to_next_call; diff --git a/trunk/include/acpi/achware.h b/trunk/include/acpi/achware.h index 29b60a8c0593..3644d7248e7e 100644 --- a/trunk/include/acpi/achware.h +++ b/trunk/include/acpi/achware.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acinterp.h b/trunk/include/acpi/acinterp.h index 9f22cfcb624b..2c9c1a1d1b7f 100644 --- a/trunk/include/acpi/acinterp.h +++ b/trunk/include/acpi/acinterp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,49 +44,7 @@ #ifndef __ACINTERP_H__ #define __ACINTERP_H__ -#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) - -/* Macros for tables used for debug output */ - -#define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f) -#define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f) -#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info)) - -/* - * If possible, pack the following structure to byte alignment, since we - * don't care about performance for debug output - */ -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#pragma pack(1) -#endif - -typedef const struct acpi_exdump_info { - u8 opcode; - u8 offset; - char *name; - -} acpi_exdump_info; - -/* Values for the Opcode field above */ - -#define ACPI_EXD_INIT 0 -#define ACPI_EXD_TYPE 1 -#define ACPI_EXD_UINT8 2 -#define ACPI_EXD_UINT16 3 -#define ACPI_EXD_UINT32 4 -#define ACPI_EXD_UINT64 5 -#define ACPI_EXD_LITERAL 6 -#define ACPI_EXD_POINTER 7 -#define ACPI_EXD_ADDRESS 8 -#define ACPI_EXD_STRING 9 -#define ACPI_EXD_BUFFER 10 -#define ACPI_EXD_PACKAGE 11 -#define ACPI_EXD_FIELD 12 -#define ACPI_EXD_REFERENCE 13 - -/* restore default alignment */ - -#pragma pack() +#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) /* * exconvrt - object conversion @@ -369,7 +327,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, void acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); -void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags); +void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags); #endif /* ACPI_FUTURE_USAGE */ /* diff --git a/trunk/include/acpi/aclocal.h b/trunk/include/acpi/aclocal.h index 97f8e4185e4f..9fba0fddda90 100644 --- a/trunk/include/acpi/aclocal.h +++ b/trunk/include/acpi/aclocal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -276,37 +276,6 @@ struct acpi_create_field_info { u8 field_type; }; -/* - * Bitmapped ACPI types. Used internally only - */ -#define ACPI_BTYPE_ANY 0x00000000 -#define ACPI_BTYPE_INTEGER 0x00000001 -#define ACPI_BTYPE_STRING 0x00000002 -#define ACPI_BTYPE_BUFFER 0x00000004 -#define ACPI_BTYPE_PACKAGE 0x00000008 -#define ACPI_BTYPE_FIELD_UNIT 0x00000010 -#define ACPI_BTYPE_DEVICE 0x00000020 -#define ACPI_BTYPE_EVENT 0x00000040 -#define ACPI_BTYPE_METHOD 0x00000080 -#define ACPI_BTYPE_MUTEX 0x00000100 -#define ACPI_BTYPE_REGION 0x00000200 -#define ACPI_BTYPE_POWER 0x00000400 -#define ACPI_BTYPE_PROCESSOR 0x00000800 -#define ACPI_BTYPE_THERMAL 0x00001000 -#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 -#define ACPI_BTYPE_DDB_HANDLE 0x00004000 -#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 -#define ACPI_BTYPE_REFERENCE 0x00010000 -#define ACPI_BTYPE_RESOURCE 0x00020000 - -#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) - -#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) -#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) -#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) -#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ -#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF - /***************************************************************************** * * Event typedefs and structs @@ -604,8 +573,6 @@ struct acpi_parse_obj_named { /* The parse node is the fundamental element of the parse tree */ -#define ACPI_MAX_PARSEOP_NAME 20 - struct acpi_parse_obj_asl { ACPI_PARSE_COMMON union acpi_parse_object *child; union acpi_parse_object *parent_method; @@ -630,7 +597,7 @@ struct acpi_parse_obj_asl { u8 aml_opcode_length; u8 aml_pkg_len_bytes; u8 extra; - char parse_op_name[ACPI_MAX_PARSEOP_NAME]; + char parse_op_name[12]; }; union acpi_parse_object { @@ -768,52 +735,44 @@ struct acpi_bit_register_info { /* resource_type values */ -#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 -#define ACPI_ADDRESS_TYPE_IO_RANGE 1 -#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 +#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 +#define ACPI_RESOURCE_TYPE_IO_RANGE 1 +#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 /* Resource descriptor types and masks */ -#define ACPI_RESOURCE_NAME_LARGE 0x80 -#define ACPI_RESOURCE_NAME_SMALL 0x00 +#define ACPI_RDESC_TYPE_LARGE 0x80 +#define ACPI_RDESC_TYPE_SMALL 0x00 -#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 */ +#define ACPI_RDESC_TYPE_MASK 0x80 +#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ /* - * Small resource descriptor "names" as defined by the ACPI specification. - * Note: Bits 2:0 are used for the descriptor length + * Small resource descriptor types + * Note: The 3 length bits (2:0) must be zero */ -#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 +#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_SMALL_VENDOR 0x70 +#define ACPI_RDESC_TYPE_END_TAG 0x78 /* - * Large resource descriptor "names" as defined by the ACPI specification. - * Note: includes the Large Descriptor bit in bit[7] + * Large resource descriptor types */ -#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 +#define ACPI_RDESC_TYPE_MEMORY_24 0x81 +#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82 +#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 /***************************************************************************** * @@ -821,7 +780,7 @@ struct acpi_bit_register_info { * ****************************************************************************/ -#define ACPI_ASCII_ZERO 0x30 +#define ACPI_ASCII_ZERO 0x30 /***************************************************************************** * diff --git a/trunk/include/acpi/acmacros.h b/trunk/include/acpi/acmacros.h index 49ba151766de..702cc4e57f5f 100644 --- a/trunk/include/acpi/acmacros.h +++ b/trunk/include/acpi/acmacros.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,7 +60,7 @@ /* * For 16-bit addresses, we have to assume that the upper 32 bits - * (out of 64) are zero. + * are zero. */ #define ACPI_LODWORD(l) ((u32)(l)) #define ACPI_HIDWORD(l) ((u32)(0)) @@ -104,38 +104,30 @@ #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) /* - * Extract data using a pointer. Any more than a byte and we - * get into potential aligment issues -- see the STORE macros below. - * Use with care. + * Extract a byte of data using a pointer. Any more than a byte and we + * get into potential aligment issues -- see the STORE macros below */ -#define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) -#define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) -#define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr) -#define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr) -#define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr) -#define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr) -#define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) -#define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) +#define ACPI_GET8(addr) (*(u8*)(addr)) -/* - * Pointer manipulation - */ -#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) -#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) -#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_native_uint)(b))) -#define ACPI_PTR_DIFF(a,b) (acpi_native_uint) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b))) +/* Pointer arithmetic */ + +#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (acpi_native_uint)(b)) +#define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b)) /* Pointer/Integer type conversions */ -#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) +#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(acpi_native_uint)i) #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) +#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) +#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) + #if ACPI_MACHINE_WIDTH == 16 #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) -#define ACPI_PTR_TO_PHYSADDR(i) (u32) ACPI_CAST_PTR (u8,(i)) +#define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i) #else #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) @@ -210,7 +202,7 @@ #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#ifdef ACPI_MISALIGNED_TRANSFERS /* The hardware supports unaligned transfers, just do the little-endian move */ @@ -334,10 +326,6 @@ #define ACPI_MUL_16(a) _ACPI_MUL(a,4) #define ACPI_MOD_16(a) _ACPI_MOD(a,16) -#define ACPI_DIV_32(a) _ACPI_DIV(a,5) -#define ACPI_MUL_32(a) _ACPI_MUL(a,5) -#define ACPI_MOD_32(a) _ACPI_MOD(a,32) - /* * Rounding macros (Power of two boundaries only) */ @@ -377,13 +365,6 @@ #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) -/* Generate a UUID */ - -#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ - (b) & 0xFF, ((b) >> 8) & 0xFF, \ - (c) & 0xFF, ((c) >> 8) & 0xFF, \ - (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) - /* * An struct acpi_namespace_node * can appear in some contexts, * where a pointer to an union acpi_operand_object can also @@ -443,66 +424,56 @@ #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) /* - * 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 + * Reporting macros that are never compiled out */ -#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 +#define ACPI_PARAM_LIST(pl) pl /* - * Ascii error messages can be configured out + * 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. */ -#ifndef ACPI_NO_ERROR_MESSAGES +#ifdef ACPI_DEBUG_OUTPUT -#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); + +#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. 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); - -/* 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 -/* No error messages */ +#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); -#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: @@ -554,9 +525,6 @@ * 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) @@ -564,55 +532,10 @@ #define ACPI_DO_WHILE0(a) a #endif -#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, (acpi_integer) _s); \ - return (_s); }) -#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ - register u32 _s = (u32) (s); \ - acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _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 */ +#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));}) /* Conditional execution */ @@ -659,6 +582,9 @@ * 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; @@ -686,8 +612,6 @@ #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/trunk/include/acpi/acnames.h b/trunk/include/acpi/acnames.h index b67da3636899..4f9063f3e951 100644 --- a/trunk/include/acpi/acnames.h +++ b/trunk/include/acpi/acnames.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acnamesp.h b/trunk/include/acpi/acnamesp.h index b667a804fc8a..dd3501f7e5d6 100644 --- a/trunk/include/acpi/acnamesp.h +++ b/trunk/include/acpi/acnamesp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -263,11 +263,13 @@ 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/trunk/include/acpi/acobject.h b/trunk/include/acpi/acobject.h index 1bd411962c77..4a326ba6d482 100644 --- a/trunk/include/acpi/acobject.h +++ b/trunk/include/acpi/acobject.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acopcode.h b/trunk/include/acpi/acopcode.h index e6d78bd9e90a..64da42992199 100644 --- a/trunk/include/acpi/acopcode.h +++ b/trunk/include/acpi/acopcode.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acoutput.h b/trunk/include/acpi/acoutput.h index 7785d481dc3e..68d7edf0f697 100644 --- a/trunk/include/acpi/acoutput.h +++ b/trunk/include/acpi/acoutput.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -137,19 +137,13 @@ /* 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/trunk/include/acpi/acparser.h b/trunk/include/acpi/acparser.h index 5a1ff484af33..d352d40de1f3 100644 --- a/trunk/include/acpi/acparser.h +++ b/trunk/include/acpi/acparser.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acpi.h b/trunk/include/acpi/acpi.h index b9a39d1009bd..ccf34f9dac64 100644 --- a/trunk/include/acpi/acpi.h +++ b/trunk/include/acpi/acpi.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acpi_drivers.h b/trunk/include/acpi/acpi_drivers.h index b425f9bb6d43..c1b4e1f882e4 100644 --- a/trunk/include/acpi/acpi_drivers.h +++ b/trunk/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 *triggering, - int *polarity, char **name); +int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level, + int *active_high_low, char **name); int acpi_pci_link_free_irq(acpi_handle handle); /* ACPI PCI Interrupt Routing (pci_irq.c) */ diff --git a/trunk/include/acpi/acpiosxf.h b/trunk/include/acpi/acpiosxf.h index 768f63f391cd..98e0b8cd14ed 100644 --- a/trunk/include/acpi/acpiosxf.h +++ b/trunk/include/acpi/acpiosxf.h @@ -8,7 +8,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -108,9 +108,9 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle); void acpi_os_delete_lock(acpi_handle handle); -acpi_native_uint acpi_os_acquire_lock(acpi_handle handle); +unsigned long acpi_os_acquire_lock(acpi_handle handle); -void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags); +void acpi_os_release_lock(acpi_handle handle, unsigned long flags); /* * Memory allocation and mapping diff --git a/trunk/include/acpi/acpixf.h b/trunk/include/acpi/acpixf.h index 66cf2ecef57a..2a9dbc13b0f2 100644 --- a/trunk/include/acpi/acpixf.h +++ b/trunk/include/acpi/acpixf.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -149,9 +149,6 @@ 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 */ @@ -271,12 +268,6 @@ typedef acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, void *context); -acpi_status -acpi_get_vendor_resource(acpi_handle device_handle, - char *name, - struct acpi_vendor_uuid *uuid, - struct acpi_buffer *ret_buffer); - acpi_status acpi_get_current_resources(acpi_handle device_handle, struct acpi_buffer *ret_buffer); @@ -289,7 +280,7 @@ acpi_get_possible_resources(acpi_handle device_handle, acpi_status acpi_walk_resources(acpi_handle device_handle, - char *name, + char *path, ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); acpi_status diff --git a/trunk/include/acpi/acresrc.h b/trunk/include/acpi/acresrc.h index fa02e8083381..38e798b05d08 100644 --- a/trunk/include/acpi/acresrc.h +++ b/trunk/include/acpi/acresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,125 +44,8 @@ #ifndef __ACRESRC_H__ #define __ACRESRC_H__ -/* Need the AML resource descriptor structs */ - -#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) - -typedef const struct acpi_rsdump_info { - u8 opcode; - u8 offset; - char *name; - const char **pointer; - -} acpi_rsdump_info; - -/* Values for the Opcode field above */ - -#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 - -/* restore default alignment */ - -#pragma pack() - -/* Resource tables indexed by internal resource 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 const u8 acpi_gbl_resource_struct_sizes[]; -extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; - -struct acpi_vendor_walk_info { - struct acpi_vendor_uuid *uuid; - struct acpi_buffer *buffer; - acpi_status status; -}; - -/* - * 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); - /* - * rsutils + * Function prototypes called from Acpi* APIs */ acpi_status acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); @@ -182,146 +65,195 @@ 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 *byte_stream_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_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 */ acpi_status -acpi_rs_get_list_length(u8 * aml_buffer, - u32 aml_buffer_length, acpi_size * size_needed); +acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, + u8 ** byte_stream_start, u32 * size); acpi_status -acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer, - acpi_size * size_needed); +acpi_rs_get_list_length(u8 * byte_stream_buffer, + u32 byte_stream_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_status acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, acpi_size * buffer_size_needed); acpi_status -acpi_rs_convert_aml_to_resources(u8 * aml_buffer, - u32 aml_buffer_length, u8 * output_buffer); +acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, + u32 byte_stream_buffer_length, u8 * output_buffer); acpi_status -acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, - acpi_size aml_size_needed, u8 * output_buffer); +acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, + acpi_size byte_stream_size_needed, + u8 * output_buffer); -/* - * rsaddr - */ -void -acpi_rs_set_address_common(union aml_resource *aml, - struct acpi_resource *resource); +acpi_status +acpi_rs_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); -u8 -acpi_rs_get_address_common(struct acpi_resource *resource, - union aml_resource *aml); +acpi_status +acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); -/* - * rsmisc - */ acpi_status -acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, - union aml_resource *aml, - struct acpi_rsconvert_info *info); +acpi_rs_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); acpi_status -acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, - union aml_resource *aml, - struct acpi_rsconvert_info *info); +acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -/* - * rsutils - */ -void -acpi_rs_move_data(void *destination, - void *source, u16 item_count, u8 move_type); +acpi_status +acpi_rs_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); + +acpi_status +acpi_rs_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -u8 acpi_rs_decode_bitmask(u16 mask, u8 * list); +acpi_status +acpi_rs_dma_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); -u16 acpi_rs_encode_bitmask(u8 * list, u8 count); +acpi_status +acpi_rs_dma_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -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_status +acpi_rs_address16_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); -acpi_rsdesc_size -acpi_rs_set_resource_source(union aml_resource *aml, - acpi_rs_length minimum_length, - struct acpi_resource_source *resource_source); +acpi_status +acpi_rs_address16_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -void -acpi_rs_set_resource_header(u8 descriptor_type, - acpi_rsdesc_size total_length, - union aml_resource *aml); +acpi_status +acpi_rs_address32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); -void -acpi_rs_set_resource_length(acpi_rsdesc_size total_length, - union aml_resource *aml); +acpi_status +acpi_rs_address32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -/* - * rsdump - */ -void acpi_rs_dump_resource_list(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); -void acpi_rs_dump_irq_list(u8 * route_table); +acpi_status +acpi_rs_address64_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); -/* - * 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[]; - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -/* - * rsinfo - */ -extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; +acpi_status +acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); -/* - * 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 +acpi_status +acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); + +acpi_status +acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, + acpi_size * bytes_consumed); + +acpi_status +acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); + +acpi_status +acpi_rs_memory24_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); + +acpi_status +acpi_rs_memory24_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); + +acpi_status +acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); + +acpi_status +acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, + acpi_size * structure_size); + +acpi_status +acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); + +acpi_status +acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); + +acpi_status +acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); + +acpi_status +acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); + +acpi_status +acpi_rs_end_tag_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); + +acpi_status +acpi_rs_end_tag_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); + +acpi_status +acpi_rs_vendor_resource(u8 * byte_stream_buffer, + acpi_size * bytes_consumed, + u8 ** output_buffer, acpi_size * structure_size); + +acpi_status +acpi_rs_vendor_stream(struct acpi_resource *linked_list, + u8 ** output_buffer, acpi_size * bytes_consumed); + +u8 acpi_rs_get_resource_type(u8 resource_start_byte); #endif /* __ACRESRC_H__ */ diff --git a/trunk/include/acpi/acstruct.h b/trunk/include/acpi/acstruct.h index d8c1c2cdac0c..99d235339801 100644 --- a/trunk/include/acpi/acstruct.h +++ b/trunk/include/acpi/acstruct.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/actables.h b/trunk/include/acpi/actables.h index 30a47542e1c8..f92c1858b808 100644 --- a/trunk/include/acpi/actables.h +++ b/trunk/include/acpi/actables.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/actbl.h b/trunk/include/acpi/actbl.h index ed53f842dad4..a46f406e1c94 100644 --- a/trunk/include/acpi/actbl.h +++ b/trunk/include/acpi/actbl.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,12 +44,6 @@ #ifndef __ACTBL_H__ #define __ACTBL_H__ -/* - * Note about bitfields: The u8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. - */ - /* * Values for description table header signatures */ diff --git a/trunk/include/acpi/actbl1.h b/trunk/include/acpi/actbl1.h index cd428d57add0..67312c3a915a 100644 --- a/trunk/include/acpi/actbl1.h +++ b/trunk/include/acpi/actbl1.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/actbl2.h b/trunk/include/acpi/actbl2.h index dfc7ac1094bb..50305ce2681a 100644 --- a/trunk/include/acpi/actbl2.h +++ b/trunk/include/acpi/actbl2.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/actypes.h b/trunk/include/acpi/actypes.h index 74819e9b4699..6213b27516e8 100644 --- a/trunk/include/acpi/actypes.h +++ b/trunk/include/acpi/actypes.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,15 +44,7 @@ #ifndef __ACTYPES_H__ #define __ACTYPES_H__ -/* - * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header - * and must be either 16, 32, or 64 - */ -#ifndef ACPI_MACHINE_WIDTH -#error ACPI_MACHINE_WIDTH not defined -#endif - -/*! [Begin] no source code translation */ +/*! [Begin] no source code translation (keep the typedefs) */ /* * Data type ranges @@ -66,150 +58,87 @@ #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ #define ACPI_ASCII_MAX 0x7F +#ifdef DEFINE_ALTERNATE_TYPES /* - * Architecture-specific ACPICA Subsystem Data Types - * - * The goal of these types is to provide source code portability across - * 16-bit, 32-bit, and 64-bit targets. - * - * 1) The following types are of fixed size for all targets (16/32/64): - * - * BOOLEAN Logical boolean - * - * UINT8 8-bit (1 byte) unsigned value - * UINT16 16-bit (2 byte) unsigned value - * UINT32 32-bit (4 byte) unsigned value - * UINT64 64-bit (8 byte) unsigned value - * - * INT16 16-bit (2 byte) signed value - * INT32 32-bit (4 byte) signed value - * INT64 64-bit (8 byte) signed value - * - * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the - * compiler-dependent header(s) and were introduced because there is no common - * 64-bit integer type across the various compilation models, as shown in - * the table below. - * - * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit - * char 8 8 8 8 8 8 - * short 16 16 16 16 16 16 - * _int32 32 - * int 32 64 32 32 16 16 - * long 64 64 32 32 32 32 - * long long 64 64 - * pointer 64 64 64 32 32 32 - * - * Note: ILP64 and LP32 are currently not supported. - * - * - * 2) These types represent the native word size of the target mode of the - * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are - * usually used for memory allocation, efficient loop counters, and array - * indexes. The types are similar to the size_t type in the C library and are - * required because there is no C type that consistently represents the native - * data width. - * - * ACPI_SIZE 16/32/64-bit unsigned value - * ACPI_NATIVE_UINT 16/32/64-bit unsigned value - * ACPI_NATIVE_INT 16/32/64-bit signed value - * + * Types used only in translated source, defined here to enable + * cross-platform compilation only. */ +typedef int s32; +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +typedef COMPILER_DEPENDENT_UINT64 u64; -/******************************************************************************* - * - * Common types for all compilers, all targets - * - ******************************************************************************/ - -typedef unsigned char BOOLEAN; -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef COMPILER_DEPENDENT_UINT64 UINT64; -typedef COMPILER_DEPENDENT_INT64 INT64; - -/*! [End] no source code translation !*/ +#endif -/******************************************************************************* - * - * Types specific to 64-bit targets +/* + * Data types - Fixed across all compilation models (16/32/64) * - ******************************************************************************/ + * BOOLEAN Logical Boolean. + * INT8 8-bit (1 byte) signed value + * UINT8 8-bit (1 byte) unsigned value + * INT16 16-bit (2 byte) signed value + * UINT16 16-bit (2 byte) unsigned value + * INT32 32-bit (4 byte) signed value + * 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 + */ + +#ifndef ACPI_MACHINE_WIDTH +#error ACPI_MACHINE_WIDTH not defined +#endif #if ACPI_MACHINE_WIDTH == 64 -/*! [Begin] no source code translation (keep the typedefs as-is) */ +/*! [Begin] no source code translation (keep the typedefs) */ -typedef unsigned int UINT32; +/* + * 64-bit type definitions + */ +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; /*! [End] no source code translation !*/ -typedef u64 acpi_native_uint; 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; +typedef u64 acpi_size; +#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ +#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX -#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 -#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ - -/* - * 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 support misaligned transfers, - * so there is no need to define this flag. - */ -#if defined (__IA64__) || defined (__ia64__) -#define ACPI_MISALIGNMENT_NOT_SUPPORTED -#endif - -/******************************************************************************* - * - * Types specific to 32-bit targets - * - ******************************************************************************/ - -#elif ACPI_MACHINE_WIDTH == 32 - -/*! [Begin] no source code translation (keep the typedefs as-is) */ - -typedef unsigned int UINT32; -typedef int INT32; - -/*! [End] no source code translation !*/ - -typedef u32 acpi_native_uint; -typedef s32 acpi_native_int; - -typedef u64 acpi_table_ptr; -typedef u32 acpi_io_address; -typedef u64 acpi_physical_address; - -#define ACPI_MAX_PTR ACPI_UINT32_MAX -#define ACPI_SIZE_MAX ACPI_UINT32_MAX - -#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 - -/******************************************************************************* - * - * Types specific to 16-bit targets - * - ******************************************************************************/ - #elif ACPI_MACHINE_WIDTH == 16 -/*! [Begin] no source code translation (keep the typedefs as-is) */ +/*! [Begin] no source code translation (keep the typedefs) */ -typedef unsigned long UINT32; -typedef short INT16; +/* + * 16-bit type definitions + */ +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned int UINT16; typedef long INT32; +typedef int INT16; +typedef unsigned long UINT32; + +struct { + UINT32 Lo; + UINT32 Hi; +}; /*! [End] no source code translation !*/ @@ -219,57 +148,61 @@ 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 -#define ALIGNED_ADDRESS_BOUNDARY 0x00000002 -#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ +/* + * (16-bit only) internal integers must be 32-bits, so + * 64-bit integers cannot be supported + */ +#define ACPI_NO_INTEGER64_SUPPORT -/* 64-bit integers cannot be supported */ +#elif ACPI_MACHINE_WIDTH == 32 -#define ACPI_NO_INTEGER64_SUPPORT +/*! [Begin] no source code translation (keep the typedefs) */ -#else +/* + * 32-bit type definitions (default) + */ +typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; +typedef unsigned short UINT16; +typedef int INT32; +typedef unsigned int UINT32; +typedef COMPILER_DEPENDENT_INT64 INT64; +typedef COMPILER_DEPENDENT_UINT64 UINT64; -/* ACPI_MACHINE_WIDTH must be either 64, 32, or 16 */ +/*! [End] no source code translation !*/ -#error unknown ACPI_MACHINE_WIDTH -#endif +typedef s32 acpi_native_int; +typedef u32 acpi_native_uint; -/******************************************************************************* - * - * OS- or compiler-dependent types - * - ******************************************************************************/ +typedef u64 acpi_table_ptr; +typedef u32 acpi_io_address; +typedef u64 acpi_physical_address; +typedef u32 acpi_size; -/* - * If acpi_uintptr_t was not defined in the OS- or compiler-dependent header, - * define it now (use C99 uintptr_t for pointer casting if available, - * "void *" otherwise) - */ -#ifndef acpi_uintptr_t -#define acpi_uintptr_t void * +#define ALIGNED_ADDRESS_BOUNDARY 0x00000004 +#define ACPI_MISALIGNED_TRANSFERS +#define ACPI_MAX_PTR ACPI_UINT32_MAX +#define ACPI_SIZE_MAX ACPI_UINT32_MAX + +#else +#error unknown ACPI_MACHINE_WIDTH #endif /* - * If acpi_cache_t was not defined in the OS-dependent header, - * define it now. This is typically the case where the local cache - * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) + * This type is used for bitfields in ACPI tables. The only type that is + * even remotely portable is u8. Anything else is not portable, so + * do not add any more bitfield types. */ -#ifndef acpi_cache_t -#define acpi_cache_t struct acpi_memory_list -#endif - -/* Variable-width type, used instead of clib size_t */ - -typedef acpi_native_uint acpi_size; - -/******************************************************************************* - * - * Independent types - * - ******************************************************************************/ +typedef u8 UINT8_BIT; +typedef acpi_native_uint ACPI_PTRDIFF; /* * Pointer overlays to avoid lots of typecasting for @@ -301,8 +234,18 @@ struct acpi_pointer { #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER -/* Logical defines and NULL */ +/* + * If acpi_cache_t was not defined in the OS-dependent header, + * define it now. This is typically the case where the local cache + * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) + */ +#ifndef acpi_cache_t +#define acpi_cache_t struct acpi_memory_list +#endif +/* + * Useful defines + */ #ifdef FALSE #undef FALSE #endif @@ -318,12 +261,12 @@ struct acpi_pointer { #endif /* - * Mescellaneous types + * Local datatypes */ typedef u32 acpi_status; /* All ACPI Exceptions */ typedef u32 acpi_name; /* 4-byte ACPI name */ typedef char *acpi_string; /* Null terminated ASCII string */ -typedef void *acpi_handle; /* Actually a ptr to a NS Node */ +typedef void *acpi_handle; /* Actually a ptr to an Node */ struct uint64_struct { u32 lo; @@ -380,7 +323,7 @@ typedef u64 acpi_integer; /* * Constants with special meanings */ -#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR) +#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) /* * Initialization sequence @@ -526,6 +469,37 @@ typedef u32 acpi_object_type; #define ACPI_TYPE_INVALID 0x1E #define ACPI_TYPE_NOT_FOUND 0xFF +/* + * Bitmapped ACPI types. Used internally only + */ +#define ACPI_BTYPE_ANY 0x00000000 +#define ACPI_BTYPE_INTEGER 0x00000001 +#define ACPI_BTYPE_STRING 0x00000002 +#define ACPI_BTYPE_BUFFER 0x00000004 +#define ACPI_BTYPE_PACKAGE 0x00000008 +#define ACPI_BTYPE_FIELD_UNIT 0x00000010 +#define ACPI_BTYPE_DEVICE 0x00000020 +#define ACPI_BTYPE_EVENT 0x00000040 +#define ACPI_BTYPE_METHOD 0x00000080 +#define ACPI_BTYPE_MUTEX 0x00000100 +#define ACPI_BTYPE_REGION 0x00000200 +#define ACPI_BTYPE_POWER 0x00000400 +#define ACPI_BTYPE_PROCESSOR 0x00000800 +#define ACPI_BTYPE_THERMAL 0x00001000 +#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 +#define ACPI_BTYPE_DDB_HANDLE 0x00004000 +#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 +#define ACPI_BTYPE_REFERENCE 0x00010000 +#define ACPI_BTYPE_RESOURCE 0x00020000 + +#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) + +#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) +#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) +#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) +#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ +#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF + /* * All I/O */ @@ -879,14 +853,6 @@ struct acpi_compatible_id_list { #define ACPI_VALID_CID 0x0010 #define ACPI_VALID_SXDS 0x0020 -/* Flags for _STA method */ - -#define ACPI_STA_DEVICE_PRESENT 0x01 -#define ACPI_STA_DEVICE_ENABLED 0x02 -#define ACPI_STA_DEVICE_UI 0x04 -#define ACPI_STA_DEVICE_OK 0x08 -#define ACPI_STA_BATTERY_PRESENT 0x10 - #define ACPI_COMMON_OBJ_INFO \ acpi_object_type type; /* ACPI object type */ \ acpi_name name /* ACPI object Name */ @@ -929,8 +895,6 @@ 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 @@ -952,9 +916,7 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 #define ACPI_ISA_ONLY_RANGES (u8) 0x02 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) -/* Type of translation - 1=Sparse, 0=Dense */ - -#define ACPI_SPARSE_TRANSLATION (u8) 0x01 +#define ACPI_SPARSE_TRANSLATION (u8) 0x03 /* * IO Port Descriptor Decode @@ -965,8 +927,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 /* * IRQ Attributes */ -#define ACPI_LEVEL_SENSITIVE (u8) 0x00 -#define ACPI_EDGE_SENSITIVE (u8) 0x01 +#define ACPI_EDGE_SENSITIVE (u8) 0x00 +#define ACPI_LEVEL_SENSITIVE (u8) 0x01 #define ACPI_ACTIVE_HIGH (u8) 0x00 #define ACPI_ACTIVE_LOW (u8) 0x01 @@ -1012,46 +974,28 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 #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 - -/* UUID data structures for use in vendor-defined resource descriptors */ - -struct acpi_uuid { - u8 data[ACPI_UUID_LENGTH]; -}; - -struct acpi_vendor_uuid { - u8 subtype; - u8 data[ACPI_UUID_LENGTH]; -}; - /* * Structures used to describe device resources */ struct acpi_resource_irq { - u8 triggering; - u8 polarity; - u8 sharable; - u8 interrupt_count; - u8 interrupts[1]; + u32 edge_level; + u32 active_high_low; + u32 shared_exclusive; + u32 number_of_interrupts; + u32 interrupts[1]; }; struct acpi_resource_dma { - u8 type; - u8 bus_master; - u8 transfer; - u8 channel_count; - u8 channels[1]; + u32 type; + u32 bus_master; + u32 transfer; + u32 number_of_channels; + u32 channels[1]; }; -struct acpi_resource_start_dependent { - u8 compatibility_priority; - u8 performance_robustness; +struct acpi_resource_start_dpf { + u32 compatibility_priority; + u32 performance_robustness; }; /* @@ -1060,217 +1004,179 @@ struct acpi_resource_start_dependent { */ struct acpi_resource_io { - u8 io_decode; - u8 alignment; - u8 address_length; - u16 minimum; - u16 maximum; + u32 io_decode; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; struct acpi_resource_fixed_io { - u16 address; - u8 address_length; + u32 base_address; + u32 range_length; }; struct acpi_resource_vendor { - u16 byte_length; - u8 byte_data[1]; -}; - -/* Vendor resource with UUID info (introduced in ACPI 3.0) */ - -struct acpi_resource_vendor_typed { - u16 byte_length; - u8 uuid_subtype; - u8 uuid[ACPI_UUID_LENGTH]; - u8 byte_data[1]; + u32 length; + u8 reserved[1]; }; struct acpi_resource_end_tag { u8 checksum; }; -struct acpi_resource_memory24 { - u8 write_protect; - u16 minimum; - u16 maximum; - u16 alignment; - u16 address_length; +struct acpi_resource_mem24 { + u32 read_write_attribute; + u32 min_base_address; + u32 max_base_address; + u32 alignment; + u32 range_length; }; -struct acpi_resource_memory32 { - u8 write_protect; - u32 minimum; - u32 maximum; +struct acpi_resource_mem32 { + u32 read_write_attribute; + u32 min_base_address; + u32 max_base_address; u32 alignment; - u32 address_length; + u32 range_length; }; -struct acpi_resource_fixed_memory32 { - u8 write_protect; - u32 address; - u32 address_length; +struct acpi_resource_fixed_mem32 { + u32 read_write_attribute; + u32 range_base_address; + u32 range_length; }; struct acpi_memory_attribute { - u8 write_protect; - u8 caching; - u8 range_type; - u8 translation; + u16 cache_attribute; + u16 read_write_attribute; }; struct acpi_io_attribute { - u8 range_type; - u8 translation; - u8 translation_type; - u8 reserved1; + u16 range_attribute; + u16 translation_attribute; +}; + +struct acpi_bus_attribute { + u16 reserved1; + u16 reserved2; }; union acpi_resource_attribute { - struct acpi_memory_attribute mem; + struct acpi_memory_attribute memory; struct acpi_io_attribute io; - - /* Used for the *word_space macros */ - - u8 type_specific; + struct acpi_bus_attribute bus; }; struct acpi_resource_source { - u8 index; - u16 string_length; + u32 index; + u32 string_length; char *string_ptr; }; /* Fields common to all address descriptors, 16/32/64 bit */ #define ACPI_RESOURCE_ADDRESS_COMMON \ - u8 resource_type; \ - u8 producer_consumer; \ - u8 decode; \ - u8 min_address_fixed; \ - u8 max_address_fixed; \ - union acpi_resource_attribute info; + u32 resource_type; \ + u32 producer_consumer; \ + u32 decode; \ + u32 min_address_fixed; \ + u32 max_address_fixed; \ + union acpi_resource_attribute attribute; struct acpi_resource_address { ACPI_RESOURCE_ADDRESS_COMMON}; struct acpi_resource_address16 { - ACPI_RESOURCE_ADDRESS_COMMON u16 granularity; - u16 minimum; - u16 maximum; - u16 translation_offset; - u16 address_length; + ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; + u32 min_address_range; + u32 max_address_range; + u32 address_translation_offset; + u32 address_length; struct acpi_resource_source resource_source; }; struct acpi_resource_address32 { ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 minimum; - u32 maximum; - u32 translation_offset; + u32 min_address_range; + u32 max_address_range; + u32 address_translation_offset; u32 address_length; struct acpi_resource_source resource_source; }; struct acpi_resource_address64 { ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; - u64 minimum; - u64 maximum; - u64 translation_offset; + u64 min_address_range; + u64 max_address_range; + u64 address_translation_offset; u64 address_length; + u64 type_specific_attributes; struct acpi_resource_source resource_source; }; -struct acpi_resource_extended_address64 { - ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; - u64 granularity; - u64 minimum; - u64 maximum; - u64 translation_offset; - u64 address_length; - u64 type_specific; -}; - -struct acpi_resource_extended_irq { - u8 producer_consumer; - u8 triggering; - u8 polarity; - u8 sharable; - u8 interrupt_count; +struct acpi_resource_ext_irq { + u32 producer_consumer; + u32 edge_level; + u32 active_high_low; + u32 shared_exclusive; + u32 number_of_interrupts; struct acpi_resource_source resource_source; u32 interrupts[1]; }; -struct acpi_resource_generic_register { - u8 space_id; - u8 bit_width; - u8 bit_offset; - u8 access_size; - u64 address; -}; - /* ACPI_RESOURCE_TYPEs */ -#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 +#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 + +typedef u32 acpi_resource_type; union acpi_resource_data { struct acpi_resource_irq irq; struct acpi_resource_dma dma; - struct acpi_resource_start_dependent start_dpf; + struct acpi_resource_start_dpf start_dpf; struct acpi_resource_io io; struct acpi_resource_fixed_io fixed_io; - struct acpi_resource_vendor vendor; - struct acpi_resource_vendor_typed vendor_typed; + struct acpi_resource_vendor vendor_specific; struct acpi_resource_end_tag end_tag; - struct acpi_resource_memory24 memory24; - struct acpi_resource_memory32 memory32; - struct acpi_resource_fixed_memory32 fixed_memory32; + 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_address16 address16; struct acpi_resource_address32 address32; struct acpi_resource_address64 address64; - 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_ext_irq extended_irq; }; struct acpi_resource { - u32 type; + acpi_resource_type id; u32 length; union acpi_resource_data data; }; -/* restore default alignment */ - -#pragma pack() +#define ACPI_RESOURCE_LENGTH 12 +#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ -#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_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#ifdef ACPI_MISALIGNED_TRANSFERS #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) #else #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) diff --git a/trunk/include/acpi/acutils.h b/trunk/include/acpi/acutils.h index 10f6625f6390..c1086452696e 100644 --- a/trunk/include/acpi/acutils.h +++ b/trunk/include/acpi/acutils.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,39 +44,6 @@ #ifndef _ACUTILS_H #define _ACUTILS_H -extern const u8 acpi_gbl_resource_aml_sizes[]; - -/* Strings used by the disassembler and debugger resource dump routines */ - -#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) - -extern const char *acpi_gbl_BMdecode[2]; -extern const char *acpi_gbl_config_decode[4]; -extern const char *acpi_gbl_consume_decode[2]; -extern const char *acpi_gbl_DECdecode[2]; -extern const char *acpi_gbl_HEdecode[2]; -extern const char *acpi_gbl_io_decode[2]; -extern const char *acpi_gbl_LLdecode[2]; -extern const char *acpi_gbl_max_decode[2]; -extern const char *acpi_gbl_MEMdecode[4]; -extern const char *acpi_gbl_min_decode[2]; -extern const char *acpi_gbl_MTPdecode[4]; -extern const char *acpi_gbl_RNGdecode[4]; -extern const char *acpi_gbl_RWdecode[2]; -extern const char *acpi_gbl_SHRdecode[2]; -extern const char *acpi_gbl_SIZdecode[4]; -extern const char *acpi_gbl_TRSdecode[2]; -extern const char *acpi_gbl_TTPdecode[2]; -extern const char *acpi_gbl_TYPdecode[4]; -#endif - -/* Types for Resource descriptor entries */ - -#define ACPI_INVALID_RESOURCE 0 -#define ACPI_FIXED_LENGTH 1 -#define ACPI_VARIABLE_LENGTH 2 -#define ACPI_SMALL_VARIABLE_LENGTH 3 - typedef acpi_status(*acpi_pkg_callback) (u8 object_type, union acpi_operand_object * source_object, @@ -192,6 +159,7 @@ 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 */ @@ -275,11 +243,12 @@ acpi_ut_ptr_exit(u32 line_number, const char *function_name, char *module_name, u32 component_id, u8 * ptr); -void acpi_ut_report_error(char *module_name, u32 line_number); +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); +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); +void +acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id); void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); @@ -450,19 +419,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); #define ACPI_ANY_BASE 0 -acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); - -u32 acpi_ut_get_descriptor_length(void *aml); - -u16 acpi_ut_get_resource_length(void *aml); - -u8 acpi_ut_get_resource_header_length(void *aml); - -u8 acpi_ut_get_resource_type(void *aml); - -acpi_status -acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, - u8 ** end_tag); +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/trunk/include/acpi/amlcode.h b/trunk/include/acpi/amlcode.h index 37964a59aef8..7fdf5299f501 100644 --- a/trunk/include/acpi/amlcode.h +++ b/trunk/include/acpi/amlcode.h @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/amlresrc.h b/trunk/include/acpi/amlresrc.h index fb4735315ad3..051786e4b210 100644 --- a/trunk/include/acpi/amlresrc.h +++ b/trunk/include/acpi/amlresrc.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,168 +92,182 @@ struct asl_resource_node { struct asl_resource_node *next; }; -/* Macros used to generate AML resource length fields */ - -#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) -#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) - /* * Resource descriptors defined in the ACPI specification. * * Packing/alignment must be BYTE because these descriptors - * are used to overlay the raw AML byte stream. + * are used to overlay the AML byte stream. */ #pragma pack(1) -/* - * 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; +struct asl_irq_format_desc { + u8 descriptor_type; + u16 irq_mask; u8 flags; }; -struct aml_resource_irq_noflags { - AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; +struct asl_irq_noflags_desc { + u8 descriptor_type; + u16 irq_mask; }; -struct aml_resource_dma { - AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask; +struct asl_dma_format_desc { + u8 descriptor_type; + u8 dma_channel_mask; u8 flags; }; -struct aml_resource_start_dependent { - AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; +struct asl_start_dependent_desc { + u8 descriptor_type; + u8 flags; }; -struct aml_resource_start_dependent_noprio { -AML_RESOURCE_SMALL_HEADER_COMMON}; +struct asl_start_dependent_noprio_desc { + u8 descriptor_type; +}; -struct aml_resource_end_dependent { -AML_RESOURCE_SMALL_HEADER_COMMON}; +struct asl_end_dependent_desc { + u8 descriptor_type; +}; -struct aml_resource_io { - AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; - u16 minimum; - u16 maximum; +struct asl_io_port_desc { + u8 descriptor_type; + u8 information; + u16 address_min; + u16 address_max; u8 alignment; - u8 address_length; + u8 length; }; -struct aml_resource_fixed_io { - AML_RESOURCE_SMALL_HEADER_COMMON u16 address; - u8 address_length; +struct asl_fixed_io_port_desc { + u8 descriptor_type; + u16 base_address; + u8 length; }; -struct aml_resource_vendor_small { -AML_RESOURCE_SMALL_HEADER_COMMON}; - -struct aml_resource_end_tag { - AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; +struct asl_small_vendor_desc { + u8 descriptor_type; + u8 vendor_defined[7]; }; -/* - * LARGE descriptors - */ -#define AML_RESOURCE_LARGE_HEADER_COMMON \ - u8 descriptor_type;\ - u16 resource_length; +struct asl_end_tag_desc { + u8 descriptor_type; + u8 checksum; +}; -struct aml_resource_large_header { -AML_RESOURCE_LARGE_HEADER_COMMON}; +/* LARGE descriptors */ -struct aml_resource_memory24 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; - u16 minimum; - u16 maximum; +struct asl_memory_24_desc { + u8 descriptor_type; + u16 length; + u8 information; + u16 address_min; + u16 address_max; u16 alignment; - u16 address_length; + u16 range_length; }; -struct aml_resource_vendor_large { -AML_RESOURCE_LARGE_HEADER_COMMON}; +struct asl_large_vendor_desc { + u8 descriptor_type; + u16 length; + u8 vendor_defined[1]; +}; -struct aml_resource_memory32 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; - u32 minimum; - u32 maximum; +struct asl_memory_32_desc { + u8 descriptor_type; + u16 length; + u8 information; + u32 address_min; + u32 address_max; u32 alignment; - u32 address_length; + u32 range_length; }; -struct aml_resource_fixed_memory32 { - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; - u32 address; - u32 address_length; +struct asl_fixed_memory_32_desc { + u8 descriptor_type; + u16 length; + u8 information; + u32 base_address; + u32 range_length; }; -#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; +struct asl_extended_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u8 revision_iD; u8 reserved; u64 granularity; - u64 minimum; - u64 maximum; + u64 address_min; + u64 address_max; u64 translation_offset; u64 address_length; - u64 type_specific; + u64 type_specific_attributes; + u8 optional_fields[2]; /* Used for length calculation only */ }; -#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ +#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ -struct aml_resource_address64 { - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON u64 granularity; - u64 minimum; - u64 maximum; +struct asl_qword_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u64 granularity; + u64 address_min; + u64 address_max; u64 translation_offset; u64 address_length; + u8 optional_fields[2]; }; -struct aml_resource_address32 { - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON u32 granularity; - u32 minimum; - u32 maximum; +struct asl_dword_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u32 granularity; + u32 address_min; + u32 address_max; u32 translation_offset; u32 address_length; + u8 optional_fields[2]; }; -struct aml_resource_address16 { - AML_RESOURCE_LARGE_HEADER_COMMON - AML_RESOURCE_ADDRESS_COMMON u16 granularity; - u16 minimum; - u16 maximum; +struct asl_word_address_desc { + u8 descriptor_type; + u16 length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u16 granularity; + u16 address_min; + u16 address_max; u16 translation_offset; u16 address_length; + u8 optional_fields[2]; }; -struct aml_resource_extended_irq { - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; - u8 interrupt_count; - u32 interrupts[1]; +struct asl_extended_xrupt_desc { + u8 descriptor_type; + u16 length; + u8 flags; + u8 table_length; + u32 interrupt_number[1]; /* res_source_index, res_source optional fields follow */ }; -struct aml_resource_generic_register { - AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id; +struct asl_general_register_desc { + u8 descriptor_type; + u16 length; + u8 address_space_id; u8 bit_width; u8 bit_offset; - u8 access_size; /* ACPI 3.0, was previously Reserved */ + u8 access_size; /* ACPI 3.0, was Reserved */ u64 address; }; @@ -263,39 +277,26 @@ struct aml_resource_generic_register { /* Union of all resource descriptors, so we can allocate the worst case */ -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; +union asl_resource_desc { + struct asl_irq_format_desc irq; + struct asl_dma_format_desc dma; + struct asl_start_dependent_desc std; + struct asl_end_dependent_desc end; + struct asl_io_port_desc iop; + struct asl_fixed_io_port_desc fio; + struct asl_small_vendor_desc smv; + struct asl_end_tag_desc et; + + 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_general_register_desc grg; u32 u32_item; u16 u16_item; u8 U8item; diff --git a/trunk/include/acpi/platform/acenv.h b/trunk/include/acpi/platform/acenv.h index 31b0f18342f6..16609c1ab2eb 100644 --- a/trunk/include/acpi/platform/acenv.h +++ b/trunk/include/acpi/platform/acenv.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,7 +68,6 @@ #define ACPI_APPLICATION #define ACPI_DEBUGGER #define ACPI_DISASSEMBLER -#define ACPI_MUTEX_DEBUG #endif #ifdef ACPI_ASL_COMPILER @@ -206,8 +205,6 @@ * *****************************************************************************/ -#define ACPI_IS_ASCII(c) ((c) < 0x80) - #ifdef ACPI_USE_SYSTEM_CLIBRARY /* * Use the standard C library headers. @@ -237,7 +234,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((const char *)(s1), (const char *)(s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (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)) @@ -249,6 +246,7 @@ #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 @@ -275,8 +273,8 @@ typedef char *va_list; /* * Storage alignment properties */ -#define _AUPBND (sizeof (acpi_native_uint) - 1) -#define _ADNBND (sizeof (acpi_native_uint) - 1) +#define _AUPBND (sizeof (acpi_native_int) - 1) +#define _ADNBND (sizeof (acpi_native_int) - 1) /* * Variable argument list macro definitions @@ -298,7 +296,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((const char *)(s1), (const char *)(s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (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 diff --git a/trunk/include/acpi/platform/acgcc.h b/trunk/include/acpi/platform/acgcc.h index ea2a6322f64d..4c0e0ba09ba0 100644 --- a/trunk/include/acpi/platform/acgcc.h +++ b/trunk/include/acpi/platform/acgcc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/platform/aclinux.h b/trunk/include/acpi/platform/aclinux.h index c21c27fe7e1e..c93e6562f0e1 100644 --- a/trunk/include/acpi/platform/aclinux.h +++ b/trunk/include/acpi/platform/aclinux.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2005, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,10 +71,6 @@ #define acpi_cache_t kmem_cache_t #endif -/* Full namespace pathname length limit - arbitrary */ - -#define ACPI_PATHNAME_MAX 256 - #else /* !__KERNEL__ */ #include diff --git a/trunk/include/asm-x86_64/mpspec.h b/trunk/include/asm-x86_64/mpspec.h index 14fc3ddd9031..10248a9a0582 100644 --- a/trunk/include/asm-x86_64/mpspec.h +++ b/trunk/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 triggering, int polarity); +extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low); #endif /*CONFIG_X86_IO_APIC*/ #endif diff --git a/trunk/include/linux/acpi.h b/trunk/include/linux/acpi.h index 84d3d9f034ce..026c3c011dc0 100644 --- a/trunk/include/linux/acpi.h +++ b/trunk/include/linux/acpi.h @@ -435,7 +435,7 @@ extern int sbf_port ; #endif /* !CONFIG_ACPI */ -int acpi_register_gsi (u32 gsi, int triggering, int polarity); +int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); /*