Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 3 Feb 2006 02:51:52 +0000 (21:51 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 3 Feb 2006 02:51:52 +0000 (21:51 -0500)
271 files changed:
Documentation/kernel-parameters.txt
Documentation/sound/alsa/ALSA-Configuration.txt
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
arch/i386/kernel/acpi/Makefile
arch/i386/kernel/acpi/boot.c
arch/i386/kernel/acpi/cstate.c
arch/i386/kernel/acpi/processor.c [new file with mode: 0644]
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
arch/i386/kernel/mpparse.c
arch/ia64/kernel/Makefile
arch/ia64/kernel/acpi-ext.c
arch/ia64/kernel/acpi-processor.c [new file with mode: 0644]
arch/ia64/kernel/acpi.c
arch/ia64/kernel/cpufreq/Makefile
arch/ia64/kernel/cpufreq/acpi-cpufreq.c
arch/ia64/pci/pci.c
arch/powerpc/platforms/pseries/pci_dlpar.c
arch/x86_64/kernel/acpi/Makefile
arch/x86_64/kernel/acpi/processor.c [new file with mode: 0644]
arch/x86_64/kernel/io_apic.c
arch/x86_64/kernel/mpparse.c
drivers/acpi/Kconfig
drivers/acpi/acpi_memhotplug.c
drivers/acpi/asus_acpi.c
drivers/acpi/dispatcher/dsfield.c
drivers/acpi/dispatcher/dsinit.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsopcode.c
drivers/acpi/dispatcher/dsutils.c
drivers/acpi/dispatcher/dswexec.c
drivers/acpi/dispatcher/dswload.c
drivers/acpi/dispatcher/dswscope.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/ec.c
drivers/acpi/events/evevent.c
drivers/acpi/events/evgpe.c
drivers/acpi/events/evgpeblk.c
drivers/acpi/events/evmisc.c
drivers/acpi/events/evregion.c
drivers/acpi/events/evrgnini.c
drivers/acpi/events/evsci.c
drivers/acpi/events/evxface.c
drivers/acpi/events/evxfevnt.c
drivers/acpi/events/evxfregn.c
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exconvrt.c
drivers/acpi/executer/excreate.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exfield.c
drivers/acpi/executer/exfldio.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exmutex.c
drivers/acpi/executer/exnames.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exoparg2.c
drivers/acpi/executer/exoparg3.c
drivers/acpi/executer/exoparg6.c
drivers/acpi/executer/exprep.c
drivers/acpi/executer/exregion.c
drivers/acpi/executer/exresnte.c
drivers/acpi/executer/exresolv.c
drivers/acpi/executer/exresop.c
drivers/acpi/executer/exstore.c
drivers/acpi/executer/exstoren.c
drivers/acpi/executer/exstorob.c
drivers/acpi/executer/exsystem.c
drivers/acpi/executer/exutils.c
drivers/acpi/glue.c
drivers/acpi/hardware/hwacpi.c
drivers/acpi/hardware/hwgpe.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/hardware/hwsleep.c
drivers/acpi/hardware/hwtimer.c
drivers/acpi/motherboard.c
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsalloc.c
drivers/acpi/namespace/nsdump.c
drivers/acpi/namespace/nsdumpdv.c
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsinit.c
drivers/acpi/namespace/nsload.c
drivers/acpi/namespace/nsnames.c
drivers/acpi/namespace/nsobject.c
drivers/acpi/namespace/nsparse.c
drivers/acpi/namespace/nssearch.c
drivers/acpi/namespace/nsutils.c
drivers/acpi/namespace/nswalk.c
drivers/acpi/namespace/nsxfeval.c
drivers/acpi/namespace/nsxfname.c
drivers/acpi/namespace/nsxfobj.c
drivers/acpi/osl.c
drivers/acpi/parser/psargs.c
drivers/acpi/parser/psloop.c
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/psscope.c
drivers/acpi/parser/pstree.c
drivers/acpi/parser/psutils.c
drivers/acpi/parser/pswalk.c
drivers/acpi/parser/psxface.c
drivers/acpi/pci_irq.c
drivers/acpi/pci_link.c
drivers/acpi/pci_root.c
drivers/acpi/processor_core.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/processor_thermal.c
drivers/acpi/processor_throttling.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/sleep/poweroff.c
drivers/acpi/sleep/sleep.h
drivers/acpi/sleep/wakeup.c
drivers/acpi/tables/tbconvrt.c
drivers/acpi/tables/tbget.c
drivers/acpi/tables/tbgetall.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/tables/tbrsdt.c
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxface.c
drivers/acpi/tables/tbxfroot.c
drivers/acpi/utilities/Makefile
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utcache.c
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/utdebug.c
drivers/acpi/utilities/utdelete.c
drivers/acpi/utilities/uteval.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utinit.c
drivers/acpi/utilities/utmath.c
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utmutex.c
drivers/acpi/utilities/utobject.c
drivers/acpi/utilities/utresrc.c [new file with mode: 0644]
drivers/acpi/utilities/utstate.c
drivers/acpi/utilities/utxface.c
drivers/acpi/video.c
drivers/char/drm/ati_pcigart.c
drivers/char/drm/drmP.h
drivers/char/drm/drm_auth.c
drivers/char/drm/drm_bufs.c
drivers/char/drm/drm_context.c
drivers/char/drm/drm_drv.c
drivers/char/drm/drm_fops.c
drivers/char/drm/drm_ioctl.c
drivers/char/drm/drm_irq.c
drivers/char/drm/drm_pciids.h
drivers/char/drm/drm_proc.c
drivers/char/drm/drm_stub.c
drivers/char/drm/drm_vm.c
drivers/char/drm/i810_dma.c
drivers/char/drm/i810_drv.h
drivers/char/drm/i830_dma.c
drivers/char/drm/i830_drv.h
drivers/char/drm/i915_dma.c
drivers/char/drm/i915_drm.h
drivers/char/drm/i915_drv.h
drivers/char/drm/i915_mem.c
drivers/char/drm/radeon_cp.c
drivers/char/drm/savage_bci.c
drivers/char/drm/savage_drv.h
drivers/char/drm/via_dma.c
drivers/char/drm/via_dmablit.c
drivers/char/drm/via_drv.h
drivers/char/drm/via_irq.c
drivers/char/hpet.c
drivers/ide/pci/sgiioc4.c
drivers/md/dm-log.c
drivers/md/md.c
drivers/md/raid6main.c
drivers/pci/hotplug/rpaphp_slot.c
drivers/pnp/card.c
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpacpi/rsparser.c
drivers/serial/8250_acpi.c
fs/cifs/connect.c
fs/cifs/file.c
fs/cifs/transport.c
fs/compat.c
include/acpi/acconfig.h
include/acpi/acdebug.h
include/acpi/acdisasm.h
include/acpi/acdispat.h
include/acpi/acevents.h
include/acpi/acexcep.h
include/acpi/acglobal.h
include/acpi/achware.h
include/acpi/acinterp.h
include/acpi/aclocal.h
include/acpi/acmacros.h
include/acpi/acnames.h
include/acpi/acnamesp.h
include/acpi/acobject.h
include/acpi/acopcode.h
include/acpi/acoutput.h
include/acpi/acparser.h
include/acpi/acpi.h
include/acpi/acpi_drivers.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acresrc.h
include/acpi/acstruct.h
include/acpi/actables.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actypes.h
include/acpi/acutils.h
include/acpi/amlcode.h
include/acpi/amlresrc.h
include/acpi/pdc_intel.h
include/acpi/platform/acenv.h
include/acpi/platform/acgcc.h
include/acpi/platform/aclinux.h
include/acpi/processor.h
include/asm-i386/acpi.h
include/asm-x86_64/mpspec.h
include/linux/acpi.h
include/linux/kernel.h
include/linux/reboot.h
include/linux/syscalls.h
kernel/power/disk.c
kernel/power/main.c
kernel/sys.c
sound/core/info.c
sound/drivers/serial-u16550.c
sound/isa/cmi8330.c
sound/isa/cs423x/cs4236.c
sound/isa/es18xx.c
sound/isa/gus/gusclassic.c
sound/isa/opl3sa2.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sb/sb16.c
sound/isa/sscape.c
sound/isa/wavefront/wavefront.c
sound/isa/wavefront/wavefront_synth.c
sound/pci/ac97/ac97_patch.c
sound/pci/ali5451/ali5451.c
sound/pci/au88x0/au88x0_eq.c
sound/pci/bt87x.c
sound/pci/ca0106/ca0106_main.c
sound/pci/cs46xx/dsp_spos_scb_lib.c
sound/pci/cs5535audio/cs5535audio.c
sound/pci/emu10k1/emumixer.c
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_si3054.c
sound/pci/hda/patch_sigmatel.c
sound/pci/intel8x0.c
sound/pci/pcxhr/pcxhr.c
sound/pci/rme9652/hdspm.c
sound/pci/trident/trident.c
sound/pci/via82xx.c
sound/pci/ymfpci/ymfpci_main.c
sound/usb/usbaudio.c

index 1cbcf65b764b47137b0db013654e55f224c3c32c..84370363da809a67733cd346e429af2e56bef91c 100644 (file)
@@ -452,6 +452,11 @@ running once the system is up.
 
        eata=           [HW,SCSI]
 
+       ec_intr=        [HW,ACPI] ACPI Embedded Controller interrupt mode
+                       Format: <int>
+                       0: polling mode
+                       non-0: interrupt mode (default)
+
        eda=            [HW,PS2]
 
        edb=            [HW,PS2]
index d2578013e8291931a5644317de55c92af652e865..36b511c7cade9aee50d70cac03fd977a28f0660c 100644 (file)
@@ -837,8 +837,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
 
     Module for AC'97 motherboards from Intel and compatibles.
                        * Intel i810/810E, i815, i820, i830, i84x, MX440
+                               ICH5, ICH6, ICH7, ESB2
                        * SiS 7012 (SiS 735)
-                       * NVidia NForce, NForce2
+                       * NVidia NForce, NForce2, NForce3, MCP04, CK804
+                                CK8, CK8S, MCP501
                        * AMD AMD768, AMD8111
                        * ALi m5455
 
@@ -868,6 +870,12 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
   --------------------
 
     Module for Intel ICH (i8x0) chipset MC97 modems.
+                       * Intel i810/810E, i815, i820, i830, i84x, MX440
+                               ICH5, ICH6, ICH7
+                       * SiS 7013 (SiS 735)
+                       * NVidia NForce, NForce2, NForce2s, NForce3
+                       * AMD AMD8111
+                       * ALi m5455
 
     ac97_clock   - AC'97 codec clock base (0 = auto-detect)
 
index e651ed8d1e6f448436cabf1bcfd6cc1fdf863fa4..4251085d38d3a173981867092bf23cc77cb9a8f7 100644 (file)
@@ -5206,14 +5206,14 @@ struct _snd_pcm_runtime {
         You need to pass the <function>snd_dma_pci_data(pci)</function>,
         where pci is the struct <structname>pci_dev</structname> pointer
         of the chip as well.
-        The <type>snd_sg_buf_t</type> instance is created as
+        The <type>struct snd_sg_buf</type> instance is created as
         substream-&gt;dma_private. You can cast
         the pointer like: 
 
         <informalexample>
           <programlisting>
 <![CDATA[
-  struct snd_sg_buf *sgbuf = (struct snd_sg_buf_t*)substream->dma_private;
+  struct snd_sg_buf *sgbuf = (struct snd_sg_buf *)substream->dma_private;
 ]]>
           </programlisting>
         </informalexample>
index 267ca48e1b6c740cc63e86669ee0b992c627cd00..d51c7313cae8ac621c69f4be28718142d12b370e 100644 (file)
@@ -3,6 +3,6 @@ obj-$(CONFIG_X86_IO_APIC)       += earlyquirk.o
 obj-$(CONFIG_ACPI_SLEEP)       += sleep.o wakeup.o
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
-obj-y                          += cstate.o
+obj-y                          += cstate.o processor.o
 endif
 
index 2111529dea77821ff595ce4a21edb369102b9b93..f21fa0d4482f4f5d91d31047c5c402433bb7e8b5 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 4c3036ba65dfeee76f85730e39222d1d10410974..25db49ef1770aa11ce148f1d35789e85bc125151 100644 (file)
 #include <acpi/processor.h>
 #include <asm/acpi.h>
 
-static void acpi_processor_power_init_intel_pdc(struct acpi_processor_power
-                                               *pow)
-{
-       struct acpi_object_list *obj_list;
-       union acpi_object *obj;
-       u32 *buf;
-
-       /* allocate and initialize pdc. It will be used later. */
-       obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
-       if (!obj_list) {
-               printk(KERN_ERR "Memory allocation error\n");
-               return;
-       }
-
-       obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
-       if (!obj) {
-               printk(KERN_ERR "Memory allocation error\n");
-               kfree(obj_list);
-               return;
-       }
-
-       buf = kmalloc(12, GFP_KERNEL);
-       if (!buf) {
-               printk(KERN_ERR "Memory allocation error\n");
-               kfree(obj);
-               kfree(obj_list);
-               return;
-       }
-
-       buf[0] = ACPI_PDC_REVISION_ID;
-       buf[1] = 1;
-       buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
-
-       obj->type = ACPI_TYPE_BUFFER;
-       obj->buffer.length = 12;
-       obj->buffer.pointer = (u8 *) buf;
-       obj_list->count = 1;
-       obj_list->pointer = obj;
-       pow->pdc = obj_list;
-
-       return;
-}
-
-/* Initialize _PDC data based on the CPU vendor */
-void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
-                                  unsigned int cpu)
-{
-       struct cpuinfo_x86 *c = cpu_data + cpu;
-
-       pow->pdc = NULL;
-       if (c->x86_vendor == X86_VENDOR_INTEL)
-               acpi_processor_power_init_intel_pdc(pow);
-
-       return;
-}
-
-EXPORT_SYMBOL(acpi_processor_power_init_pdc);
-
 /*
  * Initialize bm_flags based on the CPU cache properties
  * On SMP it depends on cache configuration
diff --git a/arch/i386/kernel/acpi/processor.c b/arch/i386/kernel/acpi/processor.c
new file mode 100644 (file)
index 0000000..9f4cc02
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * arch/i386/kernel/acpi/processor.c
+ *
+ * Copyright (C) 2005 Intel Corporation
+ *     Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
+ *     - Added _PDC for platforms with Intel CPUs
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/acpi.h>
+
+#include <acpi/processor.h>
+#include <asm/acpi.h>
+
+static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
+{
+       struct acpi_object_list *obj_list;
+       union acpi_object *obj;
+       u32 *buf;
+
+       /* allocate and initialize pdc. It will be used later. */
+       obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
+       if (!obj_list) {
+               printk(KERN_ERR "Memory allocation error\n");
+               return;
+       }
+
+       obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
+       if (!obj) {
+               printk(KERN_ERR "Memory allocation error\n");
+               kfree(obj_list);
+               return;
+       }
+
+       buf = kmalloc(12, GFP_KERNEL);
+       if (!buf) {
+               printk(KERN_ERR "Memory allocation error\n");
+               kfree(obj);
+               kfree(obj_list);
+               return;
+       }
+
+       buf[0] = ACPI_PDC_REVISION_ID;
+       buf[1] = 1;
+       buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
+
+       if (cpu_has(c, X86_FEATURE_EST))
+               buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
+
+       obj->type = ACPI_TYPE_BUFFER;
+       obj->buffer.length = 12;
+       obj->buffer.pointer = (u8 *) buf;
+       obj_list->count = 1;
+       obj_list->pointer = obj;
+       pr->pdc = obj_list;
+
+       return;
+}
+
+/* Initialize _PDC data based on the CPU vendor */
+void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
+{
+       unsigned int cpu = pr->id;
+       struct cpuinfo_x86 *c = cpu_data + cpu;
+
+       pr->pdc = NULL;
+       if (c->x86_vendor == X86_VENDOR_INTEL)
+               init_intel_pdc(pr, c);
+
+       return;
+}
+
+EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
index 7975e79d5fa4e6e607117bc7b5b2fbd7e0e37389..3852d0a4c1b5e2f35dc168399d12b97882ca8938 100644 (file)
@@ -295,68 +295,6 @@ acpi_cpufreq_guess_freq (
 }
 
 
-/* 
- * acpi_processor_cpu_init_pdc_est - let BIOS know about the SMP capabilities
- * of this driver
- * @perf: processor-specific acpi_io_data struct
- * @cpu: CPU being initialized
- *
- * To avoid issues with legacy OSes, some BIOSes require to be informed of
- * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC 
- * accordingly, for Enhanced Speedstep. Actual call to _PDC is done in
- * driver/acpi/processor.c
- */
-static void 
-acpi_processor_cpu_init_pdc_est(
-               struct acpi_processor_performance *perf, 
-               unsigned int cpu,
-               struct acpi_object_list *obj_list
-               )
-{
-       union acpi_object *obj;
-       u32 *buf;
-       struct cpuinfo_x86 *c = cpu_data + cpu;
-       dprintk("acpi_processor_cpu_init_pdc_est\n");
-
-       if (!cpu_has(c, X86_FEATURE_EST))
-               return;
-
-       /* Initialize pdc. It will be used later. */
-       if (!obj_list)
-               return;
-               
-       if (!(obj_list->count && obj_list->pointer))
-               return;
-
-       obj = obj_list->pointer;
-       if ((obj->buffer.length == 12) && obj->buffer.pointer) {
-               buf = (u32 *)obj->buffer.pointer;
-                       buf[0] = ACPI_PDC_REVISION_ID;
-                       buf[1] = 1;
-                       buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
-               perf->pdc = obj_list;
-       }
-       return;
-}
-
-/* CPU specific PDC initialization */
-static void 
-acpi_processor_cpu_init_pdc(
-               struct acpi_processor_performance *perf, 
-               unsigned int cpu,
-               struct acpi_object_list *obj_list
-               )
-{
-       struct cpuinfo_x86 *c = cpu_data + cpu;
-       dprintk("acpi_processor_cpu_init_pdc\n");
-       perf->pdc = NULL;
-       if (cpu_has(c, X86_FEATURE_EST))
-               acpi_processor_cpu_init_pdc_est(perf, cpu, obj_list);
-       return;
-}
-
-
 static int
 acpi_cpufreq_cpu_init (
        struct cpufreq_policy   *policy)
@@ -367,14 +305,7 @@ acpi_cpufreq_cpu_init (
        unsigned int            result = 0;
        struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
 
-       union acpi_object               arg0 = {ACPI_TYPE_BUFFER};
-       u32                             arg0_buf[3];
-       struct acpi_object_list         arg_list = {1, &arg0};
-
        dprintk("acpi_cpufreq_cpu_init\n");
-       /* setup arg_list for _PDC settings */
-        arg0.buffer.length = 12;
-        arg0.buffer.pointer = (u8 *) arg0_buf;
 
        data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
        if (!data)
@@ -382,9 +313,7 @@ acpi_cpufreq_cpu_init (
 
        acpi_io_data[cpu] = data;
 
-       acpi_processor_cpu_init_pdc(&data->acpi_data, cpu, &arg_list);
        result = acpi_processor_register_performance(&data->acpi_data, cpu);
-       data->acpi_data.pdc = NULL;
 
        if (result)
                goto err_free;
index 9a826cde4fd1074838faf4b3890a59567b96a7bf..c173c0fa117a927734bf9c2ee389c1d5f7ada91d 100644 (file)
@@ -362,22 +362,10 @@ static struct acpi_processor_performance p;
  */
 static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
 {
-       union acpi_object               arg0 = {ACPI_TYPE_BUFFER};
-       u32                             arg0_buf[3];
-       struct acpi_object_list         arg_list = {1, &arg0};
        unsigned long                   cur_freq;
        int                             result = 0, i;
        unsigned int                    cpu = policy->cpu;
 
-       /* _PDC settings */
-       arg0.buffer.length = 12;
-       arg0.buffer.pointer = (u8 *) arg0_buf;
-       arg0_buf[0] = ACPI_PDC_REVISION_ID;
-       arg0_buf[1] = 1;
-       arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR;
-
-       p.pdc = &arg_list;
-
        /* register with ACPI core */
        if (acpi_processor_register_performance(&p, cpu)) {
                dprintk(KERN_INFO PFX "obtaining ACPI data failed\n");
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 307514f7a2826207fc5e8da881f64c61c7f8a06c..09a0dbc17fb687bfc6e79ba6377e012246846180 100644 (file)
@@ -13,6 +13,11 @@ obj-$(CONFIG_IA64_BRL_EMU)   += brl_emu.o
 obj-$(CONFIG_IA64_GENERIC)     += acpi-ext.o
 obj-$(CONFIG_IA64_HP_ZX1)      += acpi-ext.o
 obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
+
+ifneq ($(CONFIG_ACPI_PROCESSOR),)
+obj-y                          += acpi-processor.o
+endif
+
 obj-$(CONFIG_IA64_PALINFO)     += palinfo.o
 obj-$(CONFIG_IOSAPIC)          += iosapic.o
 obj-$(CONFIG_MODULES)          += module.o
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;
 }
 
diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c
new file mode 100644 (file)
index 0000000..e683630
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * arch/ia64/kernel/cpufreq/processor.c
+ *
+ * Copyright (C) 2005 Intel Corporation
+ *     Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
+ *     - Added _PDC for platforms with Intel CPUs
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/acpi.h>
+
+#include <acpi/processor.h>
+#include <asm/acpi.h>
+
+static void init_intel_pdc(struct acpi_processor *pr)
+{
+       struct acpi_object_list *obj_list;
+       union acpi_object *obj;
+       u32 *buf;
+
+       /* allocate and initialize pdc. It will be used later. */
+       obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
+       if (!obj_list) {
+               printk(KERN_ERR "Memory allocation error\n");
+               return;
+       }
+
+       obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
+       if (!obj) {
+               printk(KERN_ERR "Memory allocation error\n");
+               kfree(obj_list);
+               return;
+       }
+
+       buf = kmalloc(12, GFP_KERNEL);
+       if (!buf) {
+               printk(KERN_ERR "Memory allocation error\n");
+               kfree(obj);
+               kfree(obj_list);
+               return;
+       }
+
+       buf[0] = ACPI_PDC_REVISION_ID;
+       buf[1] = 1;
+       buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
+
+       obj->type = ACPI_TYPE_BUFFER;
+       obj->buffer.length = 12;
+       obj->buffer.pointer = (u8 *) buf;
+       obj_list->count = 1;
+       obj_list->pointer = obj;
+       pr->pdc = obj_list;
+
+       return;
+}
+
+/* Initialize _PDC data based on the CPU vendor */
+void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
+{
+       pr->pdc = NULL;
+       init_intel_pdc(pr);
+       return;
+}
+
+EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
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 f748d34c02f0b03174d1e21c4684268e25aed42b..4838f2a57c7af7b57f584e8fb34f1bb05958aed5 100644 (file)
@@ -1 +1,2 @@
 obj-$(CONFIG_IA64_ACPI_CPUFREQ)                += acpi-cpufreq.o
+
index da4d5cf80a480eb5b4be0518240db04e44776cf0..5a1bf815282d71fda393b82e6941710afbda0c27 100644 (file)
@@ -269,48 +269,6 @@ acpi_cpufreq_verify (
 }
 
 
-/*
- * processor_init_pdc - let BIOS know about the SMP capabilities
- * of this driver
- * @perf: processor-specific acpi_io_data struct
- * @cpu: CPU being initialized
- *
- * To avoid issues with legacy OSes, some BIOSes require to be informed of
- * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC
- * accordingly. Actual call to _PDC is done in driver/acpi/processor.c
- */
-static void
-processor_init_pdc (
-               struct acpi_processor_performance *perf,
-               unsigned int cpu,
-               struct acpi_object_list *obj_list
-               )
-{
-       union acpi_object *obj;
-       u32 *buf;
-
-       dprintk("processor_init_pdc\n");
-
-       perf->pdc = NULL;
-       /* Initialize pdc. It will be used later. */
-       if (!obj_list)
-               return;
-
-       if (!(obj_list->count && obj_list->pointer))
-               return;
-
-       obj = obj_list->pointer;
-       if ((obj->buffer.length == 12) && obj->buffer.pointer) {
-               buf = (u32 *)obj->buffer.pointer;
-                       buf[0] = ACPI_PDC_REVISION_ID;
-                       buf[1] = 1;
-                       buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
-               perf->pdc = obj_list;
-       }
-       return;
-}
-
-
 static int
 acpi_cpufreq_cpu_init (
        struct cpufreq_policy   *policy)
@@ -320,14 +278,7 @@ acpi_cpufreq_cpu_init (
        struct cpufreq_acpi_io  *data;
        unsigned int            result = 0;
 
-       union acpi_object               arg0 = {ACPI_TYPE_BUFFER};
-       u32                             arg0_buf[3];
-       struct acpi_object_list         arg_list = {1, &arg0};
-
        dprintk("acpi_cpufreq_cpu_init\n");
-       /* setup arg_list for _PDC settings */
-        arg0.buffer.length = 12;
-        arg0.buffer.pointer = (u8 *) arg0_buf;
 
        data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
        if (!data)
@@ -337,9 +288,7 @@ acpi_cpufreq_cpu_init (
 
        acpi_io_data[cpu] = data;
 
-       processor_init_pdc(&data->acpi_data, cpu, &arg_list);
        result = acpi_processor_register_performance(&data->acpi_data, cpu);
-       data->acpi_data.pdc = NULL;
 
        if (result)
                goto err_free;
index d27ecdcb6fca8619405b9ffb1e2004f2186f67ec..0b30ca006286429448e418e7358cbfa4e1ab3dae 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 21934784f93679968076ebf8993c983528ac296b..bdaa8aabdaa64c4388c5ca4d933464a0293aa6f0 100644 (file)
@@ -58,6 +58,7 @@ pcibios_find_pci_bus(struct device_node *dn)
 
        return find_bus_among_children(pdn->phb->bus, dn);
 }
+EXPORT_SYMBOL_GPL(pcibios_find_pci_bus);
 
 /**
  * pcibios_remove_pci_devices - remove all devices under this bus
@@ -106,6 +107,7 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
                }
        }
 }
+EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices);
 
 static int
 pcibios_pci_config_bridge(struct pci_dev *dev)
@@ -172,3 +174,4 @@ pcibios_add_pci_devices(struct pci_bus * bus)
                        pcibios_pci_config_bridge(dev);
        }
 }
+EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
index 7da9ace890bd1337b8fba3d0da149d6a43378fed..4fe97071f2974f28aaa2fb8ab1f9a7ebd292dfed 100644 (file)
@@ -1,3 +1,8 @@
 obj-y                  := boot.o
 boot-y                 := ../../../i386/kernel/acpi/boot.o
 obj-$(CONFIG_ACPI_SLEEP)       += sleep.o wakeup.o
+
+ifneq ($(CONFIG_ACPI_PROCESSOR),)
+obj-y                  += processor.o
+endif
+
diff --git a/arch/x86_64/kernel/acpi/processor.c b/arch/x86_64/kernel/acpi/processor.c
new file mode 100644 (file)
index 0000000..3bdc2ba
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * arch/x86_64/kernel/acpi/processor.c
+ *
+ * Copyright (C) 2005 Intel Corporation
+ *     Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
+ *     - Added _PDC for platforms with Intel CPUs
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/acpi.h>
+
+#include <acpi/processor.h>
+#include <asm/acpi.h>
+
+static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
+{
+       struct acpi_object_list *obj_list;
+       union acpi_object *obj;
+       u32 *buf;
+
+       /* allocate and initialize pdc. It will be used later. */
+       obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
+       if (!obj_list) {
+               printk(KERN_ERR "Memory allocation error\n");
+               return;
+       }
+
+       obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
+       if (!obj) {
+               printk(KERN_ERR "Memory allocation error\n");
+               kfree(obj_list);
+               return;
+       }
+
+       buf = kmalloc(12, GFP_KERNEL);
+       if (!buf) {
+               printk(KERN_ERR "Memory allocation error\n");
+               kfree(obj);
+               kfree(obj_list);
+               return;
+       }
+
+       buf[0] = ACPI_PDC_REVISION_ID;
+       buf[1] = 1;
+       buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
+
+       obj->type = ACPI_TYPE_BUFFER;
+       obj->buffer.length = 12;
+       obj->buffer.pointer = (u8 *) buf;
+       obj_list->count = 1;
+       obj_list->pointer = obj;
+       pr->pdc = obj_list;
+
+       return;
+}
+
+/* Initialize _PDC data based on the CPU vendor */
+void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
+{
+       unsigned int cpu = pr->id;
+       struct cpuinfo_x86 *c = cpu_data + cpu;
+
+       pr->pdc = NULL;
+       if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST))
+               init_intel_pdc(pr, c);
+
+       return;
+}
+
+EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
index e8cf44ef8778dc50adc3d71a92ba7665155da7ff..1a5060b434b8a8858d2be94d3aaa2eb05c4e32fd 100644 (file)
@@ -2027,7 +2027,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;
@@ -2049,8 +2049,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);
@@ -2065,9 +2065,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 6d61945260a8d91b86843f0a8050aec9393bfc27..0cce28c4025b1814a57e467f1bef98e93fdeadce 100644 (file)
@@ -267,7 +267,6 @@ config ACPI_DEBUG
 
 config ACPI_EC
        bool
-       depends on X86
        default y
        help
          This driver is required on some systems for the proper operation of
index 2143609d29362f0b7896c7e5dc07dadfba8a64aa..d882bf87fa968fa191a8f647989ef954f89b581e 100644 (file)
@@ -71,8 +71,8 @@ static struct acpi_driver acpi_memory_device_driver = {
 struct acpi_memory_device {
        acpi_handle handle;
        unsigned int state;     /* State of the memory device */
-       unsigned short cache_attribute; /* memory cache attribute */
-       unsigned short read_write_attribute;    /* memory read/write attribute */
+       unsigned short caching; /* memory cache attribute */
+       unsigned short write_protect;   /* memory read/write attribute */
        u64 start_addr;         /* Memory Range start physical addr */
        u64 end_addr;           /* Memory Range end physical addr */
 };
@@ -97,12 +97,12 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
        if (ACPI_SUCCESS(status)) {
                if (address64.resource_type == ACPI_MEMORY_RANGE) {
                        /* Populate the structure */
-                       mem_device->cache_attribute =
-                           address64.attribute.memory.cache_attribute;
-                       mem_device->read_write_attribute =
-                           address64.attribute.memory.read_write_attribute;
-                       mem_device->start_addr = address64.min_address_range;
-                       mem_device->end_addr = address64.max_address_range;
+                       mem_device->caching =
+                           address64.info.mem.caching;
+                       mem_device->write_protect =
+                           address64.info.mem.write_protect;
+                       mem_device->start_addr = address64.minimum;
+                       mem_device->end_addr = address64.maximum;
                }
        }
 
@@ -250,7 +250,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
        int result;
        u64 start = mem_device->start_addr;
        u64 len = mem_device->end_addr - start + 1;
-       unsigned long attr = mem_device->read_write_attribute;
 
        ACPI_FUNCTION_TRACE("acpi_memory_disable_device");
 
index fec895af6ae6ccb86587876dd597fa6d25bba4b3..f4c87750dbf2bce15479c3a56bff51dba4c25a86 100644 (file)
@@ -78,9 +78,9 @@ MODULE_LICENSE("GPL");
 static uid_t asus_uid;
 static gid_t asus_gid;
 module_param(asus_uid, uint, 0);
-MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
+MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus.\n");
 module_param(asus_gid, uint, 0);
-MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n");
+MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus.\n");
 
 /* For each model, all features implemented, 
  * those marked with R are relative to HOTK, A for absolute */
@@ -302,7 +302,7 @@ static struct model_data model_conf[END_MODEL] = {
         .brightness_set = "SPLV",
         .brightness_get = "GPLV",
         .display_set = "SDSP",
-        .display_get = "\\SSTE"},
+        .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"},
        {
         .name = "M6R",
         .mt_mled = "MLED",
@@ -851,6 +851,8 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
                mode = S_IFREG | S_IRUGO | S_IWUGO;
        } else {
                mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP;
+               printk(KERN_WARNING "  asus_uid and asus_gid parameters are "
+                      "deprecated, use chown and chmod instead!\n");
        }
 
        acpi_device_dir(device) = asus_proc_dir;
@@ -987,9 +989,21 @@ static int __init asus_hotk_get_info(void)
                printk(KERN_NOTICE "  BSTS called, 0x%02x returned\n",
                       bsts_result);
 
-       /* Samsung P30 has a device with a valid _HID whose INIT does not 
-        * return anything. Catch this one and any similar here */
-       if (buffer.pointer == NULL) {
+       /* This is unlikely with implicit return */
+       if (buffer.pointer == NULL)
+               return -EINVAL;
+
+       model = (union acpi_object *) buffer.pointer;
+       /*
+        * Samsung P30 has a device with a valid _HID whose INIT does not 
+        * return anything. It used to be possible to catch this exception,
+        * but the implicit return code will now happily confuse the 
+        * driver. We assume that every ACPI_TYPE_STRING is a valid model
+        * identifier but it's still possible to get completely bogus data.
+        */
+       if (model->type == ACPI_TYPE_STRING) {
+               printk(KERN_NOTICE "  %s model detected, ", model->string.pointer);
+       } else {
                if (asus_info &&        /* Samsung P30 */
                    strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
                        hotk->model = P30;
@@ -1002,13 +1016,10 @@ static int __init asus_hotk_get_info(void)
                               "the developers with your DSDT\n");
                }
                hotk->methods = &model_conf[hotk->model];
-               return AE_OK;
-       }
+               
+               acpi_os_free(model);
 
-       model = (union acpi_object *)buffer.pointer;
-       if (model->type == ACPI_TYPE_STRING) {
-               printk(KERN_NOTICE "  %s model detected, ",
-                      model->string.pointer);
+               return AE_OK;
        }
 
        hotk->model = END_MODEL;
index 2022aeaecfbbeb357a23500039c809a7bfe6e4c0..76bc0463f6de456814bbde5bc771a2690c1f9396 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -128,7 +128,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
                                   ACPI_IMODE_LOAD_PASS1, flags, walk_state,
                                   &(node));
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_NSERROR(arg->common.value.string, status);
+                       ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
                        return_ACPI_STATUS(status);
                }
        }
@@ -232,7 +232,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                            + (acpi_integer) arg->common.value.size;
 
                        if (position > ACPI_UINT32_MAX) {
-                               ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n"));
+                               ACPI_ERROR((AE_INFO,
+                                           "Bit offset within field too large (> 0xFFFFFFFF)"));
                                return_ACPI_STATUS(AE_SUPPORT);
                        }
 
@@ -268,8 +269,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                                                ACPI_NS_DONT_OPEN_SCOPE,
                                                walk_state, &info->field_node);
                        if (ACPI_FAILURE(status)) {
-                               ACPI_REPORT_NSERROR((char *)&arg->named.name,
-                                                   status);
+                               ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
+                                                    status);
                                if (status != AE_ALREADY_EXISTS) {
                                        return_ACPI_STATUS(status);
                                }
@@ -293,7 +294,11 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                            + (acpi_integer) arg->common.value.size;
 
                        if (position > ACPI_UINT32_MAX) {
-                               ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name));
+                               ACPI_ERROR((AE_INFO,
+                                           "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
+                                           ACPI_CAST_PTR(char,
+                                                         &info->field_node->
+                                                         name)));
                                return_ACPI_STATUS(AE_SUPPORT);
                        }
 
@@ -302,9 +307,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
 
                default:
 
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Invalid opcode in field list: %X\n",
-                                         arg->common.aml_opcode));
+                       ACPI_ERROR((AE_INFO,
+                                   "Invalid opcode in field list: %X",
+                                   arg->common.aml_opcode));
                        return_ACPI_STATUS(AE_AML_BAD_OPCODE);
                }
 
@@ -349,7 +354,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
                                   ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
                                   walk_state, &region_node);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_NSERROR(arg->common.value.name, status);
+                       ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
                        return_ACPI_STATUS(status);
                }
        }
@@ -431,8 +436,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
                                                ACPI_NS_ERROR_IF_FOUND,
                                                walk_state, &node);
                        if (ACPI_FAILURE(status)) {
-                               ACPI_REPORT_NSERROR((char *)&arg->named.name,
-                                                   status);
+                               ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
+                                                    status);
                                if (status != AE_ALREADY_EXISTS) {
                                        return_ACPI_STATUS(status);
                                }
@@ -488,7 +493,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
                                   ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
                                   walk_state, &region_node);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_NSERROR(arg->common.value.name, status);
+                       ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
                        return_ACPI_STATUS(status);
                }
        }
@@ -502,7 +507,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
                           ACPI_NS_SEARCH_PARENT, walk_state,
                           &info.register_node);
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_NSERROR(arg->common.value.string, status);
+               ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
                return_ACPI_STATUS(status);
        }
 
@@ -560,7 +565,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
                           ACPI_NS_SEARCH_PARENT, walk_state,
                           &info.register_node);
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_NSERROR(arg->common.value.string, status);
+               ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
                return_ACPI_STATUS(status);
        }
 
@@ -573,7 +578,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
                           ACPI_NS_SEARCH_PARENT, walk_state,
                           &info.data_register_node);
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_NSERROR(arg->common.value.string, status);
+               ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
                return_ACPI_STATUS(status);
        }
 
index 8693c704aea611a6e9495fb3b7ee8ce7fe5ca017..e65a07ad2422a3d9fb8a4195109e0ffbb0356192 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -84,7 +84,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
        acpi_object_type type;
        acpi_status status;
 
-       ACPI_FUNCTION_NAME("ds_init_one_object");
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * We are only interested in NS nodes owned by the table that
@@ -105,11 +105,10 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
 
                status = acpi_ds_initialize_region(obj_handle);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Region %p [%4.4s] - Init failure, %s\n",
-                                         obj_handle,
-                                         acpi_ut_get_node_name(obj_handle),
-                                         acpi_format_exception(status)));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "During Region initialization %p [%4.4s]",
+                                       obj_handle,
+                                       acpi_ut_get_node_name(obj_handle)));
                }
 
                info->op_region_count++;
@@ -117,14 +116,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 +125,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
@@ -141,15 +147,15 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
                 */
                status = acpi_ds_parse_method(obj_handle);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "\n+Method %p [%4.4s] - parse failure, %s\n",
-                                         obj_handle,
-                                         acpi_ut_get_node_name(obj_handle),
-                                         acpi_format_exception(status)));
+                       ACPI_ERROR((AE_INFO,
+                                   "Method %p [%4.4s] - parse failure, %s",
+                                   obj_handle,
+                                   acpi_ut_get_node_name(obj_handle),
+                                   acpi_format_exception(status)));
 
                        /* This parse failed, but we will continue parsing more methods */
                }
-
+#endif
                info->method_count++;
                break;
 
@@ -207,8 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
        status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
                                     acpi_ds_init_one_object, &info, NULL);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
-                                 acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
        }
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
index 36c1ca0b9adb71a9b2d19fddd711a4b545a45312..c475546535b652fb313456c5440519c6fc66a0b9 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #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;
 
@@ -210,7 +141,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
        /* Prevent wraparound of thread count */
 
        if (obj_desc->method.thread_count == ACPI_UINT8_MAX) {
-               ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n"));
+               ACPI_ERROR((AE_INFO,
+                           "Method reached maximum reentrancy limit (255)"));
                return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
        }
 
@@ -539,22 +471,61 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
                    acpi_os_signal_semaphore(walk_state->method_desc->method.
                                             semaphore, 1);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_ERROR(("Could not signal method semaphore\n"));
+                       ACPI_ERROR((AE_INFO,
+                                   "Could not signal method semaphore"));
 
                        /* Ignore error and continue cleanup */
                }
        }
 
+       /*
+        * 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 +541,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 +551,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 4095ce70982bf3fcb1d852523ca25e4c99794b6d..c025674f938bd14a75b802d89357464ae7117650 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -260,9 +260,9 @@ acpi_ds_method_data_get_node(u16 opcode,
        case AML_LOCAL_OP:
 
                if (index > ACPI_METHOD_MAX_LOCAL) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Local index %d is invalid (max %d)\n",
-                                         index, ACPI_METHOD_MAX_LOCAL));
+                       ACPI_ERROR((AE_INFO,
+                                   "Local index %d is invalid (max %d)",
+                                   index, ACPI_METHOD_MAX_LOCAL));
                        return_ACPI_STATUS(AE_AML_INVALID_INDEX);
                }
 
@@ -274,9 +274,9 @@ acpi_ds_method_data_get_node(u16 opcode,
        case AML_ARG_OP:
 
                if (index > ACPI_METHOD_MAX_ARG) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Arg index %d is invalid (max %d)\n",
-                                         index, ACPI_METHOD_MAX_ARG));
+                       ACPI_ERROR((AE_INFO,
+                                   "Arg index %d is invalid (max %d)",
+                                   index, ACPI_METHOD_MAX_ARG));
                        return_ACPI_STATUS(AE_AML_INVALID_INDEX);
                }
 
@@ -286,8 +286,7 @@ acpi_ds_method_data_get_node(u16 opcode,
                break;
 
        default:
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n",
-                                 opcode));
+               ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode));
                return_ACPI_STATUS(AE_AML_BAD_OPCODE);
        }
 
@@ -378,8 +377,7 @@ acpi_ds_method_data_get_value(u16 opcode,
        /* Validate the object descriptor */
 
        if (!dest_desc) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Null object descriptor pointer\n"));
+               ACPI_ERROR((AE_INFO, "Null object descriptor pointer"));
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -424,23 +422,24 @@ acpi_ds_method_data_get_value(u16 opcode,
                        switch (opcode) {
                        case AML_ARG_OP:
 
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "Uninitialized Arg[%d] at node %p\n",
-                                                 index, node));
+                               ACPI_ERROR((AE_INFO,
+                                           "Uninitialized Arg[%d] at node %p",
+                                           index, node));
 
                                return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
 
                        case AML_LOCAL_OP:
 
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "Uninitialized Local[%d] at node %p\n",
-                                                 index, node));
+                               ACPI_ERROR((AE_INFO,
+                                           "Uninitialized Local[%d] at node %p",
+                                           index, node));
 
                                return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
 
                        default:
-                               ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n",
-                                                  opcode));
+                               ACPI_ERROR((AE_INFO,
+                                           "Not a Arg/Local opcode: %X",
+                                           opcode));
                                return_ACPI_STATUS(AE_AML_INTERNAL);
                        }
        }
index 8ac0cd93adb580b3e70c285bb0c99bf3452dd2d6..8b21f0f9e5177f3d82f9ea72b38ff772c75f972f 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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_ERROR_NAMESPACE(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);
@@ -183,10 +214,9 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
        byte_list = arg->named.next;
        if (byte_list) {
                if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Expecting bytelist, got AML opcode %X in op %p\n",
-                                         byte_list->common.aml_opcode,
-                                         byte_list));
+                       ACPI_ERROR((AE_INFO,
+                                   "Expecting bytelist, got AML opcode %X in op %p",
+                                   byte_list->common.aml_opcode, byte_list));
 
                        acpi_ut_remove_reference(obj_desc);
                        return (AE_TYPE);
@@ -259,7 +289,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 +301,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 +320,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 +349,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 +366,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
                                                               package.
                                                               elements[i]);
                }
-
-               i++;
                arg = arg->common.next;
        }
 
@@ -518,9 +542,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 
                        default:
 
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "Unknown constant opcode %X\n",
-                                                 opcode));
+                               ACPI_ERROR((AE_INFO,
+                                           "Unknown constant opcode %X",
+                                           opcode));
                                status = AE_AML_OPERAND_TYPE;
                                break;
                        }
@@ -535,9 +559,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
                        break;
 
                default:
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Unknown Integer type %X\n",
-                                         op_info->type));
+                       ACPI_ERROR((AE_INFO, "Unknown Integer type %X",
+                                   op_info->type));
                        status = AE_AML_OPERAND_TYPE;
                        break;
                }
@@ -615,9 +638,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 
        default:
 
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Unimplemented data type: %X\n",
-                                 ACPI_GET_OBJECT_TYPE(obj_desc)));
+               ACPI_ERROR((AE_INFO, "Unimplemented data type: %X",
+                           ACPI_GET_OBJECT_TYPE(obj_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                break;
index 939d167bf87b81eda9041c995950ae5674c11352..6229c10674e186c41bb690d58d8c80feff6da6b6 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -245,7 +245,9 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
 
        node = obj_desc->buffer.node;
        if (!node) {
-               ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc));
+               ACPI_ERROR((AE_INFO,
+                           "No pointer back to NS node in buffer obj %p",
+                           obj_desc));
                return_ACPI_STATUS(AE_AML_INTERNAL);
        }
 
@@ -287,8 +289,9 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
 
        node = obj_desc->package.node;
        if (!node) {
-               ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n",
-                                  obj_desc));
+               ACPI_ERROR((AE_INFO,
+                           "No pointer back to NS node in package %p",
+                           obj_desc));
                return_ACPI_STATUS(AE_AML_INTERNAL);
        }
 
@@ -413,9 +416,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
        /* Host object must be a Buffer */
 
        if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Target of Create Field is not a Buffer object - %s\n",
-                                 acpi_ut_get_object_type_name(buffer_desc)));
+               ACPI_ERROR((AE_INFO,
+                           "Target of Create Field is not a Buffer object - %s",
+                           acpi_ut_get_object_type_name(buffer_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -427,10 +430,10 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
         * after resolution in acpi_ex_resolve_operands().
         */
        if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "(%s) destination not a NS Node [%s]\n",
-                                 acpi_ps_get_opcode_name(aml_opcode),
-                                 acpi_ut_get_descriptor_name(result_desc)));
+               ACPI_ERROR((AE_INFO,
+                           "(%s) destination not a NS Node [%s]",
+                           acpi_ps_get_opcode_name(aml_opcode),
+                           acpi_ut_get_descriptor_name(result_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -453,8 +456,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
                /* Must have a valid (>0) bit count */
 
                if (bit_count == 0) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Attempt to create_field of length 0\n"));
+                       ACPI_ERROR((AE_INFO,
+                                   "Attempt to create_field of length zero"));
                        status = AE_AML_OPERAND_VALUE;
                        goto cleanup;
                }
@@ -507,9 +510,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
 
        default:
 
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Unknown field creation opcode %02x\n",
-                                 aml_opcode));
+               ACPI_ERROR((AE_INFO,
+                           "Unknown field creation opcode %02x", aml_opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
@@ -517,13 +519,12 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
        /* Entire field must fit within the current length of the buffer */
 
        if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
-                                 acpi_ut_get_node_name(result_desc),
-                                 bit_offset + bit_count,
-                                 acpi_ut_get_node_name(buffer_desc->buffer.
-                                                       node),
-                                 8 * (u32) buffer_desc->buffer.length));
+               ACPI_ERROR((AE_INFO,
+                           "Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
+                           acpi_ut_get_node_name(result_desc),
+                           bit_offset + bit_count,
+                           acpi_ut_get_node_name(buffer_desc->buffer.node),
+                           8 * (u32) buffer_desc->buffer.length));
                status = AE_AML_BUFFER_LIMIT;
                goto cleanup;
        }
@@ -629,9 +630,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
                           "after acpi_ex_resolve_operands");
 
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
-                                 acpi_ps_get_opcode_name(op->common.
-                                                         aml_opcode), status));
+               ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)",
+                           acpi_ps_get_opcode_name(op->common.aml_opcode),
+                           status));
 
                return_ACPI_STATUS(status);
        }
@@ -1155,9 +1156,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
 
        default:
 
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Unknown control opcode=%X Op=%p\n",
-                                 op->common.aml_opcode, op));
+               ACPI_ERROR((AE_INFO, "Unknown control opcode=%X Op=%p",
+                           op->common.aml_opcode, op));
 
                status = AE_AML_BAD_OPCODE;
                break;
index 83ae1c1aa28668ff8b931ac4e0837233b9a7901e..53356a591ac19da2e7881fc81c0d9431920318b2 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -176,8 +176,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
        /* Must have both an Op and a Result Object */
 
        if (!op) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
-               return_VALUE(TRUE);
+               ACPI_ERROR((AE_INFO, "Null Op"));
+               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 */
@@ -216,9 +216,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
        parent_info =
            acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
        if (parent_info->class == AML_CLASS_UNKNOWN) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Unknown parent opcode. Op=%p\n", op));
-               return_VALUE(FALSE);
+               ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
+               return_UINT8(FALSE);
        }
 
        /*
@@ -304,7 +303,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 +312,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);
 }
 
 /*******************************************************************************
@@ -344,7 +343,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
        ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
 
        if (!op) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
+               ACPI_ERROR((AE_INFO, "Null Op"));
                return_VOID;
        }
 
@@ -567,7 +566,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                        }
 
                        if (ACPI_FAILURE(status)) {
-                               ACPI_REPORT_NSERROR(name_string, status);
+                               ACPI_ERROR_NAMESPACE(name_string, status);
                        }
                }
 
@@ -616,7 +615,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->
@@ -635,10 +634,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                                 * Only error is underflow, and this indicates
                                 * a missing or null operand!
                                 */
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "Missing or null operand, %s\n",
-                                                 acpi_format_exception
-                                                 (status)));
+                               ACPI_EXCEPTION((AE_INFO, status,
+                                               "Missing or null operand"));
                                return_ACPI_STATUS(status);
                        }
                } else {
@@ -730,7 +727,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,
         */
        (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
-                         (arg_count + 1), acpi_format_exception(status)));
+       ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d",
+                       (arg_count + 1)));
        return_ACPI_STATUS(status);
 }
index e522763bb692aeacdb568a51a3e1a2fe7b73a213..f1af655ff11350dc82ebdd77eb03fcbc6b2666ab 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -100,9 +100,8 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
        if (result_obj) {
                status = acpi_ds_result_pop(&obj_desc, walk_state);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Could not get result from predicate evaluation, %s\n",
-                                         acpi_format_exception(status)));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Could not get result from predicate evaluation"));
 
                        return_ACPI_STATUS(status);
                }
@@ -123,9 +122,9 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
        }
 
        if (!obj_desc) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No predicate obj_desc=%p State=%p\n",
-                                 obj_desc, walk_state));
+               ACPI_ERROR((AE_INFO,
+                           "No predicate obj_desc=%p State=%p",
+                           obj_desc, walk_state));
 
                return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
@@ -140,10 +139,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
        }
 
        if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
-                                 obj_desc, walk_state,
-                                 ACPI_GET_OBJECT_TYPE(obj_desc)));
+               ACPI_ERROR((AE_INFO,
+                           "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X",
+                           obj_desc, walk_state,
+                           ACPI_GET_OBJECT_TYPE(obj_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -314,12 +313,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:
@@ -361,8 +361,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
        op_class = walk_state->op_info->class;
 
        if (op_class == AML_CLASS_UNKNOWN) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
-                                 op->common.aml_opcode));
+               ACPI_ERROR((AE_INFO, "Unknown opcode %X",
+                           op->common.aml_opcode));
                return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
        }
 
@@ -452,12 +452,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                                walk_state->operands[1]->reference.offset)) {
                                status = AE_OK;
                        } else {
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "[%s]: Could not resolve operands, %s\n",
-                                                 acpi_ps_get_opcode_name
-                                                 (walk_state->opcode),
-                                                 acpi_format_exception
-                                                 (status)));
+                               ACPI_EXCEPTION((AE_INFO, status,
+                                               "While resolving operands for [%s]",
+                                               acpi_ps_get_opcode_name
+                                               (walk_state->opcode)));
                        }
                }
 
@@ -676,8 +674,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 
                case AML_TYPE_UNDEFINED:
 
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Undefined opcode type Op=%p\n", op));
+                       ACPI_ERROR((AE_INFO,
+                                   "Undefined opcode type Op=%p", op));
                        return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
 
                case AML_TYPE_BOGUS:
@@ -689,10 +687,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 
                default:
 
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
-                                         op_class, op_type,
-                                         op->common.aml_opcode, op));
+                       ACPI_ERROR((AE_INFO,
+                                   "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p",
+                                   op_class, op_type, op->common.aml_opcode,
+                                   op));
 
                        status = AE_NOT_IMPLEMENTED;
                        break;
@@ -723,20 +721,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 +742,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..d3d24da31c814db68766a705c9eb210dfa95a7ba 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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);
                }
        }
 
@@ -187,8 +187,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                }
 #endif
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_NSERROR(path, status);
-                       return (status);
+                       ACPI_ERROR_NAMESPACE(path, status);
+                       return_ACPI_STATUS(status);
                }
 
                /*
@@ -233,9 +233,11 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
 
                        /* All other types are an error */
 
-                       ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path));
+                       ACPI_ERROR((AE_INFO,
+                                   "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)",
+                                   acpi_ut_get_type_name(node->type), path));
 
-                       return (AE_AML_OPERAND_TYPE);
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
                break;
 
@@ -257,6 +259,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 +268,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))) {
@@ -289,8 +302,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                                   ACPI_IMODE_LOAD_PASS1, flags, walk_state,
                                   &(node));
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_NSERROR(path, status);
-                       return (status);
+                       ACPI_ERROR_NAMESPACE(path, status);
+                       return_ACPI_STATUS(status);
                }
                break;
        }
@@ -302,28 +315,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 +353,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 +368,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 +377,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 +421,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 +485,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 +502,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;
@@ -574,10 +620,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
                        if (status == AE_NOT_FOUND) {
                                status = AE_OK;
                        } else {
-                               ACPI_REPORT_NSERROR(buffer_ptr, status);
+                               ACPI_ERROR_NAMESPACE(buffer_ptr, status);
                        }
 #else
-                       ACPI_REPORT_NSERROR(buffer_ptr, status);
+                       ACPI_ERROR_NAMESPACE(buffer_ptr, status);
 #endif
                        return_ACPI_STATUS(status);
                }
@@ -607,7 +653,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
                         *  Scope (DEB) { ... }
                         */
 
-                       ACPI_REPORT_WARNING(("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", buffer_ptr, acpi_ut_get_type_name(node->type)));
+                       ACPI_WARNING((AE_INFO,
+                                     "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
+                                     buffer_ptr,
+                                     acpi_ut_get_type_name(node->type)));
 
                        node->type = ACPI_TYPE_ANY;
                        walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -617,7 +666,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
 
                        /* All other types are an error */
 
-                       ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr));
+                       ACPI_ERROR((AE_INFO,
+                                   "Invalid type (%s) for target of Scope operator [%4.4s]",
+                                   acpi_ut_get_type_name(node->type),
+                                   buffer_ptr));
 
                        return (AE_AML_OPERAND_TYPE);
                }
@@ -670,7 +722,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
        }
 
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_NSERROR(buffer_ptr, status);
+               ACPI_ERROR_NAMESPACE(buffer_ptr, status);
                return_ACPI_STATUS(status);
        }
 
@@ -840,6 +892,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 +988,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 +1034,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;
@@ -1004,7 +1120,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
                         */
                        op->common.node = new_node;
                } else {
-                       ACPI_REPORT_NSERROR(arg->common.value.string, status);
+                       ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
                }
                break;
 
index defe956ef7517ebc46a968dfe8d770bf9fa0f6ef..ada21ef4a1744d0c9e39aa0c16bdb7333b9e2e32 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -107,14 +107,14 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
        if (!node) {
                /* Invalid scope   */
 
-               ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n"));
+               ACPI_ERROR((AE_INFO, "Null scope parameter"));
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Make sure object type is valid */
 
        if (!acpi_ut_valid_object_type(type)) {
-               ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
+               ACPI_WARNING((AE_INFO, "Invalid object type: 0x%X", type));
        }
 
        /* Allocate a new scope object */
index 7d68a5aaf3c43bb6423b1d8a33dfdb54bc625840..fa78cb74ee367eb69ea4a359d681e1448ee146f5 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -92,26 +92,23 @@ acpi_ds_result_remove(union acpi_operand_object **object,
 
        state = walk_state->results;
        if (!state) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No result object pushed! State=%p\n",
-                                 walk_state));
+               ACPI_ERROR((AE_INFO, "No result object pushed! State=%p",
+                           walk_state));
                return (AE_NOT_EXIST);
        }
 
        if (index >= ACPI_OBJ_MAX_OPERAND) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Index out of range: %X State=%p Num=%X\n",
-                                 index, walk_state,
-                                 state->results.num_results));
+               ACPI_ERROR((AE_INFO,
+                           "Index out of range: %X State=%p Num=%X",
+                           index, walk_state, state->results.num_results));
        }
 
        /* Check for a valid result object */
 
        if (!state->results.obj_desc[index]) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Null operand! State=%p #Ops=%X, Index=%X\n",
-                                 walk_state, state->results.num_results,
-                                 index));
+               ACPI_ERROR((AE_INFO,
+                           "Null operand! State=%p #Ops=%X, Index=%X",
+                           walk_state, state->results.num_results, index));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -163,9 +160,8 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
        }
 
        if (!state->results.num_results) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Result stack is empty! State=%p\n",
-                                 walk_state));
+               ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p",
+                           walk_state));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -192,8 +188,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
                }
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                         "No result objects! State=%p\n", walk_state));
+       ACPI_ERROR((AE_INFO, "No result objects! State=%p", walk_state));
        return (AE_AML_NO_RETURN_VALUE);
 }
 
@@ -222,15 +217,14 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
 
        state = walk_state->results;
        if (!state) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Warning: No result object pushed! State=%p\n",
-                                 walk_state));
+               ACPI_ERROR((AE_INFO,
+                           "No result object pushed! State=%p", walk_state));
                return (AE_NOT_EXIST);
        }
 
        if (!state->results.num_results) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No result objects! State=%p\n", walk_state));
+               ACPI_ERROR((AE_INFO, "No result objects! State=%p",
+                           walk_state));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -250,10 +244,10 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
        /* Check for a valid result object */
 
        if (!*object) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Null operand! State=%p #Ops=%X Index=%X\n",
-                                 walk_state, state->results.num_results,
-                                 (u32) index));
+               ACPI_ERROR((AE_INFO,
+                           "Null operand! State=%p #Ops=%X Index=%X",
+                           walk_state, state->results.num_results,
+                           (u32) index));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -288,23 +282,21 @@ acpi_ds_result_push(union acpi_operand_object * object,
 
        state = walk_state->results;
        if (!state) {
-               ACPI_REPORT_ERROR(("No result stack frame during push\n"));
+               ACPI_ERROR((AE_INFO, "No result stack frame during push"));
                return (AE_AML_INTERNAL);
        }
 
        if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Result stack overflow: Obj=%p State=%p Num=%X\n",
-                                 object, walk_state,
-                                 state->results.num_results));
+               ACPI_ERROR((AE_INFO,
+                           "Result stack overflow: Obj=%p State=%p Num=%X",
+                           object, walk_state, state->results.num_results));
                return (AE_STACK_OVERFLOW);
        }
 
        if (!object) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Null Object! Obj=%p State=%p Num=%X\n",
-                                 object, walk_state,
-                                 state->results.num_results));
+               ACPI_ERROR((AE_INFO,
+                           "Null Object! Obj=%p State=%p Num=%X",
+                           object, walk_state, state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
@@ -413,10 +405,9 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
        /* Check for stack overflow */
 
        if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "overflow! Obj=%p State=%p #Ops=%X\n",
-                                 object, walk_state,
-                                 walk_state->num_operands));
+               ACPI_ERROR((AE_INFO,
+                           "Object stack overflow! Obj=%p State=%p #Ops=%X",
+                           object, walk_state, walk_state->num_operands));
                return (AE_STACK_OVERFLOW);
        }
 
@@ -460,10 +451,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Underflow! Count=%X State=%p #Ops=%X\n",
-                                         pop_count, walk_state,
-                                         walk_state->num_operands));
+                       ACPI_ERROR((AE_INFO,
+                                   "Object stack underflow! Count=%X State=%p #Ops=%X",
+                                   pop_count, walk_state,
+                                   walk_state->num_operands));
                        return (AE_STACK_UNDERFLOW);
                }
 
@@ -506,10 +497,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Underflow! Count=%X State=%p #Ops=%X\n",
-                                         pop_count, walk_state,
-                                         walk_state->num_operands));
+                       ACPI_ERROR((AE_INFO,
+                                   "Object stack underflow! Count=%X State=%p #Ops=%X",
+                                   pop_count, walk_state,
+                                   walk_state->num_operands));
                        return (AE_STACK_UNDERFLOW);
                }
 
@@ -826,16 +817,14 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
        }
 
        if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "%p is not a valid walk state\n",
-                                 walk_state));
+               ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
+                           walk_state));
                return;
        }
 
        if (walk_state->parser_state.scope) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "%p walk still has a scope list\n",
-                                 walk_state));
+               ACPI_ERROR((AE_INFO, "%p walk still has a scope list",
+                           walk_state));
        }
 
        /* Always must free any linked control states */
@@ -894,25 +883,24 @@ acpi_ds_result_insert(void *object,
 
        state = walk_state->results;
        if (!state) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No result object pushed! State=%p\n",
-                                 walk_state));
+               ACPI_ERROR((AE_INFO, "No result object pushed! State=%p",
+                           walk_state));
                return (AE_NOT_EXIST);
        }
 
        if (index >= ACPI_OBJ_NUM_OPERANDS) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Index out of range: %X Obj=%p State=%p Num=%X\n",
-                                 index, object, walk_state,
-                                 state->results.num_results));
+               ACPI_ERROR((AE_INFO,
+                           "Index out of range: %X Obj=%p State=%p Num=%X",
+                           index, object, walk_state,
+                           state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
        if (!object) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
-                                 index, object, walk_state,
-                                 state->results.num_results));
+               ACPI_ERROR((AE_INFO,
+                           "Null Object! Index=%X Obj=%p State=%p Num=%X",
+                           index, object, walk_state,
+                           state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
@@ -986,9 +974,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
        /* Check for stack underflow */
 
        if (walk_state->num_operands == 0) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Missing operand/stack empty! State=%p #Ops=%X\n",
-                                 walk_state, walk_state->num_operands));
+               ACPI_ERROR((AE_INFO,
+                           "Missing operand/stack empty! State=%p #Ops=%X",
+                           walk_state, walk_state->num_operands));
                *object = NULL;
                return (AE_AML_NO_OPERAND);
        }
@@ -1000,9 +988,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
        /* Check for a valid operand */
 
        if (!walk_state->operands[walk_state->num_operands]) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Null operand! State=%p #Ops=%X\n",
-                                 walk_state, walk_state->num_operands));
+               ACPI_ERROR((AE_INFO,
+                           "Null operand! State=%p #Ops=%X",
+                           walk_state, walk_state->num_operands));
                *object = NULL;
                return (AE_AML_NO_OPERAND);
        }
index 3758b558d2b5e9ad1b2905049ea090874f63876a..79b09d76c180204e488a924dc4827572a51d92f1 100644 (file)
@@ -60,20 +60,20 @@ ACPI_MODULE_NAME("acpi_ec")
 #define ACPI_EC_BURST_ENABLE   0x82
 #define ACPI_EC_BURST_DISABLE  0x83
 #define ACPI_EC_COMMAND_QUERY  0x84
-#define EC_POLLING             0xFF
-#define EC_BURST               0x00
+#define EC_POLL                        0xFF
+#define EC_INTR                        0x00
 static int acpi_ec_remove(struct acpi_device *device, int type);
 static int acpi_ec_start(struct acpi_device *device);
 static int acpi_ec_stop(struct acpi_device *device, int type);
-static int acpi_ec_burst_add(struct acpi_device *device);
-static int acpi_ec_polling_add(struct acpi_device *device);
+static int acpi_ec_intr_add(struct acpi_device *device);
+static int acpi_ec_poll_add(struct acpi_device *device);
 
 static struct acpi_driver acpi_ec_driver = {
        .name = ACPI_EC_DRIVER_NAME,
        .class = ACPI_EC_CLASS,
        .ids = ACPI_EC_HID,
        .ops = {
-               .add = acpi_ec_polling_add,
+               .add = acpi_ec_intr_add,
                .remove = acpi_ec_remove,
                .start = acpi_ec_start,
                .stop = acpi_ec_stop,
@@ -105,7 +105,7 @@ union acpi_ec {
                atomic_t pending_gpe;
                struct semaphore sem;
                wait_queue_head_t wait;
-       } burst;
+       } intr;
 
        struct {
                u32 mode;
@@ -117,37 +117,37 @@ union acpi_ec {
                struct acpi_generic_address data_addr;
                unsigned long global_lock;
                spinlock_t lock;
-       } polling;
+       } poll;
 };
 
-static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event);
-static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event);
-static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data);
-static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data);
-static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data);
-static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data);
-static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data);
-static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data);
-static void acpi_ec_gpe_polling_query(void *ec_cxt);
-static void acpi_ec_gpe_burst_query(void *ec_cxt);
-static u32 acpi_ec_gpe_polling_handler(void *data);
-static u32 acpi_ec_gpe_burst_handler(void *data);
+static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event);
+static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event);
+static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data);
+static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data);
+static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data);
+static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data);
+static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data);
+static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data);
+static void acpi_ec_gpe_poll_query(void *ec_cxt);
+static void acpi_ec_gpe_intr_query(void *ec_cxt);
+static u32 acpi_ec_gpe_poll_handler(void *data);
+static u32 acpi_ec_gpe_intr_handler(void *data);
 static acpi_status __init
-acpi_fake_ecdt_polling_callback(acpi_handle handle,
+acpi_fake_ecdt_poll_callback(acpi_handle handle,
                                u32 Level, void *context, void **retval);
 
 static acpi_status __init
-acpi_fake_ecdt_burst_callback(acpi_handle handle,
+acpi_fake_ecdt_intr_callback(acpi_handle handle,
                              u32 Level, void *context, void **retval);
 
-static int __init acpi_ec_polling_get_real_ecdt(void);
-static int __init acpi_ec_burst_get_real_ecdt(void);
+static int __init acpi_ec_poll_get_real_ecdt(void);
+static int __init acpi_ec_intr_get_real_ecdt(void);
 /* If we find an EC via the ECDT, we need to keep a ptr to its context */
 static union acpi_ec *ec_ecdt;
 
 /* External interfaces use first EC only, so remember */
 static struct acpi_device *first_ec;
-static int acpi_ec_polling_mode = EC_POLLING;
+static int acpi_ec_poll_mode = EC_INTR;
 
 /* --------------------------------------------------------------------------
                              Transaction Management
@@ -163,13 +163,13 @@ static u32 acpi_ec_read_status(union acpi_ec *ec)
 
 static int acpi_ec_wait(union acpi_ec *ec, u8 event)
 {
-       if (acpi_ec_polling_mode)
-               return acpi_ec_polling_wait(ec, event);
+       if (acpi_ec_poll_mode)
+               return acpi_ec_poll_wait(ec, event);
        else
-               return acpi_ec_burst_wait(ec, event);
+               return acpi_ec_intr_wait(ec, event);
 }
 
-static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
+static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event)
 {
        u32 acpi_ec_status = 0;
        u32 i = ACPI_EC_UDELAY_COUNT;
@@ -203,36 +203,31 @@ static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
 
        return -ETIME;
 }
-static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
+static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
 {
        int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_wait");
 
-       ec->burst.expect_event = event;
+       ec->intr.expect_event = event;
        smp_mb();
 
        switch (event) {
-       case ACPI_EC_EVENT_OBF:
-               if (acpi_ec_read_status(ec) & event) {
-                       ec->burst.expect_event = 0;
-                       return_VALUE(0);
-               }
-               break;
-
        case ACPI_EC_EVENT_IBE:
                if (~acpi_ec_read_status(ec) & event) {
-                       ec->burst.expect_event = 0;
+                       ec->intr.expect_event = 0;
                        return_VALUE(0);
                }
                break;
+       default:
+               break;
        }
 
-       result = wait_event_timeout(ec->burst.wait,
-                                   !ec->burst.expect_event,
+       result = wait_event_timeout(ec->intr.wait,
+                                   !ec->intr.expect_event,
                                    msecs_to_jiffies(ACPI_EC_DELAY));
 
-       ec->burst.expect_event = 0;
+       ec->intr.expect_event = 0;
        smp_mb();
 
        /*
@@ -255,7 +250,12 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
        return_VALUE(-ETIME);
 }
 
-static int acpi_ec_enter_burst_mode(union acpi_ec *ec)
+#ifdef ACPI_FUTURE_USAGE
+/*
+ * Note: samsung nv5000 doesn't work with ec burst mode.
+ * http://bugzilla.kernel.org/show_bug.cgi?id=4980
+ */
+int acpi_ec_enter_burst_mode(union acpi_ec *ec)
 {
        u32 tmp = 0;
        int status = 0;
@@ -270,45 +270,56 @@ static int acpi_ec_enter_burst_mode(union acpi_ec *ec)
                acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE,
                                        &ec->common.command_addr);
                status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
-               if (status)
-                       return_VALUE(-EINVAL);
                acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
                if (tmp != 0x90) {      /* Burst ACK byte */
                        return_VALUE(-EINVAL);
                }
        }
 
-       atomic_set(&ec->burst.leaving_burst, 0);
+       atomic_set(&ec->intr.leaving_burst, 0);
        return_VALUE(0);
       end:
-       printk("Error in acpi_ec_wait\n");
+       printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n");
        return_VALUE(-1);
 }
 
-static int acpi_ec_leave_burst_mode(union acpi_ec *ec)
+int acpi_ec_leave_burst_mode(union acpi_ec *ec)
 {
+       int status = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
 
-       atomic_set(&ec->burst.leaving_burst, 1);
+       status = acpi_ec_read_status(ec);
+       if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){
+               status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
+               if(status)
+                       goto end;
+               acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr);
+               acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
+       } 
+       atomic_set(&ec->intr.leaving_burst, 1);
        return_VALUE(0);
+end:
+       printk(KERN_WARNING PREFIX "leave burst_mode:error\n");
+       return_VALUE(-1);
 }
+#endif /* ACPI_FUTURE_USAGE */
 
 static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
 {
-       if (acpi_ec_polling_mode)
-               return acpi_ec_polling_read(ec, address, data);
+       if (acpi_ec_poll_mode)
+               return acpi_ec_poll_read(ec, address, data);
        else
-               return acpi_ec_burst_read(ec, address, data);
+               return acpi_ec_intr_read(ec, address, data);
 }
 static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
 {
-       if (acpi_ec_polling_mode)
-               return acpi_ec_polling_write(ec, address, data);
+       if (acpi_ec_poll_mode)
+               return acpi_ec_poll_write(ec, address, data);
        else
-               return acpi_ec_burst_write(ec, address, data);
+               return acpi_ec_intr_write(ec, address, data);
 }
-static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
+static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
 {
        acpi_status status = AE_OK;
        int result = 0;
@@ -328,7 +339,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
                        return_VALUE(-ENODEV);
        }
 
-       spin_lock_irqsave(&ec->polling.lock, flags);
+       spin_lock_irqsave(&ec->poll.lock, flags);
 
        acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
                                &ec->common.command_addr);
@@ -347,7 +358,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
                          *data, address));
 
       end:
-       spin_unlock_irqrestore(&ec->polling.lock, flags);
+       spin_unlock_irqrestore(&ec->poll.lock, flags);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
@@ -355,7 +366,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
        return_VALUE(result);
 }
 
-static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
+static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
 {
        int result = 0;
        acpi_status status = AE_OK;
@@ -373,7 +384,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
                        return_VALUE(-ENODEV);
        }
 
-       spin_lock_irqsave(&ec->polling.lock, flags);
+       spin_lock_irqsave(&ec->poll.lock, flags);
 
        acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
                                &ec->common.command_addr);
@@ -395,7 +406,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
                          data, address));
 
       end:
-       spin_unlock_irqrestore(&ec->polling.lock, flags);
+       spin_unlock_irqrestore(&ec->poll.lock, flags);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
@@ -403,7 +414,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
        return_VALUE(result);
 }
 
-static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
+static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
 {
        int status = 0;
        u32 glk;
@@ -422,25 +433,24 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
        }
 
        WARN_ON(in_interrupt());
-       down(&ec->burst.sem);
+       down(&ec->intr.sem);
 
-       acpi_ec_enter_burst_mode(ec);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (status) {
-               printk("read EC, IB not empty\n");
+               printk(KERN_DEBUG PREFIX "read EC, IB not empty\n");
                goto end;
        }
        acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
                                &ec->common.command_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (status) {
-               printk("read EC, IB not empty\n");
+               printk(KERN_DEBUG PREFIX "read EC, IB not empty\n");
        }
 
        acpi_hw_low_level_write(8, address, &ec->common.data_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
        if (status) {
-               printk("read EC, OB not full\n");
+               printk(KERN_DEBUG PREFIX "read EC, OB not full\n");
                goto end;
        }
        acpi_hw_low_level_read(8, data, &ec->common.data_addr);
@@ -448,8 +458,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
                          *data, address));
 
       end:
-       acpi_ec_leave_burst_mode(ec);
-       up(&ec->burst.sem);
+       up(&ec->intr.sem);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
@@ -457,7 +466,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
        return_VALUE(status);
 }
 
-static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
+static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
 {
        int status = 0;
        u32 glk;
@@ -474,25 +483,23 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
        }
 
        WARN_ON(in_interrupt());
-       down(&ec->burst.sem);
-
-       acpi_ec_enter_burst_mode(ec);
+       down(&ec->intr.sem);
 
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (status) {
-               printk("write EC, IB not empty\n");
+               printk(KERN_DEBUG PREFIX "write EC, IB not empty\n");
        }
        acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
                                &ec->common.command_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (status) {
-               printk("write EC, IB not empty\n");
+               printk(KERN_DEBUG PREFIX "write EC, IB not empty\n");
        }
 
        acpi_hw_low_level_write(8, address, &ec->common.data_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (status) {
-               printk("write EC, IB not empty\n");
+               printk(KERN_DEBUG PREFIX "write EC, IB not empty\n");
        }
 
        acpi_hw_low_level_write(8, data, &ec->common.data_addr);
@@ -500,8 +507,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
                          data, address));
 
-       acpi_ec_leave_burst_mode(ec);
-       up(&ec->burst.sem);
+       up(&ec->intr.sem);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
@@ -553,12 +559,12 @@ EXPORT_SYMBOL(ec_write);
 
 static int acpi_ec_query(union acpi_ec *ec, u32 * data)
 {
-       if (acpi_ec_polling_mode)
-               return acpi_ec_polling_query(ec, data);
+       if (acpi_ec_poll_mode)
+               return acpi_ec_poll_query(ec, data);
        else
-               return acpi_ec_burst_query(ec, data);
+               return acpi_ec_intr_query(ec, data);
 }
-static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
+static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data)
 {
        int result = 0;
        acpi_status status = AE_OK;
@@ -583,7 +589,7 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
         * Note that successful completion of the query causes the ACPI_EC_SCI
         * bit to be cleared (and thus clearing the interrupt source).
         */
-       spin_lock_irqsave(&ec->polling.lock, flags);
+       spin_lock_irqsave(&ec->poll.lock, flags);
 
        acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
                                &ec->common.command_addr);
@@ -596,14 +602,14 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
                result = -ENODATA;
 
       end:
-       spin_unlock_irqrestore(&ec->polling.lock, flags);
+       spin_unlock_irqrestore(&ec->poll.lock, flags);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
 
        return_VALUE(result);
 }
-static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
+static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data)
 {
        int status = 0;
        u32 glk;
@@ -620,11 +626,11 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
                        return_VALUE(-ENODEV);
        }
 
-       down(&ec->burst.sem);
+       down(&ec->intr.sem);
 
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (status) {
-               printk("query EC, IB not empty\n");
+               printk(KERN_DEBUG PREFIX "query EC, IB not empty\n");
                goto end;
        }
        /*
@@ -636,7 +642,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
                                &ec->common.command_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
        if (status) {
-               printk("query EC, OB not full\n");
+               printk(KERN_DEBUG PREFIX "query EC, OB not full\n");
                goto end;
        }
 
@@ -645,7 +651,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
                status = -ENODATA;
 
       end:
-       up(&ec->burst.sem);
+       up(&ec->intr.sem);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
@@ -664,13 +670,13 @@ union acpi_ec_query_data {
 
 static void acpi_ec_gpe_query(void *ec_cxt)
 {
-       if (acpi_ec_polling_mode)
-               acpi_ec_gpe_polling_query(ec_cxt);
+       if (acpi_ec_poll_mode)
+               acpi_ec_gpe_poll_query(ec_cxt);
        else
-               acpi_ec_gpe_burst_query(ec_cxt);
+               acpi_ec_gpe_intr_query(ec_cxt);
 }
 
-static void acpi_ec_gpe_polling_query(void *ec_cxt)
+static void acpi_ec_gpe_poll_query(void *ec_cxt)
 {
        union acpi_ec *ec = (union acpi_ec *)ec_cxt;
        u32 value = 0;
@@ -685,9 +691,9 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt)
        if (!ec_cxt)
                goto end;
 
-       spin_lock_irqsave(&ec->polling.lock, flags);
+       spin_lock_irqsave(&ec->poll.lock, flags);
        acpi_hw_low_level_read(8, &value, &ec->common.command_addr);
-       spin_unlock_irqrestore(&ec->polling.lock, flags);
+       spin_unlock_irqrestore(&ec->poll.lock, flags);
 
        /* TBD: Implement asynch events!
         * NOTE: All we care about are EC-SCI's.  Other EC events are
@@ -711,7 +717,7 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt)
       end:
        acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
 }
-static void acpi_ec_gpe_burst_query(void *ec_cxt)
+static void acpi_ec_gpe_intr_query(void *ec_cxt)
 {
        union acpi_ec *ec = (union acpi_ec *)ec_cxt;
        u32 value;
@@ -736,18 +742,18 @@ static void acpi_ec_gpe_burst_query(void *ec_cxt)
 
        acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
       end:
-       atomic_dec(&ec->burst.pending_gpe);
+       atomic_dec(&ec->intr.pending_gpe);
        return;
 }
 
 static u32 acpi_ec_gpe_handler(void *data)
 {
-       if (acpi_ec_polling_mode)
-               return acpi_ec_gpe_polling_handler(data);
+       if (acpi_ec_poll_mode)
+               return acpi_ec_gpe_poll_handler(data);
        else
-               return acpi_ec_gpe_burst_handler(data);
+               return acpi_ec_gpe_intr_handler(data);
 }
-static u32 acpi_ec_gpe_polling_handler(void *data)
+static u32 acpi_ec_gpe_poll_handler(void *data)
 {
        acpi_status status = AE_OK;
        union acpi_ec *ec = (union acpi_ec *)data;
@@ -765,7 +771,7 @@ static u32 acpi_ec_gpe_polling_handler(void *data)
        else
                return ACPI_INTERRUPT_NOT_HANDLED;
 }
-static u32 acpi_ec_gpe_burst_handler(void *data)
+static u32 acpi_ec_gpe_intr_handler(void *data)
 {
        acpi_status status = AE_OK;
        u32 value;
@@ -777,22 +783,22 @@ static u32 acpi_ec_gpe_burst_handler(void *data)
        acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
        value = acpi_ec_read_status(ec);
 
-       switch (ec->burst.expect_event) {
+       switch (ec->intr.expect_event) {
        case ACPI_EC_EVENT_OBF:
                if (!(value & ACPI_EC_FLAG_OBF))
                        break;
        case ACPI_EC_EVENT_IBE:
                if ((value & ACPI_EC_FLAG_IBF))
                        break;
-               ec->burst.expect_event = 0;
-               wake_up(&ec->burst.wait);
+               ec->intr.expect_event = 0;
+               wake_up(&ec->intr.wait);
                return ACPI_INTERRUPT_HANDLED;
        default:
                break;
        }
 
        if (value & ACPI_EC_FLAG_SCI) {
-               atomic_add(1, &ec->burst.pending_gpe);
+               atomic_add(1, &ec->intr.pending_gpe);
                status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
                                                     acpi_ec_gpe_query, ec);
                return status == AE_OK ?
@@ -980,7 +986,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device)
                                Driver Interface
    -------------------------------------------------------------------------- */
 
-static int acpi_ec_polling_add(struct acpi_device *device)
+static int acpi_ec_poll_add(struct acpi_device *device)
 {
        int result = 0;
        acpi_status status = AE_OK;
@@ -999,7 +1005,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
 
        ec->common.handle = device->handle;
        ec->common.uid = -1;
-       spin_lock_init(&ec->polling.lock);
+       spin_lock_init(&ec->poll.lock);
        strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_EC_CLASS);
        acpi_driver_data(device) = ec;
@@ -1038,7 +1044,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
        if (result)
                goto end;
 
-       printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
+       printk(KERN_INFO PREFIX "%s [%s] (gpe %d) polling mode.\n",
               acpi_device_name(device), acpi_device_bid(device),
               (u32) ec->common.gpe_bit);
 
@@ -1051,7 +1057,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
 
        return_VALUE(result);
 }
-static int acpi_ec_burst_add(struct acpi_device *device)
+static int acpi_ec_intr_add(struct acpi_device *device)
 {
        int result = 0;
        acpi_status status = AE_OK;
@@ -1070,10 +1076,10 @@ static int acpi_ec_burst_add(struct acpi_device *device)
 
        ec->common.handle = device->handle;
        ec->common.uid = -1;
-       atomic_set(&ec->burst.pending_gpe, 0);
-       atomic_set(&ec->burst.leaving_burst, 1);
-       init_MUTEX(&ec->burst.sem);
-       init_waitqueue_head(&ec->burst.wait);
+       atomic_set(&ec->intr.pending_gpe, 0);
+       atomic_set(&ec->intr.leaving_burst, 1);
+       init_MUTEX(&ec->intr.sem);
+       init_waitqueue_head(&ec->intr.wait);
        strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_EC_CLASS);
        acpi_driver_data(device) = ec;
@@ -1112,8 +1118,7 @@ static int acpi_ec_burst_add(struct acpi_device *device)
        if (result)
                goto end;
 
-       printk("burst-mode-ec-10-Aug\n");
-       printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
+       printk(KERN_INFO PREFIX "%s [%s] (gpe %d) interrupt mode.\n",
               acpi_device_name(device), acpi_device_bid(device),
               (u32) ec->common.gpe_bit);
 
@@ -1151,7 +1156,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 +1176,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;
 }
@@ -1267,16 +1272,16 @@ acpi_fake_ecdt_callback(acpi_handle handle,
                        u32 Level, void *context, void **retval)
 {
 
-       if (acpi_ec_polling_mode)
-               return acpi_fake_ecdt_polling_callback(handle,
+       if (acpi_ec_poll_mode)
+               return acpi_fake_ecdt_poll_callback(handle,
                                                       Level, context, retval);
        else
-               return acpi_fake_ecdt_burst_callback(handle,
+               return acpi_fake_ecdt_intr_callback(handle,
                                                     Level, context, retval);
 }
 
 static acpi_status __init
-acpi_fake_ecdt_polling_callback(acpi_handle handle,
+acpi_fake_ecdt_poll_callback(acpi_handle handle,
                                u32 Level, void *context, void **retval)
 {
        acpi_status status;
@@ -1295,7 +1300,7 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle,
                                  &ec_ecdt->common.gpe_bit);
        if (ACPI_FAILURE(status))
                return status;
-       spin_lock_init(&ec_ecdt->polling.lock);
+       spin_lock_init(&ec_ecdt->poll.lock);
        ec_ecdt->common.global_lock = TRUE;
        ec_ecdt->common.handle = handle;
 
@@ -1308,13 +1313,13 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle,
 }
 
 static acpi_status __init
-acpi_fake_ecdt_burst_callback(acpi_handle handle,
+acpi_fake_ecdt_intr_callback(acpi_handle handle,
                              u32 Level, void *context, void **retval)
 {
        acpi_status status;
 
-       init_MUTEX(&ec_ecdt->burst.sem);
-       init_waitqueue_head(&ec_ecdt->burst.wait);
+       init_MUTEX(&ec_ecdt->intr.sem);
+       init_waitqueue_head(&ec_ecdt->intr.wait);
        status = acpi_walk_resources(handle, METHOD_NAME__CRS,
                                     acpi_ec_io_ports, ec_ecdt);
        if (ACPI_FAILURE(status))
@@ -1380,13 +1385,13 @@ static int __init acpi_ec_fake_ecdt(void)
 
 static int __init acpi_ec_get_real_ecdt(void)
 {
-       if (acpi_ec_polling_mode)
-               return acpi_ec_polling_get_real_ecdt();
+       if (acpi_ec_poll_mode)
+               return acpi_ec_poll_get_real_ecdt();
        else
-               return acpi_ec_burst_get_real_ecdt();
+               return acpi_ec_intr_get_real_ecdt();
 }
 
-static int __init acpi_ec_polling_get_real_ecdt(void)
+static int __init acpi_ec_poll_get_real_ecdt(void)
 {
        acpi_status status;
        struct acpi_table_ecdt *ecdt_ptr;
@@ -1411,7 +1416,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void)
        ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
        ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
        ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit;
-       spin_lock_init(&ec_ecdt->polling.lock);
+       spin_lock_init(&ec_ecdt->poll.lock);
        /* use the GL just to be safe */
        ec_ecdt->common.global_lock = TRUE;
        ec_ecdt->common.uid = ecdt_ptr->uid;
@@ -1431,7 +1436,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void)
        return -ENODEV;
 }
 
-static int __init acpi_ec_burst_get_real_ecdt(void)
+static int __init acpi_ec_intr_get_real_ecdt(void)
 {
        acpi_status status;
        struct acpi_table_ecdt *ecdt_ptr;
@@ -1452,8 +1457,8 @@ static int __init acpi_ec_burst_get_real_ecdt(void)
                return -ENOMEM;
        memset(ec_ecdt, 0, sizeof(union acpi_ec));
 
-       init_MUTEX(&ec_ecdt->burst.sem);
-       init_waitqueue_head(&ec_ecdt->burst.wait);
+       init_MUTEX(&ec_ecdt->intr.sem);
+       init_waitqueue_head(&ec_ecdt->intr.wait);
        ec_ecdt->common.command_addr = ecdt_ptr->ec_control;
        ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
        ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
@@ -1571,22 +1576,22 @@ static int __init acpi_fake_ecdt_setup(char *str)
 }
 
 __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup);
-static int __init acpi_ec_set_polling_mode(char *str)
+static int __init acpi_ec_set_intr_mode(char *str)
 {
-       int burst;
+       int intr;
 
-       if (!get_option(&str, &burst))
+       if (!get_option(&str, &intr))
                return 0;
 
-       if (burst) {
-               acpi_ec_polling_mode = EC_BURST;
-               acpi_ec_driver.ops.add = acpi_ec_burst_add;
+       if (intr) {
+               acpi_ec_poll_mode = EC_INTR;
+               acpi_ec_driver.ops.add = acpi_ec_intr_add;
        } else {
-               acpi_ec_polling_mode = EC_POLLING;
-               acpi_ec_driver.ops.add = acpi_ec_polling_add;
+               acpi_ec_poll_mode = EC_POLL;
+               acpi_ec_driver.ops.add = acpi_ec_poll_add;
        }
-       printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling");
+       printk(KERN_INFO PREFIX "EC %s mode.\n", intr ? "interrupt" : "polling");
        return 0;
 }
 
-__setup("ec_burst=", acpi_ec_set_polling_mode);
+__setup("ec_intr=", acpi_ec_set_intr_mode);
index 842d1e3fb37b968c66ec45c8a6a5f9485d55df1a..c9ac05c4685fae95ff7a54322dafb293e11631f5 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -73,7 +73,7 @@ acpi_status acpi_ev_initialize_events(void)
        /* Make sure we have ACPI tables */
 
        if (!acpi_gbl_DSDT) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n"));
+               ACPI_WARNING((AE_INFO, "No ACPI tables present!"));
                return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
@@ -84,20 +84,63 @@ acpi_status acpi_ev_initialize_events(void)
         */
        status = acpi_ev_fixed_event_initialize();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
-                                  acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to initialize fixed events"));
                return_ACPI_STATUS(status);
        }
 
        status = acpi_ev_gpe_initialize();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to initialize general purpose events"));
                return_ACPI_STATUS(status);
        }
 
        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
@@ -120,7 +163,8 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
 
        status = acpi_ev_install_sci_handler();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to install System Control Interrupt handler"));
                return_ACPI_STATUS(status);
        }
 
@@ -128,7 +172,8 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
 
        status = acpi_ev_init_global_lock_handler();
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Unable to initialize Global Lock handler"));
                return_ACPI_STATUS(status);
        }
 
@@ -262,7 +307,9 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
                                        enable_register_id, 0,
                                        ACPI_MTX_DO_NOT_LOCK);
 
-               ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
+               ACPI_ERROR((AE_INFO,
+                           "No installed handler for fixed event [%08X]",
+                           event));
 
                return (ACPI_INTERRUPT_NOT_HANDLED);
        }
index b2f232df13d89e48eeab7df18f64aabdf24111dc..f64f977dd3d5a04b118ebc6f904f47a138f19ed8 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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_cpu_flags flags;
        acpi_native_uint i;
        acpi_native_uint j;
 
@@ -546,7 +546,11 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 
                status = acpi_ns_evaluate_by_handle(&info);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "While evaluating method [%4.4s] for GPE[%2X]",
+                                       acpi_ut_get_node_name
+                                       (local_gpe_event_info.dispatch.
+                                        method_node), gpe_number));
                }
        }
 
@@ -599,8 +603,10 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
            ACPI_GPE_EDGE_TRIGGERED) {
                status = acpi_hw_clear_gpe(gpe_event_info);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
-                       return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Unable to clear GPE[%2X]",
+                                       gpe_number));
+                       return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                }
        }
 
@@ -637,8 +643,10 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                    ACPI_GPE_LEVEL_TRIGGERED) {
                        status = acpi_hw_clear_gpe(gpe_event_info);
                        if (ACPI_FAILURE(status)) {
-                               ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
-                               return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
+                               ACPI_EXCEPTION((AE_INFO, status,
+                                               "Unable to clear GPE[%2X]",
+                                               gpe_number));
+                               return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                        }
                }
                break;
@@ -651,8 +659,10 @@ 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);
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Unable to disable GPE[%2X]",
+                                       gpe_number));
+                       return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                }
 
                /*
@@ -663,7 +673,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                                                     acpi_ev_asynch_execute_gpe_method,
                                                     gpe_event_info);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Unable to queue handler for GPE[%2X] - event disabled",
+                                       gpe_number));
                }
                break;
 
@@ -671,7 +683,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
 
                /* No handler or method to run! */
 
-               ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number));
+               ACPI_ERROR((AE_INFO,
+                           "No handler or method for GPE[%2X], disabling event",
+                           gpe_number));
 
                /*
                 * Disable the GPE.  The GPE will remain disabled until the ACPI
@@ -679,13 +693,15 @@ 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);
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Unable to disable GPE[%2X]",
+                                       gpe_number));
+                       return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
                }
                break;
        }
 
-       return_VALUE(ACPI_INTERRUPT_HANDLED);
+       return_UINT32(ACPI_INTERRUPT_HANDLED);
 }
 
 #ifdef ACPI_GPE_NOTIFY_CHECK
@@ -722,7 +738,9 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
 
                acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
 
-               ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info));
+               ACPI_INFO((AE_INFO,
+                          "GPE %p was updated from wake/run to wake-only",
+                          gpe_event_info));
 
                /* This was a wake-only GPE */
 
index b312eb33c43ee6086123f2b50a23da722b124091..0fd00b5ad650c454776908905cc73484f9bc3383 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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_cpu_flags flags;
 
        ACPI_FUNCTION_TRACE("ev_walk_gpe_list");
 
@@ -264,7 +264,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
         * 2) Edge/Level determination is based on the 2nd character
         *    of the method name
         *
-        * NOTE: Default GPE type is RUNTIME.  May be changed later to WAKE
+        * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
         * if a _PRW object is found that points to this GPE.
         */
        switch (name[1]) {
@@ -279,9 +279,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
        default:
                /* Unknown method type, just ignore it! */
 
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n",
-                                 name));
+               ACPI_ERROR((AE_INFO,
+                           "Unknown GPE method type: %s (name not of form _Lxx or _Exx)",
+                           name));
                return_ACPI_STATUS(AE_OK);
        }
 
@@ -291,9 +291,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
        if (gpe_number == ACPI_UINT32_MAX) {
                /* Conversion failed; invalid method, just ignore it */
 
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n",
-                                 name));
+               ACPI_ERROR((AE_INFO,
+                           "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
+                           name));
                return_ACPI_STATUS(AE_OK);
        }
 
@@ -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_cpu_flags flags;
 
        ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block");
 
@@ -526,9 +527,9 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
                                                           acpi_ev_gpe_xrupt_handler,
                                                           gpe_xrupt);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Could not install GPE interrupt handler at level 0x%X\n",
-                                         interrupt_number));
+                       ACPI_ERROR((AE_INFO,
+                                   "Could not install GPE interrupt handler at level 0x%X",
+                                   interrupt_number));
                        return_PTR(NULL);
                }
        }
@@ -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_cpu_flags 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_cpu_flags 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_cpu_flags flags;
 
        ACPI_FUNCTION_TRACE("ev_install_gpe_block");
 
@@ -743,22 +745,22 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
                                               sizeof(struct
                                                      acpi_gpe_register_info));
        if (!gpe_register_info) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Could not allocate the gpe_register_info table\n"));
+               ACPI_ERROR((AE_INFO,
+                           "Could not allocate the gpe_register_info table"));
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /*
         * Allocate the GPE event_info block. There are eight distinct GPEs
-        * per register.  Initialization to zeros is sufficient.
+        * per register. Initialization to zeros is sufficient.
         */
        gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block->
                                             register_count *
                                             ACPI_GPE_REGISTER_WIDTH) *
                                            sizeof(struct acpi_gpe_event_info));
        if (!gpe_event_info) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Could not allocate the gpe_event_info table\n"));
+               ACPI_ERROR((AE_INFO,
+                           "Could not allocate the gpe_event_info table"));
                status = AE_NO_MEMORY;
                goto error_exit;
        }
@@ -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_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p",
+                           gpe_block));
        }
 
-       return_ACPI_STATUS(AE_OK);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -1072,8 +1115,8 @@ acpi_status acpi_ev_gpe_initialize(void)
                                                  &acpi_gbl_gpe_fadt_blocks[0]);
 
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n",
-                                          acpi_format_exception(status)));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Could not create GPE Block 0"));
                }
        }
 
@@ -1086,7 +1129,12 @@ acpi_status acpi_ev_gpe_initialize(void)
 
                if ((register_count0) &&
                    (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
-                       ACPI_REPORT_ERROR(("GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", gpe_number_max, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
+                       ACPI_ERROR((AE_INFO,
+                                   "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
+                                   gpe_number_max, acpi_gbl_FADT->gpe1_base,
+                                   acpi_gbl_FADT->gpe1_base +
+                                   ((register_count1 *
+                                     ACPI_GPE_REGISTER_WIDTH) - 1)));
 
                        /* Ignore GPE1 block by setting the register count to zero */
 
@@ -1104,7 +1152,8 @@ acpi_status acpi_ev_gpe_initialize(void)
                                                     [1]);
 
                        if (ACPI_FAILURE(status)) {
-                               ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status)));
+                               ACPI_EXCEPTION((AE_INFO, status,
+                                               "Could not create GPE Block 1"));
                        }
 
                        /*
@@ -1130,7 +1179,9 @@ acpi_status acpi_ev_gpe_initialize(void)
        /* Check for Max GPE number out-of-range */
 
        if (gpe_number_max > ACPI_GPE_MAX) {
-               ACPI_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max));
+               ACPI_ERROR((AE_INFO,
+                           "Maximum GPE number from FADT is too large: 0x%X",
+                           gpe_number_max));
                status = AE_BAD_VALUE;
                goto cleanup;
        }
index 7e57b8470f55a7aa39af4c97c7d395d411a19499..0909ba69577e6806f4315f11389c97518423c2bf 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -303,7 +303,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
                    acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
                                             acpi_gbl_global_lock_thread_count);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n"));
+                       ACPI_ERROR((AE_INFO,
+                                   "Could not signal Global Lock semaphore"));
                }
        }
 }
@@ -344,7 +345,8 @@ static u32 acpi_ev_global_lock_handler(void *context)
                                                     acpi_ev_global_lock_thread,
                                                     context);
                if (ACPI_FAILURE(status)) {
-                       ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status)));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Could not queue Global Lock thread"));
 
                        return (ACPI_INTERRUPT_NOT_HANDLED);
                }
@@ -384,7 +386,8 @@ acpi_status acpi_ev_init_global_lock_handler(void)
         * with an error.
         */
        if (status == AE_NO_HARDWARE_RESPONSE) {
-               ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n"));
+               ACPI_ERROR((AE_INFO,
+                           "No response from Global Lock hardware, disabling lock"));
 
                acpi_gbl_global_lock_present = FALSE;
                status = AE_OK;
@@ -480,7 +483,8 @@ acpi_status acpi_ev_release_global_lock(void)
        ACPI_FUNCTION_TRACE("ev_release_global_lock");
 
        if (!acpi_gbl_global_lock_thread_count) {
-               ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
+               ACPI_WARNING((AE_INFO,
+                             "Cannot release HW Global Lock, it has not been acquired"));
                return_ACPI_STATUS(AE_NOT_ACQUIRED);
        }
 
@@ -542,9 +546,9 @@ void acpi_ev_terminate(void)
                for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
                        status = acpi_disable_event((u32) i, 0);
                        if (ACPI_FAILURE(status)) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "Could not disable fixed event %d\n",
-                                                 (u32) i));
+                               ACPI_ERROR((AE_INFO,
+                                           "Could not disable fixed event %d",
+                                           (u32) i));
                        }
                }
 
@@ -556,8 +560,7 @@ void acpi_ev_terminate(void)
 
                status = acpi_ev_remove_sci_handler();
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Could not remove SCI handler\n"));
+                       ACPI_ERROR((AE_INFO, "Could not remove SCI handler"));
                }
        }
 
@@ -570,8 +573,7 @@ void acpi_ev_terminate(void)
        if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
                status = acpi_disable();
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
-                                         "acpi_disable failed\n"));
+                       ACPI_WARNING((AE_INFO, "acpi_disable failed"));
                }
        }
        return_VOID;
index 84fad082d80d22205b2c559313ddb6f02e690e00..6da58e776413a819123d3401f080ac7df702d9c0 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -295,12 +295,12 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 
        handler_desc = region_obj->region.handler;
        if (!handler_desc) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No handler for Region [%4.4s] (%p) [%s]\n",
-                                 acpi_ut_get_node_name(region_obj->region.
-                                                       node), region_obj,
-                                 acpi_ut_get_region_name(region_obj->region.
-                                                         space_id)));
+               ACPI_ERROR((AE_INFO,
+                           "No handler for Region [%4.4s] (%p) [%s]",
+                           acpi_ut_get_node_name(region_obj->region.node),
+                           region_obj,
+                           acpi_ut_get_region_name(region_obj->region.
+                                                   space_id)));
 
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
@@ -317,12 +317,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                if (!region_setup) {
                        /* No initialization routine, exit with error */
 
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "No init routine for region(%p) [%s]\n",
-                                         region_obj,
-                                         acpi_ut_get_region_name(region_obj->
-                                                                 region.
-                                                                 space_id)));
+                       ACPI_ERROR((AE_INFO,
+                                   "No init routine for region(%p) [%s]",
+                                   region_obj,
+                                   acpi_ut_get_region_name(region_obj->region.
+