Merge branch 'linus' into release
authorLen Brown <len.brown@intel.com>
Fri, 9 Jan 2009 08:39:43 +0000 (03:39 -0500)
committerLen Brown <len.brown@intel.com>
Fri, 9 Jan 2009 08:39:43 +0000 (03:39 -0500)
203 files changed:
Documentation/kernel-parameters.txt
arch/ia64/include/asm/acpi-ext.h
arch/ia64/include/asm/sn/acpi.h
arch/ia64/kernel/acpi.c
arch/ia64/sn/kernel/io_acpi_init.c
arch/ia64/sn/kernel/io_common.c
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/acpi/cstate.c
arch/x86/kernel/acpi/sleep.c
arch/x86/kernel/e820.c
drivers/acpi/Makefile
drivers/acpi/acpica/Makefile [new file with mode: 0644]
drivers/acpi/acpica/accommon.h [new file with mode: 0644]
drivers/acpi/acpica/acconfig.h [moved from include/acpi/acconfig.h with 98% similarity]
drivers/acpi/acpica/acdebug.h [moved from include/acpi/acdebug.h with 100% similarity]
drivers/acpi/acpica/acdispat.h [moved from include/acpi/acdispat.h with 100% similarity]
drivers/acpi/acpica/acevents.h [moved from include/acpi/acevents.h with 97% similarity]
drivers/acpi/acpica/acglobal.h [moved from include/acpi/acglobal.h with 97% similarity]
drivers/acpi/acpica/achware.h [moved from include/acpi/achware.h with 89% similarity]
drivers/acpi/acpica/acinterp.h [moved from include/acpi/acinterp.h with 100% similarity]
drivers/acpi/acpica/aclocal.h [moved from include/acpi/aclocal.h with 95% similarity]
drivers/acpi/acpica/acmacros.h [moved from include/acpi/acmacros.h with 83% similarity]
drivers/acpi/acpica/acnamesp.h [moved from include/acpi/acnamesp.h with 98% similarity]
drivers/acpi/acpica/acobject.h [moved from include/acpi/acobject.h with 100% similarity]
drivers/acpi/acpica/acopcode.h [moved from include/acpi/acopcode.h with 100% similarity]
drivers/acpi/acpica/acparser.h [moved from include/acpi/acparser.h with 100% similarity]
drivers/acpi/acpica/acpredef.h [moved from include/acpi/acpredef.h with 100% similarity]
drivers/acpi/acpica/acresrc.h [moved from include/acpi/acresrc.h with 100% similarity]
drivers/acpi/acpica/acstruct.h [moved from include/acpi/acstruct.h with 100% similarity]
drivers/acpi/acpica/actables.h [moved from include/acpi/actables.h with 98% similarity]
drivers/acpi/acpica/acutils.h [moved from include/acpi/acutils.h with 93% similarity]
drivers/acpi/acpica/amlcode.h [moved from include/acpi/amlcode.h with 100% similarity]
drivers/acpi/acpica/amlresrc.h [moved from include/acpi/amlresrc.h with 100% similarity]
drivers/acpi/acpica/dsfield.c [moved from drivers/acpi/dispatcher/dsfield.c with 99% similarity]
drivers/acpi/acpica/dsinit.c [moved from drivers/acpi/dispatcher/dsinit.c with 98% similarity]
drivers/acpi/acpica/dsmethod.c [moved from drivers/acpi/dispatcher/dsmethod.c with 98% similarity]
drivers/acpi/acpica/dsmthdat.c [moved from drivers/acpi/dispatcher/dsmthdat.c with 99% similarity]
drivers/acpi/acpica/dsobject.c [moved from drivers/acpi/dispatcher/dsobject.c with 99% similarity]
drivers/acpi/acpica/dsopcode.c [moved from drivers/acpi/dispatcher/dsopcode.c with 96% similarity]
drivers/acpi/acpica/dsutils.c [moved from drivers/acpi/dispatcher/dsutils.c with 99% similarity]
drivers/acpi/acpica/dswexec.c [moved from drivers/acpi/dispatcher/dswexec.c with 99% similarity]
drivers/acpi/acpica/dswload.c [moved from drivers/acpi/dispatcher/dswload.c with 99% similarity]
drivers/acpi/acpica/dswscope.c [moved from drivers/acpi/dispatcher/dswscope.c with 99% similarity]
drivers/acpi/acpica/dswstate.c [moved from drivers/acpi/dispatcher/dswstate.c with 99% similarity]
drivers/acpi/acpica/evevent.c [moved from drivers/acpi/events/evevent.c with 96% similarity]
drivers/acpi/acpica/evgpe.c [moved from drivers/acpi/events/evgpe.c with 94% similarity]
drivers/acpi/acpica/evgpeblk.c [moved from drivers/acpi/events/evgpeblk.c with 94% similarity]
drivers/acpi/acpica/evmisc.c [moved from drivers/acpi/events/evmisc.c with 93% similarity]
drivers/acpi/acpica/evregion.c [moved from drivers/acpi/events/evregion.c with 91% similarity]
drivers/acpi/acpica/evrgnini.c [moved from drivers/acpi/events/evrgnini.c with 95% similarity]
drivers/acpi/acpica/evsci.c [moved from drivers/acpi/events/evsci.c with 95% similarity]
drivers/acpi/acpica/evxface.c [moved from drivers/acpi/events/evxface.c with 99% similarity]
drivers/acpi/acpica/evxfevnt.c [moved from drivers/acpi/events/evxfevnt.c with 81% similarity]
drivers/acpi/acpica/evxfregn.c [moved from drivers/acpi/events/evxfregn.c with 99% similarity]
drivers/acpi/acpica/exconfig.c [moved from drivers/acpi/executer/exconfig.c with 99% similarity]
drivers/acpi/acpica/exconvrt.c [moved from drivers/acpi/executer/exconvrt.c with 99% similarity]
drivers/acpi/acpica/excreate.c [moved from drivers/acpi/executer/excreate.c with 99% similarity]
drivers/acpi/acpica/exdump.c [moved from drivers/acpi/executer/exdump.c with 99% similarity]
drivers/acpi/acpica/exfield.c [moved from drivers/acpi/executer/exfield.c with 99% similarity]
drivers/acpi/acpica/exfldio.c [moved from drivers/acpi/executer/exfldio.c with 98% similarity]
drivers/acpi/acpica/exmisc.c [moved from drivers/acpi/executer/exmisc.c with 99% similarity]
drivers/acpi/acpica/exmutex.c [moved from drivers/acpi/executer/exmutex.c with 99% similarity]
drivers/acpi/acpica/exnames.c [moved from drivers/acpi/executer/exnames.c with 99% similarity]
drivers/acpi/acpica/exoparg1.c [moved from drivers/acpi/executer/exoparg1.c with 99% similarity]
drivers/acpi/acpica/exoparg2.c [moved from drivers/acpi/executer/exoparg2.c with 99% similarity]
drivers/acpi/acpica/exoparg3.c [moved from drivers/acpi/executer/exoparg3.c with 98% similarity]
drivers/acpi/acpica/exoparg6.c [moved from drivers/acpi/executer/exoparg6.c with 99% similarity]
drivers/acpi/acpica/exprep.c [moved from drivers/acpi/executer/exprep.c with 99% similarity]
drivers/acpi/acpica/exregion.c [moved from drivers/acpi/executer/exregion.c with 99% similarity]
drivers/acpi/acpica/exresnte.c [moved from drivers/acpi/executer/exresnte.c with 98% similarity]
drivers/acpi/acpica/exresolv.c [moved from drivers/acpi/executer/exresolv.c with 99% similarity]
drivers/acpi/acpica/exresop.c [moved from drivers/acpi/executer/exresop.c with 99% similarity]
drivers/acpi/acpica/exstore.c [moved from drivers/acpi/executer/exstore.c with 99% similarity]
drivers/acpi/acpica/exstoren.c [moved from drivers/acpi/executer/exstoren.c with 99% similarity]
drivers/acpi/acpica/exstorob.c [moved from drivers/acpi/executer/exstorob.c with 99% similarity]
drivers/acpi/acpica/exsystem.c [moved from drivers/acpi/executer/exsystem.c with 99% similarity]
drivers/acpi/acpica/exutils.c [moved from drivers/acpi/executer/exutils.c with 99% similarity]
drivers/acpi/acpica/hwacpi.c [moved from drivers/acpi/hardware/hwacpi.c with 99% similarity]
drivers/acpi/acpica/hwgpe.c [moved from drivers/acpi/hardware/hwgpe.c with 86% similarity]
drivers/acpi/acpica/hwregs.c [new file with mode: 0644]
drivers/acpi/acpica/hwsleep.c [moved from drivers/acpi/hardware/hwsleep.c with 91% similarity]
drivers/acpi/acpica/hwtimer.c [moved from drivers/acpi/hardware/hwtimer.c with 99% similarity]
drivers/acpi/acpica/hwxface.c [moved from drivers/acpi/hardware/hwregs.c with 62% similarity]
drivers/acpi/acpica/nsaccess.c [moved from drivers/acpi/namespace/nsaccess.c with 98% similarity]
drivers/acpi/acpica/nsalloc.c [moved from drivers/acpi/namespace/nsalloc.c with 99% similarity]
drivers/acpi/acpica/nsdump.c [moved from drivers/acpi/namespace/nsdump.c with 99% similarity]
drivers/acpi/acpica/nsdumpdv.c [moved from drivers/acpi/namespace/nsdumpdv.c with 99% similarity]
drivers/acpi/acpica/nseval.c [moved from drivers/acpi/namespace/nseval.c with 81% similarity]
drivers/acpi/acpica/nsinit.c [moved from drivers/acpi/namespace/nsinit.c with 99% similarity]
drivers/acpi/acpica/nsload.c [moved from drivers/acpi/namespace/nsload.c with 99% similarity]
drivers/acpi/acpica/nsnames.c [moved from drivers/acpi/namespace/nsnames.c with 99% similarity]
drivers/acpi/acpica/nsobject.c [moved from drivers/acpi/namespace/nsobject.c with 99% similarity]
drivers/acpi/acpica/nsparse.c [moved from drivers/acpi/namespace/nsparse.c with 98% similarity]
drivers/acpi/acpica/nspredef.c [moved from drivers/acpi/namespace/nspredef.c with 76% similarity]
drivers/acpi/acpica/nssearch.c [moved from drivers/acpi/namespace/nssearch.c with 99% similarity]
drivers/acpi/acpica/nsutils.c [moved from drivers/acpi/namespace/nsutils.c with 98% similarity]
drivers/acpi/acpica/nswalk.c [moved from drivers/acpi/namespace/nswalk.c with 99% similarity]
drivers/acpi/acpica/nsxfeval.c [moved from drivers/acpi/namespace/nsxfeval.c with 99% similarity]
drivers/acpi/acpica/nsxfname.c [moved from drivers/acpi/namespace/nsxfname.c with 99% similarity]
drivers/acpi/acpica/nsxfobj.c [moved from drivers/acpi/namespace/nsxfobj.c with 99% similarity]
drivers/acpi/acpica/psargs.c [moved from drivers/acpi/parser/psargs.c with 99% similarity]
drivers/acpi/acpica/psloop.c [moved from drivers/acpi/parser/psloop.c with 99% similarity]
drivers/acpi/acpica/psopcode.c [moved from drivers/acpi/parser/psopcode.c with 99% similarity]
drivers/acpi/acpica/psparse.c [moved from drivers/acpi/parser/psparse.c with 97% similarity]
drivers/acpi/acpica/psscope.c [moved from drivers/acpi/parser/psscope.c with 99% similarity]
drivers/acpi/acpica/pstree.c [moved from drivers/acpi/parser/pstree.c with 99% similarity]
drivers/acpi/acpica/psutils.c [moved from drivers/acpi/parser/psutils.c with 99% similarity]
drivers/acpi/acpica/pswalk.c [moved from drivers/acpi/parser/pswalk.c with 98% similarity]
drivers/acpi/acpica/psxface.c [moved from drivers/acpi/parser/psxface.c with 90% similarity]
drivers/acpi/acpica/rsaddr.c [moved from drivers/acpi/resources/rsaddr.c with 99% similarity]
drivers/acpi/acpica/rscalc.c [moved from drivers/acpi/resources/rscalc.c with 99% similarity]
drivers/acpi/acpica/rscreate.c [moved from drivers/acpi/resources/rscreate.c with 99% similarity]
drivers/acpi/acpica/rsdump.c [moved from drivers/acpi/resources/rsdump.c with 99% similarity]
drivers/acpi/acpica/rsinfo.c [moved from drivers/acpi/resources/rsinfo.c with 99% similarity]
drivers/acpi/acpica/rsio.c [moved from drivers/acpi/resources/rsio.c with 99% similarity]
drivers/acpi/acpica/rsirq.c [moved from drivers/acpi/resources/rsirq.c with 99% similarity]
drivers/acpi/acpica/rslist.c [moved from drivers/acpi/resources/rslist.c with 99% similarity]
drivers/acpi/acpica/rsmemory.c [moved from drivers/acpi/resources/rsmemory.c with 99% similarity]
drivers/acpi/acpica/rsmisc.c [moved from drivers/acpi/resources/rsmisc.c with 99% similarity]
drivers/acpi/acpica/rsutils.c [moved from drivers/acpi/resources/rsutils.c with 99% similarity]
drivers/acpi/acpica/rsxface.c [moved from drivers/acpi/resources/rsxface.c with 99% similarity]
drivers/acpi/acpica/tbfadt.c [moved from drivers/acpi/tables/tbfadt.c with 67% similarity]
drivers/acpi/acpica/tbfind.c [moved from drivers/acpi/tables/tbfind.c with 99% similarity]
drivers/acpi/acpica/tbinstal.c [moved from drivers/acpi/tables/tbinstal.c with 99% similarity]
drivers/acpi/acpica/tbutils.c [moved from drivers/acpi/tables/tbutils.c with 95% similarity]
drivers/acpi/acpica/tbxface.c [moved from drivers/acpi/tables/tbxface.c with 99% similarity]
drivers/acpi/acpica/tbxfroot.c [moved from drivers/acpi/tables/tbxfroot.c with 99% similarity]
drivers/acpi/acpica/utalloc.c [moved from drivers/acpi/utilities/utalloc.c with 99% similarity]
drivers/acpi/acpica/utcopy.c [moved from drivers/acpi/utilities/utcopy.c with 99% similarity]
drivers/acpi/acpica/utdebug.c [moved from drivers/acpi/utilities/utdebug.c with 89% similarity]
drivers/acpi/acpica/utdelete.c [moved from drivers/acpi/utilities/utdelete.c with 99% similarity]
drivers/acpi/acpica/uteval.c [moved from drivers/acpi/utilities/uteval.c with 99% similarity]
drivers/acpi/acpica/utglobal.c [moved from drivers/acpi/utilities/utglobal.c with 99% similarity]
drivers/acpi/acpica/utinit.c [moved from drivers/acpi/utilities/utinit.c with 98% similarity]
drivers/acpi/acpica/utmath.c [moved from drivers/acpi/utilities/utmath.c with 99% similarity]
drivers/acpi/acpica/utmisc.c [moved from drivers/acpi/utilities/utmisc.c with 97% similarity]
drivers/acpi/acpica/utmutex.c [moved from drivers/acpi/utilities/utmutex.c with 99% similarity]
drivers/acpi/acpica/utobject.c [moved from drivers/acpi/utilities/utobject.c with 99% similarity]
drivers/acpi/acpica/utresrc.c [moved from drivers/acpi/utilities/utresrc.c with 99% similarity]
drivers/acpi/acpica/utstate.c [moved from drivers/acpi/utilities/utstate.c with 99% similarity]
drivers/acpi/acpica/utxface.c [moved from drivers/acpi/utilities/utxface.c with 97% similarity]
drivers/acpi/battery.c
drivers/acpi/cm_sbs.c
drivers/acpi/debug.c
drivers/acpi/dispatcher/Makefile [deleted file]
drivers/acpi/ec.c
drivers/acpi/events/Makefile [deleted file]
drivers/acpi/executer/Makefile [deleted file]
drivers/acpi/hardware/Makefile [deleted file]
drivers/acpi/main.c [moved from drivers/acpi/sleep/main.c with 92% similarity]
drivers/acpi/namespace/Makefile [deleted file]
drivers/acpi/numa.c
drivers/acpi/osl.c
drivers/acpi/parser/Makefile [deleted file]
drivers/acpi/pci_link.c
drivers/acpi/power.c
drivers/acpi/proc.c [moved from drivers/acpi/sleep/proc.c with 92% similarity]
drivers/acpi/reboot.c
drivers/acpi/resources/Makefile [deleted file]
drivers/acpi/sbshc.c
drivers/acpi/scan.c
drivers/acpi/sleep.h [moved from drivers/acpi/sleep/sleep.h with 100% similarity]
drivers/acpi/sleep/Makefile [deleted file]
drivers/acpi/system.c
drivers/acpi/tables/Makefile [deleted file]
drivers/acpi/utilities/Makefile [deleted file]
drivers/acpi/utilities/utcache.c [deleted file]
drivers/acpi/video.c
drivers/acpi/video_detect.c
drivers/acpi/wakeup.c [moved from drivers/acpi/sleep/wakeup.c with 96% similarity]
drivers/ata/libata-acpi.c
drivers/ata/pata_acpi.c
drivers/char/tpm/tpm_bios.c
drivers/cpuidle/governors/menu.c
drivers/ide/ide-acpi.c
drivers/misc/Kconfig
drivers/misc/fujitsu-laptop.c
drivers/misc/panasonic-laptop.c
drivers/misc/sony-laptop.c
drivers/misc/tc1100-wmi.c
drivers/misc/thinkpad_acpi.c
drivers/pci/hotplug/acpi_pcihp.c
drivers/pci/hotplug/pciehp.h
drivers/pci/pci-acpi.c
drivers/pnp/pnpacpi/core.c
include/acpi/acdisasm.h [deleted file]
include/acpi/acexcep.h
include/acpi/acoutput.h
include/acpi/acpi.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acrestyp.h [new file with mode: 0644]
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actypes.h
include/acpi/platform/acenv.h
include/acpi/platform/aclinux.h
include/linux/acpi.h
include/linux/pci_hotplug.h
include/linux/suspend.h
kernel/power/disk.c
kernel/power/snapshot.c
kernel/power/swsusp.c

index fb849020aea9349c9c7c6a095b2526316d95529f..fcc48bf722a8f635768912ee421156b37aab44fe 100644 (file)
@@ -141,6 +141,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        ht -- run only enough ACPI to enable Hyper Threading
                        strict -- Be less tolerant of platforms that are not
                                strictly ACPI specification compliant.
+                       rsdt -- prefer RSDT over (default) XSDT
 
                        See also Documentation/power/pm.txt, pci=noacpi
 
@@ -151,16 +152,20 @@ and is between 256 and 4096 characters. It is defined in the file
                        default: 0
 
        acpi_sleep=     [HW,ACPI] Sleep options
-                       Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, old_ordering }
-                       See Documentation/power/video.txt for s3_bios and s3_mode.
+                       Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig,
+                                 old_ordering, s4_nonvs }
+                       See Documentation/power/video.txt for information on
+                       s3_bios and s3_mode.
                        s3_beep is for debugging; it makes the PC's speaker beep
                        as soon as the kernel's real-mode entry point is called.
                        s4_nohwsig prevents ACPI hardware signature from being
                        used during resume from hibernation.
                        old_ordering causes the ACPI 1.0 ordering of the _PTS
-                       control method, wrt putting devices into low power
-                       states, to be enforced (the ACPI 2.0 ordering of _PTS is
-                       used by default).
+                       control method, with respect to putting devices into
+                       low power states, to be enforced (the ACPI 2.0 ordering
+                       of _PTS is used by default).
+                       s4_nonvs prevents the kernel from saving/restoring the
+                       ACPI NVS memory during hibernation.
 
        acpi_sci=       [HW,ACPI] ACPI System Control Interrupt trigger mode
                        Format: { level | edge | high | low }
@@ -195,7 +200,7 @@ and is between 256 and 4096 characters. It is defined in the file
        acpi_skip_timer_override [HW,ACPI]
                        Recognize and ignore IRQ0/pin2 Interrupt Override.
                        For broken nForce2 BIOS resulting in XT-PIC timer.
-       acpi_use_timer_override [HW,ACPI}
+       acpi_use_timer_override [HW,ACPI]
                        Use timer override. For some broken Nvidia NF5 boards
                        that require a timer override, but don't have
                        HPET
@@ -878,17 +883,19 @@ and is between 256 and 4096 characters. It is defined in the file
                        See Documentation/ide/ide.txt.
 
        idle=           [X86]
-                       Format: idle=poll or idle=mwait, idle=halt, idle=nomwait
-                       Poll forces a polling idle loop that can slightly improves the performance
-                       of waking up a idle CPU, but will use a lot of power and make the system
-                       run hot. Not recommended.
-                       idle=mwait. On systems which support MONITOR/MWAIT but the kernel chose
-                       to not use it because it doesn't save as much power as a normal idle
-                       loop use the MONITOR/MWAIT idle loop anyways. Performance should be the same
-                       as idle=poll.
-                       idle=halt. Halt is forced to be used for CPU idle.
+                       Format: idle=poll, idle=mwait, idle=halt, idle=nomwait
+                       Poll forces a polling idle loop that can slightly
+                       improve the performance of waking up a idle CPU, but
+                       will use a lot of power and make the system run hot.
+                       Not recommended.
+                       idle=mwait: On systems which support MONITOR/MWAIT but
+                       the kernel chose to not use it because it doesn't save
+                       as much power as a normal idle loop, use the
+                       MONITOR/MWAIT idle loop anyways. Performance should be
+                       the same as idle=poll.
+                       idle=halt: Halt is forced to be used for CPU idle.
                        In such case C2/C3 won't be used again.
-                       idle=nomwait. Disable mwait for CPU C-states
+                       idle=nomwait: Disable mwait for CPU C-states
 
        ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem
                        Claim all unknown PCI IDE storage controllers.
@@ -1074,8 +1081,8 @@ and is between 256 and 4096 characters. It is defined in the file
        lapic           [X86-32,APIC] Enable the local APIC even if BIOS
                        disabled it.
 
-       lapic_timer_c2_ok       [X86-32,x86-64,APIC] trust the local apic timer in
-                       C2 power state.
+       lapic_timer_c2_ok       [X86-32,x86-64,APIC] trust the local apic timer
+                       in C2 power state.
 
        libata.dma=     [LIBATA] DMA control
                        libata.dma=0      Disable all PATA and SATA DMA
@@ -2303,7 +2310,8 @@ and is between 256 and 4096 characters. It is defined in the file
 
        thermal.psv=    [HW,ACPI]
                        -1: disable all passive trip points
-                       <degrees C>: override all passive trip points to this value
+                       <degrees C>: override all passive trip points to this
+                       value
 
        thermal.tzp=    [HW,ACPI]
                        Specify global default ACPI thermal zone polling rate
index 734d137dda6ecb22f1f58c9cc09f6925fe605e03..7f8362b379eb9f5661829de36ca93c38a76d0388 100644 (file)
@@ -14,7 +14,6 @@
 #define _ASM_IA64_ACPI_EXT_H
 
 #include <linux/types.h>
-#include <acpi/actypes.h>
 
 extern acpi_status hp_acpi_csr_space (acpi_handle, u64 *base, u64 *length);
 
index 9ce2801cbd5725a87fa19953d3eed714889febe6..fd480db255659bfe85d8bc29ae9f3dd5ebb3000e 100644 (file)
@@ -9,8 +9,6 @@
 #ifndef _ASM_IA64_SN_ACPI_H
 #define _ASM_IA64_SN_ACPI_H
 
-#include "acpi/acglobal.h"
-
 extern int sn_acpi_rev;
 #define SN_ACPI_BASE_SUPPORT()   (sn_acpi_rev >= 0x20101)
 
index 0553648b7595742f5e19bc99ff6e6eca0c7b0284..d541671caf4a8d7e655ce5b9e811b25c8dd4777b 100644 (file)
@@ -65,6 +65,7 @@ EXPORT_SYMBOL(pm_idle);
 void (*pm_power_off) (void);
 EXPORT_SYMBOL(pm_power_off);
 
+u32 acpi_rsdt_forced;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
index bc610a6c7851bab9c4a58c639cea8d12778724c9..c5a214026a775c5d82e27fddd1c85cad2d883598 100644 (file)
@@ -13,7 +13,6 @@
 #include <asm/sn/sn_sal.h>
 #include "xtalk/hubdev.h"
 #include <linux/acpi.h>
-#include <acpi/acnamesp.h>
 
 
 /*
@@ -64,6 +63,7 @@ static acpi_status __init
 sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
 {
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        u64 addr;
        struct hubdev_info *hubdev;
        struct hubdev_info *hubdev_ptr;
@@ -77,11 +77,12 @@ sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
        status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
                                          &sn_uuid, &buffer);
        if (ACPI_FAILURE(status)) {
+               acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer);
                printk(KERN_ERR
                       "sn_acpi_hubdev_init: acpi_get_vendor_resource() "
-                      "(0x%x) failed for: ", status);
-               acpi_ns_print_node_pathname(handle, NULL);
-               printk("\n");
+                      "(0x%x) failed for: %s\n", status,
+                       (char *)name_buffer.pointer);
+               kfree(name_buffer.pointer);
                return AE_OK;           /* Continue walking namespace */
        }
 
@@ -89,11 +90,12 @@ sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
        vendor = &resource->data.vendor_typed;
        if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
            sizeof(struct hubdev_info *)) {
+               acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer);
                printk(KERN_ERR
-                      "sn_acpi_hubdev_init: Invalid vendor data length: %d for: ",
-                       vendor->byte_length);
-               acpi_ns_print_node_pathname(handle, NULL);
-               printk("\n");
+                      "sn_acpi_hubdev_init: Invalid vendor data length: "
+                      "%d for: %s\n",
+                       vendor->byte_length, (char *)name_buffer.pointer);
+               kfree(name_buffer.pointer);
                goto exit;
        }
 
@@ -120,6 +122,7 @@ sn_get_bussoft_ptr(struct pci_bus *bus)
 {
        u64 addr;
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        acpi_handle handle;
        struct pcibus_bussoft *prom_bussoft_ptr;
        struct acpi_resource *resource;
@@ -131,11 +134,11 @@ sn_get_bussoft_ptr(struct pci_bus *bus)
        status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
                                          &sn_uuid, &buffer);
        if (ACPI_FAILURE(status)) {
+               acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer);
                printk(KERN_ERR "%s: "
-                      "acpi_get_vendor_resource() failed (0x%x) for: ",
-                      __func__, status);
-               acpi_ns_print_node_pathname(handle, NULL);
-               printk("\n");
+                      "acpi_get_vendor_resource() failed (0x%x) for: %s\n",
+                      __func__, status, (char *)name_buffer.pointer);
+               kfree(name_buffer.pointer);
                return NULL;
        }
        resource = buffer.pointer;
@@ -168,6 +171,7 @@ sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info,
 {
        u64 addr;
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        struct sn_irq_info *irq_info, *irq_info_prom;
        struct pcidev_info *pcidev_ptr, *pcidev_prom_ptr;
        struct acpi_resource *resource;
@@ -182,11 +186,11 @@ sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info,
        status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
                                          &sn_uuid, &buffer);
        if (ACPI_FAILURE(status)) {
+               acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer);
                printk(KERN_ERR
-                      "%s: acpi_get_vendor_resource() failed (0x%x) for: ",
-                       __func__, status);
-               acpi_ns_print_node_pathname(handle, NULL);
-               printk("\n");
+                      "%s: acpi_get_vendor_resource() failed (0x%x) for: %s\n",
+                       __func__, status, (char *)name_buffer.pointer);
+               kfree(name_buffer.pointer);
                return 1;
        }
 
@@ -194,11 +198,12 @@ sn_extract_device_info(acpi_handle handle, struct pcidev_info **pcidev_info,
        vendor = &resource->data.vendor_typed;
        if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
            sizeof(struct pci_devdev_info *)) {
+               acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer);
                printk(KERN_ERR
-                      "%s: Invalid vendor data length: %d for: ",
-                       __func__, vendor->byte_length);
-               acpi_ns_print_node_pathname(handle, NULL);
-               printk("\n");
+                      "%s: Invalid vendor data length: %d for: %s\n",
+                        __func__, vendor->byte_length,
+                       (char *)name_buffer.pointer);
+               kfree(name_buffer.pointer);
                ret = 1;
                goto exit;
        }
@@ -239,6 +244,9 @@ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle)
        acpi_handle parent;
        int slot;
        acpi_status status;
+       struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+
+       acpi_get_name(device_handle, ACPI_FULL_PATHNAME, &name_buffer);
 
        /*
         * Do an upward search to find the root bus device, and
@@ -249,9 +257,8 @@ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle)
                status = acpi_get_parent(child, &parent);
                if (ACPI_FAILURE(status)) {
                        printk(KERN_ERR "%s: acpi_get_parent() failed "
-                              "(0x%x) for: ", __func__, status);
-                       acpi_ns_print_node_pathname(child, NULL);
-                       printk("\n");
+                              "(0x%x) for: %s\n", __func__, status,
+                               (char *)name_buffer.pointer);
                        panic("%s: Unable to find host devfn\n", __func__);
                }
                if (parent == rootbus_handle)
@@ -259,22 +266,20 @@ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle)
                child = parent;
        }
        if (!child) {
-               printk(KERN_ERR "%s: Unable to find root bus for: ",
-                      __func__);
-               acpi_ns_print_node_pathname(device_handle, NULL);
-               printk("\n");
+               printk(KERN_ERR "%s: Unable to find root bus for: %s\n",
+                      __func__, (char *)name_buffer.pointer);
                BUG();
        }
 
        status = acpi_evaluate_integer(child, METHOD_NAME__ADR, NULL, &adr);
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR "%s: Unable to get _ADR (0x%x) for: ",
-                      __func__, status);
-               acpi_ns_print_node_pathname(child, NULL);
-               printk("\n");
+               printk(KERN_ERR "%s: Unable to get _ADR (0x%x) for: %s\n",
+                      __func__, status, (char *)name_buffer.pointer);
                panic("%s: Unable to find host devfn\n", __func__);
        }
 
+       kfree(name_buffer.pointer);
+
        slot = (adr >> 16) & 0xffff;
        function = adr & 0xffff;
        devfn = PCI_DEVFN(slot, function);
@@ -300,27 +305,28 @@ find_matching_device(acpi_handle handle, u32 lvl, void *context, void **rv)
        int function;
        int slot;
        struct sn_pcidev_match *info = context;
+       struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
         status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
                                        &adr);
         if (ACPI_SUCCESS(status)) {
                status = acpi_get_parent(handle, &parent);
                if (ACPI_FAILURE(status)) {
+                       acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer);
                        printk(KERN_ERR
-                              "%s: acpi_get_parent() failed (0x%x) for: ",
-                                       __func__, status);
-                       acpi_ns_print_node_pathname(handle, NULL);
-                       printk("\n");
+                              "%s: acpi_get_parent() failed (0x%x) for: %s\n",
+                               __func__, status, (char *)name_buffer.pointer);
+                       kfree(name_buffer.pointer);
                        return AE_OK;
                }
                status = acpi_evaluate_integer(parent, METHOD_NAME__BBN,
                                               NULL, &bbn);
                if (ACPI_FAILURE(status)) {
+                       acpi_get_name(handle, ACPI_FULL_PATHNAME, &name_buffer);
                        printk(KERN_ERR
-                         "%s: Failed to find _BBN in parent of: ",
-                                       __func__);
-                       acpi_ns_print_node_pathname(handle, NULL);
-                       printk("\n");
+                         "%s: Failed to find _BBN in parent of: %s\n",
+                                       __func__, (char *)name_buffer.pointer);
+                       kfree(name_buffer.pointer);
                        return AE_OK;
                }
 
@@ -350,24 +356,27 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
        acpi_handle rootbus_handle;
        unsigned long long segment;
        acpi_status status;
+       struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
        rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle;
         status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL,
                                        &segment);
         if (ACPI_SUCCESS(status)) {
                if (segment != pci_domain_nr(dev)) {
+                       acpi_get_name(rootbus_handle, ACPI_FULL_PATHNAME,
+                               &name_buffer);
                        printk(KERN_ERR
-                              "%s: Segment number mismatch, 0x%llx vs 0x%x for: ",
-                              __func__, segment, pci_domain_nr(dev));
-                       acpi_ns_print_node_pathname(rootbus_handle, NULL);
-                       printk("\n");
+                              "%s: Segment number mismatch, 0x%llx vs 0x%x for: %s\n",
+                              __func__, segment, pci_domain_nr(dev),
+                              (char *)name_buffer.pointer);
+                       kfree(name_buffer.pointer);
                        return 1;
                }
        } else {
-               printk(KERN_ERR "%s: Unable to get __SEG from: ",
-                      __func__);
-               acpi_ns_print_node_pathname(rootbus_handle, NULL);
-               printk("\n");
+               acpi_get_name(rootbus_handle, ACPI_FULL_PATHNAME, &name_buffer);
+               printk(KERN_ERR "%s: Unable to get __SEG from: %s\n",
+                      __func__, (char *)name_buffer.pointer);
+               kfree(name_buffer.pointer);
                return 1;
        }
 
index 8a924a5661ddffff994bb59a74762b9f5bd5555a..0d4ffa4da1da755361b5506c945333a246d6a694 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/acpi.h>
 #include <asm/sn/sn2/sn_hwperf.h>
 #include <asm/sn/acpi.h>
-#include "acpi/acglobal.h"
 
 extern void sn_init_cpei_timer(void);
 extern void register_sn_procfs(void);
@@ -473,7 +472,7 @@ sn_io_early_init(void)
        {
                struct acpi_table_header *header = NULL;
 
-               acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header);
+               acpi_get_table(ACPI_SIG_DSDT, 1, &header);
                BUG_ON(header == NULL);
                sn_acpi_rev = header->oem_revision;
        }
@@ -505,7 +504,7 @@ sn_io_early_init(void)
 
        {
                struct acpi_table_header *header;
-               (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header);
+               (void)acpi_get_table(ACPI_SIG_DSDT, 1, &header);
                printk(KERN_INFO "ACPI  DSDT OEM Rev 0x%x\n",
                        header->oem_revision);
        }
index 29dc0c89d4afc076654a5f62c1056c219944f156..d37593c2f438d80ff609ed61e0584032670db260 100644 (file)
@@ -47,7 +47,7 @@
 #endif
 
 static int __initdata acpi_force = 0;
-
+u32 acpi_rsdt_forced;
 #ifdef CONFIG_ACPI
 int acpi_disabled = 0;
 #else
@@ -1374,6 +1374,17 @@ static void __init acpi_process_madt(void)
                               "Invalid BIOS MADT, disabling ACPI\n");
                        disable_acpi();
                }
+       } else {
+               /*
+                * ACPI found no MADT, and so ACPI wants UP PIC mode.
+                * In the event an MPS table was found, forget it.
+                * Boot with "acpi=off" to use MPS on such a system.
+                */
+               if (smp_found_config) {
+                       printk(KERN_WARNING PREFIX
+                               "No APIC-table, disabling MPS\n");
+                       smp_found_config = 0;
+               }
        }
 
        /*
@@ -1809,6 +1820,10 @@ static int __init parse_acpi(char *arg)
                        disable_acpi();
                acpi_ht = 1;
        }
+       /* acpi=rsdt use RSDT instead of XSDT */
+       else if (strcmp(arg, "rsdt") == 0) {
+               acpi_rsdt_forced = 1;
+       }
        /* "acpi=noirq" disables ACPI interrupt routing */
        else if (strcmp(arg, "noirq") == 0) {
                acpi_noirq_set();
index c2502eb9aa8355488a7057602bfdfa71134785a7..a4805b3b4095bd7e0b8cdb68bd73d617d423c136 100644 (file)
@@ -56,6 +56,7 @@ static struct cstate_entry *cpu_cstate_entry; /* per CPU ptr */
 static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
 
 #define MWAIT_SUBSTATE_MASK    (0xf)
+#define MWAIT_CSTATE_MASK      (0xf)
 #define MWAIT_SUBSTATE_SIZE    (4)
 
 #define CPUID_MWAIT_LEAF (5)
@@ -98,7 +99,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
        cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
 
        /* Check whether this particular cx_type (in CST) is supported or not */
-       cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1;
+       cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) &
+                       MWAIT_CSTATE_MASK) + 1;
        edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE);
        num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
 
index 806b4e9051b4e5ce2ae00576fa06a980ed6bbe08..707c1f6f95faedfb7db7aed696c45c79461b0ea2 100644 (file)
@@ -159,6 +159,8 @@ static int __init acpi_sleep_setup(char *str)
 #endif
                if (strncmp(str, "old_ordering", 12) == 0)
                        acpi_old_suspend_ordering();
+               if (strncmp(str, "s4_nonvs", 8) == 0)
+                       acpi_s4_no_nvs();
                str = strchr(str, ',');
                if (str != NULL)
                        str += strspn(str, ", \t");
index 65a13943e0982524877768164cf8cc0cd63688f4..e85826829cf25c1671b55b306976a917a40b9c43 100644 (file)
@@ -665,6 +665,27 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
 }
 #endif
 
+#ifdef CONFIG_HIBERNATION
+/**
+ * Mark ACPI NVS memory region, so that we can save/restore it during
+ * hibernation and the subsequent resume.
+ */
+static int __init e820_mark_nvs_memory(void)
+{
+       int i;
+
+       for (i = 0; i < e820.nr_map; i++) {
+               struct e820entry *ei = &e820.map[i];
+
+               if (ei->type == E820_NVS)
+                       hibernate_nvs_register(ei->addr, ei->size);
+       }
+
+       return 0;
+}
+core_initcall(e820_mark_nvs_memory);
+#endif
+
 /*
  * Early reserved memory areas.
  */
index 3c0c93300f127ffe91343f8514e27b174742bdb0..5d23c13ac7d48efe54de227ac337ceea1d75ee4c 100644 (file)
@@ -2,15 +2,8 @@
 # Makefile for the Linux ACPI interpreter
 #
 
-export ACPI_CFLAGS
-
-ACPI_CFLAGS    := -Os
-
-ifdef CONFIG_ACPI_DEBUG
-  ACPI_CFLAGS  += -DACPI_DEBUG_OUTPUT
-endif
-
-EXTRA_CFLAGS   += $(ACPI_CFLAGS)
+ccflags-y                      := -Os
+ccflags-$(CONFIG_ACPI_DEBUG)   += -DACPI_DEBUG_OUTPUT
 
 #
 # ACPI Boot-Time Table Parsing
@@ -22,9 +15,13 @@ obj-$(CONFIG_X86)            += blacklist.o
 # ACPI Core Subsystem (Interpreter)
 #
 obj-y                          += osl.o utils.o reboot.o\
-                                  dispatcher/ events/ executer/ hardware/ \
-                                  namespace/ parser/ resources/ tables/ \
-                                  utilities/
+                                       acpica/
+
+# sleep related files
+obj-y                          += wakeup.o
+obj-y                          += main.o
+obj-$(CONFIG_ACPI_SLEEP)       += proc.o
+
 
 #
 # ACPI Bus and Device Drivers
@@ -35,7 +32,6 @@ ifdef CONFIG_CPU_FREQ
 processor-objs += processor_perflib.o
 endif
 
-obj-y                          += sleep/
 obj-y                          += bus.o glue.o
 obj-y                          += scan.o
 # Keep EC driver first. Initialization of others depend on it.
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
new file mode 100644 (file)
index 0000000..3f23298
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Makefile for ACPICA Core interpreter
+#
+
+ccflags-y                      := -Os
+ccflags-$(CONFIG_ACPI_DEBUG)   += -DACPI_DEBUG_OUTPUT
+
+obj-y := dsfield.o   dsmthdat.o  dsopcode.o  dswexec.o  dswscope.o \
+        dsmethod.o  dsobject.o  dsutils.o   dswload.o  dswstate.o \
+        dsinit.o
+
+obj-y += evevent.o  evregion.o  evsci.o    evxfevnt.o \
+        evmisc.o   evrgnini.o  evxface.o  evxfregn.o \
+        evgpe.o    evgpeblk.o
+
+obj-y += exconfig.o  exfield.o  exnames.o   exoparg6.o  exresolv.o  exstorob.o\
+        exconvrt.o  exfldio.o  exoparg1.o  exprep.o    exresop.o   exsystem.o\
+        excreate.o  exmisc.o   exoparg2.o  exregion.o  exstore.o   exutils.o \
+        exdump.o    exmutex.o  exoparg3.o  exresnte.o  exstoren.o
+
+obj-y += hwacpi.o  hwgpe.o  hwregs.o  hwsleep.o hwxface.o
+
+obj-$(ACPI_FUTURE_USAGE) += hwtimer.o
+
+obj-y += nsaccess.o  nsload.o    nssearch.o  nsxfeval.o \
+        nsalloc.o   nseval.o    nsnames.o   nsutils.o   nsxfname.o \
+        nsdump.o    nsinit.o    nsobject.o  nswalk.o    nsxfobj.o  \
+        nsparse.o   nspredef.o
+
+obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
+
+obj-y += psargs.o    psparse.o  psloop.o pstree.o   pswalk.o  \
+        psopcode.o  psscope.o  psutils.o  psxface.o
+
+obj-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \
+        rscalc.o  rsirq.o  rsmemory.o  rsutils.o
+
+obj-$(ACPI_FUTURE_USAGE) += rsdump.o
+
+obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o
+
+obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
+               utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
+               utstate.o utmutex.o utobject.o utresrc.o
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h
new file mode 100644 (file)
index 0000000..3b20786
--- /dev/null
@@ -0,0 +1,63 @@
+/******************************************************************************
+ *
+ * Name: accommon.h - Common include files for generation of ACPICA source
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2008, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACCOMMON_H__
+#define __ACCOMMON_H__
+
+/*
+ * Common set of includes for all ACPICA source files.
+ * We put them here because we don't want to duplicate them
+ * in the the source code again and again.
+ *
+ * Note: The order of these include files is important.
+ */
+#include "acconfig.h"          /* Global configuration constants */
+#include "acmacros.h"          /* C macros */
+#include "aclocal.h"           /* Internal data types */
+#include "acobject.h"          /* ACPI internal object */
+#include "acstruct.h"          /* Common structures */
+#include "acglobal.h"          /* All global variables */
+#include "achware.h"           /* Hardware defines and interfaces */
+#include "acutils.h"           /* Utility interfaces */
+
+#endif                         /* __ACCOMMON_H__ */
similarity index 98%
rename from include/acpi/acconfig.h
rename to drivers/acpi/acpica/acconfig.h
index 29feee27f0ea8aeef29352635eb4f6720f55e1f2..e6777fb883d25b59d1e5acac89a7ccd24ab09f21 100644 (file)
  *
  */
 
-/* Current ACPICA subsystem version in YYYYMMDD format */
-
-#define ACPI_CA_VERSION                 0x20080926
-
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
  * but there is a large base of ASL/AML code in existing machines that check
 
 #define ACPI_ROOT_TABLE_SIZE_INCREMENT  4
 
+/* Maximum number of While() loop iterations before forced abort */
+
+#define ACPI_MAX_LOOP_ITERATIONS        0xFFFF
+
 /******************************************************************************
  *
  * ACPI Specification constants (Do not change unless the specification changes)
similarity index 97%
rename from include/acpi/acevents.h
rename to drivers/acpi/acpica/acevents.h
index d5d099bf349cb67c140ae1e73e536c942672af8a..07e20135f01b30873d1f4aca495d7278a81962cd 100644 (file)
@@ -93,11 +93,13 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
  */
 u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
 
-acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback);
+acpi_status
+acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context);
 
 acpi_status
 acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                           struct acpi_gpe_block_info *gpe_block);
+                           struct acpi_gpe_block_info *gpe_block,
+                           void *context);
 
 acpi_status
 acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
similarity index 97%
rename from include/acpi/acglobal.h
rename to drivers/acpi/acpica/acglobal.h
index 15dda46b70d1c1e36c949d9555efc7a805ccf321..ddb40f5c68fc25e35e9cab318fb232c4a9015723 100644 (file)
@@ -102,6 +102,12 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
  */
 ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
 
+/*
+ * Optionally use default values for the ACPI register widths. Set this to
+ * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
+ */
+ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
+
 /*****************************************************************************
  *
  * Debug support
@@ -140,7 +146,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags;
  */
 ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
 ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
-extern u8 acpi_gbl_permanent_mmap;
+ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS;
 
 /* These addresses are calculated from FADT address values */
 
@@ -326,6 +332,7 @@ ACPI_EXTERN struct acpi_fixed_event_handler
 ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
 ACPI_EXTERN struct acpi_gpe_block_info
 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
+ACPI_EXTERN u32 acpi_current_gpe_count;
 
 /*****************************************************************************
  *
similarity index 89%
rename from include/acpi/achware.h
rename to drivers/acpi/acpica/achware.h
index 97a72b19327683843bc95219d643406b04426b59..58c69dc49ab43b62207afde56235a5266834dfb4 100644 (file)
 #ifndef __ACHWARE_H__
 #define __ACHWARE_H__
 
-/* PM Timer ticks per second (HZ) */
-
-#define PM_TIMER_FREQUENCY  3579545
-
-/* Values for the _SST reserved method */
+/* Values for the _SST predefined method */
 
 #define ACPI_SST_INDICATOR_OFF  0
 #define ACPI_SST_WORKING        1
@@ -56,8 +52,6 @@
 #define ACPI_SST_SLEEPING       3
 #define ACPI_SST_SLEEP_CONTEXT  4
 
-/* Prototypes */
-
 /*
  * hwacpi - high level functions
  */
@@ -75,13 +69,6 @@ acpi_hw_register_read(u32 register_id, u32 * return_value);
 
 acpi_status acpi_hw_register_write(u32 register_id, u32 value);
 
-acpi_status
-acpi_hw_low_level_read(u32 width,
-                      u32 * value, struct acpi_generic_address *reg);
-
-acpi_status
-acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg);
-
 acpi_status acpi_hw_clear_acpi_status(void);
 
 /*
@@ -94,13 +81,13 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
 
 acpi_status
 acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                         struct acpi_gpe_block_info *gpe_block);
+                         struct acpi_gpe_block_info *gpe_block, void *context);
 
 acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
 acpi_status
 acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                       struct acpi_gpe_block_info *gpe_block);
+                       struct acpi_gpe_block_info *gpe_block, void *context);
 
 acpi_status
 acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
@@ -114,7 +101,8 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void);
 
 acpi_status
 acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                                struct acpi_gpe_block_info *gpe_block);
+                                struct acpi_gpe_block_info *gpe_block,
+                                void *context);
 
 #ifdef ACPI_FUTURE_USAGE
 /*
similarity index 95%
rename from include/acpi/aclocal.h
rename to drivers/acpi/acpica/aclocal.h
index ecab527cf78ef72afe33309782bf184a12c13641..492d02761bb7b34a8d2291c2508eb786a98869c8 100644 (file)
@@ -46,8 +46,6 @@
 
 /* acpisrc:struct_defs -- for acpisrc conversion */
 
-#define ACPI_WAIT_FOREVER               0xFFFF /* u16, as per ACPI spec */
-#define ACPI_DO_NOT_WAIT                0
 #define ACPI_SERIALIZED                 0xFF
 
 typedef u32 acpi_mutex_handle;
@@ -120,11 +118,6 @@ static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
 #define ACPI_MAX_LOCK                   1
 #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
 
-/* Owner IDs are used to track namespace nodes for selective deletion */
-
-typedef u8 acpi_owner_id;
-#define ACPI_OWNER_ID_MAX               0xFF
-
 /* This Thread ID means that the mutex is not in use (unlocked) */
 
 #define ACPI_MUTEX_NOT_ACQUIRED         (acpi_thread_id) 0
@@ -165,11 +158,6 @@ typedef enum {
        ACPI_IMODE_EXECUTE = 0x03
 } acpi_interpreter_mode;
 
-union acpi_name_union {
-       u32 integer;
-       char ascii[4];
-};
-
 /*
  * The Namespace Node describes a named object that appears in the AML.
  * descriptor_type is used to differentiate between internal descriptors.
@@ -216,26 +204,6 @@ struct acpi_namespace_node {
 #define ANOBJ_IS_BIT_OFFSET             0x40   /* i_aSL only: Reference is a bit offset */
 #define ANOBJ_IS_REFERENCED             0x80   /* i_aSL only: Object was referenced */
 
-/*
- * ACPI Table Descriptor.  One per ACPI table
- */
-struct acpi_table_desc {
-       acpi_physical_address address;
-       struct acpi_table_header *pointer;
-       u32 length;             /* Length fixed at 32 bits */
-       union acpi_name_union signature;
-       acpi_owner_id owner_id;
-       u8 flags;
-};
-
-/* Flags for above */
-
-#define ACPI_TABLE_ORIGIN_UNKNOWN       (0)
-#define ACPI_TABLE_ORIGIN_MAPPED        (1)
-#define ACPI_TABLE_ORIGIN_ALLOCATED     (2)
-#define ACPI_TABLE_ORIGIN_MASK          (3)
-#define ACPI_TABLE_IS_LOADED            (4)
-
 /* One internal RSDT for table management */
 
 struct acpi_internal_rsdt {
@@ -266,15 +234,6 @@ struct acpi_ns_search_data {
        struct acpi_namespace_node *node;
 };
 
-/*
- * Predefined Namespace items
- */
-struct acpi_predefined_names {
-       char *name;
-       u8 type;
-       char *val;
-};
-
 /* Object types used during package copies */
 
 #define ACPI_COPY_TYPE_SIMPLE           0
@@ -487,10 +446,15 @@ struct acpi_gpe_walk_info {
        struct acpi_gpe_block_info *gpe_block;
 };
 
-typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
-                                        gpe_xrupt_info,
-                                        struct acpi_gpe_block_info *
-                                        gpe_block);
+struct acpi_gpe_device_info {
+       u32 index;
+       u32 next_block_base_index;
+       acpi_status status;
+       struct acpi_namespace_node *gpe_device;
+};
+
+typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+               struct acpi_gpe_block_info *gpe_block, void *context);
 
 /* Information about each particular fixed event */
 
@@ -566,6 +530,7 @@ struct acpi_control_state {
        union acpi_parse_object *predicate_op;
        u8 *aml_predicate_start;        /* Start of if/while predicate */
        u8 *package_end;        /* End of if/while block */
+       u32 loop_count;         /* While() loop counter */
 };
 
 /*
@@ -671,6 +636,12 @@ union acpi_parse_value {
        union acpi_parse_object *arg;   /* arguments and contained ops */
 };
 
+#ifdef ACPI_DISASSEMBLER
+#define ACPI_DISASM_ONLY_MEMBERS(a)     a;
+#else
+#define ACPI_DISASM_ONLY_MEMBERS(a)
+#endif
+
 #define ACPI_PARSE_COMMON \
        union acpi_parse_object         *parent;        /* Parent op */\
        u8                              descriptor_type; /* To differentiate various internal objs */\
@@ -790,9 +761,6 @@ struct acpi_parse_state {
  *
  ****************************************************************************/
 
-#define PCI_ROOT_HID_STRING             "PNP0A03"
-#define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
-
 struct acpi_bit_register_info {
        u8 parent_register;
        u8 bit_position;
@@ -1019,26 +987,4 @@ struct acpi_debug_mem_block {
 #define ACPI_MEM_LIST_MAX               1
 #define ACPI_NUM_MEM_LISTS              2
 
-struct acpi_memory_list {
-       char *list_name;
-       void *list_head;
-       u16 object_size;
-       u16 max_depth;
-       u16 current_depth;
-       u16 link_offset;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
-       /* Statistics for debug memory tracking only */
-
-       u32 total_allocated;
-       u32 total_freed;
-       u32 max_occupied;
-       u32 total_size;
-       u32 current_total_size;
-       u32 requests;
-       u32 hits;
-#endif
-};
-
 #endif                         /* __ACLOCAL_H__ */
similarity index 83%
rename from include/acpi/acmacros.h
rename to drivers/acpi/acpica/acmacros.h
index 1954c9d1d012e516c011acb3ed53b4913678a818..9c127e8e2d6da313d53ac1175cb9c3bdf08a5a9e 100644 (file)
 #ifndef __ACMACROS_H__
 #define __ACMACROS_H__
 
-/*
- * Data manipulation macros
- */
-#define ACPI_LOWORD(l)                  ((u16)(u32)(l))
-#define ACPI_HIWORD(l)                  ((u16)((((u32)(l)) >> 16) & 0xFFFF))
-#define ACPI_LOBYTE(l)                  ((u8)(u16)(l))
-#define ACPI_HIBYTE(l)                  ((u8)((((u16)(l)) >> 8) & 0xFF))
-
-#define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
-#define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
-#define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
-#define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
-
-/* Size calculation */
-
-#define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
-
 /*
  * Extract data using a pointer. Any more than a byte and we
  * get into potential aligment issues -- see the STORE macros below.
 #define ACPI_SET32(ptr)                 *ACPI_CAST_PTR (u32, ptr)
 #define ACPI_SET64(ptr)                 *ACPI_CAST_PTR (u64, ptr)
 
-/*
- * Pointer manipulation
- */
-#define ACPI_CAST_PTR(t, p)             ((t *) (acpi_uintptr_t) (p))
-#define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (acpi_uintptr_t) (p))
-#define ACPI_ADD_PTR(t, a, b)          ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
-#define ACPI_PTR_DIFF(a, b)            (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b)))
-
-/* Pointer/Integer type conversions */
-
-#define ACPI_TO_POINTER(i)             ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i)
-#define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
-#define ACPI_OFFSET(d, f)               (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
-#define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
-#define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
-
-#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
-#define ACPI_COMPARE_NAME(a, b)         (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
-#else
-#define ACPI_COMPARE_NAME(a, b)         (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
-#endif
-
-/*
- * Full 64-bit integer must be available on both 32-bit and 64-bit platforms
- */
-struct acpi_integer_overlay {
-       u32 lo_dword;
-       u32 hi_dword;
-};
-
-#define ACPI_LODWORD(integer)           (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
-#define ACPI_HIDWORD(integer)           (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
-
 /*
  * printf() format helpers
  */
@@ -209,7 +159,7 @@ struct acpi_integer_overlay {
 /*
  * The hardware does not support unaligned transfers. We must move the
  * data one byte at a time. These macros work whether the source or
- * the destination (or both) is/are unaligned.  (Little-endian move)
+ * the destination (or both) is/are unaligned. (Little-endian move)
  */
 
 /* 16-bit source, 16/32/64 destination */
@@ -357,12 +307,6 @@ struct acpi_integer_overlay {
        {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
 #endif
 
-#ifdef ACPI_DISASSEMBLER
-#define ACPI_DISASM_ONLY_MEMBERS(a)     a;
-#else
-#define ACPI_DISASM_ONLY_MEMBERS(a)
-#endif
-
 #define ARG_TYPE_WIDTH                  5
 #define ARG_1(x)                        ((u32)(x))
 #define ARG_2(x)                        ((u32)(x) << (1 * ARG_TYPE_WIDTH))
@@ -388,32 +332,16 @@ struct acpi_integer_overlay {
 #define GET_CURRENT_ARG_TYPE(list)      (list & ((u32) 0x1F))
 #define INCREMENT_ARG_LIST(list)        (list >>= ((u32) ARG_TYPE_WIDTH))
 
-#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
-/*
- * Module name is include in both debug and non-debug versions primarily for
- * error messages. The __FILE__ macro is not very useful for this, because it
- * often includes the entire pathname to the module
- */
-#define ACPI_MODULE_NAME(name)         static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
-#else
-#define ACPI_MODULE_NAME(name)
-#endif
-
 /*
  * Ascii error messages can be configured out
  */
 #ifndef ACPI_NO_ERROR_MESSAGES
-#define AE_INFO                         _acpi_module_name, __LINE__
 
 /*
  * Error reporting. Callers module and line number are inserted by AE_INFO,
  * the plist contains a set of parens to allow variable-length lists.
  * These macros are used for both the debug and non-debug versions of the code.
  */
-#define ACPI_INFO(plist)                acpi_ut_info plist
-#define ACPI_WARNING(plist)             acpi_ut_warning plist
-#define ACPI_EXCEPTION(plist)           acpi_ut_exception plist
-#define ACPI_ERROR(plist)               acpi_ut_error plist
 #define ACPI_ERROR_NAMESPACE(s, e)      acpi_ns_report_error (AE_INFO, s, e);
 #define ACPI_ERROR_METHOD(s, n, p, e)   acpi_ns_report_method_error (AE_INFO, s, n, p, e);
 
@@ -421,50 +349,18 @@ struct acpi_integer_overlay {
 
 /* No error messages */
 
-#define ACPI_INFO(plist)
-#define ACPI_WARNING(plist)
-#define ACPI_EXCEPTION(plist)
-#define ACPI_ERROR(plist)
 #define ACPI_ERROR_NAMESPACE(s, e)
 #define ACPI_ERROR_METHOD(s, n, p, e)
-#endif
+#endif         /* ACPI_NO_ERROR_MESSAGES */
 
 /*
  * Debug macros that are conditionally compiled
  */
 #ifdef ACPI_DEBUG_OUTPUT
 
-/*
- * Common parameters used for debug output functions:
- * line number, function name, module(file) name, component ID
- */
-#define ACPI_DEBUG_PARAMETERS           __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
-
 /*
  * Function entry tracing
  */
-
-/*
- * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
- * define it now. This is the case where there the compiler does not support
- * a __func__ macro or equivalent.
- */
-#ifndef ACPI_GET_FUNCTION_NAME
-#define ACPI_GET_FUNCTION_NAME          _acpi_function_name
-/*
- * The Name parameter should be the procedure name as a quoted string.
- * The function name is also used by the function exit macros below.
- * Note: (const char) is used to be compatible with the debug interfaces
- * and macros such as __func__.
- */
-#define ACPI_FUNCTION_NAME(name)       static const char _acpi_function_name[] = #name;
-
-#else
-/* Compiler supports __func__ (or equivalent) -- Ignore this macro */
-
-#define ACPI_FUNCTION_NAME(name)
-#endif
-
 #ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE
 
 #define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
@@ -584,15 +480,6 @@ struct acpi_integer_overlay {
 #define ACPI_DUMP_RESOURCE_LIST(a)      acpi_rs_dump_resource_list(a)
 #define ACPI_DUMP_BUFFER(a, b)          acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
 
-/*
- * Master debug print macros
- * Print iff:
- *    1) Debug print for the current component is enabled
- *    2) Debug error level or trace level for the print statement is enabled
- */
-#define ACPI_DEBUG_PRINT(plist)         acpi_ut_debug_print plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     acpi_ut_debug_print_raw plist
-
 #else
 /*
  * This is the non-debug case -- make everything go away,
@@ -603,7 +490,6 @@ struct acpi_integer_overlay {
 
 #define ACPI_DEBUG_DEFINE(a)           do { } while(0)
 #define ACPI_DEBUG_ONLY_MEMBERS(a)     do { } while(0)
-#define ACPI_FUNCTION_NAME(a)          do { } while(0)
 #define ACPI_FUNCTION_TRACE(a)         do { } while(0)
 #define ACPI_FUNCTION_TRACE_PTR(a, b)  do { } while(0)
 #define ACPI_FUNCTION_TRACE_U32(a, b)  do { } while(0)
@@ -619,8 +505,6 @@ struct acpi_integer_overlay {
 #define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0)
 #define ACPI_DUMP_RESOURCE_LIST(a)     do { } while(0)
 #define ACPI_DUMP_BUFFER(a, b)         do { } while(0)
-#define ACPI_DEBUG_PRINT(pl)           do { } while(0)
-#define ACPI_DEBUG_PRINT_RAW(pl)       do { } while(0)
 
 #define return_VOID                     return
 #define return_ACPI_STATUS(s)           return(s)
@@ -629,7 +513,7 @@ struct acpi_integer_overlay {
 #define return_UINT32(s)                return(s)
 #define return_PTR(s)                   return(s)
 
-#endif
+#endif                         /* ACPI_DEBUG_OUTPUT */
 
 /*
  * Some code only gets executed when the debugger is built in.
similarity index 98%
rename from include/acpi/acnamesp.h
rename to drivers/acpi/acpica/acnamesp.h
index db4e6f677855293c1533c142ea575ce1a1306b00..46cb5b46d2803fd43bf7691bf0ee065fcf039dfc 100644 (file)
@@ -182,7 +182,9 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
  */
 acpi_status
 acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
-                              union acpi_operand_object *return_object);
+                              u32 user_param_count,
+                              acpi_status return_status,
+                              union acpi_operand_object **return_object);
 
 const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
                                                                    acpi_namespace_node
@@ -191,6 +193,7 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
 void
 acpi_ns_check_parameter_count(char *pathname,
                              struct acpi_namespace_node *node,
+                             u32 user_param_count,
                              const union acpi_predefined_info *info);
 
 /*
similarity index 98%
rename from include/acpi/actables.h
rename to drivers/acpi/acpica/actables.h
index 0cbe1b9ab52249e38adcd12c5fe0c8009d8ebbd9..7ce6e33c7f781ef71f308bd9ebd35ab33c282da7 100644 (file)
@@ -94,6 +94,8 @@ void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded);
 /*
  * tbutils - table manager utilities
  */
+acpi_status acpi_tb_initialize_facs(void);
+
 u8 acpi_tb_tables_loaded(void);
 
 void
similarity index 93%
rename from include/acpi/acutils.h
rename to drivers/acpi/acpica/acutils.h
index d8307b2987e371b706ac7e0c96359606fb5cd900..80d8813484fe1ee71cb633e1647644815fc05d6f 100644 (file)
@@ -297,42 +297,6 @@ void acpi_ut_report_info(char *module_name, u32 line_number);
 
 void acpi_ut_report_warning(char *module_name, u32 line_number);
 
-/* Error and message reporting interfaces */
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print(u32 requested_debug_level,
-                   u32 line_number,
-                   const char *function_name,
-                   const char *module_name,
-                   u32 component_id,
-                   const char *format, ...) ACPI_PRINTF_LIKE(6);
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print_raw(u32 requested_debug_level,
-                       u32 line_number,
-                       const char *function_name,
-                       const char *module_name,
-                       u32 component_id,
-                       const char *format, ...) ACPI_PRINTF_LIKE(6);
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_error(const char *module_name,
-             u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_exception(const char *module_name,
-                 u32 line_number,
-                 acpi_status status,
-                 const char *format, ...) ACPI_PRINTF_LIKE(4);
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_warning(const char *module_name,
-               u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_info(const char *module_name,
-            u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
-
 /*
  * utdelete - Object deletion and reference counts
  */
similarity index 99%
rename from drivers/acpi/dispatcher/dsfield.c
rename to drivers/acpi/acpica/dsfield.c
index f988a5e7d2b4f504b62214260788ee28afefa367..53e27bc5a734214cb9b76e2db9fec5cea0fbdf26 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
+#include "accommon.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acparser.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsfield")
similarity index 98%
rename from drivers/acpi/dispatcher/dsinit.c
rename to drivers/acpi/acpica/dsinit.c
index 949f7c75029ee05380cc23e01f17c6e2d43e6fe1..eb144b13d8fa434f93618fb953f498771b7e3a87 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acdispat.h>
-#include <acpi/acnamesp.h>
-#include <acpi/actables.h>
+#include "accommon.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsinit")
similarity index 98%
rename from drivers/acpi/dispatcher/dsmethod.c
rename to drivers/acpi/acpica/dsmethod.c
index 279a5a60a0dd492a2b27f144b12b353b9de78a2a..14b8b8ed802367c15c814f87695372856d3ca1af 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#ifdef ACPI_DISASSEMBLER
 #include <acpi/acdisasm.h>
+#endif
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsmethod")
@@ -412,6 +415,9 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
 
        if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
                status = obj_desc->method.implementation(next_walk_state);
+               if (status == AE_OK) {
+                       status = AE_CTRL_TERMINATE;
+               }
        }
 
        return_ACPI_STATUS(status);
similarity index 99%
rename from drivers/acpi/dispatcher/dsmthdat.c
rename to drivers/acpi/acpica/dsmthdat.c
index d03f81bd1bcb01f02cd6704732c37d54a2ae6822..da0f5468184cc15fbc8fd887bf8b6bc09fd06ec6 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acdispat.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsmthdat")
similarity index 99%
rename from drivers/acpi/dispatcher/dsobject.c
rename to drivers/acpi/acpica/dsobject.c
index 4f08e599d07e2a62eb257fefa2b6ba812b132578..15c628e6aa0032f0a2486c8f6ade61fc3b8f556d 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsobject")
similarity index 96%
rename from drivers/acpi/dispatcher/dsopcode.c
rename to drivers/acpi/acpica/dsopcode.c
index 69fae5905bb8219af26b0e0684ae22cedc1b84dc..0c3b4dd60e8a5ae9bfdcb2713a33ee8455d1daec 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acevents.h>
-#include <acpi/actables.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsopcode")
@@ -1140,9 +1141,28 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                          op->common.aml_opcode, walk_state));
 
        switch (op->common.aml_opcode) {
-       case AML_IF_OP:
        case AML_WHILE_OP:
 
+               /*
+                * If this is an additional iteration of a while loop, continue.
+                * There is no need to allocate a new control state.
+                */
+               if (walk_state->control_state) {
+                       if (walk_state->control_state->control.aml_predicate_start
+                               == (walk_state->parser_state.aml - 1)) {
+
+                               /* Reset the state to start-of-loop */
+
+                               walk_state->control_state->common.state =
+                                   ACPI_CONTROL_CONDITIONAL_EXECUTING;
+                               break;
+                       }
+               }
+
+               /*lint -fallthrough */
+
+       case AML_IF_OP:
+
                /*
                 * IF/WHILE: Create a new control state to manage these
                 * constructs. We need to manage these as a stack, in order
@@ -1243,13 +1263,36 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
 
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
 
-               if (walk_state->control_state->common.value) {
+               control_state = walk_state->control_state;
+               if (control_state->common.value) {
 
-                       /* Predicate was true, go back and evaluate it again! */
+                       /* Predicate was true, the body of the loop was just executed */
 
+                       /*
+                        * This loop counter mechanism allows the interpreter to escape
+                        * possibly infinite loops. This can occur in poorly written AML
+                        * when the hardware does not respond within a while loop and the
+                        * loop does not implement a timeout.
+                        */
+                       control_state->control.loop_count++;
+                       if (control_state->control.loop_count >
+                               ACPI_MAX_LOOP_ITERATIONS) {
+                               status = AE_AML_INFINITE_LOOP;
+                               break;
+                       }
+
+                       /*
+                        * Go back and evaluate the predicate and maybe execute the loop
+                        * another time
+                        */
                        status = AE_CTRL_PENDING;
+                       walk_state->aml_last_while =
+                           control_state->control.aml_predicate_start;
+                       break;
                }
 
+               /* Predicate was false, terminate this while loop */
+
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
                                  "[WHILE_OP] termination! Op=%p\n", op));
 
@@ -1257,9 +1300,6 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
 
                control_state =
                    acpi_ut_pop_generic_state(&walk_state->control_state);
-
-               walk_state->aml_last_while =
-                   control_state->control.aml_predicate_start;
                acpi_ut_delete_generic_state(control_state);
                break;
 
similarity index 99%
rename from drivers/acpi/dispatcher/dsutils.c
rename to drivers/acpi/acpica/dsutils.c
index b398982f0d8baef2e534efc85108a5b338fa0f1a..dabc23a46176b478d5f5ead5df1adca3d9127ef5 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acdebug.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acdebug.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsutils")
similarity index 99%
rename from drivers/acpi/dispatcher/dswexec.c
rename to drivers/acpi/acpica/dswexec.c
index 396fe12078cd1595f99199c8bf837be59df7f3ae..350e6656bc8963951f7861a1f60ebcb422cd7831 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acdebug.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acdebug.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dswexec")
similarity index 99%
rename from drivers/acpi/dispatcher/dswload.c
rename to drivers/acpi/acpica/dswload.c
index dff7a3e445a88e7dbd694f858536a7fd5dba3612..3023ceaa8d544d8d0c52a53d0dff2dc13facbd6c 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acevents.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acevents.h"
 
 #ifdef ACPI_ASL_COMPILER
 #include <acpi/acdisasm.h>
similarity index 99%
rename from drivers/acpi/dispatcher/dswscope.c
rename to drivers/acpi/acpica/dswscope.c
index 9e60732658734c4c1741f32c3eb1ff236da20e61..908645e72f0320477f1f05e83bd43d5a63135cc0 100644 (file)
@@ -42,7 +42,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acdispat.h>
+#include "accommon.h"
+#include "acdispat.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dswscope")
similarity index 99%
rename from drivers/acpi/dispatcher/dswstate.c
rename to drivers/acpi/acpica/dswstate.c
index b00d4af791aaa7829e4c020fdc19680dba1b1433..40f92bf7dce5cc2e7bf33cd5fd83013d544d4328 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/acdispat.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dswstate")
similarity index 96%
rename from drivers/acpi/events/evevent.c
rename to drivers/acpi/acpica/evevent.c
index c56c5c6ea77b9d5c8cd0d35cc794aad5ed3ba16b..803edd9e3f6a65f853b31232b07d5719a787c7a2 100644 (file)
@@ -42,7 +42,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
+#include "accommon.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evevent")
@@ -72,8 +73,8 @@ acpi_status acpi_ev_initialize_events(void)
 
        /*
         * Initialize the Fixed and General Purpose Events. This is done prior to
-        * enabling SCIs to prevent interrupts from occurring before the handlers are
-        * installed.
+        * enabling SCIs to prevent interrupts from occurring before the handlers
+        * are installed.
         */
        status = acpi_ev_fixed_event_initialize();
        if (ACPI_FAILURE(status)) {
@@ -192,8 +193,8 @@ static acpi_status acpi_ev_fixed_event_initialize(void)
        acpi_status status;
 
        /*
-        * Initialize the structure that keeps track of fixed event handlers
-        * and enable the fixed events.
+        * Initialize the structure that keeps track of fixed event handlers and
+        * enable the fixed events.
         */
        for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
                acpi_gbl_fixed_event_handlers[i].handler = NULL;
@@ -237,7 +238,7 @@ u32 acpi_ev_fixed_event_detect(void)
 
        /*
         * Read the fixed feature status and enable registers, as all the cases
-        * depend on their values.  Ignore errors here.
+        * depend on their values. Ignore errors here.
         */
        (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status);
        (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
@@ -291,8 +292,8 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
                                status_register_id, 1);
 
        /*
-        * Make sure we've got a handler.  If not, report an error.
-        * The event is disabled to prevent further interrupts.
+        * Make sure we've got a handler. If not, report an error. The event is
+        * disabled to prevent further interrupts.
         */
        if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
                (void)acpi_set_register(acpi_gbl_fixed_event_info[event].
similarity index 94%
rename from drivers/acpi/events/evgpe.c
rename to drivers/acpi/acpica/evgpe.c
index f45c74fe745e59d1aee76512c7abfc4dbf0f6300..f345ced3647731f4365f4e8e657caec8aaac84d8 100644 (file)
@@ -42,8 +42,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acevents.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evgpe")
@@ -125,7 +126,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
            (1 <<
             (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
 
-       /* 1) Disable case.  Simply clear all enable bits */
+       /* 1) Disable case. Simply clear all enable bits */
 
        if (type == ACPI_GPE_DISABLE) {
                ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
@@ -134,7 +135,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
                return_ACPI_STATUS(AE_OK);
        }
 
-       /* 2) Enable case.  Set/Clear the appropriate enable bits */
+       /* 2) Enable case. Set/Clear the appropriate enable bits */
 
        switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
        case ACPI_GPE_TYPE_WAKE:
@@ -295,7 +296,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
  *
  * FUNCTION:    acpi_ev_get_gpe_event_info
  *
- * PARAMETERS:  gpe_device          - Device node.  NULL for GPE0/GPE1
+ * PARAMETERS:  gpe_device          - Device node. NULL for GPE0/GPE1
  *              gpe_number          - Raw GPE number
  *
  * RETURN:      A GPE event_info struct. NULL if not a valid GPE
@@ -372,7 +373,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
  *
  * RETURN:      INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
  *
- * DESCRIPTION: Detect if any GP events have occurred.  This function is
+ * DESCRIPTION: Detect if any GP events have occurred. This function is
  *              executed at interrupt level.
  *
  ******************************************************************************/
@@ -400,8 +401,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 
        /*
         * We need to obtain the GPE lock for both the data structs and registers
-        * Note: Not necessary to obtain the hardware lock, since the GPE registers
-        * are owned by the gpe_lock.
+        * Note: Not necessary to obtain the hardware lock, since the GPE
+        * registers are owned by the gpe_lock.
         */
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 
@@ -410,9 +411,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
        gpe_block = gpe_xrupt_list->gpe_block_list_head;
        while (gpe_block) {
                /*
-                * Read all of the 8-bit GPE status and enable registers
-                * in this GPE block, saving all of them.
-                * Find all currently active GP events.
+                * Read all of the 8-bit GPE status and enable registers in this GPE
+                * block, saving all of them. Find all currently active GP events.
                 */
                for (i = 0; i < gpe_block->register_count; i++) {
 
@@ -423,10 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                        /* Read the Status Register */
 
                        status =
-                           acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
-                                                  &status_reg,
-                                                  &gpe_register_info->
-                                                  status_address);
+                           acpi_read(&status_reg,
+                                     &gpe_register_info->status_address);
                        if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
@@ -434,10 +432,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                        /* Read the Enable Register */
 
                        status =
-                           acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
-                                                  &enable_reg,
-                                                  &gpe_register_info->
-                                                  enable_address);
+                           acpi_read(&enable_reg,
+                                     &gpe_register_info->enable_address);
                        if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
@@ -527,8 +523,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
        (void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
 
        /*
-        * Take a snapshot of the GPE info for this level - we copy the
-        * info to prevent a race condition with remove_handler/remove_block.
+        * Take a snapshot of the GPE info for this level - we copy the info to
+        * prevent a race condition with remove_handler/remove_block.
         */
        ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info,
                    sizeof(struct acpi_gpe_event_info));
@@ -539,8 +535,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
        }
 
        /*
-        * Must check for control method type dispatch one more
-        * time to avoid race with ev_gpe_install_handler
+        * Must check for control method type dispatch one more time to avoid a
+        * race with ev_gpe_install_handler
         */
        if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
            ACPI_GPE_DISPATCH_METHOD) {
@@ -584,8 +580,8 @@ static void acpi_ev_asynch_enable_gpe(void *context)
        if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
            ACPI_GPE_LEVEL_TRIGGERED) {
                /*
-                * GPE is level-triggered, we clear the GPE status bit after
-                * handling the event.
+                * GPE is level-triggered, we clear the GPE status bit after handling
+                * the event.
                 */
                status = acpi_hw_clear_gpe(gpe_event_info);
                if (ACPI_FAILURE(status)) {
@@ -624,7 +620,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
        acpi_os_gpe_count(gpe_number);
 
        /*
-        * If edge-triggered, clear the GPE status bit now.  Note that
+        * If edge-triggered, clear the GPE status bit now. Note that
         * level-triggered events are cleared after the GPE is serviced.
         */
        if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
@@ -650,7 +646,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
 
                /*
                 * Invoke the installed handler (at interrupt level)
-                * Ignore return status for now.  TBD: leave GPE disabled on error?
+                * Ignore return status for now.
+                * TBD: leave GPE disabled on error?
                 */
                (void)gpe_event_info->dispatch.handler->address(gpe_event_info->
                                                                dispatch.
@@ -708,7 +705,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                            gpe_number));
 
                /*
-                * Disable the GPE. The GPE will remain disabled until the ACPI
+                * Disable the GPE. The GPE will remain disabled until the ACPICA
                 * Core Subsystem is restarted, or a handler is installed.
                 */
                status = acpi_ev_disable_gpe(gpe_event_info);
similarity index 94%
rename from drivers/acpi/events/evgpeblk.c
rename to drivers/acpi/acpica/evgpeblk.c
index 73c058e2f5c213b9aa3b8e01f958bc7f81b52d26..484cc0565d5baffd708e93de337da6be4c0f9074 100644 (file)
@@ -42,8 +42,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acevents.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evgpeblk")
@@ -124,6 +125,7 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
  * FUNCTION:    acpi_ev_walk_gpe_list
  *
  * PARAMETERS:  gpe_walk_callback   - Routine called for each GPE block
+ *              Context             - Value passed to callback
  *
  * RETURN:      Status
  *
@@ -131,7 +133,8 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
  *
  ******************************************************************************/
 
-acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
+acpi_status
+acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context)
 {
        struct acpi_gpe_block_info *gpe_block;
        struct acpi_gpe_xrupt_info *gpe_xrupt_info;
@@ -154,8 +157,13 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
 
                        /* One callback per GPE block */
 
-                       status = gpe_walk_callback(gpe_xrupt_info, gpe_block);
+                       status =
+                           gpe_walk_callback(gpe_xrupt_info, gpe_block,
+                                             context);
                        if (ACPI_FAILURE(status)) {
+                               if (status == AE_CTRL_END) {    /* Callback abort */
+                                       status = AE_OK;
+                               }
                                goto unlock_and_exit;
                        }
 
@@ -186,7 +194,8 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
 
 acpi_status
 acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                           struct acpi_gpe_block_info *gpe_block)
+                           struct acpi_gpe_block_info *gpe_block,
+                           void *context)
 {
        struct acpi_gpe_event_info *gpe_event_info;
        u32 i;
@@ -309,17 +318,17 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
             (gpe_block->block_base_number +
              (gpe_block->register_count * 8)))) {
                /*
-                * Not valid for this GPE block, just ignore it
-                * However, it may be valid for a different GPE block, since GPE0 and GPE1
-                * methods both appear under \_GPE.
+                * Not valid for this GPE block, just ignore it. However, it may be
+                * valid for a different GPE block, since GPE0 and GPE1 methods both
+                * appear under \_GPE.
                 */
                return_ACPI_STATUS(AE_OK);
        }
 
        /*
-        * Now we can add this information to the gpe_event_info block
-        * for use during dispatch of this GPE. Default type is RUNTIME, although
-        * this may change when the _PRW methods are executed later.
+        * Now we can add this information to the gpe_event_info block 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];
@@ -394,8 +403,8 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
        gpe_block = gpe_info->gpe_block;
 
        /*
-        * The _PRW object must return a package, we are only interested
-        * in the first element
+        * The _PRW object must return a package, we are only interested in the
+        * first element
         */
        obj_desc = pkg_desc->package.elements[0];
 
@@ -434,7 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
        /*
         * Is this GPE within this block?
         *
-        * TRUE iff these conditions are true:
+        * TRUE if and only if these conditions are true:
         *     1) The GPE devices match.
         *     2) The GPE index(number) is within the range of the Gpe Block
         *          associated with the GPE device.
@@ -457,6 +466,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
                if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
+
                status =
                    acpi_ev_update_gpe_enable_masks(gpe_event_info,
                                                    ACPI_GPE_DISABLE);
@@ -476,9 +486,9 @@ 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
- *              block per unique interrupt level used for GPEs.
- *              Should be called only when the GPE lists are semaphore locked
- *              and not subject to change.
+ *              block per unique interrupt level used for GPEs. Should be
+ *              called only when the GPE lists are semaphore locked and not
+ *              subject to change.
  *
  ******************************************************************************/
 
@@ -608,8 +618,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
  *
  * FUNCTION:    acpi_ev_install_gpe_block
  *
- * PARAMETERS:  gpe_block       - New GPE block
- *              interrupt_number - Xrupt to be associated with this GPE block
+ * PARAMETERS:  gpe_block               - New GPE block
+ *              interrupt_number        - Xrupt to be associated with this
+ *                                        GPE block
  *
  * RETURN:      Status
  *
@@ -666,7 +677,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
  *
  * FUNCTION:    acpi_ev_delete_gpe_block
  *
- * PARAMETERS:  gpe_block       - Existing GPE block
+ * PARAMETERS:  gpe_block           - Existing GPE block
  *
  * RETURN:      Status
  *
@@ -688,7 +699,8 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
 
        /* Disable all GPEs in this block */
 
-       status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block);
+       status =
+           acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block, NULL);
 
        if (!gpe_block->previous && !gpe_block->next) {
 
@@ -715,6 +727,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
                acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
        }
 
+       acpi_current_gpe_count -=
+           gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH;
+
        /* Free the gpe_block */
 
        ACPI_FREE(gpe_block->register_info);
@@ -786,9 +801,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
 
        /*
         * 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,
-        * and the enable registers occupy the second half.
+        * 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, and the enable registers occupy the second half.
         */
        this_register = gpe_register_info;
        this_event = gpe_event_info;
@@ -816,10 +831,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
                    ACPI_GPE_REGISTER_WIDTH;
                this_register->enable_address.bit_width =
                    ACPI_GPE_REGISTER_WIDTH;
-               this_register->status_address.bit_offset =
-                   ACPI_GPE_REGISTER_WIDTH;
-               this_register->enable_address.bit_offset =
-                   ACPI_GPE_REGISTER_WIDTH;
+               this_register->status_address.bit_offset = 0;
+               this_register->enable_address.bit_offset = 0;
 
                /* Init the event_info for each GPE within this register */
 
@@ -832,18 +845,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
 
                /* Disable all GPEs within this register */
 
-               status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00,
-                                                &this_register->
-                                                enable_address);
+               status = acpi_write(0x00, &this_register->enable_address);
                if (ACPI_FAILURE(status)) {
                        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);
+               status = acpi_write(0xFF, &this_register->status_address);
                if (ACPI_FAILURE(status)) {
                        goto error_exit;
                }
@@ -956,6 +965,9 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
                          gpe_device->name.ascii, gpe_block->register_count,
                          interrupt_number));
 
+       /* Update global count of currently available GPEs */
+
+       acpi_current_gpe_count += register_count * ACPI_GPE_REGISTER_WIDTH;
        return_ACPI_STATUS(AE_OK);
 }
 
@@ -1055,7 +1067,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
 
        /* Enable all valid runtime GPEs found above */
 
-       status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
+       status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL);
        if (ACPI_FAILURE(status)) {
                ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p",
                            gpe_block));
similarity index 93%
rename from drivers/acpi/events/evmisc.c
rename to drivers/acpi/acpica/evmisc.c
index 1d5670be729ab3cc13e8d57c639463adce8788dc..5f893057bcc617909cb08294089e6f0e98f9dc53 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evmisc")
 
-/* Pointer to FACS needed for the Global Lock */
-static struct acpi_table_facs *facs = NULL;
-
 /* Local prototypes */
-
 static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
 
 static u32 acpi_ev_global_lock_handler(void *context);
@@ -152,7 +149,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
                        break;
 
                default:
+
                        /* All other types are not supported */
+
                        return (AE_TYPE);
                }
        }
@@ -193,9 +192,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
                        acpi_ut_delete_generic_state(notify_info);
                }
        } else {
-               /*
-                * There is no notify handler (per-device or system) for this device.
-                */
+               /* There is no notify handler (per-device or system) for this device */
+
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                  "No notify handler for Notify (%4.4s, %X) node %p\n",
                                  acpi_ut_get_node_name(node), notify_value,
@@ -229,9 +227,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
        ACPI_FUNCTION_ENTRY();
 
        /*
-        * We will invoke a global notify handler if installed.
-        * This is done _before_ we invoke the per-device handler attached
-        * to the device.
+        * We will invoke a global notify handler if installed. This is done
+        * _before_ we invoke the per-device handler attached to the device.
         */
        if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
 
@@ -299,7 +296,7 @@ static u32 acpi_ev_global_lock_handler(void *context)
         * If we don't get it now, it will be marked pending and we will
         * take another interrupt when it becomes free.
         */
-       ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired);
+       ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired);
        if (acquired) {
 
                /* Got the lock, now wake all threads waiting for it */
@@ -336,34 +333,27 @@ acpi_status acpi_ev_init_global_lock_handler(void)
 
        ACPI_FUNCTION_TRACE(ev_init_global_lock_handler);
 
-       status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
-                                        ACPI_CAST_INDIRECT_PTR(struct
-                                                               acpi_table_header,
-                                                               &facs));
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
+       /* Attempt installation of the global lock handler */
 
-       acpi_gbl_global_lock_present = TRUE;
        status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
                                                  acpi_ev_global_lock_handler,
                                                  NULL);
 
        /*
-        * If the global lock does not exist on this platform, the attempt
-        * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
-        * Map to AE_OK, but mark global lock as not present.
-        * Any attempt to actually use the global lock will be flagged
-        * with an error.
+        * If the global lock does not exist on this platform, the attempt to
+        * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
+        * Map to AE_OK, but mark global lock as not present. Any attempt to
+        * actually use the global lock will be flagged with an error.
         */
        if (status == AE_NO_HARDWARE_RESPONSE) {
                ACPI_ERROR((AE_INFO,
                            "No response from Global Lock hardware, disabling lock"));
 
                acpi_gbl_global_lock_present = FALSE;
-               status = AE_OK;
+               return_ACPI_STATUS(AE_OK);
        }
 
+       acpi_gbl_global_lock_present = TRUE;
        return_ACPI_STATUS(status);
 }
 
@@ -462,8 +452,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
        }
 
        /*
-        * Make sure that a global lock actually exists. If not, just treat
-        * the lock as a standard mutex.
+        * Make sure that a global lock actually exists. If not, just treat the
+        * lock as a standard mutex.
         */
        if (!acpi_gbl_global_lock_present) {
                acpi_gbl_global_lock_acquired = TRUE;
@@ -472,7 +462,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
 
        /* Attempt to acquire the actual hardware lock */
 
-       ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired);
+       ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired);
        if (acquired) {
 
                /* We got the lock */
@@ -536,7 +526,7 @@ acpi_status acpi_ev_release_global_lock(void)
 
                /* Allow any thread to release the lock */
 
-               ACPI_RELEASE_GLOBAL_LOCK(facs, pending);
+               ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending);
 
                /*
                 * If the pending bit was set, we must write GBL_RLS to the control
@@ -582,8 +572,8 @@ void acpi_ev_terminate(void)
 
        if (acpi_gbl_events_initialized) {
                /*
-                * Disable all event-related functionality.
-                * In all cases, on error, print a message but obviously we don't abort.
+                * Disable all event-related functionality. In all cases, on error,
+                * print a message but obviously we don't abort.
                 */
 
                /* Disable all fixed events */
@@ -599,7 +589,7 @@ void acpi_ev_terminate(void)
 
                /* Disable all GPEs in all GPE blocks */
 
-               status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
+               status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL);
 
                /* Remove SCI handler */
 
@@ -617,7 +607,7 @@ void acpi_ev_terminate(void)
 
        /* Deallocate all handler objects installed within GPE info structs */
 
-       status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
+       status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers, NULL);
 
        /* Return to original mode if necessary */
 
similarity index 91%
rename from drivers/acpi/events/evregion.c
rename to drivers/acpi/acpica/evregion.c
index 236fbd1ca438ae35c1cff68c76cc0df69556b82f..665c0887ab4de9af51e4414106539058e9bc909b 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evregion")
-#define ACPI_NUM_DEFAULT_SPACES     4
-static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
-       ACPI_ADR_SPACE_SYSTEM_MEMORY,
-       ACPI_ADR_SPACE_SYSTEM_IO,
-       ACPI_ADR_SPACE_PCI_CONFIG,
-       ACPI_ADR_SPACE_DATA_TABLE
-};
 
 /* Local prototypes */
-
 static acpi_status
 acpi_ev_reg_run(acpi_handle obj_handle,
                u32 level, void *context, void **return_value);
@@ -66,6 +59,17 @@ static acpi_status
 acpi_ev_install_handler(acpi_handle obj_handle,
                        u32 level, void *context, void **return_value);
 
+/* These are the address spaces that will get default handlers */
+
+#define ACPI_NUM_DEFAULT_SPACES     4
+
+static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
+       ACPI_ADR_SPACE_SYSTEM_MEMORY,
+       ACPI_ADR_SPACE_SYSTEM_IO,
+       ACPI_ADR_SPACE_PCI_CONFIG,
+       ACPI_ADR_SPACE_DATA_TABLE
+};
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_region_handlers
@@ -91,18 +95,19 @@ acpi_status acpi_ev_install_region_handlers(void)
        }
 
        /*
-        * All address spaces (PCI Config, EC, SMBus) are scope dependent
-        * and registration must occur for a specific device.
+        * All address spaces (PCI Config, EC, SMBus) are scope dependent and
+        * registration must occur for a specific device.
         *
-        * In the case of the system memory and IO address spaces there is currently
-        * no device associated with the address space.  For these we use the root.
+        * In the case of the system memory and IO address spaces there is
+        * currently no device associated with the address space. For these we
+        * use the root.
         *
-        * We install the default PCI config space handler at the root so
-        * that this space is immediately available even though the we have
-        * not enumerated all the PCI Root Buses yet.  This is to conform
-        * to the ACPI specification which states that the PCI config
-        * space must be always available -- even though we are nowhere
-        * near ready to find the PCI root buses at this point.
+        * We install the default PCI config space handler at the root so that
+        * this space is immediately available even though the we have not
+        * enumerated all the PCI Root Buses yet. This is to conform to the ACPI
+        * specification which states that the PCI config space must be always
+        * available -- even though we are nowhere near ready to find the PCI root
+        * buses at this point.
         *
         * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
         * has already been installed (via acpi_install_address_space_handler).
@@ -160,12 +165,11 @@ acpi_status acpi_ev_initialize_op_regions(void)
                return_ACPI_STATUS(status);
        }
 
-       /*
-        * Run the _REG methods for op_regions in each default address space
-        */
-       for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
+       /* Run the _REG methods for op_regions in each default address space */
 
-               /* TBD: Make sure handler is the DEFAULT handler, otherwise
+       for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
+               /*
+                * TBD: Make sure handler is the DEFAULT handler, otherwise
                 * _REG will have already been run.
                 */
                status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
@@ -318,13 +322,13 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
        }
 
        /*
-        * It may be the case that the region has never been initialized
+        * It may be the case that the region has never been initialized.
         * Some types of regions require special init code
         */
        if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
-               /*
-                * This region has not been initialized yet, do it
-                */
+
+               /* This region has not been initialized yet, do it */
+
                region_setup = handler_desc->address_space.setup;
                if (!region_setup) {
 
@@ -339,9 +343,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                }
 
                /*
-                * We must exit the interpreter because the region
-                * setup will potentially execute control methods
-                * (e.g., _REG method for this region)
+                * We must exit the interpreter because the region setup will
+                * potentially execute control methods (for example, the _REG method
+                * for this region)
                 */
                acpi_ex_exit_interpreter();
 
@@ -364,9 +368,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                        return_ACPI_STATUS(status);
                }
 
-               /*
-                * Region initialization may have been completed by region_setup
-                */
+               /* Region initialization may have been completed by region_setup */
+
                if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
                        region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
 
@@ -521,8 +524,8 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
                        }
 
                        /*
-                        * If the region has been activated, call the setup handler
-                        * with the deactivate notification
+                        * If the region has been activated, call the setup handler with
+                        * the deactivate notification
                         */
                        if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
                                region_setup = handler_obj->address_space.setup;
@@ -668,8 +671,8 @@ acpi_ev_install_handler(acpi_handle obj_handle,
        }
 
        /*
-        * We only care about regions.and objects
-        * that are allowed to have address space handlers
+        * We only care about regions and objects that are allowed to have
+        * address space handlers
         */
        if ((node->type != ACPI_TYPE_DEVICE) &&
            (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
@@ -710,9 +713,9 @@ acpi_ev_install_handler(acpi_handle obj_handle,
                                /*
                                 * Since the object we found it on was a device, then it
                                 * means that someone has already installed a handler for
-                                * the branch of the namespace from this device on.  Just
+                                * the branch of the namespace from this device on. Just
                                 * bail out telling the walk routine to not traverse this
-                                * branch.  This preserves the scoping rule for handlers.
+                                * branch. This preserves the scoping rule for handlers.
                                 */
                                return (AE_CTRL_DEPTH);
                        }
@@ -723,9 +726,8 @@ acpi_ev_install_handler(acpi_handle obj_handle,
                }
 
                /*
-                * As long as the device didn't have a handler for this
-                * space we don't care about it.  We just ignore it and
-                * proceed.
+                * As long as the device didn't have a handler for this space we
+                * don't care about it. We just ignore it and proceed.
                 */
                return (AE_OK);
        }
@@ -733,16 +735,14 @@ acpi_ev_install_handler(acpi_handle obj_handle,
        /* Object is a Region */
 
        if (obj_desc->region.space_id != handler_obj->address_space.space_id) {
-               /*
-                * This region is for a different address space
-                * -- just ignore it
-                */
+
+               /* This region is for a different address space, just ignore it */
+
                return (AE_OK);
        }
 
        /*
-        * Now we have a region and it is for the handler's address
-        * space type.
+        * Now we have a region and it is for the handler's address space type.
         *
         * First disconnect region for any previous handler (if any)
         */
@@ -786,9 +786,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
        ACPI_FUNCTION_TRACE(ev_install_space_handler);
 
        /*
-        * This registration is valid for only the types below
-        * and the root.  This is where the default handlers
-        * get placed.
+        * This registration is valid for only the types below and the root. This
+        * is where the default handlers get placed.
         */
        if ((node->type != ACPI_TYPE_DEVICE) &&
            (node->type != ACPI_TYPE_PROCESSOR) &&
@@ -848,8 +847,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
        obj_desc = acpi_ns_get_attached_object(node);
        if (obj_desc) {
                /*
-                * The attached device object already exists.
-                * Make sure the handler is not already installed.
+                * The attached device object already exists. Make sure the handler
+                * is not already installed.
                 */
                handler_obj = obj_desc->device.handler;
 
@@ -864,8 +863,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
                                    handler) {
                                        /*
                                         * It is (relatively) OK to attempt to install the SAME
-                                        * handler twice. This can easily happen
-                                        * with PCI_Config space.
+                                        * handler twice. This can easily happen with the
+                                        * PCI_Config space.
                                         */
                                        status = AE_SAME_HANDLER;
                                        goto unlock_and_exit;
@@ -925,9 +924,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
        /*
         * Install the handler
         *
-        * At this point there is no existing handler.
-        * Just allocate the object for the handler and link it
-        * into the list.
+        * At this point there is no existing handler. Just allocate the object
+        * for the handler and link it into the list.
         */
        handler_obj =
            acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
@@ -1000,11 +998,10 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
        ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
 
        /*
-        * Run all _REG methods for all Operation Regions for this
-        * space ID.  This is a separate walk in order to handle any
-        * interdependencies between regions and _REG methods.  (i.e. handlers
-        * must be installed for all regions of this Space ID before we
-        * can run any _REG methods)
+        * Run all _REG methods for all Operation Regions for this space ID. This
+        * is a separate walk in order to handle any interdependencies between
+        * regions and _REG methods. (i.e. handlers must be installed for all
+        * regions of this Space ID before we can run any _REG methods)
         */
        status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
                                        ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
@@ -1042,8 +1039,8 @@ acpi_ev_reg_run(acpi_handle obj_handle,
        }
 
        /*
-        * We only care about regions.and objects
-        * that are allowed to have address space handlers
+        * We only care about regions.and objects that are allowed to have address
+        * space handlers
         */
        if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
                return (AE_OK);
@@ -1062,10 +1059,9 @@ acpi_ev_reg_run(acpi_handle obj_handle,
        /* Object is a Region */
 
        if (obj_desc->region.space_id != space_id) {
-               /*
-                * This region is for a different address space
-                * -- just ignore it
-                */
+
+               /* This region is for a different address space, just ignore it */
+
                return (AE_OK);
        }
 
similarity index 95%
rename from drivers/acpi/events/evrgnini.c
rename to drivers/acpi/acpica/evrgnini.c
index 6b94b38df07dd30b77580af0459c81e640776d29..f3f1fb45c3dcd542bcbb871960d060fbb15a304b 100644 (file)
@@ -42,8 +42,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acevents.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evrgnini")
@@ -233,9 +234,9 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
                                if (ACPI_FAILURE(status)) {
                                        if (status == AE_SAME_HANDLER) {
                                                /*
-                                                * It is OK if the handler is already installed on the root
-                                                * bridge.  Still need to return a context object for the
-                                                * new PCI_Config operation region, however.
+                                                * It is OK if the handler is already installed on the
+                                                * root bridge. Still need to return a context object
+                                                * for the new PCI_Config operation region, however.
                                                 */
                                                status = AE_OK;
                                        } else {
@@ -272,8 +273,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
        }
 
        /*
-        * For PCI_Config space access, we need the segment, bus,
-        * device and function numbers.  Acquire them here.
+        * For PCI_Config space access, we need the segment, bus, device and
+        * function numbers. Acquire them here.
         *
         * Find the parent device object. (This allows the operation region to be
         * within a subscope under the device, such as a control method.)
@@ -289,16 +290,16 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
        }
 
        /*
-        * Get the PCI device and function numbers from the _ADR object
-        * contained in the parent's scope.
+        * Get the PCI device and function numbers from the _ADR object contained
+        * in the parent's scope.
         */
        status =
            acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node,
                                            &pci_value);
 
        /*
-        * The default is zero, and since the allocation above zeroed
-        * the data, just do nothing on failure.
+        * The default is zero, and since the allocation above zeroed the data,
+        * just do nothing on failure.
         */
        if (ACPI_SUCCESS(status)) {
                pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value));
@@ -382,9 +383,8 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
        struct acpi_compatible_id_list *cid;
        u32 i;
 
-       /*
-        * Get the _HID and check for a PCI Root Bridge
-        */
+       /* Get the _HID and check for a PCI Root Bridge */
+
        status = acpi_ut_execute_HID(node, &hid);
        if (ACPI_FAILURE(status)) {
                return (FALSE);
@@ -394,10 +394,8 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
                return (TRUE);
        }
 
-       /*
-        * The _HID did not match.
-        * Get the _CID and check for a PCI Root Bridge
-        */
+       /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
+
        status = acpi_ut_execute_CID(node, &cid);
        if (ACPI_FAILURE(status)) {
                return (FALSE);
@@ -516,9 +514,9 @@ acpi_ev_default_region_setup(acpi_handle handle,
  *              Get the appropriate address space handler for a newly
  *              created region.
  *
- *              This also performs address space specific initialization.  For
+ *              This also performs address space specific initialization. For
  *              example, PCI regions must have an _ADR object that contains
- *              a PCI address in the scope of the definition.  This address is
+ *              a PCI address in the scope of the definition. This address is
  *              required to perform an access to PCI config space.
  *
  * MUTEX:       Interpreter should be unlocked, because we may run the _REG
@@ -572,7 +570,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
        if (ACPI_SUCCESS(status)) {
                /*
                 * The _REG method is optional and there can be only one per region
-                * definition.  This will be executed when the handler is attached
+                * definition. This will be executed when the handler is attached
                 * or removed
                 */
                region_obj2->extra.method_REG = method_node;
@@ -670,10 +668,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
                        }
                }
 
-               /*
-                * This node does not have the handler we need;
-                * Pop up one level
-                */
+               /* This node does not have the handler we need; Pop up one level */
+
                node = acpi_ns_get_parent_node(node);
        }
 
similarity index 95%
rename from drivers/acpi/events/evsci.c
rename to drivers/acpi/acpica/evsci.c
index 2a8b77877610a13df05762d10a9a77ce4adf8eb1..567b356c85affb780175f5009ebbb12faa0cb8db 100644 (file)
@@ -43,7 +43,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
+#include "accommon.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evsci")
@@ -115,10 +116,8 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
         * if this interrupt handler is installed, ACPI is enabled.
         */
 
-       /*
-        * GPEs:
-        * Check for and dispatch any GPEs that have occurred
-        */
+       /* GPEs: Check for and dispatch any GPEs that have occurred */
+
        interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
        return_UINT32(interrupt_handled);
@@ -158,11 +157,11 @@ u32 acpi_ev_install_sci_handler(void)
  * RETURN:      E_OK if handler uninstalled OK, E_ERROR if handler was not
  *              installed to begin with
  *
- * DESCRIPTION: Remove the SCI interrupt handler.  No further SCIs will be
+ * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
  *              taken.
  *
  * Note:  It doesn't seem important to disable all events or set the event
- *        enable registers to their original values.  The OS should disable
+ *        enable registers to their original values. The OS should disable
  *        the SCI interrupt level when the handler is removed, so no more
  *        events will come in.
  *
similarity index 99%
rename from drivers/acpi/events/evxface.c
rename to drivers/acpi/acpica/evxface.c
index 94a6efe020bed116118c408e92f35f30a0d23a2e..3aca9010a11eb16f4ded8775e009ae99cb010bf9 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acevents.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acevents.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evxface")
@@ -267,7 +268,7 @@ acpi_install_notify_handler(acpi_handle device,
        /*
         * Root Object:
         * Registering a notify handler on the root object indicates that the
-        * caller wishes to receive notifications for all objects.  Note that
+        * caller wishes to receive notifications for all objects. Note that
         * only one <external> global handler can be regsitered (per notify type).
         */
        if (device == ACPI_ROOT_OBJECT) {
similarity index 81%
rename from drivers/acpi/events/evxfevnt.c
rename to drivers/acpi/acpica/evxfevnt.c
index 41554f736b682700b3830a955cfd12e45e13b5a5..35485e4b60a67df4d5a09e8cd8aa1e2cbe3b1000 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
-#include <acpi/acnamesp.h>
-#include <acpi/actables.h>
+#include "accommon.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evxfevnt")
 
+/* Local prototypes */
+acpi_status
+acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                      struct acpi_gpe_block_info *gpe_block, void *context);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enable
@@ -60,6 +66,7 @@ ACPI_MODULE_NAME("evxfevnt")
  * DESCRIPTION: Transfers the system into ACPI mode.
  *
  ******************************************************************************/
+
 acpi_status acpi_enable(void)
 {
        acpi_status status = AE_OK;
@@ -161,8 +168,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
        }
 
        /*
-        * Enable the requested fixed event (by writing a one to the
-        * enable register bit)
+        * Enable the requested fixed event (by writing a one to the enable
+        * register bit)
         */
        status =
            acpi_set_register(acpi_gbl_fixed_event_info[event].
@@ -343,8 +350,8 @@ acpi_status acpi_disable_event(u32 event, u32 flags)
        }
 
        /*
-        * Disable the requested fixed event (by writing a zero to the
-        * enable register bit)
+        * Disable the requested fixed event (by writing a zero to the enable
+        * register bit)
         */
        status =
            acpi_set_register(acpi_gbl_fixed_event_info[event].
@@ -396,8 +403,8 @@ acpi_status acpi_clear_event(u32 event)
        }
 
        /*
-        * Clear the requested fixed event (By writing a one to the
-        * status register bit)
+        * Clear the requested fixed event (By writing a one to the status
+        * register bit)
         */
        status =
            acpi_set_register(acpi_gbl_fixed_event_info[event].
@@ -717,3 +724,148 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
 }
 
 ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_get_gpe_device
+ *
+ * PARAMETERS:  Index               - System GPE index (0-current_gpe_count)
+ *              gpe_device          - Where the parent GPE Device is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
+ *              gpe device indicates that the gpe number is contained in one of
+ *              the FADT-defined gpe blocks. Otherwise, the GPE block device.
+ *
+ ******************************************************************************/
+acpi_status
+acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
+{
+       struct acpi_gpe_device_info info;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(acpi_get_gpe_device);
+
+       if (!gpe_device) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
+
+       if (index >= acpi_current_gpe_count) {
+               return_ACPI_STATUS(AE_NOT_EXIST);
+       }
+
+       /* Setup and walk the GPE list */
+
+       info.index = index;
+       info.status = AE_NOT_EXIST;
+       info.gpe_device = NULL;
+       info.next_block_base_index = 0;
+
+       status = acpi_ev_walk_gpe_list(acpi_ev_get_gpe_device, &info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       *gpe_device = info.gpe_device;
+       return_ACPI_STATUS(info.status);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_get_gpe_device)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ev_get_gpe_device
+ *
+ * PARAMETERS:  GPE_WALK_CALLBACK
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Matches the input GPE index (0-current_gpe_count) with a GPE
+ *              block device. NULL if the GPE is one of the FADT-defined GPEs.
+ *
+ ******************************************************************************/
+acpi_status
+acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                      struct acpi_gpe_block_info *gpe_block, void *context)
+{
+       struct acpi_gpe_device_info *info = context;
+
+       /* Increment Index by the number of GPEs in this block */
+
+       info->next_block_base_index +=
+           (gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH);
+
+       if (info->index < info->next_block_base_index) {
+               /*
+                * The GPE index is within this block, get the node. Leave the node
+                * NULL for the FADT-defined GPEs
+                */
+               if ((gpe_block->node)->type == ACPI_TYPE_DEVICE) {
+                       info->gpe_device = gpe_block->node;
+               }
+
+               info->status = AE_OK;
+               return (AE_CTRL_END);
+       }
+
+       return (AE_OK);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_disable_all_gpes
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
+ *
+ ******************************************************************************/
+
+acpi_status acpi_disable_all_gpes(void)
+{
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(acpi_disable_all_gpes);
+
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       status = acpi_hw_disable_all_gpes();
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+
+       return_ACPI_STATUS(status);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_enable_all_runtime_gpes
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
+ *
+ ******************************************************************************/
+
+acpi_status acpi_enable_all_runtime_gpes(void)
+{
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(acpi_enable_all_runtime_gpes);
+
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       status = acpi_hw_enable_all_runtime_gpes();
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+
+       return_ACPI_STATUS(status);
+}
similarity index 99%
rename from drivers/acpi/events/evxfregn.c
rename to drivers/acpi/acpica/evxfregn.c
index e8750807e57d004151fab56cc56198f73acb29b6..479e7a3721be2b59045d97347bf21eea58f03687 100644 (file)
@@ -43,8 +43,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acevents.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evxfregn")
similarity index 99%
rename from drivers/acpi/executer/exconfig.c
rename to drivers/acpi/acpica/exconfig.c
index 74da6fa52ef183e4db2b3e9db7b24c7d75da5f12..932bbc26aa048322c843b9be95b355ee1ecb9cbd 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-#include <acpi/actables.h>
-#include <acpi/acdispat.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "actables.h"
+#include "acdispat.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exconfig")
similarity index 99%
rename from drivers/acpi/executer/exconvrt.c
rename to drivers/acpi/acpica/exconvrt.c
index 1d1f35adddde65cfd0558ff4a2be97f087759c95..0be10188316e0091fa83d11715eaba690ce19313 100644 (file)
@@ -42,8 +42,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exconvrt")
similarity index 99%
rename from drivers/acpi/executer/excreate.c
rename to drivers/acpi/acpica/excreate.c
index ad09696d50690c7116a3eb741dd3d92cb9a49f4d..a57ad2564ab0c7c66a1594601efcf161971dd4be 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("excreate")
similarity index 99%
rename from drivers/acpi/executer/exdump.c
rename to drivers/acpi/acpica/exdump.c
index d087a7d28aa53f34173cb7d64d688db119017086..aa313574b0df5066eb7e367080b073e82799b698 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exdump")
similarity index 99%
rename from drivers/acpi/executer/exfield.c
rename to drivers/acpi/acpica/exfield.c
index 3e440d84226a4e85aea18a5b49156145e1bfbfd7..a352d0233857dbf461c85f96038d9a247107005e 100644 (file)
@@ -42,8 +42,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acdispat.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exfield")
similarity index 98%
rename from drivers/acpi/executer/exfldio.c
rename to drivers/acpi/acpica/exfldio.c
index 9ff9d1f4615d8841eac8650bf4605e7e3cfb24fa..ef58ac4e687b8bd8f0e170647e0d2afe12abc525 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
-#include <acpi/acevents.h>
-#include <acpi/acdispat.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acevents.h"
+#include "acdispat.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exfldio")
@@ -498,14 +499,13 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                        return_ACPI_STATUS(status);
                }
 
-               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                                 "I/O to Data Register: ValuePtr %p\n",
-                                 value));
-
                if (read_write == ACPI_READ) {
 
                        /* Read the datum from the data_register */
 
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "Read from Data Register\n"));
+
                        status =
                            acpi_ex_extract_from_field(obj_desc->index_field.
                                                       data_obj, value,
@@ -513,6 +513,10 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                } else {
                        /* Write the datum to the data_register */
 
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "Write to Data Register: Value %8.8X%8.8X\n",
+                                         ACPI_FORMAT_UINT64(*value)));
+
                        status =
                            acpi_ex_insert_into_field(obj_desc->index_field.
                                                      data_obj, value,
similarity index 99%
rename from drivers/acpi/executer/exmisc.c
rename to drivers/acpi/acpica/exmisc.c
index efb19134005951cb8adce2b7b473c8734b44b610..6b0747ac683b37edf6967c2aaec1790027173e19 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
-#include <acpi/amlresrc.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "amlresrc.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exmisc")
similarity index 99%
rename from drivers/acpi/executer/exmutex.c
rename to drivers/acpi/acpica/exmutex.c
index a8bf3d713e2821db5c6e32588f4cc52f38e326bc..d301c1f363ef0fceb3749ee679d8f1366ec7fb32 100644 (file)
@@ -43,8 +43,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/acevents.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exmutex")
similarity index 99%
rename from drivers/acpi/executer/exnames.c
rename to drivers/acpi/acpica/exnames.c
index 817e67be36977c12aa7db442217ecf25c87676f3..ffdae122d94af6e365aca484d95678b77d81e759 100644 (file)
@@ -43,8 +43,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exnames")
similarity index 99%
rename from drivers/acpi/executer/exoparg1.c
rename to drivers/acpi/acpica/exoparg1.c
index f622f9eac8a1a85bfe0bfb4afbed5854b5435609..b530480cc7d55a7792c644d5d5c7a885a9e28dcd 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exoparg1")
similarity index 99%
rename from drivers/acpi/executer/exoparg2.c
rename to drivers/acpi/acpica/exoparg2.c
index 368def5dffceb0ffc47be5866d640b83e18f6c53..0b4f513ca885342fc9fc1cffb511d8e1f5e2a6c7 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/acinterp.h>
-#include <acpi/acevents.h>
-#include <acpi/amlcode.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "acevents.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exoparg2")
similarity index 98%
rename from drivers/acpi/executer/exoparg3.c
rename to drivers/acpi/acpica/exoparg3.c
index 9cb4197681af11a6d7e2d59904781cb3e0cee05e..c6520bbf882bae57da1257669a587fb9d4ef4b17 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "acparser.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exoparg3")
similarity index 99%
rename from drivers/acpi/executer/exoparg6.c
rename to drivers/acpi/acpica/exoparg6.c
index 67d48737af5360011b7facec5aa909d62f2d9425..ae43f7670a6c34fa576a1873c653dbda9151020c 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "acparser.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exoparg6")
similarity index 99%
rename from drivers/acpi/executer/exprep.c
rename to drivers/acpi/acpica/exprep.c
index a7dc87ecee37c8a1ca742d5f7870f9d72494390f..a226f74d4a5cddeaf12cdf7cadeba48419b1b3ba 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exprep")
similarity index 99%
rename from drivers/acpi/executer/exregion.c
rename to drivers/acpi/acpica/exregion.c
index 7a41c409ae4d89e14165c8f28bdc131d88d1b5e1..76ec8ff903b8e1f766bf550953303652dfdd85cb 100644 (file)
@@ -43,7 +43,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exregion")
similarity index 98%
rename from drivers/acpi/executer/exresnte.c
rename to drivers/acpi/acpica/exresnte.c
index 423ad3635f3d0aa702e8d5f3652ecf0b572af954..a063a74006f69572d37b7cf4596dea301336b63d 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exresnte")
similarity index 99%
rename from drivers/acpi/executer/exresolv.c
rename to drivers/acpi/acpica/exresolv.c
index 60e8c47128e956140eab026923cc7c937363df4f..f6105a6d6126776fd39fcdcafda104553d5c69fe 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exresolv")
similarity index 99%
rename from drivers/acpi/executer/exresop.c
rename to drivers/acpi/acpica/exresop.c
index 0bb82593da724d62ca766a2a843827a9cf33376c..3c3802764bfbe828dee9a9d1db7c71d37766c634 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
-#include <acpi/acparser.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exresop")
similarity index 99%
rename from drivers/acpi/executer/exstore.c
rename to drivers/acpi/acpica/exstore.c
index 1c118ba78adbd657dc0f22f40dad33bd8b7391e9..e35e9b4f6a4e68b5122a8471145740df389dadba 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "amlcode.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exstore")
similarity index 99%
rename from drivers/acpi/executer/exstoren.c
rename to drivers/acpi/acpica/exstoren.c
index eef61a00803edf560bf2917e1cf66d7c8587e9cc..145d15305f70a6d860d668e87cedc7b7e70ba713 100644 (file)
@@ -44,8 +44,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exstoren")
similarity index 99%
rename from drivers/acpi/executer/exstorob.c
rename to drivers/acpi/acpica/exstorob.c
index 9a75ff09fb0c46b38bf849261d6b860949251cf7..67340cc70142209d1aa97ae360b21587cefc321b 100644 (file)
@@ -43,7 +43,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exstorob")
similarity index 99%
rename from drivers/acpi/executer/exsystem.c
rename to drivers/acpi/acpica/exsystem.c
index 68990f1df371df76886f196ecbc5d42a7a867da3..3d00b9357233a56ee0d4ff00f96cbd54c7b2560a 100644 (file)
@@ -43,7 +43,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acinterp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exsystem")
similarity index 99%
rename from drivers/acpi/executer/exutils.c
rename to drivers/acpi/acpica/exutils.c
index 86c03880b5233a32a524d7efc5a583c4fb73ea7e..32b85d68e756ffd117e801031acb308086d1f6c3 100644 (file)
@@ -59,8 +59,9 @@
 #define DEFINE_AML_GLOBALS
 
 #include <acpi/acpi.h>
-#include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exutils")
similarity index 99%
rename from drivers/acpi/hardware/hwacpi.c
rename to drivers/acpi/acpica/hwacpi.c
index 816894ea839eba7fe21a85bd68f97f9329a715dc..a9d4fea4167f37833e2ef2a855d4748fdd644217 100644 (file)
@@ -43,6 +43,7 @@
  */
 
 #include <acpi/acpi.h>
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwacpi")
similarity index 86%
rename from drivers/acpi/hardware/hwgpe.c
rename to drivers/acpi/acpica/hwgpe.c
index 0b80db9d91979e17ce418f840a56d3096afb5f2d..2013b66745d2c90cf1edb48317cb1235c605e89e 100644 (file)
@@ -43,7 +43,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acevents.h>
+#include "accommon.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwgpe")
@@ -51,7 +52,8 @@ ACPI_MODULE_NAME("hwgpe")
 /* Local prototypes */
 static acpi_status
 acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                               struct acpi_gpe_block_info *gpe_block);
+                               struct acpi_gpe_block_info *gpe_block,
+                               void *context);
 
 /******************************************************************************
  *
@@ -80,8 +82,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 
        /* Get current value of the enable register that contains this GPE */
 
-       status = acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, &enable_mask,
-                                       &gpe_register_info->enable_address);
+       status = acpi_read(&enable_mask, &gpe_register_info->enable_address);
        if (ACPI_FAILURE(status)) {
                return (status);
        }
@@ -95,9 +96,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 
        /* Write the updated enable mask */
 
-       status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, enable_mask,
-                                        &gpe_register_info->enable_address);
-
+       status = acpi_write(enable_mask, &gpe_register_info->enable_address);
        return (status);
 }
 
@@ -132,8 +131,8 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
 
        /* Write the entire GPE (runtime) enable register */
 
-       status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run,
-                                        &gpe_register_info->enable_address);
+       status = acpi_write(gpe_register_info->enable_for_run,
+                           &gpe_register_info->enable_address);
 
        return (status);
 }
@@ -166,9 +165,8 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
         * Write a one to the appropriate bit in the status register to
         * clear this GPE.
         */
-       status = acpi_hw_low_level_write(8, register_bit,
-                                        &gpe_event_info->register_info->
-                                        status_address);
+       status = acpi_write(register_bit,
+                           &gpe_event_info->register_info->status_address);
 
        return (status);
 }
@@ -227,9 +225,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
 
        /* GPE currently active (status bit == 1)? */
 
-       status =
-           acpi_hw_low_level_read(8, &in_byte,
-                                  &gpe_register_info->status_address);
+       status = acpi_read(&in_byte, &gpe_register_info->status_address);
        if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
@@ -260,8 +256,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
  ******************************************************************************/
 
 acpi_status
-acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
-                         struct acpi_gpe_block_info * gpe_block)
+acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                         struct acpi_gpe_block_info *gpe_block, void *context)
 {
        u32 i;
        acpi_status status;
@@ -272,9 +268,9 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
 
                /* Disable all GPEs in this register */
 
-               status = acpi_hw_low_level_write(8, 0x00,
-                                                &gpe_block->register_info[i].
-                                                enable_address);
+               status =
+                   acpi_write(0x00,
+                              &gpe_block->register_info[i].enable_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -297,8 +293,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
  ******************************************************************************/
 
 acpi_status
-acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
-                       struct acpi_gpe_block_info * gpe_block)
+acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                       struct acpi_gpe_block_info *gpe_block, void *context)
 {
        u32 i;
        acpi_status status;
@@ -309,9 +305,9 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
 
                /* Clear status on all GPEs in this register */
 
-               status = acpi_hw_low_level_write(8, 0xFF,
-                                                &gpe_block->register_info[i].
-                                                status_address);
+               status =
+                   acpi_write(0xFF,
+                              &gpe_block->register_info[i].status_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -335,8 +331,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
  ******************************************************************************/
 
 acpi_status
-acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
-                                struct acpi_gpe_block_info * gpe_block)
+acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                                struct acpi_gpe_block_info *gpe_block, void *context)
 {
        u32 i;
        acpi_status status;
@@ -352,12 +348,9 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
 
                /* Enable all "runtime" GPEs in this register */
 
-               status =
-                   acpi_hw_low_level_write(8,
-                                           gpe_block->register_info[i].
-                                           enable_for_run,
-                                           &gpe_block->register_info[i].
-                                           enable_address);
+               status = acpi_write(gpe_block->register_info[i].enable_for_run,
+                                   &gpe_block->register_info[i].
+                                   enable_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -382,7 +375,8 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
 
 static acpi_status
 acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                               struct acpi_gpe_block_info *gpe_block)
+                               struct acpi_gpe_block_info *gpe_block,
+                               void *context)
 {
        u32 i;
        acpi_status status;
@@ -396,11 +390,9 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
                /* Enable all "wake" GPEs in this register */
 
-               status = acpi_hw_low_level_write(8,
-                                                gpe_block->register_info[i].
-                                                enable_for_wake,
-                                                &gpe_block->register_info[i].
-                                                enable_address);
+               status = acpi_write(gpe_block->register_info[i].enable_for_wake,
+                                   &gpe_block->register_info[i].
+                                   enable_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -427,8 +419,8 @@ acpi_status acpi_hw_disable_all_gpes(void)
 
        ACPI_FUNCTION_TRACE(hw_disable_all_gpes);
 
-       status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
-       status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
+       status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL);
+       status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);
        return_ACPI_STATUS(status);
 }
 
@@ -450,7 +442,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void)
 
        ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes);
 
-       status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
+       status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block, NULL);
        return_ACPI_STATUS(status);
 }
 
@@ -472,6 +464,6 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void)
 
        ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes);
 
-       status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
+       status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block, NULL);
        return_ACPI_STATUS(status);
 }
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
new file mode 100644 (file)
index 0000000..4dc43b0
--- /dev/null
@@ -0,0 +1,353 @@
+
+/*******************************************************************************
+ *
+ * Module Name: hwregs - Read/write access functions for the various ACPI
+ *                       control and status registers.
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2008, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <acpi/acpi.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+#define _COMPONENT          ACPI_HARDWARE
+ACPI_MODULE_NAME("hwregs")
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_clear_acpi_status
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Clears all fixed and general purpose status bits
+ *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+acpi_status acpi_hw_clear_acpi_status(void)
+{
+       acpi_status status;
+       acpi_cpu_flags lock_flags = 0;
+
+       ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
+                         ACPI_BITMASK_ALL_FIXED_STATUS,
+                         (u16) acpi_gbl_FADT.xpm1a_event_block.address));
+
+       lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
+
+       status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
+                                       ACPI_BITMASK_ALL_FIXED_STATUS);
+       if (ACPI_FAILURE(status)) {
+               goto unlock_and_exit;
+       }
+
+       /* Clear the fixed events */
+
+       if (acpi_gbl_FADT.xpm1b_event_block.address) {
+               status = acpi_write(ACPI_BITMASK_ALL_FIXED_STATUS,
+                                   &acpi_gbl_FADT.xpm1b_event_block);
+               if (ACPI_FAILURE(status)) {
+                       goto unlock_and_exit;
+               }
+       }
+
+       /* Clear the GPE Bits in all GPE registers in all GPE blocks */
+
+       status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);
+
+      unlock_and_exit:
+       acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
+       return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_get_register_bit_mask
+ *
+ * PARAMETERS:  register_id         - Index of ACPI Register to access
+ *
+ * RETURN:      The bitmask to be used when accessing the register
+ *
+ * DESCRIPTION: Map register_id into a register bitmask.
+ *
+ ******************************************************************************/
+
+struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
+{
+       ACPI_FUNCTION_ENTRY();
+
+       if (register_id > ACPI_BITREG_MAX) {
+               ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X",
+                           register_id));
+               return (NULL);
+       }
+
+       return (&acpi_gbl_bit_register_info[register_id]);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_register_read
+ *
+ * PARAMETERS:  register_id         - ACPI Register ID
+ *              return_value        - Where the register value is returned
+ *
+ * RETURN:      Status and the value read.
+ *
+ * DESCRIPTION: Read from the specified ACPI register
+ *
+ ******************************************************************************/
+acpi_status
+acpi_hw_register_read(u32 register_id, u32 * return_value)
+{
+       u32 value1 = 0;
+       u32 value2 = 0;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(hw_register_read);
+
+       switch (register_id) {
+       case ACPI_REGISTER_PM1_STATUS:  /* 16-bit access */
+
+               status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_event_block);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               /* PM1B is optional */
+
+               status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_event_block);
+               value1 |= value2;
+               break;
+
+       case ACPI_REGISTER_PM1_ENABLE:  /* 16-bit access */
+
+               status = acpi_read(&value1, &acpi_gbl_xpm1a_enable);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               /* PM1B is optional */
+
+               status = acpi_read(&value2, &acpi_gbl_xpm1b_enable);
+               value1 |= value2;
+               break;
+
+       case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
+
+               status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_control_block);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_control_block);
+               value1 |= value2;
+               break;
+
+       case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
+
+               status = acpi_read(&value1, &acpi_gbl_FADT.xpm2_control_block);
+               break;
+
+       case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
+
+               status = acpi_read(&value1, &acpi_gbl_FADT.xpm_timer_block);
+               break;
+
+       case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
+
+               status =
+                   acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8);
+               break;
+
+       default:
+               ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id));
+               status = AE_BAD_PARAMETER;
+               break;
+       }
+
+      exit:
+
+       if (ACPI_SUCCESS(status)) {
+               *return_value = value1;
+       }
+
+       return_ACPI_STATUS(status);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_register_write
+ *
+ * PARAMETERS:  register_id         - ACPI Register ID
+ *              Value               - The value to write
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Write to the specified ACPI register
+ *
+ * NOTE: In accordance with the ACPI specification, this function automatically
+ * preserves the value of the following bits, meaning that these bits cannot be
+ * changed via this interface:
+ *
+ * PM1_CONTROL[0] = SCI_EN
+ * PM1_CONTROL[9]
+ * PM1_STATUS[11]
+ *
+ * ACPI References:
+ * 1) Hardware Ignored Bits: When software writes to a register with ignored
+ *      bit fields, it preserves the ignored bit fields
+ * 2) SCI_EN: OSPM always preserves this bit position
+ *
+ ******************************************************************************/
+
+acpi_status acpi_hw_register_write(u32 register_id, u32 value)
+{
+       acpi_status status;
+       u32 read_value;
+
+       ACPI_FUNCTION_TRACE(hw_register_write);
+
+       switch (register_id) {
+       case ACPI_REGISTER_PM1_STATUS:  /* 16-bit access */
+
+               /* Perform a read first to preserve certain bits (per ACPI spec) */
+
+               status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS,
+                                              &read_value);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               /* Insert the bits to be preserved */
+
+               ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS,
+                                read_value);
+
+               /* Now we can write the data */
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm1a_event_block);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               /* PM1B is optional */
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm1b_event_block);
+               break;
+
+       case ACPI_REGISTER_PM1_ENABLE:  /* 16-bit access */
+
+               status = acpi_write(value, &acpi_gbl_xpm1a_enable);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               /* PM1B is optional */
+
+               status = acpi_write(value, &acpi_gbl_xpm1b_enable);
+               break;
+
+       case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
+
+               /*
+                * Perform a read first to preserve certain bits (per ACPI spec)
+                */
+               status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
+                                              &read_value);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               /* Insert the bits to be preserved */
+
+               ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS,
+                                read_value);
+
+               /* Now we can write the data */
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block);
+               break;
+
+       case ACPI_REGISTER_PM1A_CONTROL:        /* 16-bit access */
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block);
+               break;
+
+       case ACPI_REGISTER_PM1B_CONTROL:        /* 16-bit access */
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block);
+               break;
+
+       case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block);
+               break;
+
+       case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
+
+               status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block);
+               break;
+
+       case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
+
+               /* SMI_CMD is currently always in IO space */
+
+               status =
+                   acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8);
+               break;
+
+       default:
+               status = AE_BAD_PARAMETER;
+               break;
+       }
+
+      exit:
+       return_ACPI_STATUS(status);
+}
similarity index 91%
rename from drivers/acpi/hardware/hwsleep.c
rename to drivers/acpi/acpica/hwsleep.c
index 25dccdf179b9e4814ca52669f268f4409b34ce6b..a2af2a4f2f268d9116098cf926bc81bd92a915db 100644 (file)
@@ -43,7 +43,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/actables.h>
+#include "accommon.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwsleep")
@@ -52,31 +53,19 @@ ACPI_MODULE_NAME("hwsleep")
  *
  * FUNCTION:    acpi_set_firmware_waking_vector
  *
- * PARAMETERS:  physical_address    - Physical address of ACPI real mode
+ * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
  *                                    entry point.
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
+ * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS
  *
  ******************************************************************************/
 acpi_status
-acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
+acpi_set_firmware_waking_vector(u32 physical_address)
 {
-       struct acpi_table_facs *facs;
-       acpi_status status;
-
        ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
 
-       /* Get the FACS */
-
-       status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
-                                        ACPI_CAST_INDIRECT_PTR(struct
-                                                               acpi_table_header,
-                                                               &facs));
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
 
        /*
         * According to the ACPI specification 2.0c and later, the 64-bit
@@ -85,10 +74,16 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
         * Protected Mode.  Some systems (for example HP dv5-1004nr) are known
         * to fail to resume if the 64-bit vector is used.
         */
-       if (facs->version >= 1)
-               facs->xfirmware_waking_vector = 0;
 
-       facs->firmware_waking_vector = (u32)physical_address;
+       /* Set the 32-bit vector */
+
+       acpi_gbl_FACS->firmware_waking_vector = physical_address;
+
+       /* Clear the 64-bit vector if it exists */
+
+       if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) {
+               acpi_gbl_FACS->xfirmware_waking_vector = 0;
+       }
 
        return_ACPI_STATUS(AE_OK);
 }
@@ -97,48 +92,39 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_get_firmware_waking_vector
+ * FUNCTION:    acpi_set_firmware_waking_vector64
  *
- * PARAMETERS:  *physical_address   - Where the contents of
- *                                    the firmware_waking_vector field of
- *                                    the FACS will be returned.
+ * PARAMETERS:  physical_address    - 64-bit physical address of ACPI protected
+ *                                    mode entry point.
  *
- * RETURN:      Status, vector
+ * RETURN:      Status
  *
- * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
+ * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if
+ *              it exists in the table.
  *
  ******************************************************************************/
-#ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
+acpi_set_firmware_waking_vector64(u64 physical_address)
 {
-       struct acpi_table_facs *facs;
-       acpi_status status;
+       ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
 
-       ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector);
-
-       if (!physical_address) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
 
-       /* Get the FACS */
+       /* Determine if the 64-bit vector actually exists */
 
-       status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
-                                        ACPI_CAST_INDIRECT_PTR(struct
-                                                               acpi_table_header,
-                                                               &facs));
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
+       if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       /* Get the vector */
-       *physical_address = (acpi_physical_address)facs->firmware_waking_vector;
+       /* Clear 32-bit vector, set the 64-bit X_ vector */
+
+       acpi_gbl_FACS->firmware_waking_vector = 0;
+       acpi_gbl_FACS->xfirmware_waking_vector = physical_address;
 
        return_ACPI_STATUS(AE_OK);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector)
-#endif
+ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_prep
similarity index 99%
rename from drivers/acpi/hardware/hwtimer.c
rename to drivers/acpi/acpica/hwtimer.c
index b53d575491b908719643dc7b6f02d7405909d5cb..b7f522c8f023d48686d40d7267196d6d296b6e44 100644 (file)
@@ -43,6 +43,7 @@
  */
 
 #include <acpi/acpi.h>
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwtimer")
similarity index 62%
rename from drivers/acpi/hardware/hwregs.c
rename to drivers/acpi/acpica/hwxface.c
index ddf792adcf9619fe581c9067c06761d8b2780955..ae597c0ab53f38da0feb8cc5716fa6c3e41463c0 100644 (file)
@@ -1,10 +1,9 @@
 
-/*******************************************************************************
+/******************************************************************************
  *
- * Module Name: hwregs - Read/write access functions for the various ACPI
- *                       control and status registers.
+ * Module Name: hwxface - Public ACPICA hardware interfaces
  *
- ******************************************************************************/
+ *****************************************************************************/
 
 /*
  * Copyright (C) 2000 - 2008, Intel Corp.
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acevents.h>
+#include "accommon.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_HARDWARE
-ACPI_MODULE_NAME("hwregs")
+ACPI_MODULE_NAME("hwxface")
 
-/*******************************************************************************
+/******************************************************************************
  *
- * FUNCTION:    acpi_hw_clear_acpi_status
+ * FUNCTION:    acpi_reset
  *
  * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
- * DESCRIPTION: Clears all fixed and general purpose status bits
- *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ * DESCRIPTION: Set reset register in memory or IO space. Note: Does not
+ *              support reset register in PCI config space, this must be
+ *              handled separately.
  *
  ******************************************************************************/
-acpi_status acpi_hw_clear_acpi_status(void)
+acpi_status acpi_reset(void)
 {
+       struct acpi_generic_address *reset_reg;
        acpi_status status;
-       acpi_cpu_flags lock_flags = 0;
-
-       ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
-
-       ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
-                         ACPI_BITMASK_ALL_FIXED_STATUS,
-                         (u16) acpi_gbl_FADT.xpm1a_event_block.address));
 
-       lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
+       ACPI_FUNCTION_TRACE(acpi_reset);
 
-       status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
-                                       ACPI_BITMASK_ALL_FIXED_STATUS);
-       if (ACPI_FAILURE(status)) {
-               goto unlock_and_exit;
-       }
+       reset_reg = &acpi_gbl_FADT.reset_register;
 
-       /* Clear the fixed events */
+       /* Check if the reset register is supported */
 
-       if (acpi_gbl_FADT.xpm1b_event_block.address) {
-               status =
-                   acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
-                                           &acpi_gbl_FADT.xpm1b_event_block);
-               if (ACPI_FAILURE(status)) {
-                       goto unlock_and_exit;
-               }
+       if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
+           !reset_reg->address) {
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       /* Clear the GPE Bits in all GPE registers in all GPE blocks */
+       /* Write the reset value to the reset register */
 
-       status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
-
-      unlock_and_exit:
-       acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
+       status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg);
        return_ACPI_STATUS(status);
 }
 
-/*******************************************************************************
+ACPI_EXPORT_SYMBOL(acpi_reset)
+
+/******************************************************************************
  *
- * FUNCTION:    acpi_get_sleep_type_data
+ * FUNCTION:    acpi_read
  *
- * PARAMETERS:  sleep_state         - Numeric sleep state
- *              *sleep_type_a        - Where SLP_TYPa is returned
- *              *sleep_type_b        - Where SLP_TYPb is returned
+ * PARAMETERS:  Value               - Where the value is returned
+ *              Reg                 - GAS register structure
  *
- * RETURN:      Status - ACPI status
+ * RETURN:      Status
  *
- * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
- *              state.
+ * DESCRIPTION: Read from either memory or IO space.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
+acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)
 {
-       acpi_status status = AE_OK;
-       struct acpi_evaluate_info *info;
-
-       ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data);
-
-       /* Validate parameters */
-
-       if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
+       u32 width;
+       u64 address;
+       acpi_status status;
 
-       /* Allocate the evaluation information block */
+       ACPI_FUNCTION_NAME(acpi_read);
 
-       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
-       if (!info) {
-               return_ACPI_STATUS(AE_NO_MEMORY);
+       /*
+        * Must have a valid pointer to a GAS structure, and
+        * a non-zero address within. However, don't return an error
+        * because the PM1A/B code must not fail if B isn't present.
+        */
+       if (!reg) {
+               return (AE_OK);
        }
 
-       info->pathname =
-           ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
-
-       /* Evaluate the namespace object containing the values for this state */
-
-       status = acpi_ns_evaluate(info);
-       if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "%s while evaluating SleepState [%s]\n",
-                                 acpi_format_exception(status),
-                                 info->pathname));
+       /* Get a local copy of the address. Handles possible alignment issues */
 
-               goto cleanup;
+       ACPI_MOVE_64_TO_64(&address, &reg->address);
+       if (!address) {
+               return (AE_OK);
        }
 
-       /* Must have a return object */
+       /* Supported widths are 8/16/32 */
 
-       if (!info->return_object) {
-               ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
-                           info->pathname));
-               status = AE_NOT_EXIST;
+       width = reg->bit_width;
+       if ((width != 8) && (width != 16) && (width != 32)) {
+               return (AE_SUPPORT);
        }
 
-       /* It must be of type Package */
+       /* Initialize entire 32-bit return value to zero */
 
-       else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) {
-               ACPI_ERROR((AE_INFO,
-                           "Sleep State return object is not a Package"));
-               status = AE_AML_OPERAND_TYPE;
-       }
+       *value = 0;
 
        /*
-        * The package must have at least two elements. NOTE (March 2005): This
-        * goes against the current ACPI spec which defines this object as a
-        * package with one encoded DWORD element. However, existing practice
-        * by BIOS vendors seems to be to have 2 or more elements, at least
-        * one per sleep type (A/B).
+        * Two address spaces supported: Memory or IO.
+        * PCI_Config is not supported here because the GAS struct is insufficient
         */
-       else if (info->return_object->package.count < 2) {
-               ACPI_ERROR((AE_INFO,
-                           "Sleep State return package does not have at least two elements"));
-               status = AE_AML_NO_OPERAND;
-       }
+       switch (reg->space_id) {
+       case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
-       /* The first two elements must both be of type Integer */
+               status = acpi_os_read_memory((acpi_physical_address) address,
+                                            value, width);
+               break;
 
-       else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0])
-                 != ACPI_TYPE_INTEGER) ||
-                (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1])
-                 != ACPI_TYPE_INTEGER)) {
-               ACPI_ERROR((AE_INFO,
-                           "Sleep State return package elements are not both Integers (%s, %s)",
-                           acpi_ut_get_object_type_name(info->return_object->
-                                                        package.elements[0]),
-                           acpi_ut_get_object_type_name(info->return_object->
-                                                        package.elements[1])));
-               status = AE_AML_OPERAND_TYPE;
-       } else {
-               /* Valid _Sx_ package size, type, and value */
+       case ACPI_ADR_SPACE_SYSTEM_IO:
 
-               *sleep_type_a = (u8)
-                   (info->return_object->package.elements[0])->integer.value;
-               *sleep_type_b = (u8)
-                   (info->return_object->package.elements[1])->integer.value;
-       }
+               status =
+                   acpi_os_read_port((acpi_io_address) address, value, width);
+               break;
 
-       if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "While evaluating SleepState [%s], bad Sleep object %p type %s",
-                               info->pathname, info->return_object,
-                               acpi_ut_get_object_type_name(info->
-                                                            return_object)));
+       default:
+               ACPI_ERROR((AE_INFO,
+                           "Unsupported address space: %X", reg->space_id));
+               return (AE_BAD_PARAMETER);
        }
 
-       acpi_ut_remove_reference(info->return_object);
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
+                         *value, width, ACPI_FORMAT_UINT64(address),
+                         acpi_ut_get_region_name(reg->space_id)));
 
-      cleanup:
-       ACPI_FREE(info);
-       return_ACPI_STATUS(status);
+       return (status);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data)
+ACPI_EXPORT_SYMBOL(acpi_read)
 
-/*******************************************************************************
+/******************************************************************************
  *
- * FUNCTION:    acpi_hw_get_register_bit_mask
+ * FUNCTION:    acpi_write
  *
- * PARAMETERS:  register_id         - Index of ACPI Register to access
+ * PARAMETERS:  Value               - To be written
+ *              Reg                 - GAS register structure
  *
- * RETURN:      The bitmask to be used when accessing the register
+ * RETURN:      Status
  *
- * DESCRIPTION: Map register_id into a register bitmask.
+ * DESCRIPTION: Write to either memory or IO space.
  *
  ******************************************************************************/
-struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
+acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
 {
-       ACPI_FUNCTION_ENTRY();
+       u32 width;
+       u64 address;
+       acpi_status status;
 
-       if (register_id > ACPI_BITREG_MAX) {
-               ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X",
-                           register_id));
-               return (NULL);
+       ACPI_FUNCTION_NAME(acpi_write);
+
+       /*
+        * Must have a valid pointer to a GAS structure, and
+        * a non-zero address within. However, don't return an error
+        * because the PM1A/B code must not fail if B isn't present.
+        */
+       if (!reg) {
+               return (AE_OK);
+       }
+
+       /* Get a local copy of the address. Handles possible alignment issues */
+
+       ACPI_MOVE_64_TO_64(&address, &reg->address);
+       if (!address) {
+               return (AE_OK);
+       }
+
+       /* Supported widths are 8/16/32 */
+
+       width = reg->bit_width;
+       if ((width != 8) && (width != 16) && (width != 32)) {
+               return (AE_SUPPORT);
+       }
+
+       /*
+        * Two address spaces supported: Memory or IO.
+        * PCI_Config is not supported here because the GAS struct is insufficient
+        */
+       switch (reg->space_id) {
+       case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+
+               status = acpi_os_write_memory((acpi_physical_address) address,
+                                             value, width);
+               break;
+
+       case ACPI_ADR_SPACE_SYSTEM_IO:
+
+               status = acpi_os_write_port((acpi_io_address) address, value,
+                                           width);
+               break;
+
+       default:
+               ACPI_ERROR((AE_INFO,
+                           "Unsupported address space: %X", reg->space_id));
+               return (AE_BAD_PARAMETER);
        }
 
-       return (&acpi_gbl_bit_register_info[register_id]);
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
+                         value, width, ACPI_FORMAT_UINT64(address),
+                         acpi_ut_get_region_name(reg->space_id)));
+
+       return (status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_write)
+
 /*******************************************************************************
  *
- * FUNCTION:    acpi_get_register
+ * FUNCTION:    acpi_get_register_unlocked
  *
  * PARAMETERS:  register_id     - ID of ACPI bit_register to access
  *              return_value    - Value that was read from the register
@@ -254,17 +252,16 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
  * RETURN:      Status and the value read from specified Register. Value
  *              returned is normalized to bit0 (is shifted all the way right)
  *
- * DESCRIPTION: ACPI bit_register read function.
+ * DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock.
  *
  ******************************************************************************/
-
-acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value)
+acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value)
 {
        u32 register_value = 0;
        struct acpi_bit_register_info *bit_reg_info;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE(acpi_get_register);
+       ACPI_FUNCTION_TRACE(acpi_get_register_unlocked);
 
        /* Get the info structure corresponding to the requested ACPI Register */
 
@@ -296,14 +293,31 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value)
        return_ACPI_STATUS(status);
 }
 
-acpi_status acpi_get_register(u32 register_id, u32 * return_value)
+ACPI_EXPORT_SYMBOL(acpi_get_register_unlocked)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_get_register
+ *
+ * PARAMETERS:  register_id     - ID of ACPI bit_register to access
+ *              return_value    - Value that was read from the register
+ *
+ * RETURN:      Status and the value read from specified Register. Value
+ *              returned is normalized to bit0 (is shifted all the way right)
+ *
+ * DESCRIPTION: ACPI bit_register read function.
+ *
+ ******************************************************************************/
+acpi_status acpi_get_register(u32 register_id, u32 *return_value)
 {
        acpi_status status;
        acpi_cpu_flags flags;
+
        flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
        status = acpi_get_register_unlocked(register_id, return_value);
        acpi_os_release_lock(acpi_gbl_hardware_lock, flags);
-       return status;
+
+       return (status);
 }
 
 ACPI_EXPORT_SYMBOL(acpi_get_register)
@@ -370,8 +384,9 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
                                                   bit_reg_info->
                                                   access_bit_mask);
                if (value) {
-                       status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
-                                                       (u16) value);
+                       status =
+                           acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
+                                                  (u16) value);
                        register_value = 0;
                }
                break;
@@ -459,399 +474,120 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
 
 ACPI_EXPORT_SYMBOL(acpi_set_register)
 
-/******************************************************************************
+/*******************************************************************************
  *
- * FUNCTION:    acpi_hw_register_read
+ * FUNCTION:    acpi_get_sleep_type_data
  *
- * PARAMETERS:  register_id         - ACPI Register ID
- *              return_value        - Where the register value is returned
+ * PARAMETERS:  sleep_state         - Numeric sleep state
+ *              *sleep_type_a        - Where SLP_TYPa is returned
+ *              *sleep_type_b        - Where SLP_TYPb is returned
  *
- * RETURN:      Status and the value read.
+ * RETURN:      Status - ACPI status
  *
- * DESCRIPTION: Read from the specified ACPI register
+ * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
+ *              state.
  *
  ******************************************************************************/
 acpi_status
-acpi_hw_register_read(u32 register_id, u32 * return_value)
+acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
 {
-       u32 value1 = 0;
-       u32 value2 = 0;
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE(hw_register_read);
+       acpi_status status = AE_OK;
+       struct acpi_evaluate_info *info;
 
-       switch (register_id) {
-       case ACPI_REGISTER_PM1_STATUS:  /* 16-bit access */
+       ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data);
 
-               status =
-                   acpi_hw_low_level_read(16, &value1,
-                                          &acpi_gbl_FADT.xpm1a_event_block);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
+       /* Validate parameters */
 
-               /* PM1B is optional */
+       if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
 
-               status =
-                   acpi_hw_low_level_read(16, &value2,
-                                          &acpi_gbl_FADT.xpm1b_event_block);
-               value1 |= value2;
-               break;
+       /* Allocate the evaluation information block */
 
-       case ACPI_REGISTER_PM1_ENABLE:  /* 16-bit access */
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
 
-               status =
-                   acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
+       info->pathname =
+           ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
 
-               /* PM1B is optional */
+       /* Evaluate the namespace object containing the values for this state */
 
-               status =
-                   acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable);
-               value1 |= value2;
-               break;
-
-       case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
-
-               status =
-                   acpi_hw_low_level_read(16, &value1,
-                                          &acpi_gbl_FADT.xpm1a_control_block);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
-
-               status =
-                   acpi_hw_low_level_read(16, &value2,
-                                          &acpi_gbl_FADT.xpm1b_control_block);
-               value1 |= value2;
-               break;
-
-       case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
-
-               status =
-                   acpi_hw_low_level_read(8, &value1,
-                                          &acpi_gbl_FADT.xpm2_control_block);
-               break;
-
-       case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
-
-               status =
-                   acpi_hw_low_level_read(32, &value1,
-                                          &acpi_gbl_FADT.xpm_timer_block);
-               break;
-
-       case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
-
-               status =
-                   acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8);
-               break;
-
-       default:
-               ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id));
-               status = AE_BAD_PARAMETER;
-               break;
-       }
-
-      exit:
-
-       if (ACPI_SUCCESS(status)) {
-               *return_value = value1;
-       }
-
-       return_ACPI_STATUS(status);
-}
-
-/******************************************************************************
- *
- * FUNCTION:    acpi_hw_register_write
- *
- * PARAMETERS:  register_id         - ACPI Register ID
- *              Value               - The value to write
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Write to the specified ACPI register
- *
- * NOTE: In accordance with the ACPI specification, this function automatically
- * preserves the value of the following bits, meaning that these bits cannot be
- * changed via this interface:
- *
- * PM1_CONTROL[0] = SCI_EN
- * PM1_CONTROL[9]
- * PM1_STATUS[11]
- *
- * ACPI References:
- * 1) Hardware Ignored Bits: When software writes to a register with ignored
- *      bit fields, it preserves the ignored bit fields
- * 2) SCI_EN: OSPM always preserves this bit position
- *
- ******************************************************************************/
-
-acpi_status acpi_hw_register_write(u32 register_id, u32 value)
-{
-       acpi_status status;
-       u32 read_value;
-
-       ACPI_FUNCTION_TRACE(hw_register_write);
-
-       switch (register_id) {
-       case ACPI_REGISTER_PM1_STATUS:  /* 16-bit access */
-
-               /* Perform a read first to preserve certain bits (per ACPI spec) */
-
-               status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS,
-                                              &read_value);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
-
-               /* Insert the bits to be preserved */
-
-               ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS,
-                                read_value);
-
-               /* Now we can write the data */
-
-               status =
-                   acpi_hw_low_level_write(16, value,
-                                           &acpi_gbl_FADT.xpm1a_event_block);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
-
-               /* PM1B is optional */
-
-               status =
-                   acpi_hw_low_level_write(16, value,
-                                           &acpi_gbl_FADT.xpm1b_event_block);
-               break;
-
-       case ACPI_REGISTER_PM1_ENABLE:  /* 16-bit access */
-
-               status =
-                   acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
-
-               /* PM1B is optional */
-
-               status =
-                   acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable);
-               break;
-
-       case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
-
-               /*
-                * Perform a read first to preserve certain bits (per ACPI spec)
-                */
-               status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
-                                              &read_value);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
-
-               /* Insert the bits to be preserved */
-
-               ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS,
-                                read_value);
-
-               /* Now we can write the data */
-
-               status =
-                   acpi_hw_low_level_write(16, value,
-                                           &acpi_gbl_FADT.xpm1a_control_block);
-               if (ACPI_FAILURE(status)) {
-                       goto exit;
-               }
-
-               status =
-                   acpi_hw_low_level_write(16, value,
-                                           &acpi_gbl_FADT.xpm1b_control_block);
-               break;
-
-       case ACPI_REGISTER_PM1A_CONTROL:        /* 16-bit access */
-
-               status =
-                   acpi_hw_low_level_write(16, value,
-                                           &acpi_gbl_FADT.xpm1a_control_block);
-               break;
-
-       case ACPI_REGISTER_PM1B_CONTROL:        /* 16-bit access */
-
-               status =
-                   acpi_hw_low_level_write(16, value,
-                                           &acpi_gbl_FADT.xpm1b_control_block);
-               break;
-
-       case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
-
-               status =
-                   acpi_hw_low_level_write(8, value,
-                                           &acpi_gbl_FADT.xpm2_control_block);
-               break;
-
-       case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
-
-               status =
-                   acpi_hw_low_level_write(32, value,
-                                           &acpi_gbl_FADT.xpm_timer_block);
-               break;
-
-       case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
-
-               /* SMI_CMD is currently always in IO space */
-
-               status =
-                   acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8);
-               break;
+       status = acpi_ns_evaluate(info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "%s while evaluating SleepState [%s]\n",
+                                 acpi_format_exception(status),
+                                 info->pathname));
 
-       default:
-               status = AE_BAD_PARAMETER;
-               break;
+               goto cleanup;
        }
 
-      exit:
-       return_ACPI_STATUS(status);
-}
-
-/******************************************************************************
- *
- * FUNCTION:    acpi_hw_low_level_read
- *
- * PARAMETERS:  Width               - 8, 16, or 32
- *              Value               - Where the value is returned
- *              Reg                 - GAS register structure
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Read from either memory or IO space.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
-{
-       u64 address;
-       acpi_status status;
-
-       ACPI_FUNCTION_NAME(hw_low_level_read);
+       /* Must have a return object */
 
-       /*
-        * Must have a valid pointer to a GAS structure, and
-        * a non-zero address within. However, don't return an error
-        * because the PM1A/B code must not fail if B isn't present.
-        */
-       if (!reg) {
-               return (AE_OK);
+       if (!info->return_object) {
+               ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
+                           info->pathname));
+               status = AE_NOT_EXIST;
        }
 
-       /* Get a local copy of the address. Handles possible alignment issues */
+       /* It must be of type Package */
 
-       ACPI_MOVE_64_TO_64(&address, &reg->address);
-       if (!address) {
-               return (AE_OK);
+       else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) {
+               ACPI_ERROR((AE_INFO,
+                           "Sleep State return object is not a Package"));
+               status = AE_AML_OPERAND_TYPE;
        }
-       *value = 0;
 
        /*
-        * Two address spaces supported: Memory or IO.
-        * PCI_Config is not supported here because the GAS struct is insufficient
+        * The package must have at least two elements. NOTE (March 2005): This
+        * goes against the current ACPI spec which defines this object as a
+        * package with one encoded DWORD element. However, existing practice
+        * by BIOS vendors seems to be to have 2 or more elements, at least
+        * one per sleep type (A/B).
         */
-       switch (reg->space_id) {
-       case ACPI_ADR_SPACE_SYSTEM_MEMORY:
-
-               status = acpi_os_read_memory((acpi_physical_address) address,
-                                            value, width);
-               break;
-
-       case ACPI_ADR_SPACE_SYSTEM_IO:
-
-               status =
-                   acpi_os_read_port((acpi_io_address) address, value, width);
-               break;
-
-       default:
+       else if (info->return_object->package.count < 2) {
                ACPI_ERROR((AE_INFO,
-                           "Unsupported address space: %X", reg->space_id));
-               return (AE_BAD_PARAMETER);
+                           "Sleep State return package does not have at least two elements"));
+               status = AE_AML_NO_OPERAND;
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_IO,
-                         "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-                         *value, width, ACPI_FORMAT_UINT64(address),
-                         acpi_ut_get_region_name(reg->space_id)));
-
-       return (status);
-}
-
-/******************************************************************************
- *
- * FUNCTION:    acpi_hw_low_level_write
- *
- * PARAMETERS:  Width               - 8, 16, or 32
- *              Value               - To be written
- *              Reg                 - GAS register structure
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Write to either memory or IO space.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
-{
-       u64 address;
-       acpi_status status;
-
-       ACPI_FUNCTION_NAME(hw_low_level_write);
-
-       /*
-        * Must have a valid pointer to a GAS structure, and
-        * a non-zero address within. However, don't return an error
-        * because the PM1A/B code must not fail if B isn't present.
-        */
-       if (!reg) {
-               return (AE_OK);
-       }
+       /* The first two elements must both be of type Integer */
 
-       /* Get a local copy of the address. Handles possible alignment issues */
+       else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0])
+                 != ACPI_TYPE_INTEGER) ||
+                (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1])
+                 != ACPI_TYPE_INTEGER)) {
+               ACPI_ERROR((AE_INFO,
+                           "Sleep State return package elements are not both Integers (%s, %s)",
+                           acpi_ut_get_object_type_name(info->return_object->
+                                                        package.elements[0]),
+                           acpi_ut_get_object_type_name(info->return_object->
+                                                        package.elements[1])));
+               status = AE_AML_OPERAND_TYPE;
+       } else {
+               /* Valid _Sx_ package size, type, and value */
 
-       ACPI_MOVE_64_TO_64(&address, &reg->address);
-       if (!address) {
-               return (AE_OK);
+               *sleep_type_a = (u8)
+                   (info->return_object->package.elements[0])->integer.value;
+               *sleep_type_b = (u8)
+                   (info->return_object->package.elements[1])->integer.value;
        }
 
-       /*
-        * Two address spaces supported: Memory or IO.
-        * PCI_Config is not supported here because the GAS struct is insufficient
-        */
-       switch (reg->space_id) {
-       case ACPI_ADR_SPACE_SYSTEM_MEMORY:
-
-               status = acpi_os_write_memory((acpi_physical_address) address,
-                                             value, width);
-               break;
-
-       case ACPI_ADR_SPACE_SYSTEM_IO:
-
-               status = acpi_os_write_port((acpi_io_address) address, value,
-                                           width);
-               break;
-
-       default:
-               ACPI_ERROR((AE_INFO,
-                           "Unsupported address space: %X", reg->space_id));
-               return (AE_BAD_PARAMETER);
+       if (ACPI_FAILURE(status)) {
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "While evaluating SleepState [%s], bad Sleep object %p type %s",
+                               info->pathname, info->return_object,
+                               acpi_ut_get_object_type_name(info->
+                                                            return_object)));
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_IO,
-                         "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-                         value, width, ACPI_FORMAT_UINT64(address),
-                         acpi_ut_get_region_name(reg->space_id)));
+       acpi_ut_remove_reference(info->return_object);
 
-       return (status);
+      cleanup:
+       ACPI_FREE(info);
+       return_ACPI_STATUS(status);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data)
similarity index 98%
rename from drivers/acpi/namespace/nsaccess.c
rename to drivers/acpi/acpica/nsaccess.c
index c39a7f68b88929adb1fd86c94c6db3922b6a0829..88303ebe924cb7c5ec6167127edfe2cabae0923a 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acdispat.h>
+#include "accommon.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdispat.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsaccess")
@@ -165,11 +166,8 @@ acpi_status acpi_ns_root_initialize(void)
 
                                obj_desc->method.method_flags =
                                    AML_METHOD_INTERNAL_ONLY;
-
-#ifndef ACPI_DUMP_APP
                                obj_desc->method.implementation =
                                    acpi_ut_osi_implementation;
-#endif
 #endif
                                break;
 
@@ -521,11 +519,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
        }
 
        /*
-        * Search namespace for each segment of the name.  Loop through and
+        * Search namespace for each segment of the name. Loop through and
         * verify (or add to the namespace) each name segment.
         *
         * The object type is significant only at the last name
-        * segment.  (We don't care about the types along the path, only
+        * segment. (We don't care about the types along the path, only
         * the type of the final target object.)
         */
        this_search_type = ACPI_TYPE_ANY;
@@ -591,6 +589,10 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                         * segments).
                         */
                        if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) {
+                               if (!this_node->object) {
+                                       return_ACPI_STATUS(AE_NOT_EXIST);
+                               }
+
                                if (acpi_ns_opens_scope
                                    (((struct acpi_namespace_node *)this_node->
                                      object)->type)) {
similarity index 99%
rename from drivers/acpi/namespace/nsalloc.c
rename to drivers/acpi/acpica/nsalloc.c
index 3a1740ac2edcc012a7b51eabe889e03c3bd637d4..f976d848fe8241c0845ad4063d8a86c554aaefec 100644 (file)
@@ -42,7 +42,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsalloc")
similarity index 99%
rename from drivers/acpi/namespace/nsdump.c
rename to drivers/acpi/acpica/nsdump.c
index cc0ae39440e4358838626c73c63d43ccc8e15d01..0da33c8e9ba272d99979e80fd26ccb30255cb21b 100644 (file)
@@ -42,7 +42,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsdump")
similarity index 99%
rename from drivers/acpi/namespace/nsdumpdv.c
rename to drivers/acpi/acpica/nsdumpdv.c
index 428f50fde11a8cbe876d2a130e7cc09b791df75f..41994fe7fbb8a20c95e4505ad6878938a5381a7f 100644 (file)
@@ -42,6 +42,7 @@
  */
 
 #include <acpi/acpi.h>
+#include "accommon.h"
 
 /* TBD: This entire module is apparently obsolete and should be removed */
 
@@ -49,7 +50,7 @@
 ACPI_MODULE_NAME("nsdumpdv")
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-#include <acpi/acnamesp.h>
+#include "acnamesp.h"
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_one_device
similarity index 81%
rename from drivers/acpi/namespace/nseval.c
rename to drivers/acpi/acpica/nseval.c
index 4cdf03ac2b467803189d97e8c5b7d11feabc073e..0f3d5f9b59664f1aff2540606bb51660ef8b5328 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acparser.h>
-#include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acparser.h"
+#include "acinterp.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nseval")
@@ -89,6 +90,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
        /* Initialize the return value to an invalid object */
 
        info->return_object = NULL;
+       info->param_count = 0;
 
        /*
         * Get the actual namespace node for the target object. Handles these cases:
@@ -141,41 +143,17 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
                        return_ACPI_STATUS(AE_NULL_OBJECT);
                }
 
-               /*
-                * Calculate the number of arguments being passed to the method
-                */
+               /* Count the number of arguments being passed to the method */
 
-               info->param_count = 0;
                if (info->parameters) {
-                       while (info->parameters[info->param_count])
+                       while (info->parameters[info->param_count]) {
+                               if (info->param_count > ACPI_METHOD_MAX_ARG) {
+                                       return_ACPI_STATUS(AE_LIMIT);
+                               }
                                info->param_count++;
+                       }
                }
 
-               /*
-                * Warning if too few or too many arguments have been passed by the
-                * caller. We don't want to abort here with an error because an
-                * incorrect number of arguments may not cause the method to fail.
-                * However, the method will fail if there are too few arguments passed
-                * and the method attempts to use one of the missing ones.
-                */
-
-               if (info->param_count < info->obj_desc->method.param_count) {
-                       ACPI_WARNING((AE_INFO,
-                                   "Insufficient arguments - "
-                                   "method [%4.4s] needs %d, found %d",
-                                   acpi_ut_get_node_name(info->resolved_node),
-                                   info->obj_desc->method.param_count,
-                                   info->param_count));
-               } else if (info->param_count >
-                               info->obj_desc->method.param_count) {
-                       ACPI_WARNING((AE_INFO,
-                                     "Excess arguments - "
-                                     "method [%4.4s] needs %d, found %d",
-                                     acpi_ut_get_node_name(info->
-                                                           resolved_node),
-                                     info->obj_desc->method.param_count,
-                                     info->param_count));
-               }
 
                ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:",
                                   ACPI_LV_INFO, _COMPONENT);
@@ -264,32 +242,13 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
                }
        }
 
-       /* Validation of return values for ACPI-predefined methods and objects */
-
-       if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) {
-               /*
-                * If this is the first evaluation, check the return value. This
-                * ensures that any warnings will only be emitted during the very
-                * first evaluation of the object.
-                */
-               if (!(node->flags & ANOBJ_EVALUATED)) {
-                       /*
-                        * Check for a predefined ACPI name. If found, validate the
-                        * returned object.
-                        *
-                        * Note: Ignore return status for now, emit warnings if there are
-                        * problems with the returned object. May change later to abort
-                        * the method on invalid return object.
-                        */
-                       (void)acpi_ns_check_predefined_names(node,
-                                                            info->
-                                                            return_object);
-               }
-
-               /* Mark the node as having been evaluated */
-
-               node->flags |= ANOBJ_EVALUATED;
-       }
+       /*
+        * Check input argument count against the ASL-defined count for a method.
+        * Also check predefined names: argument count and return value against
+        * the ACPI specification. Some incorrect return value types are repaired.
+        */
+       (void)acpi_ns_check_predefined_names(node, info->param_count,
+               status, &info->return_object);
 
        /* Check if there is a return value that must be dealt with */
 
similarity index 99%
rename from drivers/acpi/namespace/nsinit.c
rename to drivers/acpi/acpica/nsinit.c
index e4c57510d798753cd8366f4a2fbbaecb4d545450..13501cb81863b329f9aaa30dfe5a90e1a7c1d79f 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acdispat.h>
-#include <acpi/acinterp.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acdispat.h"
+#include "acinterp.h"
 #include <linux/nmi.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
similarity index 99%
rename from drivers/acpi/namespace/nsload.c
rename to drivers/acpi/acpica/nsload.c
index a4a412b7c029526faabd771b3742fd65db3ba7a3..a0ba9e12379efa250728e801a6f2eec1ec649401 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acdispat.h>
-#include <acpi/actables.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acdispat.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsload")
similarity index 99%
rename from drivers/acpi/namespace/nsnames.c
rename to drivers/acpi/acpica/nsnames.c
index 42a39a7c96e913a519e6b1bf7b5a79d152dd4a4d..ae3dc10a7e817c4c9f11d7c5d6549e7cff2e0f61 100644 (file)
@@ -42,8 +42,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "amlcode.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsnames")
similarity index 99%
rename from drivers/acpi/namespace/nsobject.c
rename to drivers/acpi/acpica/nsobject.c
index 15fe09e24f71ef3698ac25824c91b5849e567bf3..08a97a57f8f985c998dc5b8c926fab0a6e954093 100644 (file)
@@ -43,7 +43,8 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
+#include "accommon.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsobject")
similarity index 98%
rename from drivers/acpi/namespace/nsparse.c
rename to drivers/acpi/acpica/nsparse.c
index a82271a9dbb3d5b42495f7f10a809313730fc1c3..b9e8d0070b6f0049d9a96b4887237d70ed690609 100644 (file)
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
-#include <acpi/acdispat.h>
-#include <acpi/actables.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsparse")
similarity index 76%
rename from drivers/acpi/namespace/nspredef.c
rename to drivers/acpi/acpica/nspredef.c
index 0f17cf0898c9a564d9e5357838dbdae06efb4a09..452703290d35e81bff9b98d4c706520c5c0a64a8 100644 (file)
@@ -43,8 +43,9 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acpredef.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acpredef.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nspredef")
@@ -72,7 +73,7 @@ ACPI_MODULE_NAME("nspredef")
 /* Local prototypes */
 static acpi_status
 acpi_ns_check_package(char *pathname,
-                     union acpi_operand_object *return_object,
+                     union acpi_operand_object **return_object_ptr,
                      const union acpi_predefined_info *predefined);
 
 static acpi_status
@@ -82,13 +83,18 @@ acpi_ns_check_package_elements(char *pathname,
 
 static acpi_status
 acpi_ns_check_object_type(char *pathname,
-                         union acpi_operand_object *return_object,
+                         union acpi_operand_object **return_object_ptr,
                          u32 expected_btypes, u32 package_index);
 
 static acpi_status
 acpi_ns_check_reference(char *pathname,
                        union acpi_operand_object *return_object);
 
+static acpi_status
+acpi_ns_repair_object(u32 expected_btypes,
+                     u32 package_index,
+                     union acpi_operand_object **return_object_ptr);
+
 /*
  * Names for the types that can be returned by the predefined objects.
  * Used for warning messages. Must be in the same order as the ACPI_RTYPEs
@@ -108,8 +114,8 @@ static const char *acpi_rtype_names[] = {
  * FUNCTION:    acpi_ns_check_predefined_names
  *