Pull pnpacpi into acpica branch
authorLen Brown <len.brown@intel.com>
Sat, 7 Jan 2006 08:50:18 +0000 (03:50 -0500)
committerLen Brown <len.brown@intel.com>
Sat, 7 Jan 2006 08:50:18 +0000 (03:50 -0500)
103 files changed:
arch/i386/kernel/acpi/boot.c
arch/i386/kernel/mpparse.c
arch/ia64/kernel/acpi-ext.c
arch/ia64/kernel/acpi.c
arch/ia64/pci/pci.c
arch/x86_64/kernel/io_apic.c
arch/x86_64/kernel/mpparse.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/dispatcher/dsinit.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsutils.c
drivers/acpi/dispatcher/dswexec.c
drivers/acpi/dispatcher/dswload.c
drivers/acpi/ec.c
drivers/acpi/events/evevent.c
drivers/acpi/events/evgpe.c
drivers/acpi/events/evgpeblk.c
drivers/acpi/events/evsci.c
drivers/acpi/events/evxface.c
drivers/acpi/events/evxfevnt.c
drivers/acpi/executer/exconvrt.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exnames.c
drivers/acpi/executer/exoparg2.c
drivers/acpi/executer/exoparg3.c
drivers/acpi/executer/exprep.c
drivers/acpi/executer/exregion.c
drivers/acpi/executer/exresop.c
drivers/acpi/executer/exstorob.c
drivers/acpi/executer/exutils.c
drivers/acpi/glue.c
drivers/acpi/hardware/hwacpi.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/motherboard.c
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsdump.c
drivers/acpi/namespace/nsinit.c
drivers/acpi/namespace/nsnames.c
drivers/acpi/namespace/nssearch.c
drivers/acpi/namespace/nsutils.c
drivers/acpi/namespace/nsxfeval.c
drivers/acpi/osl.c
drivers/acpi/parser/psargs.c
drivers/acpi/parser/psloop.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/psxface.c
drivers/acpi/pci_irq.c
drivers/acpi/pci_link.c
drivers/acpi/pci_root.c
drivers/acpi/resources/Makefile
drivers/acpi/resources/rsaddr.c
drivers/acpi/resources/rscalc.c
drivers/acpi/resources/rscreate.c
drivers/acpi/resources/rsdump.c
drivers/acpi/resources/rsinfo.c [new file with mode: 0644]
drivers/acpi/resources/rsio.c
drivers/acpi/resources/rsirq.c
drivers/acpi/resources/rslist.c
drivers/acpi/resources/rsmemory.c
drivers/acpi/resources/rsmisc.c
drivers/acpi/resources/rsutils.c
drivers/acpi/resources/rsxface.c
drivers/acpi/scan.c
drivers/acpi/tables/tbconvrt.c
drivers/acpi/tables/tbgetall.c
drivers/acpi/tables/tbrsdt.c
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxfroot.c
drivers/acpi/utilities/Makefile
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/uteval.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utmutex.c
drivers/acpi/utilities/utresrc.c [new file with mode: 0644]
drivers/acpi/utilities/utstate.c
drivers/acpi/utilities/utxface.c
drivers/char/hpet.c
drivers/pnp/pnpacpi/rsparser.c
drivers/serial/8250_acpi.c
include/acpi/acconfig.h
include/acpi/acdisasm.h
include/acpi/acdispat.h
include/acpi/acevents.h
include/acpi/acglobal.h
include/acpi/acinterp.h
include/acpi/aclocal.h
include/acpi/acmacros.h
include/acpi/acpi_drivers.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acresrc.h
include/acpi/actbl.h
include/acpi/actypes.h
include/acpi/acutils.h
include/acpi/amlresrc.h
include/acpi/platform/acenv.h
include/acpi/platform/aclinux.h
include/asm-x86_64/mpspec.h
include/linux/acpi.h

index 447fa9e33ffbeaaca7bbee58621900cbf0ba2b1e..1f378df14f34738d1b17dd731132727b0641ae7f 100644 (file)
@@ -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 edge_level, int active_high_low)
+int acpi_register_gsi(u32 gsi, int triggering, int polarity)
 {
        unsigned int irq;
        unsigned int plat_gsi = gsi;
@@ -476,14 +476,14 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
        if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
                extern void eisa_set_level_irq(unsigned int irq);
 
-               if (edge_level == ACPI_LEVEL_SENSITIVE)
+               if (triggering == 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, edge_level, active_high_low);
+               plat_gsi = mp_register_gsi(gsi, triggering, polarity);
        }
 #endif
        acpi_gsi_to_irq(plat_gsi, &irq);
index 91a64016956e0d4fdbfc2698e0dd3925def58fe7..0102f3d50e574fd67184fff730f7f11a77be7b49 100644 (file)
@@ -1080,7 +1080,7 @@ void __init mp_config_acpi_legacy_irqs (void)
 
 #define MAX_GSI_NUM    4096
 
-int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
+int mp_register_gsi (u32 gsi, int triggering, int polarity)
 {
        int                     ioapic = -1;
        int                     ioapic_pin = 0;
@@ -1129,7 +1129,7 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
 
        mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
 
-       if (edge_level) {
+       if (triggering == ACPI_LEVEL_SENSITIVE) {
                /*
                 * For PCI devices assign IRQs in order, avoiding gaps
                 * due to unused I/O APIC pins.
@@ -1151,8 +1151,8 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
        }
 
        io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
-                   edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1,
-                   active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1);
+                   triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
+                   polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
        return gsi;
 }
 
index 13a5b3b49bf869f0fac90186151f00a5296c34d2..4a5574ff007b8a1f1d5b0205d417c936b86e23f6 100644 (file)
@@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
        struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
        struct acpi_resource_vendor *vendor;
        struct acpi_vendor_descriptor *descriptor;
-       u32 length;
+       u32 byte_length;
 
-       if (resource->id != ACPI_RSTYPE_VENDOR)
+       if (resource->type != ACPI_RESOURCE_TYPE_VENDOR)
                return AE_OK;
 
        vendor = (struct acpi_resource_vendor *)&resource->data;
-       descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
-       if (vendor->length <= sizeof(*info->descriptor) ||
+       descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data;
+       if (vendor->byte_length <= sizeof(*info->descriptor) ||
            descriptor->guid_id != info->descriptor->guid_id ||
            efi_guidcmp(descriptor->guid, info->descriptor->guid))
                return AE_OK;
 
-       length = vendor->length - sizeof(struct acpi_vendor_descriptor);
-       info->data = acpi_os_allocate(length);
+       byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor);
+       info->data = acpi_os_allocate(byte_length);
        if (!info->data)
                return AE_NO_MEMORY;
 
        memcpy(info->data,
-              vendor->reserved + sizeof(struct acpi_vendor_descriptor),
-              length);
-       info->length = length;
+              vendor->byte_data + sizeof(struct acpi_vendor_descriptor),
+              byte_length);
+       info->length = byte_length;
        return AE_CTRL_TERMINATE;
 }
 
 acpi_status
 acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
-                         u8 ** data, u32 * length)
+                         u8 ** data, u32 * byte_length)
 {
        struct acpi_vendor_info info;
 
@@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
                return AE_NOT_FOUND;
 
        *data = info.data;
-       *length = info.length;
+       *byte_length = info.length;
        return AE_OK;
 }
 
index 9ad94ddf668776c14092993335fc171ce5ed0664..d2702c419cf830450ad63621bccec1e50842e718 100644 (file)
@@ -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 edge_level, int active_high_low)
+int acpi_register_gsi(u32 gsi, int triggering, int polarity)
 {
        if (has_8259 && gsi < 16)
                return isa_irq_to_vector(gsi);
 
        return iosapic_register_intr(gsi,
-                                    (active_high_low ==
+                                    (polarity ==
                                      ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
                                     IOSAPIC_POL_LOW,
-                                    (edge_level ==
+                                    (triggering ==
                                      ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
                                     IOSAPIC_LEVEL);
 }
index 30dbc98bf0b38a025b14161f0f088f1e67fcf6a0..337abd50c6ea34eb297d3bac39df4b70af3e7eef 100644 (file)
@@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
                goto free_resource;
        }
 
-       min = addr->min_address_range;
+       min = addr->minimum;
        max = min + addr->address_length - 1;
-       if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION)
+       if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION)
                sparse = 1;
 
-       space_nr = new_space(addr->address_translation_offset, sparse);
+       space_nr = new_space(addr->translation_offset, sparse);
        if (space_nr == ~0)
                goto free_name;
 
@@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
        if (addr.resource_type == ACPI_MEMORY_RANGE) {
                flags = IORESOURCE_MEM;
                root = &iomem_resource;
-               offset = addr.address_translation_offset;
+               offset = addr.translation_offset;
        } else if (addr.resource_type == ACPI_IO_RANGE) {
                flags = IORESOURCE_IO;
                root = &ioport_resource;
@@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
        window = &info->controller->window[info->controller->windows++];
        window->resource.name = info->name;
        window->resource.flags = flags;
-       window->resource.start = addr.min_address_range + offset;
+       window->resource.start = addr.minimum + offset;
        window->resource.end = window->resource.start + addr.address_length - 1;
        window->resource.child = NULL;
        window->offset = offset;
index 97154ab058b470e1e27af7484e6adcf97fa93a06..619767d3ea2bf8d248b893a87d6740a9105b9c42 100644 (file)
@@ -1956,7 +1956,7 @@ int __init io_apic_get_redir_entries (int ioapic)
 }
 
 
-int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low)
+int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
 {
        struct IO_APIC_route_entry entry;
        unsigned long flags;
@@ -1978,8 +1978,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
        entry.delivery_mode = INT_DELIVERY_MODE;
        entry.dest_mode = INT_DEST_MODE;
        entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
-       entry.trigger = edge_level;
-       entry.polarity = active_high_low;
+       entry.trigger = triggering;
+       entry.polarity = polarity;
        entry.mask = 1;                                  /* Disabled (masked) */
 
        irq = gsi_irq_sharing(irq);
@@ -1994,9 +1994,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
        apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
                "IRQ %d Mode:%i Active:%i)\n", ioapic, 
               mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
-              edge_level, active_high_low);
+              triggering, polarity);
 
-       ioapic_register_intr(irq, entry.vector, edge_level);
+       ioapic_register_intr(irq, entry.vector, triggering);
 
        if (!ioapic && (irq < 16))
                disable_8259A_irq(irq);
index 1105250bf02c3ee26d8b1f8a54ab78904e85ca5a..dc49bfb6db0a92fc71349f0626887e5aaa6cee72 100644 (file)
@@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void)
 
 #define MAX_GSI_NUM    4096
 
-int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
+int mp_register_gsi(u32 gsi, int triggering, int polarity)
 {
        int                     ioapic = -1;
        int                     ioapic_pin = 0;
@@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
 
        mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
 
-       if (edge_level) {
+       if (triggering == ACPI_LEVEL_SENSITIVE) {
                /*
                 * For PCI devices assign IRQs in order, avoiding gaps
                 * due to unused I/O APIC pins.
@@ -986,8 +986,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
        }
 
        io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
-               edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1,
-               active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1);
+               triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
+               polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
        return gsi;
 }
 
index 2143609d29362f0b7896c7e5dc07dadfba8a64aa..b12946ccd13505c69aaca0714943e8ab8ce2f71e 100644 (file)
@@ -101,8 +101,8 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
                            address64.attribute.memory.cache_attribute;
                        mem_device->read_write_attribute =
                            address64.attribute.memory.read_write_attribute;
-                       mem_device->start_addr = address64.min_address_range;
-                       mem_device->end_addr = address64.max_address_range;
+                       mem_device->start_addr = address64.minimum;
+                       mem_device->end_addr = address64.maximum;
                }
        }
 
index 8693c704aea611a6e9495fb3b7ee8ce7fe5ca017..4fa80abfe6c06ebe52d46dae85ffe9e45c79395d 100644 (file)
@@ -117,14 +117,6 @@ 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.
@@ -134,6 +126,21 @@ 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
@@ -149,7 +156,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
 
                        /* This parse failed, but we will continue parsing more methods */
                }
-
+#endif
                info->method_count++;
                break;
 
index 36c1ca0b9adb71a9b2d19fddd711a4b545a45312..e7ce86b8d95457eefdbe78a692091b0e34762098 100644 (file)
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
+#include <acpi/acdisasm.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsmethod")
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ds_parse_method
+ * FUNCTION:    acpi_ds_method_error
  *
- * PARAMETERS:  Node        - Method node
+ * PARAMETERS:  Status          - Execution status
+ *              walk_state      - Current state
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Parse the AML that is associated with the method.
+ * DESCRIPTION: Called on method error. Invoke the global exception handler if
+ *              present, dump the method data if the disassembler is configured
  *
- * MUTEX:       Assumes parser is locked
+ *              Note: Allows the exception handler to change the status code
  *
  ******************************************************************************/
-acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
+acpi_status
+acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
 {
-       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);
+       ACPI_FUNCTION_ENTRY();
 
-       /* Parameter Validation */
+       /* Ignore AE_OK and control exception codes */
 
-       if (!node) {
-               return_ACPI_STATUS(AE_NULL_ENTRY);
+       if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) {
+               return (status);
        }
 
-       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 */
+       /* Invoke the global exception handler */
 
-       obj_desc = acpi_ns_get_attached_object(node);
-       if (!obj_desc) {
-               return_ACPI_STATUS(AE_NULL_OBJECT);
-       }
+       if (acpi_gbl_exception_handler) {
+               /* Exit the interpreter, allow handler to execute methods */
 
-       /* Create a mutex for the method if there is a concurrency limit */
+               acpi_ex_exit_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;
+               /*
+                * 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();
        }
-
-       status = acpi_ds_init_aml_walk(walk_state, op, node,
-                                      obj_desc->method.aml_start,
-                                      obj_desc->method.aml_length, NULL, 1);
+#ifdef ACPI_DISASSEMBLER
        if (ACPI_FAILURE(status)) {
-               acpi_ds_delete_walk_state(walk_state);
-               goto cleanup2;
-       }
+               /* Display method locals/args if disassembler is present */
 
-       /*
-        * 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_dm_dump_method_info(status, walk_state, walk_state->op);
        }
+#endif
 
-       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);
+       return (status);
 }
 
 /*******************************************************************************
@@ -195,9 +126,9 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
  ******************************************************************************/
 
 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;
 
@@ -545,16 +476,54 @@ 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,
-                                 "*** Not deleting method namespace, there are still %d threads\n",
+                                 "*** Completed execution of one thread, %d threads remaining\n",
                                  walk_state->method_desc->method.
                                  thread_count));
-       } else {                /* This is the last executing thread */
+       } else {
+               /* This is the only executing thread for this method */
 
                /*
                 * Support to dynamically change a method from not_serialized to
-                * Serialized if it appears that the method is written foolishly and
+                * Serialized if it appears that the method is incorrectly written 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
@@ -570,34 +539,8 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
                                                          semaphore);
                }
 
-               /*
-                * 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);
-               }
+               /* No more threads, we can free the owner_id */
 
-               /*
-                * 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);
        }
@@ -606,3 +549,140 @@ 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
index 8ac0cd93adb580b3e70c285bb0c99bf3452dd2d6..905a84e4b1458ac68753055d236f8d9a43462212 100644 (file)
@@ -51,6 +51,7 @@
 #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,
@@ -85,7 +86,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 an named object reference.  If this name was
+                * This is a 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
                 */
@@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
                                                ACPI_IMODE_EXECUTE,
                                                ACPI_NS_SEARCH_PARENT |
                                                ACPI_NS_DONT_OPEN_SCOPE, NULL,
-                                               (struct acpi_namespace_node **)
-                                               &(op->common.node));
-
+                                               ACPI_CAST_INDIRECT_PTR(struct
+                                                                      acpi_namespace_node,
+                                                                      &(op->
+                                                                        common.
+                                                                        node)));
                        if (ACPI_FAILURE(status)) {
-                               ACPI_REPORT_NSERROR(op->common.value.string,
-                                                   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);
+                               }
+
                                return_ACPI_STATUS(status);
                        }
                }
        }
 
-       /* Create and init the internal ACPI object */
+       /* Create and init a new internal ACPI object */
 
        obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
                                                   (op->common.aml_opcode))->
@@ -157,13 +188,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) {
-               /*
-                * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
-                * The buffer object already exists (from the NS node)
-                */
-       } else {
+       if (!obj_desc) {
                /* Create a new buffer object */
 
                obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@@ -259,7 +290,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;
-       u32 i;
+       acpi_native_uint i;
 
        ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
 
@@ -271,13 +302,12 @@ 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) {
-               /*
-                * We are evaluating a Named package object "Name (xxxx, Package)".
-                * Get the existing package object from the NS node
-                */
-       } else {
+       if (!obj_desc) {
                obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
                *obj_desc_ptr = obj_desc;
                if (!obj_desc) {
@@ -291,11 +321,9 @@ 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;
-       while (arg) {
-               package_list_length++;
+       for (package_list_length = 0; arg; package_list_length++) {
                arg = arg->common.next;
        }
 
@@ -322,12 +350,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
        }
 
        /*
-        * Now init the elements of the package
+        * Initialize all elements of the package
         */
-       i = 0;
        arg = op->common.value.arg;
        arg = arg->common.next;
-       while (arg) {
+       for (i = 0; arg; i++) {
                if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
                        /* Object (package or buffer) is already built */
 
@@ -340,8 +367,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
                                                               package.
                                                               elements[i]);
                }
-
-               i++;
                arg = arg->common.next;
        }
 
index 83ae1c1aa28668ff8b931ac4e0837233b9a7901e..2cc53da5c0bd3bba8a11a5565defc06056b65493 100644 (file)
@@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 
        if (!op) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
-               return_VALUE(TRUE);
+               return_UINT8(TRUE);
        }
 
        /*
@@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                                  "At Method level, result of [%s] not used\n",
                                  acpi_ps_get_opcode_name(op->common.
                                                          aml_opcode)));
-               return_VALUE(FALSE);
+               return_UINT8(FALSE);
        }
 
        /* Get info on the parent. The root_op is AML_SCOPE */
@@ -218,7 +218,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
        if (parent_info->class == AML_CLASS_UNKNOWN) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                  "Unknown parent opcode. Op=%p\n", op));
-               return_VALUE(FALSE);
+               return_UINT8(FALSE);
        }
 
        /*
@@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                          acpi_ps_get_opcode_name(op->common.parent->common.
                                                  aml_opcode), op));
 
-       return_VALUE(TRUE);
+       return_UINT8(TRUE);
 
       result_not_used:
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                          acpi_ps_get_opcode_name(op->common.parent->common.
                                                  aml_opcode), op));
 
-       return_VALUE(FALSE);
+       return_UINT8(FALSE);
 }
 
 /*******************************************************************************
@@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
 
                if (op_info->flags & AML_HAS_RETVAL) {
                        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                         "Argument previously created, already stacked \n"));
+                                         "Argument previously created, already stacked\n"));
 
                        ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
                                           (walk_state->
index e522763bb692aeacdb568a51a3e1a2fe7b73a213..74f6996db2d71468df74f6d9efb86dcd0e210459 100644 (file)
@@ -314,12 +314,13 @@ 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
                 */
-               status = acpi_ds_result_stack_push(walk_state);
+               if (walk_state->opcode != AML_CREATE_FIELD_OP) {
+                       status = acpi_ds_result_stack_push(walk_state);
+               }
                break;
 
        default:
@@ -723,20 +724,6 @@ 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 */
 
@@ -758,18 +745,14 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
        }
 #endif
 
-       /* Always clear the object stack */
-
-       walk_state->num_operands = 0;
-
-#ifdef ACPI_DISASSEMBLER
-
-       /* On error, display method locals/args */
+       /* Invoke exception handler on error */
 
        if (ACPI_FAILURE(status)) {
-               acpi_dm_dump_method_info(status, walk_state, op);
+               status = acpi_ds_method_error(status, walk_state);
        }
-#endif
 
+       /* Always clear the object stack */
+
+       walk_state->num_operands = 0;
        return_ACPI_STATUS(status);
 }
index 411731261c2986b2c19e01104bd0e48e89be6131..441931cab08a019951159fdf3df558f7a734f692 100644 (file)
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
        char *path;
        u32 flags;
 
-       ACPI_FUNCTION_NAME("ds_load1_begin_op");
+       ACPI_FUNCTION_TRACE("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 (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
 
                /* Check if this object has already been installed in the namespace */
 
                if (op->common.node) {
                        *out_op = op;
-                       return (AE_OK);
+                       return_ACPI_STATUS(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 (status);
+                       return_ACPI_STATUS(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 (AE_AML_OPERAND_TYPE);
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
                break;
 
@@ -257,6 +257,7 @@ 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 */
 
@@ -265,6 +266,16 @@ 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))) {
@@ -290,7 +301,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                                   &(node));
                if (ACPI_FAILURE(status)) {
                        ACPI_REPORT_NSERROR(path, status);
-                       return (status);
+                       return_ACPI_STATUS(status);
                }
                break;
        }
@@ -302,28 +313,29 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
 
                op = acpi_ps_alloc_op(walk_state->opcode);
                if (!op) {
-                       return (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
        }
 
-       /* Initialize */
-
-       op->named.name = node->name.integer;
+       /* Initialize the op */
 
 #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
-       op->named.path = (u8 *) path;
+       op->named.path = ACPI_CAST_PTR(u8, path);
 #endif
 
-       /*
-        * 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;
+       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;
+       }
+
        acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state),
                           op);
-
        *out_op = op;
-       return (status);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -339,13 +351,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_NAME("ds_load1_end_op");
+       ACPI_FUNCTION_TRACE("ds_load1_end_op");
 
        op = walk_state->op;
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -354,7 +366,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 (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Get the object type to determine if we should pop the scope */
@@ -363,21 +375,37 @@ 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 (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 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);
+                       }
                }
-               return (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);
+       /*
+        * 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);
+                       }
                }
        }
 #endif
@@ -391,47 +419,63 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
                                                               common.
                                                               aml_opcode))->
                            object_type;
-                       op->common.node->type = (u8) object_type;
+
+                       /* Set node type if we have a namespace node */
+
+                       if (op->common.node) {
+                               op->common.node->type = (u8) object_type;
+                       }
                }
        }
 
-       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 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 (!acpi_ns_get_attached_object(op->named.node)) {
-                       walk_state->operands[0] = (void *)op->named.node;
-                       walk_state->num_operands = 1;
+                       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;
+                               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 (status);
+                               if (ACPI_FAILURE(status)) {
+                                       return_ACPI_STATUS(status);
+                               }
                        }
                }
        }
 
-       /* Pop the scope stack */
+       /* Pop the scope stack (only if loading a table) */
 
-       if (acpi_ns_opens_scope(object_type)) {
+       if (!walk_state->method_node && 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));
@@ -439,7 +483,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
                status = acpi_ds_scope_stack_pop(walk_state);
        }
 
-       return (status);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -456,8 +500,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;
@@ -840,6 +884,13 @@ 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:
 
@@ -929,6 +980,24 @@ 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
@@ -957,11 +1026,50 @@ 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;
index 7e1a445955bc1fd5a747038a4b2b1e867cf42b08..0ecbfa5db1ba66618cd4bf014080c277e6c14720 100644 (file)
@@ -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->id != ACPI_RSTYPE_IO) {
+       if (resource->type != ACPI_RESOURCE_TYPE_IO) {
                return AE_OK;
        }
 
@@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
        addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
        addr->register_bit_width = 8;
        addr->register_bit_offset = 0;
-       addr->address = resource->data.io.min_base_address;
+       addr->address = resource->data.io.minimum;
 
        return AE_OK;
 }
index 842d1e3fb37b968c66ec45c8a6a5f9485d55df1a..9522c643b88b51545dc4c594c2d8c9dab2a74270 100644 (file)
@@ -98,6 +98,48 @@ 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
index b2f232df13d89e48eeab7df18f64aabdf24111dc..bdd86537738ee8576a2cb841432c5f7f5423bbca 100644 (file)
@@ -372,14 +372,14 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
 
 u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 {
+       acpi_status status;
+       struct acpi_gpe_block_info *gpe_block;
+       struct acpi_gpe_register_info *gpe_register_info;
        u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
        u8 enabled_status_byte;
-       struct acpi_gpe_register_info *gpe_register_info;
        u32 status_reg;
        u32 enable_reg;
-       u32 flags;
-       acpi_status status;
-       struct acpi_gpe_block_info *gpe_block;
+       acpi_native_uint flags;
        acpi_native_uint i;
        acpi_native_uint j;
 
@@ -600,7 +600,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                status = acpi_hw_clear_gpe(gpe_event_info);
                if (ACPI_FAILURE(status)) {
                        ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
-                       return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+                       return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                }
        }
 
@@ -638,7 +638,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                        status = acpi_hw_clear_gpe(gpe_event_info);
                        if (ACPI_FAILURE(status)) {
                                ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
-                               return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+                               return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                        }
                }
                break;
@@ -652,7 +652,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                status = acpi_ev_disable_gpe(gpe_event_info);
                if (ACPI_FAILURE(status)) {
                        ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
-                       return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+                       return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                }
 
                /*
@@ -680,12 +680,12 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                status = acpi_ev_disable_gpe(gpe_event_info);
                if (ACPI_FAILURE(status)) {
                        ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
-                       return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+                       return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                }
                break;
        }
 
-       return_VALUE(ACPI_INTERRUPT_HANDLED);
+       return_UINT32(ACPI_INTERRUPT_HANDLED);
 }
 
 #ifdef ACPI_GPE_NOTIFY_CHECK
index b312eb33c43ee6086123f2b50a23da722b124091..8efca2eac27ed74c420892c420a2dc357639b1fa 100644 (file)
@@ -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;
-       u32 flags;
+       acpi_native_uint 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]) {
@@ -313,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;
@@ -341,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.
  *
  ******************************************************************************/
@@ -443,6 +443,7 @@ 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)) {
@@ -466,7 +467,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.
@@ -479,7 +480,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
        struct acpi_gpe_xrupt_info *next_gpe_xrupt;
        struct acpi_gpe_xrupt_info *gpe_xrupt;
        acpi_status status;
-       u32 flags;
+       acpi_native_uint flags;
 
        ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block");
 
@@ -553,7 +554,7 @@ static acpi_status
 acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
 {
        acpi_status status;
-       u32 flags;
+       acpi_native_uint flags;
 
        ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt");
 
@@ -566,8 +567,9 @@ 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);
        }
@@ -610,7 +612,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
        struct acpi_gpe_block_info *next_gpe_block;
        struct acpi_gpe_xrupt_info *gpe_xrupt_block;
        acpi_status status;
-       u32 flags;
+       acpi_native_uint flags;
 
        ACPI_FUNCTION_TRACE("ev_install_gpe_block");
 
@@ -663,7 +665,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
 acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
 {
        acpi_status status;
-       u32 flags;
+       acpi_native_uint flags;
 
        ACPI_FUNCTION_TRACE("ev_install_gpe_block");
 
@@ -750,7 +752,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
 
        /*
         * 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 *
@@ -769,9 +771,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;
@@ -812,11 +814,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
                        this_event++;
                }
 
-               /*
-                * Clear the status/enable registers.  Note that status registers
-                * are cleared by writing a '1', while enable registers are cleared
-                * by writing a '0'.
-                */
+               /* Disable all GPEs within this register */
+
                status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00,
                                                 &this_register->
                                                 enable_address);
@@ -824,6 +823,8 @@ 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);
@@ -860,7 +861,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Create and Install a block of GPE registers
+ * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
+ *              the block are disabled at exit.
+ *              Note: Assumes namespace is locked.
  *
  ******************************************************************************/
 
@@ -872,14 +875,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
                         u32 interrupt_number,
                         struct acpi_gpe_block_info **return_gpe_block)
 {
-       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;
+       struct acpi_gpe_block_info *gpe_block;
 
        ACPI_FUNCTION_TRACE("ev_create_gpe_block");
 
@@ -896,22 +893,24 @@ 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 */
-
+       /*
+        * Create the register_info and event_info sub-structures
+        * Note: disables and clears all GPEs in the block
+        */
        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 list(s) */
+       /* Install the new block in the global lists */
 
        status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
        if (ACPI_FAILURE(status)) {
@@ -926,16 +925,70 @@ 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;
@@ -948,9 +1001,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
        }
 
        /*
-        * 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.
+        * 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.
         */
        wake_gpe_count = 0;
        gpe_enabled_count = 0;
@@ -976,32 +1032,19 @@ acpi_ev_create_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));
 
-       /* Return the new block */
+       /* Enable all valid runtime GPEs found above */
 
-       if (return_gpe_block) {
-               (*return_gpe_block) = gpe_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));
        }
 
-       return_ACPI_STATUS(AE_OK);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
index 1418359770022a462e1e4f2a53edce4bfacdc6e4..e2c0b48a7e9fdd7c0ac79db5185f49d989eff91d 100644 (file)
@@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
         */
        interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-       return_VALUE(interrupt_handled);
+       return_UINT32(interrupt_handled);
 }
 
 /*******************************************************************************
@@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
         */
        interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-       return_VALUE(interrupt_handled);
+       return_UINT32(interrupt_handled);
 }
 
 /******************************************************************************
index 43b33d19cdf9169b751b275fb9466cc9b6fa2811..57d73299298eb0ed1f867a4c353571166d8fe99e 100644 (file)
@@ -562,7 +562,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
        struct acpi_gpe_event_info *gpe_event_info;
        struct acpi_handler_info *handler;
        acpi_status status;
-       u32 flags;
+       acpi_native_uint flags;
 
        ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
 
@@ -653,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
        struct acpi_gpe_event_info *gpe_event_info;
        struct acpi_handler_info *handler;
        acpi_status status;
-       u32 flags;
+       acpi_native_uint flags;
 
        ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
 
index 887ff9f28a0d254277ad31192d17bdcfde3edf17..c1b8989282568c5b72b362ec20aeb2612bfe8d52 100644 (file)
@@ -626,6 +626,13 @@ 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);
index 04e5194989a6ffe51a718f370dedc85ba9e6aadd..fa9e75d4ec656e331c11a48d8deceb666021f4a7 100644 (file)
@@ -504,18 +504,12 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                }
 
                /*
-                * Perform the conversion.
+                * Create a new string object and string buffer
                 * (-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);
+                   acpi_ut_create_string_object((acpi_size)
+                                                (string_length - 1));
                if (!return_desc) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
index bc2fa996047ef6148ce26101e77fa2ef7a8468cd..17c79cd91b31b16fb27a82d6892704160bc01407 100644 (file)
@@ -55,20 +55,386 @@ 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(union acpi_operand_object *obj_desc);
+static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
 
 static void
-acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index);
-#endif                         /* ACPI_FUTURE_USAGE */
+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--;
+       }
+}
 
 /*******************************************************************************
  *
@@ -214,7 +580,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
 
        case ACPI_TYPE_BUFFER:
 
-               acpi_os_printf("Buffer len %X @ %p \n",
+               acpi_os_printf("Buffer len %X @ %p\n",
                               obj_desc->buffer.length,
                               obj_desc->buffer.pointer);
 
@@ -320,17 +686,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);
@@ -441,7 +807,6 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
        return;
 }
 
-#ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_out* functions
@@ -465,11 +830,6 @@ 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)
 {
 
@@ -482,16 +842,16 @@ static void acpi_ex_out_address(char *title, acpi_physical_address value)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ex_dump_node
+ * FUNCTION:    acpi_ex_dump_namespace_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_node(struct acpi_namespace_node *node, u32 flags)
+void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
 {
 
        ACPI_FUNCTION_ENTRY();
@@ -506,19 +866,17 @@ void acpi_ex_dump_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
+ * FUNCTION:    acpi_ex_dump_reference_obj
  *
  * PARAMETERS:  Object              - Descriptor to dump
  *
@@ -526,14 +884,16 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags)
  *
  ******************************************************************************/
 
-static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
+static void acpi_ex_dump_reference_obj(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);
@@ -551,9 +911,9 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ex_dump_package
+ * FUNCTION:    acpi_ex_dump_package_obj
  *
- * PARAMETERS:  Object              - Descriptor to dump
+ * PARAMETERS:  obj_desc            - Descriptor to dump
  *              Level               - Indentation Level
  *              Index               - Package index for this object
  *
@@ -562,7 +922,8 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
  ******************************************************************************/
 
 static void
-acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
+acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
+                        u32 level, u32 index)
 {
        u32 i;
 
@@ -608,7 +969,8 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
                acpi_os_printf("[Buffer] Length %.2X = ",
                               obj_desc->buffer.length);
                if (obj_desc->buffer.length) {
-                       acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer,
+                       acpi_ut_dump_buffer(ACPI_CAST_PTR
+                                           (u8, obj_desc->buffer.pointer),
                                            obj_desc->buffer.length,
                                            DB_DWORD_DISPLAY, _COMPONENT);
                } else {
@@ -618,19 +980,19 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
 
        case ACPI_TYPE_PACKAGE:
 
-               acpi_os_printf("[Package] Contains %d Elements: \n",
+               acpi_os_printf("[Package] Contains %d Elements:\n",
                               obj_desc->package.count);
 
                for (i = 0; i < obj_desc->package.count; i++) {
-                       acpi_ex_dump_package(obj_desc->package.elements[i],
-                                            level + 1, i);
+                       acpi_ex_dump_package_obj(obj_desc->package.elements[i],
+                                                level + 1, i);
                }
                break;
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
                acpi_os_printf("[Object Reference] ");
-               acpi_ex_dump_reference(obj_desc);
+               acpi_ex_dump_reference_obj(obj_desc);
                break;
 
        default:
@@ -645,7 +1007,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
  *
  * FUNCTION:    acpi_ex_dump_object_descriptor
  *
- * PARAMETERS:  Object              - Descriptor to dump
+ * PARAMETERS:  obj_desc            - Descriptor to dump
  *              Flags               - Force display if TRUE
  *
  * DESCRIPTION: Dumps the members of the object descriptor given.
@@ -670,11 +1032,13 @@ 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_node((struct acpi_namespace_node *)obj_desc,
-                                 flags);
+               acpi_ex_dump_namespace_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;
@@ -687,233 +1051,18 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
                return_VOID;
        }
 
-       /* Common Fields */
-
-       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:
-
-               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;
+       if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) {
+               return_VOID;
+       }
 
-       case ACPI_TYPE_LOCAL_NOTIFY:
+       /* Common Fields */
 
-               acpi_ex_out_pointer("Node", obj_desc->notify.node);
-               acpi_ex_out_pointer("Context", obj_desc->notify.context);
-               break;
+       acpi_ex_dump_object(obj_desc, acpi_ex_dump_common);
 
-       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;
-       }
+       /* Object-specific fields */
 
+       acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]);
        return_VOID;
 }
 
-#endif                         /*  ACPI_FUTURE_USAGE  */
 #endif
index a3f4d72bedc979b45c77e3b86516b08d763bc7e2..0778bff632bf10a4a4c080adcd79d4d7f6d1b282 100644 (file)
@@ -45,6 +45,7 @@
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
+#include <acpi/amlresrc.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exmisc")
@@ -157,48 +158,58 @@ 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_tag1;
-       u8 *end_tag2;
+       u8 *end_tag;
+       acpi_size length0;
        acpi_size length1;
-       acpi_size length2;
 
        ACPI_FUNCTION_TRACE("ex_concat_template");
 
-       /* Find the end_tags in each resource 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);
 
-       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);
+       status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       /* Compute the length of each part */
+       /* Include the end_tag in the second template length */
 
-       length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer);
-       length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2;        /* Size of END_TAG */
+       length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) +
+           sizeof(struct aml_resource_end_tag);
 
        /* Create a new buffer object for the result */
 
-       return_desc = acpi_ut_create_buffer_object(length1 + length2);
+       return_desc = acpi_ut_create_buffer_object(length0 + length1);
        if (!return_desc) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       /* Copy the templates to the new descriptor */
-
+       /*
+        * Copy the templates to the new buffer, 0 first, then 1 follows. One
+        * end_tag descriptor is copied from Operand1.
+        */
        new_buf = return_desc->buffer.pointer;
-       ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1);
-       ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2);
+       ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0);
+       ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1);
 
-       /* Compute the new checksum */
+       /* Set the end_tag checksum to zero, means "ignore checksum" */
 
-       new_buf[return_desc->buffer.length - 1] =
-           acpi_ut_generate_checksum(return_desc->buffer.pointer,
-                                     (return_desc->buffer.length - 1));
+       new_buf[return_desc->buffer.length - 1] = 0;
 
-       /* Return the completed template descriptor */
+       /* Return the completed resource template */
 
        *actual_return_desc = return_desc;
        return_ACPI_STATUS(AE_OK);
@@ -229,7 +240,6 @@ 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");
 
@@ -256,7 +266,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
                break;
 
        default:
-               ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n",
+               ACPI_REPORT_ERROR(("Concatanate - invalid object type: %X\n",
                                   ACPI_GET_OBJECT_TYPE(operand0)));
                status = AE_AML_INTERNAL;
        }
@@ -296,8 +306,7 @@ 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 */
@@ -311,14 +320,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
 
                /* Result of two Strings is a String */
 
-               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);
+               return_desc = acpi_ut_create_string_object((acpi_size)
+                                                          (operand0->string.
+                                                           length +
+                                                           local_operand1->
+                                                           string.length));
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -338,11 +344,10 @@ 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 +
-                                                          (acpi_size)
-                                                          local_operand1->
-                                                          buffer.length);
+                                                          (operand0->buffer.
+                                                           length +
+                                                           local_operand1->
+                                                           buffer.length));
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -352,8 +357,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);
@@ -625,9 +630,8 @@ acpi_ex_do_logical_op(u16 opcode,
 
                /* Lexicographic compare: compare the data bytes */
 
-               compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer,
-                                     (const char *)local_operand1->buffer.
-                                     pointer,
+               compare = ACPI_MEMCMP(operand0->buffer.pointer,
+                                     local_operand1->buffer.pointer,
                                      (length0 > length1) ? length1 : length0);
 
                switch (opcode) {
index 239d8473e9a5c8d7195861d03ccb02d89688ef9f..7bb5e17b5680ba639625615da048755a43dbef8b 100644 (file)
@@ -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) {
                /*
@@ -216,7 +216,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
                                  *aml_address, aml_address));
        }
 
-       *in_aml_address = (u8 *) aml_address;
+       *in_aml_address = ACPI_CAST_PTR(u8, aml_address);
        return_ACPI_STATUS(status);
 }
 
index 8d70c6beef00c9f6d875320c0ea3c7e6d3b352b7..d8472842c1fd5f4782b8b06159ead42c178b9ded 100644 (file)
@@ -344,10 +344,6 @@ 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 */
@@ -358,8 +354,10 @@ 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;
index 483365777670d00a2100ac81de158167e7fe13b4..2ea1c322970b2cd4457e419a1373ff3a8a693d7e 100644 (file)
@@ -223,8 +223,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
                        goto cleanup;
                }
 
-               if (length > 0) {
-                       /* Copy the portion requested */
+               if (buffer) {
+                       /* We have a buffer, copy the portion requested */
 
                        ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
                                    length);
index 7476c363e407e30b9f67c899bcfdeaa068ee8aed..88ccbf3b29d0a03158783ec6e8a518894b9c59e5 100644 (file)
@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
 
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                  "Unknown field access type %X\n", access));
-               return_VALUE(0);
+               return_UINT32(0);
        }
 
        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
        }
 
        *return_byte_alignment = byte_alignment;
-       return_VALUE(bit_length);
+       return_UINT32(bit_length);
 }
 
 /*******************************************************************************
index 9a2f5bea3afe9618bbb5de54614683672d28629b..80118be3f544495e5cf21be734ebf91d04dad8f9 100644 (file)
@@ -77,7 +77,7 @@ acpi_ex_system_memory_space_handler(u32 function,
        struct acpi_mem_space_context *mem_info = region_context;
        u32 length;
        acpi_size window_size;
-#ifndef ACPI_MISALIGNED_TRANSFERS
+#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
        u32 remainder;
 #endif
 
@@ -109,7 +109,7 @@ acpi_ex_system_memory_space_handler(u32 function,
                return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
        }
 
-#ifndef ACPI_MISALIGNED_TRANSFERS
+#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
        /*
         * Hardware does not support non-aligned data transfers, we must verify
         * the request.
@@ -199,20 +199,20 @@ acpi_ex_system_memory_space_handler(u32 function,
                *value = 0;
                switch (bit_width) {
                case 8:
-                       *value = (acpi_integer) * ((u8 *) logical_addr_ptr);
+                       *value = (acpi_integer) ACPI_GET8(logical_addr_ptr);
                        break;
 
                case 16:
-                       *value = (acpi_integer) * ((u16 *) logical_addr_ptr);
+                       *value = (acpi_integer) ACPI_GET16(logical_addr_ptr);
                        break;
 
                case 32:
-                       *value = (acpi_integer) * ((u32 *) logical_addr_ptr);
+                       *value = (acpi_integer) ACPI_GET32(logical_addr_ptr);
                        break;
 
 #if ACPI_MACHINE_WIDTH != 16
                case 64:
-                       *value = (acpi_integer) * ((u64 *) logical_addr_ptr);
+                       *value = (acpi_integer) ACPI_GET64(logical_addr_ptr);
                        break;
 #endif
                default:
@@ -225,20 +225,20 @@ acpi_ex_system_memory_space_handler(u32 function,
 
                switch (bit_width) {
                case 8:
-                       *(u8 *) logical_addr_ptr = (u8) * value;
+                       ACPI_SET8(logical_addr_ptr) = (u8) * value;
                        break;
 
                case 16:
-                       *(u16 *) logical_addr_ptr = (u16) * value;
+                       ACPI_SET16(logical_addr_ptr) = (u16) * value;
                        break;
 
                case 32:
-                       *(u32 *) logical_addr_ptr = (u32) * value;
+                       ACPI_SET32(logical_addr_ptr) = (u32) * value;
                        break;
 
 #if ACPI_MACHINE_WIDTH != 16
                case 64:
-                       *(u64 *) logical_addr_ptr = (u64) * value;
+                       ACPI_SET64(logical_addr_ptr) = (u64) * value;
                        break;
 #endif
 
index ff064e79ab90d66995213dc498e473731bb58af9..b04e4a3707a1974790ec5e82cec65e1bb954a54f 100644 (file)
@@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode,
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                         "Opcode %X [%s] required_operand_types=%8.8X \n",
+                         "Opcode %X [%s] required_operand_types=%8.8X\n",
                          opcode, op_info->name, arg_types));
 
        /*
index c4ff654a669717637baf578766d9524fd062fb40..855db713075134ab319f3b955ded22e6c62e1cd0 100644 (file)
@@ -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 = (u8 *) source_desc->buffer.pointer;
+       buffer = ACPI_CAST_PTR(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 = (u8 *) source_desc->string.pointer;
+       buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer);
        length = source_desc->string.length;
 
        /*
index 1ee79d8c8f8827d2895ac6a221b592eea6c78cd0..9f4e547d7734c7f3a707a07af2a323470c9d0d25 100644 (file)
@@ -206,7 +206,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
                }
        }
 
-       return_VALUE(locked);
+       return_UINT8(locked);
 }
 
 /*******************************************************************************
@@ -268,7 +268,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
        /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
 
        if (value == 0) {
-               return_VALUE(1);
+               return_UINT32(1);
        }
 
        current_value = value;
@@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
                num_digits++;
        }
 
-       return_VALUE(num_digits);
+       return_UINT32(num_digits);
 }
 
 /*******************************************************************************
index aa993715d6445d40c6ca668616b8f203d35a6b2c..8daef57b994c4b264db47d4a050243812f5a0b8b 100644 (file)
@@ -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->id != ACPI_RSTYPE_ADDRESS16 &&
-           resource->id != ACPI_RSTYPE_ADDRESS32 &&
-           resource->id != ACPI_RSTYPE_ADDRESS64)
+       if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
+           resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
+           resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
                return AE_OK;
 
        acpi_resource_to_address64(resource, &address);
        if ((address.address_length > 0) &&
            (address.resource_type == ACPI_BUS_NUMBER_RANGE))
-               *busnr = address.min_address_range;
+               *busnr = address.minimum;
 
        return AE_OK;
 }
index 1bb3463d7040ae6b5913a8863999bff17e920543..20a335cc9beaf30fd9fd602e587720e8c1914f45 100644 (file)
@@ -204,18 +204,18 @@ u32 acpi_hw_get_mode(void)
         * system does not support mode transition.
         */
        if (!acpi_gbl_FADT->smi_cmd) {
-               return_VALUE(ACPI_SYS_MODE_ACPI);
+               return_UINT32(ACPI_SYS_MODE_ACPI);
        }
 
        status =
            acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
        if (ACPI_FAILURE(status)) {
-               return_VALUE(ACPI_SYS_MODE_LEGACY);
+               return_UINT32(ACPI_SYS_MODE_LEGACY);
        }
 
        if (value) {
-               return_VALUE(ACPI_SYS_MODE_ACPI);
+               return_UINT32(ACPI_SYS_MODE_ACPI);
        } else {
-               return_VALUE(ACPI_SYS_MODE_LEGACY);
+               return_UINT32(ACPI_SYS_MODE_LEGACY);
        }
 }
index 536a7aea80c93a802f206a0268d9c688d48478a3..b243f20708b79974cc278dd0ba58b70ae7b24171 100644 (file)
@@ -144,7 +144,8 @@ 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 = (char *)acpi_gbl_sleep_state_names[sleep_state];
+       sleep_state_name =
+           ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
 
        status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
        if (ACPI_FAILURE(status)) {
index e928e8c2c6ec90629aab15eeef143319c8c2462e..468244147ec1f7f422ee6d5bfe7fb7d510c602eb 100644 (file)
@@ -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->id == ACPI_RSTYPE_IO) {
+       if (res->type == ACPI_RESOURCE_TYPE_IO) {
                struct acpi_resource_io *io_res = &res->data.io;
 
-               if (io_res->min_base_address != io_res->max_base_address)
+               if (io_res->minimum != io_res->maximum)
                        return_VALUE(AE_OK);
                if (IS_RESERVED_ADDR
-                   (io_res->min_base_address, io_res->range_length)) {
+                   (io_res->minimum, io_res->address_length)) {
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                          "Motherboard resources 0x%08x - 0x%08x\n",
-                                         io_res->min_base_address,
-                                         io_res->min_base_address +
-                                         io_res->range_length));
+                                         io_res->minimum,
+                                         io_res->minimum +
+                                         io_res->address_length));
                        requested_res =
-                           request_region(io_res->min_base_address,
-                                          io_res->range_length, "motherboard");
+                           request_region(io_res->minimum,
+                                          io_res->address_length, "motherboard");
                }
-       } else if (res->id == ACPI_RSTYPE_FIXED_IO) {
+       } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) {
                struct acpi_resource_fixed_io *fixed_io_res =
                    &res->data.fixed_io;
 
                if (IS_RESERVED_ADDR
-                   (fixed_io_res->base_address, fixed_io_res->range_length)) {
+                   (fixed_io_res->address, fixed_io_res->address_length)) {
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                          "Motherboard resources 0x%08x - 0x%08x\n",
-                                         fixed_io_res->base_address,
-                                         fixed_io_res->base_address +
-                                         fixed_io_res->range_length));
+                                         fixed_io_res->address,
+                                         fixed_io_res->address +
+                                         fixed_io_res->address_length));
                        requested_res =
-                           request_region(fixed_io_res->base_address,
-                                          fixed_io_res->range_length,
+                           request_region(fixed_io_res->address,
+                                          fixed_io_res->address_length,
                                           "motherboard");
                }
        } else {
index edfbe34600f5178b66b9ec39f18c768eee2b1dfd..6923059ba3c7e5cef1ad748250b91f06245425a0 100644 (file)
@@ -498,7 +498,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                        path++;
 
                        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
-                                         "Multi Pathname (%d Segments, Flags=%X) \n",
+                                         "Multi Pathname (%d Segments, Flags=%X)\n",
                                          num_segments, flags));
                        break;
 
index 9faf1d5c86ed8179ecdd7210df20f81d22b11d2a..864c642759fab63990b78aca95504dc6d1c057b4 100644 (file)
@@ -212,7 +212,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
        /*
         * Now we can print out the pertinent information
         */
-       acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node);
+       acpi_os_printf(" %-12s %p %2.2X ",
+                      acpi_ut_get_type_name(type), this_node,
+                      this_node->owner_id);
 
        dbg_level = acpi_dbg_level;
        acpi_dbg_level = 0;
index 0a08d2f04a06bd5394d18698338c0c6cdb9db985..efa3f4233736a9c622d4249d55f4bcc0bb6cf675 100644 (file)
@@ -336,23 +336,22 @@ 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");
 
-       pinfo.parameters = NULL;
-       pinfo.parameter_type = ACPI_PARAM_ARGS;
-
-       pinfo.node = acpi_ns_map_handle_to_node(obj_handle);
-       if (!pinfo.node) {
+       device_node = acpi_ns_map_handle_to_node(obj_handle);
+       if (!device_node) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * We will run _STA/_INI on Devices, Processors and thermal_zones only
         */
-       if ((pinfo.node->type != ACPI_TYPE_DEVICE) &&
-           (pinfo.node->type != ACPI_TYPE_PROCESSOR) &&
-           (pinfo.node->type != ACPI_TYPE_THERMAL)) {
+       if ((device_node->type != ACPI_TYPE_DEVICE) &&
+           (device_node->type != ACPI_TYPE_PROCESSOR) &&
+           (device_node->type != ACPI_TYPE_THERMAL)) {
                return_ACPI_STATUS(AE_OK);
        }
 
@@ -364,57 +363,69 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
        info->device_count++;
 
        /*
-        * Run _STA to determine if we can run _INI on the device.
+        * 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
         */
        ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
-                                                     pinfo.node,
+                                                     device_node,
                                                      METHOD_NAME__STA));
-       status = acpi_ut_execute_STA(pinfo.node, &flags);
 
+       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)) {
-               if (pinfo.node->type == ACPI_TYPE_DEVICE) {
-                       /* Ignore error and move on to next device */
+               /* Ignore error and move on to next device */
 
-                       return_ACPI_STATUS(AE_OK);
-               }
+               return_ACPI_STATUS(AE_OK);
+       }
 
-               /* _STA is not required for Processor or thermal_zone objects */
-       } else {
+       if (flags != ACPI_UINT32_MAX) {
                info->num_STA++;
+       }
 
-               if (!(flags & 0x01)) {
-                       /* Don't look at children of a not present device */
+       if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
+               /* 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. Run _INI.
+        * The device is present and _INI exists. Run the _INI method.
+        * (We already have the _INI node from above)
         */
        ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
                                                      pinfo.node,
                                                      METHOD_NAME__INI));
-       status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo);
-       if (ACPI_FAILURE(status)) {
-               /* No _INI (AE_NOT_FOUND) means device requires no initialization */
 
-               if (status != AE_NOT_FOUND) {
-                       /* Ignore error and move on to next device */
+       pinfo.node = ini_node;
+       status = acpi_ns_evaluate_by_handle(&pinfo);
+       if (ACPI_FAILURE(status)) {
+               /* Ignore error and move on to next device */
 
 #ifdef ACPI_DEBUG_OUTPUT
-                       char *scope_name =
-                           acpi_ns_get_external_pathname(pinfo.node);
+               char *scope_name = acpi_ns_get_external_pathname(ini_node);
 
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n",
-                                         scope_name,
-                                         acpi_format_exception(status)));
+               ACPI_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) */
 
@@ -434,5 +445,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
                    acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
        }
 
-       return_ACPI_STATUS(status);
+       return_ACPI_STATUS(AE_OK);
 }
index d5e8dea61c278f1e3f2fe76d3713e9fd380b851b..5400728eb7915246ce008684c5070edf2ae2b5ac 100644 (file)
@@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
 
        acpi_ns_build_external_path(node, required_size, buffer->pointer);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n",
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n",
                          (char *)buffer->pointer, (u32) required_size));
        return_ACPI_STATUS(AE_OK);
 }
index 50a3ca5470ed6f1c41cd0332d7e03bec14ad4768..c1b1943d467092eeed694e95e1c6c2afb333f683 100644 (file)
@@ -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,
-                                         (char *)&target_name,
+                                         scope_name, node, ACPI_CAST_PTR(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",
-                                         (char *)&target_name,
+                                         ACPI_CAST_PTR(char, &target_name),
                                          acpi_ut_get_type_name(next_node->
                                                                type),
                                          next_node,
@@ -160,7 +160,8 @@ 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",
-                         (char *)&target_name, acpi_ut_get_type_name(type),
+                         ACPI_CAST_PTR(char, &target_name),
+                         acpi_ut_get_type_name(type),
                          acpi_ut_get_node_name(node), node, node->child));
 
        return_ACPI_STATUS(AE_NOT_FOUND);
@@ -210,14 +211,14 @@ acpi_ns_search_parent_tree(u32 target_name,
         */
        if (!parent_node) {
                ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
-                                 (char *)&target_name));
+                                 ACPI_CAST_PTR(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",
-                                 (char *)&target_name,
+                                 ACPI_CAST_PTR(char, &target_name),
                                  acpi_ut_get_type_name(type)));
                return_ACPI_STATUS(AE_NOT_FOUND);
        }
@@ -227,7 +228,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),
-                         (char *)&target_name));
+                         ACPI_CAST_PTR(char, &target_name)));
 
        /*
         * Search parents until target is found or we have backed up to the root
@@ -360,7 +361,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",
-                                 (char *)&target_name, node));
+                                 ACPI_CAST_PTR(char, &target_name), node));
 
                return_ACPI_STATUS(AE_NOT_FOUND);
        }
index ebec036423c9af25db4d25d029d946a5fce08a35..549075fb9f880ad327af93bc8b528d77829da1f7 100644 (file)
@@ -249,10 +249,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
 
        if (!node) {
                ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n"));
-               return_VALUE(ACPI_TYPE_ANY);
+               return_UINT32(ACPI_TYPE_ANY);
        }
 
-       return_VALUE((acpi_object_type) node->type);
+       return_UINT32((acpi_object_type) node->type);
 }
 
 /*******************************************************************************
@@ -276,10 +276,10 @@ u32 acpi_ns_local(acpi_object_type type)
                /* Type code out of range  */
 
                ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n"));
-               return_VALUE(ACPI_NS_NORMAL);
+               return_UINT32(ACPI_NS_NORMAL);
        }
 
-       return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
+       return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
 }
 
 /*******************************************************************************
@@ -805,10 +805,10 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
 
                ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
                                     type));
-               return_VALUE(ACPI_NS_NORMAL);
+               return_UINT32(ACPI_NS_NORMAL);
        }
 
-       return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
+       return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
 }
 
 /*******************************************************************************
index c07b046659ff6c9dd298bf9ca6afd7dbdefce089..75b137a6a3c9164748068275ca63fe427de2e953 100644 (file)
@@ -399,7 +399,7 @@ acpi_walk_namespace(acpi_object_type type,
 
        /* Parameter validation */
 
-       if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) {
+       if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -473,8 +473,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
                return (AE_CTRL_DEPTH);
        }
 
-       if (!(flags & 0x01)) {
-               /* Don't return at the device or children of the device if not there */
+       if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
+               /* Don't examine children of the device if not present */
 
                return (AE_CTRL_DEPTH);
        }
index e3cd0b16031ad32c70ee1b47516c23b02856cbcb..58e7c47354ee6afac27bf1b6ed157322d35636d9 100644 (file)
@@ -1058,11 +1058,9 @@ EXPORT_SYMBOL(max_cstate);
  * Acquire a spinlock.
  *
  * handle is a pointer to the spinlock_t.
- * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
- *   that indicates whether we are at interrupt level.
  */
 
-unsigned long acpi_os_acquire_lock(acpi_handle handle)
+acpi_native_uint acpi_os_acquire_lock(acpi_handle handle)
 {
        unsigned long flags;
        spin_lock_irqsave((spinlock_t *) handle, flags);
@@ -1073,9 +1071,9 @@ unsigned long acpi_os_acquire_lock(acpi_handle handle)
  * Release a spinlock. See above.
  */
 
-void acpi_os_release_lock(acpi_handle handle, unsigned long flags)
+void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags)
 {
-       spin_unlock_irqrestore((spinlock_t *) handle, flags);
+       spin_unlock_irqrestore((spinlock_t *) handle, (unsigned long) flags);
 }
 
 #ifndef ACPI_USE_LOCAL_CACHE
index 5858188f94a69912220474c7af6142e7ba494b53..e6d4cb9fd3034d5a189b229a58e3dbf321db04fa 100644 (file)
@@ -45,6 +45,7 @@
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
+#include <acpi/acdispat.h>
 
 #define _COMPONENT          ACPI_PARSER
 ACPI_MODULE_NAME("psargs")
@@ -62,61 +63,51 @@ 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
+ * DESCRIPTION: Decode and return a package length field.
+ *              Note: Largest package length is 28 bits, from ACPI specification
  *
  ******************************************************************************/
 
 static u32
 acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
 {
-       u32 encoded_length;
-       u32 length = 0;
+       u8 *aml = parser_state->aml;
+       u32 package_length = 0;
+       acpi_native_uint byte_count;
+       u8 byte_zero_mask = 0x3F;       /* Default [0:5] */
 
        ACPI_FUNCTION_TRACE("ps_get_next_package_length");
 
-       encoded_length = (u32) ACPI_GET8(parser_state->aml);
-       parser_state->aml++;
-
-       switch (encoded_length >> 6) {  /* bits 6-7 contain encoding scheme */
-       case 0:         /* 1-byte encoding (bits 0-5) */
-
-               length = (encoded_length & 0x3F);
-               break;
-
-       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) */
-
-               length = ((ACPI_GET8(parser_state->aml + 1) << 12) |
-                         (ACPI_GET8(parser_state->aml) << 04) |
-                         (encoded_length & 0x0F));
-               parser_state->aml += 2;
-               break;
+       /*
+        * 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);
 
-       case 3:         /* 4-byte encoding (next 3 bytes + bits 0-3) */
+       /* Get bytes 3, 2, 1 as needed */
 
-               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:
+       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));
 
-               /* Can't get here, only 2 bits / 4 cases */
-               break;
+               byte_zero_mask = 0x0F;  /* Use bits [0:3] of byte 0 */
+               byte_count--;
        }
 
-       return_VALUE(length);
+       /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
+
+       package_length |= (aml[0] & byte_zero_mask);
+       return_UINT32(package_length);
 }
 
 /*******************************************************************************
@@ -135,16 +126,15 @@ 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;
-       acpi_native_uint length;
+       u32 package_length;
 
        ACPI_FUNCTION_TRACE("ps_get_next_package_end");
 
-       /* Function below changes parser_state->Aml */
+       /* Function below updates parser_state->Aml */
 
-       length =
-           (acpi_native_uint) acpi_ps_get_next_package_length(parser_state);
+       package_length = acpi_ps_get_next_package_length(parser_state);
 
-       return_PTR(start + length);     /* end of package */
+       return_PTR(start + package_length);     /* end of package */
 }
 
 /*******************************************************************************
@@ -169,17 +159,15 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
 
        ACPI_FUNCTION_TRACE("ps_get_next_namestring");
 
-       /* Handle multiple prefix characters */
-
-       while (acpi_ps_is_prefix_char(ACPI_GET8(end))) {
-               /* Include prefix '\\' or '^' */
+       /* Point past any namestring prefix characters (backslash or carat) */
 
+       while (acpi_ps_is_prefix_char(*end)) {
                end++;
        }
 
-       /* Decode the path */
+       /* Decode the path prefix character */
 
-       switch (ACPI_GET8(end)) {
+       switch (*end) {
        case 0:
 
                /* null_name */
@@ -199,9 +187,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 */
+               /* Multiple name segments, 4 chars each, count in next byte */
 
-               end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE);
+               end += 2 + (*(end + 1) * ACPI_NAME_SIZE);
                break;
 
        default:
@@ -212,7 +200,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
                break;
        }
 
-       parser_state->aml = (u8 *) end;
+       parser_state->aml = end;
        return_PTR((char *)start);
 }
 
@@ -224,7 +212,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.
- *              method_call         - Whether the namepath can possibly be the
+ *              possible_method_call - Whether the namepath can possibly be the
  *                                    start of a method call
  *
  * RETURN:      Status
@@ -240,11 +228,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 method_call)
+                         union acpi_parse_object *arg, u8 possible_method_call)
 {
        char *path;
        union acpi_parse_object *name_op;
-       acpi_status status = AE_OK;
+       acpi_status status;
        union acpi_operand_object *method_desc;
        struct acpi_namespace_node *node;
        union acpi_generic_state scope_info;
@@ -252,115 +240,127 @@ 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 */
+       /* Null path case is allowed, just exit */
 
-       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;
-               }
+       if (!path) {
+               arg->common.value.name = path;
+               return_ACPI_STATUS(AE_OK);
+       }
 
-               /*
-                * 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);
-                               }
+       /* Setup search scope info */
 
-                               /* Change arg into a METHOD CALL and attach name to it */
+       scope_info.scope.node = NULL;
+       node = parser_state->start_node;
+       if (node) {
+               scope_info.scope.node = node;
+       }
 
-                               acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
-                               name_op->common.value.name = path;
+       /*
+        * 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);
 
-                               /* Point METHODCALL/NAME to the METHOD 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 */
 
-                               name_op->common.node = node;
-                               acpi_ps_append_arg(arg, name_op);
+               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));
 
-                               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);
-                               }
+               name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
+               if (!name_op) {
+                       return_ACPI_STATUS(AE_NO_MEMORY);
+               }
 
-                               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                                                 "Control Method - %p Args %X\n",
-                                                 node,
-                                                 method_desc->method.
-                                                 param_count));
+               /* Change Arg into a METHOD CALL and attach name to it */
 
-                               /* Get the number of arguments to expect */
+               acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
+               name_op->common.value.name = path;
 
-                               walk_state->arg_count =
-                                   method_desc->method.param_count;
-                               return_ACPI_STATUS(AE_OK);
-                       }
+               /* Point METHODCALL/NAME to the METHOD Node */
 
-                       /*
-                        * Else this is normal named object reference.
-                        * Just init the NAMEPATH object with the pathname.
-                        * (See code below)
-                        */
-               }
+               name_op->common.node = node;
+               acpi_ps_append_arg(arg, name_op);
 
-               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;
-                       }
+               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);
                }
+
+               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                 "Control Method - %p Args %X\n",
+                                 node, method_desc->method.param_count));
+
+               /* Get the number of arguments to expect */
+
+               walk_state->arg_count = method_desc->method.param_count;
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
-        * Regardless of success/failure above,
-        * Just initialize the Op with the pathname.
+        * Special handling if the name was not found during the lookup -
+        * some not_found cases are allowed
         */
-       acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
-       arg->common.value.name = path;
+       if (status == AE_NOT_FOUND) {
+               /* 1) not_found is ok during load pass 1/2 (allow forward references) */
+
+               if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
+                   ACPI_PARSE_EXECUTE) {
+                       status = AE_OK;
+               }
+
+               /* 2) not_found during a cond_ref_of(x) is ok by definition */
+
+               else if (walk_state->op->common.aml_opcode ==
+                        AML_COND_REF_OF_OP) {
+                       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;
+               }
+       }
+
+       /* 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);
+               }
+       }
+
+       /* Save the namepath */
+
+       arg->common.value.name = path;
        return_ACPI_STATUS(status);
 }
 
@@ -382,59 +382,63 @@ 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:
 
-               acpi_ps_init_op(arg, AML_BYTE_OP);
-               arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml);
-               parser_state->aml++;
+               /* Get 1 byte from the AML stream */
+
+               opcode = AML_BYTE_OP;
+               arg->common.value.integer = (acpi_integer) * aml;
+               length = 1;
                break;
 
        case ARGP_WORDDATA:
 
-               acpi_ps_init_op(arg, AML_WORD_OP);
-
                /* Get 2 bytes from the AML stream */
 
-               ACPI_MOVE_16_TO_32(&arg->common.value.integer,
-                                  parser_state->aml);
-               parser_state->aml += 2;
+               opcode = AML_WORD_OP;
+               ACPI_MOVE_16_TO_64(&arg->common.value.integer, aml);
+               length = 2;
                break;
 
        case ARGP_DWORDDATA:
 
-               acpi_ps_init_op(arg, AML_DWORD_OP);
-
                /* Get 4 bytes from the AML stream */
 
-               ACPI_MOVE_32_TO_32(&arg->common.value.integer,
-                                  parser_state->aml);
-               parser_state->aml += 4;
+               opcode = AML_DWORD_OP;
+               ACPI_MOVE_32_TO_64(&arg->common.value.integer, aml);
+               length = 4;
                break;
 
        case ARGP_QWORDDATA:
 
-               acpi_ps_init_op(arg, AML_QWORD_OP);
-
                /* Get 8 bytes from the AML stream */
 
-               ACPI_MOVE_64_TO_64(&arg->common.value.integer,
-                                  parser_state->aml);
-               parser_state->aml += 8;
+               opcode = AML_QWORD_OP;
+               ACPI_MOVE_64_TO_64(&arg->common.value.integer, aml);
+               length = 8;
                break;
 
        case ARGP_CHARLIST:
 
-               acpi_ps_init_op(arg, AML_STRING_OP);
-               arg->common.value.string = (char *)parser_state->aml;
+               /* Get a pointer to the string, point past the string */
+
+               opcode = AML_STRING_OP;
+               arg->common.value.string = ACPI_CAST_PTR(char, aml);
 
-               while (ACPI_GET8(parser_state->aml) != '\0') {
-                       parser_state->aml++;
+               /* Find the null terminator */
+
+               length = 0;
+               while (aml[length]) {
+                       length++;
                }
-               parser_state->aml++;
+               length++;
                break;
 
        case ARGP_NAME:
@@ -443,14 +447,16 @@ 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);
-               break;
+               return_VOID;
 
        default:
 
                ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type));
-               break;
+               return_VOID;
        }
 
+       acpi_ps_init_op(arg, opcode);
+       parser_state->aml += length;
        return_VOID;
 }
 
@@ -540,7 +546,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 =
-                   (ACPI_GET8(parser_state->aml) << 8);
+                   (((u32) ACPI_GET8(parser_state->aml) << 8));
                parser_state->aml++;
                field->common.value.integer |= ACPI_GET8(parser_state->aml);
                parser_state->aml++;
index 088d33999d9076b17575502b0bb5fc99906e51a0..e81e51b8b3ae22adb5927a24b695e53f3eadac48 100644 (file)
@@ -704,6 +704,15 @@ 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 */
index 76d4d640d83cdebaa7362742258b2daac841e2d9..f0979b2956f249eef846eeb589927666ad8fe1f8 100644 (file)
@@ -333,7 +333,6 @@ 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.
@@ -346,13 +345,19 @@ 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 = AE_CTRL_BREAK;
+               status = acpi_ds_result_stack_pop(walk_state);
+               if (ACPI_SUCCESS(status)) {
+                       status = AE_CTRL_BREAK;
+               }
                break;
 
        case AE_CTRL_CONTINUE:
 
                parser_state->aml = walk_state->aml_last_while;
-               status = AE_CTRL_CONTINUE;
+               status = acpi_ds_result_stack_pop(walk_state);
+               if (ACPI_SUCCESS(status)) {
+                       status = AE_CTRL_CONTINUE;
+               }
                break;
 
        case AE_CTRL_PENDING:
@@ -369,16 +374,18 @@ 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
@@ -503,22 +510,23 @@ 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)) {
-                       ACPI_REPORT_METHOD_ERROR("Method execution failed",
-                                                walk_state->method_node, NULL,
-                                                status);
-
-                       /* Ensure proper cleanup */
+                       /* Either the method parse or actual execution failed */
 
-                       walk_state->parse_flags |= ACPI_PARSE_EXECUTE;
+                       ACPI_REPORT_METHOD_ERROR
+                           ("Method parse/execution failed",
+                            walk_state->method_node, NULL, status);
 
                        /* Check for possible multi-thread reentrancy problem */
 
                        if ((status == AE_ALREADY_EXISTS) &&
                            (!walk_state->method_desc->method.semaphore)) {
                                /*
-                                * This method is marked not_serialized, but it tried to create
+                                * 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
                                 * a named object, causing the second thread entrance to fail.
-                                * We will workaround this by marking the method permanently
+                                * Workaround this problem by marking the method permanently
                                 * as Serialized.
                                 */
                                walk_state->method_desc->method.method_flags |=
@@ -536,15 +544,22 @@ 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,
-                * there's lots of cleanup to do
+                * 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 ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
-                   ACPI_PARSE_EXECUTE) {
+               if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
+                    ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) {
                        if (walk_state->method_desc) {
                                /* Decrement the thread count on the method parse tree */
 
-                               walk_state->method_desc->method.thread_count--;
+                               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"));
+                               }
                        }
 
                        acpi_ds_terminate_control_method(walk_state);
@@ -553,7 +568,6 @@ 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,
index 4dcbd443160e64a90e62c8ca59412c59cf00e5b2..14d544d60867a0f6ec5fc84cdaee3a70a4224a85 100644 (file)
 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
@@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
         */
        acpi_ps_update_parameter_list(info, REF_INCREMENT);
 
+       /* Begin tracing if requested */
+
+       acpi_ps_start_trace(info);
+
        /*
         * 1) Perform the first pass parse of the method to enter any
         *    named objects that it creates into the namespace
@@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
        status = acpi_ps_execute_pass(info);
 
       cleanup:
+       /* End optional tracing */
+
+       acpi_ps_stop_trace(info);
+
        /* Take away the extra reference that we gave the parameters above */
 
        acpi_ps_update_parameter_list(info, REF_DECREMENT);
index 09567c2edcfb5225a67deb44d71cba7249915735..726dda1fce1cfc77edb8bf3ef3ef66a79d17f5c3 100644 (file)
@@ -258,7 +258,7 @@ typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
 
 static int
 acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
-                     int *edge_level, int *active_high_low, char **link)
+                     int *triggering, int *polarity, char **link)
 {
        int irq;
 
@@ -266,8 +266,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
 
        if (entry->link.handle) {
                irq = acpi_pci_link_allocate_irq(entry->link.handle,
-                                                entry->link.index, edge_level,
-                                                active_high_low, link);
+                                                entry->link.index, triggering,
+                                                polarity, link);
                if (irq < 0) {
                        ACPI_DEBUG_PRINT((ACPI_DB_WARN,
                                          "Invalid IRQ link routing entry\n"));
@@ -275,8 +275,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
                }
        } else {
                irq = entry->link.index;
-               *edge_level = ACPI_LEVEL_SENSITIVE;
-               *active_high_low = ACPI_ACTIVE_LOW;
+               *triggering = ACPI_LEVEL_SENSITIVE;
+               *polarity = ACPI_ACTIVE_LOW;
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
@@ -285,7 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
 
 static int
 acpi_pci_free_irq(struct acpi_prt_entry *entry,
-                 int *edge_level, int *active_high_low, char **link)
+                 int *triggering, int *polarity, char **link)
 {
        int irq;
 
@@ -307,8 +307,8 @@ static int
 acpi_pci_irq_lookup(struct pci_bus *bus,
                    int device,
                    int pin,
-                   int *edge_level,
-                   int *active_high_low, char **link, irq_lookup_func func)
+                   int *triggering,
+                   int *polarity, char **link, irq_lookup_func func)
 {
        struct acpi_prt_entry *entry = NULL;
        int segment = pci_domain_nr(bus);
@@ -327,7 +327,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
                return_VALUE(-1);
        }
 
-       ret = func(entry, edge_level, active_high_low, link);
+       ret = func(entry, triggering, polarity, link);
        return_VALUE(ret);
 }
 
@@ -339,8 +339,8 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
 static int
 acpi_pci_irq_derive(struct pci_dev *dev,
                    int pin,
-                   int *edge_level,
-                   int *active_high_low, char **link, irq_lookup_func func)
+                   int *triggering,
+                   int *polarity, char **link, irq_lookup_func func)
 {
        struct pci_dev *bridge = dev;
        int irq = -1;
@@ -375,7 +375,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
                }
 
                irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
-                                         pin, edge_level, active_high_low,
+                                         pin, triggering, polarity,
                                          link, func);
        }
 
@@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
 {
        int irq = 0;
        u8 pin = 0;
-       int edge_level = ACPI_LEVEL_SENSITIVE;
-       int active_high_low = ACPI_ACTIVE_LOW;
+       int triggering = ACPI_LEVEL_SENSITIVE;
+       int polarity = ACPI_ACTIVE_LOW;
        char *link = NULL;
        int rc;
 
@@ -432,7 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
         * values override any BIOS-assigned IRQs set during boot.
         */
        irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
-                                 &edge_level, &active_high_low, &link,
+                                 &triggering, &polarity, &link,
                                  acpi_pci_allocate_irq);
 
        /*
@@ -440,8 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
         * device's parent bridge.
         */
        if (irq < 0)
-               irq = acpi_pci_irq_derive(dev, pin, &edge_level,
-                                         &active_high_low, &link,
+               irq = acpi_pci_irq_derive(dev, pin, &triggering,
+                                         &polarity, &link,
                                          acpi_pci_allocate_irq);
 
        /*
@@ -463,7 +463,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
                }
        }
 
-       rc = acpi_register_gsi(irq, edge_level, active_high_low);
+       rc = acpi_register_gsi(irq, triggering, polarity);
        if (rc < 0) {
                printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
                       "to register GSI\n", pci_name(dev), ('A' + pin));
@@ -478,8 +478,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
                printk("Link [%s] -> ", link);
 
        printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
-              (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
-              (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
+              (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
+              (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
 
        return_VALUE(0);
 }
@@ -495,8 +495,8 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
 {
        int gsi = 0;
        u8 pin = 0;
-       int edge_level = ACPI_LEVEL_SENSITIVE;
-       int active_high_low = ACPI_ACTIVE_LOW;
+       int triggering = ACPI_LEVEL_SENSITIVE;
+       int polarity = ACPI_ACTIVE_LOW;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
 
@@ -512,7 +512,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
         * First we check the PCI IRQ routing table (PRT) for an IRQ.
         */
        gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
-                                 &edge_level, &active_high_low, NULL,
+                                 &triggering, &polarity, NULL,
                                  acpi_pci_free_irq);
        /*
         * If no PRT entry was found, we'll try to derive an IRQ from the
@@ -520,7 +520,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
         */
        if (gsi < 0)
                gsi = acpi_pci_irq_derive(dev, pin,
-                                         &edge_level, &active_high_low, NULL,
+                                         &triggering, &polarity, NULL,
                                          acpi_pci_free_irq);
        if (gsi < 0)
                return_VOID;
index 78927c0f155102a01f3acf97b87887819bfc546f..1ffc771153679c2dbd247d124b2a2d9ef71a7723 100644 (file)
@@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = {
  */
 struct acpi_pci_link_irq {
        u8 active;              /* Current IRQ */
-       u8 edge_level;          /* All IRQs */
-       u8 active_high_low;     /* All IRQs */
+       u8 triggering;          /* All IRQs */
+       u8 polarity;    /* All IRQs */
        u8 resource_type;
        u8 possible_count;
        u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
@@ -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->id) {
-       case ACPI_RSTYPE_START_DPF:
+       switch (resource->type) {
+       case ACPI_RESOURCE_TYPE_START_DEPENDENT:
                return_ACPI_STATUS(AE_OK);
-       case ACPI_RSTYPE_IRQ:
+       case ACPI_RESOURCE_TYPE_IRQ:
                {
                        struct acpi_resource_irq *p = &resource->data.irq;
-                       if (!p || !p->number_of_interrupts) {
+                       if (!p || !p->interrupt_count) {
                                ACPI_DEBUG_PRINT((ACPI_DB_WARN,
                                                  "Blank IRQ resource\n"));
                                return_ACPI_STATUS(AE_OK);
                        }
                        for (i = 0;
-                            (i < p->number_of_interrupts
+                            (i < p->interrupt_count
                              && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
                                if (!p->interrupts[i]) {
                                        ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -131,22 +131,22 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
                                link->irq.possible[i] = p->interrupts[i];
                                link->irq.possible_count++;
                        }
-                       link->irq.edge_level = p->edge_level;
-                       link->irq.active_high_low = p->active_high_low;
-                       link->irq.resource_type = ACPI_RSTYPE_IRQ;
+                       link->irq.triggering = p->triggering;
+                       link->irq.polarity = p->polarity;
+                       link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ;
                        break;
                }
-       case ACPI_RSTYPE_EXT_IRQ:
+       case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
                {
-                       struct acpi_resource_ext_irq *p =
+                       struct acpi_resource_extended_irq *p =
                            &resource->data.extended_irq;
-                       if (!p || !p->number_of_interrupts) {
+                       if (!p || !p->interrupt_count) {
                                ACPI_DEBUG_PRINT((ACPI_DB_WARN,
                                                  "Blank EXT IRQ resource\n"));
                                return_ACPI_STATUS(AE_OK);
                        }
                        for (i = 0;
-                            (i < p->number_of_interrupts
+                            (i < p->interrupt_count
                              && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
                                if (!p->interrupts[i]) {
                                        ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -157,9 +157,9 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
                                link->irq.possible[i] = p->interrupts[i];
                                link->irq.possible_count++;
                        }
-                       link->irq.edge_level = p->edge_level;
-                       link->irq.active_high_low = p->active_high_low;
-                       link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ;
+                       link->irq.triggering = p->triggering;
+                       link->irq.polarity = p->polarity;
+                       link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
                        break;
                }
        default:
@@ -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->id) {
-       case ACPI_RSTYPE_IRQ:
+       switch (resource->type) {
+       case ACPI_RESOURCE_TYPE_IRQ:
                {
                        struct acpi_resource_irq *p = &resource->data.irq;
-                       if (!p || !p->number_of_interrupts) {
+                       if (!p || !p->interrupt_count) {
                                /*
                                 * IRQ descriptors may have no IRQ# bits set,
                                 * particularly those those w/ _STA disabled
@@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
                        *irq = p->interrupts[0];
                        break;
                }
-       case ACPI_RSTYPE_EXT_IRQ:
+       case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
                {
-                       struct acpi_resource_ext_irq *p =
+                       struct acpi_resource_extended_irq *p =
                            &resource->data.extended_irq;
-                       if (!p || !p->number_of_interrupts) {
+                       if (!p || !p->interrupt_count) {
                                /*
                                 * extended IRQ descriptors must
                                 * return at least 1 IRQ
@@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
        buffer.pointer = resource;
 
        switch (link->irq.resource_type) {
-       case ACPI_RSTYPE_IRQ:
-               resource->res.id = ACPI_RSTYPE_IRQ;
+       case ACPI_RESOURCE_TYPE_IRQ:
+               resource->res.type = ACPI_RESOURCE_TYPE_IRQ;
                resource->res.length = sizeof(struct acpi_resource);
-               resource->res.data.irq.edge_level = link->irq.edge_level;
-               resource->res.data.irq.active_high_low =
-                   link->irq.active_high_low;
-               if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
-                       resource->res.data.irq.shared_exclusive =
+               resource->res.data.irq.triggering = link->irq.triggering;
+               resource->res.data.irq.polarity =
+                   link->irq.polarity;
+               if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
+                       resource->res.data.irq.sharable =
                            ACPI_EXCLUSIVE;
                else
-                       resource->res.data.irq.shared_exclusive = ACPI_SHARED;
-               resource->res.data.irq.number_of_interrupts = 1;
+                       resource->res.data.irq.sharable = ACPI_SHARED;
+               resource->res.data.irq.interrupt_count = 1;
                resource->res.data.irq.interrupts[0] = irq;
                break;
 
-       case ACPI_RSTYPE_EXT_IRQ:
-               resource->res.id = ACPI_RSTYPE_EXT_IRQ;
+       case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+               resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
                resource->res.length = sizeof(struct acpi_resource);
                resource->res.data.extended_irq.producer_consumer =
                    ACPI_CONSUMER;
-               resource->res.data.extended_irq.edge_level =
-                   link->irq.edge_level;
-               resource->res.data.extended_irq.active_high_low =
-                   link->irq.active_high_low;
-               if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
-                       resource->res.data.irq.shared_exclusive =
+               resource->res.data.extended_irq.triggering =
+                   link->irq.triggering;
+               resource->res.data.extended_irq.polarity =
+                   link->irq.polarity;
+               if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
+                       resource->res.data.irq.sharable =
                            ACPI_EXCLUSIVE;
                else
-                       resource->res.data.irq.shared_exclusive = ACPI_SHARED;
-               resource->res.data.extended_irq.number_of_interrupts = 1;
+                       resource->res.data.irq.sharable = ACPI_SHARED;
+               resource->res.data.extended_irq.interrupt_count = 1;
                resource->res.data.extended_irq.interrupts[0] = irq;
                /* ignore resource_source, it's optional */
                break;
@@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
                goto end;
 
        }
-       resource->end.id = ACPI_RSTYPE_END_TAG;
+       resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
 
        /* Attempt to set the resource */
        status = acpi_set_current_resources(link->handle, &buffer);
@@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
 int
 acpi_pci_link_allocate_irq(acpi_handle handle,
                           int index,
-                          int *edge_level, int *active_high_low, char **name)
+                          int *triggering, int *polarity, char **name)
 {
        int result = 0;
        struct acpi_device *device = NULL;
@@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
        link->refcnt++;
        up(&acpi_link_lock);
 
-       if (edge_level)
-               *edge_level = link->irq.edge_level;
-       if (active_high_low)
-               *active_high_low = link->irq.active_high_low;
+       if (triggering)
+               *triggering = link->irq.triggering;
+       if (polarity)
+               *polarity = link->irq.polarity;
        if (name)
                *name = acpi_device_bid(link->device);
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
index 0fd9988c283d199f3a3d5d9a6f14369198d73474..4c313eab6313d94ff6e345555fa1eb53e24bedd0 100644 (file)
@@ -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->id != ACPI_RSTYPE_ADDRESS16 &&
-           resource->id != ACPI_RSTYPE_ADDRESS32 &&
-           resource->id != ACPI_RSTYPE_ADDRESS64)
+       if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
+           resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
+           resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
                return AE_OK;
 
        acpi_resource_to_address64(resource, &address);
        if ((address.address_length > 0) &&
            (address.resource_type == ACPI_BUS_NUMBER_RANGE))
-               *busnr = address.min_address_range;
+               *busnr = address.minimum;
 
        return AE_OK;
 }
index 2130b74170c3ee7048b00e8800d27045f8f14e55..8de4f69dfa095f8120e6f72f19596129dda17fd3 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-obj-y := rsaddr.o  rscreate.o  rsio.o   rslist.o    rsmisc.o   rsxface.o \
+obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \
         rscalc.o  rsirq.o  rsmemory.o  rsutils.o
 
 obj-$(ACPI_FUTURE_USAGE) += rsdump.o
index 23b54baa0cb2ebd6e451fff26967ba79b2b00eba..4ac942badbc00130d3bafba244b24d383a0b3b77 100644 (file)
 #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);
-
 /*******************************************************************************
  *
- * 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
+ * acpi_rs_convert_address16 - All WORD (16-bit) address resources
  *
  ******************************************************************************/
+struct acpi_rsconvert_info acpi_rs_convert_address16[5] = {
+       {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16,
+        ACPI_RS_SIZE(struct acpi_resource_address16),
+        ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address16)},
 
-static void
-acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags)
-{
-       ACPI_FUNCTION_ENTRY();
-
-       /* Producer / Consumer - flag bit[0] */
-
-       resource->address.producer_consumer = (u32) (flags & 0x01);
+       {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16,
+        sizeof(struct aml_resource_address16),
+        0},
 
-       /* Decode (_DEC) - flag bit[1] */
+       /* Resource Type, General Flags, and Type-Specific Flags */
 
-       resource->address.decode = (u32) ((flags >> 1) & 0x01);
+       {ACPI_RSC_ADDRESS, 0, 0, 0},
 
-       /* Min Address Fixed (_MIF) - flag bit[2] */
+       /*
+        * 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.min_address_fixed = (u32) ((flags >> 2) & 0x01);
+       /* Optional resource_source (Index and String) */
 
-       /* Max Address Fixed (_MAF) - flag bit[3] */
-
-       resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01);
-}
+       {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address16.resource_source),
+        0,
+        sizeof(struct aml_resource_address16)}
+};
 
 /*******************************************************************************
  *
- * 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
+ * acpi_rs_convert_address32 - All DWORD (32-bit) address resources
  *
  ******************************************************************************/
 
-static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource)
-{
-       u8 flags;
-
-       ACPI_FUNCTION_ENTRY();
-
-       /* Producer / Consumer - flag bit[0] */
-
-       flags = (u8) (resource->address.producer_consumer & 0x01);
-
-       /* Decode (_DEC) - flag bit[1] */
-
-       flags |= (u8) ((resource->address.decode & 0x01) << 1);
-
-       /* Min Address Fixed (_MIF) - flag bit[2] */
-
-       flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2);
+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)},
 
-       /* Max Address Fixed (_MAF) - flag bit[3] */
+       {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32,
+        sizeof(struct aml_resource_address32),
+        0},
 
-       flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3);
+       /* Resource Type, General Flags, and Type-Specific Flags */
 
-       return (flags);
-}
-
-/*******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
+       {ACPI_RSC_ADDRESS, 0, 0, 0},
 
-static void
-acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags)
-{
-       ACPI_FUNCTION_ENTRY();
-
-       if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
-               /* Write Status (_RW) - flag bit[0] */
-
-               resource->address.attribute.memory.read_write_attribute =
-                   (u16) (flags & 0x01);
-
-               /* Memory Attributes (_MEM) - flag bits[2:1] */
-
-               resource->address.attribute.memory.cache_attribute =
-                   (u16) ((flags >> 1) & 0x03);
-       } else if (resource->address.resource_type == ACPI_IO_RANGE) {
-               /* Ranges (_RNG) - flag bits[1:0] */
-
-               resource->address.attribute.io.range_attribute =
-                   (u16) (flags & 0x03);
+       /*
+        * 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},
 
-               /* Translations (_TTP and _TRS) - flag bits[5:4] */
+       /* Optional resource_source (Index and String) */
 
-               resource->address.attribute.io.translation_attribute =
-                   (u16) ((flags >> 4) & 0x03);
-       }
-}
+       {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address32.resource_source),
+        0,
+        sizeof(struct aml_resource_address32)}
+};
 
 /*******************************************************************************
  *
- * 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.
+ * acpi_rs_convert_address64 - All QWORD (64-bit) address resources
  *
  ******************************************************************************/
 
-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] */
+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)},
 
-               flags = (u8)
-                   (resource->address.attribute.memory.
-                    read_write_attribute & 0x01);
+       {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64,
+        sizeof(struct aml_resource_address64),
+        0},
 
-               /* Memory Attributes (_MEM) - flag bits[2:1] */
+       /* Resource Type, General Flags, and Type-Specific Flags */
 
-               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] */
+       {ACPI_RSC_ADDRESS, 0, 0, 0},
 
-               flags = (u8)
-                   (resource->address.attribute.io.range_attribute & 0x03);
+       /*
+        * 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},
 
-               /* Translations (_TTP and _TRS) - flag bits[5:4] */
+       /* Optional resource_source (Index and String) */
 
-               flags |= (u8)
-                   ((resource->address.attribute.io.
-                     translation_attribute & 0x03) << 4);
-       }
-
-       return (flags);
-}
+       {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address64.resource_source),
+        0,
+        sizeof(struct aml_resource_address64)}
+};
 
 /*******************************************************************************
  *
- * 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_rs_convert_ext_address64 - All Extended (64-bit) address resources
  *
  ******************************************************************************/
 
-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) */
+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)},
 
-       buffer += 2;
-       temp8 = *buffer;
+       {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
+        sizeof(struct aml_resource_extended_address64),
+        0},
 
-       /* Values 0-2 and 0xC0-0xFF are valid */
+       /* Resource Type, General Flags, and Type-Specific Flags */
 
-       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) */
+       {ACPI_RSC_ADDRESS, 0, 0, 0},
 
-       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;
+       /* Revision ID */
 
+       {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD),
+        AML_OFFSET(ext_address64.revision_iD),
+        1},
        /*
-        * 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.
+        * 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
         */
-       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_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity),
+        AML_OFFSET(ext_address64.granularity),
+        6}
+};
 
 /*******************************************************************************
  *
- * 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
+ * acpi_rs_convert_general_flags - Flags common to all address descriptors
  *
  ******************************************************************************/
 
-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 */
+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_MOVE_32_TO_16(buffer,
-                          &linked_list->data.address16.min_address_range);
-       buffer += 2;
+       /* Resource Type (Memory, Io, bus_number, etc.) */
 
-       /* Set the address range maximum */
+       {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.address.resource_type),
+        AML_OFFSET(address.resource_type),
+        1},
 
-       ACPI_MOVE_32_TO_16(buffer,
-                          &linked_list->data.address16.max_address_range);
-       buffer += 2;
+       /* General Flags - Consume, Decode, min_fixed, max_fixed */
 
-       /* Set the address translation offset */
+       {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer),
+        AML_OFFSET(address.flags),
+        0},
 
-       ACPI_MOVE_32_TO_16(buffer,
-                          &linked_list->data.address16.
-                          address_translation_offset);
-       buffer += 2;
+       {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.decode),
+        AML_OFFSET(address.flags),
+        1},
 
-       /* Set the address length */
+       {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.min_address_fixed),
+        AML_OFFSET(address.flags),
+        2},
 
-       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_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.max_address_fixed),
+        AML_OFFSET(address.flags),
+        3}
+};
 
 /*******************************************************************************
  *
- * 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.
+ * acpi_rs_convert_mem_flags - Flags common to Memory address descriptors
  *
  ******************************************************************************/
 
-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);
+static struct acpi_rsconvert_info acpi_rs_convert_mem_flags[5] = {
+       {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags),
+        ACPI_RSC_TABLE_SIZE(acpi_rs_convert_mem_flags)},
 
-       ACPI_FUNCTION_TRACE("rs_address32_resource");
+       /* Memory-specific flags */
 
-       /* Get the Descriptor Length field */
+       {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.write_protect),
+        AML_OFFSET(address.specific_flags),
+        0},
 
-       buffer += 1;
-       ACPI_MOVE_16_TO_16(&temp16, buffer);
+       {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.caching),
+        AML_OFFSET(address.specific_flags),
+        1},
 
-       /* Validate minimum descriptor length */
+       {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.range_type),
+        AML_OFFSET(address.specific_flags),
+        3},
 
-       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_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.translation),
+        AML_OFFSET(address.specific_flags),
+        5}
+};
 
 /*******************************************************************************
  *
- * 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
+ * acpi_rs_convert_io_flags - Flags common to I/O address descriptors
  *
  ******************************************************************************/
 
-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;
+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)},
 
-       /* Resource Source Index and Resource Source are optional */
+       /* I/O-specific flags */
 
-       if (linked_list->data.address32.resource_source.string_length) {
-               *buffer =
-                   (u8) linked_list->data.address32.resource_source.index;
-               buffer += 1;
+       {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.io.range_type),
+        AML_OFFSET(address.specific_flags),
+        0},
 
-               /* Copy the resource_source string */
+       {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.io.translation),
+        AML_OFFSET(address.specific_flags),
+        4},
 
-               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);
-}
+       {ACPI_RSC_1BITFLAG,
+        ACPI_RS_OFFSET(data.address.info.io.translation_type),
+        AML_OFFSET(address.specific_flags),
+        5}
+};
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_rs_address64_resource
+ * FUNCTION:    acpi_rs_get_address_common
  *
- * PARAMETERS:  byte_stream_buffer      - Pointer to the resource input byte
- *                                        stream
- *              bytes_consumed          - Pointer to where the number of bytes
- *                                        consumed the byte_stream_buffer is
- *                                        returned
- *              output_buffer           - Pointer to the return data buffer
- *              structure_size          - Pointer to where the number of bytes
- *                                        in the return data struct is returned
+ * PARAMETERS:  Resource            - Pointer to the internal resource struct
+ *              Aml                 - Pointer to the AML resource descriptor
  *
- * RETURN:      Status
+ * RETURN:      TRUE if the resource_type field is OK, FALSE otherwise
  *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- *              structure pointed to by the output_buffer. Return the
- *              number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
+ *              to an internal resource descriptor
  *
  ******************************************************************************/
 
-acpi_status
-acpi_rs_address64_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)
 {
-       u16 temp16;
-       u8 temp8;
-       u8 resource_type;
-       u8 *temp_ptr;
-       u32 index;
-       u8 *buffer = byte_stream_buffer;
-       struct acpi_resource *output_struct = (void *)*output_buffer;
-       acpi_size struct_size =
-           ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64);
-
-       ACPI_FUNCTION_TRACE("rs_address64_resource");
-
-       /* Get the Descriptor Type */
-
-       resource_type = *buffer;
-
-       /* Get the Descriptor Length field */
-
-       buffer += 1;
-       ACPI_MOVE_16_TO_16(&temp16, buffer);
-
-       /* Validate minimum descriptor length */
-
-       if (temp16 < 43) {
-               return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
-       }
-
-       *bytes_consumed = temp16 + 3;
-       output_struct->id = ACPI_RSTYPE_ADDRESS64;
-
-       /* 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.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);
+       ACPI_FUNCTION_ENTRY();
 
-       if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) {
-               /* Move past revision_id and Reserved byte */
+       /* Validate the Resource Type */
 
-               buffer += 2;
+       if ((aml->address.resource_type > 2)
+           && (aml->address.resource_type < 0xC0)) {
+               return (FALSE);
        }
 
-       /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */
-
-       buffer += 1;
-       ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer);
-
-       /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */
-
-       buffer += 8;
-       ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range,
-                          buffer);
-
-       /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */
-
-       buffer += 8;
-       ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range,
-                          buffer);
-
-       /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */
-
-       buffer += 8;
-       ACPI_MOVE_64_TO_64(&output_struct->data.address64.
-                          address_translation_offset, buffer);
+       /* Get the Resource Type and General Flags */
 
-       /* Get address_length (Bytes 38-45) or (Bytes 40-47) */
+       (void)acpi_rs_convert_aml_to_resource(resource, aml,
+                                             acpi_rs_convert_general_flags);
 
-       buffer += 8;
-       ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length,
-                          buffer);
+       /* Get the Type-Specific Flags (Memory and I/O descriptors only) */
 
-       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);
+       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 {
-               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.
-                */